From 16baac04434c310d94e63e1f325435646fb055d9 Mon Sep 17 00:00:00 2001 From: pmoegenburg Date: Thu, 12 Oct 2023 17:16:21 -0400 Subject: [PATCH] clean up --- .../core/tasks/motion_controller_task.hpp | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/include/motor-control/core/tasks/motion_controller_task.hpp b/include/motor-control/core/tasks/motion_controller_task.hpp index df738b2fc..c21dc95a9 100644 --- a/include/motor-control/core/tasks/motion_controller_task.hpp +++ b/include/motor-control/core/tasks/motion_controller_task.hpp @@ -148,26 +148,21 @@ class MotionControllerMessageHandler { // cancel_and_clear_moves(can::ids::ErrorCode::motor_driver_error)? void handle(const can::messages::MotorDriverErrorEncountered& m) { // check if gpio is low before making controller calls - //if (!driver_error_handled()) { - controller.stop(can::ids::ErrorSeverity::unrecoverable); - if (!controller.is_timer_interrupt_running()){ - can_client.send_can_message(can::ids::NodeId::host, - can::messages::ErrorMessage{.message_index = m.message_index, - .severity = can::ids::ErrorSeverity::unrecoverable, - .error_code = can::ids::ErrorCode::hardware}); - driver_client.send_motor_driver_queue( - can::messages::ReadMotorDriverErrorStatus{.message_index = m.message_index}); - } - //} + controller.stop(can::ids::ErrorSeverity::unrecoverable); + if (!controller.is_timer_interrupt_running()){ + can_client.send_can_message(can::ids::NodeId::host, + can::messages::ErrorMessage{.message_index = m.message_index, + .severity = can::ids::ErrorSeverity::unrecoverable, + .error_code = can::ids::ErrorCode::hardware}); + driver_client.send_motor_driver_queue( + can::messages::ReadMotorDriverErrorStatus{.message_index = m.message_index}); + } } - bool driver_error_handled() { return driver_error_handled_flag.exchange(true); } - MotorControllerType& controller; CanClient& can_client; UsageClient& usage_client; DriverClient& driver_client; - std::atomic driver_error_handled_flag = false; }; /**