Parcourir la source

Remove intermediate variable (-48 bytes)

tags/v1.2.0
Bertrand Lemasle il y a 6 ans
Parent
révision
5498b9ae67
1 fichiers modifiés avec 4 ajouts et 5 suppressions
  1. +4
    -5
      Core.cpp

+ 4
- 5
Core.cpp Voir le fichier

@@ -95,9 +95,10 @@ namespace core {
}

bool updateSleepTime() {
uint8_t velocity = gps::getVelocity();
uint16_t result = mapSleepTime(velocity);
bool goingLongSleep = false;
uint8_t velocity = gps::getVelocity();

sleepTime = mapSleepTime(velocity);

if (velocity < SLEEP_TIMING_MIN_MOVING_VELOCITY) {
float distance = gps::getDistanceFromPrevious(); //did we missed positions because we were sleeping ?
@@ -105,15 +106,13 @@ namespace core {
else stoppedInARow = min(stoppedInARow + 1, SLEEP_DEFAULT_STOPPED_THRESHOLD + 1); //avoid overflow on REALLY long stops

if (stoppedInARow < SLEEP_DEFAULT_STOPPED_THRESHOLD) {
result = SLEEP_DEFAULT_PAUSING_TIME_SECONDS;
sleepTime = SLEEP_DEFAULT_PAUSING_TIME_SECONDS;
}
else if (stoppedInARow == SLEEP_DEFAULT_STOPPED_THRESHOLD) goingLongSleep = true;
}
else stoppedInARow = 0;

sleepTime = result;
NOTICE_FORMAT("updateSleepTime", "%dkmh => %d seconds", velocity, sleepTime);

return goingLongSleep;
}



Chargement…
Annuler
Enregistrer