AP_Compass: use a set_and_notify for external and IDs

ensure that GCS that connects quickly gets the right value
fixes issue #5364
This commit is contained in:
Andrew Tridgell 2016-12-10 08:16:17 +11:00 committed by Randy Mackay
parent 95f00b4891
commit 00ed6bbc2b

View File

@ -103,7 +103,7 @@ uint8_t AP_Compass_Backend::register_compass(void) const
*/ */
void AP_Compass_Backend::set_dev_id(uint8_t instance, uint32_t dev_id) void AP_Compass_Backend::set_dev_id(uint8_t instance, uint32_t dev_id)
{ {
_compass._state[instance].dev_id.set(dev_id); _compass._state[instance].dev_id.set_and_notify(dev_id);
} }
/* /*
@ -112,7 +112,7 @@ void AP_Compass_Backend::set_dev_id(uint8_t instance, uint32_t dev_id)
void AP_Compass_Backend::set_external(uint8_t instance, bool external) void AP_Compass_Backend::set_external(uint8_t instance, bool external)
{ {
if (_compass._state[instance].external != 2) { if (_compass._state[instance].external != 2) {
_compass._state[instance].external.set(external); _compass._state[instance].external.set_and_notify(external);
} }
} }