aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/px4io/adc.c2
-rw-r--r--apps/px4io/controls.c4
-rw-r--r--apps/px4io/mixer.cpp2
-rw-r--r--apps/px4io/px4io.h4
4 files changed, 6 insertions, 6 deletions
diff --git a/apps/px4io/adc.c b/apps/px4io/adc.c
index e06b269dc..670b8d635 100644
--- a/apps/px4io/adc.c
+++ b/apps/px4io/adc.c
@@ -154,7 +154,7 @@ adc_measure(unsigned channel)
while (!(rSR & ADC_SR_EOC)) {
/* never spin forever - this will give a bogus result though */
- if ((hrt_absolute_time() - now) > 1000) {
+ if (hrt_elapsed_time(&now) > 1000) {
debug("adc timeout");
break;
}
diff --git a/apps/px4io/controls.c b/apps/px4io/controls.c
index cad368ae4..6b5164756 100644
--- a/apps/px4io/controls.c
+++ b/apps/px4io/controls.c
@@ -218,7 +218,7 @@ controls_tick() {
* If we haven't seen any new control data in 200ms, assume we
* have lost input.
*/
- if ((hrt_absolute_time() - system_state.rc_channels_timestamp) > 200000) {
+ if (hrt_elapsed_time(&system_state.rc_channels_timestamp) > 200000) {
rc_input_lost = true;
/* clear the input-kind flags here */
@@ -294,7 +294,7 @@ ppm_input(uint16_t *values, uint16_t *num_values)
* If we have received a new PPM frame within the last 200ms, accept it
* and then invalidate it.
*/
- if ((hrt_absolute_time() - ppm_last_valid_decode) < 200000) {
+ if (hrt_elapsed_time(&ppm_last_valid_decode) < 200000) {
/* PPM data exists, copy it */
*num_values = ppm_decoded_channels;
diff --git a/apps/px4io/mixer.cpp b/apps/px4io/mixer.cpp
index 505bc8a69..77f28cd7a 100644
--- a/apps/px4io/mixer.cpp
+++ b/apps/px4io/mixer.cpp
@@ -88,7 +88,7 @@ void
mixer_tick(void)
{
/* check that we are receiving fresh data from the FMU */
- if ((hrt_absolute_time() - system_state.fmu_data_received_time) > FMU_INPUT_DROP_LIMIT_US) {
+ if (hrt_elapsed_time(&system_state.fmu_data_received_time) > FMU_INPUT_DROP_LIMIT_US) {
/* too long without FMU input, time to go to failsafe */
if (r_status_flags & PX4IO_P_STATUS_FLAGS_FMU_OK) {
diff --git a/apps/px4io/px4io.h b/apps/px4io/px4io.h
index 22993fb52..7b4b07c2c 100644
--- a/apps/px4io/px4io.h
+++ b/apps/px4io/px4io.h
@@ -105,12 +105,12 @@ extern uint16_t r_page_servo_failsafe[]; /* PX4IO_PAGE_FAILSAFE_PWM */
*/
struct sys_state_s {
- uint64_t rc_channels_timestamp;
+ volatile uint64_t rc_channels_timestamp;
/**
* Last FMU receive time, in microseconds since system boot
*/
- uint64_t fmu_data_received_time;
+ volatile uint64_t fmu_data_received_time;
};