mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-20 11:23:06 +08:00
added a check to ensure the initialize settings function succeeds. If it does not, the driver fails gracefully. This handles the case that the device is not there.
This commit is contained in:
@@ -649,7 +649,13 @@ void PGA460::request_results()
|
||||
void PGA460::run()
|
||||
{
|
||||
open_serial();
|
||||
initialize_device_settings();
|
||||
int ret = initialize_device_settings();
|
||||
|
||||
if(ret != PX4_OK) {
|
||||
close_serial();
|
||||
PX4_INFO("Could not initialize device settings. Exiting.");
|
||||
return;
|
||||
}
|
||||
|
||||
struct distance_sensor_s report = {};
|
||||
_distance_sensor_topic = orb_advertise(ORB_ID(distance_sensor), &report);
|
||||
|
||||
Reference in New Issue
Block a user