forked from Archive/PX4-Autopilot
PWM out: provide running state
Important to know if the app is running.
This commit is contained in:
parent
33c5f4210a
commit
9490c64ad4
|
@ -2258,15 +2258,24 @@ extern "C" __EXPORT int pwm_out_main(int argc, char *argv[])
|
|||
|
||||
} else if (strcmp(argv[1], "status") == 0) {
|
||||
if (PWMOut::trylock_module()) {
|
||||
|
||||
unsigned count = 0;
|
||||
|
||||
for (int i = 0; i < PWM_OUT_MAX_INSTANCES; i++) {
|
||||
if (_objects[i].load()) {
|
||||
PX4_INFO_RAW("\n");
|
||||
_objects[i].load()->print_status();
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
PWMOut::unlock_module();
|
||||
|
||||
if (count == 0) {
|
||||
PX4_INFO("not running");
|
||||
return 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
PX4_WARN("module locked, try again later");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue