-->
Page 1 of 1

tmr interval bug 12884901 6871948

PostPosted: Sun May 01, 2016 11:41 am
by stevemac00
I need a tmr with large values to accommodate a necessary off function for relay.

This comment is in https://nodemcu.readthedocs.io/en/dev/en/modules/tmr/
timer interval in milliseconds. Maximum value is 12884901. In SDKs <= 1.5.0 values >6871948 result in incorrect behaviour.

However, when I downloaded 1.5.1 dev and built/flashed, I found the "bug" is still there.
For example, this code finishes immediately:
Code: Select alltmr.alarm(0,12600000,0,function() print("\nDone\n") end)

Can anyone tell me the status of this issue? ( I realize I can work around with breaking it up into multiples with intermediate functions but I'd like to clean up if I can.)

Re: tmr interval bug 12884901 6871948

PostPosted: Wed May 04, 2016 7:44 am
by stevemac00
Here's what I empirically determined:
Internally the mS value is multiplied by 1000 to be uS. This means a 32-bit signed integer has a maximum value of 0X7FFFFFF / 1000 or 2147483. This doesn't seem to be documented anywhere so there's a chance I'm incorrect . However, I'm sure this statement in the documentation is wrong:
interval_ms timer interval in milliseconds. Maximum value is 12884901. In SDKs <= 1.5.0 values >6871948 result in incorrect behaviour.

Re: tmr interval bug 12884901 6871948

PostPosted: Fri May 06, 2016 10:30 pm
by dnc40085
interval_ms timer interval in milliseconds. Maximum value is 12884901. In SDKs <= 1.5.0 values >6871948 result in incorrect behaviour.

stevemac00 is right. the documentation has a typo, it should be " In SDKs >= 1.5.0" instead of " In SDKs <= 1.5.0"