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 <jilay.pandya@zeiss.com>
This commit is contained in:
Jilay Pandya 2024-10-08 16:08:23 +02:00 committed by Fabio Baltieri
parent 27572ea59d
commit 9cf1269e0e
1 changed files with 19 additions and 3 deletions

View File

@ -445,10 +445,26 @@ static void stepper_poll_thread(void *p1, void *p2, void *p3)
while (1) { while (1) {
k_poll(&stepper_poll_event, 1, K_FOREVER); k_poll(&stepper_poll_event, 1, K_FOREVER);
if (stepper_poll_event.signal->result == STEPPER_SIGNAL_STEPS_COMPLETED) { switch (stepper_poll_event.signal->result) {
shell_print(sh, "Stepper: All steps completed"); case STEPPER_SIGNAL_STEPS_COMPLETED:
k_poll_signal_reset(&stepper_signal); shell_fprintf_info(sh, "Stepper: All steps completed.\n");
break;
case STEPPER_SIGNAL_SENSORLESS_STALL_DETECTED:
shell_fprintf_info(sh, "Stepper: Sensorless stall detected.\n");
break;
case STEPPER_SIGNAL_LEFT_END_STOP_DETECTED:
shell_fprintf_info(sh, "Stepper: Left limit switch pressed.\n");
break;
case STEPPER_SIGNAL_RIGHT_END_STOP_DETECTED:
shell_fprintf_normal(sh, "Stepper: Right limit switch pressed.\n");
break;
default:
shell_fprintf_error(sh, "Stepper: Unknown signal received.\n");
break;
} }
k_poll_signal_reset(&stepper_signal);
} }
} }