mirror of https://github.com/ArduPilot/ardupilot
Copter: added SYSID_ENFORCE parameter
allows enforcement of SYSID_MYGCS
This commit is contained in:
parent
3a8e38ee12
commit
5a9276a5c4
|
@ -2259,3 +2259,17 @@ void Copter::gcs_send_text_fmt(MAV_SEVERITY severity, const char *fmt, ...)
|
|||
hal.util->vsnprintf((char *)str, sizeof(str), fmt, arg_list);
|
||||
GCS_MAVLINK::send_statustext(severity, 0xFF, str);
|
||||
}
|
||||
|
||||
/*
|
||||
return true if we will accept this packet. Used to implement SYSID_ENFORCE
|
||||
*/
|
||||
bool GCS_MAVLINK_Copter::accept_packet(const mavlink_status_t &status, mavlink_message_t &msg)
|
||||
{
|
||||
if (!copter.g2.sysid_enforce) {
|
||||
return true;
|
||||
}
|
||||
if (msg.msgid == MAVLINK_MSG_ID_RADIO || msg.msgid == MAVLINK_MSG_ID_RADIO_STATUS) {
|
||||
return true;
|
||||
}
|
||||
return (msg.sysid == copter.g.sysid_my_gcs);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ protected:
|
|||
|
||||
uint32_t telem_delay() const override;
|
||||
|
||||
bool accept_packet(const mavlink_status_t &status, mavlink_message_t &msg) override;
|
||||
|
||||
private:
|
||||
|
||||
void handleMessage(mavlink_message_t * msg) override;
|
||||
|
|
|
@ -1031,6 +1031,13 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = {
|
|||
// @User: Advanced
|
||||
AP_GROUPINFO("ACRO_THR_MID", 10, ParametersG2, acro_thr_mid, ACRO_THR_MID_DEFAULT),
|
||||
|
||||
// @Group: SYSID_ENFORCE
|
||||
// @DisplayName: GCS sysid enforcement
|
||||
// @Description: This controls whether packets from other than the expected GCS system ID will be accepted
|
||||
// @Values: 0:NotEnforced,1:Enforced
|
||||
// @User: Advanced
|
||||
AP_GROUPINFO("SYSID_ENFORCE", 11, ParametersG2, sysid_enforce, 0),
|
||||
|
||||
AP_GROUPEND
|
||||
};
|
||||
|
||||
|
|
|
@ -563,6 +563,9 @@ public:
|
|||
AP_Proximity proximity;
|
||||
#endif
|
||||
|
||||
// whether to enforce acceptance of packets only from sysid_my_gcs
|
||||
AP_Int8 sysid_enforce;
|
||||
|
||||
#if ADVANCED_FAILSAFE == ENABLED
|
||||
// advanced failsafe library
|
||||
AP_AdvancedFailsafe_Copter afs;
|
||||
|
|
Loading…
Reference in New Issue