From c84bfcd86af197fd801756e1d901c6abef0a2532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=86=AFSir?= Date: Fri, 3 May 2024 14:01:03 +0800 Subject: [PATCH] general --- Firmware/Core/apps/src/menu.c | 42 ++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/Firmware/Core/apps/src/menu.c b/Firmware/Core/apps/src/menu.c index 36a1cd0..5a12c60 100644 --- a/Firmware/Core/apps/src/menu.c +++ b/Firmware/Core/apps/src/menu.c @@ -12,41 +12,43 @@ #include "sdio.h" #include "rtc.h" -void Staring_Menu(){ +void Staring_Menu() { WS_TFT_Clear(WHITE); char buffer[120]; - if(sdMountFlag == 1){ - WS_TFT_Dis_12X24_String(0,0,"SD card mount OK!",WHITE,GREEN); - WS_TFT_Dis_12X24_String(0,25,"SD card init OK!",WHITE,GREEN); - sprintf(buffer,"size: %.1f M",(float )hsd.SdCard.BlockNbr * hsd.SdCard - .BlockSize/ 1024 / 1024); - WS_TFT_Dis_12X24_String(0,49,buffer,WHITE,GREEN); - WS_TFT_Dis_12X24_String(0,73,"System Init OK!",WHITE,GREEN); - }else{ - WS_TFT_Dis_12X24_String(0,0,"SD card mount fail!",WHITE,RED); - WS_TFT_Dis_12X24_String(0,0,"Please Check sdCard",WHITE,RED); + if (sdMountFlag == 1) { + WS_TFT_Dis_12X24_String(0, 0, "SD card mount OK!", WHITE, GREEN); + WS_TFT_Dis_12X24_String(0, 25, "SD card init OK!", WHITE, GREEN); + sprintf(buffer, "size: %.1f M", (float)hsd.SdCard.BlockNbr * hsd.SdCard + .BlockSize / 1024 / 1024); + WS_TFT_Dis_12X24_String(0, 49, buffer, WHITE, GREEN); + WS_TFT_Dis_12X24_String(0, 73, "System Init OK!", WHITE, GREEN); + } else { + WS_TFT_Dis_12X24_String(0, 0, "SD card mount fail!", WHITE, RED); + WS_TFT_Dis_12X24_String(0, 0, "Please Check sdCard", WHITE, RED); } HAL_Delay(20); WS_TFT_Clear(WHITE); } -void showTime(){ +void showTime() { RTC_TimeTypeDef sTime; RTC_DateTypeDef sDate; - HAL_RTC_GetTime(&hrtc,&sTime,RTC_FORMAT_BIN); - HAL_RTC_GetDate(&hrtc,&sDate,RTC_FORMAT_BIN); + HAL_RTC_GetTime(&hrtc, &sTime, RTC_FORMAT_BIN); + HAL_RTC_GetDate(&hrtc, &sDate, RTC_FORMAT_BIN); uint8_t buffer[32]; - sprintf(buffer,"20%02d-%02d-%02d week %d",sDate.Year,sDate.Month,sDate - .Date,sDate.WeekDay); - WS_TFT_Dis_12X24_String(16,0,buffer,WHITE,BLUE); - sprintf(buffer,"%02d:%02d:%02d",sTime.Hours,sTime.Minutes,sTime.Seconds); - WS_TFT_Dis_12X24_String(72,25,buffer,WHITE,BLUE); + sprintf(buffer, "20%02u-%02u-%02u", sDate.Year, sDate.Month, sDate + .Date); + WS_TFT_Dis_12X24_String(60, 0, buffer, WHITE, BLUE); + sprintf(buffer, "%02u:%02u:%02u", sTime.Hours, sTime.Minutes, sTime.Seconds); + WS_TFT_Dis_12X24_String(72, 25, buffer, WHITE, BLUE); } -void user_Menu(){ +void user_Menu() { showTime(); + + }