diff --git a/Project/Src/MyWinApp/mywin_user_status_bar.c b/Project/Src/MyWinApp/mywin_user_status_bar.c index d5a9bfd..a25d54b 100644 --- a/Project/Src/MyWinApp/mywin_user_status_bar.c +++ b/Project/Src/MyWinApp/mywin_user_status_bar.c @@ -14,13 +14,13 @@ WIN_StatusBarStruct *WIN_CreatStatusBar (WIN_WindowStruct *base, void (*msgLoop)(struct _WIN_WindowStruct *win,WIN_MsgStruct *msg), int x,int y,int x_size,int y_size) -{ +{ //重设消息循环 if (msgLoop==0) { - msgLoop=(void (*)(struct _WIN_WindowStruct *win,WIN_MsgStruct *msg))STATUSBAR_DefaultMsgLoop; - } - + msgLoop=(void (*)(struct _WIN_WindowStruct *win,WIN_MsgStruct *msg))STATUSBAR_DefaultMsgLoop; + } + WIN_StatusBarStruct *ret=mymalloc (sizeof ( WIN_StatusBarStruct)); //调用父类的构造函数 if (ret) @@ -48,8 +48,8 @@ WIN_StatusBarStruct *WIN_CreatStatusBar (WIN_WindowStruct *base, ret->app_y_step=30; } } - - + + return ret; } @@ -58,7 +58,7 @@ WIN_StatusBarStruct *WIN_CreatStatusBar (WIN_WindowStruct *base, void STATUSBAR_StateUpdata (WIN_StatusBarStruct *statusbar,STATUSBAR_DataStruct *s) { int temp=statusbar->stat.mode_x; - + //使用内存复制的方法复制结构体 mymemcpy (& statusbar->stat,s,sizeof (STATUSBAR_DataStruct)); if (strlen(statusbar->stat.mode)>8) @@ -120,7 +120,7 @@ void STATUSBAR_ScanApp(WIN_StatusBarStruct *bar) { app_struct *app=appm_get(i); if(app) - { + { bar->app_item[bar->app_num].app=app; bar->app_num++; } @@ -138,14 +138,14 @@ void STATUSBAR_ClearApp(WIN_StatusBarStruct *bar) //默认绘制函数 void STATUSBAR_DefaultPaint (WIN_StatusBarStruct *statusbar) { - + int x=0; int y=0; int x_size=((WIN_WindowStruct *)statusbar)->x_size; // int y_size=((WIN_WindowStruct *)statusbar)->y_size; int y_size=20; int tag_xsize=0;//绘制目标的宽度 - + //显示背景 WIN_SetLcdBkColor (statusbar->backColor); //如果有图片就显示图片 @@ -158,25 +158,25 @@ void STATUSBAR_DefaultPaint (WIN_StatusBarStruct *statusbar) { WIN_Clear(); } - + u32 font_type =WIN_SetFontSize (16); - + WIN_SetLcdColor (statusbar->color); - + //显示时间 WIN_SetFontMode (WIN_DRAWMODE_ALONE); WIN_SetLcdBkColor (statusbar->color); if (statusbar->stat.time[0]) { - WIN_DrawTxtAt (statusbar->stat.time,x,y_size/2-WIN_GetFontHight()/2); + WIN_DrawTxtAt (statusbar->stat.time,x,y_size/2-WIN_GetFontHight()/2); } - + //显示模式 if (statusbar->stat.mode[0]) { - WIN_DrawTxtHCenterAt (statusbar->stat.mode,x_size/2,y_size/2-WIN_GetFontHight()/2); + WIN_DrawTxtHCenterAt (statusbar->stat.mode,x_size/2,y_size/2-WIN_GetFontHight()/2); } - + //显示电池百分比,从右向左绘制 if (statusbar->stat.betty[0]) { @@ -184,8 +184,8 @@ void STATUSBAR_DefaultPaint (WIN_StatusBarStruct *statusbar) WIN_DrawTxtAt (statusbar->stat.betty,x_size-tag_xsize-1,y_size/2-WIN_GetFontHight()/2); x_size-=tag_xsize; } - - + + int y_step=statusbar->app_y_step; x=15; y=statusbar->y_size_def+10; @@ -209,14 +209,14 @@ void STATUSBAR_DefaultPaint (WIN_StatusBarStruct *statusbar) rect->x_size=x_size/4; rect->y_size=y_step; WIN_DrawTxtAt("删除",rect->x,txt_y); - + y+=y_step; WIN_DrawHLine(10,y,x_size-1-10); } - + WIN_SetFontSize (font_type); } - + @@ -327,7 +327,7 @@ int STATUSBAR_TouchMove(WIN_StatusBarStruct *statusbar,WIN_MoveStruct *m) - + //默认消息处理函数 void STATUSBAR_DefaultMsgLoop (WIN_StatusBarStruct *statusbar,WIN_MsgStruct *msg) { @@ -335,7 +335,7 @@ void STATUSBAR_DefaultMsgLoop (WIN_StatusBarStruct *statusbar,WIN_MsgStruct *msg WIN_TouchStruct *t=0; STATUSBAR_DataStruct *s=0; switch (msg->msg) - { + { case WIN_MSG_PAINT: STATUSBAR_DefaultPaint(statusbar); break; @@ -359,14 +359,16 @@ void STATUSBAR_DefaultMsgLoop (WIN_StatusBarStruct *statusbar,WIN_MsgStruct *msg { //更新状态栏 statusbar->sec=Seconds; + int a=mem_perused(),b=exmem_perused(); sprintf (statu->time,"%02d:%02d:%02d", Hours,Minutes,Seconds); - sprintf (statu->mode,"mem:%.1f,exm:%.1f",mem_perused()/100.0,exmem_perused()/100.0); + sprintf (statu->mode,"mem:%02d.%02d,exm:%02d.%02d",a/100,a%100, + b/100,b%100); sprintf (statu->betty,"电量:100%%"); STATUSBAR_StateUpdata (statusbar,statu); - + STATUSBAR_ClearApp(statusbar); STATUSBAR_ScanApp(statusbar); - + WIN_SetInvalidWhenTop ((WIN_WindowStruct *)statusbar); } myfree(statu); diff --git a/Project/Src/MyWinApp/mywin_user_status_bar.h b/Project/Src/MyWinApp/mywin_user_status_bar.h index 8bb8d76..30c49d3 100644 --- a/Project/Src/MyWinApp/mywin_user_status_bar.h +++ b/Project/Src/MyWinApp/mywin_user_status_bar.h @@ -27,7 +27,7 @@ typedef struct char time[20]; char mode[100]; int mode_x; //在字符超过显示宽度时,滚动显示x方向的偏移 - char betty[5]; + char betty[10]; int blueState; int heartState; int nfcState; @@ -39,7 +39,7 @@ typedef struct { app_struct *app; RECT_Struct enter; - RECT_Struct exit; + RECT_Struct exit; }STATUSBAR_AppStruct; @@ -47,7 +47,7 @@ typedef struct { WIN_WindowStruct win; STATUSBAR_ResStruct res; //显示用的资源 - STATUSBAR_DataStruct stat; + STATUSBAR_DataStruct stat; int img_xsize;//图标最大横向尺寸 WIN_PicStruct pic;//状态栏背景图片 u32 backColor; //背景颜色 @@ -55,15 +55,15 @@ typedef struct int timerId; //定时器id int timerIdGet; //用于获取时间 u8 sec; - + int mov_start; //移动开始 int y_size_def; //默认的y尺寸 int dis; //滑动方向,1,展开,0,缩小 - + int app_num; int app_y_step; STATUSBAR_AppStruct app_item[APPM_LIST_MAXLEN]; - + }WIN_StatusBarStruct; @@ -74,20 +74,20 @@ WIN_StatusBarStruct *WIN_CreatStatusBar (WIN_WindowStruct *base, int x,int y,int x_size,int y_size); - + //状态信息更新 void STATUSBAR_StateUpdata (WIN_StatusBarStruct *statusbar,STATUSBAR_DataStruct *s); - + //设置资源文件 void STATUSBAR_SetRes (WIN_StatusBarStruct *statusbar,STATUSBAR_ResStruct *r); - + //设置背景图片 void STATUSBAR_SetBackPic (WIN_StatusBarStruct *statusbar,WIN_PicStruct *pic); - + //默认绘制函数 void STATUSBAR_DefaultPaint (WIN_StatusBarStruct *statusbar); - - + + //默认消息处理函数 void STATUSBAR_DefaultMsgLoop (WIN_StatusBarStruct *statusbar,WIN_MsgStruct *msg); diff --git a/Project/make.py b/Project/make.py index 656fa4a..c83a6c6 100644 --- a/Project/make.py +++ b/Project/make.py @@ -9,6 +9,7 @@ from multiprocessing import Process,Queue,Value,cpu_count os.environ["PATH"]+=";D:/Program Files/arm-gnu-toolchain/bin" +os.environ["LANG"]="zh_CN.GBK" CC="arm-none-eabi-gcc" AS = CC + ' -x assembler-with-cpp' @@ -25,6 +26,8 @@ CFLAG=[ '-Wall', '-fdata-sections', '-ffunction-sections', + # '-u _printf_float', # 浣跨敤杩欎釜閫夐」浼氬鑷磋皟鐢╡xit + '-specs=nano.specs', # 浣跨敤nano-newlib # debug '-g -gdwarf-2' ] @@ -298,7 +301,7 @@ def build_target(src:list): obj_list.append('.'.join([name,'o'])) dst=os.path.join(OUTPUT,TARGET)+".elf" if(check_rebuild(dst,obj_list)): - rsp=f"{' '.join(obj_list)} -o {dst} {flags} -specs=nano.specs \ + rsp=f"{' '.join(obj_list)} -o {dst} {flags} \ -T{LD_FILE} -lc -lm -lnosys -Wl,-Map={OUTPUT}/{TARGET}.map,--cref -Wl,--gc-sections \ -Wl,--no-warn-rwx-segments -Wl,-print-memory-usage" print(f"閾炬帴 {dst}")