From 81eea96da30b095e1ff046801db661072e03b52b Mon Sep 17 00:00:00 2001 From: Oskar Weigl Date: Mon, 21 Jun 2021 16:23:37 -0700 Subject: [PATCH] add option to force precalib setting to bypass check --- Firmware/MotorControl/encoder.cpp | 2 ++ Firmware/MotorControl/encoder.hpp | 1 + Firmware/odrive-interface.yaml | 1 + 3 files changed, 4 insertions(+) diff --git a/Firmware/MotorControl/encoder.cpp b/Firmware/MotorControl/encoder.cpp index 71072923..56c94d00 100644 --- a/Firmware/MotorControl/encoder.cpp +++ b/Firmware/MotorControl/encoder.cpp @@ -127,6 +127,8 @@ void Encoder::update_pll_gains() { } void Encoder::check_pre_calibrated() { + if (config_.override_precal_check) + return; // TODO: restoring config from python backup is fragile here (ACIM motor type must be set first) if (axis_->motor_.config_.motor_type != Motor::MOTOR_TYPE_ACIM) { if (!is_ready_) diff --git a/Firmware/MotorControl/encoder.hpp b/Firmware/MotorControl/encoder.hpp index d764582f..743b9537 100644 --- a/Firmware/MotorControl/encoder.hpp +++ b/Firmware/MotorControl/encoder.hpp @@ -27,6 +27,7 @@ public: int32_t cpr = (2048 * 4); // Default resolution of CUI-AMT102 encoder, float index_offset = 0.0f; bool use_index = false; + bool override_precal_check = false; // If true, apply pre_calibrated unconditionally bool pre_calibrated = false; // If true, this means the offset stored in // configuration is valid and does not need // be determined by run_offset_calibration. diff --git a/Firmware/odrive-interface.yaml b/Firmware/odrive-interface.yaml index f628355b..4a54dc87 100644 --- a/Firmware/odrive-interface.yaml +++ b/Firmware/odrive-interface.yaml @@ -1088,6 +1088,7 @@ interfaces: phase_offset: int32 phase_offset_float: float32 direction: int32 + override_precal_check: bool pre_calibrated: {type: bool, c_setter: set_pre_calibrated} enable_phase_interpolation: bool bandwidth: {type: float32, c_setter: set_bandwidth}