mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-13 19:47:34 +08:00
mavlink: update radio status timestamp atomically
- this is updated by the mavlink rx thread, but checked in the tx thread
This commit is contained in:
@@ -1457,7 +1457,7 @@ Mavlink::update_rate_mult()
|
||||
} else if (_radio_status_available) {
|
||||
|
||||
// check for RADIO_STATUS timeout and reset
|
||||
if (hrt_elapsed_time(&_rstatus.timestamp) > (_param_mav_radio_timeout.get() * 1_s)) {
|
||||
if (hrt_elapsed_time_atomic(&_rstatus.timestamp) > (_param_mav_radio_timeout.get() * 1_s)) {
|
||||
PX4_ERR("instance %d: RADIO_STATUS timeout", _instance_id);
|
||||
_radio_status_available = false;
|
||||
|
||||
|
||||
@@ -1506,7 +1506,7 @@ MavlinkReceiver::handle_message_radio_status(mavlink_message_t *msg)
|
||||
|
||||
radio_status_s status{};
|
||||
|
||||
status.timestamp = hrt_absolute_time();
|
||||
hrt_store_absolute_time(&status.timestamp);
|
||||
status.rssi = rstatus.rssi;
|
||||
status.remote_rssi = rstatus.remrssi;
|
||||
status.txbuf = rstatus.txbuf;
|
||||
|
||||
Reference in New Issue
Block a user