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:
Jake Dahl
2018-08-28 15:50:35 -06:00
committed by Daniel Agar
parent c10ea132b4
commit 5a678295b3
@@ -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);