Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pmoegenburg committed Nov 15, 2023
1 parent 39aa8ce commit 6ae3cde
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions include/motor-control/core/tasks/motion_controller_task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class MotionControllerMessageHandler {
controller.send_usage_data(m.message_index, usage_client);
}

//get rid of this method
// use this method, get rid of debounce message
void handle(const can::messages::RouteMotorDriverInterrupt& m) {
if (!diag0_debounced) {
motion_client.send_motion_controller_queue(can::messages::DebounceMotorDriverError{.message_index = m.message_index});
Expand Down Expand Up @@ -213,11 +213,12 @@ class MotionControllerMessageHandler {
can::ids::ErrorCode::motor_driver_error_detected}); // delete
}

// no debouncing needed in final product
// make messages non-CAN, should be trivial, everything takes std::monostate
void handle(const can::messages::DebounceMotorDriverError& m) {
// delay after first message, check/act on pin after delay. Deal with/discard all messgaes during delay
vTaskDelay(pdMS_TO_TICKS(100)); // Need to act immediately?! Just decrease this?!
vTaskDelay(pdMS_TO_TICKS(100));
debounce_count++;
if (debounce_count > 9) { // send msg immediately, reset flags after delay?!
if (debounce_count > 9) {
if (controller.read_tmc_diag0()) {
motion_client.send_motion_controller_queue(can::messages::MotorDriverErrorEncountered{.message_index = m.message_index});
} else {
Expand Down

0 comments on commit 6ae3cde

Please sign in to comment.