fix encoder offset calibration and error handling

This commit is contained in:
Samuel Sadok
2018-04-09 19:32:36 -07:00
parent 1718e5c397
commit 09f361de61
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -251,14 +251,20 @@ void Axis::run_state_machine_loop() {
switch (current_state_) {
case AXIS_STATE_MOTOR_CALIBRATION:
status = motor_.run_calibration();
if (!status)
error_ |= ERROR_MOTOR_FAILED;
break;
case AXIS_STATE_ENCODER_INDEX_SEARCH:
status = encoder_.run_index_search();
if (!status)
error_ |= ERROR_ENCODER_FAILED;
break;
case AXIS_STATE_ENCODER_OFFSET_CALIBRATION:
status = encoder_.run_offset_calibration();
if (!status)
error_ |= ERROR_ENCODER_FAILED;
break;
case AXIS_STATE_SENSORLESS_CONTROL:
+1 -1
View File
@@ -103,7 +103,7 @@ bool Encoder::run_offset_calibration() {
// Temporarily disable index search so it doesn't mess
// with the offset calibration
bool old_use_index = config_.use_index;
config_.use_index = true;
config_.use_index = false;
float voltage_magnitude;
if (axis_->motor_.config_.motor_type == MOTOR_TYPE_HIGH_CURRENT)