📄 ui_execute.c
字号:
/******************************************************************************
* Copyright (c) 2006 Primax Corporation,Ltd. All rights reserved.
*
* Author: shaohua
*
* Description:
*
* Revision History:
* Date Author Description
******************************************************************************/
#include "Standard.h"
#include "Nucleus.h"
#include "Uifax.h"
#include "Menu.h"
#include "Smfm.h"
#include "Uilcdnew.h"
#include "RTC.h"
#include "Message.h"
#include "Uinew.h"
#include "Bios.h"
#include "ts.h"
#include "UI_Execute.h"
#include "jsusb.h"
#include "Jobprint.h"
#include "uilcdnew.h"
#define UI_EXE_stack_size 2000 //(sizeof(Uint32))
static Uint32 UI_EXe_stack[UI_EXE_stack_size];
NU_TASK uiExeTASK;
STATUS task_Status;
NU_MAILBOX UI_MailBox;
STATUS MailBoxStatus;
static tsTaskID UI_Execute_ID=INVALIDTASK;
Sint32 UI_EXe_msgQue_id = INVALIDMSGQ;
void UI_ExecuteInit(void);
void UI_Execute(void);
//extern const Uint8 Clear_drum[];
extern char firstlinebuf[],secondlinebuf[];
void UI_ExecuteInit(void)
{
task_Status = NU_Create_Task(&uiExeTASK,
"UIExe_task",
UI_Execute,
0,
NU_NULL,
UI_EXe_stack,
UI_EXE_stack_size,
30,
10,
NU_PREEMPT,
NU_START);
while(task_Status != NU_SUCCESS)
{
PSPRINTF("Create UIExe_task fail!");
}
MailBoxStatus =NU_Create_Mailbox(&UI_MailBox,"UiMailBox",NU_FIFO);
while(MailBoxStatus != NU_SUCCESS)
{
PSPRINTF("Create UiMailBox fail!");
}
}
void UI_Execute(void)
{
Msg ExeCmd;
Uint32 *Page_Buff,i;
PrintAppData printAppInfo_UI;
int read_ok;
Uint8 string_len,count;
char *disp_str;
Uint32 UI_message[4];
while(1)
{
// TaskMsgWait(UI_EXe_msgQue_id, &ExeCmd);
NU_Receive_From_Mailbox(&UI_MailBox,(void *)UI_message,NU_SUSPEND);
//switch(ExeCmd.msg1)
//PSPRINTF("\nUI_message:%02x",UI_message[0]);
switch(UI_message[0])
{
case disp_special: //LCD character shift display
{
string_len = strlen(secondlinebuf);
if((UI_message[1] == 1) && (string_len < LCD_LINE_MAX-1))
{
break;
}
if((UI_message[1] == 0) && (string_len < LCD_LINE_MAX+1))
{
break;
}
count = string_len - 11;
PSPRINTF("\nmenu display shift! LEN:%02x \n ",count);
disp_str = secondlinebuf;
for(i = 0; i < count; i++,disp_str++)
{
if(strlen(secondlinebuf) != string_len)
{
break;
}
if(UI_message[1] == 1)
{
LCDStringOut(1, 1, disp_str, LCD_LINE_MAX-2);
LCDCharOut(0, 1, 0xBD);
LCDCharOut(15, 1, 0xBC);
}
else
{
LCDStringOut(1, 1, disp_str, LCD_LINE_MAX);
}
NU_Sleep(200);
}
if(strlen(secondlinebuf) != string_len)
{
break;
}
if(UI_message[1] == 1)
{
LCDStringOut(1, 1, disp_str, LCD_LINE_MAX-2);
LCDCharOut(0, 1, 0xBD);
LCDCharOut(15, 1, 0xBC);
}
else
{
LCDStringOut(1, 1, disp_str, LCD_LINE_MAX);
}
}break;
case Print_Accuracy:
{
//PSPRINTF("\nPrint_Accuracy_Pages:%d\n",Print_Accuracy_Pages);
SPI_Config();
Page_Buff = (void *)malloc_locked(Print_Accuracy_Pages * 512);
read_ok=0xff;
LockSPIMode(TRUE);
read_ok = SPI_ReadPage(Print_Accuracy_Adrr, Print_Accuracy_Pages, Page_Buff);
if(0==read_ok)
{
PSPRINTF("Read test page from flash succeed!");
}
else
{
PSPRINTF("Read test page from flash fail!");
}
UnlockSPIMode();
PSPRINTF("first byte: %02x",(Uint8)Page_Buff[0]);
if((Uint8)Page_Buff[0]==0x47)
{
PSPRINTF("Printing Test page...");
MemPrint(Page_Buff, &printAppInfo_UI);
}
else
{
NU_Sleep(50);
LCDDisplayClear();
strcpy(firstlinebuf,GetMsgData(DISP_NO_PRINT_DATA));
strcpy(secondlinebuf,GetMsgData(DISP_PLS_LOAD_DATA));
DisplayLCD(0,firstlinebuf,MIDDLE,FALSE);
DisplayLCD(1,secondlinebuf,MIDDLE,FALSE);
NU_Sleep(50);
//strcpy(firstlinebuf,"Ready-Toner ");
//strcpy(secondlinebuf,"Please download data!");
}
free(Page_Buff);
}break;
case Print_20Gray:
{
SPI_Config();
Page_Buff = (void *)malloc_locked(Print20Gray_Pages * 512);
read_ok=0xff;
LockSPIMode(TRUE);
read_ok = SPI_ReadPage(Print20Gray_Addr, Print20Gray_Pages, Page_Buff);
if(0==read_ok)
{
PSPRINTF("Read test page from flash succeed!");
}
else
{
PSPRINTF("Read test page from flash fail!");
}
UnlockSPIMode();
if((Uint8)Page_Buff[0]==0x47)
{
PSPRINTF("Printing Test page...");
MemPrint(Page_Buff, &printAppInfo_UI);
}
else
{
NU_Sleep(50);
LCDDisplayClear();
strcpy(firstlinebuf,GetMsgData(DISP_NO_PRINT_DATA));
strcpy(secondlinebuf,GetMsgData(DISP_PLS_LOAD_DATA));
DisplayLCD(0,firstlinebuf,MIDDLE,FALSE);
DisplayLCD(1,secondlinebuf,MIDDLE,FALSE);
NU_Sleep(50);
//strcpy(firstlinebuf,"Ready-Toner ");
//strcpy(secondlinebuf,"Please download data!");
}
free(Page_Buff);
}break;
case Print_ClearDrum:
{
SPI_Config();
Page_Buff = (void *)malloc_locked(ClearDrum_Pages * 512);
read_ok=0xff;
LockSPIMode(TRUE);
read_ok = SPI_ReadPage(ClearDrum_Addr, ClearDrum_Pages, Page_Buff);
if(0==read_ok)
{
PSPRINTF("Read test page from flash succeed!");
}
else
{
PSPRINTF("Read test page from flash fail!");
}
UnlockSPIMode();
PSPRINTF("\n%d : ",*Page_Buff);
for(i=0;i<16;i++)
{
PSPRINTF(" %02X ",Page_Buff[i]);
}
if((Uint8)Page_Buff[0]==0x47)
{
PSPRINTF("Printing Test page:");
MemPrint(Page_Buff, &printAppInfo_UI);
}
else
{
NU_Sleep(50);
LCDDisplayClear();
strcpy(firstlinebuf,GetMsgData(DISP_NO_PRINT_DATA));
strcpy(secondlinebuf,GetMsgData(DISP_PLS_LOAD_DATA));
DisplayLCD(0,firstlinebuf,MIDDLE,FALSE);
DisplayLCD(1,secondlinebuf,MIDDLE,FALSE);
NU_Sleep(50);
//strcpy(firstlinebuf,"Ready-Toner ");
//strcpy(secondlinebuf,"Please download data!");
}
free(Page_Buff);
}break;
case Print_5percent:
{
SPI_Config();
Page_Buff = (void *)malloc_locked(percent5_pages * 512);
read_ok=0xff;
LockSPIMode(TRUE);
read_ok = SPI_ReadPage(percent5_Addr, percent5_pages, Page_Buff);
if(0==read_ok)
{
PSPRINTF("Read test page from flash succeed!");
}
else
{
PSPRINTF("Read test page from flash fail!");
}
UnlockSPIMode();
//PSPRINTF("\n%d : ",*Page_Buff);
//for(i=0;i<16;i++)
//{
// PSPRINTF(" %02X ",Page_Buff[i]);
//}
if((Uint8)Page_Buff[0]==0x47)
{
PSPRINTF("Printing Test page:");
MemPrint(Page_Buff, &printAppInfo_UI);
}
else
{
NU_Sleep(50);
LCDDisplayClear();
strcpy(firstlinebuf,GetMsgData(DISP_NO_PRINT_DATA));
strcpy(secondlinebuf,GetMsgData(DISP_PLS_LOAD_DATA));
DisplayLCD(0,firstlinebuf,MIDDLE,FALSE);
DisplayLCD(1,secondlinebuf,MIDDLE,FALSE);
NU_Sleep(50);
//strcpy(firstlinebuf,"Ready-Toner ");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -