diff --git a/src/main.cpp b/src/main.cpp index cbce384..5a8ca0d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,8 +9,10 @@ It will also read the speed of the motor and send it to the onboard computer. #include #include "RefSpeed.h" #include "BatteryFunctions.h" +#include "hardware/watchdog.h" #include "globals.h" + #if defined(ROS) || defined(ROS_DEBUG) #include #include "microRosFunctions.h" @@ -108,7 +110,7 @@ void setup() { pinMode(speedFreqLPin, INPUT_PULLDOWN); attachInterrupt(digitalPinToInterrupt(speedFreqRPin), pulse_handler_1, RISING); attachInterrupt(digitalPinToInterrupt(speedFreqLPin), pulse_handler_2, RISING); - + watchdog_enable(3000, 1); // updating the watchdog// set the watchdog to run at 8s interval @@ -143,7 +145,7 @@ void setup() { } void loop() { - + watchdog_update(); //updating the watchdog #if defined(ROS) || defined(ROS_DEBUG) microRosTick(); refSpeedSensors = getRefSpeed(); @@ -238,4 +240,4 @@ void loop() { #ifdef ROS_DEBUG transmitDac(refSpeedL, refSpeedR); #endif -} +} \ No newline at end of file