Airspeed sim: Fix reset function

This commit is contained in:
Lorenz Meier 2017-01-03 09:28:35 +01:00 committed by Beat Küng
parent 4fcb4cf0fd
commit 9cfd46b87c
1 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
* *
* Copyright (c) 2013, 2014 PX4 Development Team. All rights reserved. * Copyright (c) 2013, 2014, 2017 PX4 Development Team. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@ -33,7 +33,7 @@
/** /**
* @file meas_airspeed_sim.cpp * @file meas_airspeed_sim.cpp
* @author Lorenz Meier * @author Lorenz Meier <lorenz@px4.io>
* @author Sarthak Kaingade * @author Sarthak Kaingade
* @author Simon Wilks * @author Simon Wilks
* @author Thomas Gubler * @author Thomas Gubler
@ -473,14 +473,18 @@ reset()
if (ioctl(fd, SENSORIOCRESET, 0) < 0) { if (ioctl(fd, SENSORIOCRESET, 0) < 0) {
PX4_ERR("driver reset failed"); PX4_ERR("driver reset failed");
close(fd);
return 1; return 1;
} }
if (ioctl(fd, SENSORIOCSPOLLRATE, SENSOR_POLLRATE_DEFAULT) < 0) { if (ioctl(fd, SENSORIOCSPOLLRATE, SENSOR_POLLRATE_DEFAULT) < 0) {
PX4_ERR("driver poll restart failed"); PX4_ERR("driver poll restart failed");
close(fd);
return 1; return 1;
} }
close(fd);
return 0; return 0;
} }