Commit dc1aa1bb authored by 梁百峰's avatar 梁百峰

feat:上电扫码,如果不需要扫码初始化将firstpowerflag = 2

parent 54f657fd
......@@ -47,6 +47,7 @@ uint8_t powerstdio = 0;
uint8_t get_num_buf[34];
uint8_t comparestart;
uint8_t blename[5];
uint8_t firstpowerflag = 0;
void get_key(void)
{
key_array[0] = seed_value[0] | seed_value[3];
......@@ -410,6 +411,10 @@ void UART_Put1(uint32_t Value)
// RS485_TX_finish = 0;
// LINE_OUT_NEG_09 = 1;
// RS485_TX_finish = 0;
if(firstpowerflag != 2)
{
firstpowerflag = 1;
}
return;
}
void Recv_Byte(void)
......
......@@ -33,4 +33,5 @@ extern uint8_t connectbleFlag;
extern uint8_t get_num_buf[34];
extern uint8_t blename[5];
extern uint8_t recvflag111;
extern uint8_t firstpowerflag;
#endif
\ No newline at end of file
......@@ -9,29 +9,36 @@ void Key_Operation_SW5(Key_Event_en_t enKeyEvent)
{
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{
if ( (LED_Waring == 1) || (UDS_Warning_Voltage ==1))
// if ( (LED_Waring == 1) || (UDS_Warning_Voltage ==1))
// {
// ;
// }
// else
// {
// Display_Add( );
// Display_TFT_Clear( );
// }
if(firstpowerflag == 2)
{
;
MENU_CHECK_STEP_ADD( );
}
else
{
Display_Add( );
Display_TFT_Clear( );
}
MENU_CHECK_STEP_ADD( );
}
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
{
if(AutoFlag == 1)
if(firstpowerflag == 2)
{
AutoFlag = 0;
}
else
{
AutoFlag = 1;
if(AutoFlag == 1)
{
AutoFlag = 0;
}
else
{
AutoFlag = 1;
}
}
}
// else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS )
......@@ -65,7 +72,10 @@ void Key_Operation_SW4(Key_Event_en_t enKeyEvent)
// Display_Sub( );
// Display_TFT_Clear( );
// }
MENU_CHECK_STEP_SUB();
if(firstpowerflag == 2)
{
MENU_CHECK_STEP_SUB();
}
}
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
{
......@@ -94,14 +104,18 @@ void Key_Operation_SW7(Key_Event_en_t enKeyEvent)
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{
if(zhenduanflag != 2 && zhenduanflag != 3)
{
zhenduanflag = 2;
}
else
{
zhenduanflag = 0;
}
if(firstpowerflag == 2)
{
if(zhenduanflag != 2 && zhenduanflag != 3)
{
zhenduanflag = 2;
}
else
{
zhenduanflag = 0;
}
}
}
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
{
......@@ -117,22 +131,25 @@ void Key_Operation_SW8(Key_Event_en_t enKeyEvent)
{
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{
if(zhenduanflag != 1)
if(firstpowerflag == 2)
{
zhenduanflag = 1;
}
else
{
zhenduanflag = 0;
LINE_OUT_NEG_01 = 1;
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
LINE_OUT_NEG_04 = 1;
zhenduansendStep = 0;
// memset(barcode_Msg,0,sizeof(barcode_Msg));
if(zhenduanflag != 1)
{
zhenduanflag = 1;
}
else
{
zhenduanflag = 0;
LINE_OUT_NEG_01 = 1;
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
LINE_OUT_NEG_04 = 1;
zhenduansendStep = 0;
// memset(barcode_Msg,0,sizeof(barcode_Msg));
}
RS485_TX_finish = 0;
}
RS485_TX_finish = 0;
}
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
......@@ -149,17 +166,20 @@ void Key_Operation_SW2(Key_Event_en_t enKeyEvent)
{
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{
if(LINE_OUT_NEG_01 == 1U)
{
LINE_OUT_NEG_01 = 0U;
Auto_ONOFF = 3;
}
else
if(firstpowerflag == 2)
{
LINE_OUT_NEG_01 = 1U;
Auto_ONOFF == 0;
if(LINE_OUT_NEG_01 == 1U)
{
LINE_OUT_NEG_01 = 0U;
Auto_ONOFF = 3;
}
else
{
LINE_OUT_NEG_01 = 1U;
Auto_ONOFF == 0;
}
}
}
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
{
......@@ -179,13 +199,16 @@ void Key_Operation_SW3(Key_Event_en_t enKeyEvent)
// {
// MENU_CHECK_STEP_SUB( );
// }
if(clearOdoFlag == 0)
if(firstpowerflag == 2)
{
clearOdoFlag = 1;
}
else
{
clearOdoFlag = 0;
if(clearOdoFlag == 0)
{
clearOdoFlag = 1;
}
else
{
clearOdoFlag = 0;
}
}
}
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
......@@ -207,13 +230,16 @@ void Key_Operation_SW1(Key_Event_en_t enKeyEvent)
/*清零ODO*/
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{
if(Auto_ONOFF != 0)
if(firstpowerflag == 2)
{
Auto_ONOFF = 0;
}
else
{
Auto_ONOFF = 1;
if(Auto_ONOFF != 0)
{
Auto_ONOFF = 0;
}
else
{
Auto_ONOFF = 1;
}
}
}
......@@ -337,22 +363,25 @@ void Key_Operation_SW10(Key_Event_en_t enKeyEvent)
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{
if(connectbleFlag == 0)
{
connectbleFlag = 1;
name1= (devicename) & 0xFF;
name2 = (devicename >> 8) & 0xFF;
}
else
if(firstpowerflag == 2)
{
Display_TFT_Clear();
name1= (devicename) & 0xFF;
name2 = (devicename >> 8) & 0xFF;
startONfalg = 0;
send0x42time = 0;
bleOFFtoONtime = 0;
startONfalg = 0;
startIGONtime = 0;
if(connectbleFlag == 0)
{
connectbleFlag = 1;
name1= (devicename) & 0xFF;
name2 = (devicename >> 8) & 0xFF;
}
else
{
name1= (devicename) & 0xFF;
name2 = (devicename >> 8) & 0xFF;
startONfalg = 0;
send0x42time = 0;
bleOFFtoONtime = 0;
startONfalg = 0;
startIGONtime = 0;
}
}
}
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
......
......@@ -36,6 +36,7 @@ uint32_t send0x42time = 0;
uint32_t bleOFFtoONtime = 0;
uint8_t startONfalg = 0;
uint32_t startIGONtime = 0;
uint8_t compareresult;
const unsigned char gImage_cuo1[] = {24, 24,0X00,0X00,0X00,0X00,0X30,0X70,0XE0,0XC0,0X80,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80,0XC0,0X70,0X30,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0X83,0XC7,0X66,0X38,0X38,0X7C,0XE6,0XC3,0X81,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X0C,0X0C,0X06,0X03,0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0X03,0X07,0X0E,0X0C,0X00,0X00,0X00,0X00,};
const unsigned char gImage_dui1[] = {24, 24,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80,0XC0,0XE0,0X40,0X00,0X00,0X00,0X00,0X08,0X18,0X30,0X70,0XC0,0X80,0X00,0X00,0X80,0XC0,0XE0,0X70,0X38,0X1C,0X0E,0X07,0X03,0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0X03,0X07,0X03,0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,};
void Sys_Run_Mode_Pseudo_Real_Time_Tasks(void)
......@@ -106,9 +107,10 @@ void Sys_Run_Mode_10ms_Tasks_Group(void)
// UART_Ch0_Send_Multiple_Byte(testdata,3);
// RS485_User_Tx_Data();
if(clearOdoFlag == 0)
if(firstpowerflag == 2)
{
if(clearOdoFlag == 0)
{
backsend();
// RS485_TX_finish = 0;
if(RS485_TX_finish == 0)
......@@ -222,6 +224,8 @@ void Sys_Run_Mode_10ms_Tasks_Group(void)
queren = 1;
}
}
}
}
......@@ -341,62 +345,145 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
{
RS485_send_time++;
}
if(AutoFlag == 1)
if(firstpowerflag == 2)
{
if(AutoTime <= 200)
if(AutoFlag == 1)
{
if(AutoTime <= 200)
{
AutoTime++;
}
else
{
MENU_CHECK_STEP_ADD( );
if(MENU_CHECK_STEP == 0)
{
MENU_CHECK_STEP = 0;
}
if(MENU_CHECK_STEP == 13)
{
AutoTime = 0;
}
else
{
AutoTime = 160;
}
}
}
if(Auto_ONOFF == 1)
{
if(ONOFFtime <=420)
{
ONOFFtime++;
}
else
{
if(LINE_OUT_NEG_01 == 1)
{
LINE_OUT_NEG_01 = 0;
ONOFFtime = 0;
}
else
{
LINE_OUT_NEG_01 = 1;
ONOFFtime = 0;
}
}
}
if(flashtime < 3)
{
AutoTime++;
flashtime++;
}
else
{
MENU_CHECK_STEP_ADD( );
if(MENU_CHECK_STEP == 0)
if(comparestart == 1)
{
MENU_CHECK_STEP = 0;
compareresult = GetDataCompare();
// Display_TFT_Clear();
if(compareresult == 1)
{
TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_cuo1 );
// comparestart = 2;
}
else
{
TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_dui1 );
// comparestart = 2;
}
comparestart = 0;
// Display_TFT_Clear();
}
if(MENU_CHECK_STEP == 13)
else if(comparestart == 0)
{
AutoTime = 0;
Total_Check( );
if(zhenduanflag == 3)
{
if(compareresult == 1)
{
TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_cuo1 );
// comparestart = 2;
}
else
{
TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_dui1 );
// comparestart = 2;
}
// comparestart = 1;
}
}
else
{
AutoTime = 160;
Total_Check();
}
flashtime = 0;
}
if(recvflag111 == 1)
{
blename[4] = 0xff;
General_Number_Disp(blename, 3, 165);
recvflag111 = 0;
}
}
if(Auto_ONOFF == 1)
if(firstpowerflag == 1)
{
if(ONOFFtime <=420)
{
ONOFFtime++;
}
else
zhenduanflag = 2;
Total_Check();
firstpowerflag = 2;
Display_TFT_Clear();
if(compareresult == 1 && comparestart == 0)
{
// Total_Check();
if(LINE_OUT_NEG_01 == 1)
if(compareresult == 1)
{
LINE_OUT_NEG_01 = 0;
ONOFFtime = 0;
TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_cuo1 );
// comparestart = 2;
}
else
{
LINE_OUT_NEG_01 = 1;
ONOFFtime = 0;
TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_dui1 );
// comparestart = 2;
}
Total_Check();
firstpowerflag = 3;
// zhendlag = 5;
}
}
if(flashtime < 3)
{
flashtime++;
}
else
{
if(comparestart == 1)
if(compareresult == 1)
{
compareresult = GetDataCompare();
// Display_TFT_Clear();
Total_Check();
firstpowerflag = 3;
zhenduanflag = 2;
if(compareresult == 1)
{
TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_cuo1 );
......@@ -407,43 +494,11 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_dui1 );
// comparestart = 2;
}
comparestart = 0;
// Display_TFT_Clear();
// Total_Check();
// zhenduanflag = 5;
}
else if(comparestart == 0)
{
Total_Check( );
if(zhenduanflag == 3)
{
if(compareresult == 1)
{
TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_cuo1 );
// comparestart = 2;
}
else
{
TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_dui1 );
// comparestart = 2;
}
// comparestart = 1;
}
}
else
{
Total_Check();
}
flashtime = 0;
}
if(recvflag111 == 1)
{
blename[4] = 0xff;
General_Number_Disp(blename, 3, 165);
recvflag111 = 0;
}
// zhenduanflag = 2;
}
//u16LJSText = TFT_LCD_REQ_FIFO_MAX_DEPTH;
}
/*=================================================================*/
......
......@@ -104,6 +104,12 @@ void Sys_Startup_Init(void)
loc_config.pfnUARTErrHandleCallBack = 0;
loc_config.pfnUARTReadMsgCallBack = UART_Put1;
UART_Init(UART_RLIN31, &loc_config);
LINE_OUT_NEG_01 = 1;
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
LINE_OUT_NEG_04 = 1;
Display_TFT_Clear();
GUI_Display_Version_Code_Service(25, 20, "Please Scan The Code ", Letter_Num_11, PCodeText_Space_size);
}
/***********************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment