mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-21 07:14:22 +08:00
CNT is 32 bit, so count should be too
Also, explicitly cast count to a float for pll_pos
This commit is contained in:
@@ -1380,9 +1380,9 @@ void motor_thread(void const * argument) {
|
||||
motor->thread_ready = false;
|
||||
}
|
||||
|
||||
|
||||
void setEncoderCount(Motor_t* motor, uint16_t count){
|
||||
/** Function that sets the current encoder count to a desired 32-bit value. */
|
||||
void setEncoderCount(Motor_t* motor, uint32_t count){
|
||||
motor->encoder.encoder_state = count;
|
||||
motor->motor_timer->Instance->CNT = count;
|
||||
motor->encoder.pll_pos = count;
|
||||
motor->encoder.pll_pos = (float)count;
|
||||
}
|
||||
@@ -172,7 +172,7 @@ void step_cb(uint16_t GPIO_Pin);
|
||||
void pwm_trig_adc_cb(ADC_HandleTypeDef* hadc, bool injected);
|
||||
void vbus_sense_adc_cb(ADC_HandleTypeDef* hadc, bool injected);
|
||||
|
||||
void setEncoderCount(Motor_t* motor, uint16_t count);
|
||||
void setEncoderCount(Motor_t* motor, uint32_t count);
|
||||
|
||||
bool anti_cogging_calibration(Motor_t* motor);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user