From 36f4dc0ada013bbd0df37d6a5835920fe997c29b Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 24 Aug 2019 21:50:59 -0400 Subject: [PATCH] Add watchdog enable option --- Firmware/MotorControl/axis.cpp | 1 + Firmware/MotorControl/axis.hpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Firmware/MotorControl/axis.cpp b/Firmware/MotorControl/axis.cpp index d85489dd..311b4886 100644 --- a/Firmware/MotorControl/axis.cpp +++ b/Firmware/MotorControl/axis.cpp @@ -206,6 +206,7 @@ void Axis::watchdog_feed() { // @brief Check the watchdog timer for expiration. Also sets the watchdog error bit if expired. bool Axis::watchdog_check() { // reset value = 0 means watchdog disabled. + if(!config_.enable_watchdog) return true; if (get_watchdog_reset() == 0) return true; // explicit check here to ensure that we don't underflow back to UINT32_MAX diff --git a/Firmware/MotorControl/axis.hpp b/Firmware/MotorControl/axis.hpp index af305a43..efadbcea 100644 --- a/Firmware/MotorControl/axis.hpp +++ b/Firmware/MotorControl/axis.hpp @@ -77,6 +77,7 @@ class Axis { float counts_per_step = 2.0f; float watchdog_timeout = 0.0f; // [s] (0 disables watchdog) + bool enable_watchdog = false; // Defaults loaded from hw_config in load_configuration in main.cpp uint16_t step_gpio_pin = 0; @@ -283,6 +284,7 @@ class Axis { make_protocol_property("enable_step_dir", &config_.enable_step_dir), make_protocol_property("counts_per_step", &config_.counts_per_step), make_protocol_property("watchdog_timeout", &config_.watchdog_timeout), + make_protocol_property("enable_watchdog", &config_.enable_watchdog), make_protocol_property("step_gpio_pin", &config_.step_gpio_pin, [](void* ctx) { static_cast(ctx)->decode_step_dir_pins(); }, this), make_protocol_property("dir_gpio_pin", &config_.dir_gpio_pin,