Closed menuet88 closed 3 years ago
Working on it. Sorry for the delay
Hello, I already solve this issue in my local clone of your project. The problem was with multiplying sleep and wake time to 64bits number. I was thinking why you set the timers to run so fast (if I well remember it was about 1 or 10MHz). I decreased the timebase for the timers to get one cycle in 10ms and then the problem with multiplying was not visible.
Second issue with not returning 0 time I resolved with this code (runs after stopping the timer):
ESP_ERROR_CHECK(timer_pause(TIMERGROUP, sleepTimer)); //reset timer, because getSleep return high values after expire ESP_ERROR_CHECK(timer_set_counter_value(TIMERGROUP, sleepTimer, 0x00000000ULL)); ESP_ERROR_CHECK(timer_set_alarm_value(TIMERGROUP, sleepTimer,0x00000000ULL));
Best regards, Menuet88
Yes, i found it too. The wrong calcul is resolved by
Yes, it run too fast for the use, but i was lazy to change it ;-)
And now counter and alarm are set to 0 when stopped like you.
It is in the 2.1 R1 now.
I observed issue with cli.sleep("xxx") and cli.wake("xxx") commands. When the parameter is lower than 15 (it means 15 minutes) then everything is ok, but when value is higher or equal 15 time calculations is wrong.
Ok example:
cli.wake("14")
#Wake in 839 s##
Failed example:cli.wake("20")
#Wake in 341 s##
The strange thing is value on web UI is displayed correctly - 20minutes means 1200 seconds. Also setting these values from web gives correct values in seconds in terminal. Also after sleep time elapsed the value from command cli.sleep is strange:
#Sleep in 3689348813401 s##
and is counting down.Sorry, one more edit: When sleep timer was started previously and after command
cli.sleep("0")
the timer is stopped, but value in terminal is not zero but last counted value. On web UI the remaning time goes to zero like it should be.