Skip to content

Commit 9cf1269

Browse files
jilaypandyafabiobaltieri
authored andcommitted
shell: stepper: add further stepper signals to shell
This commit adds further signals to stepper shell - STEPPER_SIGNAL_SENSORLESS_STALL_DETECTED - STEPPER_SIGNAL_LEFT_END_STOP_DETECTED - STEPPER_SIGNAL_RIGHT_END_STOP_DETECTED Signed-off-by: Jilay Pandya <[email protected]>
1 parent 27572ea commit 9cf1269

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

drivers/stepper/stepper_shell.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,26 @@ static void stepper_poll_thread(void *p1, void *p2, void *p3)
445445
while (1) {
446446
k_poll(&stepper_poll_event, 1, K_FOREVER);
447447

448-
if (stepper_poll_event.signal->result == STEPPER_SIGNAL_STEPS_COMPLETED) {
449-
shell_print(sh, "Stepper: All steps completed");
450-
k_poll_signal_reset(&stepper_signal);
448+
switch (stepper_poll_event.signal->result) {
449+
case STEPPER_SIGNAL_STEPS_COMPLETED:
450+
shell_fprintf_info(sh, "Stepper: All steps completed.\n");
451+
break;
452+
case STEPPER_SIGNAL_SENSORLESS_STALL_DETECTED:
453+
shell_fprintf_info(sh, "Stepper: Sensorless stall detected.\n");
454+
break;
455+
case STEPPER_SIGNAL_LEFT_END_STOP_DETECTED:
456+
shell_fprintf_info(sh, "Stepper: Left limit switch pressed.\n");
457+
break;
458+
case STEPPER_SIGNAL_RIGHT_END_STOP_DETECTED:
459+
shell_fprintf_normal(sh, "Stepper: Right limit switch pressed.\n");
460+
break;
461+
default:
462+
shell_fprintf_error(sh, "Stepper: Unknown signal received.\n");
463+
break;
451464
}
465+
466+
k_poll_signal_reset(&stepper_signal);
467+
452468
}
453469
}
454470

0 commit comments

Comments
 (0)