save L R vals dispite out of range

This commit is contained in:
Oskar Weigl
2017-11-15 01:05:18 -08:00
parent 40afb9daf1
commit 1ec18e8d0c
2 changed files with 5 additions and 2 deletions
+3
View File
@@ -3,6 +3,9 @@
* USB communication deadlock
* EXTI handler redefiniton in V3.2
### Changed
* Resistance/inductance measurement now saved dispite errors, to allow debugging
## [0.2.0] - 2017-11-12
### Added
* UART communication
+2 -2
View File
@@ -684,11 +684,11 @@ static bool measure_phase_resistance(Motor_t* motor, float test_current, float m
queue_voltage_timings(motor, 0.0f, 0.0f);
float R = test_voltage / test_current;
motor->phase_resistance = R;
if (fabs(test_voltage) == fabs(max_voltage) || R < 0.01f || R > 1.0f) {
motor->error = ERROR_PHASE_RESISTANCE_OUT_OF_RANGE;
return false;
}
motor->phase_resistance = R;
return true;
}
@@ -726,12 +726,12 @@ static bool measure_phase_inductance(Motor_t* motor, float voltage_low, float vo
float dI_by_dt = (Ialphas[1] - Ialphas[0]) / (current_meas_period * (float)num_cycles);
float L = v_L / dI_by_dt;
motor->phase_inductance = L;
// TODO arbitrary values set for now
if (L < 1e-6f || L > 500e-6f) {
motor->error = ERROR_PHASE_INDUCTANCE_OUT_OF_RANGE;
return false;
}
motor->phase_inductance = L;
return true;
}