Commit 3e74870b authored by 何锐's avatar 何锐

feat:增加蓝牙按键,增加扫码读码

parent 189fa3ca
...@@ -46,6 +46,7 @@ uint8_t zhenduansendStep = 0; ...@@ -46,6 +46,7 @@ uint8_t zhenduansendStep = 0;
uint8_t line_stdio = 2; uint8_t line_stdio = 2;
uint8_t powerstdio = 0; uint8_t powerstdio = 0;
uint8_t get_num_buf[34]; uint8_t get_num_buf[34];
uint8_t mimaread[35];
uint8_t comparestart; uint8_t comparestart;
uint8_t blename[5]; uint8_t blename[5];
uint8_t btmac[6]; uint8_t btmac[6];
...@@ -65,6 +66,8 @@ void get_key(void) ...@@ -65,6 +66,8 @@ void get_key(void)
} }
uint8_t recvflag111 = 0; uint8_t recvflag111 = 0;
uint8_t xierucishu = 0; uint8_t xierucishu = 0;
uint8_t waittimer;
uint8_t saomafinish;;
void datacheck(void) void datacheck(void)
{ {
uint16_t checksum = 0; uint16_t checksum = 0;
...@@ -88,14 +91,6 @@ void datacheck(void) ...@@ -88,14 +91,6 @@ void datacheck(void)
} }
switch (BarCode[2]) //ID switch (BarCode[2]) //ID
{ {
// case 0x48:
// memcpy(R485_ID48h.Msg,RS485_data,64);
// checksum = Yadi_CAL_Data_Sum(&BarCode[2], 64 + 2);
// if(checksum != BarCode[68])
// {
// // checknumwrong = 1;
// }
// break;
case 0xB4: case 0xB4:
memcpy(R485_IDB4h.Msg,RS485_data,RS485_RX_ID0XB4_DATA_LEN); memcpy(R485_IDB4h.Msg,RS485_data,RS485_RX_ID0XB4_DATA_LEN);
checksum = Yadi_CAL_Data_Sum(&BarCode[2], 64 + 2); checksum = Yadi_CAL_Data_Sum(&BarCode[2], 64 + 2);
...@@ -103,44 +98,25 @@ void datacheck(void) ...@@ -103,44 +98,25 @@ void datacheck(void)
{ {
; ;
} }
// case 0x49:
// memcpy(R485_ID49h.Msg,RS485_data,64);
// checksum = Yadi_CAL_Data_Sum(&BarCode[2], 64 + 2);
// if(checksum != BarCode[68])
// {
// // checknumwrong = 1;
// }
// break;
// case 0x4A:
// if(connectbleFlag == 1)
// {
// memcpy(R485_ID4Ah.Msg,RS485_data,64);
// }
// memcpy(R485_ID4Ah.Msg,RS485_data,64);
// checksum = Yadi_CAL_Data_Sum(&BarCode[2], 64 + 2);
// if(checksum != BarCode[68])
// {
// // checknumwrong = 1;
// }
// break;
// case 0x4D:
// memcpy(R485_ID4Dh.Msg,RS485_data,64);
// break;
case 0x81: //81接收mac地址 case 0x81: //81接收mac地址
{ {
btmac[0] = RS485_data[0]; if((BarCode[72] == 0x4A) && (BarCode[71] == 0x4B))
btmac[1] = RS485_data[1]; {
btmac[2] = RS485_data[2]; btmac[0] = RS485_data[0];
btmac[3] = RS485_data[3]; btmac[1] = RS485_data[1];
btmac[4] = RS485_data[4]; btmac[2] = RS485_data[2];
btmac[5] = RS485_data[5]; btmac[3] = RS485_data[3];
blename[0] = RS485_data[6]; btmac[4] = RS485_data[4];
blename[1] = RS485_data[7]; btmac[5] = RS485_data[5];
blename[2] = RS485_data[8]; blename[0] = RS485_data[6];
blename[3] = RS485_data[9]; blename[1] = RS485_data[7];
blename[4] = 0xff; blename[2] = RS485_data[8];
lightnumber = (RS485_data[11]<<8)+RS485_data[10]; blename[3] = RS485_data[9];
writeflag = RS485_data[12]; blename[4] = 0xff;
lightnumber = (RS485_data[11]<<8)+RS485_data[10];
writeflag = RS485_data[12];
}
// General_Number_Disp(blename, 3, 165); // General_Number_Disp(blename, 3, 165);
} }
break; break;
...@@ -229,149 +205,160 @@ void datacheck(void) ...@@ -229,149 +205,160 @@ void datacheck(void)
} }
else if(zhenduanflag == 1) else if(zhenduanflag == 1)
{ {
if(BarCode[0] == 0x59 && BarCode[1] == 0x44) if(BarCode[0] == 0x59 && BarCode[1] == 0x44)
{
for(int i = 0;i<255;i++)
{ {
for(int i = 0;i<255;i++) if(BarCode[3] == 0x40)
{
if(BarCode[i] == 0x4A && BarCode[i - 1] == 0x4B && i > 0x40-3)
{ {
if(BarCode[3] == 0x40) arraynum = i;
}
}
else
{
if(BarCode[i] == 0x4A && BarCode[i - 1] == 0x4B)
{
arraynum = i;
}
}
}
// g_Stage = 1;
if(((BarCode[arraynum]) == 0x4A) && ((BarCode[arraynum-1]) == 0x4B))
{
if(BarCode[2] == 0x81)
{
writeflag = BarCode[17];
RS485_TX_finish = 0;
}
switch (zhenduansendStep)
{
case 0:
if(BarCode[2] == 0x14)
{
if(BarCode[5] == 0x50 && BarCode[6] == 0x3)
{ {
if(BarCode[i] == 0x4A && BarCode[i - 1] == 0x4B && i > 0x40-3) zhenduansendStep++;
{ RS485_TX_finish = 0;
arraynum = i; }
} }
break;
case 1:
if(BarCode[2] == 0x14)
{
if(BarCode[5] == 0x67 && BarCode[6] == 0x1)
{
seed_value[0] = BarCode[7];
seed_value[1] = BarCode[8];
seed_value[2] = BarCode[9];
seed_value[3] = BarCode[10];
get_key();
zhenduansendStep++;
RS485_TX_finish = 0;
}
}
break;
case 2:
if(BarCode[2] == 0x14)
{
if(BarCode[5] == 0x67 && BarCode[6] == 0x2)
{
zhenduansendStep++;
RS485_TX_finish = 0;
}
else if(BarCode[5] != 0x67)
{
zhenduansendStep = 0;
RS485_TX_finish = 0;
} }
else else
{ {
if(BarCode[i] == 0x4A && BarCode[i - 1] == 0x4B) ;
{
arraynum = i;
}
} }
} }
// g_Stage = 1; break;
if(((BarCode[arraynum]) == 0x4A) && ((BarCode[arraynum-1]) == 0x4B)) case 3:
if(BarCode[2] == 0x14)
{ {
if(BarCode[2] == 0x81) if((BarCode[5] == 0x6E) && (BarCode[6] == 0x50) && (BarCode[7] == 0))
{ {
writeflag = BarCode[16]; zhenduansendStep++;
RS485_TX_finish = 0; RS485_TX_finish = 0;
// zhenduanflag = 0;
saomafinish = 1;
waittimer = 0;
} }
switch (zhenduansendStep) if(BarCode[5] == 0x7F && BarCode[6] == 0x2E && BarCode[7] == 0x78 )
{ {
case 0: if(waittimer >= 2)
if(BarCode[2] == 0x4F)
{
if(BarCode[4] == 0x50 && BarCode[5] == 0x3)
{
zhenduansendStep++;
RS485_TX_finish = 0;
}
}
break;
case 1:
if(BarCode[2] == 0x4F)
{
if(BarCode[4] == 0x67 && BarCode[5] == 0x1)
{
seed_value[0] = BarCode[6];
seed_value[1] = BarCode[7];
seed_value[2] = BarCode[8];
seed_value[3] = BarCode[9];
get_key();
zhenduansendStep++;
RS485_TX_finish = 0;
}
}
break;
case 2:
if(BarCode[2] == 0x4F)
{
if(BarCode[4] == 0x67 && BarCode[5] == 0x2)
{
zhenduansendStep++;
RS485_TX_finish = 0;
}
else if(BarCode[4] != 0x67)
{
zhenduansendStep = 0;
RS485_TX_finish = 0;
}
else
{
;
}
}
break;
case 3:
if(BarCode[2] == 0x4F)
{ {
zhenduansendStep = 0;
if((BarCode[4] == 0x6E) && (BarCode[5] == 0x50) && (BarCode[6] == 0)) waittimer = 0;
{ RS485_TX_finish = 0;
// if(xierucishu > 4)
// {
zhenduansendStep++;
xierucishu = 0;
// }
// else
// {
// xierucishu++;
// }
RS485_TX_finish = 0;
}
if(BarCode[4] == 0x7F && BarCode[5] == 0x2E && BarCode[6] == 0x78 )
{
RS485_TX_finish = 1;
// zhenduansendStep = 0;
// ;
}
if(BarCode[4] == 0x7F && BarCode[5] == 0x2E && BarCode[6] == 0x31 )
{
RS485_TX_finish = 0;
}
} }
else else
{ {
// RS485_TX_finish = 0; waittimer++;
} }
break;
default:
break;
} }
memset(RS485_data,0,64); if(BarCode[5] == 0x7F && BarCode[6] == 0x2E && BarCode[7] == 0x31 )
{
RS485_TX_finish = 0;
}
} }
else else
{ {
// RS485_TX_finish = 0x0; // RS485_TX_finish = 0;
} }
} break;
} case 4:
else if(zhenduanflag == 2) if(BarCode[0] == 0x59 && BarCode[1] == 0x44)
{
if(BarCode[0] == 0x59 && BarCode[1] == 0x44)
{
for(int i = 0;i<255;i++)
{ {
if(BarCode[i] == 0x4A && BarCode[i - 1] == 0x4B) if(((BarCode[arraynum]) == 0x4A) && ((BarCode[arraynum-1]) == 0x4B))
{ {
arraynum = i; if(BarCode[5] == 0x62 && BarCode[6] == 0x50 && BarCode[7] == 0)
{
memcpy(mimaread,BarCode+8,34 );
saomafinish = 2;
}
} }
} }
if(((BarCode[arraynum]) == 0x4A) && ((BarCode[arraynum-1]) == 0x4B)) default:
{ break;
if(BarCode[4] == 0x62 && BarCode[5] == 0x50 && BarCode[6] == 0) }
{ memset(RS485_data,0,64);
memcpy(get_num_buf,BarCode+7,34 ); }
comparestart = 1; else
zhenduanflag = 3; {
// RS485_TX_finish = 0x0;
}
}
} }
}
}
else if(zhenduanflag == 2)
{
// if(BarCode[0] == 0x59 && BarCode[1] == 0x44)
// {
// for(int i = 0;i<255;i++)
// {
// if(BarCode[i] == 0x4A && BarCode[i - 1] == 0x4B)
// {
// arraynum = i;
// }
// }
// if(((BarCode[arraynum]) == 0x4A) && ((BarCode[arraynum-1]) == 0x4B))
// {
// if(BarCode[4] == 0x62 && BarCode[5] == 0x50 && BarCode[6] == 0)
// {
// memcpy(get_num_buf,BarCode+7,34 );
// comparestart = 1;
// zhenduanflag = 3;
// }
// }
// }
} }
} }
uint8_t cmpresult = 3; uint8_t cmpresult = 3;
...@@ -382,6 +369,7 @@ void BarCodeDataGet(void) ...@@ -382,6 +369,7 @@ 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
{ {
......
...@@ -39,4 +39,6 @@ extern uint8_t firstpowerflag; ...@@ -39,4 +39,6 @@ extern uint8_t firstpowerflag;
extern uint16_t lightnumber; extern uint16_t lightnumber;
extern uint8_t btmac[6]; extern uint8_t btmac[6];
extern uint8_t writeflag; extern uint8_t writeflag;
extern uint8_t saomafinish;
extern uint8_t mimaread[35];
#endif #endif
\ No newline at end of file
...@@ -76,10 +76,10 @@ void MENU_CHECK_STEP_ADD(void) ...@@ -76,10 +76,10 @@ void MENU_CHECK_STEP_ADD(void)
{ {
MENU_CHECK_STEP = 0; MENU_CHECK_STEP = 0;
} }
if((guangganflag == 2 || guangganflag == 1 ) && guangganflag != 3) // if((guangganflag == 2 || guangganflag == 1 ) && guangganflag != 3)
{ // {
MENU_CHECK_STEP = 3; // MENU_CHECK_STEP = 3;
} // }
} }
void MENU_CHECK_STEP_SUB(void) void MENU_CHECK_STEP_SUB(void)
{ {
...@@ -240,16 +240,22 @@ uint8_t yibiaoshuju[34]; ...@@ -240,16 +240,22 @@ uint8_t yibiaoshuju[34];
// { // {
// erweima[i] = barcode_Msg[i]; // erweima[i] = barcode_Msg[i];
// } // }
memcpy(erweima,barcode_Msg,34); if(saomafinish == 2)
erweima[34] = 0xFF;
General_Number_Disp(erweima, 3, 90);
if(writeflag == 1 || writeflag == 3)
{
TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_dui12 );
}
else
{ {
TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_cuo12 ); memcpy(erweima,barcode_Msg,34);
erweima[34] = 0xFF;
General_Number_Disp(erweima, 3, 90);
if(writeflag == 1 || writeflag == 3)
{
TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_dui12 );
}
else
{
TFT_LCD_Draw_Bmp(200, 90+40, ( uint8_t * )gImage_cuo12 );
}
mimaread[34] = 0xFF;
General_Number_Disp(mimaread, 3, 200);
} }
break; break;
...@@ -310,10 +316,8 @@ uint8_t yibiaoshuju[34]; ...@@ -310,10 +316,8 @@ uint8_t yibiaoshuju[34];
{ {
General_Number_Disp(blename, 3, 165); General_Number_Disp(blename, 3, 165);
} }
// recvflag111 = 0; // recvflag111 = 0;
// } // }
// POWER_CTRL_KL30 = 0u; //B+ // POWER_CTRL_KL30 = 0u; //B+
// POWER_CTRL_KL15 = 0u; //KL15 // POWER_CTRL_KL15 = 0u; //KL15
// CAN_Msg_Tx_Enable = 1u; // CAN_Msg_Tx_Enable = 1u;
...@@ -325,10 +329,6 @@ uint8_t yibiaoshuju[34]; ...@@ -325,10 +329,6 @@ uint8_t yibiaoshuju[34];
// // Function_Check_Ctrl(1); //Excel表格发报文。硬线信号 // // Function_Check_Ctrl(1); //Excel表格发报文。硬线信号
// //FUEL_UDS__Display(3); // //FUEL_UDS__Display(3);
// Buzzer_Warning(); // Buzzer_Warning();
// break; // break;
// case 4: // case 4:
......
...@@ -3814,7 +3814,7 @@ void Display_Version_Info(uint32_t ON_OFF) ...@@ -3814,7 +3814,7 @@ void Display_Version_Info(uint32_t ON_OFF)
// TFT_LCD_Draw_Bmp(3, 160, ( uint8_t * )gImage_Alarm_12_WordX6_Y165); //24脚输出占空比 // TFT_LCD_Draw_Bmp(3, 160, ( uint8_t * )gImage_Alarm_12_WordX6_Y165); //24脚输出占空比
// TFT_LCD_Draw_Bmp(210, 160, ( uint8_t * )gImage_Alarm_13_ImageX222_Y166); //% // TFT_LCD_Draw_Bmp(210, 160, ( uint8_t * )gImage_Alarm_13_ImageX222_Y166); //%
TFT_LCD_Draw_Bmp(3, 290, ( uint8_t * )gImage_gImage_checkVX6_Y165 ); //检测台版本号 TFT_LCD_Draw_Bmp(3, 290, ( uint8_t * )gImage_gImage_checkVX6_Y165 ); //检测台版本号
uint8_t mbuff [7] = {2,5,0,8,2,0,0xff}; uint8_t mbuff [7] = {2,5,0,8,2,8,0xff};
General_Number_Disp(mbuff, 160, 290); General_Number_Disp(mbuff, 160, 290);
} }
......
...@@ -13,6 +13,7 @@ typedef enum ...@@ -13,6 +13,7 @@ typedef enum
KEY_10, KEY_10,
KEY_11, KEY_11,
KEY_3, KEY_3,
KEY_1,
KEY_NUM_MAX, KEY_NUM_MAX,
} Key_Num_en_t; } Key_Num_en_t;
......
...@@ -11,10 +11,16 @@ void Key_Operation_SW5(Key_Event_en_t enKeyEvent) //下一步 ...@@ -11,10 +11,16 @@ 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( ); MENU_CHECK_STEP_ADD( );
} zhenduansendStep = 0;
}
} }
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS ) else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
{ {
...@@ -254,6 +260,33 @@ void Key_Operation_SW1(Key_Event_en_t enKeyEvent) //自动下电模式 ...@@ -254,6 +260,33 @@ void Key_Operation_SW1(Key_Event_en_t enKeyEvent) //自动下电模式
} }
} }
void Key_Operation_SW6(Key_Event_en_t enKeyEvent)
{
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{
if(BlueTooth == 0)
{
BlueTooth = 1;
}
else
{
BlueTooth = 0;
}
}
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
{
}
else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS )
{
}
else
{
}
}
/*-------------------------------------------------*/ /*-------------------------------------------------*/
Key_Real_Status_en_t Key_Real_sw5(void) Key_Real_Status_en_t Key_Real_sw5(void)
{ {
...@@ -353,6 +386,18 @@ Key_Real_Status_en_t Key_Real_sw10(void) ...@@ -353,6 +386,18 @@ Key_Real_Status_en_t Key_Real_sw10(void)
return enKeyRealStatus; return enKeyRealStatus;
} }
Key_Real_Status_en_t Key_Real_sw6(void)
{
Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
if ( SW9 == 0U )
{
enKeyRealStatus = KEY_LINE_PRESS;
}
return enKeyRealStatus;
}
void Key_Operation_SW10(Key_Event_en_t enKeyEvent) void Key_Operation_SW10(Key_Event_en_t enKeyEvent)
{ {
/*清零ODO*/ /*清零ODO*/
...@@ -404,5 +449,5 @@ const Key_Attribute_st_t stKeyAttribute [ KEY_NUM_MAX ] = { ...@@ -404,5 +449,5 @@ const Key_Attribute_st_t stKeyAttribute [ KEY_NUM_MAX ] = {
{KEY_TYPE_LINE, Key_Real_sw1, Key_Operation_SW1}, //SW1+ {KEY_TYPE_LINE, Key_Real_sw1, Key_Operation_SW1}, //SW1+
{KEY_TYPE_LINE, Key_Real_sw10, Key_Operation_SW10}, {KEY_TYPE_LINE, Key_Real_sw10, Key_Operation_SW10},
{KEY_TYPE_LINE, Key_Real_sw3, Key_Operation_SW3}, //SW1+ {KEY_TYPE_LINE, Key_Real_sw3, Key_Operation_SW3}, //SW1+
{KEY_TYPE_LINE, Key_Real_sw6, Key_Operation_SW6}, //SW1+
}; };
...@@ -6,10 +6,6 @@ uint8_t barcode_Msg1[64]; ...@@ -6,10 +6,6 @@ uint8_t barcode_Msg1[64];
uint8_t name1 = 0; uint8_t name1 = 0;
uint8_t name2 = 0; uint8_t name2 = 0;
void bee(void)
{
LINE_FUEL_RES03 = LINE_FUEL_RES03 ^ 1;
}
uint32_t R485_Send_0xD0(void) uint32_t R485_Send_0xD0(void)
{ {
memset(R485_IDD0h.Msg, 0xFF, 27); memset(R485_IDD0h.Msg, 0xFF, 27);
...@@ -149,14 +145,17 @@ uint32_t R485_Send_0xD1(void) ...@@ -149,14 +145,17 @@ uint32_t R485_Send_0xD1(void)
case 9: case 9:
R485_IDD1h.Sig.MainBatteryQuantity = 0xB0; //电量 R485_IDD1h.Sig.MainBatteryQuantity = 0xB0; //电量
R485_IDD1h.Sig.BatteryChargingStatus = 0x01; //充电枪
break; break;
case 10: case 10:
R485_IDD1h.Sig.MainBatteryQuantity = 0xC6; //电量 R485_IDD1h.Sig.MainBatteryQuantity = 0xC6; //电量
R485_IDD1h.Sig.BatteryChargingStatus = 0x01; //充电枪
break; break;
case 11: case 11:
R485_IDD1h.Sig.MainBatteryQuantity = 0xC8; //电量 R485_IDD1h.Sig.MainBatteryQuantity = 0xC8; //电量
R485_IDD1h.Sig.BatteryChargingStatus = 0x01; //充电枪
break; break;
default: default:
...@@ -483,6 +482,9 @@ uint32_t R485_Send_0x04(void) ...@@ -483,6 +482,9 @@ uint32_t R485_Send_0x04(void)
case 3: case 3:
length = 37; length = 37;
break; break;
case 4:
length = 3;
break;
case 5: case 5:
break; break;
case 6: case 6:
...@@ -517,19 +519,18 @@ uint32_t R485_Send_0x04(void) ...@@ -517,19 +519,18 @@ uint32_t R485_Send_0x04(void)
memcpy(R485_zhenduan_Msg+3,barcode_Msg,34); memcpy(R485_zhenduan_Msg+3,barcode_Msg,34);
break; break;
case 4: case 4:
// LINE_OUT_NEG_01 = 0; R485_zhenduan_Msg[0] = 0x22;
// LINE_OUT_NEG_02 = 0; R485_zhenduan_Msg[1] = 0x50;
// LINE_OUT_NEG_03 = 0; R485_zhenduan_Msg[2] = 0x0;
// LINE_OUT_NEG_04 = 0;
break; break;
default: default:
break; break;
} }
RS485_TX_finish = 1; RS485_TX_finish = 1;
if(zhenduansendStep != 4) // if(zhenduansendStep = 4)
{ // {
u32sendendflag = R485_Send(0x47, 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;
...@@ -1307,83 +1308,7 @@ uint32_t R485_Send_ble0x42(void) ...@@ -1307,83 +1308,7 @@ uint32_t R485_Send_ble0x42(void)
} }
uint32_t R485_Send_0x47(void) uint32_t R485_Send_0x47(void)
{ {
uint8_t length;
uint32_t u32sendendflag = 0;
if(RS485_TX_finish == 0)
{
switch (zhenduansendStep)
{
case 0:
length = 2;
break;
case 1:
length = 2;
break;
case 2:
length = 6;
break;
case 3:
length = 37;
break;
case 5:
break;
case 6:
length = 3;
break;
default:
break;
}
switch (zhenduansendStep)
{
case 0:
// R485_zhenduan_Msg[0] = 0x2;
R485_zhenduan_Msg[0] = 0x10;
R485_zhenduan_Msg[1] = 0x03;
break;
case 1:
// R485_zhenduan_Msg[0] = 0x2;
R485_zhenduan_Msg[0] = 0x27;
R485_zhenduan_Msg[1] = 0x1;
break;
case 2:
// R485_zhenduan_Msg[0] = 0x6;
R485_zhenduan_Msg[0] = 0x27;
R485_zhenduan_Msg[1] = 0x2;
R485_zhenduan_Msg[2] = key_array[0];
R485_zhenduan_Msg[3] = key_array[1];
R485_zhenduan_Msg[4] = key_array[2];
R485_zhenduan_Msg[5] = key_array[3];
break;
case 3:
R485_zhenduan_Msg[0] = 0x2E;
R485_zhenduan_Msg[1] = 0x50;
R485_zhenduan_Msg[2] = 0x0;
memcpy(R485_zhenduan_Msg+3,barcode_Msg,34);
break;
case 4:
LINE_OUT_NEG_01 = 0;
LINE_OUT_NEG_02 = 0;
LINE_OUT_NEG_03 = 0;
LINE_OUT_NEG_04 = 0;
break;
default:
break;
}
RS485_TX_finish = 1;
if(zhenduansendStep != 4)
{
u32sendendflag = R485_Send(0x47, R485_zhenduan_Msg, length);
}
RS485_send_time = 0;
RS485_TX_finish = 1;
}
RS485_TX_finish = 1;
return u32sendendflag;
} }
uint8_t R485_0x80_msg[64]; uint8_t R485_0x80_msg[64];
uint32_t R485_Send_0x80(void) uint32_t R485_Send_0x80(void)
......
...@@ -1875,7 +1875,6 @@ extern uint32_t R485_Send_0xD3(void); ...@@ -1875,7 +1875,6 @@ extern uint32_t R485_Send_0xD3(void);
extern uint32_t R485_Send_0xA4(void); extern uint32_t R485_Send_0xA4(void);
// extern uint32_t R485_Send_0x80(void); // extern uint32_t R485_Send_0x80(void);
extern uint32_t R485_Send_0x04(void); extern uint32_t R485_Send_0x04(void);
extern void bee(void);
extern uint8_t barcode_Msg[64]; extern uint8_t barcode_Msg[64];
extern uint8_t barcode_Msg1[64]; extern uint8_t barcode_Msg1[64];
extern uint8_t name1; extern uint8_t name1;
......
...@@ -54,7 +54,6 @@ void Sys_Run_Mode_Pseudo_Real_Time_Tasks(void) ...@@ -54,7 +54,6 @@ void Sys_Run_Mode_Pseudo_Real_Time_Tasks(void)
Fre_In_Service(FRE_VEHICLE); Fre_In_Service(FRE_VEHICLE);
// MENU_CHECK_STEP = 11; // MENU_CHECK_STEP = 11;
//Fre_In_Service(FRE_ENGINE); //Fre_In_Service(FRE_ENGINE);
// bee();
} }
/*============================================================================*/ /*============================================================================*/
...@@ -190,8 +189,11 @@ void Sys_Run_Mode_10ms_Tasks_Group(void) ...@@ -190,8 +189,11 @@ void Sys_Run_Mode_10ms_Tasks_Group(void)
if(zhenduanflag == 0) if(zhenduanflag == 0)
{ {
RS485_User_Tx_Data(); RS485_User_Tx_Data();
// IGONTime = 0; }
// R485_Send_0x04(); else if(zhenduanflag == 1)
{
R485_Send_0x04();
R485_Send_0x80();
} }
} }
} }
......
...@@ -389,7 +389,8 @@ uint8_t sendmsgAll[8]; ...@@ -389,7 +389,8 @@ uint8_t sendmsgAll[8];
uint32_t sendnum = 1; uint32_t sendnum = 1;
uint8_t getbanbenhaoflag = 0; uint8_t getbanbenhaoflag = 0;
uint32_t send80time = 0; uint32_t send80time = 0;
uint8_t BlueTooth = 0;
uint8_t dianliangflag = 0;
uint8_t RS485_User_Tx_Data(void) uint8_t RS485_User_Tx_Data(void)
{ {
uint32_t sendfinishflag = 0; uint32_t sendfinishflag = 0;
...@@ -414,7 +415,7 @@ uint8_t RS485_User_Tx_Data(void) ...@@ -414,7 +415,7 @@ uint8_t RS485_User_Tx_Data(void)
// RS485_TxControl.sendIndex ++; // RS485_TxControl.sendIndex ++;
// } // }
break; // break;
case RS485_Tx_IDA4_Idx: case RS485_Tx_IDA4_Idx:
if((MENU_CHECK_STEP == 0)&&(clearOdoFlag == 0)) if((MENU_CHECK_STEP == 0)&&(clearOdoFlag == 0))
...@@ -459,15 +460,17 @@ uint8_t RS485_User_Tx_Data(void) ...@@ -459,15 +460,17 @@ uint8_t RS485_User_Tx_Data(void)
case RS485_Tx_IDD1_Idx: case RS485_Tx_IDD1_Idx:
if((MENU_CHECK_STEP != 16)&&(clearOdoFlag == 0)) if((MENU_CHECK_STEP != 16)&&(clearOdoFlag == 0))
{ {
sendfinishflag = R485_Send_0xD1(); if(dianliangflag == 0)
RS485_TX_finish = 1;
if(sendfinishflag == 0)
{ {
if(RS485_TX_finish == 1) sendfinishflag = R485_Send_0xD1();
{ dianliangflag++;
RS485_send_time = 0; }
RS485_TxControl.sendIndex ++; else
} {
RS485_send_time = 0;
RS485_TxControl.sendIndex ++;
RS485_TX_finish = 1;
dianliangflag = 0;
} }
} }
else else
...@@ -525,48 +528,27 @@ uint8_t RS485_User_Tx_Data(void) ...@@ -525,48 +528,27 @@ uint8_t RS485_User_Tx_Data(void)
{ {
if(MENU_CHECK_STEP == 16) if(MENU_CHECK_STEP == 16)
{ {
RS485_TxControl.Openble[0] = 0x59; BlueTooth = 1;
RS485_TxControl.Openble[1] = 0x44;
RS485_TxControl.Openble[2] = 0xA;
RS485_TxControl.Openble[3] = 0x8A;
RS485_TxControl.Openble[4] = 0xA;
RS485_TxControl.Openble[5] = 0xA;
RS485_TxControl.Openble[6] = name2;
RS485_TxControl.Openble[7] = name1;
RS485_TxControl.Openble[8] = 1;
RS485_TxControl.Openble[9] = btmac[0];
RS485_TxControl.Openble[10] = btmac[1];
RS485_TxControl.Openble[11] = btmac[2];
RS485_TxControl.Openble[12] = btmac[3];
RS485_TxControl.Openble[13] = btmac[4];
RS485_TxControl.Openble[14] = btmac[5];
RS485_TxControl.Openble[15] = 0x4B;
RS485_TxControl.Openble[16] = 0x4A;
UART_Ch2_Send_Multiple_Byte(RS485_TxControl.Openble,sizeof(RS485_TxControl.Openble));
}
else
{
RS485_TxControl.Openble[0] = 0x59;
RS485_TxControl.Openble[1] = 0x44;
RS485_TxControl.Openble[2] = 0xA;
RS485_TxControl.Openble[3] = 0x8A;
RS485_TxControl.Openble[4] = 0xA;
RS485_TxControl.Openble[5] = 0xA;
RS485_TxControl.Openble[6] = name2;
RS485_TxControl.Openble[7] = name1;
RS485_TxControl.Openble[8] = 0;
RS485_TxControl.Openble[9] = btmac[0];
RS485_TxControl.Openble[10] = btmac[1];
RS485_TxControl.Openble[11] = btmac[2];
RS485_TxControl.Openble[12] = btmac[3];
RS485_TxControl.Openble[13] = btmac[4];
RS485_TxControl.Openble[14] = btmac[5];
RS485_TxControl.Openble[15] = 0x4B;
RS485_TxControl.Openble[16] = 0x4A;
UART_Ch2_Send_Multiple_Byte(RS485_TxControl.Openble,sizeof(RS485_TxControl.Openble));
} }
RS485_TxControl.Openble[0] = 0x59;
RS485_TxControl.Openble[1] = 0x44;
RS485_TxControl.Openble[2] = 0xA;
RS485_TxControl.Openble[3] = 0x8A;
RS485_TxControl.Openble[4] = 0xA;
RS485_TxControl.Openble[5] = 0xA;
RS485_TxControl.Openble[6] = name2;
RS485_TxControl.Openble[7] = name1;
RS485_TxControl.Openble[8] = BlueTooth;
RS485_TxControl.Openble[9] = btmac[0];
RS485_TxControl.Openble[10] = btmac[1];
RS485_TxControl.Openble[11] = btmac[2];
RS485_TxControl.Openble[12] = btmac[3];
RS485_TxControl.Openble[13] = btmac[4];
RS485_TxControl.Openble[14] = btmac[5];
RS485_TxControl.Openble[15] = 0x4B;
RS485_TxControl.Openble[16] = 0x4A;
UART_Ch2_Send_Multiple_Byte(RS485_TxControl.Openble,sizeof(RS485_TxControl.Openble));
sendfinishflag = R485_Send_0x80(); sendfinishflag = R485_Send_0x80();
if(sendfinishflag == 0) if(sendfinishflag == 0)
{ {
...@@ -604,6 +586,11 @@ void backsend(void) ...@@ -604,6 +586,11 @@ void backsend(void)
{ {
backtime = 1; backtime = 1;
} }
if(zhenduanflag == 1)
{
backtime = 10;
}
if(RS485_send_time>=backtime) if(RS485_send_time>=backtime)
{ {
RS485_send_time = 0; RS485_send_time = 0;
......
...@@ -67,6 +67,8 @@ typedef struct ...@@ -67,6 +67,8 @@ typedef struct
} RS485ValidDataPacket_st_t; } RS485ValidDataPacket_st_t;
extern uint32_t RS485_send_time; extern uint32_t RS485_send_time;
extern uint8_t RS485_TX_finish; extern uint8_t RS485_TX_finish;
extern uint8_t BlueTooth;
extern uint8_t dianliangflag;
// extern uint32_t RS485_send_num; // extern uint32_t RS485_send_num;
extern uint32_t sendnum; extern uint32_t sendnum;
extern uint8_t sendmsgAll[8]; extern uint8_t sendmsgAll[8];
......
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