How to implement whatchdog for Arduino Serial Gateway



  • Hi to all!
    I would implement a watchdog on the Arduino Serial Gateway connected on my PI.

    You know that gateway sketch basically... does nothing in loop or in setup. It is blank.

    Is sufficient put a watchdog of 1/2 seconds on setup, reset on loop and "forget"?

    I mean...

    
    
    // Enable debug prints to serial monitor
    //#define MY_DEBUG
    
    //#define MY_DEBUG_VERBOSE_SIGNING //!< Enable signing related debug prints to serial monitor
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    // Set LOW transmit power level as default, if you have an amplified NRF-module and
    // power your radio separately with a good regulator you can turn up PA level.
    #define MY_RF24_PA_LEVEL RF24_PA_HIGH
    
    // Enable serial gateway
    #define MY_GATEWAY_SERIAL
    
    // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
    #if F_CPU == 8000000L
    #define MY_BAUD_RATE 38400
    #endif
    
    // Enable inclusion mode
    //#define MY_INCLUSION_MODE_FEATURE
    // Enable Inclusion mode button on gateway
    //#define MY_INCLUSION_BUTTON_FEATURE
    
    // Inverses behavior of inclusion button (if using external pullup)
    //#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
    
    // Set inclusion mode duration (in seconds)
    //#define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    //#define MY_INCLUSION_MODE_BUTTON_PIN  3
    
    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Inverses the behavior of leds
    //#define MY_WITH_LEDS_BLINKING_INVERSE
    
    /*
     * SECURITY // SIGNING SECTION
     */
    
    #define MY_SIGNING_SOFT
    #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
    #define MY_SIGNING_REQUEST_SIGNATURES
    
    #include <MySensors.h>
    #include <avr/wdt.h>
    
    void setup()
    {
      // Setup locally attached sensors
     // activate watchdog
     wdt_enable(WDTO_2S);
    }
    
    void presentation()
    {
      // Present locally attached sensors
    }
    
    void loop()
    {
      // Send locally attached sensor data here
      // reset watchdog
    wdt_reset();
    }
    

Log in to reply
 

280
Online

6.7k
Users

7.6k
Topics

80.4k
Posts

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.