Commit 88692e08 authored by 何锐's avatar 何锐

feat:增加上电扫码解锁,单独写入,校验等步骤,增加连接蓝牙时显示蓝牙名称

parent 4a60b863
...@@ -313,7 +313,7 @@ void datacheck(void) ...@@ -313,7 +313,7 @@ void datacheck(void)
// RS485_TX_finish = 0; // RS485_TX_finish = 0;
} }
break; break;
case 4: case 5:
if(BarCode[0] == 0x59 && BarCode[1] == 0x44) if(BarCode[0] == 0x59 && BarCode[1] == 0x44)
{ {
if(((BarCode[arraynum]) == 0x4A) && ((BarCode[arraynum-1]) == 0x4B)) if(((BarCode[arraynum]) == 0x4A) && ((BarCode[arraynum-1]) == 0x4B))
...@@ -369,12 +369,12 @@ void BarCodeDataGet(void) ...@@ -369,12 +369,12 @@ void BarCodeDataGet(void)
{ {
memcpy(barcode_Msg,&mDataBufPtr1[6],34); memcpy(barcode_Msg,&mDataBufPtr1[6],34);
memcpy(barcode_Msg1,&mDataBufPtr1[6],34); memcpy(barcode_Msg1,&mDataBufPtr1[6],34);
zhenduanflag = 1;
} }
else else
{ {
memcpy(barcode_Msg1,&mDataBufPtr1[6],34); // memcpy(barcode_Msg1,&mDataBufPtr1[6],34);
memset(barcode_Msg,0,34); memset(barcode_Msg,0,34);
General_Number_Disp(writefail, 3, 250);
} }
} }
uint8_t GetDataCompare(void) uint8_t GetDataCompare(void)
......
...@@ -189,6 +189,18 @@ uint32_t Get_IPK_Status(void) ...@@ -189,6 +189,18 @@ uint32_t Get_IPK_Status(void)
{ {
return NO_IPK_EXIST_Status; return NO_IPK_EXIST_Status;
} }
uint8_t Datajudgment(void)
{
for(int i = 0; i<34; i++)
{
if(barcode_Msg[i] != mimaread[i])
{
return 0;
}
}
return 1;
}
void Diag_Info_Init(void) void Diag_Info_Init(void)
{ {
NO_IPK_EXIST_Status = 0x11223344; NO_IPK_EXIST_Status = 0x11223344;
...@@ -208,11 +220,12 @@ void Diag_Info_Init(void) ...@@ -208,11 +220,12 @@ void Diag_Info_Init(void)
} }
uint8_t Type_Clear = 0; uint8_t Type_Clear = 0;
extern uint8_t BCM_FLAG_2014 = 0; extern uint8_t BCM_FLAG_2014 = 0;
uint8_t writefail[5] = {0x46,0x41,0x49,0x4c,0xff};
uint8_t erweima[64] ;
uint32_t loc_Type = 0; uint32_t loc_Type = 0;
void Total_Check(void) void Total_Check(void)
{ {
uint8_t erweima[64] ;
uint8_t cmperweima[34]; uint8_t cmperweima[34];
uint8_t yibiaoshuju[34]; uint8_t yibiaoshuju[34];
...@@ -230,21 +243,23 @@ uint8_t yibiaoshuju[34]; ...@@ -230,21 +243,23 @@ uint8_t yibiaoshuju[34];
switch ( loc_Type ) switch ( loc_Type )
{ {
case 0: case 0:
if(saomafinish == 0)
// Buzzer_Init();
// Function_Check_Ctrl(1); //Excel表格发报文。硬线信号
//Buzzer_Warning();
// TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_dui12 );
// for(int i = 0;i<34;i++)
// {
// erweima[i] = barcode_Msg[i];
// }
if(saomafinish == 2)
{ {
for(int i = 0;i<34;i++)
{
if(barcode_Msg[i] != erweima[i])
{
Display_TFT_Clear();
break;
}
}
memcpy(erweima,barcode_Msg,34); memcpy(erweima,barcode_Msg,34);
erweima[34] = 0xFF; erweima[34] = 0xFF;
General_Number_Disp(erweima, 3, 90);
General_Number_Disp(erweima, 3, 60);
if(writeflag == 1 || writeflag == 3) if(writeflag == 1 || writeflag == 3)
{ {
TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_dui12 ); TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_dui12 );
...@@ -253,9 +268,55 @@ uint8_t yibiaoshuju[34]; ...@@ -253,9 +268,55 @@ uint8_t yibiaoshuju[34];
{ {
TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_cuo12 ); TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_cuo12 );
} }
}
else if(saomafinish == 1)
{
memcpy(erweima,barcode_Msg,34);
erweima[34] = 0xFF;
General_Number_Disp(erweima, 3, 60);
if(writeflag == 1 || writeflag == 3)
{
TFT_LCD_Draw_Bmp(200, 90+40-5, ( uint8_t * )gImage_dui12 );
}
else
{
TFT_LCD_Draw_Bmp(200, 90+40-5, ( uint8_t * )gImage_cuo12 );
}
uint8_t writesuccess[8] = {0x53,0x55,0x43,0x43,0x46,0x53,0x53,0xff};
General_Number_Disp(writesuccess, 3, 125);
}
else if(saomafinish == 2)
{
memcpy(erweima,barcode_Msg,34);
erweima[34] = 0xFF;
General_Number_Disp(erweima, 3, 60);
if(writeflag == 1 || writeflag == 3)
{
TFT_LCD_Draw_Bmp(200, 90+40-5, ( uint8_t * )gImage_dui12 );
}
else
{
TFT_LCD_Draw_Bmp(200, 90+40-5, ( uint8_t * )gImage_cuo12 );
}
uint8_t writesuccess[8] = {0x53,0x55,0x43,0x43,0x45,0x53,0x53,0xff};
General_Number_Disp(writesuccess, 3, 125);
mimaread[34] = 0xFF; mimaread[34] = 0xFF;
General_Number_Disp(mimaread, 3, 200); General_Number_Disp(mimaread, 3, 200);
if(Datajudgment())
{
saomafinish = 3;
firstpowerflag = 2;
General_Number_Disp(writesuccess, 3, 250);
}
else
{
General_Number_Disp(writefail, 3, 250);
}
} }
break; break;
...@@ -269,14 +330,14 @@ uint8_t yibiaoshuju[34]; ...@@ -269,14 +330,14 @@ uint8_t yibiaoshuju[34];
// cmperweima[i] = barcode_Msg1[i]; // cmperweima[i] = barcode_Msg1[i];
// } // }
cmperweima[34] = 0xFF; cmperweima[34] = 0xFF;
General_Number_Disp(cmperweima, 3, 90); General_Number_Disp(cmperweima, 3, 60);
memcpy(yibiaoshuju,get_num_buf,34); // memcpy(yibiaoshuju,get_num_buf,34);
// for(int i =0;i<34;i++) // for(int i =0;i<34;i++)
// { // {
// yibiaoshuju[i] = get_num_buf[i]; // yibiaoshuju[i] = get_num_buf[i];
// } // }
yibiaoshuju[34] = 0xFF; // yibiaoshuju[34] = 0xFF;
General_Number_Disp(yibiaoshuju, 3, 165); // General_Number_Disp(yibiaoshuju, 3, 165);
// zhenduanflag = 3; // zhenduanflag = 3;
// comparestart = 1; // comparestart = 1;
break; break;
......
...@@ -45,7 +45,7 @@ extern unsigned char KEYBUFFER [ 4 ]; ...@@ -45,7 +45,7 @@ extern unsigned char KEYBUFFER [ 4 ];
extern unsigned int CAN_Msg_Tx_Enable; extern unsigned int CAN_Msg_Tx_Enable;
extern uint8_t loc_Type_back; extern uint8_t loc_Type_back;
extern uint8_t LED_Waring ; extern uint8_t LED_Waring ;
extern uint8_t writefail[5];
void SET_IPK_NONE(void); void SET_IPK_NONE(void);
void Clear_IPK_NONE(void); void Clear_IPK_NONE(void);
void CHECK_IPK_COUNT(void); void CHECK_IPK_COUNT(void);
......
...@@ -2892,7 +2892,7 @@ uint32_t Get_Display_Type(void) ...@@ -2892,7 +2892,7 @@ uint32_t Get_Display_Type(void)
{ {
return 2; return 2;
} }
else if(zhenduanflag == 1) else if((zhenduanflag == 1) || (zhenduanflag == 2))
{ {
return 0; return 0;
} }
......
...@@ -11,15 +11,14 @@ void Key_Operation_SW5(Key_Event_en_t enKeyEvent) //下一步 ...@@ -11,15 +11,14 @@ void Key_Operation_SW5(Key_Event_en_t enKeyEvent) //下一步
{ {
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS ) if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{ {
if(zhenduanflag == 1)
{
zhenduanflag = 0;
}
if(firstpowerflag == 2) if(firstpowerflag == 2)
{ {
MENU_CHECK_STEP_ADD( ); if(saomafinish == 3)
zhenduansendStep = 0; {
MENU_CHECK_STEP_ADD( );
zhenduansendStep = 0;
zhenduanflag = 0;
}
} }
} }
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS ) else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
...@@ -45,10 +44,12 @@ void Key_Operation_SW4(Key_Event_en_t enKeyEvent) //上一步 ...@@ -45,10 +44,12 @@ void Key_Operation_SW4(Key_Event_en_t enKeyEvent) //上一步
{ {
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS ) if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{ {
if(firstpowerflag == 2) // if(firstpowerflag == 2)
{ // {
MENU_CHECK_STEP_SUB(); // MENU_CHECK_STEP_SUB();
} // }
zhenduanflag = 1;
} }
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS ) else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
{ {
...@@ -406,26 +407,11 @@ void Key_Operation_SW10(Key_Event_en_t enKeyEvent) ...@@ -406,26 +407,11 @@ void Key_Operation_SW10(Key_Event_en_t enKeyEvent)
if(firstpowerflag == 2) if(firstpowerflag == 2)
{ {
// Display_TFT_Clear(); // clearOdoFlag = 1;
// if(connectbleFlag == 0) if(zhenduanflag == 1)
// { {
// connectbleFlag = 1; zhenduansendStep = 5;
// 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;
// recvflag111 = 0;
// }
clearOdoFlag = 1;
// queren = 1;
} }
} }
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS ) else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
......
...@@ -483,9 +483,9 @@ uint32_t R485_Send_0x04(void) ...@@ -483,9 +483,9 @@ uint32_t R485_Send_0x04(void)
length = 37; length = 37;
break; break;
case 4: case 4:
length = 3;
break; break;
case 5: case 5:
length = 3;
break; break;
case 6: case 6:
length = 3; length = 3;
...@@ -518,7 +518,7 @@ uint32_t R485_Send_0x04(void) ...@@ -518,7 +518,7 @@ uint32_t R485_Send_0x04(void)
R485_zhenduan_Msg[2] = 0x0; R485_zhenduan_Msg[2] = 0x0;
memcpy(R485_zhenduan_Msg+3,barcode_Msg,34); memcpy(R485_zhenduan_Msg+3,barcode_Msg,34);
break; break;
case 4: case 5:
R485_zhenduan_Msg[0] = 0x22; R485_zhenduan_Msg[0] = 0x22;
R485_zhenduan_Msg[1] = 0x50; R485_zhenduan_Msg[1] = 0x50;
R485_zhenduan_Msg[2] = 0x0; R485_zhenduan_Msg[2] = 0x0;
...@@ -527,10 +527,10 @@ uint32_t R485_Send_0x04(void) ...@@ -527,10 +527,10 @@ uint32_t R485_Send_0x04(void)
break; break;
} }
RS485_TX_finish = 1; RS485_TX_finish = 1;
// if(zhenduansendStep = 4) if(zhenduansendStep != 4)
// { {
u32sendendflag = R485_Send(0x04, R485_zhenduan_Msg, length); u32sendendflag = R485_Send(0x04, R485_zhenduan_Msg, length);
// } }
RS485_send_time = 0; RS485_send_time = 0;
RS485_TX_finish = 1; RS485_TX_finish = 1;
......
...@@ -432,23 +432,21 @@ void Sys_Run_Mode_100ms_Tasks_Group(void) ...@@ -432,23 +432,21 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
} }
else if(comparestart == 0) else if(comparestart == 0)
{ {
Total_Check( ); Total_Check( );
if(zhenduanflag == 3) if(zhenduanflag == 3)
{
if(compareresult == 1)
{ {
if(compareresult == 1) TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_cuo1 );
{ // comparestart = 2;
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
{
TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_dui1 );
// comparestart = 2;
}
// comparestart = 1;
}
} }
else else
{ {
......
...@@ -118,11 +118,11 @@ void Sys_Startup_Init(void) ...@@ -118,11 +118,11 @@ void Sys_Startup_Init(void)
LINE_OUT_NEG_03 = 1; LINE_OUT_NEG_03 = 1;
LINE_OUT_NEG_04 = 1; LINE_OUT_NEG_04 = 1;
// Display_TFT_Clear(); Display_TFT_Clear();
// GUI_Display_Version_Code_Service(25, 20, "Please Scan The Code ", Letter_Num_11, PCodeText_Space_size); GUI_Display_Version_Code_Service(25, 20, "Please Scan The Code ", Letter_Num_11, PCodeText_Space_size);
/*上电扫码校验功能如果需要扫码校验注释掉firstpowerflag = 2,打开上面两行的注释即可*/ /*上电扫码校验功能如果需要扫码校验注释掉firstpowerflag = 2,打开上面两行的注释即可*/
firstpowerflag = 2; // firstpowerflag = 2;
} }
/*********************************************************************** /***********************************************************************
......
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