Arduino sketch, How to specify Timeout Mysensor initailisation



  • Hello,
    Maybe a naive question but I'm looking after a way to exit from mysensor initailisation in case it fails hooking to gateway and I havent found the way to specify a timeout.

    About the context:
    I have a Arduino based Mysensor Node that is used to control 2 relays for Opening and Closing curtains.
    The Node control is done either through radio as a Mysensor Node either locally through local to curtains Button control.

    The Button status are in fact read by Arduino, programs arbitrates between local buttons and radio.

    All works well as long as the Mysensor network is ON and the curtain Node hooks to mysensor gateway, but I want to make sure I can keep control of the curtains with local buttons in absence of the mysensor network and I haven't yet found the way to manage it.

    On Arduino sketch of the curtain node, at Reset the program keeps expecting a successfull link with gateway and keeps cycling before excecution of presentation() or even loop() of the arduino sketch.

    Would somebody have a trick to specify a timeout or a maximum attempts to hook gateway and keeps executing arduino sketch ?

    Also I would be interested to now How to reinitiate a mysensor initialisation from the Arduino sketch without having to reset the arduino.

    Thanks in advance


  • Mod

    @benbidouille welcome to the MySensors forum!
    To do stuff at reset, before MySensors code runs, implement preHwInit() or before() in your sketch.

    To set timeout, use MY_TRANSPORT_WAIT_READY_MS.

    search for these keywords in the forum to see some earlier discussions on similar use cases - maybe you can reuse some ideas and code.

    Re-initialization should happen automatically as soon as you try to send something.



  • Many Thanks @mfalkvidd
    Works just great as expected.
    Regards


  • Mod

    @benbidouille great. Thanks for reporting back.


Log in to reply
 

Suggested Topics

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts