mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-05 05:51:35 +08:00
Tests: Correct use of unsubscribe
This commit is contained in:
committed by
Lorenz Meier
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++) {
|
for (unsigned i = 0; i < rc_input.channel_count; i++) {
|
||||||
if (abs(rc_input.values[i] - rc_last.values[i]) > 20) {
|
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]);
|
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;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,13 +117,13 @@ int test_rc(int argc, char *argv[])
|
|||||||
|
|
||||||
if (rc_last.channel_count != rc_input.channel_count) {
|
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);
|
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;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hrt_absolute_time() - rc_input.timestamp_last_signal > 100000) {
|
if (hrt_absolute_time() - rc_input.timestamp_last_signal > 100000) {
|
||||||
PX4_ERR("TIMEOUT, less than 10 Hz updates");
|
PX4_ERR("TIMEOUT, less than 10 Hz updates");
|
||||||
(void)close(_rc_sub);
|
(void)orb_unsubscribe(_rc_sub);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user