AP_OpenDroneID: ensure Persistent memory is not read continuously
This commit is contained in:
parent
54db689b0f
commit
f95e16bca6
@ -131,7 +131,7 @@ void AP_OpenDroneID::set_basic_id() {
|
|||||||
if (pkt_basic_id.id_type != MAV_ODID_ID_TYPE_NONE) {
|
if (pkt_basic_id.id_type != MAV_ODID_ID_TYPE_NONE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (id_len == 0) {
|
if ((id_len == 0) && (_options & LockUASIDOnFirstBasicIDRx)) {
|
||||||
load_UAS_ID_from_persistent_memory();
|
load_UAS_ID_from_persistent_memory();
|
||||||
}
|
}
|
||||||
if (id_len > 0) {
|
if (id_len > 0) {
|
||||||
@ -208,10 +208,12 @@ void AP_OpenDroneID::update()
|
|||||||
|
|
||||||
if ((pkt_basic_id.id_type == MAV_ODID_ID_TYPE_SERIAL_NUMBER)
|
if ((pkt_basic_id.id_type == MAV_ODID_ID_TYPE_SERIAL_NUMBER)
|
||||||
&& (_options & LockUASIDOnFirstBasicIDRx)
|
&& (_options & LockUASIDOnFirstBasicIDRx)
|
||||||
&& id_len == 0) {
|
&& id_len == 0
|
||||||
|
&& !bootloader_flashed) {
|
||||||
hal.util->flash_bootloader();
|
hal.util->flash_bootloader();
|
||||||
// reset the basic id on next set_basic_id call
|
// reset the basic id on next set_basic_id call
|
||||||
pkt_basic_id.id_type = MAV_ODID_ID_TYPE_NONE;
|
pkt_basic_id.id_type = MAV_ODID_ID_TYPE_NONE;
|
||||||
|
bootloader_flashed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_basic_id();
|
set_basic_id();
|
||||||
|
@ -117,7 +117,7 @@ private:
|
|||||||
char id_type[3];
|
char id_type[3];
|
||||||
size_t id_len;
|
size_t id_len;
|
||||||
char id_str[21];
|
char id_str[21];
|
||||||
|
bool bootloader_flashed;
|
||||||
enum Options : int16_t {
|
enum Options : int16_t {
|
||||||
EnforceArming = (1U << 0U),
|
EnforceArming = (1U << 0U),
|
||||||
AllowNonGPSPosition = (1U << 1U),
|
AllowNonGPSPosition = (1U << 1U),
|
||||||
|
Loading…
Reference in New Issue
Block a user