Commit 0b53c3a1 authored by 何锐's avatar 何锐

feat:增加ble蓝牙连接,简易导航

parent ee2277fd
...@@ -608,6 +608,22 @@ uint32_t R485_Send_0xA4(void) ...@@ -608,6 +608,22 @@ uint32_t R485_Send_0xA4(void)
return u32sendendflag; return u32sendendflag;
} }
uint32_t R485_Send_0xB3(void) //蓝牙地址
{
memset(R485_IDB3h.Msg, 0xFF, RS485_RX_ID0XB3_DATA_LEN);
uint32_t u32sendendflag = 0;
R485_IDB3h.Sig.BT_MAC1 = name1; //蓝牙名
R485_IDB3h.Sig.BT_MAC2 = name2;
R485_IDB3h.Sig.BT_MAC3 = 0xA;
R485_IDB3h.Sig.BT_MAC4 = 0xA;
R485_IDB3h.Sig.BT_MAC5 = 0xA;
R485_IDB3h.Sig.BT_MAC6 = 0xA;
u32sendendflag = R485_Send(0xB3, R485_IDB3h.Msg, sizeof(R485_IDB3h.Msg));
return u32sendendflag;
}
uint32_t R485_Send_0x41(void) uint32_t R485_Send_0x41(void)
{ {
/**************0.437*********** */ /**************0.437*********** */
...@@ -1283,70 +1299,7 @@ uint32_t R485_Send_0x41(void) ...@@ -1283,70 +1299,7 @@ uint32_t R485_Send_0x41(void)
uint32_t R485_Send_0x42(void) uint32_t R485_Send_0x42(void)
{ {
memset(R485_ID42h.Msg, 0xFF, 64);
uint32_t u32sendendflag = 0;
R485_ID42h.Sig.TPower = 0; //T动力状态
R485_ID42h.Sig.TotalBatteryCurrent = 0;
R485_ID42h.Sig.BLE_MAC01 = name1; //发送mac地址
R485_ID42h.Sig.BLE_MAC02 = name2;
R485_ID42h.Sig.BLE_MAC03 = 0xA;
R485_ID42h.Sig.BLE_MAC04 = 0xA;
R485_ID42h.Sig.BLE_MAC05 = 0xA;
R485_ID42h.Sig.BLE_MAC06 = 0xA;
R485_ID42h.Sig.EggAnimation = 0;
switch (MENU_CHECK_STEP)
{
case 0:
break;
case 1:
R485_ID42h.Sig.TotalBatteryCurrent = 0x44; //母线电流
break;
case 2:
R485_ID42h.Sig.TotalBatteryCurrent = 0x74; //母线电流
break;
case 3:
R485_ID42h.Sig.TotalBatteryCurrent = 0xFA; //母线电流
break;
case 4:
R485_ID42h.Sig.SuperTPower = 0x0; //超级T动力模式
R485_ID42h.Sig.TPower = 0x1; //T动力状态
break;
case 5:
// R485_ID42h.Sig.nenglainhuishou = 0x1;
R485_ID42h.Sig.TotalBatteryCurrent = 0x17;
break;
case 6:
// R485_ID42h.Sig.nenglainhuishou = 0x1;
R485_ID42h.Sig.TotalBatteryCurrent = 0x14;
break;
case 7:
R485_ID42h.Sig.nenglainhuishou = 0x1;
R485_ID42h.Sig.TotalBatteryCurrent = 0x0;
break;
case 8:
break;
case 9:
break;
case 10:
break;
case 11:
break;
case 12:
break;
case 13:
break;
case 14:
R485_ID42h.Sig.PasswordUnlockCommand = 0x1;
R485_ID42h.Sig.PasswordCanbeEnter = 0x2;
break;
default:
break;
}
u32sendendflag = R485_Send(0x42, R485_ID42h.Msg, sizeof(R485_ID42h.Msg));
// RS485_TX_finish = 1;
return u32sendendflag;
} }
uint32_t R485_Send_ble0x42(void) uint32_t R485_Send_ble0x42(void)
{ {
......
...@@ -1873,6 +1873,7 @@ extern uint32_t R485_Send_0xD1(void); ...@@ -1873,6 +1873,7 @@ 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_0xB3(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 uint8_t barcode_Msg[64]; extern uint8_t barcode_Msg[64];
......
...@@ -437,6 +437,26 @@ uint8_t RS485_User_Tx_Data(void) ...@@ -437,6 +437,26 @@ uint8_t RS485_User_Tx_Data(void)
} }
break; break;
case RS485_Tx_IDB3_Idx:
if((clearOdoFlag == 0) && (BlueTooth == 1))
{
sendfinishflag = R485_Send_0xB3();
RS485_TX_finish = 1;
if(sendfinishflag == 0)
{
if(RS485_TX_finish == 1)
{
RS485_send_time = 0;
RS485_TxControl.sendIndex ++;
}
}
}
else
{
RS485_TxControl.sendIndex ++;
}
break;
case RS485_Tx_IDD0_Idx: case RS485_Tx_IDD0_Idx:
if((MENU_CHECK_STEP != 16)&&(clearOdoFlag == 0)) if((MENU_CHECK_STEP != 16)&&(clearOdoFlag == 0))
{ {
......
...@@ -18,6 +18,7 @@ typedef enum ...@@ -18,6 +18,7 @@ typedef enum
RS485_Tx_ID04_Idx = 0, RS485_Tx_ID04_Idx = 0,
RS485_Tx_ID80_Idx, RS485_Tx_ID80_Idx,
RS485_Tx_IDA4_Idx, RS485_Tx_IDA4_Idx,
RS485_Tx_IDB3_Idx,
RS485_Tx_IDD0_Idx, RS485_Tx_IDD0_Idx,
RS485_Tx_IDD1_Idx, RS485_Tx_IDD1_Idx,
RS485_Tx_IDD2_Idx, RS485_Tx_IDD2_Idx,
...@@ -75,5 +76,5 @@ extern uint8_t sendmsgAll[8]; ...@@ -75,5 +76,5 @@ extern uint8_t sendmsgAll[8];
extern uint32_t R485_Send(const uint16_t cmdID, const uint8_t* pData, uint8_t len); extern uint32_t R485_Send(const uint16_t cmdID, const uint8_t* pData, uint8_t len);
extern uint16_t Yadi_CAL_Data_Sum(uint8_t* pu8LinData, uint8_t u8LinLen); extern uint16_t Yadi_CAL_Data_Sum(uint8_t* pu8LinData, uint8_t u8LinLen);
extern uint8_t RS485_User_Tx_Data(void); extern uint8_t RS485_User_Tx_Data(void);
void backsend(void); extern void backsend(void);
#endif /* API_ADC_H_ */ #endif /* API_ADC_H_ */
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