From 96082d0d21101c3be3ad38b95839831b1c52d344 Mon Sep 17 00:00:00 2001 From: Joachim Bach <joachimbach11@gmail.com> Date: Thu, 28 Dec 2023 12:24:53 +0100 Subject: [PATCH] corrected weird indentation --- MCU_Workspace/labo5_mpu_user_console_etu/src/user_cmd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MCU_Workspace/labo5_mpu_user_console_etu/src/user_cmd.c b/MCU_Workspace/labo5_mpu_user_console_etu/src/user_cmd.c index d6dc544..d1a5e0b 100644 --- a/MCU_Workspace/labo5_mpu_user_console_etu/src/user_cmd.c +++ b/MCU_Workspace/labo5_mpu_user_console_etu/src/user_cmd.c @@ -113,13 +113,16 @@ void exec_user_read_write_uart() } str[i]=0; value_idx=i+1; - } else if (!isxdigit(str[i])) + } + else if (!isxdigit(str[i])) { strcpy(str, "\r\nSyntax error! Expected syntax is either <8 characters hexadecimal address> for reading\r\n or <8 characters hexadecimal address>,<8 characters hexadecimal value> for writing\r\n"); uart0_send_ref((uint8_t *)str, strlen(str)); return; } } + + if ((coma_nb&(i<2)) || i>17) { strcpy(str, "\r\nSyntax error! Expected syntax is either <8 characters hexadecimal address> for reading\r\n or <8 characters hexadecimal address>,<8 characters hexadecimal value> for writing\r\n (Bad length!) \r\n"); @@ -127,6 +130,7 @@ void exec_user_read_write_uart() return; } + sscanf(str, "%x", &addr); if (!coma_nb) // if read { -- GitLab