Browse Source

SRV_Channel: add ARM/MOTOR_EMERGENCY_STOP Aux Switch

master
Henry Wurzburg 3 years ago committed by Peter Barker
parent
commit
61b0f23ee2
  1. 4
      libraries/SRV_Channel/SRV_Channel.h
  2. 14
      libraries/SRV_Channel/SRV_Channels.cpp

4
libraries/SRV_Channel/SRV_Channel.h

@ -538,9 +538,7 @@ public: @@ -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;}

14
libraries/SRV_Channel/SRV_Channels.cpp

@ -21,6 +21,7 @@ @@ -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) @@ -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;
}

Loading…
Cancel
Save