forked from Archive/PX4-Autopilot
Sensors: added missing px4_close and removed _exit() call
The QuRT build was broken from the call to exit. While fixing the code to clean up before returning, I found a missed call to px4_close. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
parent
f24d807b66
commit
0c3681c896
|
@ -922,16 +922,16 @@ Sensors::gyro_init()
|
|||
warnx("FATAL: no gyro found: %s", GYRO0_DEVICE_PATH);
|
||||
return ERROR;
|
||||
|
||||
} else {
|
||||
|
||||
/* set the gyro internal sampling rate to default rate */
|
||||
px4_ioctl(fd, GYROIOCSSAMPLERATE, GYRO_SAMPLERATE_DEFAULT);
|
||||
|
||||
/* set the driver to poll at default rate */
|
||||
px4_ioctl(fd, SENSORIOCSPOLLRATE, SENSOR_POLLRATE_DEFAULT);
|
||||
|
||||
}
|
||||
|
||||
/* set the gyro internal sampling rate to default rate */
|
||||
px4_ioctl(fd, GYROIOCSSAMPLERATE, GYRO_SAMPLERATE_DEFAULT);
|
||||
|
||||
/* set the driver to poll at default rate */
|
||||
px4_ioctl(fd, SENSORIOCSPOLLRATE, SENSOR_POLLRATE_DEFAULT);
|
||||
|
||||
px4_close(fd);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -2086,8 +2086,12 @@ Sensors::task_main()
|
|||
} while (0);
|
||||
|
||||
if (ret) {
|
||||
warnx("Sensor initialization failed");
|
||||
_sensors_task = -1;
|
||||
_exit(ret);
|
||||
if (_fd_adc >=0) {
|
||||
close(_fd_adc);
|
||||
_fd_adc = -1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue