用mdk自带的emwin和u盘等固件,发现一个奇葩问题,u盘需要在ui线程启动前启动,ui线程优先级也要比u盘低,而且ui里边启动rtc更新,居然会检测不到u盘的插入。诺是注释掉rtc 更新,u盘检测非常正常。
static void Caculate_RTC(WM_MESSAGE *pMsg)
{
RTC_DateTypeDef Sdatestructure;
RTC_TimeTypeDef Stimestructure;
char buf[30];
WM_HWIN hWin = pMsg->hWin;
/* Get the RTC current Time */
HAL_RTC_GetTime(&hrtc, &Stimestructure, RTC_FORMAT_BIN);
/* Get the RTC current Date */
HAL_RTC_GetDate(&hrtc, &Sdatestructure, RTC_FORMAT_BIN);
sprintf(buf,
"%0.2d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d", Sdatestructure.Year, Sdatestructure.Month, Sdatestructure.Date,
Stimestructure.Hours, Stimestructure.Minutes, Stimestructure.Seconds
);
//TEXT_SetText(WM_GetDialogItem(hWin, ID_TEXT_TIME), buf); //注释掉这行,才能检测到u盘
sprintf(buf, "%0.6s", ucWeekDay[Sdatestructure.WeekDay - 1]);
TEXT_SetText(WM_GetDialogItem(hWin, ID_TEXT_WEEK), buf);
}
离线
sprintf 改为自己写的函数也不行,我改为每一分钟刷新也不行。改为在ui主循环去刷新这个控件也不行,改为定时在WM_PAINT用 GUI_DispStringHCenterA显示时间也不行.最后只能把时间部分独立出来,不要再窗口里边才行
离线
800X480分辨率的液晶,我留了一个矩形块(0,0)(799,39)单独显示时间,状态,gui的窗口大小为800X440
离线