px4iofirmware: avoid using hrt_elapsed_time_atomic

It's only ever read and written in controls_tick() after startup
This commit is contained in:
Beat Küng
2021-09-23 09:23:08 +02:00
parent eec94965f2
commit 0bfb1a983b
2 changed files with 2 additions and 7 deletions
+1 -5
View File
@@ -197,7 +197,6 @@ controls_init(void)
/* no channels */
r_raw_rc_count = 0;
system_state.rc_channels_timestamp_received = 0;
system_state.rc_channels_timestamp_valid = 0;
/* DSM input (USART1) */
_dsm_fd = dsm_init("/dev/ttyS0");
@@ -378,9 +377,6 @@ controls_tick()
/* update RC-received timestamp */
system_state.rc_channels_timestamp_received = hrt_absolute_time();
/* update RC-received timestamp */
system_state.rc_channels_timestamp_valid = system_state.rc_channels_timestamp_received;
/* map raw inputs to mapped inputs */
/* XXX mapping should be atomic relative to protocol */
for (unsigned i = 0; i < r_raw_rc_count; i++) {
@@ -500,7 +496,7 @@ controls_tick()
* If we haven't seen any new control data in 200ms, assume we
* have lost input.
*/
if (!rc_input_lost && hrt_elapsed_time_atomic(&system_state.rc_channels_timestamp_received) > 200000) {
if (!rc_input_lost && hrt_elapsed_time(&system_state.rc_channels_timestamp_received) > 200000) {
rc_input_lost = true;
/* clear the input-kind flags here */
+1 -2
View File
@@ -136,8 +136,7 @@ extern uint16_t r_page_servo_disarmed[]; /* PX4IO_PAGE_DISARMED_PWM */
*/
struct sys_state_s {
volatile uint64_t rc_channels_timestamp_received;
volatile uint64_t rc_channels_timestamp_valid;
uint64_t rc_channels_timestamp_received;
/**
* Last FMU receive time, in microseconds since system boot