Sleep modes

Posted on
  • Is there already guidance on how to put the puck.js in deep sleep and wake up on intervals? Is it as simple as using the NRF.sleep()?

  • You don't have to do anything at all. Unlike the other Espruino boards it's always sleeping as much as it can.

    NRF.sleep() totally turns off bluetooth, which you probably don't want :)

    Only real guidance is make sure you don't keep pins set to use the hardware UART or PWM, as they use the full speed clock and so force it to stay on when active.

  • Sweeeeet!!

  • Hi Gordon,

    NRF.sleep() totally turns off bluetooth, which you probably don't want :)

    This is exactly what i've tried to do to save some battery capacity.
    Unfortunately the Puck doesn't show up again after NFR.wake()
    Do I have to do anything else after enabling bluetooth again?
    Do I have to setup advertisements using NRF.setServices / NRF.setAdvertising?

    Greets pk910

    Edit:

    NRF.setServices({},{uart:true});
    

    just after NRF.wake() fixed it :)

  • That's a strange one - do you have any other code in there that could have been causing problems?

    NRF.wake() should really be enough to get it advertising again after sleep turned it off

    edit: You'll need to be using a recent firmware though - 1v88 could cause you problems

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Sleep modes

Posted by Avatar for gnz @gnz

Actions