Commit 52881119 authored by 何锐's avatar 何锐

feat:更新4.3寸检测台

parents 27406b02 8d358d96
......@@ -57,6 +57,7 @@
"C_Cpp_Runner.useLinkTimeOptimization": false,
"C_Cpp_Runner.msvcSecureNoWarnings": false,
"files.associations": {
"string.h": "c"
"string.h": "c",
"can_communication_matrix.h": "c"
}
}
\ No newline at end of file
......@@ -68,6 +68,63 @@ uint8_t recvflag111 = 0;
uint8_t xierucishu = 0;
uint8_t waittimer;
uint8_t saomafinish;
uint8_t Autoheadlightstatustime;
uint8_t Autoheadlightstatuslast;
uint8_t RampStopSettime;
uint8_t RampStopSetlast;
uint8_t TCSSettime;
uint8_t TCSSetlast;
uint8_t Sendcontinuouslytime;
uint8_t Sendcontinuouslylast;
uint8_t steepslopetime;
uint8_t steepslopelast;
void ProcessVehicleStatus(void)
{
typedef struct {
uint8_t currentValue;
uint8_t* lastValue;
uint8_t* counter;
uint8_t* flag;
} StatusCheck_t;
StatusCheck_t statusChecks[] = {
{R485_IDD4h.Sig.SideStaySenseSetInstructTX, &Sendcontinuouslylast, &Sendcontinuouslytime, &SideStayflag},
{R485_IDD4h.Sig.SlopeDropSetInstructTX, &steepslopelast, &steepslopetime, &SlopeDescentflag},
{R485_IDD4h.Sig.RampStopSetInstructTX, &RampStopSetlast, &RampStopSettime, &RampParkflag},
{R485_IDD4h.Sig.TCSSetInstructTX, &TCSSetlast, &TCSSettime, &TCSflag},
{R485_IDD4h.Sig.Autoheadlightstatus, &Autoheadlightstatuslast, &Autoheadlightstatustime, &Autoheadlightflag}
};
for (int i = 0; i < sizeof(statusChecks)/sizeof(statusChecks[0]); i++)
{
StatusCheck_t check = statusChecks[i];
if (check.currentValue == 1 || check.currentValue == 0)
{
if(*check.lastValue == check.currentValue)
{
(*check.counter)++;
}
else
{
if(*check.counter == 1)
{
*check.counter = 1;
}
*check.counter = 1;
*check.lastValue = check.currentValue;
}
}
if (*check.counter >= 3)
{
*check.counter = 0;
*check.flag = (*check.lastValue == 1) ? 1 : 0;
}
}
}
void datacheck(void)
{
uint16_t checksum = 0;
......@@ -91,6 +148,11 @@ void datacheck(void)
}
switch (BarCode[2]) //ID
{
case 0xD4:
memcpy(R485_IDD4h.Msg,RS485_data,RS485_RX_ID0XD4_DATA_LEN);
ProcessVehicleStatus();
break;
case 0xB4:
memcpy(R485_IDB4h.Msg,RS485_data,RS485_RX_ID0XB4_DATA_LEN);
checksum = Yadi_CAL_Data_Sum(&BarCode[2], 64 + 2);
......@@ -98,6 +160,8 @@ void datacheck(void)
{
;
}
break;
case 0x81: //81接收mac地址
{
if((BarCode[72] == 0x4A) && (BarCode[71] == 0x4B))
......@@ -113,8 +177,8 @@ void datacheck(void)
blename[2] = RS485_data[8];
blename[3] = RS485_data[9];
blename[4] = 0xff;
lightnumber = (RS485_data[11]<<8)+RS485_data[10];
writeflag = RS485_data[12];
lightnumber = (RS485_data[12]<<8)+RS485_data[11];
writeflag = RS485_data[13];
}
// General_Number_Disp(blename, 3, 165);
......@@ -240,47 +304,47 @@ void datacheck(void)
{
if(BarCode[5] == 0x50 && BarCode[6] == 0x3)
{
zhenduansendStep++;
zhenduansendStep = 3;
RS485_TX_finish = 0;
}
}
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;
}
}
// 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
{
;
}
}
// 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
// {
// ;
// }
// }
break;
case 3:
if(BarCode[2] == 0x14)
if(BarCode[2] == 0x14) //写码
{
if((BarCode[5] == 0x6E) && (BarCode[6] == 0x50) && (BarCode[7] == 0))
{
......@@ -289,7 +353,7 @@ void datacheck(void)
saomafinish = 1;
waittimer = 0;
}
if(BarCode[5] == 0x7F && BarCode[6] == 0x2E && BarCode[7] == 0x78 )
if(BarCode[5] == 0x7F && BarCode[6] == 0x2E && BarCode[7] == 0x78 ) //等待后重发10 03
{
if(waittimer >= 2)
{
......@@ -302,8 +366,9 @@ void datacheck(void)
waittimer++;
}
}
if(BarCode[5] == 0x7F && BarCode[6] == 0x2E && BarCode[7] == 0x31 )
if(BarCode[5] == 0x7F && BarCode[6] == 0x2E && BarCode[7] == 0x31 ) //写入内容不对
{
zhenduansendStep = 0;
RS485_TX_finish = 0;
}
}
......@@ -313,7 +378,7 @@ void datacheck(void)
}
break;
case 5:
if(BarCode[0] == 0x59 && BarCode[1] == 0x44)
if(BarCode[0] == 0x59 && BarCode[1] == 0x44) //扫码
{
if(((BarCode[arraynum]) == 0x4A) && ((BarCode[arraynum-1]) == 0x4B))
{
......@@ -337,33 +402,40 @@ void datacheck(void)
}
else if(zhenduanflag == Data_Mode_Read)
{
// 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;
// }
// }
// }
if(saomafinish!= 3)
{
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[5] == 0x50 && BarCode[6] == 0x03)
{
zhenduansendStep = 4;
}
else if(BarCode[5] == 0x62 && BarCode[6] == 0x50 && BarCode[7] == 0)
{
memcpy(mimaread,BarCode+8,34 );
saomafinish = 2;
}
else
{
zhenduansendStep = 0;
}
}
}
}
}
}
uint8_t cmpresult = 3;
void BarCodeDataGet(void)
{
if((mDataBufPtr1[0] == 0x59) && (mDataBufPtr1[1] == 0x59)&&(mDataBufPtr1[39] != 0x0))
{
memcpy(barcode_Msg,&mDataBufPtr1[6],34);
......
......@@ -71,6 +71,8 @@ void Function_Check_Ctrl(uint32_t cmd);
void MENU_CHECK_STEP_ADD(void)
{
// if(jiaoyan == 1)
// {
MENU_CHECK_STEP++;
if(MENU_CHECK_STEP > 14)
......@@ -81,6 +83,12 @@ void MENU_CHECK_STEP_ADD(void)
// {
// MENU_CHECK_STEP = 3;
// }
if(CurrentWrong == 1)
{
MENU_CHECK_STEP = 1;
}
// }
}
void MENU_CHECK_STEP_SUB(void)
{
......@@ -224,6 +232,8 @@ 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;
uint8_t blnamedisplay[4];
uint8_t blenamedisplay[5];
void Total_Check(void)
{
......@@ -272,6 +282,15 @@ uint8_t yibiaoshuju[34];
}
else if(saomafinish == 1)
{
for(int i = 0;i<34;i++)
{
if(barcode_Msg[i] != erweima[i])
{
Display_TFT_Clear();
break;
}
}
memcpy(erweima,barcode_Msg,34);
erweima[34] = 0xFF;
General_Number_Disp(erweima, 3, 60);
......@@ -381,10 +400,30 @@ uint8_t yibiaoshuju[34];
blename[4] = 0xFF;
GUI_Display_Version_Code_Service(3, 150, "BT Name is ", Letter_Num_11, PCodeText_Space_size);
if(((blename[0]+blename[1]+blename[2]+blename[3]) != 0) && (blename[0] != 0xFF) && (blename[1] != 0xFF)&& (blename[2] != 0xFF)&& (blename[3] != 0xFF))
blnamedisplay[0] = name2 / 16;
blnamedisplay[1] = name2 % 16;
blnamedisplay[2] = name1 / 16;
blnamedisplay[3] = name1 % 16;
for(int i = 0; i<4; i++)
{
if(blnamedisplay[i] >= 10)
{
General_Number_Disp(blename, 110, 154);
blnamedisplay[i] += 55;
}
}
blenamedisplay[0] = blnamedisplay[0];
blenamedisplay[1] = blnamedisplay[1];
blenamedisplay[2] = blnamedisplay[2];
blenamedisplay[3] = blnamedisplay[3];
blenamedisplay[4] = 0xFF;
if(blnamedisplay[0]+blnamedisplay[1]+blnamedisplay[2]+blnamedisplay[3] != 0)
{
General_Number_Disp(blenamedisplay, 110, 154);
}
// }
// recvflag111 = 0;
// }
// POWER_CTRL_KL30 = 0u; //B+
......@@ -395,10 +434,10 @@ uint8_t yibiaoshuju[34];
// Display_Version_Info(0);
// Display_Set_Buff();
// // Function_Check_Ctrl(1); //Excel表格发报文。硬线信号
Function_Check_Ctrl(1); //Excel表格发报文。硬线信号
// //FUEL_UDS__Display(3);
// Buzzer_Warning();
// break;
break;
// case 4:
......@@ -628,7 +667,7 @@ uint8_t delaytime = 0;
uint8_t delayresult = 0;
uint8_t TimeDelay_3s(void)
{
if(MENU_CHECK_STEP == 14) //光感步骤
if(MENU_CHECK_STEP == 6) //光感步骤
{
if(delaytime <= 30)
{
......@@ -694,7 +733,10 @@ void Function_Check_Ctrl(uint32_t cmd)
}
General_Number_Disp(p, 190, 10);//刷图:报文检测步数
}
if(BlueTooth == 0)
{
Display_Send_Vspead(MENU_CHECK_STEP);
}
switch (MENU_CHECK_STEP)
{
case 0:
......@@ -703,12 +745,9 @@ void Function_Check_Ctrl(uint32_t cmd)
{
LINE_OUT_NEG_01 = 1;
LINE_OUT_NEG_04 = 1;
}
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
name1= (devicename) & 0xFF;
name2 = (devicename >> 8) & 0xFF;
}
RightturnSignal = 0;
LeftturnSignal = 0;
......@@ -725,9 +764,9 @@ void Function_Check_Ctrl(uint32_t cmd)
{
LINE_OUT_NEG_01 = 0;
LINE_OUT_NEG_04 = 0;
}
LINE_OUT_NEG_02 = 0;
LINE_OUT_NEG_03 = 1;
}
RightturnSignal = 0;
LeftturnSignal = 0;
......@@ -743,9 +782,9 @@ void Function_Check_Ctrl(uint32_t cmd)
{
LINE_OUT_NEG_01 = 1;
LINE_OUT_NEG_04 = 1;
}
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
}
RightturnSignal = 1;
LeftturnSignal = 0;
......@@ -759,42 +798,77 @@ void Function_Check_Ctrl(uint32_t cmd)
{
RightturnSignal = 0;
LeftturnSignal = 1;
Bluetoothlight = 0;
Bluetoothlight = 1;
Positionlight = 0;
highbeam = 0;
highbeam = 1;
Lowbeam = 0;
break;
}
case 4:
{
RightturnSignal = 0;
LeftturnSignal = 0;
Bluetoothlight = 0;
LeftturnSignal = 1;
Bluetoothlight = 1;
Positionlight = 0;
highbeam = 0;
Lowbeam = 1;
highbeam = 1;
Lowbeam = 0;
break;
}
case 5:
{
RightturnSignal = 1;
LeftturnSignal = 1;
if(Auto_ONOFF == 0)
{
LINE_OUT_NEG_01 = 1;
LINE_OUT_NEG_04 = 1;
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
}
RightturnSignal = 0;
LeftturnSignal = 0;
Bluetoothlight = 0;
Positionlight = 0;
Positionlight = 1;
highbeam = 0;
Lowbeam = 0;
Lowbeam = 1;
break;
}
case 6:
{
//密码认证
if(KeyStep == 3)
{
if(Auto_ONOFF == 0)
{
LINE_OUT_NEG_01 = 1;
LINE_OUT_NEG_04 = 1;
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
}
}
else
{
if(TimeDelay_3s() == 0)
{
if(Auto_ONOFF == 0)
{
LINE_OUT_NEG_01 = 0;
LINE_OUT_NEG_04 = 0;
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
}
}
else
{
if(Auto_ONOFF == 0)
{
LINE_OUT_NEG_01 = 0;
LINE_OUT_NEG_04 = 1;
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
}
}
}
RightturnSignal = 0;
LeftturnSignal = 0;
......@@ -806,78 +880,32 @@ void Function_Check_Ctrl(uint32_t cmd)
}
case 7:
{
if(Auto_ONOFF == 0)
{
LINE_OUT_NEG_01 = 0;
LINE_OUT_NEG_04 = 0;
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
}
RightturnSignal = 0;
LeftturnSignal = 0;
Bluetoothlight = 0;
Bluetoothlight = 1;
Positionlight = 0;
highbeam = 0;
Lowbeam = 0;
break;
}
// case 8:
// {
// if(Auto_ONOFF == 0)
// {
// LINE_OUT_NEG_01 = 1;
// LINE_OUT_NEG_04 = 1;
// }
// LINE_OUT_NEG_02 = 1;
// LINE_OUT_NEG_03 = 1;
// RightturnSignal = 0;
// LeftturnSignal = 0;
// Bluetoothlight = 0;
// Positionlight = 0;
// highbeam = 0;
// Lowbeam = 0;
// break;
// }
case 8:
{
// LED3 = 0;
// LINE_OUT_NEG_05 = 1;
// LINE_jinguang = 0;
// LED4 = 0;
// POWER_CTRL_KL30_Current = 0;
// POWER_CTRL_KL30 = 0;
Lowbeam = 0;
LeftturnSignal = 0;
highbeam = 0;
RightturnSignal = 0;
Bluetoothlight = 0;
break;
}
case 9:
if(Auto_ONOFF == 0)
{
// LED3 = 1;
// LED4 = 1;
// LINE_OUT_NEG_05 = 0;
// LINE_jinguang = 1;
// POWER_CTRL_KL30_Current = 1;
// POWER_CTRL_KL30 = 1;
Lowbeam = 0;
LeftturnSignal = 0;
highbeam = 0;
RightturnSignal = 0;
Bluetoothlight = 0;
break;
LINE_OUT_NEG_01 = 1;
LINE_OUT_NEG_04 = 1;
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
}
case 10:
{
// if(Auto_ONOFF == 0)
// {
// LINE_OUT_NEG_01 = 1;
// LINE_OUT_NEG_04 = 1;
// }
// LINE_OUT_NEG_02 = 1;
// LINE_OUT_NEG_03 = 1;
// LED3 = 1;
// LED4 = 1;
// LINE_OUT_NEG_05 = 0;
// LINE_jinguang = 1;
// POWER_CTRL_KL30 = 1;
// POWER_CTRL_KL30_Current = 1;
Lowbeam = 0;
LeftturnSignal = 0;
highbeam = 0;
......@@ -885,42 +913,80 @@ void Function_Check_Ctrl(uint32_t cmd)
Bluetoothlight = 0;
break;
}
case 11: //下电蓝牙外屏
{
// POWER_CTRL_KL30_Current = 1;
// if(Auto_ONOFF == 0)
// case 9:
// {
// LINE_OUT_NEG_01 = 0;
// // LED3 = 1;
// // LED4 = 1;
// // LINE_OUT_NEG_05 = 0;
// // LINE_jinguang = 1;
// // POWER_CTRL_KL30_Current = 1;
// // POWER_CTRL_KL30 = 1;
// Lowbeam = 0;
// LeftturnSignal = 0;
// highbeam = 0;
// RightturnSignal = 0;
// Bluetoothlight = 0;
// break;
// }
// LINE_OUT_NEG_02 = 0;
// LINE_OUT_NEG_03 = 1;
// LINE_OUT_NEG_04 = 0;
// case 10:
// {
// // if(Auto_ONOFF == 0)
// // {
// // LINE_OUT_NEG_01 = 1;
// // LINE_OUT_NEG_04 = 1;
// // }
// // LINE_OUT_NEG_02 = 1;
// // LINE_OUT_NEG_03 = 1;
// // LED3 = 1;
// // LED4 = 1;
// // LINE_OUT_NEG_05 = 0;
// // LINE_jinguang = 1;
// // POWER_CTRL_KL30 = 1;
// // POWER_CTRL_KL30_Current = 1;
// Lowbeam = 0;
// LeftturnSignal = 0;
// highbeam = 0;
// RightturnSignal = 0;
// Bluetoothlight = 0;
// break;
// }
// case 11: //下电蓝牙外屏
// {
// // POWER_CTRL_KL30_Current = 1;
// // if(Auto_ONOFF == 0)
// // {
// // LINE_OUT_NEG_01 = 0;
// // }
// // LINE_OUT_NEG_02 = 0;
// // LINE_OUT_NEG_03 = 1;
// // LINE_OUT_NEG_04 = 0;
Lowbeam = 0;
LeftturnSignal = 0;
highbeam = 0;
RightturnSignal = 0;
Bluetoothlight = 0;
break;
}
case 12:
{
Lowbeam = 0;
LeftturnSignal = 0;
highbeam = 0;
RightturnSignal = 0;
Bluetoothlight = 0;
break;
}
case 13:
// Lowbeam = 0;
// LeftturnSignal = 0;
// highbeam = 0;
// RightturnSignal = 0;
// Bluetoothlight = 0;
// break;
// }
// case 12:
// {
// Lowbeam = 0;
// LeftturnSignal = 0;
// highbeam = 0;
// RightturnSignal = 0;
// Bluetoothlight = 0;
// break;
// }
case 9:
{
if(Auto_ONOFF == 0)
{
LINE_OUT_NEG_01 = 1;
LINE_OUT_NEG_04 = 1;
}
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
}
RightturnSignal = 1;
LeftturnSignal = 1;
......@@ -930,50 +996,15 @@ void Function_Check_Ctrl(uint32_t cmd)
Lowbeam = 1;
break;
}
case 14:
{
//密码认证
if(KeyStep == 3)
{
if(Auto_ONOFF == 0)
{
LINE_OUT_NEG_01 = 1;
LINE_OUT_NEG_04 = 1;
}
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
}
else
{
if(TimeDelay_3s() == 0)
{
if(Auto_ONOFF == 0)
{
LINE_OUT_NEG_01 = 0;
LINE_OUT_NEG_04 = 0;
}
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
}
else
{
if(Auto_ONOFF == 0)
{
LINE_OUT_NEG_01 = 0;
LINE_OUT_NEG_04 = 1;
}
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
}
}
Lowbeam = 0;
LeftturnSignal = 0;
highbeam = 0;
RightturnSignal = 0;
Bluetoothlight = 1;
break;
}
// case 14:
// {
// Lowbeam = 0;
// LeftturnSignal = 0;
// highbeam = 0;
// RightturnSignal = 0;
// Bluetoothlight = 1;
// break;
// }
// case 15: //全上电连蓝牙
// {
// LINE_OUT_NEG_05 = 0;
......
......@@ -46,6 +46,7 @@ extern unsigned int CAN_Msg_Tx_Enable;
extern uint8_t loc_Type_back;
extern uint8_t LED_Waring ;
extern uint8_t writefail[5];
extern uint8_t erweima[64] ;;
void SET_IPK_NONE(void);
void Clear_IPK_NONE(void);
void CHECK_IPK_COUNT(void);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -94,9 +94,12 @@ extern const uint8_t *Num_30[];
extern const uint8_t * Letter_Num_11[];
extern uint32_t loc_Current_0;
extern uint8_t menumondel;
extern void Get_static_Current(void);
extern uint32_t Get_Display_Type(void);
extern uint8_t guangganflag;
extern uint8_t CurrentWrong;
extern uint8_t jiaoyan;
extern const uint8_t *Num_15[];
#define PCodeText_Space_size 2//故障文字 英文空格的像素数
#endif
......@@ -15,9 +15,15 @@ void Key_Operation_SW5(Key_Event_en_t enKeyEvent) //下一步
{
if(saomafinish == 3)
{
MENU_CHECK_STEP_ADD( );
zhenduansendStep = 0;
zhenduanflag = Data_Mode_Dot;
memset(erweima, 0, 64);
memset(barcode_Msg, 0, 64);
saomafinish = 4;
}
else if(saomafinish == 4)
{
MENU_CHECK_STEP_ADD( );
}
}
}
......@@ -78,6 +84,13 @@ void Key_Operation_SW7(Key_Event_en_t enKeyEvent)
if(firstpowerflag == 2)
{
if(zhenduanflag == Data_Mode_Write)
{
if(saomafinish == 1)
{
zhenduansendStep = 5;
}
}
else if(((zhenduansendStep == 4) && (zhenduanflag == Data_Mode_Read)))
{
zhenduansendStep = 5;
}
......@@ -98,6 +111,8 @@ void Key_Operation_SW8(Key_Event_en_t enKeyEvent)
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{
zhenduanflag = Data_Mode_Write;
zhenduansendStep = 0;
saomafinish = 0;
}
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
{
......@@ -210,7 +225,15 @@ void Key_Operation_SW6(Key_Event_en_t enKeyEvent)
}
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
{
if(menumondel == 0)
{
menumondel = 1;
Display_TFT_Clear();
}
else
{
menumondel = 0;
}
}
else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS )
{
......@@ -298,7 +321,7 @@ void confirmkeyserve(void)
uint8_t KeyStep = 0;
void PasswordUnlock(void)
{
if(MENU_CHECK_STEP == 14)
if(MENU_CHECK_STEP == 6)
{
if(KeyStep == 0)
{
......@@ -319,7 +342,12 @@ void PasswordUnlock(void)
if(Confirmkeyflag)
{
KeyStep = 3;
Display_TFT_Clear();
}
}
else
{
;
}
}
else
......@@ -457,6 +485,8 @@ void Key_Operation_SW10(Key_Event_en_t enKeyEvent)
if(BlueTooth == 0)
{
BlueTooth = 1;
name1 = (devicename) & 0xFF;
name2 = (devicename >> 8) & 0xFF;
}
else
{
......
......@@ -2,6 +2,7 @@
#include "Barcode_Scanner.h"
#include "string.h"
#include "Key.h"
#include "Display_Info.h"
uint8_t barcode_Msg[64];
uint8_t barcode_Msg1[64];
uint8_t name1 = 0;
......@@ -42,8 +43,6 @@ uint32_t R485_Send_0xD0(void)
R485_IDD0h.Sig.IOT_RealTime_Hour = 0x16;
R485_IDD0h.Sig.IOT_RealTime_Minute = 0x16;
R485_IDD0h.Sig.IOT_RealTime_Second = 0x00; //时分秒
R485_IDD0h.Sig.GPS_State = 0; //GPS
R485_IDD0h.Sig.GSM_State = 0; //GSM
break;
case 4:
......@@ -53,8 +52,6 @@ uint32_t R485_Send_0xD0(void)
R485_IDD0h.Sig.EstimateRemainingMileage_L = 0x10;
R485_IDD0h.Sig.EstimateRemainingMileage_H = 0x27; //续航里程
R485_IDD0h.Sig.GPS_State = 0;
R485_IDD0h.Sig.GSM_State = 0;
break;
case 5:
......@@ -81,14 +78,6 @@ uint32_t R485_Send_0xD0(void)
R485_IDD0h.Sig.GSM_State = 0;
break;
// case 8:
// R485_IDD0h.Sig.IOT_RealTime_Hour = 0x11;
// R485_IDD0h.Sig.IOT_RealTime_Minute = 0x07;
// R485_IDD0h.Sig.IOT_RealTime_Second = 0x00; //时分秒
// R485_IDD0h.Sig.GPS_State = 0;
// R485_IDD0h.Sig.GSM_State = 0;
// break;
case 8:
R485_IDD0h.Sig.IOT_RealTime_Hour = 0x12;
R485_IDD0h.Sig.IOT_RealTime_Minute = 0x08;
......@@ -131,6 +120,7 @@ uint32_t R485_Send_0xD1(void)
{
case 0:
R485_IDD1h.Sig.MainBatteryQuantity = 0x00; //电量
R485_IDD1h.Sig.BatteryChargingStatus = 0x01; //充电枪
break;
case 1:
......@@ -138,12 +128,12 @@ uint32_t R485_Send_0xD1(void)
break;
case 2:
R485_IDD1h.Sig.MainBatteryQuantity = 0x14; //电量
R485_IDD1h.Sig.MainBatteryQuantity = 0x02; //电量
R485_IDD1h.Sig.BatteryChargingStatus = 0x01; //充电枪
break;
case 3:
R485_IDD1h.Sig.MainBatteryQuantity = 0x64; //电量
R485_IDD1h.Sig.MainBatteryQuantity = 0xC8; //电量
break;
case 4:
......@@ -173,11 +163,8 @@ uint32_t R485_Send_0xD1(void)
case 9:
R485_IDD1h.Sig.MainBatteryQuantity = 0x00; //电量
// R485_IDD1h.Sig.BatteryChargingStatus = 0x01; //充电枪
break;
case 13:
R485_IDD1h.Sig.BatteryChargingStatus = 0x01; //充电枪
break;
default:
R485_IDD1h.Sig.MainBatteryQuantity = 0x00; //电量
......@@ -196,6 +183,19 @@ uint32_t R485_Send_0xD1(void)
uint8_t RampParkedStatecounter = 0; //红色闪烁两次
uint8_t SideStayflag;
uint8_t TCSflag;
uint8_t SlopeDescentflag;
uint8_t RampParkflag;
uint8_t Autoheadlightflag;
void menuFeedbackinit(void)
{
SideStayflag = 0;
TCSflag = 0;
SlopeDescentflag = 0;
RampParkflag = 0;
Autoheadlightflag = 0;
}
uint32_t R485_Send_0xD2(void)
{
memset(R485_IDD2h.Msg, 0xFF, 36);
......@@ -205,6 +205,42 @@ uint32_t R485_Send_0xD2(void)
R485_IDD2h.Sig.BrakeSwitchFeedback = 0x00; //ready灯熄灭
if(SideStayflag == 0)
{
R485_IDD2h.Sig.SideStaySenseSetFeedback = 0x00; //菜单边撑感应功能设置反馈功能
}
else if(SideStayflag == 1)
{
R485_IDD2h.Sig.SideStaySenseSetFeedback = 0x01; //菜单边撑感应功能设置反馈功能
}
if(TCSflag == 0)
{
R485_IDD2h.Sig.TCSDefined = 0x00; //菜单TCS功能设置反馈功能
}
else if(TCSflag == 1)
{
R485_IDD2h.Sig.TCSDefined = 0x01; //菜单TCS功能设置反馈功能
}
if(SlopeDescentflag == 0)
{
R485_IDD2h.Sig.SlopeDescentFunctionStatus = 0x00; //菜单陡坡缓降功能设置反馈功能
}
else if(SlopeDescentflag == 1)
{
R485_IDD2h.Sig.SlopeDescentFunctionStatus = 0x01; //菜单陡坡缓降功能设置反馈功能
}
if(RampParkflag == 0)
{
R485_IDD2h.Sig.RampParkedSetFeedback = 0x00; //菜单边撑感应功能设置反馈功能
}
else if(RampParkflag == 1)
{
R485_IDD2h.Sig.RampParkedSetFeedback = 0x01; //菜单边撑感应功能设置反馈功能
}
if(clearOdoFlag == 0)
{
switch (MENU_CHECK_STEP)
......@@ -231,51 +267,82 @@ uint32_t R485_Send_0xD2(void)
break;
case 2:
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0x47;
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x00; //车速10
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0x00;
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x00; //车速00
R485_IDD2h.Sig.BusbarVoltage = 0x05;
R485_IDD2h.Sig.BusbarCurrent = 0x3A; //功率10%
R485_IDD2h.Sig.BusbarVoltage = 0x00;
R485_IDD2h.Sig.BusbarCurrent = 0x00; //功率00%
R485_IDD2h.Sig.ParkinFeedback = 0x00;
R485_IDD2h.Sig.SpeedGear = 0x01; //档位TTFAR
R485_IDD2h.Sig.MCUFaultStatus_HandlebarFault = 0x01; //故障灯
R485_IDD2h.Sig.ClaudicationPatternFeedback = 0x01; //龟速行驶
R485_IDD2h.Sig.TCSDefined = 0x01;
R485_IDD2h.Sig.TCSActivation = 0x02; //TCS
R485_IDD2h.Sig.SlopeDescentFunctionStatus = 0x01; //陡坡缓降
break;
case 3:
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0x6F;
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x01; //车速50
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0xDE;
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x02; //车速99
R485_IDD2h.Sig.BusbarVoltage = 0x05;
R485_IDD2h.Sig.BusbarCurrent = 0x5A; //功率50%
R485_IDD2h.Sig.BusbarVoltage = 0x0E;
R485_IDD2h.Sig.BusbarCurrent = 0xAA; //功率100%
R485_IDD2h.Sig.ParkinFeedback = 0x00;
R485_IDD2h.Sig.SpeedGear = 0x03; //档位SPORT
RampParkedStatecounter = 0;
// RampParkedStatecounter = 0;
R485_IDD2h.Sig.TCSDefined = 0x01;
R485_IDD2h.Sig.TCSActivation = 0x02; //TCS
R485_IDD2h.Sig.FaultCorrecting = 0x00; //修复模式
// R485_IDD2h.Sig.FaultCorrecting = 0x00; //修复模式
R485_IDD2h.Sig.CruiseModeFeedback = 0x01; //巡航灯
R485_IDD2h.Sig.SteepHillDescentEnable = 0x00;
R485_IDD2h.Sig.SlopeDescentFunctionStatus = 0x01; //陡坡缓降
R485_IDD2h.Sig.SteepHillDescentEnable = 0x00;
R485_IDD2h.Sig.ClaudicationPatternFeedback = 0x01; //龟速行驶
break;
case 4:
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0xb8;
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x01; //车速60
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0xDE;
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x02; //车速60
R485_IDD2h.Sig.BusbarVoltage = 0x05;
R485_IDD2h.Sig.BusbarCurrent = 0x82; //功率100%
R485_IDD2h.Sig.BusbarCurrent = 0xAA; //功率100%
R485_IDD2h.Sig.SpeedGear = 0x04; //不为free模式
R485_IDD2h.Sig.MCUFaultStatus_HandlebarFault = 0x01; //故障灯
R485_IDD2h.Sig.TCSUserDefined = 0x01;
R485_IDD2h.Sig.TCSActivation = 0x02; //TCS
R485_IDD2h.Sig.ClaudicationPatternFeedback = 0x01; //龟速行驶
R485_IDD2h.Sig.SlopeDescentFunctionStatus = 0x01; //陡坡缓降
RampParkedStatecounter = 0;
break;
case 5:
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0xDE;
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x02; //车速60
R485_IDD2h.Sig.BusbarVoltage = 0x0E;
R485_IDD2h.Sig.BusbarCurrent = 0xAA; //功率100%
R485_IDD2h.Sig.SpeedGear = 0x01; //不为free模式
R485_IDD2h.Sig.TPowerFeedback = 0x01; //T动力
if(RampParkedStatecounter < 10)
{
RampParkedStatecounter++;
......@@ -287,106 +354,81 @@ uint32_t R485_Send_0xD2(void)
}
break;
case 5:
case 6:
RampParkedStatecounter = 0;
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0xb8;
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x01; //车速60
R485_IDD2h.Sig.BusbarVoltage = 0x05;
R485_IDD2h.Sig.BusbarCurrent = 0x82; //功率100%
R485_IDD2h.Sig.SpeedGear = 0x01; //不为free模式
break;
case 6:
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0x4B;
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0xDE;
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x02; //车速80
R485_IDD2h.Sig.BusbarVoltage = 0x28;
R485_IDD2h.Sig.BusbarCurrent = 0x31; //电流为负
R485_IDD2h.Sig.BusbarVoltage = 0xC8;
R485_IDD2h.Sig.BusbarCurrent = 0x2F; //负50
R485_IDD2h.Sig.SpeedGear = 0x01; //不为free模式
R485_IDD2h.Sig.RecuperationStatusFeedback = 0x01; //能量回收功能设置反馈为1 //能量回收10格
R485_IDD2h.Sig.TPowerFeedback = 0x01; //T动力
break;
case 7:
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0xDE;
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x02; //车速99
R485_IDD2h.Sig.BusbarVoltage = 0xC8;
R485_IDD2h.Sig.BusbarCurrent = 0x31; //电流为负
R485_IDD2h.Sig.BusbarVoltage = 0x0E;
R485_IDD2h.Sig.BusbarCurrent = 0xAA; //功率100%
R485_IDD2h.Sig.SpeedGear = 0x01; //不为free模式
R485_IDD2h.Sig.RecuperationStatusFeedback = 0x01; //能量回收功能设置反馈为1 //能量回收50格
R485_IDD2h.Sig.ClaudicationPatternFeedback = 0x01; //龟速行驶
// R485_IDD2h.Sig.ClaudicationPatternFeedback = 0x01; //龟速行驶
break;
// case 8:
// R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0xDE;
// R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x02; //车速99
// R485_IDD2h.Sig.BusbarVoltage = 0xC8;
// R485_IDD2h.Sig.BusbarCurrent = 0x30; //电流为负
// R485_IDD2h.Sig.SpeedGear = 0x01; //不为free模式
// R485_IDD2h.Sig.RecuperationStatusFeedback = 0x01; //能量回收功能设置反馈为1 //能量回收100格
// // R485_IDD2h.Sig.MCUFaultStatus_HandlebarFault = 0x01; //整车故障等
// // R485_IDD2h.Sig.RampParkedState = 0x01; //坡道驻停状态(氛围灯红色闪烁两次)
// break;
case 8:
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0xDE;
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x02; //车速99
R485_IDD2h.Sig.SpeedGear = 0x01; //不为free模式
R485_IDD2h.Sig.BusbarVoltage = 0x05;
R485_IDD2h.Sig.BusbarCurrent = 0x82; //功率100%
R485_IDD2h.Sig.BusbarVoltage = 0x0E;
R485_IDD2h.Sig.BusbarCurrent = 0xAA; //功率100%
R485_IDD2h.Sig.RecuperationStatusFeedback = 0x01; //能量回收功能设置反馈为1 //能量回收100格
break;
case 9:
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0x00;
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x00; //车速00
// case 9:
// R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0x00;
// R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x00; //车速00
R485_IDD2h.Sig.ParkinFeedback = 0x00;
R485_IDD2h.Sig.SpeedGear = 0x00; //档位-助力推行
break;
// R485_IDD2h.Sig.ParkinFeedback = 0x00;
// R485_IDD2h.Sig.SpeedGear = 0x00; //档位-助力推行
// break;
case 10:
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0x00;
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x00; //车速00
// case 10:
// R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0x00;
// R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x00; //车速00
R485_IDD2h.Sig.SpeedGear = 0x04;
R485_IDD2h.Sig.ParkinFeedback = 0x01; //驻车挡位P档
break;
// R485_IDD2h.Sig.SpeedGear = 0x04;
// R485_IDD2h.Sig.ParkinFeedback = 0x01; //驻车挡位P档
// break;
case 11:
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0x00;
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x00; //车速00
// case 11:
// R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0x00;
// R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x00; //车速00
R485_IDD2h.Sig.SpeedGear = 0x04;
R485_IDD2h.Sig.ParkinFeedback = 0x00;
R485_IDD2h.Sig.ReverseModeFeedback = 0x01; //倒挡模式
break;
// R485_IDD2h.Sig.SpeedGear = 0x04;
// R485_IDD2h.Sig.ParkinFeedback = 0x00;
// R485_IDD2h.Sig.ReverseModeFeedback = 0x01; //倒挡模式
// break;
case 12:
R485_IDD2h.Sig.RampParkedState = 0x01; //坡道驻停
break;
// case 12:
// R485_IDD2h.Sig.RampParkedState = 0x01; //坡道驻停
// break;
case 13:
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0xDE;
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x02; //车速99
case 9:
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0x00;
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x00; //车速99
R485_IDD2h.Sig.BusbarVoltage = 0xC8;
R485_IDD2h.Sig.BusbarCurrent = 0x2F; //电流为负
R485_IDD2h.Sig.CruiseModeFeedback = 0x01; //巡航灯
......@@ -396,7 +438,7 @@ uint32_t R485_Send_0xD2(void)
R485_IDD2h.Sig.MCUFaultStatus_HandlebarFault = 0x01; //整车故障等
R485_IDD2h.Sig.ClaudicationPatternFeedback = 0x01; //龟速行驶
// R485_IDD2h.Sig.ClaudicationPatternFeedback = 0x01; //龟速行驶
R485_IDD2h.Sig.TCSDefined = 0x01;
R485_IDD2h.Sig.TCSActivation = 0x02; //TCS
......@@ -404,7 +446,7 @@ uint32_t R485_Send_0xD2(void)
R485_IDD2h.Sig.SlopeDescentFunctionStatus = 0x01;
R485_IDD2h.Sig.SteepHillDescentEnable = 0x00; //陡坡缓降
// R485_IDD2h.Sig.FaultCorrecting = 0x00; //修复模式
R485_IDD2h.Sig.ClaudicationPatternFeedback = 0x01; //龟速行驶
break;
default:
......@@ -438,8 +480,8 @@ uint32_t R485_Send_0xD2(void)
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_L = 0x78;
R485_IDD2h.Sig.ICMCalculatesVehicleSpeed_H = 0x56; //车速99
R485_IDD2h.Sig.BusbarVoltage = 0x05;
R485_IDD2h.Sig.BusbarCurrent = 0x82; //功率100%
R485_IDD2h.Sig.BusbarVoltage = 0x0E;
R485_IDD2h.Sig.BusbarCurrent = 0xAA; //功率100%
}
u32sendendflag = R485_Send(0xD2, R485_IDD2h.Msg, sizeof(R485_IDD2h.Msg));
......@@ -452,31 +494,50 @@ uint32_t R485_Send_0xD3(void)
memset(R485_IDD3h.Msg, 0xFF, 26);
uint32_t u32sendendflag = 0;
R485_IDD3h.Sig.AutoheadLightSetting = 0x00; //自动大灯
// R485_IDD3h.Sig.AutoheadLightSetting = 0x00; //自动大灯
R485_IDD3h.Sig.BlueToothPair = 0x00; //经典蓝牙配对指令
if(clearOdoFlag == 0)
{
// if(BlueTooth == 0)
// {
// R485_IDD3h.Sig.MacAddr1 = 0x00;
// R485_IDD3h.Sig.MacAddr2 = 0x00;
// }
// else
// {
R485_IDD3h.Sig.MacAddr1 = name1;//
R485_IDD3h.Sig.MacAddr2 = name2;
// }
R485_IDD3h.Sig.MacAddr3 = 0x20;
R485_IDD3h.Sig.MacAddr4 = 0x59;
R485_IDD3h.Sig.MacAddr5 = 0x28;
R485_IDD3h.Sig.MacAddr6 = 0xC1;
switch (MENU_CHECK_STEP)
{
case 2:
R485_IDD3h.Sig.AutoheadLightSetting = 0x00; //自动大灯
// R485_IDD3h.Sig.AutoheadLightSetting = 0x00; //自动大灯
R485_IDD3h.Sig.ElectronicCushionStatus = 0x01; //座桶开启灯
break;
case 3:
R485_IDD3h.Sig.AutoheadLightSetting = 0x00; //自动大灯
// R485_IDD3h.Sig.AutoheadLightSetting = 0x00; //自动大灯
R485_IDD3h.Sig.RemainingMileageDisSetting = 0; //续航里程
R485_IDD3h.Sig.SupportSwitchState = 0x01; //边撑状态
R485_IDD3h.Sig.ElectronicCushionStatus = 0x01; //座桶开启灯
break;
case 4:
R485_IDD3h.Sig.AutoheadLightSetting = 0x00; //自动大灯
// R485_IDD3h.Sig.AutoheadLightSetting = 0x00; //自动大灯
R485_IDD3h.Sig.RemainingMileageDisSetting = 1; //续航里程
R485_IDD3h.Sig.ElectronicCushionStatus = 0x01; //座桶开启灯
// R485_IDD3h.Sig.VehicleStatus = 0x00;
// R485_IDD3h.Sig.AlarmStatus = 0x01; //氛围灯红色(会线束故障挡住显示)
R485_IDD3h.Sig.SupportSwitchState = 0x01; //边撑状态
break;
case 5:
......@@ -484,53 +545,40 @@ uint32_t R485_Send_0xD3(void)
break;
case 6:
R485_IDD3h.Sig.AutoheadLightSetting = 0x01; //自动大灯
break;
// case 7:
// break;
// R485_IDD3h.Sig.AutoheadLightSetting = 0x01; //自动大灯
case 9:
break;
if(mimayanzhengjieguo == 1)
if(KeyStep == 3)
{
R485_IDD3h.Sig.PasswordAuthResult = 0x00; //密码认证结果
R485_IDD3h.Sig.PasswordUnlockCommand = 0x00; //密码解锁
}
else
{
R485_IDD3h.Sig.PasswordAuthResult = 0x03; //密码认证结果
R485_IDD3h.Sig.PasswordUnlockCommand = 0x01; //密码解锁
R485_IDD3h.Sig.PasswordCanbeEnter = 0x03;
}
break;
case 10:
R485_IDD3h.Sig.ElectronicCushionStatus = 0x01; //座桶开启灯
default:
R485_IDD3h.Sig.SupportSwitchState = 0x00; //边撑状态
R485_IDD3h.Sig.ElectronicCushionStatus = 0x00; //座桶开启灯
// R485_IDD3h.Sig.VehicleStatus = 0xFF;
// R485_IDD3h.Sig.AlarmStatus = 0xFF; //氛围灯颜色
// case 9:
// break;
R485_IDD3h.Sig.AutoheadLightSetting = 0x00; //自动大灯
break;
// case 10:
// R485_IDD3h.Sig.ElectronicCushionStatus = 0x01; //座桶开启灯
// break;
case 13:
case 9:
R485_IDD3h.Sig.SupportSwitchState = 0x01; //边撑状态
R485_IDD3h.Sig.AutoheadLightSetting = 0x01; //自动大灯
// R485_IDD3h.Sig.AutoheadLightSetting = 0x01; //自动大灯
R485_IDD3h.Sig.ElectronicCushionStatus = 0x01; //座桶开启灯
break;
case 14:
if(KeyStep == 3)
{
R485_IDD3h.Sig.PasswordUnlockCommand = 0x00; //密码解锁
}
else
{
R485_IDD3h.Sig.PasswordUnlockCommand = 0x01; //密码解锁
}
break;
default:
R485_IDD3h.Sig.SupportSwitchState = 0x00; //边撑状态
R485_IDD3h.Sig.ElectronicCushionStatus = 0x00; //座桶开启灯
// R485_IDD3h.Sig.AutoheadLightSetting = 0x00; //自动大灯
break;
}
}
......@@ -539,6 +587,10 @@ uint32_t R485_Send_0xD3(void)
R485_IDD3h.Sig.RemainingMileageDisSetting = 1; //续航里程
}
if(clearOdoFlag == 0)
{
}
u32sendendflag = R485_Send(0xD3, R485_IDD3h.Msg, sizeof(R485_IDD3h.Msg));
return u32sendendflag;
}
......@@ -585,16 +637,16 @@ uint32_t R485_Send_0x04(void)
R485_zhenduan_Msg[1] = 0x03;
break;
case 1:
R485_zhenduan_Msg[0] = 0x27;
R485_zhenduan_Msg[1] = 0x1;
// R485_zhenduan_Msg[0] = 0x27;
// R485_zhenduan_Msg[1] = 0x1;
break;
case 2:
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];
// 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;
......@@ -631,10 +683,29 @@ uint32_t R485_Send_0xA4(void)
R485_IDA4h.Sig.Invalid_characters = 0x01;
uint32_t u32sendendflag = 0;
if(menumondel == 0)
{
u32sendendflag = R485_Send(0xA4, R485_IDA4h.Msg, sizeof(R485_IDA4h.Msg));
}
else if(menumondel == 1)
{
u32sendendflag = R485_Send(0xC4, R485_IDA4h.Msg, sizeof(R485_IDA4h.Msg));
}
return u32sendendflag;
}
uint32_t R485_Send_0xC4(void) //菜单设置收发
{
memset(R485_IDC4h.Msg, 0xFF, 1);
R485_IDC4h.Sig.Invalid_characterssecond = 0x01;
uint32_t u32sendendflag = 0;
u32sendendflag = R485_Send(0xC4, R485_IDC4h.Msg, sizeof(R485_IDC4h.Msg));
return u32sendendflag;
}
uint32_t R485_Send_0x41(void)
{
/**************0.437*********** */
......
......@@ -12,14 +12,14 @@
#define RS485_RX_ID0XB2_DATA_LEN 76
#define RS485_RX_ID0XD2_DATA_LEN 36
#define RS485_RX_ID0XB3_DATA_LEN 89
#define RS485_RX_ID0XD3_DATA_LEN 26
#define RS485_RX_ID0XD3_DATA_LEN 59
#define RS485_RX_ID0XB6_DATA_LEN 86
#define RS485_RX_ID0XD6_DATA_LEN 111
#define RS485_RX_ID0XA4_DATA_LEN 1
#define RS485_RX_ID0XC4_DATA_LEN 4
#define RS485_RX_ID0XC4_DATA_LEN 1
#define RS485_RX_ID0XB4_DATA_LEN 75
#define RS485_RX_ID0XD4_DATA_LEN 14
#define RS485_RX_ID0XB4_DATA_LEN 77
#define RS485_RX_ID0XD4_DATA_LEN 17
typedef union
{
uint8_t Msg[64];
......@@ -1193,12 +1193,12 @@ typedef union __attribute__((packed))
uint8_t : 8; //标定固件次版本信息
uint8_t : 8; //标定固件主版本信息
uint8_t ESP32_APP_SV : 8; //系统固件次版本信息
uint8_t ESP32_APP_PV : 8; //系统固件主版本信息
uint8_t : 8; //应用固件次版本信息
uint8_t : 8; //应用固件主版本信息
uint8_t G031_APP_SV : 8; //从单片机固件次版本信息
uint8_t G031_APP_PV : 8; //从单片机固件主版本信息
uint8_t JL7926_APP_SV : 8; //系统固件次版本信息
uint8_t JL7926_APP_PV : 8; //系统固件主版本信息
uint8_t JL7106_APP_SV : 8; //应用固件次版本信息
uint8_t JL7106_APP_PV : 8; //应用固件主版本信息
uint8_t PY32F072_APP_SV : 8; //从单片机固件次版本信息
uint8_t PY32F072_APP_PV : 8; //从单片机固件主版本信息
uint8_t : 8; //GPS固件次版本信息
uint8_t : 8; //GPS固件主版本信息
uint8_t Picture_SV : 8; //图片次版本信息
......@@ -1207,6 +1207,8 @@ typedef union __attribute__((packed))
uint8_t Animation_PV : 8; //开机动画主版本信息
uint8_t Font_SV : 8; //字体库次版本信息
uint8_t Font_PV : 8; //字体库主版本信息
uint8_t u8WholeBagUpdateSWVMinor : 8; /*整包次版本号*/
uint8_t u8WholeBagUpdateSWVMajor : 8; /*整包主版本号*/
}Sig;
} _ID0XB4h_Data;
......@@ -1242,8 +1244,19 @@ typedef union __attribute__((packed))
uint8_t ABSOLStatus : 1; // ABS在线状态
uint8_t : 5;
uint8_t UserPasswordL : 8; // 用户输入密码值_L
uint8_t UserPasswordH : 8; // 用户输入密码值_H
uint16_t UserPassword :16; // 用户输入密码值
/*--byte14--*/
uint8_t : 8;
uint8_t SideStaySenseSetInstructTX :2; /*边撑感应功能设置指令*/
uint8_t SlopeDropSetInstructTX :2; /*陡坡缓降功能设置指令*/
uint8_t RampStopSetInstructTX :2; /*坡道驻停功能设置指令*/
uint8_t TCSSetInstructTX :2; /*TCS功能设置指令*/
uint8_t CushionSenseSetInstructTX :2; /*座垫感应功能设置指令*/
uint8_t :6;
}Sig;
} _ID0XD4h_Data;
......@@ -1261,6 +1274,15 @@ typedef union __attribute__((packed))
}Sig;
} _ID0XA4h_Data;
typedef union __attribute__((packed))
{
uint8_t Msg[RS485_RX_ID0XC4_DATA_LEN];
struct
{
uint8_t Invalid_characterssecond : 8;
}Sig;
} _ID0XC4h_Data;
typedef union __attribute__((packed))
{
uint8_t Msg[RS485_RX_ID0XD0_DATA_LEN];
......@@ -1553,7 +1575,7 @@ typedef union __attribute__((packed))
uint8_t : 4;
uint8_t : 2; // 推行模式反馈
uint8_t : 2;
uint8_t SideStaySenseSetFeedback: 2; /*边撑感应功能设置反馈*/
uint8_t : 2; /*30*/
uint8_t ReverseModeFeedback : 2; // 倒车模式反馈
......@@ -1575,7 +1597,7 @@ typedef union __attribute__((packed))
uint8_t SuperTPower : 2; // 超级T动力状态
uint8_t : 2;
uint8_t : 2;
uint8_t RampParkedSetFeedback: 2; /*坡道驻停功能设置反馈*/
uint8_t RampParkedState : 2; // 坡道驻停状态
uint8_t SlopeDescentFunctionStatus: 2; //陡坡缓降功能设置反馈
uint8_t SteepHillDescentEnable : 2; // 陡坡缓降激活
......@@ -1686,7 +1708,7 @@ typedef union __attribute__((packed))
uint8_t : 2; // 座垫加热等级设置反馈
uint8_t : 2; // 座垫感应开关状态反馈
uint8_t : 2;
uint8_t CushionSenseSetFeedback: 2; // 座垫感应功能设置反馈
uint8_t DumpCategory : 2; // 倾倒类别
uint8_t SupportSwitchState : 2; // 边撑开关状态
......@@ -1720,6 +1742,74 @@ typedef union __attribute__((packed))
uint8_t PasswordCanbeEnter : 3; // 密码可输入剩余次数
uint8_t BlueToothPair : 1; // 经典蓝牙配对指令
/*-----B26------*/
uint8_t MusicPlayModeCommand :3; /*音乐播放模式设置指令*/
uint8_t :2;
uint8_t :3;
uint8_t :8;
uint8_t :8;
uint8_t MacAddr1 :8;
uint8_t MacAddr2 :8;
uint8_t MacAddr3 :8;
uint8_t MacAddr4 :8;
uint8_t MacAddr5 :8;
uint8_t MacAddr6 :8;
uint8_t :8;
uint8_t :8;
uint8_t :3;
uint8_t CurrentAccountID :3; /*当前账户ID*/
uint8_t AccompanyMeHome :2; /*伴我回家功能激活状态*/
uint8_t :8;
uint8_t :8;
uint8_t :8;
uint8_t :8;
uint8_t :8;
uint8_t :8;
uint8_t :8;
uint8_t :8;
uint8_t SuddenBrakeFlash :2; /*急刹爆闪*/
uint8_t :6;
uint8_t :2;
uint8_t WifiStartUpCommand :3; /*wifi开启设置指令B47*/
uint8_t :3;
uint8_t :8;
uint8_t :8;
uint8_t :8;
uint8_t :8;
uint8_t :8;
uint8_t :8;
uint8_t :8;
uint8_t :8;
uint8_t :8;
uint8_t :2;
uint8_t ManualAdjBacklightSet :2; /*手动调节背光功能设置指令*/
uint8_t :4;
uint8_t BackLightValueSet :8; /*背光亮度值设置*/
}Sig;
} _ID0XD3h_Data;
......@@ -1847,6 +1937,7 @@ extern _ID0XD6h_Data R485_IDD6h;
extern _ID0XB4h_Data R485_IDB4h;
extern _ID0XD4h_Data R485_IDD4h;
extern _ID0XA4h_Data R485_IDA4h;
extern _ID0XC4h_Data R485_IDC4h;
extern uint8_t zhenduansendStep;
extern uint32_t R485_Send_0x40(void);
......@@ -1873,13 +1964,22 @@ extern uint32_t R485_Send_0xD1(void);
extern uint32_t R485_Send_0xD2(void);
extern uint32_t R485_Send_0xD3(void);
extern uint32_t R485_Send_0xA4(void);
extern uint32_t R485_Send_0xC4(void);
// extern uint32_t R485_Send_0x80(void);
extern uint32_t R485_Send_0x04(void);
extern void menuFeedbackinit(void);
extern uint8_t barcode_Msg[64];
extern uint8_t barcode_Msg1[64];
extern uint8_t name1;
extern uint8_t name2;
extern uint8_t R485_0x80_msg[64];
extern uint8_t SideStayflag;
extern uint8_t TCSflag;
extern uint8_t SlopeDescentflag;
extern uint8_t RampParkflag;
extern uint8_t Autoheadlightflag;
extern uint8_t mimayanzhengjieguo;
#endif
......@@ -37,6 +37,18 @@ void Sys_Run_Mode_Pseudo_Real_Time_Tasks(void)
}
TFT_LCD_Display_Update_Service( );
Fre_In_Service(FRE_VEHICLE);
if(UART_Ch0_Get_TX_Busy_Flag())
{
LINE_OUT_NEG_09 = 1; //发送
}
else
{
LINE_OUT_NEG_09 = 0; //接收
}
}
/*============================================================================*/
......@@ -71,6 +83,7 @@ void Sys_Run_Mode_10ms_Tasks_Group(void)
downkeyserve();
}
backsend();
TX_RX_485_service();
}
/*==============================================================================
......@@ -99,10 +112,14 @@ uint8_t flashtime = 0;
uint8_t showtime = 0;
uint8_t bleuarttime = 0;
uint8_t querendelay = 0;
void Sys_Run_Mode_100ms_Tasks_Group(void)
{
ProcessBluetoothDeviceNameWithLock();
AutoClearCounterAfterAllLit();
TimeDelay_3s();
PasswordUnlock();
BTEnableDelayPowerReset();
static uint32_t loc_timer = 0;
loc_timer++;
......@@ -231,7 +248,6 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
Total_Check();
firstpowerflag = 3;
}
}
else
{
......
......@@ -56,6 +56,7 @@ LineSta LineGetSta;
_ID0XB4h_Data R485_IDB4h;
_ID0XD4h_Data R485_IDD4h;
_ID0XA4h_Data R485_IDA4h;
_ID0XC4h_Data R485_IDC4h;
void R485_TX_Init(void)
{
......@@ -362,6 +363,105 @@ void Bluetoothname(void)
devicename = 0;
}
}
uint8_t BlueToothlock = 0;
/* 蓝牙名字设置函数 */
void ProcessBluetoothDeviceNameWithLock(void)
{
if(BlueTooth)
{
if(BlueToothlock == 0)
{
name1 = (devicename) & 0xFF;
name2 = (devicename >> 8) & 0xFF;
}
BlueToothlock = 1;
}
else
{
BlueToothlock = 0;
}
}
uint8_t clesrodoauto = 0;
uint8_t clesrodookauto = 0;
/* 全亮后自动清大计函数 */
void AutoClearCounterAfterAllLit(void)
{
if(MENU_CHECK_STEP == 9)
{
if(clesrodoauto >= 50)
{
clearOdoFlag = 1;
}
else
{
clesrodoauto++;
}
}
else
{
clesrodoauto = 0;
}
if(clearOdoFlag == 1)
{
if(clesrodookauto >= 160)
{
queren = 1;
}
else
{
clesrodookauto++;
}
}
else
{
clesrodookauto = 0;
}
}
uint8_t bluetoothdelaytime;
/* 蓝牙检测后切电 */
uint8_t BlueToothSwitch;
void BTEnableDelayPowerReset(void)
{
if((BlueTooth == 1) && (BlueToothSwitch != 1))
{
if(bluetoothdelaytime <= 120)
{
bluetoothdelaytime++;
}
else if(bluetoothdelaytime <= 125)
{
bluetoothdelaytime++;
Auto_ONOFF = 3;
LINE_OUT_NEG_01 = 0;
LINE_OUT_NEG_04 = 0;
LINE_OUT_NEG_02 = 0;
LINE_OUT_NEG_03 = 0;
}
else
{
Auto_ONOFF = 0;
BlueToothSwitch = 1;
bluetoothdelaytime = 0;
LINE_OUT_NEG_01 = 1;
LINE_OUT_NEG_04 = 1;
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
}
}
else if((BlueTooth == 0) && (BlueToothSwitch == 1))
{
BlueToothSwitch = 0;
bluetoothdelaytime = 0;
}
else
{
bluetoothdelaytime = 0;
}
}
uint32_t R485_Send(const uint16_t cmdID, const uint8_t* pData, uint8_t len)
{
uint8_t dataBuf[256];
......@@ -408,9 +508,26 @@ uint8_t RS485_User_Tx_Data(void)
switch (RS485_TxControl.sendIndex)
{
case RS485_Tx_IDA4_Idx:
if(MENU_CHECK_STEP == 0)
{
sendfinishflag = R485_Send_0xA4();
RS485_TX_finish = 1;
if(sendfinishflag == 0)
{
RS485_send_time = 0;
RS485_TxControl.sendIndex ++;
}
}
else
{
RS485_TxControl.sendIndex ++;
}
break;
// case RS485_Tx_IDC4_Idx:
// if(MENU_CHECK_STEP == 0)
// {
// sendfinishflag = R485_Send_0xA4();
// sendfinishflag = R485_Send_0xC4();
// RS485_TX_finish = 1;
// if(sendfinishflag == 0)
// {
......@@ -420,9 +537,10 @@ uint8_t RS485_User_Tx_Data(void)
// }
// else
// {
RS485_TxControl.sendIndex ++;
// RS485_TxControl.sendIndex ++;
// }
break;
// break;
case RS485_Tx_IDD0_Idx:
sendfinishflag = R485_Send_0xD0();
......@@ -470,31 +588,31 @@ uint8_t RS485_User_Tx_Data(void)
if(sendfinishflag == 0)
{
RS485_send_time = 0;
RS485_TxControl.sendIndex ++;
RS485_TxControl.sendIndex = 0;
}
break;
case RS485_Tx_ID80_Idx:
if(MENU_CHECK_STEP == 16)
if(MENU_CHECK_STEP == 8)
{
BlueTooth = 1;
}
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[2] = 0;
RS485_TxControl.Openble[3] = 0;
RS485_TxControl.Openble[4] = 0;
RS485_TxControl.Openble[5] = 0;
RS485_TxControl.Openble[6] = 0;
RS485_TxControl.Openble[7] = 0;
RS485_TxControl.Openble[8] = BlueToothSwitch;
RS485_TxControl.Openble[9] = 0xC1;
RS485_TxControl.Openble[10] = 0xA8;
RS485_TxControl.Openble[11] = 0x59;
RS485_TxControl.Openble[12] = 0x20;
RS485_TxControl.Openble[13] = name2;
RS485_TxControl.Openble[14] = name1;
RS485_TxControl.Openble[15] = 0x4B;
RS485_TxControl.Openble[16] = 0x4A;
UART_Ch2_Send_Multiple_Byte(RS485_TxControl.Openble,sizeof(RS485_TxControl.Openble));
......@@ -554,7 +672,6 @@ void TX_RX_485_service(void)
}
else
{
LINE_OUT_NEG_09 = 0;
Recv_Byte();
}
// }
......
......@@ -84,4 +84,7 @@ extern uint8_t RS485_User_Tx_Data(void);
void backsend(void);
extern void TX_RX_485_service(void);
extern void Bluetoothname(void);
extern void ProcessBluetoothDeviceNameWithLock(void);
extern void BTEnableDelayPowerReset(void);
extern void AutoClearCounterAfterAllLit(void);
#endif /* API_ADC_H_ */
......@@ -374,7 +374,7 @@ uint8_t UART_Ch3_Get_TX_Busy_Flag(void)
uint32_t UART_Ch0_Send_Multiple_Byte(uint8_t *Data, uint32_t Len)
{
uint32_t u32UARTResult = 1UL;
if ((UART_Ch1_Get_TX_Busy_Flag() == 0U) && (Len <= UART_30_SEND_MAX))
if ((UART_Ch0_Get_TX_Busy_Flag() == 0U) && (Len <= UART_30_SEND_MAX))
{
uint32_t i = 0UL;
stUARTCtr0.u32UARTCount = 1U;
......
......@@ -83,6 +83,7 @@ void Sys_Startup_Init(void)
Key_Init( );
Buzzer_Init();
Fre_In_KL30_Wakeup_Init();
menuFeedbackinit();
UART_Channel_Config_st_t loc_config;
loc_config.enUARTLINMode = MODE_UART;
loc_config.u32UARTbps = 115200;
......
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