Commit 52881119 authored by 何锐's avatar 何锐

feat:更新4.3寸检测台

parents 27406b02 8d358d96
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
"C_Cpp_Runner.useLinkTimeOptimization": false, "C_Cpp_Runner.useLinkTimeOptimization": false,
"C_Cpp_Runner.msvcSecureNoWarnings": false, "C_Cpp_Runner.msvcSecureNoWarnings": false,
"files.associations": { "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; ...@@ -68,6 +68,63 @@ uint8_t recvflag111 = 0;
uint8_t xierucishu = 0; uint8_t xierucishu = 0;
uint8_t waittimer; uint8_t waittimer;
uint8_t saomafinish; 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) void datacheck(void)
{ {
uint16_t checksum = 0; uint16_t checksum = 0;
...@@ -91,6 +148,11 @@ void datacheck(void) ...@@ -91,6 +148,11 @@ void datacheck(void)
} }
switch (BarCode[2]) //ID switch (BarCode[2]) //ID
{ {
case 0xD4:
memcpy(R485_IDD4h.Msg,RS485_data,RS485_RX_ID0XD4_DATA_LEN);
ProcessVehicleStatus();
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);
...@@ -98,6 +160,8 @@ void datacheck(void) ...@@ -98,6 +160,8 @@ void datacheck(void)
{ {
; ;
} }
break;
case 0x81: //81接收mac地址 case 0x81: //81接收mac地址
{ {
if((BarCode[72] == 0x4A) && (BarCode[71] == 0x4B)) if((BarCode[72] == 0x4A) && (BarCode[71] == 0x4B))
...@@ -113,8 +177,8 @@ void datacheck(void) ...@@ -113,8 +177,8 @@ void datacheck(void)
blename[2] = RS485_data[8]; blename[2] = RS485_data[8];
blename[3] = RS485_data[9]; blename[3] = RS485_data[9];
blename[4] = 0xff; blename[4] = 0xff;
lightnumber = (RS485_data[11]<<8)+RS485_data[10]; lightnumber = (RS485_data[12]<<8)+RS485_data[11];
writeflag = RS485_data[12]; writeflag = RS485_data[13];
} }
// General_Number_Disp(blename, 3, 165); // General_Number_Disp(blename, 3, 165);
...@@ -240,47 +304,47 @@ void datacheck(void) ...@@ -240,47 +304,47 @@ void datacheck(void)
{ {
if(BarCode[5] == 0x50 && BarCode[6] == 0x3) if(BarCode[5] == 0x50 && BarCode[6] == 0x3)
{ {
zhenduansendStep++; zhenduansendStep = 3;
RS485_TX_finish = 0; RS485_TX_finish = 0;
} }
} }
break; break;
case 1: case 1:
if(BarCode[2] == 0x14) // if(BarCode[2] == 0x14)
{ // {
if(BarCode[5] == 0x67 && BarCode[6] == 0x1) // if(BarCode[5] == 0x67 && BarCode[6] == 0x1)
{ // {
seed_value[0] = BarCode[7]; // seed_value[0] = BarCode[7];
seed_value[1] = BarCode[8]; // seed_value[1] = BarCode[8];
seed_value[2] = BarCode[9]; // seed_value[2] = BarCode[9];
seed_value[3] = BarCode[10]; // seed_value[3] = BarCode[10];
get_key(); // get_key();
zhenduansendStep++; // zhenduansendStep++;
RS485_TX_finish = 0; // RS485_TX_finish = 0;
} // }
} // }
break; break;
case 2: case 2:
if(BarCode[2] == 0x14) // if(BarCode[2] == 0x14)
{ // {
if(BarCode[5] == 0x67 && BarCode[6] == 0x2) // if(BarCode[5] == 0x67 && BarCode[6] == 0x2)
{ // {
zhenduansendStep++; // zhenduansendStep++;
RS485_TX_finish = 0; // RS485_TX_finish = 0;
} // }
else if(BarCode[5] != 0x67) // else if(BarCode[5] != 0x67)
{ // {
zhenduansendStep = 0; // zhenduansendStep = 0;
RS485_TX_finish = 0; // RS485_TX_finish = 0;
} // }
else // else
{ // {
; // ;
} // }
} // }
break; break;
case 3: case 3:
if(BarCode[2] == 0x14) if(BarCode[2] == 0x14) //写码
{ {
if((BarCode[5] == 0x6E) && (BarCode[6] == 0x50) && (BarCode[7] == 0)) if((BarCode[5] == 0x6E) && (BarCode[6] == 0x50) && (BarCode[7] == 0))
{ {
...@@ -289,7 +353,7 @@ void datacheck(void) ...@@ -289,7 +353,7 @@ void datacheck(void)
saomafinish = 1; saomafinish = 1;
waittimer = 0; 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) if(waittimer >= 2)
{ {
...@@ -302,8 +366,9 @@ void datacheck(void) ...@@ -302,8 +366,9 @@ void datacheck(void)
waittimer++; 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; RS485_TX_finish = 0;
} }
} }
...@@ -313,7 +378,7 @@ void datacheck(void) ...@@ -313,7 +378,7 @@ void datacheck(void)
} }
break; break;
case 5: 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))
{ {
...@@ -337,33 +402,40 @@ void datacheck(void) ...@@ -337,33 +402,40 @@ void datacheck(void)
} }
else if(zhenduanflag == Data_Mode_Read) else if(zhenduanflag == Data_Mode_Read)
{ {
// if(BarCode[0] == 0x59 && BarCode[1] == 0x44) if(saomafinish!= 3)
// { {
// for(int i = 0;i<255;i++) if(BarCode[0] == 0x59 && BarCode[1] == 0x44)
// { {
// if(BarCode[i] == 0x4A && BarCode[i - 1] == 0x4B) for(int i = 0;i<255;i++)
// { {
// arraynum = 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) if(((BarCode[arraynum]) == 0x4A) && ((BarCode[arraynum-1]) == 0x4B))
// { {
// memcpy(get_num_buf,BarCode+7,34 ); if(BarCode[5] == 0x50 && BarCode[6] == 0x03)
// comparestart = 1; {
// zhenduanflag = 3; 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; uint8_t cmpresult = 3;
void BarCodeDataGet(void) void BarCodeDataGet(void)
{ {
if((mDataBufPtr1[0] == 0x59) && (mDataBufPtr1[1] == 0x59)&&(mDataBufPtr1[39] != 0x0)) if((mDataBufPtr1[0] == 0x59) && (mDataBufPtr1[1] == 0x59)&&(mDataBufPtr1[39] != 0x0))
{ {
memcpy(barcode_Msg,&mDataBufPtr1[6],34); memcpy(barcode_Msg,&mDataBufPtr1[6],34);
......
...@@ -46,6 +46,7 @@ extern unsigned int CAN_Msg_Tx_Enable; ...@@ -46,6 +46,7 @@ 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]; extern uint8_t writefail[5];
extern uint8_t erweima[64] ;;
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);
......
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[]; ...@@ -94,9 +94,12 @@ extern const uint8_t *Num_30[];
extern const uint8_t * Letter_Num_11[]; extern const uint8_t * Letter_Num_11[];
extern uint32_t loc_Current_0; extern uint32_t loc_Current_0;
extern uint8_t menumondel;
extern void Get_static_Current(void); extern void Get_static_Current(void);
extern uint32_t Get_Display_Type(void); extern uint32_t Get_Display_Type(void);
extern uint8_t guangganflag; extern uint8_t guangganflag;
extern uint8_t CurrentWrong;
extern uint8_t jiaoyan;
extern const uint8_t *Num_15[]; extern const uint8_t *Num_15[];
#define PCodeText_Space_size 2//故障文字 英文空格的像素数 #define PCodeText_Space_size 2//故障文字 英文空格的像素数
#endif #endif
...@@ -14,10 +14,16 @@ void Key_Operation_SW5(Key_Event_en_t enKeyEvent) //下一步 ...@@ -14,10 +14,16 @@ void Key_Operation_SW5(Key_Event_en_t enKeyEvent) //下一步
if(firstpowerflag == 2) if(firstpowerflag == 2)
{ {
if(saomafinish == 3) if(saomafinish == 3)
{ {
MENU_CHECK_STEP_ADD( );
zhenduansendStep = 0; zhenduansendStep = 0;
zhenduanflag = Data_Mode_Dot; 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) ...@@ -78,6 +84,13 @@ void Key_Operation_SW7(Key_Event_en_t enKeyEvent)
if(firstpowerflag == 2) if(firstpowerflag == 2)
{ {
if(zhenduanflag == Data_Mode_Write) if(zhenduanflag == Data_Mode_Write)
{
if(saomafinish == 1)
{
zhenduansendStep = 5;
}
}
else if(((zhenduansendStep == 4) && (zhenduanflag == Data_Mode_Read)))
{ {
zhenduansendStep = 5; zhenduansendStep = 5;
} }
...@@ -98,6 +111,8 @@ void Key_Operation_SW8(Key_Event_en_t enKeyEvent) ...@@ -98,6 +111,8 @@ void Key_Operation_SW8(Key_Event_en_t enKeyEvent)
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS ) if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{ {
zhenduanflag = Data_Mode_Write; zhenduanflag = Data_Mode_Write;
zhenduansendStep = 0;
saomafinish = 0;
} }
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS ) else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
{ {
...@@ -210,7 +225,15 @@ void Key_Operation_SW6(Key_Event_en_t enKeyEvent) ...@@ -210,7 +225,15 @@ void Key_Operation_SW6(Key_Event_en_t enKeyEvent)
} }
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS ) 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 ) else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS )
{ {
...@@ -298,7 +321,7 @@ void confirmkeyserve(void) ...@@ -298,7 +321,7 @@ void confirmkeyserve(void)
uint8_t KeyStep = 0; uint8_t KeyStep = 0;
void PasswordUnlock(void) void PasswordUnlock(void)
{ {
if(MENU_CHECK_STEP == 14) if(MENU_CHECK_STEP == 6)
{ {
if(KeyStep == 0) if(KeyStep == 0)
{ {
...@@ -319,8 +342,13 @@ void PasswordUnlock(void) ...@@ -319,8 +342,13 @@ void PasswordUnlock(void)
if(Confirmkeyflag) if(Confirmkeyflag)
{ {
KeyStep = 3; KeyStep = 3;
Display_TFT_Clear();
} }
} }
else
{
;
}
} }
else else
{ {
...@@ -457,6 +485,8 @@ void Key_Operation_SW10(Key_Event_en_t enKeyEvent) ...@@ -457,6 +485,8 @@ void Key_Operation_SW10(Key_Event_en_t enKeyEvent)
if(BlueTooth == 0) if(BlueTooth == 0)
{ {
BlueTooth = 1; BlueTooth = 1;
name1 = (devicename) & 0xFF;
name2 = (devicename >> 8) & 0xFF;
} }
else else
{ {
......
...@@ -12,14 +12,14 @@ ...@@ -12,14 +12,14 @@
#define RS485_RX_ID0XB2_DATA_LEN 76 #define RS485_RX_ID0XB2_DATA_LEN 76
#define RS485_RX_ID0XD2_DATA_LEN 36 #define RS485_RX_ID0XD2_DATA_LEN 36
#define RS485_RX_ID0XB3_DATA_LEN 89 #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_ID0XB6_DATA_LEN 86
#define RS485_RX_ID0XD6_DATA_LEN 111 #define RS485_RX_ID0XD6_DATA_LEN 111
#define RS485_RX_ID0XA4_DATA_LEN 1 #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_ID0XB4_DATA_LEN 77
#define RS485_RX_ID0XD4_DATA_LEN 14 #define RS485_RX_ID0XD4_DATA_LEN 17
typedef union typedef union
{ {
uint8_t Msg[64]; uint8_t Msg[64];
...@@ -1193,12 +1193,12 @@ typedef union __attribute__((packed)) ...@@ -1193,12 +1193,12 @@ typedef union __attribute__((packed))
uint8_t : 8; //标定固件次版本信息 uint8_t : 8; //标定固件次版本信息
uint8_t : 8; //标定固件主版本信息 uint8_t : 8; //标定固件主版本信息
uint8_t ESP32_APP_SV : 8; //系统固件次版本信息 uint8_t JL7926_APP_SV : 8; //系统固件次版本信息
uint8_t ESP32_APP_PV : 8; //系统固件主版本信息 uint8_t JL7926_APP_PV : 8; //系统固件主版本信息
uint8_t : 8; //应用固件次版本信息 uint8_t JL7106_APP_SV : 8; //应用固件次版本信息
uint8_t : 8; //应用固件主版本信息 uint8_t JL7106_APP_PV : 8; //应用固件主版本信息
uint8_t G031_APP_SV : 8; //从单片机固件次版本信息 uint8_t PY32F072_APP_SV : 8; //从单片机固件次版本信息
uint8_t G031_APP_PV : 8; //从单片机固件主版本信息 uint8_t PY32F072_APP_PV : 8; //从单片机固件主版本信息
uint8_t : 8; //GPS固件次版本信息 uint8_t : 8; //GPS固件次版本信息
uint8_t : 8; //GPS固件主版本信息 uint8_t : 8; //GPS固件主版本信息
uint8_t Picture_SV : 8; //图片次版本信息 uint8_t Picture_SV : 8; //图片次版本信息
...@@ -1207,6 +1207,8 @@ typedef union __attribute__((packed)) ...@@ -1207,6 +1207,8 @@ typedef union __attribute__((packed))
uint8_t Animation_PV : 8; //开机动画主版本信息 uint8_t Animation_PV : 8; //开机动画主版本信息
uint8_t Font_SV : 8; //字体库次版本信息 uint8_t Font_SV : 8; //字体库次版本信息
uint8_t Font_PV : 8; //字体库主版本信息 uint8_t Font_PV : 8; //字体库主版本信息
uint8_t u8WholeBagUpdateSWVMinor : 8; /*整包次版本号*/
uint8_t u8WholeBagUpdateSWVMajor : 8; /*整包主版本号*/
}Sig; }Sig;
} _ID0XB4h_Data; } _ID0XB4h_Data;
...@@ -1242,8 +1244,19 @@ typedef union __attribute__((packed)) ...@@ -1242,8 +1244,19 @@ typedef union __attribute__((packed))
uint8_t ABSOLStatus : 1; // ABS在线状态 uint8_t ABSOLStatus : 1; // ABS在线状态
uint8_t : 5; uint8_t : 5;
uint8_t UserPasswordL : 8; // 用户输入密码值_L uint16_t UserPassword :16; // 用户输入密码值
uint8_t UserPasswordH : 8; // 用户输入密码值_H
/*--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; }Sig;
} _ID0XD4h_Data; } _ID0XD4h_Data;
...@@ -1261,6 +1274,15 @@ typedef union __attribute__((packed)) ...@@ -1261,6 +1274,15 @@ typedef union __attribute__((packed))
}Sig; }Sig;
} _ID0XA4h_Data; } _ID0XA4h_Data;
typedef union __attribute__((packed)) 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]; uint8_t Msg[RS485_RX_ID0XD0_DATA_LEN];
...@@ -1553,7 +1575,7 @@ typedef union __attribute__((packed)) ...@@ -1553,7 +1575,7 @@ typedef union __attribute__((packed))
uint8_t : 4; uint8_t : 4;
uint8_t : 2; // 推行模式反馈 uint8_t : 2; // 推行模式反馈
uint8_t : 2; uint8_t SideStaySenseSetFeedback: 2; /*边撑感应功能设置反馈*/
uint8_t : 2; /*30*/ uint8_t : 2; /*30*/
uint8_t ReverseModeFeedback : 2; // 倒车模式反馈 uint8_t ReverseModeFeedback : 2; // 倒车模式反馈
...@@ -1575,7 +1597,7 @@ typedef union __attribute__((packed)) ...@@ -1575,7 +1597,7 @@ typedef union __attribute__((packed))
uint8_t SuperTPower : 2; // 超级T动力状态 uint8_t SuperTPower : 2; // 超级T动力状态
uint8_t : 2; uint8_t : 2;
uint8_t : 2; uint8_t RampParkedSetFeedback: 2; /*坡道驻停功能设置反馈*/
uint8_t RampParkedState : 2; // 坡道驻停状态 uint8_t RampParkedState : 2; // 坡道驻停状态
uint8_t SlopeDescentFunctionStatus: 2; //陡坡缓降功能设置反馈 uint8_t SlopeDescentFunctionStatus: 2; //陡坡缓降功能设置反馈
uint8_t SteepHillDescentEnable : 2; // 陡坡缓降激活 uint8_t SteepHillDescentEnable : 2; // 陡坡缓降激活
...@@ -1686,7 +1708,7 @@ typedef union __attribute__((packed)) ...@@ -1686,7 +1708,7 @@ typedef union __attribute__((packed))
uint8_t : 2; // 座垫加热等级设置反馈 uint8_t : 2; // 座垫加热等级设置反馈
uint8_t : 2; // 座垫感应开关状态反馈 uint8_t : 2; // 座垫感应开关状态反馈
uint8_t : 2; uint8_t CushionSenseSetFeedback: 2; // 座垫感应功能设置反馈
uint8_t DumpCategory : 2; // 倾倒类别 uint8_t DumpCategory : 2; // 倾倒类别
uint8_t SupportSwitchState : 2; // 边撑开关状态 uint8_t SupportSwitchState : 2; // 边撑开关状态
...@@ -1720,6 +1742,74 @@ typedef union __attribute__((packed)) ...@@ -1720,6 +1742,74 @@ typedef union __attribute__((packed))
uint8_t PasswordCanbeEnter : 3; // 密码可输入剩余次数 uint8_t PasswordCanbeEnter : 3; // 密码可输入剩余次数
uint8_t BlueToothPair : 1; // 经典蓝牙配对指令 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; }Sig;
} _ID0XD3h_Data; } _ID0XD3h_Data;
...@@ -1847,6 +1937,7 @@ extern _ID0XD6h_Data R485_IDD6h; ...@@ -1847,6 +1937,7 @@ extern _ID0XD6h_Data R485_IDD6h;
extern _ID0XB4h_Data R485_IDB4h; extern _ID0XB4h_Data R485_IDB4h;
extern _ID0XD4h_Data R485_IDD4h; extern _ID0XD4h_Data R485_IDD4h;
extern _ID0XA4h_Data R485_IDA4h; extern _ID0XA4h_Data R485_IDA4h;
extern _ID0XC4h_Data R485_IDC4h;
extern uint8_t zhenduansendStep; extern uint8_t zhenduansendStep;
extern uint32_t R485_Send_0x40(void); extern uint32_t R485_Send_0x40(void);
...@@ -1873,13 +1964,22 @@ extern uint32_t R485_Send_0xD1(void); ...@@ -1873,13 +1964,22 @@ extern uint32_t R485_Send_0xD1(void);
extern uint32_t R485_Send_0xD2(void); extern uint32_t R485_Send_0xD2(void);
extern uint32_t R485_Send_0xD3(void); 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_0xC4(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 menuFeedbackinit(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;
extern uint8_t name2; extern uint8_t name2;
extern uint8_t R485_0x80_msg[64]; 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; extern uint8_t mimayanzhengjieguo;
#endif #endif
...@@ -37,6 +37,18 @@ void Sys_Run_Mode_Pseudo_Real_Time_Tasks(void) ...@@ -37,6 +37,18 @@ void Sys_Run_Mode_Pseudo_Real_Time_Tasks(void)
} }
TFT_LCD_Display_Update_Service( ); TFT_LCD_Display_Update_Service( );
Fre_In_Service(FRE_VEHICLE); Fre_In_Service(FRE_VEHICLE);
if(UART_Ch0_Get_TX_Busy_Flag())
{
LINE_OUT_NEG_09 = 1; //发送
}
else
{
LINE_OUT_NEG_09 = 0; //接收
}
} }
/*============================================================================*/ /*============================================================================*/
...@@ -54,7 +66,7 @@ void Sys_Run_Mode_2ms_Tasks_Group(void) ...@@ -54,7 +66,7 @@ void Sys_Run_Mode_2ms_Tasks_Group(void)
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
void Sys_Run_Mode_5ms_Tasks_Group(void) void Sys_Run_Mode_5ms_Tasks_Group(void)
{ {
} }
/*============================================================================== /*==============================================================================
...@@ -71,6 +83,7 @@ void Sys_Run_Mode_10ms_Tasks_Group(void) ...@@ -71,6 +83,7 @@ void Sys_Run_Mode_10ms_Tasks_Group(void)
downkeyserve(); downkeyserve();
} }
backsend(); backsend();
TX_RX_485_service(); TX_RX_485_service();
} }
/*============================================================================== /*==============================================================================
...@@ -99,10 +112,14 @@ uint8_t flashtime = 0; ...@@ -99,10 +112,14 @@ uint8_t flashtime = 0;
uint8_t showtime = 0; uint8_t showtime = 0;
uint8_t bleuarttime = 0; uint8_t bleuarttime = 0;
uint8_t querendelay = 0; uint8_t querendelay = 0;
void Sys_Run_Mode_100ms_Tasks_Group(void) void Sys_Run_Mode_100ms_Tasks_Group(void)
{ {
ProcessBluetoothDeviceNameWithLock();
AutoClearCounterAfterAllLit();
TimeDelay_3s(); TimeDelay_3s();
PasswordUnlock(); PasswordUnlock();
BTEnableDelayPowerReset();
static uint32_t loc_timer = 0; static uint32_t loc_timer = 0;
loc_timer++; loc_timer++;
...@@ -212,7 +229,7 @@ void Sys_Run_Mode_100ms_Tasks_Group(void) ...@@ -212,7 +229,7 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
} }
} }
if(firstpowerflag == 1) if(firstpowerflag == 1)
{ {
zhenduanflag = Data_Mode_Read; zhenduanflag = Data_Mode_Read;
Total_Check(); Total_Check();
...@@ -231,7 +248,6 @@ void Sys_Run_Mode_100ms_Tasks_Group(void) ...@@ -231,7 +248,6 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
Total_Check(); Total_Check();
firstpowerflag = 3; firstpowerflag = 3;
} }
} }
else else
{ {
......
...@@ -56,6 +56,7 @@ LineSta LineGetSta; ...@@ -56,6 +56,7 @@ LineSta LineGetSta;
_ID0XB4h_Data R485_IDB4h; _ID0XB4h_Data R485_IDB4h;
_ID0XD4h_Data R485_IDD4h; _ID0XD4h_Data R485_IDD4h;
_ID0XA4h_Data R485_IDA4h; _ID0XA4h_Data R485_IDA4h;
_ID0XC4h_Data R485_IDC4h;
void R485_TX_Init(void) void R485_TX_Init(void)
{ {
...@@ -362,6 +363,105 @@ void Bluetoothname(void) ...@@ -362,6 +363,105 @@ void Bluetoothname(void)
devicename = 0; 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) uint32_t R485_Send(const uint16_t cmdID, const uint8_t* pData, uint8_t len)
{ {
uint8_t dataBuf[256]; uint8_t dataBuf[256];
...@@ -408,9 +508,26 @@ uint8_t RS485_User_Tx_Data(void) ...@@ -408,9 +508,26 @@ uint8_t RS485_User_Tx_Data(void)
switch (RS485_TxControl.sendIndex) switch (RS485_TxControl.sendIndex)
{ {
case RS485_Tx_IDA4_Idx: 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) // if(MENU_CHECK_STEP == 0)
// { // {
// sendfinishflag = R485_Send_0xA4(); // sendfinishflag = R485_Send_0xC4();
// RS485_TX_finish = 1; // RS485_TX_finish = 1;
// if(sendfinishflag == 0) // if(sendfinishflag == 0)
// { // {
...@@ -420,9 +537,10 @@ uint8_t RS485_User_Tx_Data(void) ...@@ -420,9 +537,10 @@ uint8_t RS485_User_Tx_Data(void)
// } // }
// else // else
// { // {
RS485_TxControl.sendIndex ++; // RS485_TxControl.sendIndex ++;
// } // }
break; // break;
case RS485_Tx_IDD0_Idx: case RS485_Tx_IDD0_Idx:
sendfinishflag = R485_Send_0xD0(); sendfinishflag = R485_Send_0xD0();
...@@ -470,31 +588,31 @@ uint8_t RS485_User_Tx_Data(void) ...@@ -470,31 +588,31 @@ uint8_t RS485_User_Tx_Data(void)
if(sendfinishflag == 0) if(sendfinishflag == 0)
{ {
RS485_send_time = 0; RS485_send_time = 0;
RS485_TxControl.sendIndex ++; RS485_TxControl.sendIndex = 0;
} }
break; break;
case RS485_Tx_ID80_Idx: case RS485_Tx_ID80_Idx:
if(MENU_CHECK_STEP == 16) if(MENU_CHECK_STEP == 8)
{ {
BlueTooth = 1; BlueTooth = 1;
} }
RS485_TxControl.Openble[0] = 0x59; RS485_TxControl.Openble[0] = 0x59;
RS485_TxControl.Openble[1] = 0x44; RS485_TxControl.Openble[1] = 0x44;
RS485_TxControl.Openble[2] = 0xA; RS485_TxControl.Openble[2] = 0;
RS485_TxControl.Openble[3] = 0x8A; RS485_TxControl.Openble[3] = 0;
RS485_TxControl.Openble[4] = 0xA; RS485_TxControl.Openble[4] = 0;
RS485_TxControl.Openble[5] = 0xA; RS485_TxControl.Openble[5] = 0;
RS485_TxControl.Openble[6] = name2; RS485_TxControl.Openble[6] = 0;
RS485_TxControl.Openble[7] = name1; RS485_TxControl.Openble[7] = 0;
RS485_TxControl.Openble[8] = BlueTooth; RS485_TxControl.Openble[8] = BlueToothSwitch;
RS485_TxControl.Openble[9] = btmac[0]; RS485_TxControl.Openble[9] = 0xC1;
RS485_TxControl.Openble[10] = btmac[1]; RS485_TxControl.Openble[10] = 0xA8;
RS485_TxControl.Openble[11] = btmac[2]; RS485_TxControl.Openble[11] = 0x59;
RS485_TxControl.Openble[12] = btmac[3]; RS485_TxControl.Openble[12] = 0x20;
RS485_TxControl.Openble[13] = btmac[4]; RS485_TxControl.Openble[13] = name2;
RS485_TxControl.Openble[14] = btmac[5]; RS485_TxControl.Openble[14] = name1;
RS485_TxControl.Openble[15] = 0x4B; RS485_TxControl.Openble[15] = 0x4B;
RS485_TxControl.Openble[16] = 0x4A; RS485_TxControl.Openble[16] = 0x4A;
UART_Ch2_Send_Multiple_Byte(RS485_TxControl.Openble,sizeof(RS485_TxControl.Openble)); UART_Ch2_Send_Multiple_Byte(RS485_TxControl.Openble,sizeof(RS485_TxControl.Openble));
...@@ -554,7 +672,6 @@ void TX_RX_485_service(void) ...@@ -554,7 +672,6 @@ void TX_RX_485_service(void)
} }
else else
{ {
LINE_OUT_NEG_09 = 0;
Recv_Byte(); Recv_Byte();
} }
// } // }
......
...@@ -84,4 +84,7 @@ extern uint8_t RS485_User_Tx_Data(void); ...@@ -84,4 +84,7 @@ extern uint8_t RS485_User_Tx_Data(void);
void backsend(void); void backsend(void);
extern void TX_RX_485_service(void); extern void TX_RX_485_service(void);
extern void Bluetoothname(void); extern void Bluetoothname(void);
extern void ProcessBluetoothDeviceNameWithLock(void);
extern void BTEnableDelayPowerReset(void);
extern void AutoClearCounterAfterAllLit(void);
#endif /* API_ADC_H_ */ #endif /* API_ADC_H_ */
...@@ -374,7 +374,7 @@ uint8_t UART_Ch3_Get_TX_Busy_Flag(void) ...@@ -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 UART_Ch0_Send_Multiple_Byte(uint8_t *Data, uint32_t Len)
{ {
uint32_t u32UARTResult = 1UL; 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; uint32_t i = 0UL;
stUARTCtr0.u32UARTCount = 1U; stUARTCtr0.u32UARTCount = 1U;
......
...@@ -83,6 +83,7 @@ void Sys_Startup_Init(void) ...@@ -83,6 +83,7 @@ void Sys_Startup_Init(void)
Key_Init( ); Key_Init( );
Buzzer_Init(); Buzzer_Init();
Fre_In_KL30_Wakeup_Init(); Fre_In_KL30_Wakeup_Init();
menuFeedbackinit();
UART_Channel_Config_st_t loc_config; UART_Channel_Config_st_t loc_config;
loc_config.enUARTLINMode = MODE_UART; loc_config.enUARTLINMode = MODE_UART;
loc_config.u32UARTbps = 115200; 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