#include "ClearDescp.h" #include "Runtime.h" extern "C"{ #include "user_norflash.h" #include "user_eeprom.h" #include "uart_key_drv.h" #include "task.h" } #define dWdClr clSkyBlue #define dWdDisabelClr clNearWhite #define dWWidth 24 #define dWHeigh 24 #define dRoundR 7 static const int xFirst = 10; void TClearDescp::Init() { CtlIndex = 0; IsShowing = 0; PermissionCmd =0; IsPermission =0; Eraser.OnGo = 0; Eraser.Step = 0xFF; } void TClearDescp::sDelayMs(unsigned int aMs) { volatile unsigned int mTick; volatile unsigned int Tick; for(Tick=0; Tick清除注释信息"); TextRender_string24(Lv.Grid.Left[0] + 10, Lv.Grid.Top[0] +6, clNearWhite, "清除注释信息"); TRoundRect::sDrawBySize(xFirst, Lv.Grid.Top[0] + 36, 72, 30, 7, clBlue, "确定", 12, clNearWhite); }else{ TextRender_string24(Lv.Caption.Left + 10, Lv.Caption.Top +4, clNearWhite, CaptionColor, "Advanced Setup->Clear All Description"); TextRender_string24(Lv.Grid.Left[0] + 10, Lv.Grid.Top[0] +6, clNearWhite, "Clear All Description"); TRoundRect::sDrawBySize(xFirst, Lv.Grid.Top[0] + 36, 72, 30, 7, clBlue, "Clear", 6, clNearWhite); } } void TClearDescp::DrawSelf(void) { RenderBackGround(); RectFillRender(Lv.Caption.Left, Lv.Caption.Top, Lv.Caption.Right, Lv.Caption.Bottom, CaptionColor); for(int i=0; i 2){ PermissionCmdGO(); }else{ IsPermission = 1; if(LanguageEnCn==0) TRoundRect::sDrawBySize(xFirst, Lv.Grid.Top[0] + 36, 72, 30, 7, clNearWhite, "确定", 12, clNearBlack); else TRoundRect::sDrawBySize(xFirst, Lv.Grid.Top[0] + 36, 72, 30, 7, clNearWhite, "Clear", 6, clNearBlack); PmsIntervene4Gui.Show4Gui(100, Lv.Grid.Bottom[0] + 40, 600 , 120, 3); } } break; case VK_RETURN: IsShowing = 0; if(Eraser.OnGo){ ForceExit(); } aMsg = guiMsgReturn; break; } } return aMsg; } void TClearDescp::Task1000Ms() { volatile unsigned int uiVal; if(IsShowing){ if(Eraser.OnGo == 0xB6){ if(Eraser.Step < 6){ sDelayMs(2); uiVal = nor_get_busy_state(dEepDescpChip); if(uiVal)return; uiVal = dFlashAddrDescpBase + (Eraser.Step * 0x10000); nor_erase_sector_64k(dEepDescpChip,uiVal); Eraser.Step++; }else if(Eraser.Step < 7){ sDelayMs(2); uiVal = nor_get_busy_state(dEepDescpChip); if(uiVal)return; Eraser.Step++; }else{ sDelayMs(2); uiVal = nor_get_busy_state(dEepDescpChip); if(uiVal)return; Record.ReadDescp(); if(LanguageEnCn==0) TextRender_string24(400, Lv.Grid.Top[0]+ 36, clNearWhite, ItemColor, "清除完成 "); else TextRender_string24(400, Lv.Grid.Top[0]+ 36, clNearWhite, ItemColor, "Cleared "); Record.OperateAdd_CleanUp(4); Eraser.OnGo =0; } } } } void TClearDescp::ForceExit() { Record.ReadDescp(); Record.OperateAdd_CleanUp(0xF4); Eraser.OnGo =0; } int TClearDescp::ExtRequst(unsigned char Prm) { IsShowing =0; if(Eraser.OnGo){ ForceExit(); } return 0; }