void IP_extract(uint8_t * buf, uint8_t type)
{
  int i,j;
  char ip_address[32];
  switch(type)
  {
    case(1):
      for(i = 0; buf[i] != ':';i++)    // Message Format: <IP>:<Subnet>
      {
        ip_address[i] = (char)buf[i];
      }
      ip_address[i]='\0';
      LCDPrintf(2,0,"IP:");
      LCDPrintf(3,0,"%s",ip_address);
      LCDPrintf(4,0,"Port: 8010");
      break;
    case(2):
      for(i = 12,j=0; i<=24;i++,j++)    // From Message Buffer               
      {                                 // Message Format = CONNECTED<CID><0/1> <IP>        
        ip_address[j] = (char)buf[i];   //                                      ^
      }                                 //                                      |
      ip_address[j]='\0';               //                                     12th bit 
      LCDPrintf(2,0,"Client IP:");
      LCDPrintf(3,0,"%s",ip_address);
      break;
      
}     
}   
void Disp_Client_Data()
{
  uint8_t line = 1 ,column = 0,chk =0;
  char buf;
  LCDClear();
  LCDFont(FONT_SMALL);
  while(1)
  {
    while(!WIFI_ReceiveByte(&buf));
    chk = Parse_Data(buf);
    if(chk == 2)
    {
      Format_Data(buf,&line,&column);
      if(buf == 'X')
      {
        LCDClear();
        LCDPrintf(1,0,"Connection Closed");
        LCDPrintf(8,0,"SW2 to Exit");
        wait_for_sw();
        LCDPrintf(8,0,"Exit        ");
        break;
      }
        
  }
}
}
void Auto_Setup(uint8_t type)
{
  LCDPrintf(1,0,"Connecting..");
  switch(type)
  {
    case 0:
      LCDClear();
      LCDFont(FONT_SMALL);
      Echo_Disable();             // Disable Echo for each command ( easier to parse)
     while (!(Echo_Confirm()));   // Send AT command till response OK 
     if(!Disassociate())          // Disassociate if currently associated to any network
      {
       LCDPrintf(5,0,"Exit");
        break;
      }
      if(!DHCP_Enable())         // Enable Dynamic IP (or Dynamic Host Configuration Protocol)
      {
        LCDPrintf(5,0,"Exit");
        break;
      }
      if(!Auto_Wifi())           // Configure Auto Connect Wifi settings
      {
        LCDPrintf(5,0,"Exit");
        break;
      }
      if(!Auto_Network())       // Configure Auto Connect Network Settings 
      {
        LCDPrintf(5,0,"Exit");
        break;
      }
      if(!Auto_Enable())        // Enable Auto Connect Profile
      {
        LCDPrintf(5,0,"Exit");
        break;
      }
      if(!Auto_Start())         // Start Auto Connect
      {
        LCDPrintf(5,0,"Exit");
        break;
      }
      LCDPrintf(1,0,"Connected");
      LCDPrintf(8,0,"SW2 to connect");
      break;
    default:
      break;
  }
// Auto connection done 
// Now Actual Application  
  wait_for_sw();
  LCDClear();
  LCDPrintf(1,0,"Connect Client");
  Data_handle(CLIENT);            // Wait For Client Connection Details
  wait_for_sw();
//  Disp_Client_Data();             // Parse message sent from Client and Display the Data
}      
uint8_t Response_handle()
{
   uint8_t inbuf[64];
   uint32_t i =0; 
   uint8_t chk = 0;
   char buf;
  while(!(P7 & (1<<7)));
  while (1)
  { 
    while(!WIFI_ReceiveByte(&buf));   // Checks and flushes data from WIFI SPI buffer one character at a time
    chk = Received_Char_Handle(buf);  // State Machine to Extract message from formated message response
       if(chk == 2)
       {
          inbuf[i++] = buf;
          if(i > 64)
          {
            LCDPrintf(7,0,"OVERFLOW");   
            i = 0;
          }
       }
       else if (chk == 1)
       { 
         break;
       }
  }
   inbuf[i] = '\0';
   if(inbuf[0] == 'O')
     return (1);
   else if(inbuf[0] == 'E')
     return (0);
   else
   {
     return (0);
   }     
}
void Data_handle(uint8_t type)
{
   uint8_t inbuf[64];
   uint32_t i =0; 
   uint8_t chk = 0;
   char buf;
  while(!(P7 & (1<<7)));
  while (1) 
  { 
        while(!WIFI_ReceiveByte(&buf));   // Checks and flushes data from WIFI SPI buffer one character at a time
       chk = Received_Char_Handle(buf);   // State Machine to Extract message from formated message response
       if(chk == 2)
       {
          inbuf[i++] = buf;
          if(i > 64)
          {
            LCDPrintf(7,0,"OVERFLOW");   
            i = 0;
          }
       }
       else if (chk == 1)
       { 
         break;
       }
  }
inbuf[i] = '\0';
switch(type)
{
  case IP: IP_extract(inbuf,1);break;
  case CLIENT: 
    if(inbuf[0] == 'C')
    {
      LCDPrintf(1,0,"Client Connected");
      LCDPrintf(8,0,"SW2 for Data");
      connection_id = inbuf[10];
      IP_extract(inbuf,2);
    }
}
}
void Format_Data(char buf, uint8_t* line, uint8_t* column)
{
  
    if(buf == '\r' || buf == '\n')
    {
      if(*line == 7)
      {
        *line = 1;
        LCDClear();
      }
      else
        (*line)++;
    }
    else if ( buf >= 'a'  || buf <= 'z' || buf >='A' || buf <= 'Z' 
                || buf >= '1' || buf <= '9')
    {
        LCDPrintf(*line,*column,"%c",buf);
        if(*column == 16)
        {
          if(*line == 7)
          {
            *line = 1;
            LCDClear();
          }
          else 
            (*line)++;
          *column = 0;
        }
        else
          (*column)++;
    }
    else if ( buf == SPI_CHAR_IDLE);
    else
    {
      LCDPrintf(8,0,"Invalid Char");
    }
}
Beispiel #7
0
void  LCDTest2(void)
{
	volatile int32_t n;
	float f1=3.1415927;
	uint8_t i, y;

	while (1) {

		LCDClear();
		LCDFont(FONT_SMALL);
		LCDPrintf(1, 0, "Small Font");
		LCDPrintf(2, 0, "1234567890123456789");
		for (i=3; i<LCD_H/G_CharHeight; i++)
			LCDPrintf(i, 0, "Line %u", i);
	
		for (n=0; n<100000; n++)
			;
		
		LCDClear();
		
		LCDFont(FONT_LARGE);
		LCDPrintf(0, 0, "Large Font");
		LCDPrintf(1, 0, "123456789ABC");
		for (i=2; i<LCD_H/G_CharHeight; i++)
			LCDPrintf(i, 0, "Line %u", i);
	
		for (n=0; n<100000; n++)
			;
		
		LCDClear();
	
		n = 123;
		LCDPrintf(1, 0, "%d", n);
		LCDPrintf(2, 0, "%x", n);
		LCDPrintf(3, 0, "%5d", n);
		LCDPrintf(4, 0, "%-5d", n);
		LCDPrintf(5, 0, "%5.4d", n);
	
		for (n=0; n<100000; n++)
			;
		
		LCDClear();

		LCDPrintf(1, 0, "%f", f1);
		LCDPrintf(2, 0, "%-6.3f", f1);
		LCDPrintf(3, 0, "%6.3f", f1);
		LCDPrintf(4, 0, "%8.3f", f1);
		LCDPrintf(5, 0, "%.6f", f1);
	
		for (n=0; n<100000; n++)
			;
		LCDClear();
	

		for (i=0; i<LCD_W; i++) {
			y = (uint8_t) (30 - 20*sin(0.2*i));
	   	GlyphDrawBlock(G_lcd, i, y, i, 50);
		}

		for (n=0; n<100000; n++)
			;
		LCDClear();

		for (i=0; i<LCD_W; i++) {
			y = 32 - (i&31);
	   	GlyphDrawBlock(G_lcd, i, y, i, 50);
		}
		
		for (n=0; n<100000; n++)
			;
		
	}	
}
Beispiel #8
0
/*********************************************************************************************************
** Function name:     	acdc_manage
** Creater By		:	yoc 2014.05.07
** Descriptions:	   展示灯压缩机管理操作页面
** input parameters:    type 1压缩机  2展示灯3加热 4除臭
** output parameters:   无
** Returned value:
*********************************************************************************************************/
void acdc_manage(const unsigned char type)
{
    unsigned char topFlush = 1,topReturn = 0,changed = 0;
    unsigned char key,lang,cabinetNO = 1,flag,rst;
    char *acdcTitleStr;
    DEVICECONTROLTIME *stDevPtr;
    lang= SystemPara.Language;

    while(SystemPara.SubBinOpen || SystemPara.hefangGui)
    {
        if(topFlush)
        {
            topFlush = 0;
            LCDClrScreen();
            LCDDrawRectangle(0,0,239,15);
            LCDDrawRectangle(0,0,239,3);
            LCDClrArea(1,4,238,14);
            LCDPrintf(8,1,0,lang," %s",ui_acdc_man.manage[lang]);
            LCDPrintf(8,5,0,lang," %s",ui_aisle_admin.enternCabinetNo[lang]);
            LCDPrintf(8,7,0,lang," %s%s",ui_aisle_admin.no_1[lang],ui_aisle_admin.A_Bin[lang]);
            if(SystemPara.SubBinOpen && SystemPara.hefangGui)
            {
                LCDPrintf(8,9,0,lang," %s%s",ui_aisle_admin.no_2[lang],ui_aisle_admin.B_Bin[lang]);
                LCDPrintf(8,11,0,lang," %s%s",ui_aisle_admin.no_3[lang],ui_aisle_admin.hefan[lang]);
            }
            else if(SystemPara.SubBinOpen)
                LCDPrintf(8,9,0,lang," %s%s",ui_aisle_admin.no_2[lang],ui_aisle_admin.B_Bin[lang]);
            else if(SystemPara.hefangGui)
                LCDPrintf(8,9,0,lang," %s%s",ui_aisle_admin.no_2[lang],ui_aisle_admin.hefan[lang]);

        }
        key = ReadKeyValue();
        OSTimeDly(5);
        if(key == '1')
        {

            cabinetNO = 1;
            break;
        }
        else  if(key == '2')
        {
            if(SystemPara.SubBinOpen)
            {
                cabinetNO = 2;

                break;
            }
            else if(SystemPara.hefangGui)
                return;
            topFlush = 1;

        }
        else if(key == '3')
        {
            if(SystemPara.hefangGui)
                return;
            topFlush = 1;
        }
        else if(key == 'C')
            return;
    }

    if(cabinetNO == 1)
    {
        if(type == 1)//压缩机
        {
            acdcTitleStr = ui_acdc_man.cprtManage[lang];
            stDevPtr = &UserPara.CompressorCtr;
        }
        else if(type == 2)//展示灯
        {
            acdcTitleStr = ui_acdc_man.lightManage[lang];
            stDevPtr = &UserPara.LEDCtr;
        }
        else if(type == 4)//除臭
        {
            acdcTitleStr = ui_acdc_man.chuchouManage[lang];
            stDevPtr = &UserPara.box1Chuchou;
        }
        else
            return;

    }
    else if(cabinetNO == 2)
    {
        if(type == 1)
        {
            acdcTitleStr = ui_acdc_man.cprtManage[lang];
            stDevPtr = &UserPara.CompressorCtr2Bin;
        }
        else if(type == 2)
        {
            acdcTitleStr = ui_acdc_man.lightManage[lang];
            stDevPtr = &UserPara.LEDCtr2Bin;
        }
        else if(type == 4)//除臭
        {
            acdcTitleStr = ui_acdc_man.chuchouManage[lang];
            stDevPtr = &UserPara.box2Chuchou;
        }
        else
            return;

    }
    else
    {
        return;
    }


    topFlush = 1;
    while(1)
    {
        if(topFlush)
        {
            topFlush = 0;
            LCDClrScreen();
            LCDDrawRectangle(0,0,239,15);
            LCDDrawRectangle(0,0,239,3);
            LCDClrArea(1,4,238,14);
            if(stDevPtr->flag & (0x01 << 1))
                LCDPrintf(8,1,0,lang,"%s %s",acdcTitleStr,ui_acdc_man.timerStarting[lang]);
            else if(stDevPtr->flag & 0x01)
                LCDPrintf(8,1,0,lang,"%s %s",acdcTitleStr,ui_aisle_admin.open[lang]);
            else
                LCDPrintf(8,1,0,lang,"%s %s",acdcTitleStr,ui_aisle_admin.close[lang]);

            LCDPrintf(8,5,0,lang,"%s %s",ui_aisle_admin.no_1[lang],ui_aisle_admin.open[lang]);
            LCDPrintf(8,7,0,lang,"%s %s",ui_aisle_admin.no_2[lang],ui_aisle_admin.close[lang]);
            LCDPrintf(8,9,0,lang,"%s %s",ui_aisle_admin.no_3[lang],ui_acdc_man.timerManage[lang]);



        }

        if(topReturn)
            return;

        key = ReadKeyValue();
        OSTimeDly(5);
        switch(key)
        {
        case '1':
        case '2':
            flag = (key == '1') ? 1 : 0;


            TraceCompress("acdc man type = %d %d\r\n",type,stDevPtr->flag);
            LCDPrintf(8,1,0,lang,"%s %s",acdcTitleStr,ui_acdc_man.operating[lang]);
            OSTimeDly(100);
            if(type == 4)
                rst = acdc_chuchou_API(cabinetNO,flag & 0x01);
            else
            {
                stDevPtr->flag = flag;
                if(cabinetNO == 1)
                    rst = acdc_handle_API(1,UserPara.LEDCtr.flag & 0x01,UserPara.CompressorCtr.flag & 0x01);
                else
                    rst = acdc_handle_API(2,UserPara.LEDCtr2Bin.flag & 0x01,UserPara.CompressorCtr2Bin.flag & 0x01);
            }
            if(rst)
            {
                stDevPtr->flag = flag;
                LCDPrintf(8,1,0,lang,"%s %s",acdcTitleStr,ui_acdc_man.operateSuc[lang]);

            }
            else
                LCDPrintf(8,1,0,lang,"%s %s",acdcTitleStr,ui_acdc_man.operateFail[lang]);

            OSTimeDly(200);


            topFlush = 1;
            break;

        case '3':
            changed = acdc_timerHandlePage(cabinetNO,type);
            if(changed == 1)
            {
                chuchouFlush = 1;
            }
            topFlush = 1;
            break;
        case 'C':
            topReturn = 1;
            break;
        case 'E':
            topReturn = 1;
            break;
        default:
            break;
        }

    }


}
Beispiel #9
0
/*********************************************************************************************************
** Function name:     	acdc_timerHandlePage
** Creater By		:	yoc 2014.05.07
** Descriptions:	   压缩机和展示灯定时操作页面
** input parameters:    cabinet 柜号type 1压缩机  2展示灯3 加热 4除臭
** output parameters:   无
** Returned value:
*********************************************************************************************************/
unsigned char acdc_timerHandlePage(unsigned char cabinet,unsigned char type)
{
    unsigned char topFlushFlag = 1,topReturnFlag = 0,enterSub = 0,subFlushFlag = 0;
    unsigned char lang,key,tempState,changed = 0;
    unsigned char cursorIndex = 0;
    char buf[4] = {' '},dis_buf[4];

    DEVICECONTROLTIME *stDevPtr;


    if(cabinet == 1)
    {
        if(type == 1)
            stDevPtr = &UserPara.CompressorCtr;
        else if(type == 2)//展示灯
            stDevPtr = &UserPara.LEDCtr;
        else if(type == 4)//除臭
            stDevPtr = &UserPara.box1Chuchou;
        else
            return changed;
    }
    else
    {
        if(type == 1)
            stDevPtr = &UserPara.CompressorCtr2Bin;
        else if(type == 2)//展示灯
            stDevPtr = &UserPara.LEDCtr2Bin;
        else if(type == 4)//除臭
            stDevPtr = &UserPara.box2Chuchou;
        else
            return changed;
    }

    lang = SystemPara.Language;
    while(1)
    {
        if(topFlushFlag)
        {
            topFlushFlag = 0;
            LCDClrScreen();
            LCDDrawRectangle(0,0,239,15);
            LCDDrawRectangle(0,0,239,3);
            LCDClrArea(1,4,238,14);
            if(stDevPtr->flag & 0x02)
                LCDPrintf(8,1,0,lang,"%s %s",ui_acdc_man.timerManage[lang],ui_aisle_admin.open[lang]);
            else
                LCDPrintf(8,1,0,lang,"%s %s",ui_acdc_man.timerManage[lang],ui_aisle_admin.close[lang]);

            LCDPrintf(8,5,0,lang,"%s %s",ui_aisle_admin.no_1[lang],ui_aisle_admin.open[lang]);
            LCDPrintf(8,7,0,lang,"%s %s",ui_aisle_admin.no_2[lang],ui_aisle_admin.close[lang]);
            if(stDevPtr->flag & 0x02)
            {
                LCDPrintf(8,9,0,lang,"%s %s %02d:%02d",ui_aisle_admin.no_3[lang],ui_acdc_man.startTime[lang],
                          stDevPtr->HourOn,
                          stDevPtr->MinOn);
                LCDPrintf(8,11,0,lang,"%s %s %02d:%02d",ui_aisle_admin.no_4[lang],ui_acdc_man.stopTime[lang],
                          stDevPtr->HourOff,
                          stDevPtr->MinOff);
            }

        }

        if(topReturnFlag)
        {
            return changed;
        }

        key = ReadKeyValue();
        OSTimeDly(5);

        switch(key)
        {
        case '1':
        case '2':
            tempState = (key == '1')? 1 : 0;
            stDevPtr->flag = (tempState << 1);
            topFlushFlag = 1;
            break;
        case '3':
            if(stDevPtr->flag & 0x02)
            {
                subFlushFlag = 1;
                enterSub = 1;
                cursorIndex = 0;
                buf[0] = stDevPtr->HourOn  / 10 + '0';
                buf[1] = stDevPtr->HourOn  % 10 + '0';
                buf[2] = stDevPtr->MinOn   / 10 + '0';
                buf[3] = stDevPtr->MinOn   % 10 + '0';
            }

            break;
        case '4':
            if(stDevPtr->flag & 0x02)
            {
                subFlushFlag = 1;
                enterSub = 3;
                cursorIndex = 0;
                buf[0] = stDevPtr->HourOff  / 10 + '0';
                buf[1] = stDevPtr->HourOff  % 10 + '0';
                buf[2] = stDevPtr->MinOff   / 10 + '0';
                buf[3] = stDevPtr->MinOff   % 10 + '0';
            }
            break;
        case 'C':
            enterSub = 0;
            topReturnFlag = 1;
            break;
        default:
            break;

        }

        while(enterSub)//编辑界面
        {
            if(subFlushFlag)
            {
                subFlushFlag = 0;
                dis_buf[0] = (cursorIndex == 0) ? '-': buf[0];
                dis_buf[1] = (cursorIndex == 1) ? '-': buf[1];
                dis_buf[2] = (cursorIndex == 2) ? '-': buf[2];
                dis_buf[3] = (cursorIndex == 3) ? '-': buf[3];
                {
                    if(enterSub < 3)
                    {
                        LCDPrintf(8,9,1,lang,"%s %s %c%c:%c%c",ui_aisle_admin.no_3[lang],ui_acdc_man.startTime[lang],
                                  dis_buf[0],dis_buf[1],dis_buf[2],dis_buf[3]);
                    }
                    else
                        LCDPrintf(8,11,1,lang,"%s %s %c%c:%c%c",ui_aisle_admin.no_4[lang],ui_acdc_man.stopTime[lang],
                                  dis_buf[0],dis_buf[1],dis_buf[2],dis_buf[3]);
                }

            }

            key = ReadKeyValue();
            OSTimeDly(5);
            switch(key)
            {
            case '1':
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
            case '0':


                if(cursorIndex == 0 && (key - '0') >= 3)
                    break;
                if(cursorIndex == 1 && (buf[0] == '2') && ((key - '0') >= 4))
                    break;
                if(cursorIndex == 2 && (key - '0') >= 6)
                    break;

                buf[cursorIndex] = key;
                if(cursorIndex == 3)
                {
                    if(enterSub < 3)
                    {
                        stDevPtr->HourOn = (buf[0] - '0') * 10 + (buf[1] - '0');
                        stDevPtr->MinOn = (buf[2] - '0') * 10 + (buf[3] - '0');
                    }
                    else
                    {
                        stDevPtr->HourOff = (buf[0] - '0') * 10 + (buf[1] - '0');
                        stDevPtr->MinOff = (buf[2] - '0') * 10 + (buf[3] - '0');
                    }
                    enterSub = 0;
                    topFlushFlag = 1;
                    break;
                }
                cursorIndex = (++cursorIndex) % 4;
                subFlushFlag = 1;
                break;
            case '>':
                cursorIndex = (++cursorIndex) % 4;
                break;
            case '<':
                cursorIndex = (cursorIndex) ? (--cursorIndex): 3;
                break;
            case 'C':
                enterSub = 0;
                topFlushFlag = 1;
                break;
            case 'E'://确定编辑
                if(enterSub < 3)
                {
                    stDevPtr->HourOn = (buf[0] - '0') * 10 + (buf[1] - '0');
                    stDevPtr->MinOn = (buf[2] - '0') * 10 + (buf[3] - '0');
                }
                else
                {
                    stDevPtr->HourOff = (buf[0] - '0') * 10 + (buf[1] - '0');
                    stDevPtr->MinOff = (buf[2] - '0') * 10 + (buf[3] - '0');
                }
                acdc_chuchou_API(cabinet,stDevPtr->flag & 0x01);

                enterSub = 0;
                topFlushFlag = 1;
                changed = 1;
                break;
            }

        }


    }
}
Beispiel #10
0
void acdc_hotTimerHandlePage(unsigned char cabinet)
{

    unsigned char topFlushFlag = 1,topReturnFlag = 0;
    unsigned char lang,key;


    ST_HOT_DEV *hotPtr;
    if(cabinet == 1)
    {
        hotPtr = &UserPara.box1Hot;
    }
    else if(cabinet == 2)
    {
        hotPtr = &UserPara.box2Hot;
    }
    else
        return;

    lang = SystemPara.Language;
#if 1

    while(1)
    {

        if(topFlushFlag)
        {
            topFlushFlag = 0;
            LCDClrScreen();
            LCDDrawRectangle(0,0,239,15);
            LCDDrawRectangle(0,0,239,3);
            LCDClrArea(1,4,238,14);

            LCDPrintf(8,1,0,lang,"%s",ui_acdc_man.timerManage[lang]);
            if(hotPtr->flag & (0x01 << 2))
                LCDPrintf(8,5,0,lang,"%s %s1:%s",ui_aisle_admin.no_1[lang],
                          ui_acdc_man.durTime[lang],ui_aisle_admin.open[lang]);
            else
                LCDPrintf(8,5,0,lang,"%s %s1:%s",ui_aisle_admin.no_1[lang],
                          ui_acdc_man.durTime[lang],ui_aisle_admin.close[lang]);

            if(hotPtr->flag & (0x01 << 3))
                LCDPrintf(8,7,0,lang,"%s %s2:%s",ui_aisle_admin.no_2[lang],
                          ui_acdc_man.durTime[lang],ui_aisle_admin.open[lang]);
            else
                LCDPrintf(8,7,0,lang,"%s %s2:%s",ui_aisle_admin.no_2[lang],
                          ui_acdc_man.durTime[lang],ui_aisle_admin.close[lang]);
            if(hotPtr->flag & (0x01 << 4))
                LCDPrintf(8,9,0,lang,"%s %s3:%s",ui_aisle_admin.no_3[lang],
                          ui_acdc_man.durTime[lang],ui_aisle_admin.open[lang]);
            else
                LCDPrintf(8,9,0,lang,"%s %s3:%s",ui_aisle_admin.no_3[lang],
                          ui_acdc_man.durTime[lang],ui_aisle_admin.close[lang]);
            if(hotPtr->flag & (0x01 << 5))
                LCDPrintf(8,11,0,lang,"%s %s4:%s",ui_aisle_admin.no_4[lang],
                          ui_acdc_man.durTime[lang],ui_aisle_admin.open[lang]);
            else
                LCDPrintf(8,11,0,lang,"%s %s4:%s",ui_aisle_admin.no_4[lang],
                          ui_acdc_man.durTime[lang],ui_aisle_admin.close[lang]);
            if(hotPtr->flag & (0x01 << 6))
                LCDPrintf(8,13,0,lang,"%s %s5:%s",ui_aisle_admin.no_5[lang],
                          ui_acdc_man.durTime[lang],ui_aisle_admin.open[lang]);
            else
                LCDPrintf(8,13,0,lang,"%s %s5:%s",ui_aisle_admin.no_5[lang],
                          ui_acdc_man.durTime[lang],ui_aisle_admin.close[lang]);

        }

        if(topReturnFlag)
        {
            return ;
        }

        key = ReadKeyValue();
        OSTimeDly(5);

        switch(key)
        {
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
            acdc_hotTimerSetPage(cabinet,(key - '0'));

            if((hotPtr->flag & 0x7C) || (hotPtr->flag & 0x01) )
            {
                hotPtr->flag |= 0x02;
            }
            else
                hotPtr->flag &= ~0x02;
            tempFlush = 1;
            topFlushFlag = 1;
            break;
        case 'C':

            topReturnFlag = 1;
            break;
        default:
            break;

        }
    }
#endif




}
Beispiel #11
0
void acdc_hotTimerSetPage(unsigned char cabinet,const unsigned char no)
{
    unsigned char topFlushFlag = 1,topReturnFlag = 0,enterSub = 0,subFlushFlag = 0;
    unsigned char lang,key;
    unsigned char cursorIndex = 0;
    char buf[4] = {' '},dis_buf[4];
    unsigned short temp = 0;
    ST_HOT_DEV *stDevPtr;


    if(cabinet == 1)
    {
        stDevPtr = &UserPara.box1Hot;
    }
    else if(cabinet == 2)
    {
        stDevPtr = &UserPara.box2Hot;
    }
    else
        return;

    lang = SystemPara.Language;
    while(1)
    {
        if(topFlushFlag)
        {
            topFlushFlag = 0;
            LCDClrScreen();
            LCDDrawRectangle(0,0,239,15);
            LCDDrawRectangle(0,0,239,3);
            LCDClrArea(1,4,238,14);
            if(stDevPtr->flag & (0x01 << (no + 1)))
                LCDPrintf(8,1,0,lang,"%s %s",ui_acdc_man.timerManage[lang],ui_aisle_admin.open[lang]);
            else
                LCDPrintf(8,1,0,lang,"%s %s",ui_acdc_man.timerManage[lang],ui_aisle_admin.close[lang]);

            LCDPrintf(8,5,0,lang,"%s %s",ui_aisle_admin.no_1[lang],ui_aisle_admin.open[lang]);
            LCDPrintf(8,7,0,lang,"%s %s",ui_aisle_admin.no_2[lang],ui_aisle_admin.close[lang]);

            if(stDevPtr->flag & (0x01 << (no + 1)))
            {
                LCDPrintf(8,9,0,lang,"%s %s %02d:%02d",ui_aisle_admin.no_3[lang],ui_acdc_man.startTime[lang],
                          stDevPtr->HourOn[no - 1],stDevPtr->MinOn[no - 1]);
                LCDPrintf(8,11,0,lang,"%s %s %02d:%02d",ui_aisle_admin.no_4[lang],ui_acdc_man.stopTime[lang],
                          stDevPtr->HourOff[no - 1],stDevPtr->MinOff[no - 1]);
                LCDPrintf(8,13,0,lang,"%s %s:  %02d.%02d ℃",ui_aisle_admin.no_5[lang],ui_acdc_man.setTemp[lang],
                          stDevPtr->setTemp[no - 1] / 10,(stDevPtr->setTemp[no - 1] % 10) * 10);

            }


        }

        if(topReturnFlag)
        {
            return ;
        }

        key = ReadKeyValue();
        OSTimeDly(5);

        switch(key)
        {
        case '1':
            stDevPtr->flag |= (0x01 << (no + 1));
            topFlushFlag = 1;
            break;

        case '2':
            stDevPtr->flag &= ~(0x01 << (no + 1));
            topFlushFlag = 1;
            break;
        case '3':
            if(!(stDevPtr->flag & (0x01 << (no + 1))))
                break;
            subFlushFlag = 1;
            enterSub = 1;
            cursorIndex = 0;
            buf[0] = stDevPtr->HourOn[no - 1]  / 10 + '0';
            buf[1] = stDevPtr->HourOn[no - 1]  % 10 + '0';
            buf[2] = stDevPtr->MinOn[no - 1]   / 10 + '0';
            buf[3] = stDevPtr->MinOn[no - 1]   % 10 + '0';
            break;
        case '4':
            if(!(stDevPtr->flag & (0x01 << (no + 1))))
                break;
            subFlushFlag = 1;
            enterSub = 3;
            cursorIndex = 0;
            buf[0] = stDevPtr->HourOff[no - 1]	/ 10 + '0';
            buf[1] = stDevPtr->HourOff[no - 1]	% 10 + '0';
            buf[2] = stDevPtr->MinOff[no - 1]	/ 10 + '0';
            buf[3] = stDevPtr->MinOff[no - 1]	% 10 + '0';

            break;
        case '5'://设置温度
            if(!(stDevPtr->flag & (0x01 << (no + 1))))
                break;
            temp = 0;
            subFlushFlag = 1;
            enterSub = 1;
            while(enterSub)
            {
                if(subFlushFlag)
                {
                    subFlushFlag = 0;
                    LCDPrintf(8,13,1,lang,"%s %s:  %02d.%02d ℃",ui_aisle_admin.no_5[lang],ui_acdc_man.setTemp[lang],
                              temp / 10,(temp % 10) * 10);
                }
                key = ReadKeyValue();
                OSTimeDly(5);
                switch(key)
                {
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                case '0':
                    temp = temp * 10 + (key - '0');
                    subFlushFlag = 1;
                    break;
                case 'C':
                    enterSub = 0;
                    topFlushFlag = 1;
                    break;
                case 'E'://确定编辑
                    stDevPtr->setTemp[no - 1] = ((temp >= ACDC_MAX_HOT_TEMP) ?ACDC_MAX_HOT_TEMP  : temp);
                    TraceCompress("temp: %d   %d\r\n",stDevPtr->setTemp[no - 1],temp);

                    enterSub = 0;
                    topFlushFlag = 1;
                    break;
                default:
                    break;
                }
            }
            break;
        case 'C':
            enterSub = 0;
            topReturnFlag = 1;
            break;
        default:
            break;

        }

        while(enterSub)//编辑界面
        {
            if(subFlushFlag)
            {
                subFlushFlag = 0;
                dis_buf[0] = (cursorIndex == 0) ? '-': buf[0];
                dis_buf[1] = (cursorIndex == 1) ? '-': buf[1];
                dis_buf[2] = (cursorIndex == 2) ? '-': buf[2];
                dis_buf[3] = (cursorIndex == 3) ? '-': buf[3];
                {
                    if(enterSub < 3)
                    {
                        LCDPrintf(8,9,1,lang,"%s %s %c%c:%c%c",ui_aisle_admin.no_3[lang],ui_acdc_man.startTime[lang],
                                  dis_buf[0],dis_buf[1],dis_buf[2],dis_buf[3]);
                    }
                    else
                        LCDPrintf(8,11,1,lang,"%s %s %c%c:%c%c",ui_aisle_admin.no_4[lang],ui_acdc_man.stopTime[lang],
                                  dis_buf[0],dis_buf[1],dis_buf[2],dis_buf[3]);
                }

            }

            key = ReadKeyValue();
            OSTimeDly(5);
            switch(key)
            {
            case '1':
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
            case '0':


                if(cursorIndex == 0 && (key - '0') >= 3)
                    break;
                if(cursorIndex == 1 && (buf[0] == '2') && ((key - '0') >= 4))
                    break;
                if(cursorIndex == 2 && (key - '0') >= 6)
                    break;

                buf[cursorIndex] = key;
                if(cursorIndex == 3)
                {
                    if(enterSub < 3)
                    {
                        stDevPtr->HourOn[no - 1] = (buf[0] - '0') * 10 + (buf[1] - '0');
                        stDevPtr->MinOn[no - 1] = (buf[2] - '0') * 10 + (buf[3] - '0');
                    }
                    else
                    {
                        stDevPtr->HourOff[no - 1] = (buf[0] - '0') * 10 + (buf[1] - '0');
                        stDevPtr->MinOff[no - 1] = (buf[2] - '0') * 10 + (buf[3] - '0');
                    }
                    enterSub = 0;
                    topFlushFlag = 1;
                    break;
                }
                cursorIndex = (++cursorIndex) % 4;
                subFlushFlag = 1;
                break;
            case '>':
                cursorIndex = (++cursorIndex) % 4;
                break;
            case '<':
                cursorIndex = (cursorIndex) ? (--cursorIndex): 3;
                break;
            case 'C':
                enterSub = 0;
                topFlushFlag = 1;
                break;
            case 'E'://确定编辑
                if(enterSub < 3)
                {
                    stDevPtr->HourOn[no - 1] = (buf[0] - '0') * 10 + (buf[1] - '0');
                    stDevPtr->MinOn[no - 1] = (buf[2] - '0') * 10 + (buf[3] - '0');
                }
                else
                {
                    stDevPtr->HourOff[no - 1] = (buf[0] - '0') * 10 + (buf[1] - '0');
                    stDevPtr->MinOff[no - 1] = (buf[2] - '0') * 10 + (buf[3] - '0');
                }
                enterSub = 0;
                topFlushFlag = 1;
                break;
            }

        }


    }

}
Beispiel #12
0
//加热界面
void acdc_controlHot(void)
{
    unsigned char topFlush = 1,topReturn = 0,enterSub =  0;
    unsigned char key,lang,cabinetNO = 1,flag,rst;
    char *acdcTitleStr;
    unsigned short temp;
    ST_HOT_DEV *stDevPtr;
    lang= SystemPara.Language;



    while(SystemPara.SubBinOpen || SystemPara.hefangGui)
    {
        if(topFlush)
        {
            topFlush = 0;
            LCDClrScreen();
            LCDDrawRectangle(0,0,239,15);
            LCDDrawRectangle(0,0,239,3);
            LCDClrArea(1,4,238,14);
            LCDPrintf(8,1,0,lang," %s",ui_acdc_man.manage[lang]);
            LCDPrintf(8,5,0,lang," %s",ui_aisle_admin.enternCabinetNo[lang]);
            LCDPrintf(8,7,0,lang," %s%s",ui_aisle_admin.no_1[lang],ui_aisle_admin.A_Bin[lang]);
            if(SystemPara.SubBinOpen && SystemPara.hefangGui)
            {
                LCDPrintf(8,9,0,lang," %s%s",ui_aisle_admin.no_2[lang],ui_aisle_admin.B_Bin[lang]);
                LCDPrintf(8,11,0,lang," %s%s",ui_aisle_admin.no_3[lang],ui_aisle_admin.hefan[lang]);
            }
            else if(SystemPara.SubBinOpen)
                LCDPrintf(8,9,0,lang," %s%s",ui_aisle_admin.no_2[lang],ui_aisle_admin.B_Bin[lang]);
            else if(SystemPara.hefangGui)
                LCDPrintf(8,9,0,lang," %s%s",ui_aisle_admin.no_2[lang],ui_aisle_admin.hefan[lang]);

        }
        key = ReadKeyValue();
        OSTimeDly(5);
        if(key == '1')
        {

            cabinetNO = 1;
            break;
        }
        else  if(key == '2')
        {
            if(SystemPara.SubBinOpen)
            {
                cabinetNO = 2;

                break;
            }
            else if(SystemPara.hefangGui)
                return;
            topFlush = 1;

        }
        else if(key == '3')
        {
            if(SystemPara.hefangGui)
                return;
            topFlush = 1;
        }
        else if(key == 'C')
            return;
    }



    if(cabinetNO == 1)
    {
        acdcTitleStr = ui_acdc_man.hotManage[lang];
        stDevPtr = &UserPara.box1Hot;
    }
    else if(cabinetNO == 2)
    {
        acdcTitleStr = ui_acdc_man.hotManage[lang];
        stDevPtr = &UserPara.box2Hot;

    }
    else
    {
        return;
    }


    topFlush = 1;
    while(1)
    {
        if(topFlush)
        {
            stDevPtr->curTemp = acdc_getTemp_API(cabinetNO);
            topFlush = 0;
            LCDClrScreen();
            LCDDrawRectangle(0,0,239,15);
            LCDDrawRectangle(0,0,239,3);
            LCDClrArea(1,4,238,14);
            if(stDevPtr->flag & 0x02)
                LCDPrintf(8,1,0,lang,"%s %s",acdcTitleStr,ui_acdc_man.timerStarting[lang]);
            else if(stDevPtr->flag & 0x01)
                LCDPrintf(8,1,0,lang,"%s %s",acdcTitleStr,ui_aisle_admin.open[lang]);
            else
                LCDPrintf(8,1,0,lang,"%s %s",acdcTitleStr,ui_aisle_admin.close[lang]);

            LCDPrintf(8,5,0,lang,"%s: %02d.%02d ℃",ui_acdc_man.curTemp[lang],
                      stDevPtr->curTemp / 10,(stDevPtr->curTemp % 10) * 10);

            LCDPrintf(8,7,0,lang,"%s %s",ui_aisle_admin.no_1[lang],ui_aisle_admin.open[lang]);
            LCDPrintf(8,9,0,lang,"%s %s",ui_aisle_admin.no_2[lang],ui_aisle_admin.close[lang]);

            LCDPrintf(8,11,0,lang,"%s %s",ui_aisle_admin.no_3[lang],ui_acdc_man.timerManage[lang]);

            if(stDevPtr->flag & 0x01)
                LCDPrintf(8,13,0,lang,"%s %s:  %02d.%02d ℃",ui_aisle_admin.no_4[lang],ui_acdc_man.setTemp[lang],
                          stDevPtr->setTemp1 / 10,(stDevPtr->setTemp1 % 10) * 10 );



        }

        if(topReturn)
        {
            //WriteUserSystemPara(UserPara);
            return;
        }


        key = ReadKeyValue();
        OSTimeDly(5);
        switch(key)
        {
        case '1':
        case '2':
            flag = (key == '1') ? 1 : 0;
            LCDPrintf(8,1,0,lang,"%s %s",acdcTitleStr,ui_acdc_man.operating[lang]);
            rst = acdc_hot_API(cabinetNO,(flag & 0x01) * (ACDC_MAX_HOT_TEMP / 2));
            if(rst)
            {
                stDevPtr->flag &= ~0x03;
                stDevPtr->flag |= flag;
                stDevPtr->flag |= ((flag && (stDevPtr->flag & 0x7C)) ? 0x02 : 0);
                stDevPtr->setTemp1 = ACDC_MAX_HOT_TEMP / 2;
            }


            topFlush = 1;
            break;

        case '3':
            acdc_hotTimerHandlePage(cabinetNO);
            topFlush = 1;
            break;
        case '4'://设置温度
            if(!(stDevPtr->flag & 0x01))
                break;
            temp = 0;
            topFlush = 1;
            enterSub = 1;
            while(enterSub)
            {
                if(topFlush)
                {
                    topFlush = 0;
                    LCDPrintf(8,13,1,lang,"%s %s:  %02d.%02d ℃",ui_aisle_admin.no_4[lang],ui_acdc_man.setTemp[lang],
                              temp / 10,(temp % 10) * 10);
                }
                key = ReadKeyValue();
                OSTimeDly(5);
                switch(key)
                {
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                case '0':
                    temp = temp * 10 + (key - '0');
                    topFlush = 1;
                    break;
                case 'C':
                    enterSub = 0;
                    topFlush = 1;
                    break;
                case 'E'://确定编辑
                    stDevPtr->setTemp1 = ((temp >= ACDC_MAX_HOT_TEMP) ?ACDC_MAX_HOT_TEMP  : temp);
                    TraceCompress("temp: %d   %d\r\n",stDevPtr->setTemp1,temp);
                    if((stDevPtr->flag & 0x01) || (stDevPtr->flag & 0x02))
                        acdc_hot_API(cabinetNO,stDevPtr->setTemp1);
                    enterSub = 0;
                    topFlush = 1;
                    break;
                default:
                    break;
                }



            }
            break;
        case 'C':
            topReturn = 1;
            break;
        case 'E':
            topReturn = 1;
            break;
        default:
            break;
        }

    }
}