优化通讯模块
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: