mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-21 23:44:48 +08:00
Revert "Handle current scaling factor for HW versions <= 3.3"
This reverts commit fefa091de2.
This commit is contained in:
@@ -39,8 +39,6 @@ float vbus_voltage = 12.0f;
|
||||
#define POLE_PAIRS 7
|
||||
static float elec_rad_per_enc = POLE_PAIRS * 2 * M_PI * (1.0f / (float)ENCODER_CPR);
|
||||
|
||||
#define CURRENT_SCALING_FACTOR (1.31578947f)
|
||||
|
||||
// TODO: Migrate to C++, clearly we are actually doing object oriented code here...
|
||||
// TODO: For nice encapsulation, consider not having the motor objects public
|
||||
Motor_t motors[] = {
|
||||
@@ -621,12 +619,7 @@ void pwm_trig_adc_cb(ADC_HandleTypeDef* hadc, bool injected) {
|
||||
} else {
|
||||
ADCValue = HAL_ADC_GetValue(hadc);
|
||||
}
|
||||
if(HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR <= 3){
|
||||
float current = phase_current_from_adcval(motor, ADCValue)*CURRENT_SCALING_FACTOR;
|
||||
} else {
|
||||
float current = phase_current_from_adcval(motor, ADCValue);
|
||||
}
|
||||
|
||||
float current = phase_current_from_adcval(motor, ADCValue);
|
||||
|
||||
if (current_meas_not_DC_CAL) {
|
||||
// ADC2 and ADC3 record the phB and phC currents concurrently,
|
||||
@@ -1300,12 +1293,7 @@ static void control_motor_loop(Motor_t* motor) {
|
||||
}
|
||||
|
||||
// Current limiting
|
||||
if(HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR <= 3){
|
||||
float Ilim = motor->current_control.current_lim*CURRENT_SCALING_FACTOR;
|
||||
} else{
|
||||
float Ilim = motor->current_control.current_lim;
|
||||
}
|
||||
|
||||
float Ilim = motor->current_control.current_lim;
|
||||
bool limited = false;
|
||||
if (Iq > Ilim) {
|
||||
limited = true;
|
||||
|
||||
@@ -70,7 +70,6 @@
|
||||
|
||||
#define MACRO_MAX(x, y) (((x) > (y)) ? (x) : (y))
|
||||
#define MACRO_MIN(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#define MACRO_CONSTRAIN(amt,low,high) (((amt)<(low)) ? (low) : ((amt > high) ? (high) : (amt)))
|
||||
|
||||
// Compute rising edge timings (0.0 - 1.0) as a function of alpha-beta
|
||||
// as per the magnitude invariant clarke transform
|
||||
|
||||
Reference in New Issue
Block a user