arduino version have a non atomic Timer implementation and block publish forever sometimes
pat1 opened this issue · comments
Paolo Patruno commented
The timer is not atomic as used in the library
first is called timer.expired() and after timer.left_ms()
so sometimes when time left is small timer.left_ms() return a very big value.
I think the best solution is to make timer atomic
as below:
int left_ms()
{
unsigned long now=millis();
if(now >= interval_end_ms){
return 0;
}else{
return interval_end_ms - now;
}
}