|
|
@@ -106,8 +106,14 @@ void pmu_to_con_voltage_data()
|
|
|
msg_buf[index++] = 0x00;
|
|
|
msg_buf[index++] = 0x00;
|
|
|
msg_buf[index++] = _MSGID_VOL;
|
|
|
-
|
|
|
- pmu.voltage = ADC_gather() / 10.0f + volinf.cal_vol * 10; // 获取当前板子电压
|
|
|
+ if(Dev.Current_Link.connect_status == COMP_NORMAL)
|
|
|
+ {
|
|
|
+ pmu.voltage = (power_BatteryInfo.voltage * 100) + volinf.cal_vol * 10;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pmu.voltage = ADC_gather() / 10.0f + volinf.cal_vol * 10; // 获取当前板子电压
|
|
|
+ }
|
|
|
memcpy(&msg_buf[index], &pmu.voltage, 2);
|
|
|
index += 2;
|
|
|
|
|
|
@@ -656,6 +662,59 @@ void pmu_to_con_DM4DFradar_data(void)
|
|
|
DM4d_recv_flag = 0;
|
|
|
|
|
|
}
|
|
|
+//4D仿地雷达分段高度
|
|
|
+void pmu_to_con_DM4DTradar_data(void)
|
|
|
+{
|
|
|
+ uint8_t index = 0;
|
|
|
+ msg_buf[index++] = 0xFE;
|
|
|
+ msg_buf[index++] = 0;
|
|
|
+ msg_buf[index++] = 0;
|
|
|
+ msg_buf[index++] = 0x00;
|
|
|
+ msg_buf[index++] = 0x00;
|
|
|
+ msg_buf[index++] = _MSGID_FT4DRADAR;
|
|
|
+ DM4dt_recv_flag = 1;
|
|
|
+ memcpy(&msg_buf[index], &D4T_tofmu.target_num, 1);
|
|
|
+ index += 1;
|
|
|
+ memcpy(&msg_buf[index], &D4T_tofmu.time_delay, 2);
|
|
|
+ index += 2;
|
|
|
+ memcpy(&msg_buf[index], &D4T_tofmu.err_num, 2);
|
|
|
+ index += 2;
|
|
|
+ memcpy(&msg_buf[index], &D4T_tofmu.RawData, D4T_tofmu.target_num * 2);
|
|
|
+ index += D4T_tofmu.target_num * 2;
|
|
|
+ msg_buf[1] = index - 6;
|
|
|
+ crc = Get_Crc16(msg_buf, index);
|
|
|
+ msg_buf[index++] = crc;
|
|
|
+ msg_buf[index++] = (crc >> 8) & 0xff;
|
|
|
+
|
|
|
+ uart2_send_msg(msg_buf, index);
|
|
|
+ DM4dt_recv_flag = 0;
|
|
|
+}
|
|
|
+void pmu_to_con_DM4DBTradar_data(void)
|
|
|
+{
|
|
|
+ uint8_t index = 0;
|
|
|
+ msg_buf[index++] = 0xFE;
|
|
|
+ msg_buf[index++] = 0;
|
|
|
+ msg_buf[index++] = 0;
|
|
|
+ msg_buf[index++] = 0x00;
|
|
|
+ msg_buf[index++] = 0x00;
|
|
|
+ msg_buf[index++] = _MSGID_BT4DRADAR;
|
|
|
+ DM4dbt_recv_flag = 1;
|
|
|
+ memcpy(&msg_buf[index], &D4BT_tofmu.target_num, 1);
|
|
|
+ index += 1;
|
|
|
+ memcpy(&msg_buf[index], &D4BT_tofmu.time_delay, 2);
|
|
|
+ index += 2;
|
|
|
+ memcpy(&msg_buf[index], &D4BT_tofmu.err_num, 2);
|
|
|
+ index += 2;
|
|
|
+ memcpy(&msg_buf[index], &D4BT_tofmu.RawData, D4BT_tofmu.target_num * 2);
|
|
|
+ index += D4BT_tofmu.target_num * 2;
|
|
|
+ msg_buf[1] = index - 6;
|
|
|
+ crc = Get_Crc16(msg_buf, index);
|
|
|
+ msg_buf[index++] = crc;
|
|
|
+ msg_buf[index++] = (crc >> 8) & 0xff;
|
|
|
+
|
|
|
+ uart2_send_msg(msg_buf, index);
|
|
|
+ DM4dbt_recv_flag = 0;
|
|
|
+}
|
|
|
//电目4D后避障雷达
|
|
|
void pmu_to_con_DM4DBradar_data(void)
|
|
|
{
|
|
|
@@ -728,8 +787,8 @@ void pmu_to_con_DM4DBradar_msg(void)
|
|
|
msg_buf[index++] = 'K';
|
|
|
msg_buf[index++] = 'Z';
|
|
|
msg_buf[index++] = '1';
|
|
|
- memcpy(&msg_buf[index],&DM_4DRADARMAG.angel_4DF,16);
|
|
|
- index += 16;
|
|
|
+ memcpy(&msg_buf[index],&DM_4DRADARMAG.angel_4DF,(sizeof(_dev_par) - 8));
|
|
|
+ index += (sizeof(_dev_par)-8);
|
|
|
msg_buf[1] = index - 6;
|
|
|
crc = Get_Crc16(msg_buf, index);
|
|
|
msg_buf[index++] = crc;
|
|
|
@@ -776,6 +835,7 @@ void pmu_to_con_heart_data()
|
|
|
crc = Get_Crc16(msg_buf, index);
|
|
|
memcpy(&msg_buf[index], &crc, 2);
|
|
|
index += 2;
|
|
|
+ //static uint32_t send_times = 0;
|
|
|
uart2_send_msg(msg_buf, index);
|
|
|
}
|
|
|
|
|
|
@@ -1341,12 +1401,23 @@ void pmu_to_fcu()
|
|
|
pmu_to_con_heart_data();
|
|
|
pmu_heart_flag = false;
|
|
|
}
|
|
|
- if(F4d_send_flag == true)
|
|
|
+ if (F4T_send_flag == true)
|
|
|
+ {
|
|
|
+ pmu_to_con_DM4DTradar_data();
|
|
|
+ F4T_send_flag = false;
|
|
|
+ }
|
|
|
+ if(F4DB_send_flag == true)
|
|
|
+ {
|
|
|
+ pmu_to_con_DM4DBTradar_data();
|
|
|
+ F4DB_send_flag = false;
|
|
|
+ }
|
|
|
+ /*if(F4d_send_flag == true)
|
|
|
{
|
|
|
pmu_to_con_DM4DFradar_data();
|
|
|
F4d_send_flag = false;
|
|
|
- }
|
|
|
- if(DM4Dmsg_send_fmu == true || (pmu_to_DM4Dmsg_flag == true && DM4d_to_fmu10s_flag <= 10000))
|
|
|
+ }*/
|
|
|
+ if(DM4Dmsg_send_fmu == true || ((pmu_to_DM4Dmsg_flag == true && DM4d_to_fmu10s_flag <= 10000) &&
|
|
|
+ (Dev.Part_Fradar_Link.connect_status == COMP_NORMAL || Dev.Part_Bradar_Link.connect_status == COMP_NORMAL)))
|
|
|
{
|
|
|
pmu_to_con_DM4DBradar_msg();
|
|
|
DM4d_to_fmu10s_flag = HAL_GetTick();
|
|
|
@@ -1518,6 +1589,7 @@ void uart_recv_con_msg()
|
|
|
if(uavinf.uavtype != planep.UAV_type)
|
|
|
{
|
|
|
write_uav_information = true;
|
|
|
+
|
|
|
}
|
|
|
break;
|
|
|
case _MSGID_TIME:
|
|
|
@@ -1551,6 +1623,9 @@ void uart_recv_con_msg()
|
|
|
case MSGID_ACK_HEART:
|
|
|
uavinf.abnormal_outage_flag = 0;
|
|
|
write_uav_information = true;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
break;
|
|
|
case MSGID_ACK_VERSION:
|
|
|
start_msg.version_info = true;
|
|
|
@@ -1722,7 +1797,22 @@ void uart_recv_con_msg()
|
|
|
}
|
|
|
break;
|
|
|
case MSGID_SET_VOL:
|
|
|
- set_cali_voltage = (fcu_protocol.payload[7] + 256 * fcu_protocol.payload[8]) - (int)(ADC_gather() /100.0f) ;
|
|
|
+ if(Dev.Current_Link.connect_status == COMP_NORMAL)
|
|
|
+ {
|
|
|
+ /*static short tem_16t = 0 ;
|
|
|
+ tem_16t = fcu_protocol.payload[7] + 256 * fcu_protocol.payload[8];
|
|
|
+ static short tem2_16t = 0 ;
|
|
|
+ tem2_16t = power_BatteryInfo.voltage * 10;*/
|
|
|
+ set_cali_voltage = (fcu_protocol.payload[7] + 256 * fcu_protocol.payload[8]) - (power_BatteryInfo.voltage * 10) ;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ /*static short tem3_16t = 0 ;
|
|
|
+ tem3_16t = fcu_protocol.payload[7] + 256 * fcu_protocol.payload[8];
|
|
|
+ static short tem4_16t = 0 ;
|
|
|
+ tem4_16t = (int)(ADC_gather() /100.0f);*/
|
|
|
+ set_cali_voltage = (fcu_protocol.payload[7] + 256 * fcu_protocol.payload[8]) - (int)(ADC_gather() /100.0f) ;
|
|
|
+ }
|
|
|
write_vol_information = true;
|
|
|
pmu_set_ack(_MSGID_SET,MSGID_SET_VOL,0,0);
|
|
|
break;
|
|
|
@@ -1853,6 +1943,12 @@ void uart_recv_con_msg()
|
|
|
else if(set_pmu_serail == serial.num)
|
|
|
{
|
|
|
pmu_set_ack(_MSGID_SET,MSGID_SET_PMU_SERIAL,0,0);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
break;
|
|
|
case MSGID_SET_RADAR_FB:
|