SRV_Channel: add ARM/MOTOR_EMERGENCY_STOP Aux Switch

This commit is contained in:
Henry Wurzburg 2022-08-19 10:06:24 -05:00 committed by Peter Barker
parent 451ed0aede
commit 61b0f23ee2
2 changed files with 15 additions and 3 deletions

View File

@ -538,9 +538,7 @@ public:
static bool have_digital_outputs() { return digital_mask != 0; }
// Set E - stop
static void set_emergency_stop(bool state) {
emergency_stop = state;
}
static void set_emergency_stop(bool state);
// get E - stop
static bool get_emergency_stop() { return emergency_stop;}

View File

@ -21,6 +21,7 @@
#include <AP_Math/AP_Math.h>
#include <AP_Vehicle/AP_Vehicle.h>
#include "SRV_Channel.h"
#include <AP_Logger/AP_Logger.h>
#if HAL_MAX_CAN_PROTOCOL_DRIVERS
#include <AP_CANManager/AP_CANManager.h>
@ -602,3 +603,16 @@ bool SRV_Channels::is_GPIO(uint8_t channel)
}
return false;
}
// Set E - stop
void SRV_Channels::set_emergency_stop(bool state) {
#if HAL_LOGGING_ENABLED
if (state != emergency_stop) {
AP_Logger *logger = AP_Logger::get_singleton();
if (logger && logger->logging_enabled()) {
logger->Write_Event(state ? LogEvent::MOTORS_EMERGENCY_STOPPED : LogEvent::MOTORS_EMERGENCY_STOP_CLEARED);
}
}
#endif
emergency_stop = state;
}