-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Your debounce code at https://github.com/hackhitchin/esp8266-co-uk/blob/master/tutorials/introduction-to-gpio-api.md was (indirectly) discussed at http://www.esp8266.com/viewtopic.php?f=24&t=4833&start=5#p29127. It essentially says
tmr.now() rolls over at 2147 seconds - the NodeMCU API page indicates uint31, not uint32, which means it wraps to zero when it reaches the max value for int32. The value (now - last) will be negative when (last) gets really big and (now) wraps around.
And it goes on to propose adding if delta < 0 then delta = delta + 2147483647 end; as a remedy.
-> https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en#tmrnow
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels