Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pmoegenburg committed Aug 12, 2024
1 parent 884e576 commit d441d2e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 20 deletions.
9 changes: 3 additions & 6 deletions head/firmware/stm32g4xx_it.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,11 @@ void TIM2_IRQHandler(void) { HAL_TIM_IRQHandler(&htim2); }
void TIM3_IRQHandler(void) { HAL_TIM_IRQHandler(&htim3); }

void EXTI15_10_IRQHandler(void) {
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_13);
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_15);
/*if (__HAL_GPIO_EXTI_GET_IT(GPIO_PIN_13)) {
if (__HAL_GPIO_EXTI_GET_IT(GPIO_PIN_13)) {
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_13);
}
if (__HAL_GPIO_EXTI_GET_IT(GPIO_PIN_15)) {
} else if (__HAL_GPIO_EXTI_GET_IT(GPIO_PIN_15)) {
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_15);
}*/
}
}

extern void xPortSysTickHandler(void);
Expand Down
12 changes: 1 addition & 11 deletions include/motor-control/core/tasks/motion_controller_task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "motor-control/core/tasks/messages.hpp"
#include "motor-control/core/tasks/tmc_motor_driver_common.hpp"

constexpr uint32_t DIAG0_DEBOUNCE_REPS = 0; // 9
constexpr uint32_t DIAG0_DEBOUNCE_REPS = 9;
constexpr uint32_t DIAG0_DEBOUNCE_DELAY = 100;

namespace motion_controller_task {
Expand Down Expand Up @@ -205,16 +205,6 @@ class MotionControllerMessageHandler {
const motor_control_task_messages::RouteMotorDriverInterrupt& m) {
if (m.debounce_count > DIAG0_DEBOUNCE_REPS) {
if (controller.read_tmc_diag0()) {
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::
motor_driver_error_detected});
driver_client.send_motor_driver_queue(
can::messages::ReadMotorDriverErrorStatusRequest{
.message_index = m.message_index});
controller.stop(
can::ids::ErrorSeverity::unrecoverable,
can::ids::ErrorCode::motor_driver_error_detected);
Expand Down
7 changes: 5 additions & 2 deletions include/pipettes/core/tasks/motion_controller_task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include "motor-control/core/tasks/usage_storage_task.hpp"
#include "pipettes/core/tasks/messages.hpp"

constexpr uint32_t DIAG0_DEBOUNCE_REPS = 9;
constexpr uint32_t DIAG0_DEBOUNCE_DELAY = 100;

namespace pipettes {

namespace tasks {
Expand Down Expand Up @@ -156,7 +159,7 @@ class MotionControllerMessageHandler {

void handle(const pipettes::task_messages::motor_control_task_messages::
RouteMotorDriverInterrupt& m) {
if (m.debounce_count > 9) {
if (m.debounce_count > DIAG0_DEBOUNCE_REPS) {
if (controller.read_tmc_diag0()) {
controller.stop(
can::ids::ErrorSeverity::unrecoverable,
Expand All @@ -176,7 +179,7 @@ class MotionControllerMessageHandler {
}
diag0_debounced = false;
} else {
vTaskDelay(pdMS_TO_TICKS(100));
vTaskDelay(pdMS_TO_TICKS(DIAG0_DEBOUNCE_DELAY));
motion_client.send_motion_controller_queue(
increment_message_debounce_count(m));
}
Expand Down
2 changes: 1 addition & 1 deletion motor-control/firmware/stepper_motor/motor_hardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void MotorHardware::activate_motor() {
void MotorHardware::deactivate_motor() {
if (pins.ebrake.has_value()) {
gpio::set(pins.ebrake.value());
motor_hardware_delay(20); // need more time? How was this derived?
motor_hardware_delay(20);
}
gpio::reset(pins.enable);
}
Expand Down

0 comments on commit d441d2e

Please sign in to comment.