drivers/differential_pressure move all to px4 work queue

This commit is contained in:
Daniel Agar
2019-02-21 09:46:22 -05:00
parent 83d3ead821
commit e1bc975065
8 changed files with 36 additions and 73 deletions
@@ -84,9 +84,9 @@ protected:
* Perform a poll cycle; collect from the previous measurement
* and start a new one.
*/
virtual void cycle();
virtual int measure();
virtual int collect();
void Run() override;
int measure() override;
int collect() override;
};
@@ -174,7 +174,7 @@ ETSAirspeed::collect()
}
void
ETSAirspeed::cycle()
ETSAirspeed::Run()
{
int ret;
@@ -198,14 +198,10 @@ ETSAirspeed::cycle()
/*
* Is there a collect->measure gap?
*/
if (_measure_ticks > USEC2TICK(CONVERSION_INTERVAL)) {
if (_measure_interval > CONVERSION_INTERVAL) {
/* schedule a fresh cycle call when we are ready to measure again */
work_queue(HPWORK,
&_work,
(worker_t)&Airspeed::cycle_trampoline,
this,
_measure_ticks - USEC2TICK(CONVERSION_INTERVAL));
ScheduleDelayed(_measure_interval - CONVERSION_INTERVAL);
return;
}
@@ -224,11 +220,7 @@ ETSAirspeed::cycle()
_collect_phase = true;
/* schedule a fresh cycle call when the measurement is done */
work_queue(HPWORK,
&_work,
(worker_t)&Airspeed::cycle_trampoline,
this,
USEC2TICK(CONVERSION_INTERVAL));
ScheduleDelayed(CONVERSION_INTERVAL);
}
/**
@@ -99,9 +99,9 @@ protected:
* Perform a poll cycle; collect from the previous measurement
* and start a new one.
*/
virtual void cycle();
virtual int measure();
virtual int collect();
void Run() override;
int measure() override;
int collect() override;
math::LowPassFilter2p _filter{MEAS_RATE, MEAS_DRIVER_FILTER_FREQ};
@@ -238,7 +238,7 @@ MEASAirspeed::collect()
}
void
MEASAirspeed::cycle()
MEASAirspeed::Run()
{
int ret;
@@ -261,14 +261,10 @@ MEASAirspeed::cycle()
/*
* Is there a collect->measure gap?
*/
if (_measure_ticks > USEC2TICK(CONVERSION_INTERVAL)) {
if (_measure_interval > CONVERSION_INTERVAL) {
/* schedule a fresh cycle call when we are ready to measure again */
work_queue(HPWORK,
&_work,
(worker_t)&Airspeed::cycle_trampoline,
this,
_measure_ticks - USEC2TICK(CONVERSION_INTERVAL));
ScheduleDelayed(_measure_interval - CONVERSION_INTERVAL);
return;
}
@@ -287,11 +283,7 @@ MEASAirspeed::cycle()
_collect_phase = true;
/* schedule a fresh cycle call when the measurement is done */
work_queue(HPWORK,
&_work,
(worker_t)&Airspeed::cycle_trampoline,
this,
USEC2TICK(CONVERSION_INTERVAL));
ScheduleDelayed(CONVERSION_INTERVAL);
}
/**
@@ -272,7 +272,7 @@ MS5525::collect()
}
void
MS5525::cycle()
MS5525::Run()
{
int ret = PX4_ERROR;
@@ -292,11 +292,10 @@ MS5525::cycle()
_collect_phase = false;
// is there a collect->measure gap?
if (_measure_ticks > USEC2TICK(CONVERSION_INTERVAL)) {
if (_measure_interval > CONVERSION_INTERVAL) {
// schedule a fresh cycle call when we are ready to measure again
work_queue(HPWORK, &_work, (worker_t)&Airspeed::cycle_trampoline, this,
_measure_ticks - USEC2TICK(CONVERSION_INTERVAL));
ScheduleDelayed(_measure_interval - CONVERSION_INTERVAL);
return;
}
@@ -315,5 +314,5 @@ MS5525::cycle()
_collect_phase = true;
// schedule a fresh cycle call when the measurement is done
work_queue(HPWORK, &_work, (worker_t)&Airspeed::cycle_trampoline, this, USEC2TICK(CONVERSION_INTERVAL));
ScheduleDelayed(CONVERSION_INTERVAL);
}
@@ -71,7 +71,7 @@ private:
* Perform a poll cycle; collect from the previous measurement
* and start a new one.
*/
void cycle() override;
void Run() override;
int measure() override;
int collect() override;
@@ -168,7 +168,7 @@ SDP3X::collect()
}
void
SDP3X::cycle()
SDP3X::Run()
{
int ret = PX4_ERROR;
@@ -181,7 +181,7 @@ SDP3X::cycle()
}
// schedule a fresh cycle call when the measurement is done
work_queue(HPWORK, &_work, (worker_t)&Airspeed::cycle_trampoline, this, USEC2TICK(CONVERSION_INTERVAL));
ScheduleDelayed(CONVERSION_INTERVAL);
}
bool SDP3X::crc(const uint8_t data[], unsigned size, uint8_t checksum)
@@ -87,7 +87,7 @@ private:
* Perform a poll cycle; collect from the previous measurement
* and start a new one.
*/
void cycle() override;
void Run() override;
int measure() override { return 0; }
int collect() override;
int probe() override;