Fixed a bug on the stat trigger.

This commit is contained in:
sinseman
2014-08-29 15:38:22 +02:00
parent 0c85b18911
commit cbc5444fdb

View File

@@ -299,7 +299,7 @@ void renderVario()
display.print(conf.stat_index + 1); display.print(conf.stat_index + 1);
display.print(F(" ")); display.print(F(" "));
renderChrono(); renderChrono();
display.display(); display.display();
} }
@@ -926,13 +926,6 @@ void loop()
if (millis() >= (get_time1 + 67)) if (millis() >= (get_time1 + 67))
{ {
get_time1 = millis(); get_time1 = millis();
/*
if (stat.chrono_start != 0 && stat.chrono == 0) {
if (altitude_temp - ALTI_TRIGGER / 2 > Altitude || altitude_temp + ALTI_TRIGGER / 2 < Altitude) {
chrono_cpt = 0;
altitude_temp = Altitude;
}
}*/
// update vario bar // update vario bar
if (varioState == true) if (varioState == true)
@@ -984,7 +977,7 @@ void loop()
// if the altitude out of his "zone", the timer is started // if the altitude out of his "zone", the timer is started
//if (stat.chrono_start == 0) { if (stat.chrono_start == 0) {
if (Altitude > altitude_temp + ALTI_TRIGGER || Altitude < altitude_temp - ALTI_TRIGGER) { if (Altitude > altitude_temp + ALTI_TRIGGER || Altitude < altitude_temp - ALTI_TRIGGER) {
resetStat(); resetStat();
DateTime now = rtc.now(); DateTime now = rtc.now();
@@ -997,10 +990,10 @@ void loop()
altitude_temp = Altitude; altitude_temp = Altitude;
} }
} }
//} }
if (stat.chrono_start != 0 && stat.chrono == 0) { if (stat.chrono_start != 0 && stat.chrono == 0) {
// if left in the same altitude "zone" 15 seconds, the timer is stopped // if altitude left in the same "zone" (2 meters) during 15 seconds, the timer is stopped
if (altitude_temp - ALTI_TRIGGER / 2 < Altitude && altitude_temp + ALTI_TRIGGER / 2 > Altitude) { if (altitude_temp - 1 < Altitude && altitude_temp + 1 > Altitude) {
chrono_cpt++; chrono_cpt++;
if (chrono_cpt >= 15) { if (chrono_cpt >= 15) {
DateTime now = rtc.now(); DateTime now = rtc.now();