Improve stat trigger
improvement of the detection of the altitude to trigger stopping statistics
This commit is contained in:
parent
299e6c9f6d
commit
d27229ad08
@ -1021,10 +1021,11 @@ 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_temp + ALTI_TRIGGER < Altitude || altitude_temp - ALTI_TRIGGER > Altitude) {
|
||||||
resetStat();
|
resetStat();
|
||||||
DateTime now = rtc.now();
|
DateTime now = rtc.now();
|
||||||
stat.chrono_start = now.unixtime();
|
stat.chrono_start = now.unixtime();
|
||||||
|
chrono_cpt = 0;
|
||||||
}
|
}
|
||||||
else { // every 15 seconds, the altitude "zone" is updated
|
else { // every 15 seconds, the altitude "zone" is updated
|
||||||
chrono_cpt++;
|
chrono_cpt++;
|
||||||
@ -1035,8 +1036,8 @@ void loop()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (stat.chrono_start != 0 && stat.chrono == 0) {
|
if (stat.chrono_start != 0 && stat.chrono == 0) {
|
||||||
// if altitude left in the same "zone" (2 meters) during 15 seconds, the timer is stopped
|
// if altitude left in the same "zone" (1.5 meters) during 15 seconds, the timer is stopped
|
||||||
if (altitude_temp - 1 <= Altitude && altitude_temp + 1 >= Altitude) {
|
if (altitude_temp - 0.75 < Altitude && altitude_temp + 0.75 > Altitude) {
|
||||||
chrono_cpt++;
|
chrono_cpt++;
|
||||||
if (chrono_cpt >= 15) {
|
if (chrono_cpt >= 15) {
|
||||||
DateTime now = rtc.now();
|
DateTime now = rtc.now();
|
||||||
|
Loading…
Reference in New Issue
Block a user