Quellcode durchsuchen

Remove intermediate variable (-48 bytes)

tags/v1.2.0
Bertrand Lemasle vor 6 Jahren
Ursprung
Commit
5498b9ae67
1 geänderte Dateien mit 4 neuen und 5 gelöschten Zeilen
  1. +4
    -5
      Core.cpp

+ 4
- 5
Core.cpp Datei anzeigen

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


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

sleepTime = mapSleepTime(velocity);


if (velocity < SLEEP_TIMING_MIN_MOVING_VELOCITY) { if (velocity < SLEEP_TIMING_MIN_MOVING_VELOCITY) {
float distance = gps::getDistanceFromPrevious(); //did we missed positions because we were sleeping ? 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 else stoppedInARow = min(stoppedInARow + 1, SLEEP_DEFAULT_STOPPED_THRESHOLD + 1); //avoid overflow on REALLY long stops


if (stoppedInARow < SLEEP_DEFAULT_STOPPED_THRESHOLD) { 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 if (stoppedInARow == SLEEP_DEFAULT_STOPPED_THRESHOLD) goingLongSleep = true;
} }
else stoppedInARow = 0; else stoppedInARow = 0;


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

return goingLongSleep; return goingLongSleep;
} }




Laden…
Abbrechen
Speichern