mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Tests: Correct use of unsubscribe
This commit is contained in:
parent
313ff2a6f2
commit
92c35f26be
@ -108,7 +108,7 @@ int test_rc(int argc, char *argv[])
|
||||
for (unsigned i = 0; i < rc_input.channel_count; i++) {
|
||||
if (abs(rc_input.values[i] - rc_last.values[i]) > 20) {
|
||||
PX4_ERR("comparison fail: RC: %d, expected: %d", rc_input.values[i], rc_last.values[i]);
|
||||
(void)close(_rc_sub);
|
||||
(void)orb_unsubscribe(_rc_sub);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
@ -117,13 +117,13 @@ int test_rc(int argc, char *argv[])
|
||||
|
||||
if (rc_last.channel_count != rc_input.channel_count) {
|
||||
PX4_ERR("channel count mismatch: last: %d, now: %d", rc_last.channel_count, rc_input.channel_count);
|
||||
(void)close(_rc_sub);
|
||||
(void)orb_unsubscribe(_rc_sub);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
if (hrt_absolute_time() - rc_input.timestamp_last_signal > 100000) {
|
||||
PX4_ERR("TIMEOUT, less than 10 Hz updates");
|
||||
(void)close(_rc_sub);
|
||||
(void)orb_unsubscribe(_rc_sub);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user