From 40e076b5e542cd86d92067aa797ce9b2a815c439 Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Sat, 19 Aug 2017 23:05:24 -0700 Subject: [PATCH] fix resistance measurement factor 2 error --- MotorControl/low_level.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MotorControl/low_level.c b/MotorControl/low_level.c index aa553f9d..43dc7df5 100755 --- a/MotorControl/low_level.c +++ b/MotorControl/low_level.c @@ -823,7 +823,7 @@ static bool measure_phase_resistance(Motor_t* motor, float test_current, float m motor->error = ERROR_PHASE_RESISTANCE_MEASUREMENT_TIMEOUT; return false; } - float Ialpha = -0.5f * (motor->current_meas.phB + motor->current_meas.phC); + float Ialpha = -(motor->current_meas.phB + motor->current_meas.phC); test_voltage += (kI * CURRENT_MEAS_PERIOD) * (test_current - Ialpha); if (test_voltage > max_voltage) test_voltage = max_voltage; if (test_voltage < -max_voltage) test_voltage = -max_voltage;