diff options
author | Anton Babushkin <anton.babushkin@me.com> | 2014-07-28 20:31:29 +0200 |
---|---|---|
committer | Anton Babushkin <anton.babushkin@me.com> | 2014-07-28 20:31:29 +0200 |
commit | 5f0fc4b566993590bac90d577047a24e8c545415 (patch) | |
tree | a217be6573deee05bd126b73b3965e6091c5aeb5 /src/modules/mavlink/mavlink_main.cpp | |
parent | f3ec46369b68d57489a5fa57a320ae99a1bda220 (diff) | |
parent | 67db8ee4f0908c31f17ed490c48ea21cc7ac3f86 (diff) | |
download | px4-firmware-5f0fc4b566993590bac90d577047a24e8c545415.tar.gz px4-firmware-5f0fc4b566993590bac90d577047a24e8c545415.tar.bz2 px4-firmware-5f0fc4b566993590bac90d577047a24e8c545415.zip |
Merge branch 'master' into mavlinkrates2
Diffstat (limited to 'src/modules/mavlink/mavlink_main.cpp')
-rw-r--r-- | src/modules/mavlink/mavlink_main.cpp | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index d72fb8508..4ae90c344 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -475,22 +475,39 @@ void Mavlink::mavlink_update_system(void) _param_component_id = param_find("MAV_COMP_ID"); _param_system_type = param_find("MAV_TYPE"); _param_use_hil_gps = param_find("MAV_USEHILGPS"); - _param_initialized = true; } /* update system and component id */ int32_t system_id; param_get(_param_system_id, &system_id); - if (system_id > 0 && system_id < 255) { - mavlink_system.sysid = system_id; - } - int32_t component_id; param_get(_param_component_id, &component_id); - if (component_id > 0 && component_id < 255) { - mavlink_system.compid = component_id; + + /* only allow system ID and component ID updates + * after reboot - not during operation */ + if (!_param_initialized) { + if (system_id > 0 && system_id < 255) { + mavlink_system.sysid = system_id; + } + + if (component_id > 0 && component_id < 255) { + mavlink_system.compid = component_id; + } + + _param_initialized = true; + } + + /* warn users that they need to reboot to take this + * into effect + */ + if (system_id != mavlink_system.sysid) { + send_statustext_critical("Save params and reboot to change SYSID"); + } + + if (component_id != mavlink_system.compid) { + send_statustext_critical("Save params and reboot to change COMPID"); } int32_t system_type; |