Merge tag '1.0.6' into develop

tag 1.0.6
diff --git a/supwisdom/main.c b/supwisdom/main.c
index c5fdc97..7b89edb 100644
--- a/supwisdom/main.c
+++ b/supwisdom/main.c
@@ -34,11 +34,7 @@
     sp_communicate(&POS);
     if(POS.paymode == PAYMODE_QRCODE)
     {
-      if(tick - lasttick >= DELAY_TIME100ms)
-      {
-        lasttick = tick;
-        sp_qrcode_handle(&POS, &cardWorkState);
-      }
+      sp_qrcode_handle(&POS, &cardWorkState);
     }
     else
     {
diff --git a/supwisdom/sp_card.c b/supwisdom/sp_card.c
index 81babcb..4fcbd65 100644
--- a/supwisdom/sp_card.c
+++ b/supwisdom/sp_card.c
@@ -41,7 +41,6 @@
 
 uint8 sp_card_request(sp_card_t* cardpcd)
 {
-
   uint8 sak;
   uint8 snr[8];
 
@@ -80,7 +79,7 @@
 
 static uint16 sp_select_adf15()
 {
-  uint16 ret = 0;
+  uint16 ret;
   uint8* temp_buff = NULL;
   uint8 buff_len = 0;
   uint8 cmd_buff[] = {"\x00\xA4\x00\x00\x02\x3F\x00"};
@@ -94,7 +93,7 @@
 
 static uint16 sp_read_binary_file(uint8 out[])
 {
-  uint16 ret = 0;
+  uint16 ret;
   uint8* temp_buff = NULL;
   uint8 buff_len = 0;
   uint8 cmd_buff[5] = {"\x00\xB0\x95\x00\x47"};
@@ -108,9 +107,9 @@
 }
 static uint16 sp_cpu_read(sp_card_t* card)
 {
-  uint16 ret = 0;
+  uint16 ret;
   uint8 buff[72];
-  uint8 offset = 0;
+  uint8 offset;
   MEMCLEAR(buff, sizeof(buff));
   ret = sp_select_adf15();
   if(ret)
@@ -123,6 +122,7 @@
   {
     return ret;
   }
+  offset = 0;
   MEMCLEAR(card->citizen_cardno, sizeof(card->citizen_cardno));
   offset += 31;
   MEMCPY(card->citizen_cardno, buff+offset, sizeof(card->citizen_cardno));
diff --git a/supwisdom/sp_communicate.c b/supwisdom/sp_communicate.c
index c86690a..28dfe83 100644
--- a/supwisdom/sp_communicate.c
+++ b/supwisdom/sp_communicate.c
@@ -8,41 +8,69 @@
 #include "sp_upgrade.h"
 #include "../sys_hw/drv_usart.h"
 
+static uint8 rxBuf[512] = {0};
+static uint16 rxBufLen = 0;
+
 static void sp_usart_send(sp_pos_t* pos, sp_protocol_request_t* req)
 {
-  uint8 sendBuff[264];
-  MEMCLEAR(sendBuff, sizeof(sendBuff));
+  uint8 buf[sizeof(sp_protocol_request_t)];
+  MEMCLEAR(buf, sizeof(buf));
+  sp_protocol_crc((uint8*)req +2, req->datalen, (uint8*)req +2 +req->datalen);
+  req->datalen += 2;
+  MEMCPY(buf, req, req->datalen+2);
+  usart_send(buf, req->datalen+2);
 
   pos->last_comm_status.command = req->excmd;
   pos->last_comm_status.sendtime = sp_get_ticker();
-
-  sp_protocol_crc((uint8*)req +2, req->datalen, (uint8*)req +2 +req->datalen);
-  req->datalen += 2;
-  MEMCPY(sendBuff, req, req->datalen+2);
-  usart_send(sendBuff, req->datalen+2);
+  MEMCLEAR(rxBuf,sizeof rxBuf);
+  rxBufLen = 0;
 }
 
-static uint8 sp_usart_recv(sp_pos_t* pos, sp_protocol_response_t* resp, int32 timeout_ms)
+static uint8 sp_usart_recv(sp_pos_t* pos, sp_protocol_response_t* resp,
+                               uint32 timeout_ms)
 {
-  uint32 tick = 0;
+  uint32 tick;
+  uint16 len;
+  int16 datalen;
+  uint8 crc[2];
+  uint8 temp[sizeof(sp_protocol_response_t)];
   tick = sp_get_ticker();
+  MEMCLEAR(temp,sizeof temp);
   while(1)
   {
-    MEMCLEAR(resp, sizeof(sp_protocol_response_t));
-    usart_read((u8*)resp, sizeof(sp_protocol_response_t));
-    if(pos->last_comm_status.command == resp->excmd)
+
+    len = usart_read((u8*)temp,sizeof temp);
+    if(len > 0)
     {
-      MEMCLEAR(&(pos->last_comm_status), sizeof(sp_comm_status_t));
-      return resp->retcode;
+      MEMCPY(rxBuf +rxBufLen, temp,len);
+      rxBufLen += len;
+      datalen = get_2byte_int_le(rxBuf);
+      if((datalen+2) <= rxBufLen)
+      {
+        MEMCLEAR(resp, sizeof(sp_protocol_response_t));
+        MEMCPY((uint8*)resp,rxBuf,rxBufLen);
+        MEMCLEAR(rxBuf,sizeof rxBuf);
+        rxBufLen = 0;
+        if(pos->last_comm_status.command == resp->excmd)
+        {
+          sp_protocol_crc((uint8*)resp +2,datalen -2, crc);
+          if(MEMCMP((uint8*)resp +datalen,crc,2) == 0)
+          {
+            MEMCLEAR(&(pos->last_comm_status), sizeof(sp_comm_status_t));
+            return resp->retcode;
+          }
+        }
+      }
     }
     if((sp_get_ticker() - tick) >= timeout_ms)
     {
-      return 1;
+      return RC_COMM_TIMEOUT;
     }
   }
 }
+
 uint8 sp_comm_call(sp_pos_t* pos, sp_protocol_request_t* req,
-                   sp_protocol_response_t* resp, int32 timeout_ms)
+                   sp_protocol_response_t* resp, uint32 timeout_ms)
 {
   sp_usart_send(pos, req);
   return sp_usart_recv(pos, resp, timeout_ms);
@@ -62,13 +90,12 @@
 {
   uint8 size;
   uint16 ret;
-  int32 timeout_ms = COMM_WAIT_TIME;
   cw_unpack_context unpack;
   unpack_field_t field;
   sp_protocol_response_t resp;
 
-  disp_hint_info(pos,"ÕýÔÚÉí·ÝÈÏÖ¤ÖÐ",DELAY_TIME2s);
-  ret = sp_usart_recv(pos, &resp, timeout_ms);
+  disp_hint_info_two(pos,"Éí·ÝÈ·ÈÏÖÐ","ÇëÉÔµÈ...",0);
+  ret = sp_usart_recv(pos, &resp, COMM_WAIT_TIME);
   if(ret)
   {
     ret = RC_CARD_AUTHENTICATION;
@@ -109,7 +136,7 @@
       card->feepara.fee_start = field.val.intval;
     }
   }
-  disp_hint_info(pos,"Éí·ÝÈÏÖ¤³É¹¦",DELAY_TIME1s);
+  //disp_hint_info(pos,"Éí·ÝÈÏÖ¤³É¹¦",DELAY_TIME1s);
   return 0;
 }
 
@@ -163,6 +190,30 @@
   return 0;
 }
 
+void sp_login(sp_pos_t* pos)
+{
+  uint16 ret;
+  char msg[20];
+  sp_protocol_response_t resp;
+  disp_hint_info_two(pos,"ÕýÔڵǼ","ÇëÉÔµÈ...",0);
+  ret = sp_async_equipment_login(pos);
+  if(ret)
+  {
+    sprintf(msg,"´íÎóÂë=%d",ret);
+    disp_hint_info_two(pos,"µÇ¼ʧ°Ü",msg,DELAY_TIME3s);
+    return;
+  }
+  MEMCLEAR(&resp,sizeof resp);
+  sp_usart_recv(pos,&resp,COMM_WAIT_TIME);
+  ret = sp_confirm_login(&resp,pos);
+  if(ret)
+  {
+    disp_server_errmsg(pos,"µÇ¼ʧ°Ü",resp.data,resp.datalen);
+    return;
+  }
+  disp_hint_info(pos,"µÇ¼³É¹¦",DELAY_TIME3s);
+}
+
 //ÐÄÌøÈ·ÈÏ£¬¼ì²âÍøÂçÊÇ·ñÕý³£
 uint16 sp_async_heartbeat(sp_pos_t* pos)
 {
@@ -202,12 +253,11 @@
 {
   uint8 size;
   uint16 ret;
-  int32 timeout_ms = COMM_WAIT_TIME;
   cw_unpack_context unpack;
   unpack_field_t field;
   sp_protocol_response_t resp;
 
-  ret = sp_usart_recv(pos, &resp, timeout_ms);
+  ret = sp_usart_recv(pos, &resp, COMM_WAIT_TIME);
   if(ret)
   {
     ret = RC_QRCODE_FAILURE;
@@ -261,12 +311,11 @@
 {
   uint8 size;
   uint16 ret;
-  int32 timeout_ms = COMM_WAIT_TIME;
   cw_unpack_context unpack;
   unpack_field_t field;
   sp_protocol_response_t resp;
 
-  ret = sp_usart_recv(pos, &resp, timeout_ms);
+  ret = sp_usart_recv(pos, &resp, COMM_WAIT_TIME);
   if(ret)
   {
     ret = RC_QRCODE_QUERY_FAIL;
@@ -401,7 +450,7 @@
   uint8 size;
   uint8 ctime[6];
   uint8 systime[7];
-  uint8 login_flag = 0;
+  uint8 login_flag;
   cw_unpack_context unpack;
   unpack_field_t field;
 
@@ -410,7 +459,7 @@
     return resp->retcode;
   }
   pos->heartbeat.heart_status = HEART_RECV;
-
+  login_flag = 0;
   sp_unpack_init(&unpack,resp->data,resp->datalen);
   size = sp_unpack_map_size(&unpack);
   while(size-- > 0)
@@ -524,10 +573,9 @@
 {
   uint8 ret = 0;
   uint8 i = 0;
-  int32 timeout_ms = COMM_WAIT_TIME;
   sp_protocol_response_t resp;
 
-  ret = sp_usart_recv(pos, &resp, timeout_ms);
+  ret = sp_usart_recv(pos, &resp, 100);
   if(ret)
   {
     return ret;
@@ -562,8 +610,8 @@
 
 void sp_communicate(sp_pos_t* pos)
 {
-  uint16 ret = 0;
-  uint32 ticker = 0;
+  uint16 ret;
+  uint32 ticker;
   sp_transdtl_t transdtl;
 
   if(pos->deviceno == 0)
@@ -576,14 +624,14 @@
     if(pos->devlogin.last_login_ticker == 0 || pos->devlogin.login_flag == 0
         || ticker - pos->devlogin.last_login_ticker > DELAY_TIME60s*30)
     {
-        pos->devlogin.last_login_ticker = ticker;
-        sp_async_equipment_login(pos);
+      pos->devlogin.last_login_ticker = ticker;
+      sp_async_equipment_login(pos);
     }
     if(pos->heartbeat.last_heartbeat_ticker == 0
         || ticker - pos->heartbeat.last_heartbeat_ticker > DELAY_TIME60s)
     {
-        pos->heartbeat.last_heartbeat_ticker = ticker;
-        sp_async_heartbeat(pos);
+      pos->heartbeat.last_heartbeat_ticker = ticker;
+      sp_async_heartbeat(pos);
     }
     else
     {
diff --git a/supwisdom/sp_communicate.h b/supwisdom/sp_communicate.h
index 3258eff..8a6f59a 100644
--- a/supwisdom/sp_communicate.h
+++ b/supwisdom/sp_communicate.h
@@ -132,10 +132,11 @@
 uint16 sp_async_upload_transdtl(sp_pos_t* pos, sp_transdtl_t* dtl);
 uint16 sp_qrcode_init(sp_pos_t* pos, sp_card_t* card);
 uint16 sp_qrcode_query(sp_pos_t* pos, sp_card_t* card);
+void sp_login(sp_pos_t* pos);
 
 //ͨѶ
 uint8 sp_comm_call(sp_pos_t* pos, sp_protocol_request_t* req,
-                   sp_protocol_response_t* resp, int32 timeout_ms);
+                   sp_protocol_response_t* resp, uint32 timeout_ms);
 void sp_protocol_req_init(sp_protocol_request_t* req, uint8 command);
 #endif
 
diff --git a/supwisdom/sp_config.h b/supwisdom/sp_config.h
index 948e86a..5039ab6 100644
--- a/supwisdom/sp_config.h
+++ b/supwisdom/sp_config.h
@@ -32,7 +32,7 @@
 #define NULL ((void *)0)
 #endif
 
-#define DEV_TYPE "G401302"
+#define DEV_TYPE "G401201"
 #define DEV_OFFLINE_DEFAULT_HOUR 168
 #define DEV_BLKBITMAP_DONE 1984
 #define DEV_MAX_DEVICENO 99
diff --git a/supwisdom/sp_constant.h b/supwisdom/sp_constant.h
index a7dd95b..ea79d09 100644
--- a/supwisdom/sp_constant.h
+++ b/supwisdom/sp_constant.h
@@ -51,6 +51,7 @@
 #define RC_DEV_NOT_LOGIN				65	//É豸δǩµ½
 #define RC_DEV_FAULT					66  //É豸ÒÉËÆ¹ÊÕÏ
 #define RC_DEV_NOSET_FLOWSENSOR_UNIT	67  //É豸Á÷Á¿¼ÆË㵥λδÉèÖÃ
+#define RC_COMM_TIMEOUT					68  //ͨѶ³¬Ê±
 #define STATUS_KEEPOPEN					1	//³£¿ª¿¨
 #define STATUS_CLOSED					0	//È¡Ïû³£¿ª¿¨
 
diff --git a/supwisdom/sp_consume.c b/supwisdom/sp_consume.c
index e1a9c46..579a3af 100644
--- a/supwisdom/sp_consume.c
+++ b/supwisdom/sp_consume.c
@@ -57,7 +57,7 @@
 
 void sp_test_card_state(sp_pos_t* pos, sp_cardworkstate_t* cardWorkState, uint32 tick)
 {
-  uint8 ret = 0;
+  uint8 ret;
   sp_card_t cardpcd;
   switch(pos->cardState.cur_state)
   {
@@ -197,7 +197,7 @@
 
 static uint16 sp_check_dev(const sp_pos_t* pos)
 {
-  uint16 ret = 0;
+  uint16 ret;
   uint8 ctime[6];
   MEMCLEAR(ctime, sizeof(ctime));
   sp_get_bcdtime(ctime);
@@ -230,7 +230,7 @@
 
 static uint16 do_new(sp_pos_t* pos, sp_card_t* card)
 {
-  uint16 ret = 0;
+  uint16 ret;
   sp_transdtl_t record;
   MEMCLEAR(&record, sizeof(record));
   card->cardtype = pos->cardState.tag_type;
@@ -289,7 +289,7 @@
 
 static uint16 do_work(sp_pos_t* pos, sp_card_t* card)
 {
-  uint16 ret = 0;
+  uint16 ret;
   sp_valve_on();
   //¼ÆËãÏû·Ñ½ð¶î
   ret = sp_calc_payamt_by_flowsensor(pos, card);
@@ -438,7 +438,7 @@
     }
     if(pos->purchase.paid_num > card->waterlimit)
     {
-      disp_hint_info(pos,"ÒÑ´ïµ¥´Î³öË®ÉÏÏÞ",DELAY_TIME2s);
+      disp_hint_info_two(pos,"Í£Ö¹³öË®","ÒÑ´ïµ¥´Î³öË®ÉÏÏÞ",DELAY_TIME2s);
       cardWorkState->current_state = CARDWORKSTATUS_STOPPING;
     }
     cardWorkState->pause_tick = timer_get_ticker();
@@ -454,7 +454,7 @@
     cardWorkState->current_state = CARDWORKSTATUS_STOPPED;
     break;
   case CARDWORKSTATUS_STOPPED:
-    disp_hint_info(pos, "Çë°Î¿¨", DELAY_TIME2s);
+    disp_hint_info_two(pos,"Í£Ö¹³öË®", "ÇëÄÃ×ß¿¨", DELAY_TIME2s);
     break;
   case CARDWORKSTATUS_FEECARD_WORKING:
     if(MEMCMP(pos->cardState.snr, card->cardphyid, 4) != 0)
@@ -613,7 +613,7 @@
 }
 
 //¶þάÂëÏû·Ñ´¦Àí
-uint32 tick = 0;
+static uint32 tick = 0;
 void sp_qrcode_handle(sp_pos_t* pos, sp_cardworkstate_t* cardWorkState)
 {
   uint16 ret = 0;
@@ -629,6 +629,7 @@
       cardWorkState->current_state = CARDWORKSTATUS_ERROR;
       break;
     }
+	disp_hint_info_two(pos, "ÇëÇó¶þάÂë","ÇëÉÔµÈ...",0);
     ret = sp_qrcode_init(pos, &CARD);
     if(ret)
     {
@@ -645,7 +646,7 @@
     }
     pos->sysconf.work_mode = 1;
     CARD.qrcode.starttime = sp_get_ticker();
-    disp_hint_info(pos, "ÕýÔÚÉú³É¶þάÂë", DELAY_TIME2s);
+    //disp_hint_info(pos, "Éú³É¶þάÂë", 0);
     cardWorkState->last_state = cardWorkState->current_state;
     cardWorkState->current_state = CARDWORKSTATUS_READY;
     break;
@@ -696,7 +697,7 @@
     }
     if(pos->purchase.paid_num > CARD.waterlimit)
     {
-      disp_hint_info(pos, "ÒÑ´ïµ¥´Î³öË®ÉÏÏÞ", DELAY_TIME2s);
+      disp_hint_info_two(pos, "Í£Ö¹³öË®","ÒÑ´ïµ¥´Î³öË®ÉÏÏÞ", DELAY_TIME2s);
       cardWorkState->current_state = CARDWORKSTATUS_STOPPING;
     }
     cardWorkState->last_state = cardWorkState->current_state;
@@ -706,7 +707,7 @@
     if(cardWorkState->last_state == CARDWORKSTATUS_NONE
         || cardWorkState->last_state == CARDWORKSTATUS_READY)
     {
-      disp_hint_info(pos,"È¡ÏûË¢Âë!", DELAY_TIME2s);
+      disp_hint_info_two(pos,"Í£Ö¹³öË®","È¡ÏûË¢Âë!", DELAY_TIME2s);
       pos->paymode = PAYMODE_INIT;
       pos->sysconf.work_mode = 0;
     }
diff --git a/supwisdom/sp_data.c b/supwisdom/sp_data.c
index a6bad45..f2fdac3 100644
--- a/supwisdom/sp_data.c
+++ b/supwisdom/sp_data.c
@@ -351,7 +351,7 @@
   uint8 crc[2];
   sp_config_t config;
   MEMCLEAR(&config, sizeof(config));
-  disp_hint_info(pos,"É豸²ÎÊý³õʼ»¯", DELAY_TIME2s);
+  disp_hint_info_two(pos,"É豸²ÎÊý³õʼ»¯", "ÇëÉÔµÈ...",0);
   sp_protocol_crc((uint8*)&config,sizeof(sp_config_t)-2,config.crc);
   sp_flash_erase(ADDR_CONFIG_PARA);
   sp_flash_write(ADDR_CONFIG_PARA,(uint8*)&config,sizeof(sp_config_t));
diff --git a/supwisdom/sp_display.c b/supwisdom/sp_display.c
index 860a451..b81672a 100644
--- a/supwisdom/sp_display.c
+++ b/supwisdom/sp_display.c
@@ -14,7 +14,7 @@
 #define GLCD_BUTTOM_Y 56
 #define GLCD_LINE_LENGTH 0x10
 
-static char line_buff[17];
+static char line_buff[32];
 
 /********************************************************************************************************
 * º¯Êý(Name)      : void  Show_Money(uint32 money)
@@ -59,8 +59,8 @@
 
 static void show_bottom(sp_pos_t* pos)
 {
-  sprintf(line_buff,"%02d:%02x%02x%02x%02x",pos->deviceno, pos->devphyid[0],
-          pos->devphyid[1], pos->devphyid[2], pos->devphyid[3]);
+  sprintf(line_buff,"%02d:%02x%02x%02x%02x    v%s",pos->deviceno, pos->devphyid[0],
+          pos->devphyid[1], pos->devphyid[2], pos->devphyid[3],PRO_VERSION);
   glcd_draw_string_xy(0, GLCD_BUTTOM_Y, line_buff);
 }
 
@@ -100,7 +100,7 @@
   if(MEMCMP(ctime,last_ctime,6) != 0)
   {
     MEMCPY(last_ctime,ctime,6);
-    disp_hint_info_two(pos,"F°æ±¾",PRO_VERSION,0);
+    disp_hint_info_two(pos,">>Ë¢ÊÐÃñ¿¨³öË®",">>°´È·ÈϼüɨÂë",0);
   }
 }
 
@@ -335,8 +335,8 @@
   uint8 strlen;
   char errmsg[64];
   strlen = data[0];
-  //command+canid+excmd+flag+retcode+len+crc
-  if((strlen +8) != len)
+  //command+excmd+flag+retcode+len+crc
+  if((strlen +7) != len)
   {
     disp_hint_info_two(pos,hint,"ÇëÇó³¬Ê±",DELAY_TIME3s);
     return;
diff --git a/supwisdom/sp_menu.c b/supwisdom/sp_menu.c
index 572f788..d9d1b0a 100644
--- a/supwisdom/sp_menu.c
+++ b/supwisdom/sp_menu.c
@@ -80,6 +80,7 @@
   ticker = sp_get_ticker();
   while(sp_get_ticker()-ticker <= DELAY_TIME60s)
   {
+    sp_feed_dog();
     keycode = sp_get_key();
     if(keycode != SP_KEY_NONE)
     {
@@ -296,6 +297,7 @@
   ticker = sp_get_ticker();
   while(sp_get_ticker() -ticker < DELAY_TIME60s)
   {
+    sp_feed_dog();
     kcode = sp_get_key();
     if(kcode != SP_KEY_NONE)
     {
@@ -354,41 +356,6 @@
   }
 }
 
-static void sp_manual_login(sp_pos_t* pos)
-{
-  uint16 ret;
-  uint32 tick;
-  sp_protocol_response_t resp;
-  MEMCLEAR(&resp, sizeof(resp));
-  disp_hint_info_two(pos,"ÕýÔڵǼ","ÇëÉÔµÈ...",0);
-  sp_async_equipment_login(pos);
-  tick = sp_get_ticker();
-  while(sp_get_ticker() - tick < DELAY_TIME3s*2)
-  {
-    MEMCLEAR(&resp, sizeof(resp));
-    usart_read((u8*)&resp, sizeof(resp));
-    if(resp.excmd == SP_CMD_LOGIN)
-    {
-      ret = sp_confirm_login(&resp, pos);
-      break;
-    }
-    else
-    {
-      ret = RC_DEV_LOGIN_FAIL;
-    }
-  }
-  if(ret)
-  {
-    char msg[32];
-    sprintf(msg,"´íÎóÂë=%d",ret);
-    disp_hint_info_two(pos,"Ç©µ½Ê§°Ü",msg,DELAY_TIME3s);
-  }
-  else
-  {
-    disp_hint_info(pos,"Ç©µ½³É¹¦",DELAY_TIME3s);
-  }
-}
-
 static void sp_set_devphyid(sp_pos_t* pos)
 {
   uint32 ticker;
@@ -407,6 +374,7 @@
   sp_hex_to_str(devphyid,4,str);
   while(sp_get_ticker() -ticker < DELAY_TIME60s)
   {
+    sp_feed_dog();
     kcode = sp_get_key();
     if(kcode != SP_KEY_NONE)
     {
@@ -485,6 +453,7 @@
   ticker = sp_get_ticker();
   while(sp_get_ticker() -ticker < DELAY_TIME60s)
   {
+    sp_feed_dog();
     kcode = sp_get_key();
     if(kcode != SP_KEY_NONE)
     {
@@ -605,6 +574,7 @@
   ticker = sp_get_ticker();
   while(sp_get_ticker() -ticker < DELAY_TIME60s)
   {
+    sp_feed_dog();
     sp_valve_control();
     kcode = sp_get_key();
     if(kcode != SP_KEY_NONE)
@@ -631,12 +601,11 @@
 
 static void test_factory_options(sp_pos_t* pos)
 {
-  uint32 ticker = 0;
+  uint32 ticker;
   uint8 keycode;
   uint8 page;
   uint8 max_cnt;
-  uint8 key_press = 1;
-
+  uint8 key_press;
   menu_t menus[] =
   {
     {"1.°´¼üУ׼", do_keyboard_calibrate},
@@ -648,8 +617,9 @@
   };
   max_cnt = (sizeof(menus)/sizeof(menu_t) -1)/3 + 1;
   page = 0;
+  key_press = 1;
   ticker = sp_get_ticker();
-  while(sp_get_ticker()-ticker <= DELAY_TIME60s*5)
+  while(sp_get_ticker()-ticker <= DELAY_TIME60s)
   {
     sp_feed_dog();
     keycode = sp_get_key();
@@ -676,6 +646,7 @@
         if(menus[keycode-SP_KEY_1].func != NULL)
         {
           menus[keycode-SP_KEY_1].func(pos);
+          key_press = 1;
         }
         break;
       case SP_KEY_CLEAR:
@@ -700,28 +671,29 @@
 
 void sp_menu_options(sp_pos_t* pos)
 {
-  uint32 ticker = 0;
+  uint32 ticker;
   uint8 keycode;
   uint8 page;
   uint8 max_cnt;
-  uint8 key_press = 1;
+  uint8 key_press;
 
   menu_t menus[] =
   {
     {"1.²é¿´²ÎÊý", sp_show_syspara},
     {"2.¹¤³§²âÊÔ", test_factory_options},
     {"3.ÉèÖÃʱ¼ä", sp_set_devtime},
-    {"4.ÊÖ¶¯µÇ¼", sp_manual_login},
+    {"4.ÊÖ¶¯µÇ¼", sp_login},
     {"5.ÉèÖÃÎïÀíid", sp_set_devphyid},
     {"6.ÉèÖûúºÅ", sp_set_deviceno},
     {"7.Çå¿ÕÁ÷Ë®", clear_transdtl},
     {"8.ÔÚÏßÉý¼¶", manual_upgrade},
     {"9.»Ö¸´³ö³§", reset_factory}
   };
+  key_press = 1;
   max_cnt = (sizeof(menus)/sizeof(menu_t) -1)/3 + 1;
   page = 0;
   ticker = sp_get_ticker();
-  while(sp_get_ticker()-ticker <= DELAY_TIME60s*5)
+  while(sp_get_ticker()-ticker <= DELAY_TIME60s)
   {
     sp_feed_dog();
     keycode = sp_get_key();
@@ -748,6 +720,7 @@
         if(menus[keycode-SP_KEY_1].func != NULL)
         {
           menus[keycode-SP_KEY_1].func(pos);
+          key_press = 1;
         }
         break;
       case SP_KEY_CLEAR:
diff --git a/supwisdom/sp_upgrade.c b/supwisdom/sp_upgrade.c
index 6f2fdb8..6d04a83 100644
--- a/supwisdom/sp_upgrade.c
+++ b/supwisdom/sp_upgrade.c
@@ -311,7 +311,7 @@
       offset += (uint32)data_len;
       if(ADDR_UPGRADE_BEGIN + offset >= ADDR_UPGRADE_END)
       {
-        disp_hint_info(pos, "ÏÂÔØÎļþ¹ý´ó",DELAY_TIME3s);
+        disp_hint_info_two(pos,"Éý¼¶Ê§°Ü", "ÏÂÔØÎļþ¹ý´ó",DELAY_TIME3s);
         return 1;
       }
     }
@@ -319,7 +319,7 @@
     {
       if(3 < timeout_trycnt)
       {
-        disp_hint_info(pos, "ÏÂÔØÎļþ³¬Ê±",DELAY_TIME3s);
+        disp_hint_info_two(pos,"Éý¼¶Ê§°Ü", "ÏÂÔØÎļþ³¬Ê±",DELAY_TIME3s);
         return 1;
       }
       Delay_ms(DELAY_TIME1s);
@@ -374,7 +374,7 @@
       }
       else
       {
-        disp_hint_info(pos, "ÎļþУÑé´íÎó",DELAY_TIME3s);
+        disp_hint_info_two(pos,"Éý¼¶Ê§°Ü", "ÎļþУÑé´íÎó",DELAY_TIME3s);
         return 1;
       }
     }