Browse Source

use same time measure for whole function

should have minor impact, but use same time value for all computation.
master
Marc Poulhiès 4 years ago
parent
commit
8d34196a15
  1. 6
      arduino/startracker.ino

6
arduino/startracker.ino

@ -210,18 +210,20 @@ static void handle_active_timer(void){
Serial.print("Timer: ");
Serial.println(active_timer.remain);
#endif
unsigned long current_time = millis();
if (active_timer.deadline){
active_timer.remain = active_timer.deadline - millis();
active_timer.remain = active_timer.deadline - current_time;
} else {
return;
}
if (active_timer.remain <= active_threshold) {
active_timer.remain = active_timer.period;
active_timer.deadline = millis() + active_timer.period;
active_timer.deadline = current_time + active_timer.period;
active_timer.expired++;
loop_count++;
#if DEBUG
Serial.println("Timer expired");
Serial.println(active_timer.expired);

Loading…
Cancel
Save