From ab8b31b6af51ac46880d852134267905fc57d5ee Mon Sep 17 00:00:00 2001 From: sowgro Date: Wed, 5 Nov 2025 14:37:53 -0500 Subject: Fix pause --- project/Core/Src/Project/remote_control.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'project/Core/Src/Project/remote_control.c') diff --git a/project/Core/Src/Project/remote_control.c b/project/Core/Src/Project/remote_control.c index 2153a4a..c8c1f73 100644 --- a/project/Core/Src/Project/remote_control.c +++ b/project/Core/Src/Project/remote_control.c @@ -11,6 +11,8 @@ #include "player_actions.h" #include "UART.h" #include "project.h" +#include "systick.h" +#include "player_actions.h" static char buffer[80]; static char* cur = buffer; @@ -19,7 +21,7 @@ void remote_control_init() { NVIC_EnableIRQ (USART2_IRQn); USART2->CR1 |= USART_CR1_RXNEIE; // 1 << 5 - help(); + player_help(); } void remote_control_loop() { @@ -27,36 +29,33 @@ void remote_control_loop() { } static void parse_input(char buffer[]) { - uint8_t *state = project_get_state(); if (!strcmp(buffer, "HELP")) { - help(); + player_help(); } else if (!strcmp(buffer, "NEXT")) { - next(); + player_next(); } else if (!strcmp(buffer, "PLAY")) { - play(); - *state = PLAYING_STATE; + player_play(); } else if (!strcmp(buffer, "PAUSE")) { - pause(); - *state = PAUSED_STATE; + player_pause(); } else if (!strcmp(buffer, "STOP")) { - stop(); - *state = STOPPED_STATE; + player_stop(); } else { printf("Unknown command \"%s\"\n\r", buffer); } } -#include "systick.h" void USART2_IRQHandler() { int ch = USART_Read(USART2); - if (project_get_mode() != REMOTE_MODE) + if (project_get_mode() != REMOTE_MODE) { + cur = buffer; return; + } putchar(ch); if (!ch) -- cgit v1.2.3