gps: only use injected data if copy successful

This commit is contained in:
Daniel Agar
2020-05-08 10:27:57 -04:00
parent b12a655c5b
commit da186877c9
+9 -7
View File
@@ -430,15 +430,17 @@ void GPS::handleInjectDataTopic()
if (updated) { if (updated) {
gps_inject_data_s msg; 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. if (_orb_inject_data_sub.copy(&msg)) {
* 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; /* 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); } while (updated && num_injections < max_num_injections);
} }