Add axis.clear_errors() function

This commit is contained in:
Paul Guenette
2019-07-08 23:07:47 +02:00
parent 1494cb333f
commit cbc23de7b7
2 changed files with 11 additions and 7 deletions
+10 -1
View File
@@ -134,6 +134,14 @@ public:
void watchdog_feed();
bool watchdog_check();
void clear_errors() {
motor_.error_ = Motor::ERROR_NONE;
controller_.error_ = Controller::ERROR_NONE;
sensorless_estimator_.error_ = SensorlessEstimator::ERROR_NONE;
encoder_.error_ = Encoder::ERROR_NONE;
error_ = Axis::ERROR_NONE;
}
// True if there are no errors
bool inline check_for_errors() {
@@ -311,7 +319,8 @@ public:
make_protocol_object("trap_traj", trap_.make_protocol_definitions()),
make_protocol_object("min_endstop", min_endstop_.make_protocol_definitions()),
make_protocol_object("max_endstop", max_endstop_.make_protocol_definitions()),
make_protocol_function("watchdog_feed", *this, &Axis::watchdog_feed)
make_protocol_function("watchdog_feed", *this, &Axis::watchdog_feed),
make_protocol_function("clear_errors", *this, &Axis::clear_errors)
);
}
};
+1 -6
View File
@@ -379,12 +379,7 @@ void CANSimple::get_vbus_voltage_callback(Axis* axis, can_Message_t& msg) {
}
void CANSimple::clear_errors_callback(Axis* axis, can_Message_t& msg) {
axis->motor_.error_ = Motor::ERROR_NONE;
axis->controller_.error_ = Controller::ERROR_NONE;
axis->sensorless_estimator_.error_ = SensorlessEstimator::ERROR_NONE;
axis->encoder_.error_ = Encoder::ERROR_NONE;
axis->error_ = Axis::ERROR_NONE;
axis->clear_errors();
}
void CANSimple::send_heartbeat(Axis* axis) {