Puck reboot()

Posted on
  • Can I have a reboot(), like reset()?
    Then it would not be necessary to take the battery out, to reset the Puck.
    I have a saved program I want to start again, after I have made some test with other progam's in the ram.

  • Hi @Frida, what would be the difference to reset()?

  • reset() wiper only the program in ram out, reboot() takes the saved program if any.

  • You could type reset(); save();

    If you want a reboot command always available, just do:

    E.setBootCode("function reboot() { reset(); save(); }");

    That would do the trick for you. It would also be in memory after you reset or saved something.

    BTW: I would not necessarily name that reboot. After all if you reboot a computer it does not wipe the harddisk :-).

  • I guess @Frida is thinking of something like this


    similar to

  • Yep
    If I do reset(); save(); I wipe out the program in EEPROM, that is not what I want.

    I have a program saved in EEPROM, that I want to get back running, when I am finished playing with other programs in ram.

  • Okay got, it. Sorry for misunderstanding. Yes, that would be useful!

  • @Gordon is there something we can do for now with a paper clip - like shorten RST to GND ?

  • Yes, tested, that works.

  • Surely that is what load() does? It resets and loads the program that was saved in flash?

    But yes, @MaBe you could short the RST pin, or even shorting out GND and 3V for a fraction of a second won't do much harm (it'll just marginally reduce your battery life).

  • Hmm, so using a 10kΩ resistor is a better choice, than a paper clip :-)

  • @Gordon is it possible to implement a NRF.reboot() ?

  • What about load()? As I said that seems to do what you want.

    If you really care about a full hardware reboot you can always just poke the relevant ARM registers - but for most people reset() and load() should work fine - the only time you should need a hardware reboot is if something hideous has gone wrong, in which case the interpreter may not be responding anyway

  • Thank you, load() was just what I needed.
    Sorry I have overlooked it.

  • No problem - it's not mentioned much in the docs :)

  • Load is cool! I also overlooked it...

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

Puck reboot()

Posted by Avatar for Frida @Frida