mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
gps: only use injected data if copy successful
This commit is contained in:
@@ -430,15 +430,17 @@ void GPS::handleInjectDataTopic()
|
||||
|
||||
if (updated) {
|
||||
gps_inject_data_s msg;
|
||||
_orb_inject_data_sub.copy(&msg);
|
||||
|
||||
/* Write the message to the gps device. Note that the message could be fragmented.
|
||||
* But as we don't write anywhere else to the device during operation, we don't
|
||||
* need to assemble the message first.
|
||||
*/
|
||||
injectData(msg.data, msg.len);
|
||||
if (_orb_inject_data_sub.copy(&msg)) {
|
||||
|
||||
++_last_rate_rtcm_injection_count;
|
||||
/* Write the message to the gps device. Note that the message could be fragmented.
|
||||
* But as we don't write anywhere else to the device during operation, we don't
|
||||
* need to assemble the message first.
|
||||
*/
|
||||
injectData(msg.data, msg.len);
|
||||
|
||||
++_last_rate_rtcm_injection_count;
|
||||
}
|
||||
}
|
||||
} while (updated && num_injections < max_num_injections);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user