@@ -13,7 +13,7 @@ namespace core { | |||||
PositionEntryMetadata metadata; | PositionEntryMetadata metadata; | ||||
if (positions::acquire(metadata)) { | if (positions::acquire(metadata)) { | ||||
positions::appendLast(metadata); | positions::appendLast(metadata); | ||||
updateSleepTime(); | |||||
setSleepTime(); | |||||
} | } | ||||
if (positions::needsToSend()) { | 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) { | void setSleepTime(uint8_t velocity) { | ||||
@@ -15,5 +15,5 @@ namespace core { | |||||
void main(); | void main(); | ||||
void setSleepTime(uint8_t velocity); | void setSleepTime(uint8_t velocity); | ||||
void updateSleepTime(); | |||||
void setSleepTime(); | |||||
} | } |
@@ -44,10 +44,13 @@ namespace gps { | |||||
return currentStatus; | return currentStatus; | ||||
} | } | ||||
void getVelocity(uint8_t &velocity) { | |||||
uint8_t getVelocity() { | |||||
uint8_t velocity; | |||||
hardware::sim808::device.getGpsField(lastPosition, SIM808_GPS_FIELD::SPEED, &velocity); | hardware::sim808::device.getGpsField(lastPosition, SIM808_GPS_FIELD::SPEED, &velocity); | ||||
VERBOSE_FORMAT("getVelocity", "%d", velocity); | VERBOSE_FORMAT("getVelocity", "%d", velocity); | ||||
return velocity; | |||||
} | } | ||||
void getTime(tmElements_t &time) { | void getTime(tmElements_t &time) { | ||||
@@ -17,6 +17,6 @@ namespace gps { | |||||
SIM808_GPS_STATUS acquireCurrentPosition(uint16_t timeout); | SIM808_GPS_STATUS acquireCurrentPosition(uint16_t timeout); | ||||
void getVelocity(uint8_t &velocity); | |||||
uint8_t getVelocity(); | |||||
void getTime(tmElements_t &time); | void getTime(tmElements_t &time); | ||||
} | } |