2025-06-27 00:32:57 +08:00
|
|
|
|
#include "mywin_inc.h"
|
|
|
|
|
#include "mywin_user_debug.h"
|
|
|
|
|
#include "date.h"
|
|
|
|
|
#include "math.h"
|
|
|
|
|
#include "tools.h"
|
|
|
|
|
#include "system_file.h"
|
|
|
|
|
#include "mywin_user_filder.h"
|
|
|
|
|
#include "mywin_user_animation.h"
|
|
|
|
|
#include "tools.h"
|
|
|
|
|
#include "mylua.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define MODULE(s) DEBUG_##s
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MODULE(Delete)(WIN_DebugStruct *lock);
|
|
|
|
|
WIN_DebugStruct *WIN_CreatDebug (WIN_WindowStruct *base,
|
|
|
|
|
void (*msgLoop)(struct _WIN_WindowStruct *win,WIN_MsgStruct *msg),
|
|
|
|
|
int x,int y,int x_size,int y_size)
|
|
|
|
|
{
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣѭ<CFA2><D1AD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
if (msgLoop==0)
|
|
|
|
|
{
|
|
|
|
|
msgLoop=(void (*)(struct _WIN_WindowStruct *win,WIN_MsgStruct *msg))MODULE(DefaultMsgLoop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WIN_DebugStruct *ret=mymalloc (sizeof ( WIN_DebugStruct));
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><><EFBFBD>ø<EFBFBD><C3B8><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9>캯<EFBFBD><ECBAAF>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
if (ret)
|
|
|
|
|
{
|
|
|
|
|
mymemset (ret,0,sizeof ( WIN_DebugStruct));
|
|
|
|
|
if (0==WIN_CreatTouchEx((WIN_TouchWinStruct *)ret,base,msgLoop,x,y,x_size,y_size))
|
|
|
|
|
{
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
myfree (ret);
|
|
|
|
|
ret=0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
((WIN_WindowStruct *)ret)->winType="WIN_DebugStruct";
|
|
|
|
|
((WIN_WindowStruct *)ret)->deleteWindow=(void (*)(struct _WIN_WindowStruct *win))MODULE(Delete);
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//((WIN_WindowStruct *)ret)->intercept=1;//<2F><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD><CDB0><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
((WIN_WindowStruct *)ret)->bkcolor=0x008080;
|
|
|
|
|
((WIN_WindowStruct *)ret)->color=0xd7c1ac;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret->time_id1=WIN_CreatTimer ((WIN_WindowStruct *)ret,50);
|
|
|
|
|
freopen("lcd","r+",stdout);
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MODULE(Delete)(WIN_DebugStruct *lock)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
freopen("usart","r+",stdout);
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><><EFBFBD>ø<EFBFBD><C3B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٺ<EFBFBD><D9BA><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
WIN_DeleteWindow ( (WIN_WindowStruct *)lock);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int draw_char_at(int c,int x,int y)
|
|
|
|
|
{
|
|
|
|
|
char ch[3]={0};
|
|
|
|
|
if(c>0x80)
|
|
|
|
|
{ch[0]=c>>8;ch[1]=c;}
|
|
|
|
|
else ch[0]=c;
|
|
|
|
|
WIN_DrawTxtAt(ch,x,y);
|
|
|
|
|
return 8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//Ĭ<>ϻ<EFBFBD><CFBB>ƺ<EFBFBD><C6BA><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
void MODULE(DefaultPaint) (WIN_DebugStruct *home)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
int x=0;
|
|
|
|
|
int y=0;
|
|
|
|
|
int x_size=((WIN_WindowStruct *)home)->x_size;
|
|
|
|
|
int y_size=((WIN_WindowStruct *)home)->y_size;
|
|
|
|
|
|
|
|
|
|
WIN_PaintBackGround ((WIN_WindowStruct *)home);
|
|
|
|
|
u32 font_type=WIN_SetFontSize(16);
|
|
|
|
|
u32 color_bk=((WIN_WindowStruct *)home)->bkcolor;
|
|
|
|
|
u32 color=((WIN_WindowStruct *)home)->color;
|
|
|
|
|
WIN_SetLcdColor(color);
|
|
|
|
|
|
|
|
|
|
tools_dbg_print(draw_char_at);
|
|
|
|
|
|
|
|
|
|
WIN_SetFontSize(font_type);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MODULE(Exit)(WIN_DebugStruct *op)
|
|
|
|
|
{
|
|
|
|
|
if(op->work==0)
|
|
|
|
|
((WIN_WindowStruct *)op)->deleteWindow((WIN_WindowStruct *)op);
|
|
|
|
|
else
|
|
|
|
|
{
|
2025-07-05 19:47:28 +08:00
|
|
|
|
MSGBOX_TipsTime((WIN_WindowStruct *)op,"<EFBFBD><EFBFBD>ʾ","<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD>","ȷ<EFBFBD><EFBFBD>",5000);
|
2025-06-27 00:32:57 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//Ĭ<><C4AC><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
void MODULE(DefaultMsgLoop) (WIN_DebugStruct *home,WIN_MsgStruct *msg)
|
|
|
|
|
{
|
|
|
|
|
WIN_KeyStruct *k=0;
|
|
|
|
|
WIN_MoveStruct *m;
|
|
|
|
|
switch (msg->msg)
|
|
|
|
|
{
|
|
|
|
|
case WIN_MSG_PAINT:
|
|
|
|
|
MODULE(DefaultPaint)(home);
|
|
|
|
|
break;
|
|
|
|
|
case WIN_MSG_INIT:
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case WIN_MSG_TIMER:
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><>ʱ<EFBFBD><CAB1>ʱ<EFBFBD>䵽
|
2025-06-27 00:32:57 +08:00
|
|
|
|
if (msg->data.v==home->time_id1)
|
|
|
|
|
{
|
|
|
|
|
if (WIN_GetExWorkFunStat(home->work))
|
|
|
|
|
{
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ɣ<EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
WIN_ExWorkFunClear (home->work);
|
|
|
|
|
home->work=0;
|
|
|
|
|
}
|
|
|
|
|
WIN_SetInvalidWhenTop((WIN_WindowStruct *)home);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case WIN_MSG_CHID:
|
|
|
|
|
break;
|
|
|
|
|
case WIN_MSG_KEY:
|
|
|
|
|
k=msg->data.p;
|
|
|
|
|
if(k->shortPress&KEY_VALUE_DOWN)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
else if(k->shortPress&KEY_VALUE_UP)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
else if(k->shortPress&KEY_VALUE_ENTER)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
else if(k->shortPress&KEY_VALUE_HOME)
|
|
|
|
|
{
|
|
|
|
|
MODULE(Exit)(home);
|
|
|
|
|
}
|
|
|
|
|
WIN_SetInvalid((WIN_WindowStruct *)home);
|
|
|
|
|
break;//case WIN_MSG_KEY:
|
|
|
|
|
case WIN_MSG_MOVE:
|
|
|
|
|
m=msg->data.p;
|
|
|
|
|
switch(m->moveType)
|
|
|
|
|
{
|
|
|
|
|
case MOVE_DATA_SHORT:
|
|
|
|
|
WIN_SetInvalid((WIN_WindowStruct *)home);
|
|
|
|
|
break;
|
|
|
|
|
case MOVE_DATA_LONG:
|
|
|
|
|
{
|
|
|
|
|
MODULE(Exit)(home);
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
WIN_DefaultMsgLoop((WIN_WindowStruct *)home,msg);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
void DEBUG_EnterPrint(void)
|
|
|
|
|
{
|
|
|
|
|
WIN_DebugStruct *home=0;
|
|
|
|
|
WIN_WindowStruct *win=0;
|
|
|
|
|
if(win=WIN_GetWinByTitle(0,"debug"),win==0)
|
|
|
|
|
{
|
|
|
|
|
WIN_WindowStruct *base=0;
|
|
|
|
|
if(base==0) base=WIN_GetBaseWindow();
|
|
|
|
|
home=WIN_CreatDebug (base,0,0,0,base->x_size,base->y_size);
|
|
|
|
|
WIN_SetWinTitle((WIN_WindowStruct*)home,"debug");
|
|
|
|
|
|
|
|
|
|
WIN_ShowWindow((WIN_WindowStruct*)home);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
WIN_SetChidWinTop(win->baseWin,win);
|
|
|
|
|
WIN_ShowWindow(win);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int cb_run_lua(void *ptr)
|
|
|
|
|
{
|
|
|
|
|
char *argv[]={
|
|
|
|
|
"lua",
|
|
|
|
|
(char *)ptr,
|
|
|
|
|
};
|
|
|
|
|
|
2025-06-28 22:15:49 +08:00
|
|
|
|
// lua_main(2,argv);
|
2025-06-27 00:32:57 +08:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
void DEBUG_EnterPrintCmd(char *cmd)
|
|
|
|
|
{
|
|
|
|
|
WIN_DebugStruct *w=0;
|
|
|
|
|
|
|
|
|
|
WIN_WindowStruct *base=0;
|
|
|
|
|
if(base==0) base=WIN_GetBaseWindow();
|
|
|
|
|
w=WIN_CreatDebug (base,0,0,0,base->x_size,base->y_size);
|
|
|
|
|
|
|
|
|
|
mymemcpy(w->cmd,cmd,strlen(cmd)+1);
|
|
|
|
|
|
2025-07-05 19:47:28 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
w->work=WIN_CreatThreadPro (cb_run_lua,w->cmd,&w->ret,18);
|
|
|
|
|
|
|
|
|
|
WIN_ShowWindow((WIN_WindowStruct*)w);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#undef MODULE
|
|
|
|
|
|
|
|
|
|
|