-->
Page 1 of 2

node.dsleep results in immediately reboot

PostPosted: Mon Mar 07, 2016 10:52 am
by willwach
I'm trying to use the node.dsleep.

Code: Select allfunction startup()
    if abort == true then
        print('startup aborted')
        return
        end
    print('in startup')

    node.dsleep(60000)
    end

abort = false
tmr.alarm(0,5000,tmr.ALARM_SINGLE,startup)


Timer works as expected and waits 5second before startup.
But after starting it results in an unreadable error message and rebooting again and again.

I'm using the development firmware build by frightanic.com
branch: master
commit: c8037568571edb5c568c2f8231e4f8ce0683b883
SSL: true
modules: bmp085,dht,enduser_setup,file,gpio,i2c,mqtt,net,node,ow,tmr,uart,wifi
build built on: 2016-02-14 13:27
powered by Lua 5.1.4 on SDK 1.4.0

Any ideas?

Man y thanks,
Marc

the message i get in ESPlorer every 5 seconds

PostPosted: Mon Mar 07, 2016 10:56 am
by willwach
Code: Select all
NodeMCU custom build by frightanic.com
   branch: master
   commit: c8037568571edb5c568c2f8231e4f8ce0683b883
   SSL: true
   modules: bmp085,dht,enduser_setup,file,gpio,i2c,mqtt,net,node,ow,tmr,uart,wifi
 build    built on: 2016-02-14 13:27
 powered by Lua 5.1.4 on SDK 1.4.0
> in startup
 �~?�4�!��I�O�:�COAE�����aR

NodeMCU custom build by frightanic.com
   branch: master
   commit: c8037568571edb5c568c2f8231e4f8ce0683b883
   SSL: true
   modules: bmp085,dht,enduser_setup,file,gpio,i2c,mqtt,net,node,ow,tmr,uart,wifi
 build    built on: 2016-02-14 13:27
 powered by Lua 5.1.4 on SDK 1.4.0
> in startup
0�~�4�!��Y�O�:�COAE�����aR

NodeMCU custom build by frightanic.com
   branch: master
   commit: c8037568571edb5c568c2f8231e4f8ce0683b883
   SSL: true
   modules: bmp085,dht,enduser_setup,file,gpio,i2c,mqtt,net,node,ow,tmr,uart,wifi
 build    built on: 2016-02-14 13:27
 powered by Lua 5.1.4 on SDK 1.4.0
> in startup
0�~?�4�!��Y�O�:�C_AE�����aR



Re: node.dsleep results in immediately reboot

PostPosted: Mon Mar 07, 2016 1:06 pm
by jankop
Yes:
Code: Select allprint ('WakeUp')
function startup()
   if abort == true then
      print('Sleep aborted')
      return
   end
    print('Go to sleep')
    node.dsleep(5000000)-- sleep 5s
end

abort = false

tmr.alarm(0,5000,tmr.ALARM_SINGLE,function() startup() end)

Re: node.dsleep results in immediately reboot

PostPosted: Tue Mar 08, 2016 4:06 am
by willwach
Ah, now I see.
Its MICROseconds and not MILLIseconds.
This is really unexspected for me.
Mostly in other languages milliseconds is used.

Many thanks!