#include "Copter.h"
void Copter::set_auto_armed(bool b)
{
if( ap.auto_armed == b )
return;
ap.auto_armed = b;
if(b){
LOGGER_WRITE_EVENT(LogEvent::AUTO_ARMED);
}
}
void Copter::set_simple_mode(SimpleMode b)
{
if (simple_mode != b) {
switch (b) {
case SimpleMode::NONE:
LOGGER_WRITE_EVENT(LogEvent::SET_SIMPLE_OFF);
gcs().send_text(MAV_SEVERITY_INFO, "SIMPLE mode off");
break;
case SimpleMode::SIMPLE:
LOGGER_WRITE_EVENT(LogEvent::SET_SIMPLE_ON);
gcs().send_text(MAV_SEVERITY_INFO, "SIMPLE mode on");
break;
case SimpleMode::SUPERSIMPLE:
update_super_simple_bearing(true);
LOGGER_WRITE_EVENT(LogEvent::SET_SUPERSIMPLE_ON);
gcs().send_text(MAV_SEVERITY_INFO, "SUPERSIMPLE mode on");
break;
}
simple_mode = b;
}
}
void Copter::set_failsafe_radio(bool b)
{
if(failsafe.radio != b) {
failsafe.radio = b;
if (failsafe.radio == false) {
failsafe_radio_off_event();
}else{
failsafe_radio_on_event();
}
AP_Notify::flags.failsafe_radio = b;
}
}
void Copter::set_failsafe_gcs(bool b)
{
failsafe.gcs = b;
AP_Notify::flags.failsafe_gcs = b;
}
void Copter::update_using_interlock()
{
#if FRAME_CONFIG == HELI_FRAME
ap.using_interlock = true;
#else
ap.using_interlock = rc().find_channel_for_option(RC_Channel::AUX_FUNC::MOTOR_INTERLOCK) != nullptr;
#endif
}