diff --git a/GpsTracker/Core.cpp b/GpsTracker/Core.cpp index 6a75538..d6461a3 100644 --- a/GpsTracker/Core.cpp +++ b/GpsTracker/Core.cpp @@ -13,7 +13,7 @@ namespace core { PositionEntryMetadata metadata; if (positions::acquire(metadata)) { positions::appendLast(metadata); - updateSleepTime(); + setSleepTime(); } if (positions::needsToSend()) { @@ -21,12 +21,8 @@ namespace core { } } - void updateSleepTime() { - VERBOSE("updateSleepTime"); - - uint8_t velocity; - gps::getVelocity(velocity); - setSleepTime(velocity); + void setSleepTime() { + setSleepTime(gps::getVelocity()); } void setSleepTime(uint8_t velocity) { diff --git a/GpsTracker/Core.h b/GpsTracker/Core.h index 509976e..78172ab 100644 --- a/GpsTracker/Core.h +++ b/GpsTracker/Core.h @@ -15,5 +15,5 @@ namespace core { void main(); void setSleepTime(uint8_t velocity); - void updateSleepTime(); + void setSleepTime(); } \ No newline at end of file diff --git a/GpsTracker/Gps.cpp b/GpsTracker/Gps.cpp index 1d047f9..cbe80c8 100644 --- a/GpsTracker/Gps.cpp +++ b/GpsTracker/Gps.cpp @@ -44,10 +44,13 @@ namespace gps { return currentStatus; } - void getVelocity(uint8_t &velocity) { + uint8_t getVelocity() { + uint8_t velocity; hardware::sim808::device.getGpsField(lastPosition, SIM808_GPS_FIELD::SPEED, &velocity); VERBOSE_FORMAT("getVelocity", "%d", velocity); + + return velocity; } void getTime(tmElements_t &time) { diff --git a/GpsTracker/Gps.h b/GpsTracker/Gps.h index bb231ec..f5be055 100644 --- a/GpsTracker/Gps.h +++ b/GpsTracker/Gps.h @@ -17,6 +17,6 @@ namespace gps { SIM808_GPS_STATUS acquireCurrentPosition(uint16_t timeout); - void getVelocity(uint8_t &velocity); + uint8_t getVelocity(); void getTime(tmElements_t &time); } \ No newline at end of file