将485地址与can设备地址同一起来
This commit is contained in:
parent
080f45620e
commit
553cd2414c
|
@ -24,6 +24,8 @@ static void w5500_rcv_call(uint8_t socket, uint8_t *buf, uint16_t len);
|
||||||
ModbusItem w5500_modbus_tcp_array[W5500_MODBUS_NUM];
|
ModbusItem w5500_modbus_tcp_array[W5500_MODBUS_NUM];
|
||||||
W5500_STATIC_INIT(w5500, kSpiDev_3, kGpioType_W5500Cs, w5500_rcv_call);
|
W5500_STATIC_INIT(w5500, kSpiDev_3, kGpioType_W5500Cs, w5500_rcv_call);
|
||||||
|
|
||||||
|
uint8_t canID_devNumber = 0;
|
||||||
|
|
||||||
static void eth_ctrl_rx_int(uint8_t comm_dev, bool is_en)
|
static void eth_ctrl_rx_int(uint8_t comm_dev, bool is_en)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -275,7 +277,6 @@ const uint32_t can_baudrate[kCanBaudRateEnd] = {125, 250, 500, 1000};
|
||||||
void bms_init_comm(void)
|
void bms_init_comm(void)
|
||||||
{
|
{
|
||||||
uint32_t i, tmp, prop;
|
uint32_t i, tmp, prop;
|
||||||
|
|
||||||
tmp = bms_get_tag_data(kTagData_DevAddr);
|
tmp = bms_get_tag_data(kTagData_DevAddr);
|
||||||
modbus_gate.is_write_check = true;
|
modbus_gate.is_write_check = true;
|
||||||
modbus_gate.write_buf = &eeprom_item.data_buf[kEep_GateDataStart];
|
modbus_gate.write_buf = &eeprom_item.data_buf[kEep_GateDataStart];
|
||||||
|
@ -283,6 +284,8 @@ void bms_init_comm(void)
|
||||||
bsp_eeprom_set_data(kEep_Inter485Parity_Baudrate,1,kEepromDataType_Low);
|
bsp_eeprom_set_data(kEep_Inter485Parity_Baudrate,1,kEepromDataType_Low);
|
||||||
bsp_eeprom_set_data(kEep_Exter485_2Parity_Baudrate,1,kEepromDataType_Low);
|
bsp_eeprom_set_data(kEep_Exter485_2Parity_Baudrate,1,kEepromDataType_Low);
|
||||||
|
|
||||||
|
canID_devNumber = get_eeprom_data(kEep_ExterRS485_1SlaveID_Protocol, kEepromDataType_High);
|
||||||
|
|
||||||
for(i = 0; i < BMS_485_CHANNEL; i++)
|
for(i = 0; i < BMS_485_CHANNEL; i++)
|
||||||
{
|
{
|
||||||
tmp = get_eeprom_data(kEep_Inter485Parity_Baudrate + i, kEepromDataType_Low);
|
tmp = get_eeprom_data(kEep_Inter485Parity_Baudrate + i, kEepromDataType_Low);
|
||||||
|
|
|
@ -247,6 +247,12 @@ int16_t bms_caculate_current(uint32_t base_time)
|
||||||
//调试
|
//调试
|
||||||
bms_integral_soc(current, base_time);
|
bms_integral_soc(current, base_time);
|
||||||
|
|
||||||
|
//分流器最大量程350
|
||||||
|
if (current > 3600 || current < -3600)
|
||||||
|
{
|
||||||
|
current = 0;
|
||||||
|
}
|
||||||
|
|
||||||
cur_hv_item.current = current / 10;
|
cur_hv_item.current = current / 10;
|
||||||
|
|
||||||
#if CUR_FILTER_ENABLE
|
#if CUR_FILTER_ENABLE
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,260 +15,261 @@
|
||||||
#include "statistic_manager.h"
|
#include "statistic_manager.h"
|
||||||
#include "run_status.h"
|
#include "run_status.h"
|
||||||
#include "bmu_manager.h"
|
#include "bmu_manager.h"
|
||||||
|
#include "signal_manager.h"
|
||||||
#include "protocol_comm.h"
|
#include "protocol_comm.h"
|
||||||
|
|
||||||
|
extern uint8_t canID_devNumber;
|
||||||
|
|
||||||
//BCU广播报文1
|
//BCU广播报文1
|
||||||
void bcu_send_0x18010000(can_dev_e can)
|
//void bcu_send_0x18010000(can_dev_e can)
|
||||||
{
|
//{
|
||||||
uint8_t len = 0, buf[8];
|
// uint8_t len = 0, buf[8];
|
||||||
uint16_t tmp_16u;
|
// uint16_t tmp_16u;
|
||||||
uint8_t tmp_8u,status;
|
// uint8_t tmp_8u,status;
|
||||||
static uint8_t heart_bit = 0;
|
// static uint8_t heart_bit = 0;
|
||||||
|
//
|
||||||
|
// switch(bms_get_run_status())
|
||||||
|
// {
|
||||||
|
// case kRunStatus_Init:
|
||||||
|
// status = 0;
|
||||||
|
// break;
|
||||||
|
// case kRunStatus_Standby:
|
||||||
|
// status = 1;
|
||||||
|
// break;
|
||||||
|
// case kRunStatus_Chg:
|
||||||
|
// status = 2;
|
||||||
|
// break;
|
||||||
|
// case kRunStatus_Dis:
|
||||||
|
// status = 3;
|
||||||
|
// default:
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //电池组总电压
|
||||||
|
// tmp_16u = bms_get_statistic_data(kStatisticData_TotalVolt);
|
||||||
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
|
// //电池组充/放电总电流
|
||||||
|
// tmp_16u = bms_get_current() + 32000;
|
||||||
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
|
// //电池模块SOC
|
||||||
|
// tmp_8u = (uint8_t )(bms_get_soc()/100);
|
||||||
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
|
// //电池模块SOH
|
||||||
|
// tmp_8u = (uint8_t)(bms_get_soh()/100);
|
||||||
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
|
// //BMS工作状态
|
||||||
|
// tmp_8u = status;
|
||||||
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
|
// //BMS心跳
|
||||||
|
// tmp_8u = heart_bit++;
|
||||||
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
|
// bsp_can_ext_data_sync_send(can, 0x18010000, buf, len);
|
||||||
|
//}
|
||||||
|
|
||||||
switch(bms_get_run_status())
|
////BCU广播报文2
|
||||||
{
|
//void bcu_send_0x18020000(can_dev_e can)
|
||||||
case kRunStatus_Init:
|
//{
|
||||||
status = 0;
|
// uint8_t len = 0, buf[8];
|
||||||
break;
|
// uint16_t tmp_16u;
|
||||||
case kRunStatus_Standby:
|
|
||||||
status = 1;
|
|
||||||
break;
|
|
||||||
case kRunStatus_Chg:
|
|
||||||
status = 2;
|
|
||||||
break;
|
|
||||||
case kRunStatus_Dis:
|
|
||||||
status = 3;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//电池组总电压
|
// //电池总容量
|
||||||
tmp_16u = bms_get_statistic_data(kStatisticData_TotalVolt);
|
// tmp_16u = get_eeprom_data(kEep_RatedCapacity, kEepromDataType_Full);
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
//电池组充/放电总电流
|
// //电池剩余容量
|
||||||
tmp_16u = bms_get_current() + 32000;
|
// tmp_16u = (uint32_t)bms_get_soc()*get_eeprom_data(kEep_RatedCapacity, kEepromDataType_Full)/10000;;
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
//电池模块SOC
|
// //系统额定电量
|
||||||
tmp_8u = (uint8_t )(bms_get_soc()/100);
|
// tmp_16u = get_eeprom_data(kEep_RatedCapacity, kEepromDataType_Full)*get_eeprom_data(kEep_RatedTotalVolt, kEepromDataType_Full)/10000;
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
//电池模块SOH
|
// //预留
|
||||||
tmp_8u = (uint8_t)(bms_get_soh()/100);
|
// WRITE_LT_INT16U(buf, len, 0);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// bsp_can_ext_data_sync_send(can, 0x18020000, buf, len);
|
||||||
//BMS工作状态
|
//}
|
||||||
tmp_8u = status;
|
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
|
||||||
//BMS心跳
|
|
||||||
tmp_8u = heart_bit++;
|
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
|
||||||
bsp_can_ext_data_sync_send(can, 0x18010000, buf, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
//BCU广播报文2
|
////BCU广播报文3
|
||||||
void bcu_send_0x18020000(can_dev_e can)
|
//void bcu_send_0x18030000(can_dev_e can)
|
||||||
{
|
//{
|
||||||
uint8_t len = 0, buf[8];
|
// uint8_t len = 0, buf[8];
|
||||||
uint16_t tmp_16u;
|
// uint16_t tmp_16u;
|
||||||
|
|
||||||
//电池总容量
|
// //在线电池总数
|
||||||
tmp_16u = get_eeprom_data(kEep_RatedCapacity, kEepromDataType_Full);
|
// tmp_16u = bms_get_statistic_data(kStatisticData_OnlineCellNum);
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
//电池剩余容量
|
// //在线温感总数
|
||||||
tmp_16u = (uint32_t)bms_get_soc()*get_eeprom_data(kEep_RatedCapacity, kEepromDataType_Full)/10000;;
|
// tmp_16u = get_eeprom_data(kEep_TempNum, kEepromDataType_Full);
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
//系统额定电量
|
// //循环次数
|
||||||
tmp_16u = get_eeprom_data(kEep_RatedCapacity, kEepromDataType_Full)*get_eeprom_data(kEep_RatedTotalVolt, kEepromDataType_Full)/10000;
|
// tmp_16u = bms_get_cycle();
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
//预留
|
// //预留
|
||||||
WRITE_LT_INT16U(buf, len, 0);
|
// tmp_16u = 0;
|
||||||
bsp_can_ext_data_sync_send(can, 0x18020000, buf, len);
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
}
|
//
|
||||||
|
// bsp_can_ext_data_sync_send(can, 0x18030000, buf, len);
|
||||||
|
//}
|
||||||
|
|
||||||
//BCU广播报文3
|
////BCU广播报文4
|
||||||
void bcu_send_0x18030000(can_dev_e can)
|
//void bcu_send_0x18040000(can_dev_e can)
|
||||||
{
|
//{
|
||||||
uint8_t len = 0, buf[8];
|
// uint8_t len = 0, buf[8];
|
||||||
uint16_t tmp_16u;
|
// uint16_t tmp_16u;
|
||||||
|
|
||||||
//在线电池总数
|
// //最大允许充电电流
|
||||||
tmp_16u = bms_get_statistic_data(kStatisticData_OnlineCellNum);
|
// tmp_16u = bms_get_sop_data(kSopData_ChgCur);
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
//在线温感总数
|
// //最大允许放电电流
|
||||||
tmp_16u = get_eeprom_data(kEep_TempNum, kEepromDataType_Full);
|
// tmp_16u = bms_get_sop_data(kSopData_DisCur);
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
//循环次数
|
// //最大允许充电功率
|
||||||
tmp_16u = bms_get_cycle();
|
// tmp_16u = bms_get_sop_data(kSopData_ChgCur) * bms_get_statistic_data(kStatisticData_TotalVolt) / 10000;
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
//预留
|
// //最大允许放电功率
|
||||||
tmp_16u = 0;
|
// tmp_16u = get_eeprom_data(kEep_DisLTVoltLTAlarm1, kEepromDataType_Full);
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
|
// bsp_can_ext_data_sync_send(can, 0x18040000, buf, len);
|
||||||
|
//}
|
||||||
|
|
||||||
bsp_can_ext_data_sync_send(can, 0x18030000, buf, len);
|
////BCU广播报文5
|
||||||
}
|
//void bcu_send_0x18050000(can_dev_e can)
|
||||||
|
//{
|
||||||
|
// uint8_t len = 0, buf[8];
|
||||||
|
// uint16_t tmp_16u;
|
||||||
|
|
||||||
//BCU广播报文4
|
// //最高单体电压
|
||||||
void bcu_send_0x18040000(can_dev_e can)
|
// tmp_16u = bms_get_statistic_data(kStatisticData_MaxVolt);
|
||||||
{
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
uint8_t len = 0, buf[8];
|
// //最低单体电压
|
||||||
uint16_t tmp_16u;
|
// tmp_16u = bms_get_statistic_data(kStatisticData_MinVolt);
|
||||||
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
//最大允许充电电流
|
// //最大压差
|
||||||
tmp_16u = bms_get_sop_data(kSopData_ChgCur);
|
// tmp_16u = bms_get_statistic_data(kStatisticData_VoltDiff);
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
//最大允许放电电流
|
// //平均电压
|
||||||
tmp_16u = bms_get_sop_data(kSopData_DisCur);
|
// tmp_16u = bms_get_statistic_data(kStatisticData_AvgVolt);
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
//最大允许充电功率
|
// bsp_can_ext_data_sync_send(can, 0x18050000, buf, len);
|
||||||
tmp_16u = bms_get_sop_data(kSopData_ChgCur) * bms_get_statistic_data(kStatisticData_TotalVolt) / 10000;
|
//}
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
|
||||||
//最大允许放电功率
|
|
||||||
tmp_16u = get_eeprom_data(kEep_DisLTVoltLTAlarm1, kEepromDataType_Full);
|
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
|
||||||
bsp_can_ext_data_sync_send(can, 0x18040000, buf, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
//BCU广播报文5
|
|
||||||
void bcu_send_0x18050000(can_dev_e can)
|
|
||||||
{
|
|
||||||
uint8_t len = 0, buf[8];
|
|
||||||
uint16_t tmp_16u;
|
|
||||||
|
|
||||||
//最高单体电压
|
|
||||||
tmp_16u = bms_get_statistic_data(kStatisticData_MaxVolt);
|
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
|
||||||
//最低单体电压
|
|
||||||
tmp_16u = bms_get_statistic_data(kStatisticData_MinVolt);
|
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
|
||||||
//最大压差
|
|
||||||
tmp_16u = bms_get_statistic_data(kStatisticData_VoltDiff);
|
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
|
||||||
//平均电压
|
|
||||||
tmp_16u = bms_get_statistic_data(kStatisticData_AvgVolt);
|
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
|
||||||
bsp_can_ext_data_sync_send(can, 0x18050000, buf, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//BCU广播报文6
|
////BCU广播报文6
|
||||||
void bcu_send_0x18060000(can_dev_e can)
|
//void bcu_send_0x18060000(can_dev_e can)
|
||||||
{
|
//{
|
||||||
uint8_t len = 0, buf[8];
|
// uint8_t len = 0, buf[8];
|
||||||
uint16_t tmp_16u;
|
// uint16_t tmp_16u;
|
||||||
|
|
||||||
//最高单体温度
|
// //最高单体温度
|
||||||
tmp_16u = bms_get_statistic_data(kStatisticData_MaxTemp);
|
// tmp_16u = bms_get_statistic_data(kStatisticData_MaxTemp);
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
//最低单体温度
|
// //最低单体温度
|
||||||
tmp_16u = bms_get_statistic_data(kStatisticData_MinTemp);
|
// tmp_16u = bms_get_statistic_data(kStatisticData_MinTemp);
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
//单体温差
|
// //单体温差
|
||||||
tmp_16u = bms_get_statistic_data(kStatisticData_TempDiff);
|
// tmp_16u = bms_get_statistic_data(kStatisticData_TempDiff);
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
//平均温度
|
// //平均温度
|
||||||
tmp_16u = bms_get_statistic_data(kStatisticData_AvgTemp);
|
// tmp_16u = bms_get_statistic_data(kStatisticData_AvgTemp);
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
// WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
bsp_can_ext_data_sync_send(can, 0x1806FF00, buf, len);
|
// bsp_can_ext_data_sync_send(can, 0x1806FF00, buf, len);
|
||||||
}
|
//}
|
||||||
|
|
||||||
//BCU广播报文7
|
////BCU广播报文7
|
||||||
void bcu_send_0x18070000(can_dev_e can)
|
//void bcu_send_0x18070000(can_dev_e can)
|
||||||
{
|
//{
|
||||||
uint8_t len = 0, buf[8];
|
// uint8_t len = 0, buf[8];
|
||||||
uint8_t tmp_8u;
|
// uint8_t tmp_8u;
|
||||||
|
|
||||||
//最高单体电压从机序号
|
// //最高单体电压从机序号
|
||||||
tmp_8u = bms_get_statistic_data(kStatisticData_MaxVoltBmuIdx) + 1;
|
// tmp_8u = bms_get_statistic_data(kStatisticData_MaxVoltBmuIdx) + 1;
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
//最高单体电压电池序号
|
// //最高单体电压电池序号
|
||||||
tmp_8u = bms_get_statistic_data(kStatisticData_MaxVoltIdx) + 1;
|
// tmp_8u = bms_get_statistic_data(kStatisticData_MaxVoltIdx) + 1;
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
//最低单体电压从机序号
|
// //最低单体电压从机序号
|
||||||
tmp_8u = bms_get_statistic_data(kStatisticData_MinVoltBmuIdx) + 1;
|
// tmp_8u = bms_get_statistic_data(kStatisticData_MinVoltBmuIdx) + 1;
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
//最低单体电压电池序号
|
// //最低单体电压电池序号
|
||||||
tmp_8u = bms_get_statistic_data(kStatisticData_MinVoltIdx) + 1;
|
// tmp_8u = bms_get_statistic_data(kStatisticData_MinVoltIdx) + 1;
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
//最高单体温度从机序号
|
// //最高单体温度从机序号
|
||||||
tmp_8u = bms_get_statistic_data(kStatisticData_MaxTempBmuIdx) + 1;
|
// tmp_8u = bms_get_statistic_data(kStatisticData_MaxTempBmuIdx) + 1;
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
//最高单体温度温感序号
|
// //最高单体温度温感序号
|
||||||
tmp_8u = bms_get_statistic_data(kStatisticData_MaxTempIdx) + 1;
|
// tmp_8u = bms_get_statistic_data(kStatisticData_MaxTempIdx) + 1;
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
//最低单体温度从机序号
|
// //最低单体温度从机序号
|
||||||
tmp_8u = bms_get_statistic_data(kStatisticData_MinTempBmuIdx) + 1;
|
// tmp_8u = bms_get_statistic_data(kStatisticData_MinTempBmuIdx) + 1;
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
//最低单体温度温感序号
|
// //最低单体温度温感序号
|
||||||
tmp_8u = bms_get_statistic_data(kStatisticData_MinTempIdx) + 1;
|
// tmp_8u = bms_get_statistic_data(kStatisticData_MinTempIdx) + 1;
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
bsp_can_ext_data_sync_send(can, 0x18070000, buf, len);
|
// bsp_can_ext_data_sync_send(can, 0x18070000, buf, len);
|
||||||
}
|
//}
|
||||||
#include "signal_manager.h"
|
//#include "signal_manager.h"
|
||||||
//BCU广播报文8
|
////BCU广播报文8
|
||||||
void bcu_send_0x18080000(can_dev_e can)
|
//void bcu_send_0x18080000(can_dev_e can)
|
||||||
{
|
//{
|
||||||
uint8_t len = 0, buf[8];
|
// uint8_t len = 0, buf[8];
|
||||||
uint8_t tmp_8u;
|
// uint8_t tmp_8u;
|
||||||
|
|
||||||
//故障最高等级
|
// //故障最高等级
|
||||||
tmp_8u = bms_get_max_fault_level();
|
// tmp_8u = bms_get_max_fault_level();
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
//断继电器故障
|
// //断继电器故障
|
||||||
tmp_8u = (bms_get_fault_relay_off_bit() != 0);
|
// tmp_8u = (bms_get_fault_relay_off_bit() != 0);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
//禁充标志
|
// //禁充标志
|
||||||
tmp_8u = (bms_get_signal(kSignalIdx_ForbidChg) == kSignalStatus_High);
|
// tmp_8u = (bms_get_signal(kSignalIdx_ForbidChg) == kSignalStatus_High);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
//禁放标志
|
// //禁放标志
|
||||||
tmp_8u = (bms_get_signal(kSignalIdx_ForbidDis) == kSignalStatus_High);
|
// tmp_8u = (bms_get_signal(kSignalIdx_ForbidDis) == kSignalStatus_High);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
|
//
|
||||||
|
// WRITE_LT_INT32U(buf, len, 0);
|
||||||
|
|
||||||
WRITE_LT_INT32U(buf, len, 0);
|
// bsp_can_ext_data_sync_send(can, 0x18080000, buf, len);
|
||||||
|
//}
|
||||||
|
|
||||||
bsp_can_ext_data_sync_send(can, 0x18080000, buf, len);
|
//void bcu_can_receive(CanMsg *msg, can_dev_e can)
|
||||||
}
|
//{
|
||||||
|
// uint8_t code = 0,value = 0;
|
||||||
|
// if(msg->id.value == 0x181CFFF4)
|
||||||
|
// {
|
||||||
|
// code = msg->data.byte[0];
|
||||||
|
// value = msg->data.byte[1];
|
||||||
|
// if(code == 1)
|
||||||
|
// {
|
||||||
|
// bsp_eeprom_save_data(kEep_ChgDisChangeBasis_RelayOnOffMode, value,kEepromDataType_Low);
|
||||||
|
// }
|
||||||
|
// if(code == 0 && get_eeprom_data(kEep_ChgDisChangeBasis_RelayOnOffMode, kEepromDataType_Low) == kRunCtrl_Cmd)
|
||||||
|
// {
|
||||||
|
// bms_set_circuit_cmd_status((CircuitStatus)value);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
void bcu_can_receive(CanMsg *msg, can_dev_e can)
|
//void bcu_can_send(uint32_t base_time,can_dev_e can)
|
||||||
{
|
//{
|
||||||
uint8_t code = 0,value = 0;
|
// static uint32_t dly = 0;
|
||||||
if(msg->id.value == 0x181CFFF4)
|
//
|
||||||
{
|
// dly += base_time;
|
||||||
code = msg->data.byte[0];
|
// if((dly % 100) == 0)
|
||||||
value = msg->data.byte[1];
|
// {
|
||||||
if(code == 1)
|
// dly = 0;
|
||||||
{
|
// bcu_send_0x18010000(can);
|
||||||
bsp_eeprom_save_data(kEep_ChgDisChangeBasis_RelayOnOffMode, value,kEepromDataType_Low);
|
// bcu_send_0x18020000(can);
|
||||||
}
|
// bcu_send_0x18030000(can);
|
||||||
if(code == 0 && get_eeprom_data(kEep_ChgDisChangeBasis_RelayOnOffMode, kEepromDataType_Low) == kRunCtrl_Cmd)
|
// bcu_send_0x18040000(can);
|
||||||
{
|
// bcu_send_0x18050000(can);
|
||||||
bms_set_circuit_cmd_status((CircuitStatus)value);
|
// bcu_send_0x18060000(can);
|
||||||
}
|
// bcu_send_0x18070000(can);
|
||||||
}
|
// bcu_send_0x18080000(can);
|
||||||
}
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
void bcu_can_send(uint32_t base_time,can_dev_e can)
|
//void protocol_can_bcu_init(can_dev_e can)
|
||||||
{
|
//{
|
||||||
static uint32_t dly = 0;
|
// protocol_can_set_call(can, bcu_can_receive, bcu_can_send,NULL);
|
||||||
|
//}
|
||||||
dly += base_time;
|
|
||||||
if((dly % 100) == 0)
|
|
||||||
{
|
|
||||||
dly = 0;
|
|
||||||
bcu_send_0x18010000(can);
|
|
||||||
bcu_send_0x18020000(can);
|
|
||||||
bcu_send_0x18030000(can);
|
|
||||||
bcu_send_0x18040000(can);
|
|
||||||
bcu_send_0x18050000(can);
|
|
||||||
bcu_send_0x18060000(can);
|
|
||||||
bcu_send_0x18070000(can);
|
|
||||||
bcu_send_0x18080000(can);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void protocol_can_bcu_init(can_dev_e can)
|
|
||||||
{
|
|
||||||
protocol_can_set_call(can, bcu_can_receive, bcu_can_send,NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************pylon can*********************/
|
/*********************pylon can*********************/
|
||||||
/*********************pylon can*********************/
|
/*********************pylon can*********************/
|
||||||
|
@ -278,6 +279,8 @@ void bcu_send_0x42100000(can_dev_e can)
|
||||||
uint8_t len = 0, buf[8];
|
uint8_t len = 0, buf[8];
|
||||||
uint16_t tmp_16u;
|
uint16_t tmp_16u;
|
||||||
uint8_t tmp_8u;
|
uint8_t tmp_8u;
|
||||||
|
uint32_t canID_dev;
|
||||||
|
canID_dev = 0x00004210 + canID_devNumber -1;
|
||||||
|
|
||||||
//电池组总电压
|
//电池组总电压
|
||||||
tmp_16u = bms_get_statistic_data(kStatisticData_TotalVolt);
|
tmp_16u = bms_get_statistic_data(kStatisticData_TotalVolt);
|
||||||
|
@ -294,7 +297,7 @@ void bcu_send_0x42100000(can_dev_e can)
|
||||||
//电池模块SOH
|
//电池模块SOH
|
||||||
tmp_8u = (uint8_t)(bms_get_soh()/100);
|
tmp_8u = (uint8_t)(bms_get_soh()/100);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
bsp_can_ext_data_sync_send(can, 0x00004210, buf, len);
|
bsp_can_ext_data_sync_send(can, canID_dev, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bcu_send_0x42200000(can_dev_e can)
|
void bcu_send_0x42200000(can_dev_e can)
|
||||||
|
@ -302,6 +305,9 @@ void bcu_send_0x42200000(can_dev_e can)
|
||||||
uint8_t len = 0, buf[8];
|
uint8_t len = 0, buf[8];
|
||||||
uint16_t tmp_16u;
|
uint16_t tmp_16u;
|
||||||
|
|
||||||
|
uint32_t canID_dev;
|
||||||
|
canID_dev = 0x00004220 + canID_devNumber -1;
|
||||||
|
|
||||||
//充电截止电压
|
//充电截止电压
|
||||||
tmp_16u = get_eeprom_data(kEep_ChgHTVoltHTAlarm1, kEepromDataType_Full);
|
tmp_16u = get_eeprom_data(kEep_ChgHTVoltHTAlarm1, kEepromDataType_Full);
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
|
@ -314,13 +320,15 @@ void bcu_send_0x42200000(can_dev_e can)
|
||||||
//最大放电电流
|
//最大放电电流
|
||||||
tmp_16u = bms_get_sop_data(kSopData_DisCur);
|
tmp_16u = bms_get_sop_data(kSopData_DisCur);
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
bsp_can_ext_data_sync_send(can, 0x00004220, buf, len);
|
bsp_can_ext_data_sync_send(can, canID_dev, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bcu_send_0x42300000(can_dev_e can)
|
void bcu_send_0x42300000(can_dev_e can)
|
||||||
{
|
{
|
||||||
uint8_t len = 0, buf[8];
|
uint8_t len = 0, buf[8];
|
||||||
uint16_t tmp_16u;
|
uint16_t tmp_16u;
|
||||||
|
uint32_t canID_dev;
|
||||||
|
canID_dev = 0x00004230 + canID_devNumber -1;
|
||||||
|
|
||||||
//最高单体电池电压
|
//最高单体电池电压
|
||||||
tmp_16u = bms_get_statistic_data(kStatisticData_MaxVolt);
|
tmp_16u = bms_get_statistic_data(kStatisticData_MaxVolt);
|
||||||
|
@ -334,7 +342,7 @@ void bcu_send_0x42300000(can_dev_e can)
|
||||||
//最低单体电池电压编号
|
//最低单体电池电压编号
|
||||||
tmp_16u = bms_get_statistic_data(kStatisticData_MinVoltIdx) + 1;
|
tmp_16u = bms_get_statistic_data(kStatisticData_MinVoltIdx) + 1;
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
bsp_can_ext_data_sync_send(can, 0x00004230, buf, len);
|
bsp_can_ext_data_sync_send(can, canID_dev, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bcu_send_0x42400000(can_dev_e can)
|
void bcu_send_0x42400000(can_dev_e can)
|
||||||
|
@ -342,6 +350,9 @@ void bcu_send_0x42400000(can_dev_e can)
|
||||||
uint8_t len = 0, buf[8];
|
uint8_t len = 0, buf[8];
|
||||||
uint16_t tmp_16u;
|
uint16_t tmp_16u;
|
||||||
|
|
||||||
|
uint32_t canID_dev;
|
||||||
|
canID_dev = 0x00004240 + canID_devNumber -1;
|
||||||
|
|
||||||
//最高单体电池温度
|
//最高单体电池温度
|
||||||
tmp_16u = bms_get_statistic_data(kStatisticData_MaxTemp);
|
tmp_16u = bms_get_statistic_data(kStatisticData_MaxTemp);
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
|
@ -354,7 +365,7 @@ void bcu_send_0x42400000(can_dev_e can)
|
||||||
//最低单体电池温度编号
|
//最低单体电池温度编号
|
||||||
tmp_16u = bms_get_statistic_data(kStatisticData_MinTempIdx) + 1;
|
tmp_16u = bms_get_statistic_data(kStatisticData_MinTempIdx) + 1;
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
bsp_can_ext_data_sync_send(can, 0x00004240, buf, len);
|
bsp_can_ext_data_sync_send(can, canID_dev, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bcu_send_0x42500000(can_dev_e can)
|
void bcu_send_0x42500000(can_dev_e can)
|
||||||
|
@ -365,6 +376,9 @@ void bcu_send_0x42500000(can_dev_e can)
|
||||||
uint16_t temp_second;
|
uint16_t temp_second;
|
||||||
uint16_t temp_first;
|
uint16_t temp_first;
|
||||||
|
|
||||||
|
uint32_t canID_dev;
|
||||||
|
canID_dev = 0x00004250 + canID_devNumber -1;
|
||||||
|
|
||||||
/* 基本状态
|
/* 基本状态
|
||||||
pylon bluesun
|
pylon bluesun
|
||||||
0 休眠 初始化
|
0 休眠 初始化
|
||||||
|
@ -412,7 +426,7 @@ void bcu_send_0x42500000(can_dev_e can)
|
||||||
tmp_16u = set_bit_based_on_source_pylon(status, kFaultLevel_Third);
|
tmp_16u = set_bit_based_on_source_pylon(status, kFaultLevel_Third);
|
||||||
|
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
bsp_can_ext_data_sync_send(can, 0x00004250, buf, len);
|
bsp_can_ext_data_sync_send(can, canID_dev, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bcu_send_0x42600000(can_dev_e can)
|
void bcu_send_0x42600000(can_dev_e can)
|
||||||
|
@ -420,6 +434,9 @@ void bcu_send_0x42600000(can_dev_e can)
|
||||||
uint8_t len = 0, buf[8];
|
uint8_t len = 0, buf[8];
|
||||||
uint16_t tmp_16u;
|
uint16_t tmp_16u;
|
||||||
|
|
||||||
|
uint32_t canID_dev;
|
||||||
|
canID_dev = 0x00004260 + canID_devNumber -1;
|
||||||
|
|
||||||
//最高电池模块电压--无,用单体平均电压×16代替
|
//最高电池模块电压--无,用单体平均电压×16代替
|
||||||
tmp_16u = bms_get_statistic_data(kStatisticData_AvgVolt) * 16;
|
tmp_16u = bms_get_statistic_data(kStatisticData_AvgVolt) * 16;
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
|
@ -432,7 +449,7 @@ void bcu_send_0x42600000(can_dev_e can)
|
||||||
//最低电池模块电压编号--无,用单体从机号代替
|
//最低电池模块电压编号--无,用单体从机号代替
|
||||||
tmp_16u = bms_get_statistic_data(kStatisticData_MinVoltBmuIdx) + 1;
|
tmp_16u = bms_get_statistic_data(kStatisticData_MinVoltBmuIdx) + 1;
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
bsp_can_ext_data_sync_send(can, 0x00004260, buf, len);
|
bsp_can_ext_data_sync_send(can, canID_dev, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bcu_send_0x42700000(can_dev_e can)
|
void bcu_send_0x42700000(can_dev_e can)
|
||||||
|
@ -440,6 +457,9 @@ void bcu_send_0x42700000(can_dev_e can)
|
||||||
uint8_t len = 0, buf[8];
|
uint8_t len = 0, buf[8];
|
||||||
uint16_t tmp_16u;
|
uint16_t tmp_16u;
|
||||||
|
|
||||||
|
uint32_t canID_dev;
|
||||||
|
canID_dev = 0x00004270 + canID_devNumber -1;
|
||||||
|
|
||||||
//最高电池模块温度--无,用最高单体温度代替
|
//最高电池模块温度--无,用最高单体温度代替
|
||||||
tmp_16u = bms_get_statistic_data(kStatisticData_MaxTemp);
|
tmp_16u = bms_get_statistic_data(kStatisticData_MaxTemp);
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
|
@ -452,7 +472,7 @@ void bcu_send_0x42700000(can_dev_e can)
|
||||||
//最低电池模块温度编号--无,用单体从机号代替
|
//最低电池模块温度编号--无,用单体从机号代替
|
||||||
tmp_16u = bms_get_statistic_data(kStatisticData_MinTempBmuIdx) + 1;
|
tmp_16u = bms_get_statistic_data(kStatisticData_MinTempBmuIdx) + 1;
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
bsp_can_ext_data_sync_send(can, 0x00004270, buf, len);
|
bsp_can_ext_data_sync_send(can, canID_dev, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bcu_send_0x42800000(can_dev_e can)
|
void bcu_send_0x42800000(can_dev_e can)
|
||||||
|
@ -462,6 +482,9 @@ void bcu_send_0x42800000(can_dev_e can)
|
||||||
uint8_t tmp_8u;
|
uint8_t tmp_8u;
|
||||||
uint16_t bms_stu = 0;
|
uint16_t bms_stu = 0;
|
||||||
|
|
||||||
|
uint32_t canID_dev;
|
||||||
|
canID_dev = 0x00004280 + canID_devNumber -1;
|
||||||
|
|
||||||
if(bms_get_run_status() == kRunStatus_Init)
|
if(bms_get_run_status() == kRunStatus_Init)
|
||||||
{
|
{
|
||||||
bms_stu = 0;
|
bms_stu = 0;
|
||||||
|
@ -518,7 +541,7 @@ void bcu_send_0x42800000(can_dev_e can)
|
||||||
tmp_16u = 0;
|
tmp_16u = 0;
|
||||||
WRITE_LT_INT16U(buf, len, tmp_16u);
|
WRITE_LT_INT16U(buf, len, tmp_16u);
|
||||||
|
|
||||||
bsp_can_ext_data_sync_send(can, 0x00004280, buf, len);
|
bsp_can_ext_data_sync_send(can, canID_dev, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bcu_send_0x73100000(can_dev_e can)
|
void bcu_send_0x73100000(can_dev_e can)
|
||||||
|
@ -527,6 +550,9 @@ void bcu_send_0x73100000(can_dev_e can)
|
||||||
uint16_t tmp_16u;
|
uint16_t tmp_16u;
|
||||||
uint8_t tmp_8u;
|
uint8_t tmp_8u;
|
||||||
|
|
||||||
|
uint32_t canID_dev;
|
||||||
|
canID_dev = 0x00007310 + canID_devNumber -1;
|
||||||
|
|
||||||
//Hardware Version
|
//Hardware Version
|
||||||
tmp_8u = 1;
|
tmp_8u = 1;
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
|
@ -552,69 +578,75 @@ void bcu_send_0x73100000(can_dev_e can)
|
||||||
tmp_8u = 1;
|
tmp_8u = 1;
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
|
|
||||||
bsp_can_ext_data_sync_send(can, 0x00007310, buf, len);
|
bsp_can_ext_data_sync_send(can, canID_dev, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void bcu_send_0x73200000(can_dev_e can)
|
//void bcu_send_0x73200000(can_dev_e can)
|
||||||
{
|
//{
|
||||||
uint8_t len = 0, buf[8];
|
// uint8_t len = 0, buf[8];
|
||||||
uint16_t tmp_16u;
|
// uint16_t tmp_16u;
|
||||||
uint8_t tmp_8u;
|
// uint8_t tmp_8u;
|
||||||
|
//
|
||||||
|
// uint32_t canID_dev;
|
||||||
|
// canID_dev = 0x00007320 + canID_devNumber -1;
|
||||||
|
//
|
||||||
|
// tmp_8u = 0;
|
||||||
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
|
//
|
||||||
|
// bsp_can_ext_data_sync_send(can, canID_dev, buf, len);
|
||||||
|
//}
|
||||||
|
|
||||||
|
//void bcu_send_0x73300000(can_dev_e can)
|
||||||
|
//{
|
||||||
|
// uint8_t len = 0, buf[8];
|
||||||
|
// uint16_t tmp_16u;
|
||||||
|
// uint8_t tmp_8u;
|
||||||
|
//
|
||||||
|
// uint32_t canID_dev;
|
||||||
|
// canID_dev = 0x00007330 + canID_devNumber -1;
|
||||||
|
|
||||||
tmp_8u = 0;
|
// tmp_8u = 0;
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
|
//
|
||||||
|
// bsp_can_ext_data_sync_send(can, canID_dev, buf, len);
|
||||||
|
//}
|
||||||
|
|
||||||
bsp_can_ext_data_sync_send(can, 0x00007320, buf, len);
|
//void bcu_send_0x42900000(can_dev_e can)
|
||||||
}
|
//{
|
||||||
|
// uint8_t len = 0, buf[8];
|
||||||
void bcu_send_0x73300000(can_dev_e can)
|
// uint16_t tmp_16u;
|
||||||
{
|
// uint8_t tmp_8u;
|
||||||
uint8_t len = 0, buf[8];
|
//
|
||||||
uint16_t tmp_16u;
|
// uint32_t canID_dev;
|
||||||
uint8_t tmp_8u;
|
// canID_dev = 0x00004290 + canID_devNumber -1;
|
||||||
|
//
|
||||||
|
// tmp_8u = 0;
|
||||||
tmp_8u = 0;
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
// WRITE_LT_INT8U(buf, len, tmp_8u);
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
//
|
||||||
|
// bsp_can_ext_data_sync_send(can, canID_dev, buf, len);
|
||||||
bsp_can_ext_data_sync_send(can, 0x00007330, buf, len);
|
//}
|
||||||
}
|
|
||||||
|
|
||||||
void bcu_send_0x42900000(can_dev_e can)
|
|
||||||
{
|
|
||||||
uint8_t len = 0, buf[8];
|
|
||||||
uint16_t tmp_16u;
|
|
||||||
uint8_t tmp_8u;
|
|
||||||
|
|
||||||
|
|
||||||
tmp_8u = 0;
|
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
|
||||||
WRITE_LT_INT8U(buf, len, tmp_8u);
|
|
||||||
|
|
||||||
bsp_can_ext_data_sync_send(can, 0x00004290, buf, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
void bcu_can_send_pylon(uint32_t base_time,can_dev_e can)
|
void bcu_can_send_pylon(uint32_t base_time,can_dev_e can)
|
||||||
{
|
{
|
||||||
|
@ -633,9 +665,9 @@ void bcu_can_send_pylon(uint32_t base_time,can_dev_e can)
|
||||||
bcu_send_0x42700000(can);
|
bcu_send_0x42700000(can);
|
||||||
bcu_send_0x42800000(can);
|
bcu_send_0x42800000(can);
|
||||||
bcu_send_0x73100000(can);
|
bcu_send_0x73100000(can);
|
||||||
bcu_send_0x73200000(can);
|
// bcu_send_0x73200000(can);
|
||||||
bcu_send_0x42900000(can);
|
// bcu_send_0x42900000(can);
|
||||||
bcu_send_0x73300000(can);
|
// bcu_send_0x73300000(can);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ typedef void (*CanProtocalCall)(can_dev_e can);
|
||||||
CanProtocalCall protocol_can_init_array[kCanProtocal_End] =
|
CanProtocalCall protocol_can_init_array[kCanProtocal_End] =
|
||||||
{
|
{
|
||||||
protocol_can_none_init,
|
protocol_can_none_init,
|
||||||
protocol_can_bcu_init,
|
// protocol_can_bcu_init,
|
||||||
protocol_pylon_can_init,
|
protocol_pylon_can_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ void protocol_can_set_call(can_dev_e can, CanCommReceive rx, CanCommSend tx, Can
|
||||||
|
|
||||||
void protocol_modbus_bcu_init(void * const mb_item,uint16_t addr);
|
void protocol_modbus_bcu_init(void * const mb_item,uint16_t addr);
|
||||||
void protocol_modbus_demo(void * const mb_item,uint16_t addr);
|
void protocol_modbus_demo(void * const mb_item,uint16_t addr);
|
||||||
void protocol_can_bcu_init(can_dev_e can);
|
//void protocol_can_bcu_init(can_dev_e can);
|
||||||
void protocol_pylon_can_init(can_dev_e can);
|
void protocol_pylon_can_init(can_dev_e can);
|
||||||
void protocol_can_invt_pcs_init(can_dev_e can);
|
void protocol_can_invt_pcs_init(can_dev_e can);
|
||||||
|
|
||||||
|
|
|
@ -448,8 +448,8 @@ uint16_t bcu_total_cfg_fill(uint16_t start_addr, uint8_t reg_num, uint8_t *buf)
|
||||||
uint16_t address = 0,data = 0;
|
uint16_t address = 0,data = 0;
|
||||||
int32_t year,mon,day,hour,min,sec;
|
int32_t year,mon,day,hour,min,sec;
|
||||||
uint32_t addr = 0;
|
uint32_t addr = 0;
|
||||||
//drv_rtc_get_date(&year, &mon, &day);
|
drv_rtc_get_date(&year, &mon, &day);
|
||||||
//drv_rtc_get_time(&hour, &min, &sec);
|
drv_rtc_get_time(&hour, &min, &sec);
|
||||||
|
|
||||||
for(address = start_addr; address < start_addr + reg_num; address++)
|
for(address = start_addr; address < start_addr + reg_num; address++)
|
||||||
{
|
{
|
||||||
|
@ -720,7 +720,7 @@ uint16_t bcu_total_cfg_fill(uint16_t start_addr, uint8_t reg_num, uint8_t *buf)
|
||||||
break;
|
break;
|
||||||
case 3149: // 系统时间(s)
|
case 3149: // 系统时间(s)
|
||||||
data = 0;
|
data = 0;
|
||||||
//drv_rtc_set_tick(bcu_holding_reg.sys_time);
|
drv_rtc_set_tick(bcu_holding_reg.sys_time);
|
||||||
break;
|
break;
|
||||||
case 3150: // 系统时间(s)
|
case 3150: // 系统时间(s)
|
||||||
data = year;
|
data = year;
|
||||||
|
|
|
@ -1172,7 +1172,7 @@ void mqtt_publish_bms_data(uint32_t basetime)
|
||||||
// drv_mqtt_publish_no_respose("1", 1);
|
// drv_mqtt_publish_no_respose("1", 1);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// 定期检测是否蓝牙断连--???
|
// 定期检测是否蓝牙断连
|
||||||
if (!drv_at_send_cmd("AT+QBLESTAT", "ADVERTISING\0", WIFI_TIMEOUT))
|
if (!drv_at_send_cmd("AT+QBLESTAT", "ADVERTISING\0", WIFI_TIMEOUT))
|
||||||
{
|
{
|
||||||
if (!drv_at_send_cmd("AT+QBLESTAT", "CONNECTED\0", WIFI_TIMEOUT))
|
if (!drv_at_send_cmd("AT+QBLESTAT", "CONNECTED\0", WIFI_TIMEOUT))
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue