diff --git a/Core/Src/clock.c b/Core/Src/clock.c index cee5871..7efea0d 100644 --- a/Core/Src/clock.c +++ b/Core/Src/clock.c @@ -42,13 +42,15 @@ uint8_t clock_convert_hours(uint8_t hours){ uint8_t clock_convert_min_sec(uint8_t min_sec){ float led = 0; + float divider = 2.5; if(min_sec < 60){ - led = (float) min_sec/(60/24); + led = (float) min_sec/divider; - led += LED_OFFSET; - if(led > 23){ - led -= 24; + + led = led + LED_OFFSET; + while(led > 23){ + led = led - 24; } } diff --git a/Core/Src/myComms.c b/Core/Src/myComms.c index 425bca8..286112b 100644 --- a/Core/Src/myComms.c +++ b/Core/Src/myComms.c @@ -99,7 +99,7 @@ void cmd_GetTime(uint32_t time){ uint8_t msg[6] = {0}; - uint8_t resp[] = "Hello Ewaryst\n"; + //uint8_t resp[] = "Hello Ewaryst\n"; // sprintf(resp, "%d, %d, %d, \n", my_rtc.hours, my_rtc.minutes, my_rtc.seconds); @@ -111,7 +111,7 @@ void cmd_GetTime(uint32_t time){ msg[5] = 44; - HAL_UART_Transmit(&huart2, resp, sizeof(resp), 1000); + HAL_UART_Transmit(&huart2, msg, sizeof(msg), 1000); } void cmd_setColour_hour(uint32_t colour){