Skip to content

Commit

Permalink
fix(motor-control): z stage falls after being disengaged (#733)
Browse files Browse the repository at this point in the history
Adding a delay before disengaging the motor
  • Loading branch information
ahiuchingau committed Nov 27, 2023
1 parent 1ffb311 commit f9f8885
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/motor-control/firmware/motor_control_hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ uint16_t motor_hardware_encoder_pulse_count(void* encoder_handle);
uint16_t motor_hardware_encoder_pulse_count_with_overflow(void* encoder_handle, int8_t *overflows);
void motor_hardware_reset_encoder_count(void* encoder_handle, uint16_t reset_value);
uint16_t motor_hardware_get_stopwatch_pulses(void* stopwatch_handle, uint8_t clear);
void motor_hardware_delay(uint32_t delay);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
Expand Down
6 changes: 6 additions & 0 deletions motor-control/firmware/motor_control_hardware.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "FreeRTOS.h"
#include "platform_specific_hal_conf.h"
#include "stm32g4xx_hal_tim.h"
#include "stm32g4xx_hal.h"
#include "task.h"

HAL_StatusTypeDef custom_stop_pwm_it(TIM_HandleTypeDef* htim,
Expand Down Expand Up @@ -131,3 +132,8 @@ uint16_t motor_hardware_get_stopwatch_pulses(void* stopwatch_handle, uint8_t cle
return count;
}

void motor_hardware_delay(uint32_t delay) {
HAL_Delay(delay);
}


1 change: 1 addition & 0 deletions motor-control/firmware/stepper_motor/motor_hardware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ void MotorHardware::deactivate_motor() {
if (pins.ebrake.has_value()) {
gpio::set(pins.ebrake.value());
}
motor_hardware_delay(10);
gpio::reset(pins.enable);
}
void MotorHardware::start_timer_interrupt() {
Expand Down

0 comments on commit f9f8885

Please sign in to comment.