diff --git a/src/encoders/calibrated/CalibratedSensor.cpp b/src/encoders/calibrated/CalibratedSensor.cpp index 76b8ced..cfc6ee1 100644 --- a/src/encoders/calibrated/CalibratedSensor.cpp +++ b/src/encoders/calibrated/CalibratedSensor.cpp @@ -101,12 +101,11 @@ void CalibratedSensor::calibrate(FOCMotor &motor, int settle_time_ms) { // if the LUT is already defined, skip the calibration - if(calibrationLut == NULL) { + if (calibrationLut == NULL) { allocated = true; calibrationLut = new uint16_t[n_lut]; - }else{ - SIMPLEFOC_DEBUG("SEN_CAL: Using pre-defined LUT for calibration."); - return; + } else { + SIMPLEFOC_DEBUG("SEN_CAL: Overwriting pre-defined LUT for calibration."); } SIMPLEFOC_DEBUG("SEN_CAL: Starting Sensor Calibration."); diff --git a/src/encoders/calibrated/README.md b/src/encoders/calibrated/README.md index 01d467a..f8cfdb5 100644 --- a/src/encoders/calibrated/README.md +++ b/src/encoders/calibrated/README.md @@ -125,7 +125,7 @@ If you calibrate once during setup and save the LUT to EEPROM or hardcode it, yo 1. **First run**: Call `calibrate(motor)` → Serial outputs LUT 2. **Copy LUT**: Paste the generated values into your code -3. **Subsequent runs**: Pass LUT to constructor and `calibrate()` → instantaneous, no rotation needed +3. **Subsequent runs**: Pass LUT to constructor and DO NOT call `calibrate()` → instantaneous, no rotation needed Your code will look something like this: