minor fix

This commit is contained in:
Joerg Lehmann 2019-11-22 08:07:45 +01:00
parent 54460724db
commit 0b493ffa56
1 changed files with 5 additions and 4 deletions

View File

@ -698,10 +698,11 @@ void StartNewIteration() {
}
}
uint32_t sleep_time_sec;
if ((wait_time + 2) < CATCFG_T_INTERVAL) {
sleep_time_sec = CATCFG_T_INTERVAL - wait_time - 2;
if (wait_time < CATCFG_T_INTERVAL) {
sleep_time_sec = CATCFG_T_INTERVAL - wait_time;
} else {
sleep_time_sec = 0;
// minimal sleep time is 5 seconds
sleep_time_sec = 5;
}
if (!fUsbPower) {
DoDeepSleep(sleep_time_sec);
@ -711,7 +712,7 @@ void StartNewIteration() {
startNewIterationCb);
}
else {
gCatena.SafePrintf("%010d - light sleep; os_setTimedCallback for startNewIterationCb in %d...\n", millis(), CATCFG_T_INTERVAL);
gCatena.SafePrintf("%010d - light sleep; os_setTimedCallback for startNewIterationCb in %d...\n", millis(), sleep_time_sec);
os_setTimedCallback(
&iterationJob,
os_getTime() + sec2osticks(sleep_time_sec),