mirror of https://github.com/ArduPilot/ardupilot
AP_RangeFinder: use millis/micros/panic functions
This commit is contained in:
parent
5344d95ef5
commit
82a14b183d
|
@ -91,9 +91,9 @@ void AP_RangeFinder_LightWareSerial::update(void)
|
|||
{
|
||||
if (get_reading(state.distance_cm)) {
|
||||
// update range_valid state based on distance measured
|
||||
last_reading_ms = hal.scheduler->millis();
|
||||
last_reading_ms = AP_HAL::millis();
|
||||
update_status();
|
||||
} else if (hal.scheduler->millis() - last_reading_ms > 200) {
|
||||
} else if (AP_HAL::millis() - last_reading_ms > 200) {
|
||||
set_status(RangeFinder::RangeFinder_NoData);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ void AP_RangeFinder_PX4::update(void)
|
|||
}
|
||||
|
||||
// if we have not taken a reading in the last 0.2s set status to No Data
|
||||
if (hal.scheduler->micros64() - _last_timestamp >= 200000) {
|
||||
if (AP_HAL::micros64() - _last_timestamp >= 200000) {
|
||||
set_status(RangeFinder::RangeFinder_NoData);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ void AP_RangeFinder_PX4_PWM::update(void)
|
|||
float sum_cm = 0;
|
||||
uint16_t count = 0;
|
||||
const float scaling = ranger._scaling[state.instance];
|
||||
uint32_t now = hal.scheduler->millis();
|
||||
uint32_t now = AP_HAL::millis();
|
||||
|
||||
while (::read(_fd, &pwm, sizeof(pwm)) == sizeof(pwm)) {
|
||||
// report the voltage as the pulse width, so we get the raw
|
||||
|
@ -147,7 +147,7 @@ void AP_RangeFinder_PX4_PWM::update(void)
|
|||
}
|
||||
|
||||
// if we have not taken a reading in the last 0.2s set status to No Data
|
||||
if (hal.scheduler->micros64() - _last_timestamp >= 200000) {
|
||||
if (AP_HAL::micros64() - _last_timestamp >= 200000) {
|
||||
set_status(RangeFinder::RangeFinder_NoData);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue