mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 07:03:34 +08:00
sensors: remove sensors_init
The initialization code is redundant and incomplete (only the first sensor is done). I verified that all drivers already set this on startup. For the mags, they all set their maximum supported update rate. For the baro, the call can silently fail, as for example the MS5611 which does not support 150Hz update. But it also sets the maximum in initialization. Tested on Pixhawk & pixracer.
This commit is contained in:
@@ -91,7 +91,6 @@
|
||||
|
||||
#include <DevMgr.hpp>
|
||||
|
||||
#include "sensors_init.h"
|
||||
#include "parameters.h"
|
||||
#include "rc_update.h"
|
||||
#include "voted_sensors_update.h"
|
||||
@@ -158,11 +157,10 @@ public:
|
||||
void print_status();
|
||||
|
||||
private:
|
||||
/* XXX should not be here - should be own driver */
|
||||
DevHandle _h_adc; /**< ADC driver handle */
|
||||
hrt_abstime _last_adc; /**< last time we took input from the ADC */
|
||||
|
||||
bool _task_should_exit; /**< if true, sensor task should exit */
|
||||
volatile bool _task_should_exit; /**< if true, sensor task should exit */
|
||||
int _sensors_task; /**< task handle for sensor task */
|
||||
|
||||
const bool _hil_enabled; /**< if true, HIL is active */
|
||||
@@ -553,23 +551,14 @@ void
|
||||
Sensors::task_main()
|
||||
{
|
||||
|
||||
/* start individual sensors */
|
||||
int ret = 0;
|
||||
|
||||
if (!_hil_enabled) {
|
||||
/* This calls a sensors_init which can have different implementations on NuttX, POSIX, QURT. */
|
||||
ret = sensors_init();
|
||||
|
||||
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_RPI) && !defined(__PX4_POSIX_BEBOP)
|
||||
// TODO: move adc_init into the sensors_init call.
|
||||
ret = ret || adc_init();
|
||||
adc_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
PX4_ERR("sensor initialization failed");
|
||||
}
|
||||
|
||||
struct sensor_combined_s raw = {};
|
||||
|
||||
struct sensor_preflight_s preflt = {};
|
||||
|
||||
Reference in New Issue
Block a user