添加部分HY协议,完善充电控制
This commit is contained in:
parent
0929ac0d96
commit
031d6b747e
|
@ -25,6 +25,9 @@
|
|||
"checktime.h": "c",
|
||||
"test.h": "c",
|
||||
"task.h": "c",
|
||||
"other.h": "c"
|
||||
"other.h": "c",
|
||||
"hy_protocol.h": "c",
|
||||
"cfg_protocol.h": "c",
|
||||
"chargcontrolenum.h": "c"
|
||||
}
|
||||
}
|
|
@ -6,6 +6,9 @@
|
|||
#include "uart_dev.h"
|
||||
|
||||
|
||||
#define buffLen 100
|
||||
extern uint8_t rs485_buff[buffLen];
|
||||
|
||||
void GW485_comm(void);
|
||||
void BAT485_comm(void);
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
#ifndef BL_CFG_PROTOCOL_H_
|
||||
#define BL_CFG_PROTOCOL_H_
|
||||
|
||||
#include "comm_types.h"
|
||||
|
||||
void inConfigBuff(uint8_t c);
|
||||
void zeroConfigBuff(void);
|
||||
uint16_t checkModebusCrc(uint8_t *arr_buff, uint8_t len);
|
||||
void read_and_process_config_data(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
#ifndef BL_HY_PROTOCOL_H_
|
||||
#define BL_HY_PROTOCOL_H_
|
||||
|
||||
#include "uart_dev.h"
|
||||
|
||||
BOOL getHYconfigModeState(void);
|
||||
void setHYconfigModeState(BOOL state);
|
||||
|
||||
void HY_read_and_process_uart_data(device_handle device);
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -23,8 +23,8 @@ typedef struct _recv_config_info{
|
|||
uint8_t protocolType; /* 协议类型; 0x01表示:汇源协议(波特率9600) 0x02表示:南瑞协议(波特率115200)*/
|
||||
|
||||
|
||||
// uint8_t CommunicationProtocolType; /* 0x00:SL
|
||||
// 0x01:HY*/
|
||||
uint8_t CommunicationProtocolType; /* 0x00:SL
|
||||
0x01:HY*/
|
||||
uint8_t onlyPower; /* 是否只充当电源板:0x00:不是
|
||||
0x01:是*/
|
||||
|
||||
|
@ -61,8 +61,8 @@ typedef struct _config_info{
|
|||
uint8_t communicationID[4]; /* 通信ID */
|
||||
uint8_t protocolType; /* 协议类型; 0x01表示:汇源协议(波特率9600) 0x02表示:南瑞协议(波特率115200)*/
|
||||
|
||||
// uint8_t CommunicationProtocolType; /* 0x00:SL
|
||||
// 0x01:HY*/
|
||||
uint8_t CommunicationProtocolType; /* 0x00:SL
|
||||
0x01:HY*/
|
||||
uint8_t onlyPower; /* 是否只充当电源板:0x00:不是
|
||||
0x01:是*/
|
||||
|
||||
|
@ -98,7 +98,6 @@ typedef struct _config_info{
|
|||
void save_config_info(config_info *save_config_info);
|
||||
void read_config_info(config_info *output_config_info);
|
||||
void config_info_start(void);
|
||||
// void read_and_process_config_data(void);
|
||||
|
||||
void saveLoopImpedance(float *loopImpedance);
|
||||
void readLoopImpedance(float *loopImpedance);
|
||||
|
|
|
@ -10,10 +10,7 @@ void task_Init(void);
|
|||
|
||||
void beginStartControlTask(void);
|
||||
void beginSoftStartTask(void);
|
||||
|
||||
|
||||
|
||||
|
||||
void beginHYconfigMode(void);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ void mppt_constantVoltageO(float OutVoltage)
|
|||
/* 当有电池时,输出电压的曲线是先上升后下降 */
|
||||
if (lastDutyRatio >= getDutyRatio()) {
|
||||
// if (lastVolt >= outVolt) {
|
||||
setDutyRatio((getDutyRatio() - StepPwm));
|
||||
setDutyRatio((getDutyRatio() + StepPwm));
|
||||
// } else {
|
||||
// g_controlParameter.dutyRatio -= StepPwm;
|
||||
// }
|
||||
|
@ -104,7 +104,7 @@ void mppt_constantVoltageO(float OutVoltage)
|
|||
// } else {
|
||||
// g_controlParameter.dutyRatio += StepPwm;
|
||||
// }
|
||||
setDutyRatio((getDutyRatio() + StepPwm));
|
||||
setDutyRatio((getDutyRatio() - StepPwm));
|
||||
}
|
||||
|
||||
// lastVolt = outVolt;
|
||||
|
@ -312,15 +312,15 @@ void mppt_readJust(void)
|
|||
// static float kp = 0.005;
|
||||
// static float ki = 0.00001;
|
||||
|
||||
static float stepV1 = 0.5;
|
||||
static float stepV2 = 0.2;
|
||||
static float stepV1 = 0.2;
|
||||
static float stepV2 = 0.1;
|
||||
|
||||
static uint8_t flag1 = 0; //表明上次运算是加还是减
|
||||
|
||||
/* 延时一段时间才判断 */
|
||||
static uint16_t flag = 0;
|
||||
flag++;
|
||||
if (flag < 150) {
|
||||
if (flag < 50) {
|
||||
// float pv1Volt = getSolarInCircuitVoltage();
|
||||
// float error = pv1Volt - SolarInCircuitV;
|
||||
// float stepPwm = kp * error + ki * pv1Volt;
|
||||
|
@ -342,7 +342,7 @@ void mppt_readJust(void)
|
|||
|
||||
// if ((lPower + 0.7 < Power) && (lLPower + 0.7 < Power) && (lLLPower + 0.7 < Power)) {
|
||||
// if ((lPower + 0.7 < Power) && (lLPower + 0.7 < Power)) {
|
||||
if ((lPower + 0.3f < Power)) {
|
||||
if ((lPower + 1.0f < Power)) {
|
||||
if (powerT > 5) {
|
||||
if (flag1) {
|
||||
SolarInCircuitV += stepV1;
|
||||
|
@ -362,7 +362,7 @@ void mppt_readJust(void)
|
|||
}
|
||||
// } else if ((lPower - 0.7 > Power) && (lLPower - 0.7 > Power) && (lLLPower - 0.7 > Power)) {
|
||||
// } else if ((lPower - 0.7 > Power) && (lLPower - 0.7 > Power)) {
|
||||
} else if ((lPower - 0.3f > Power)) {
|
||||
} else if ((lPower - 1.0f > Power)) {
|
||||
if (powerT > 5) {
|
||||
if (flag1) {
|
||||
SolarInCircuitV -= stepV1;
|
||||
|
@ -382,8 +382,8 @@ void mppt_readJust(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (SolarInCircuitV > 18.5f) {
|
||||
SolarInCircuitV = 18.5f;
|
||||
if (SolarInCircuitV > 20.0f) {
|
||||
SolarInCircuitV = 20.0f;
|
||||
}
|
||||
else if (SolarInCircuitV < 16.0f) {
|
||||
SolarInCircuitV = 16.0f;
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
|
||||
#include "bl_comm.h"
|
||||
#include "uart_dev.h"
|
||||
|
||||
|
||||
uint8_t rs485_buff[buffLen]={0x00};
|
||||
|
||||
|
||||
|
||||
|
@ -18,12 +20,28 @@ void BAT485_comm(void)
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief gw485串口接收中断回调函数
|
||||
* @param
|
||||
* @retval
|
||||
*
|
||||
*/
|
||||
void gw485_RxIt(void)
|
||||
{
|
||||
|
||||
uart_device_info *dev = (uart_device_info *)g_gw485_uart2_handle;
|
||||
if(!RingQueueFull(&dev->uart_ring_queue))
|
||||
InRingQueue(&dev->uart_ring_queue, rx_gw485_buf[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief bat485串口接收中断回调函数
|
||||
* @param
|
||||
* @retval
|
||||
*
|
||||
*/
|
||||
void bat485_RxIt(void)
|
||||
{
|
||||
|
||||
uart_device_info *dev = (uart_device_info *)g_bat485_uart3_handle;
|
||||
if(!RingQueueFull(&dev->uart_ring_queue))
|
||||
InRingQueue(&dev->uart_ring_queue, rx_bat485_buf[0]);
|
||||
}
|
|
@ -0,0 +1,406 @@
|
|||
|
||||
#include "cfg_protocol.h"
|
||||
#include "uart_dev.h"
|
||||
#include "inFlash.h"
|
||||
#include "parameter.h"
|
||||
#include "string.h"
|
||||
#include "chargControlEnum.h"
|
||||
|
||||
#define cfgBuffLen 200
|
||||
uint8_t configBuff[cfgBuffLen];
|
||||
uint8_t cfigLen = 0;
|
||||
|
||||
/* 配置文件中的部分数据放大倍数 */
|
||||
#define enlargeScale 100
|
||||
|
||||
/**
|
||||
* @brief 向配置文件buff中存入一个数据
|
||||
* @param c 数据
|
||||
* @retval
|
||||
*
|
||||
*/
|
||||
void inConfigBuff(uint8_t c)
|
||||
{
|
||||
if (cfigLen < cfgBuffLen) {
|
||||
configBuff[cfigLen] = c;
|
||||
cfigLen++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 向配置文件buff中丢掉一个数据
|
||||
* @param
|
||||
* @retval
|
||||
*
|
||||
*/
|
||||
void outConfigBuff(void)
|
||||
{
|
||||
if (cfigLen > 0) {
|
||||
cfigLen--;
|
||||
memcpy(configBuff, configBuff + 1, cfigLen - 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief modbus的crc校验
|
||||
* @param *arr_buff 需要校验的数据
|
||||
* len 数据长度
|
||||
* @retval crc 校验的结果
|
||||
*/
|
||||
uint16_t checkModebusCrc(uint8_t *arr_buff, uint8_t len)
|
||||
{
|
||||
uint16_t crc = 0xFFFF;
|
||||
uint16_t i, j;
|
||||
for (j = 0; j < len; ++j) {
|
||||
crc = crc ^ (*arr_buff++);
|
||||
for (i = 0; i < 8; ++i) {
|
||||
if ((crc&0x0001) > 0) {
|
||||
crc = crc >> 1;
|
||||
crc = crc ^ 0xa001;
|
||||
}
|
||||
else {
|
||||
crc = crc >> 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 清空配置文件buff
|
||||
* @param
|
||||
* @retval
|
||||
*
|
||||
*/
|
||||
void zeroConfigBuff(void)
|
||||
{
|
||||
cfigLen = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 判断接收到的配置文件数据是否正确,正确的话存入flash中
|
||||
* @param None
|
||||
* @retval None
|
||||
*
|
||||
*/
|
||||
void read_and_process_config_data(void)
|
||||
{
|
||||
recv_config_info *pack = (recv_config_info *)cfgBuffLen;
|
||||
static config_info save_configInfo;
|
||||
while (cfigLen >= RECV_CONFIG_INFO) {
|
||||
/* 判断起始标志是否正确 */
|
||||
if (pack->start_Flag[0] != g_cfgParameter.startFlagSL[0]
|
||||
|| pack->start_Flag[1] != g_cfgParameter.startFlagSL[1]) {
|
||||
// debug(" start_Flag : 0x%x, 0x%x \n", pack->start_Flag[0], pack->start_Flag[1]);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断接入节点类型是否正确 */
|
||||
save_configInfo.Access_Node_Type = (uint16_t)pack->Access_Node_Type[0] << 8
|
||||
| (uint16_t)pack->Access_Node_Type[1];
|
||||
// debug(" Access_Node_Type : 0x%x \n", save_configInfo.Access_Node_Type);
|
||||
if (save_configInfo.Access_Node_Type != POWERBOX) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断通信方式是否正确 */
|
||||
save_configInfo.Communication_Methods = (uint16_t)pack->Communication_Methods[0] << 8
|
||||
| (uint16_t)pack->Communication_Methods[1];
|
||||
// debug(" Communication_Methods : 0x%x \n", save_configInfo.Communication_Methods);
|
||||
// if (temp_u16 != RS485 || temp_u16 != RJ45) {
|
||||
if (save_configInfo.Communication_Methods != RS485) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断波特率是否正确 */
|
||||
save_configInfo.gw485_Baud = (uint32_t)pack->gw485_Baud[0] << 24
|
||||
| (uint32_t)pack->gw485_Baud[1] << 16
|
||||
| (uint32_t)pack->gw485_Baud[2] << 8
|
||||
| (uint32_t)pack->gw485_Baud[3];
|
||||
// debug(" gw485_Baud : 0x%x, %d \n", save_configInfo.gw485_Baud, save_configInfo.gw485_Baud);
|
||||
if (save_configInfo.gw485_Baud != 9600 && save_configInfo.gw485_Baud != 115200) {
|
||||
// if (save_configInfo.gw485_Baud != 0x2580 || save_configInfo.gw485_Baud != 115200) {
|
||||
// debug(" error : %d\n", save_configInfo.gw485_Baud);
|
||||
goto err;
|
||||
}
|
||||
|
||||
save_configInfo.bat485_Baud = (uint32_t)pack->bat485_Baud[0] << 24
|
||||
| (uint32_t)pack->bat485_Baud[1] << 16
|
||||
| (uint32_t)pack->bat485_Baud[2] << 8
|
||||
| (uint32_t)pack->bat485_Baud[3];
|
||||
// debug(" bat485_Baud : 0x%x, %d \n", save_configInfo.bat485_Baud, save_configInfo.bat485_Baud);
|
||||
if (save_configInfo.bat485_Baud != 9600 && save_configInfo.bat485_Baud!= 115200 && save_configInfo.bat485_Baud!= 0) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断协议类型是否正确 */
|
||||
if (pack->protocolType != 0x01 && pack->protocolType != 0x02) {
|
||||
goto err;
|
||||
}
|
||||
// debug(" protocolType : 0x%x \n", pack->protocolType);
|
||||
|
||||
/* 判断通信协议类型是否正确 */
|
||||
if (pack->CommunicationProtocolType != 0x00 && pack->CommunicationProtocolType != 0x01) {
|
||||
goto err;
|
||||
}
|
||||
// debug(" CommunicationProtocolType : 0x%x \n", pack->CommunicationProtocolType);
|
||||
|
||||
|
||||
/* 判断电源盒类型是否正确 */
|
||||
if (pack->onlyPower != 0x00 && pack->onlyPower != 0x01) {
|
||||
goto err;
|
||||
}
|
||||
// debug(" onlyPower : 0x%x \n", pack->onlyPower);
|
||||
|
||||
/* 判断恒压充电阈值是否正确 */
|
||||
save_configInfo.constantVoltageV =
|
||||
(float)(pack->ConstantVoltageV[0] << 8 | pack->ConstantVoltageV[1]) / enlargeScale;
|
||||
// debug(" constantVoltageV : %f \n", save_configInfo.constantVoltageV);
|
||||
if (save_configInfo.constantVoltageV > (float)14.4 || save_configInfo.constantVoltageV < (float)13.5) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断浮充充电阈值是否正确 */
|
||||
save_configInfo.floatI = (float)(pack->FloatI[0] << 8 | pack->FloatI[1]) / enlargeScale;
|
||||
// debug(" floatI : %f \n", save_configInfo.floatI);
|
||||
if (save_configInfo.floatI > (float)0.2 || save_configInfo.floatI < (float)0) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断太阳能板开路启动电压是否正确 */
|
||||
save_configInfo.startSolarOpenCircuitV =
|
||||
(float)(pack->startSolarOpenCircuitV[0] << 8 | pack->startSolarOpenCircuitV[1]) / enlargeScale;
|
||||
// debug(" startSolarOpenCircuitV : %f \n", save_configInfo.startSolarOpenCircuitV);
|
||||
if (save_configInfo.startSolarOpenCircuitV > 24 || save_configInfo.startSolarOpenCircuitV < 14) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断太阳能板关闭电压是否正确 */
|
||||
save_configInfo.stopSolarOpenCircuitV =
|
||||
(float)(pack->stopSolarOpenCircuitV[0] << 8 | pack->stopSolarOpenCircuitV[1]) / enlargeScale;
|
||||
// debug(" stopSolarOpenCircuitV : %f \n", save_configInfo.stopSolarOpenCircuitV);
|
||||
if (save_configInfo.stopSolarOpenCircuitV > 17 || save_configInfo.stopSolarOpenCircuitV < 13) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断恒压充电时的输出电压是否正确 */
|
||||
save_configInfo.constantVoltageChargeV =
|
||||
(float)(pack->constantVoltageChargeV[0] << 8 | pack->constantVoltageChargeV[1]) / enlargeScale;
|
||||
// debug(" constantVoltageChargeV : %f \n", save_configInfo.constantVoltageChargeV);
|
||||
if (save_configInfo.constantVoltageChargeV > (float)14.6 || save_configInfo.constantVoltageChargeV < (float)14) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断浮充充电时的输出电压是否正确 */
|
||||
save_configInfo.FloatChargeV =
|
||||
(float)(pack->FloatChargeV[0] << 8 | pack->FloatChargeV[1]) / enlargeScale;
|
||||
// debug(" FloatChargeV : %f \n", save_configInfo.FloatChargeV);
|
||||
if (save_configInfo.FloatChargeV > (float)14.4 || save_configInfo.FloatChargeV < (float)13.8) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断mos管停止工作温度是否正确 */
|
||||
save_configInfo.HighSideMosTemperature_stop =
|
||||
(float)(pack->HighSideMosTemperature_stop[0] << 8 | pack->HighSideMosTemperature_stop[1]) / enlargeScale;
|
||||
// debug(" HighSideMosTemperature_stop : %f \n", save_configInfo.HighSideMosTemperature_stop);
|
||||
if (save_configInfo.HighSideMosTemperature_stop < 60) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断mos管降低工作功率工作温度是否正确 */
|
||||
save_configInfo.HighSideMosTemperature_end =
|
||||
(float)(pack->HighSideMosTemperature_end[0] << 8 | pack->HighSideMosTemperature_end[1]) / enlargeScale;
|
||||
// debug(" HighSideMosTemperature_end : %f \n", save_configInfo.HighSideMosTemperature_end));
|
||||
if (save_configInfo.HighSideMosTemperature_end < 50) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断mos管完全恢复工作温度是否正确 */
|
||||
save_configInfo.HighSideMosTemperature_start =
|
||||
(float)(pack->HighSideMosTemperature_start[0] << 8 | pack->HighSideMosTemperature_start[1]) / enlargeScale;
|
||||
// debug(" HighSideMosTemperature_start : %d \n", save_configInfo.HighSideMosTemperature_start);
|
||||
if (save_configInfo.HighSideMosTemperature_start < 40) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断启动任务中太阳能板开路电压检测间隔时间是否正确 */
|
||||
save_configInfo.checkSolarOpenCircuitVTime =
|
||||
pack->checkSolarOpenCircuitVTime[0] << 8 | pack->checkSolarOpenCircuitVTime[1];
|
||||
// debug(" checkSolarOpenCircuitVTime : %d \n", save_configInfo.checkSolarOpenCircuitVTime);
|
||||
if (save_configInfo.checkSolarOpenCircuitVTime > 1800 || save_configInfo.checkSolarOpenCircuitVTime < 5) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断传感器运行再次注册的间隔是否正确 */
|
||||
save_configInfo.sensorEnableBroadcastTime =
|
||||
pack->sensorEnableBroadcastTime[0] << 8 | pack->sensorEnableBroadcastTime[1];
|
||||
// debug(" sensorEnableBroadcastTime : %d \n", save_configInfo.sensorEnableBroadcastTime);
|
||||
if (save_configInfo.sensorEnableBroadcastTime > 60 || save_configInfo.sensorEnableBroadcastTime < 10) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断出现短路保护后延长该段时间再次检测是否短路,仍然短路则关闭输出的间隔是否正确 */
|
||||
save_configInfo.outputAgainFlagTime =
|
||||
pack->outputAgainFlagTime[0] << 8 | pack->outputAgainFlagTime[1];
|
||||
// debug(" outputAgainFlagTime : %d \n", save_configInfo.outputAgainFlagTime);
|
||||
if (save_configInfo.sensorEnableBroadcastTime > 30 || save_configInfo.sensorEnableBroadcastTime < 5) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断出现过载后,在该间隔时间中多次(2次)出现过载,则关闭输出的间隔是否正确 */
|
||||
save_configInfo.excessiveLoadFlagTime =
|
||||
pack->excessiveLoadFlagTime[0] << 8 | pack->excessiveLoadFlagTime[1];
|
||||
// debug(" excessiveLoadFlagTime : %d \n", save_configInfo.excessiveLoadFlagTime);
|
||||
if (save_configInfo.excessiveLoadFlagTime > 90 || save_configInfo.excessiveLoadFlagTime < 30) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断出现过载过载保护后,在该间隔段时间后,再次尝试输出的间隔是否正确 */
|
||||
save_configInfo.eLAgainTime = pack->eLAgainTime[0] << 8 | pack->eLAgainTime[1];
|
||||
// debug(" eLAgainTime : %d \n", save_configInfo.eLAgainTime);
|
||||
if (save_configInfo.eLAgainTime > 3000 || save_configInfo.eLAgainTime < 1000) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* crc校验 */
|
||||
save_configInfo.crc = pack->crc[0] << 8 | pack->crc[1];
|
||||
// debug(" crc : %x%x \n", pack->crc[0], pack->crc[1]);
|
||||
if (save_configInfo.crc != checkModebusCrc(configBuff, RECV_CONFIG_INFO - 3)) {
|
||||
// debug(" checkModebusCrc : %x \n", checkModebusCrc(configBuff, RECV_CONFIG_INFO));
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
||||
/* 结束标志 */
|
||||
// debug(" end_Flag : %x \n", pack->end_Flag);
|
||||
if (pack->end_Flag != 0x16) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
// debug("address : 0x %x %x %x %x %x %x %x\n", pack->address[0]
|
||||
// , pack->address[1], pack->address[2], pack->address[3]
|
||||
// , pack->address[4], pack->address[5], pack->address[6]);
|
||||
config_info temp_configInfo;
|
||||
read_config_info(&temp_configInfo);
|
||||
|
||||
if (pack->address[0] != 0xFF
|
||||
|| pack->address[1] != 0xFF
|
||||
|| pack->address[2] != 0xFF
|
||||
|| pack->address[3] != 0xFF
|
||||
|| pack->address[4] != 0xFF
|
||||
|| pack->address[5] != 0xFF
|
||||
|| pack->address[6] != 0xFF) {
|
||||
save_configInfo.address[0] = pack->address[0];
|
||||
save_configInfo.address[1] = pack->address[1];
|
||||
save_configInfo.address[2] = pack->address[2];
|
||||
save_configInfo.address[3] = pack->address[3];
|
||||
save_configInfo.address[4] = pack->address[4];
|
||||
save_configInfo.address[5] = pack->address[5];
|
||||
save_configInfo.address[6] = pack->address[6];
|
||||
// debug("address : 0x %x %x %x %x %x %x %x\n", save_configInfo.address[0]
|
||||
// , save_configInfo.address[1], save_configInfo.address[2], save_configInfo.address[3]
|
||||
// , save_configInfo.address[4], save_configInfo.address[5], save_configInfo.address[6]);
|
||||
} else {
|
||||
save_configInfo.address[0] = temp_configInfo.address[0];
|
||||
save_configInfo.address[1] = temp_configInfo.address[1];
|
||||
save_configInfo.address[2] = temp_configInfo.address[2];
|
||||
save_configInfo.address[3] = temp_configInfo.address[3];
|
||||
save_configInfo.address[4] = temp_configInfo.address[4];
|
||||
save_configInfo.address[5] = temp_configInfo.address[5];
|
||||
save_configInfo.address[6] = temp_configInfo.address[6];
|
||||
}
|
||||
|
||||
if (pack->hardwareID[0] != 0xFF
|
||||
|| pack->hardwareID[1] != 0xFF
|
||||
|| pack->hardwareID[2] != 0xFF
|
||||
|| pack->hardwareID[3] != 0xFF
|
||||
|| pack->hardwareID[4] != 0xFF
|
||||
|| pack->hardwareID[5] != 0xFF) {
|
||||
save_configInfo.hardwareID[0] = pack->hardwareID[0];
|
||||
save_configInfo.hardwareID[1] = pack->hardwareID[1];
|
||||
save_configInfo.hardwareID[2] = pack->hardwareID[2];
|
||||
save_configInfo.hardwareID[3] = pack->hardwareID[3];
|
||||
save_configInfo.hardwareID[4] = pack->hardwareID[4];
|
||||
save_configInfo.hardwareID[5] = pack->hardwareID[5];
|
||||
} else {
|
||||
save_configInfo.hardwareID[0] = temp_configInfo.hardwareID[0];
|
||||
save_configInfo.hardwareID[1] = temp_configInfo.hardwareID[1];
|
||||
save_configInfo.hardwareID[2] = temp_configInfo.hardwareID[2];
|
||||
save_configInfo.hardwareID[3] = temp_configInfo.hardwareID[3];
|
||||
save_configInfo.hardwareID[4] = temp_configInfo.hardwareID[4];
|
||||
save_configInfo.hardwareID[5] = temp_configInfo.hardwareID[5];
|
||||
}
|
||||
|
||||
if (pack->communicationID[0] != 0xFF
|
||||
|| pack->communicationID[1] != 0xFF
|
||||
|| pack->communicationID[2] != 0xFF
|
||||
|| pack->communicationID[3] != 0xFF) {
|
||||
save_configInfo.communicationID[0] = pack->communicationID[0];
|
||||
save_configInfo.communicationID[1] = pack->communicationID[1];
|
||||
save_configInfo.communicationID[2] = pack->communicationID[2];
|
||||
save_configInfo.communicationID[3] = pack->communicationID[3];
|
||||
} else {
|
||||
save_configInfo.communicationID[0] = temp_configInfo.communicationID[0];
|
||||
save_configInfo.communicationID[1] = temp_configInfo.communicationID[1];
|
||||
save_configInfo.communicationID[2] = temp_configInfo.communicationID[2];
|
||||
save_configInfo.communicationID[3] = temp_configInfo.communicationID[3];
|
||||
}
|
||||
|
||||
save_configInfo.protocolType = pack->protocolType;
|
||||
|
||||
save_configInfo.CommunicationProtocolType = pack->CommunicationProtocolType;
|
||||
|
||||
save_configInfo.onlyPower = pack->onlyPower;
|
||||
|
||||
save_configInfo.crc = checkModebusCrc((uint8_t *)&save_configInfo, CONFIG_INFO_SIZE - 2);
|
||||
save_backups_config_info(&save_configInfo);
|
||||
save_config_info(&save_configInfo);
|
||||
|
||||
// memset(config_buff, 0, sizeof(config_buff));
|
||||
zeroConfigBuff();
|
||||
|
||||
// /* 返回更改配置文件成功 */
|
||||
// SL_Mppt_SOther_pack SUpdateProfile_pack = {0};
|
||||
|
||||
// SUpdateProfile_pack.start_Flag[0] = g_otherParameter.startFlagSL[0];
|
||||
// SUpdateProfile_pack.start_Flag[1] = g_otherParameter.startFlagSL[1];
|
||||
|
||||
// SUpdateProfile_pack.address[0] = save_configInfo.address[0];
|
||||
// SUpdateProfile_pack.address[1] = save_configInfo.address[1];
|
||||
// SUpdateProfile_pack.address[2] = save_configInfo.address[2];
|
||||
// SUpdateProfile_pack.address[3] = save_configInfo.address[3];
|
||||
// SUpdateProfile_pack.address[4] = save_configInfo.address[4];
|
||||
// SUpdateProfile_pack.address[5] = save_configInfo.address[5];
|
||||
// SUpdateProfile_pack.address[6] = save_configInfo.address[6];
|
||||
|
||||
// SUpdateProfile_pack.function_Code = SL_Function_Code_Update_Profile;
|
||||
|
||||
// SUpdateProfile_pack.state = 0x01;
|
||||
|
||||
// uint16_t crc = CheckFuncSL((uint8_t *)&SUpdateProfile_pack, SL_MPPT_SOTHER_PACK_SIZE - 3);
|
||||
// SUpdateProfile_pack.check_Bit_H = crc >> 8;
|
||||
// SUpdateProfile_pack.check_Bit_L = crc;
|
||||
|
||||
// SUpdateProfile_pack.end_Flag = g_otherParameter.endFlagSL;
|
||||
|
||||
// while (1) {
|
||||
// if (!Check_485_bus_busy(g_gw485_uart4_handle)) {
|
||||
// uart_dev_write(g_gw485_uart4_handle, (uint8_t *)&SUpdateProfile_pack, SL_MPPT_SOTHER_PACK_SIZE);
|
||||
// USART_ITConfig(USART3, USART_IT_RXNE, ENABLE);
|
||||
// break;
|
||||
// }
|
||||
// Delay_Ms(randomDelay());
|
||||
// }
|
||||
|
||||
/* 复位 */
|
||||
NVIC_SystemReset();
|
||||
|
||||
return;
|
||||
|
||||
err:
|
||||
// config_buff_pos--;
|
||||
// memcpy(config_buff, config_buff + 1, sizeof(config_buff) - 1);
|
||||
outConfigBuff();
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -3,32 +3,6 @@
|
|||
#include "parameter.h"
|
||||
#include "pDebug.h"
|
||||
|
||||
// static uint8_t config_buff[200];
|
||||
// static uint8_t config_buff_pos = 0;
|
||||
|
||||
/**
|
||||
* @brief 校验算法, modebus
|
||||
* @param
|
||||
* @retval
|
||||
*/
|
||||
static uint16_t configCheckFunc(uint8_t *arr_buff, uint8_t len)
|
||||
{
|
||||
uint16_t crc = 0xFFFF;
|
||||
uint16_t i, j;
|
||||
for (j = 0; j < len; ++j) {
|
||||
crc = crc ^ (*arr_buff++);
|
||||
for (i = 0; i < 8; ++i) {
|
||||
if ((crc&0x0001) > 0) {
|
||||
crc = crc >> 1;
|
||||
crc = crc ^ 0xa001;
|
||||
}
|
||||
else {
|
||||
crc = crc >> 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 保存配置信息
|
||||
|
@ -224,332 +198,6 @@ void config_info_start(void)
|
|||
totalChargCapacityInt(fTemp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 判断接收到的配置文件数据是否正确,正确的话存入flash中
|
||||
* @param None
|
||||
* @retval None
|
||||
*
|
||||
*/
|
||||
// #define enlargeScale 100
|
||||
// BOOL read_and_process_config_data(uint8_t *config_buff[])
|
||||
// {
|
||||
// recv_config_info *pack = (recv_config_info *)*config_buff;
|
||||
// config_info save_configInfo;
|
||||
// while (config_buff_pos >= RECV_CONFIG_INFO) {
|
||||
// /* 判断起始标志是否正确 */
|
||||
// if (pack->start_Flag[0] != g_cfgParameter.startFlagSL[0]
|
||||
// || pack->start_Flag[1] != g_cfgParameter.startFlagSL[1]) {
|
||||
// // debug(" start_Flag : 0x%x, 0x%x \n", pack->start_Flag[0], pack->start_Flag[1]);
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* 判断接入节点类型是否正确 */
|
||||
// save_configInfo.Access_Node_Type = (uint16_t)pack->Access_Node_Type[0] << 8
|
||||
// | (uint16_t)pack->Access_Node_Type[1];
|
||||
// // debug(" Access_Node_Type : 0x%x \n", save_configInfo.Access_Node_Type);
|
||||
// if (save_configInfo.Access_Node_Type != POWERBOX) {
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* 判断通信方式是否正确 */
|
||||
// save_configInfo.Communication_Methods = (uint16_t)pack->Communication_Methods[0] << 8
|
||||
// | (uint16_t)pack->Communication_Methods[1];
|
||||
// // debug(" Communication_Methods : 0x%x \n", save_configInfo.Communication_Methods);
|
||||
// // if (temp_u16 != RS485 || temp_u16 != RJ45) {
|
||||
// if (save_configInfo.Communication_Methods != RS485) {
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* 判断波特率是否正确 */
|
||||
// save_configInfo.gw485_Baud = (uint32_t)pack->gw485_Baud[0] << 24
|
||||
// | (uint32_t)pack->gw485_Baud[1] << 16
|
||||
// | (uint32_t)pack->gw485_Baud[2] << 8
|
||||
// | (uint32_t)pack->gw485_Baud[3];
|
||||
// // debug(" gw485_Baud : 0x%x, %d \n", save_configInfo.gw485_Baud, save_configInfo.gw485_Baud);
|
||||
// if (save_configInfo.gw485_Baud != 9600 && save_configInfo.gw485_Baud != 115200) {
|
||||
// // if (save_configInfo.gw485_Baud != 0x2580 || save_configInfo.gw485_Baud != 115200) {
|
||||
// // debug(" error : %d\n", save_configInfo.gw485_Baud);
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// save_configInfo.bat485_Baud = (uint32_t)pack->bat485_Baud[0] << 24
|
||||
// | (uint32_t)pack->bat485_Baud[1] << 16
|
||||
// | (uint32_t)pack->bat485_Baud[2] << 8
|
||||
// | (uint32_t)pack->bat485_Baud[3];
|
||||
// // debug(" bat485_Baud : 0x%x, %d \n", save_configInfo.bat485_Baud, save_configInfo.bat485_Baud);
|
||||
// if (save_configInfo.bat485_Baud != 9600 && save_configInfo.bat485_Baud!= 115200 && save_configInfo.bat485_Baud!= 0) {
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* 判断协议类型是否正确 */
|
||||
// if (pack->protocolType != 0x01 && pack->protocolType != 0x02) {
|
||||
// goto err;
|
||||
// }
|
||||
// // debug(" protocolType : 0x%x \n", pack->protocolType);
|
||||
|
||||
/* 判断通信协议类型是否正确 */
|
||||
/*
|
||||
if (pack->CommunicationProtocolType != 0x00 && pack->CommunicationProtocolType != 0x01) {
|
||||
goto err;
|
||||
}
|
||||
// debug(" CommunicationProtocolType : 0x%x \n", pack->CommunicationProtocolType);
|
||||
*/
|
||||
|
||||
// /* 判断电源盒类型是否正确 */
|
||||
// if (pack->onlyPower != 0x00 && pack->onlyPower != 0x01) {
|
||||
// goto err;
|
||||
// }
|
||||
// // debug(" onlyPower : 0x%x \n", pack->onlyPower);
|
||||
|
||||
// /* 判断恒压充电阈值是否正确 */
|
||||
// save_configInfo.constantVoltageV =
|
||||
// (float)(pack->ConstantVoltageV[0] << 8 | pack->ConstantVoltageV[1]) / enlargeScale;
|
||||
// // debug(" constantVoltageV : %f \n", save_configInfo.constantVoltageV);
|
||||
// if (save_configInfo.constantVoltageV > (float)14.4 || save_configInfo.constantVoltageV < (float)13.5) {
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* 判断浮充充电阈值是否正确 */
|
||||
// save_configInfo.floatI = (float)(pack->FloatI[0] << 8 | pack->FloatI[1]) / enlargeScale;
|
||||
// // debug(" floatI : %f \n", save_configInfo.floatI);
|
||||
// if (save_configInfo.floatI > (float)0.2 || save_configInfo.floatI < (float)0) {
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* 判断太阳能板开路启动电压是否正确 */
|
||||
// save_configInfo.startSolarOpenCircuitV =
|
||||
// (float)(pack->startSolarOpenCircuitV[0] << 8 | pack->startSolarOpenCircuitV[1]) / enlargeScale;
|
||||
// // debug(" startSolarOpenCircuitV : %f \n", save_configInfo.startSolarOpenCircuitV);
|
||||
// if (save_configInfo.startSolarOpenCircuitV > 24 || save_configInfo.startSolarOpenCircuitV < 14) {
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* 判断太阳能板关闭电压是否正确 */
|
||||
// save_configInfo.stopSolarOpenCircuitV =
|
||||
// (float)(pack->stopSolarOpenCircuitV[0] << 8 | pack->stopSolarOpenCircuitV[1]) / enlargeScale;
|
||||
// // debug(" stopSolarOpenCircuitV : %f \n", save_configInfo.stopSolarOpenCircuitV);
|
||||
// if (save_configInfo.stopSolarOpenCircuitV > 17 || save_configInfo.stopSolarOpenCircuitV < 13) {
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* 判断恒压充电时的输出电压是否正确 */
|
||||
// save_configInfo.constantVoltageChargeV =
|
||||
// (float)(pack->constantVoltageChargeV[0] << 8 | pack->constantVoltageChargeV[1]) / enlargeScale;
|
||||
// // debug(" constantVoltageChargeV : %f \n", save_configInfo.constantVoltageChargeV);
|
||||
// if (save_configInfo.constantVoltageChargeV > (float)14.6 || save_configInfo.constantVoltageChargeV < (float)14) {
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* 判断浮充充电时的输出电压是否正确 */
|
||||
// save_configInfo.FloatChargeV =
|
||||
// (float)(pack->FloatChargeV[0] << 8 | pack->FloatChargeV[1]) / enlargeScale;
|
||||
// // debug(" FloatChargeV : %f \n", save_configInfo.FloatChargeV);
|
||||
// if (save_configInfo.FloatChargeV > (float)14.4 || save_configInfo.FloatChargeV < (float)13.8) {
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* 判断mos管停止工作温度是否正确 */
|
||||
// save_configInfo.HighSideMosTemperature_stop =
|
||||
// (float)(pack->HighSideMosTemperature_stop[0] << 8 | pack->HighSideMosTemperature_stop[1]) / enlargeScale;
|
||||
// // debug(" HighSideMosTemperature_stop : %f \n", save_configInfo.HighSideMosTemperature_stop);
|
||||
// if (save_configInfo.HighSideMosTemperature_stop < 60) {
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* 判断mos管降低工作功率工作温度是否正确 */
|
||||
// save_configInfo.HighSideMosTemperature_end =
|
||||
// (float)(pack->HighSideMosTemperature_end[0] << 8 | pack->HighSideMosTemperature_end[1]) / enlargeScale;
|
||||
// // debug(" HighSideMosTemperature_end : %f \n", save_configInfo.HighSideMosTemperature_end));
|
||||
// if (save_configInfo.HighSideMosTemperature_end < 50) {
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* 判断mos管完全恢复工作温度是否正确 */
|
||||
// save_configInfo.HighSideMosTemperature_start =
|
||||
// (float)(pack->HighSideMosTemperature_start[0] << 8 | pack->HighSideMosTemperature_start[1]) / enlargeScale;
|
||||
// // debug(" HighSideMosTemperature_start : %d \n", save_configInfo.HighSideMosTemperature_start);
|
||||
// if (save_configInfo.HighSideMosTemperature_start < 40) {
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* 判断启动任务中太阳能板开路电压检测间隔时间是否正确 */
|
||||
// save_configInfo.checkSolarOpenCircuitVTime =
|
||||
// pack->checkSolarOpenCircuitVTime[0] << 8 | pack->checkSolarOpenCircuitVTime[1];
|
||||
// // debug(" checkSolarOpenCircuitVTime : %d \n", save_configInfo.checkSolarOpenCircuitVTime);
|
||||
// if (save_configInfo.checkSolarOpenCircuitVTime > 1800 || save_configInfo.checkSolarOpenCircuitVTime < 5) {
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* 判断传感器运行再次注册的间隔是否正确 */
|
||||
// save_configInfo.sensorEnableBroadcastTime =
|
||||
// pack->sensorEnableBroadcastTime[0] << 8 | pack->sensorEnableBroadcastTime[1];
|
||||
// // debug(" sensorEnableBroadcastTime : %d \n", save_configInfo.sensorEnableBroadcastTime);
|
||||
// if (save_configInfo.sensorEnableBroadcastTime > 60 || save_configInfo.sensorEnableBroadcastTime < 10) {
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* 判断出现短路保护后延长该段时间再次检测是否短路,仍然短路则关闭输出的间隔是否正确 */
|
||||
// save_configInfo.outputAgainFlagTime =
|
||||
// pack->outputAgainFlagTime[0] << 8 | pack->outputAgainFlagTime[1];
|
||||
// // debug(" outputAgainFlagTime : %d \n", save_configInfo.outputAgainFlagTime);
|
||||
// if (save_configInfo.sensorEnableBroadcastTime > 30 || save_configInfo.sensorEnableBroadcastTime < 5) {
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* 判断出现过载后,在该间隔时间中多次(2次)出现过载,则关闭输出的间隔是否正确 */
|
||||
// save_configInfo.excessiveLoadFlagTime =
|
||||
// pack->excessiveLoadFlagTime[0] << 8 | pack->excessiveLoadFlagTime[1];
|
||||
// // debug(" excessiveLoadFlagTime : %d \n", save_configInfo.excessiveLoadFlagTime);
|
||||
// if (save_configInfo.excessiveLoadFlagTime > 90 || save_configInfo.excessiveLoadFlagTime < 30) {
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* 判断出现过载过载保护后,在该间隔段时间后,再次尝试输出的间隔是否正确 */
|
||||
// save_configInfo.eLAgainTime = pack->eLAgainTime[0] << 8 | pack->eLAgainTime[1];
|
||||
// // debug(" eLAgainTime : %d \n", save_configInfo.eLAgainTime);
|
||||
// if (save_configInfo.eLAgainTime > 3000 || save_configInfo.eLAgainTime < 1000) {
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* crc校验 */
|
||||
// save_configInfo.crc = pack->crc[0] << 8 | pack->crc[1];
|
||||
// // debug(" crc : %x%x \n", pack->crc[0], pack->crc[1]);
|
||||
// if (save_configInfo.crc != configCheckFunc(config_buff, RECV_CONFIG_INFO - 3)) {
|
||||
// // debug(" configCheckFunc : %x \n", configCheckFunc(config_buff, RECV_CONFIG_INFO));
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
|
||||
// /* 结束标志 */
|
||||
// // debug(" end_Flag : %x \n", pack->end_Flag);
|
||||
// if (pack->end_Flag != 0x16) {
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// // debug("address : 0x %x %x %x %x %x %x %x\n", pack->address[0]
|
||||
// // , pack->address[1], pack->address[2], pack->address[3]
|
||||
// // , pack->address[4], pack->address[5], pack->address[6]);
|
||||
// config_info temp_configInfo;
|
||||
// read_config_info(&temp_configInfo);
|
||||
|
||||
// if (pack->address[0] != 0xFF
|
||||
// || pack->address[1] != 0xFF
|
||||
// || pack->address[2] != 0xFF
|
||||
// || pack->address[3] != 0xFF
|
||||
// || pack->address[4] != 0xFF
|
||||
// || pack->address[5] != 0xFF
|
||||
// || pack->address[6] != 0xFF) {
|
||||
// save_configInfo.address[0] = pack->address[0];
|
||||
// save_configInfo.address[1] = pack->address[1];
|
||||
// save_configInfo.address[2] = pack->address[2];
|
||||
// save_configInfo.address[3] = pack->address[3];
|
||||
// save_configInfo.address[4] = pack->address[4];
|
||||
// save_configInfo.address[5] = pack->address[5];
|
||||
// save_configInfo.address[6] = pack->address[6];
|
||||
// // debug("address : 0x %x %x %x %x %x %x %x\n", save_configInfo.address[0]
|
||||
// // , save_configInfo.address[1], save_configInfo.address[2], save_configInfo.address[3]
|
||||
// // , save_configInfo.address[4], save_configInfo.address[5], save_configInfo.address[6]);
|
||||
// } else {
|
||||
// save_configInfo.address[0] = temp_configInfo.address[0];
|
||||
// save_configInfo.address[1] = temp_configInfo.address[1];
|
||||
// save_configInfo.address[2] = temp_configInfo.address[2];
|
||||
// save_configInfo.address[3] = temp_configInfo.address[3];
|
||||
// save_configInfo.address[4] = temp_configInfo.address[4];
|
||||
// save_configInfo.address[5] = temp_configInfo.address[5];
|
||||
// save_configInfo.address[6] = temp_configInfo.address[6];
|
||||
// }
|
||||
|
||||
// if (pack->hardwareID[0] != 0xFF
|
||||
// || pack->hardwareID[1] != 0xFF
|
||||
// || pack->hardwareID[2] != 0xFF
|
||||
// || pack->hardwareID[3] != 0xFF
|
||||
// || pack->hardwareID[4] != 0xFF
|
||||
// || pack->hardwareID[5] != 0xFF) {
|
||||
// save_configInfo.hardwareID[0] = pack->hardwareID[0];
|
||||
// save_configInfo.hardwareID[1] = pack->hardwareID[1];
|
||||
// save_configInfo.hardwareID[2] = pack->hardwareID[2];
|
||||
// save_configInfo.hardwareID[3] = pack->hardwareID[3];
|
||||
// save_configInfo.hardwareID[4] = pack->hardwareID[4];
|
||||
// save_configInfo.hardwareID[5] = pack->hardwareID[5];
|
||||
// } else {
|
||||
// save_configInfo.hardwareID[0] = temp_configInfo.hardwareID[0];
|
||||
// save_configInfo.hardwareID[1] = temp_configInfo.hardwareID[1];
|
||||
// save_configInfo.hardwareID[2] = temp_configInfo.hardwareID[2];
|
||||
// save_configInfo.hardwareID[3] = temp_configInfo.hardwareID[3];
|
||||
// save_configInfo.hardwareID[4] = temp_configInfo.hardwareID[4];
|
||||
// save_configInfo.hardwareID[5] = temp_configInfo.hardwareID[5];
|
||||
// }
|
||||
|
||||
// if (pack->communicationID[0] != 0xFF
|
||||
// || pack->communicationID[1] != 0xFF
|
||||
// || pack->communicationID[2] != 0xFF
|
||||
// || pack->communicationID[3] != 0xFF) {
|
||||
// save_configInfo.communicationID[0] = pack->communicationID[0];
|
||||
// save_configInfo.communicationID[1] = pack->communicationID[1];
|
||||
// save_configInfo.communicationID[2] = pack->communicationID[2];
|
||||
// save_configInfo.communicationID[3] = pack->communicationID[3];
|
||||
// } else {
|
||||
// save_configInfo.communicationID[0] = temp_configInfo.communicationID[0];
|
||||
// save_configInfo.communicationID[1] = temp_configInfo.communicationID[1];
|
||||
// save_configInfo.communicationID[2] = temp_configInfo.communicationID[2];
|
||||
// save_configInfo.communicationID[3] = temp_configInfo.communicationID[3];
|
||||
// }
|
||||
|
||||
// save_configInfo.protocolType = pack->protocolType;
|
||||
|
||||
// save_configInfo.CommunicationProtocolType = pack->CommunicationProtocolType;
|
||||
|
||||
// save_configInfo.onlyPower = pack->onlyPower;
|
||||
|
||||
// save_configInfo.crc = configCheckFunc((uint8_t *)&save_configInfo, CONFIG_INFO_SIZE - 2);
|
||||
// save_backups_config_info(&save_configInfo);
|
||||
// save_config_info(&save_configInfo);
|
||||
|
||||
// memset(config_buff, 0, sizeof(config_buff));
|
||||
|
||||
// // /* 返回更改配置文件成功 */
|
||||
// // SL_Mppt_SOther_pack SUpdateProfile_pack = {0};
|
||||
|
||||
// // SUpdateProfile_pack.start_Flag[0] = g_otherParameter.startFlagSL[0];
|
||||
// // SUpdateProfile_pack.start_Flag[1] = g_otherParameter.startFlagSL[1];
|
||||
|
||||
// // SUpdateProfile_pack.address[0] = save_configInfo.address[0];
|
||||
// // SUpdateProfile_pack.address[1] = save_configInfo.address[1];
|
||||
// // SUpdateProfile_pack.address[2] = save_configInfo.address[2];
|
||||
// // SUpdateProfile_pack.address[3] = save_configInfo.address[3];
|
||||
// // SUpdateProfile_pack.address[4] = save_configInfo.address[4];
|
||||
// // SUpdateProfile_pack.address[5] = save_configInfo.address[5];
|
||||
// // SUpdateProfile_pack.address[6] = save_configInfo.address[6];
|
||||
|
||||
// // SUpdateProfile_pack.function_Code = SL_Function_Code_Update_Profile;
|
||||
|
||||
// // SUpdateProfile_pack.state = 0x01;
|
||||
|
||||
// // uint16_t crc = CheckFuncSL((uint8_t *)&SUpdateProfile_pack, SL_MPPT_SOTHER_PACK_SIZE - 3);
|
||||
// // SUpdateProfile_pack.check_Bit_H = crc >> 8;
|
||||
// // SUpdateProfile_pack.check_Bit_L = crc;
|
||||
|
||||
// // SUpdateProfile_pack.end_Flag = g_otherParameter.endFlagSL;
|
||||
|
||||
// // while (1) {
|
||||
// // if (!Check_485_bus_busy(g_gw485_uart4_handle)) {
|
||||
// // uart_dev_write(g_gw485_uart4_handle, (uint8_t *)&SUpdateProfile_pack, SL_MPPT_SOTHER_PACK_SIZE);
|
||||
// // USART_ITConfig(USART3, USART_IT_RXNE, ENABLE);
|
||||
// // break;
|
||||
// // }
|
||||
// // Delay_Ms(randomDelay());
|
||||
// // }
|
||||
|
||||
// /* 复位 */
|
||||
// NVIC_SystemReset();
|
||||
|
||||
// return;
|
||||
|
||||
// err:
|
||||
// config_buff_pos--;
|
||||
// memcpy(config_buff, config_buff + 1, sizeof(config_buff) - 1);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* @brief 保存回路阻抗在flash中
|
||||
|
|
|
@ -141,7 +141,7 @@ float getBatteryVoltage(void)
|
|||
void setBatteryVoltage(void)
|
||||
{
|
||||
g_otherParameter.Battery_Voltage = g_otherParameter.Output_Voltage
|
||||
+ getChargBatteryCurrent() * g_cfgParameter.loopImpedance;
|
||||
- getChargBatteryCurrent() * g_cfgParameter.loopImpedance;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "FM_GPIO.h"
|
||||
#include "chargControlEnum.h"
|
||||
#include "bl_chargControl.h"
|
||||
#include "hy_protocol.h"
|
||||
|
||||
/* 控制运行指示灯和喂狗 */
|
||||
// #define runled_reloadVal 1000 /* 任务执行间隔 */
|
||||
|
@ -46,9 +47,18 @@ static void Task_impedanceCalculation(void);
|
|||
/* 开路电压采集 */
|
||||
#define collectOpenCircuitVoltage_reloadVal 1000 /* 任务执行间隔 */
|
||||
#define collectOpenCircuitVoltage_offset 0 /* 任务执行偏移量 */
|
||||
STR_TimeSliceOffset g_collectOpenCircuitVoltage;
|
||||
STR_TimeSliceOffset m_collectOpenCircuitVoltage;
|
||||
void Task_collectOpenCircuitVoltage(void);
|
||||
|
||||
/* 限时开启HY协议配置模式 */
|
||||
#define beginHYconfigMode_reloadVal 1000 /* 任务执行间隔 */
|
||||
#define beginHYconfigMode_offset 0 /* 任务执行偏移量 */
|
||||
STR_TimeSliceOffset m_beginHYconfigMode;
|
||||
void Task_beginHYconfigMode(void);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief 启动时初始化各任务
|
||||
* @param None
|
||||
|
@ -60,7 +70,11 @@ void task_Init(void)
|
|||
TimeSliceOffset_Register(&m_runled, Task_Runled, runled_reloadVal, runled_offset);
|
||||
TimeSliceOffset_Register(&m_wdi, Task_wdi, wdi_reloadVal, wdi_offset);
|
||||
TimeSliceOffset_Register(&m_startControl, Task_startControl, startControl_reloadVal, startControl_offset);
|
||||
TimeSliceOffset_Register(&m_refreshJudgeData, Task_refreshJudgeData, refreshJudgeData_reloadVal, refreshJudgeData_offset);
|
||||
TimeSliceOffset_Register(&m_refreshJudgeData, Task_refreshJudgeData
|
||||
, refreshJudgeData_reloadVal, refreshJudgeData_offset);
|
||||
TimeSliceOffset_Register(&m_collectOpenCircuitVoltage, Task_collectOpenCircuitVoltage
|
||||
, collectOpenCircuitVoltage_reloadVal, collectOpenCircuitVoltage_offset);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,12 +99,14 @@ void Task_wdi(void)
|
|||
|
||||
debug_printf("chargCurrent:%f \n", getChargCurrent());
|
||||
debug_printf("outputVoltage:%f \n", getOutputVoltage());
|
||||
debug_printf("BatteryVoltage:%f \n", getBatteryVoltage());
|
||||
debug_printf("dischargCurrent:%f \n", getDischargCurrent());
|
||||
debug_printf("solarInCircuitVoltage:%f \n", getSolarInCircuitVoltage());
|
||||
debug_printf("HighSideMosTemperature:%f \n", getHighSideMosTemperature());
|
||||
debug_printf("InputVoltage:%f \n", getInputVoltage());
|
||||
debug_printf("DischargMosState:%d \n", getDischargMosState());
|
||||
debug_printf("MPPT_Mode:%d \n", getMPPT_Mode());
|
||||
debug_printf("loopImpedance:%f \n", g_cfgParameter.loopImpedance);
|
||||
debug_printf("DutyRatio:%f \n", getDutyRatio());
|
||||
|
||||
/* 每天复位一次,复位前将电量信息写入flash中 */
|
||||
|
@ -303,13 +319,23 @@ void Task_collectOpenCircuitVoltage(void)
|
|||
static uint32_t collectOpenCircuitVoltageNoNUM = 0;
|
||||
/* 用于有充电控制时获取开路电压 */
|
||||
static uint8_t collectOpenCircuitVoltageYesNUM = 0;
|
||||
/* 用于有充电控制时当标志位 */
|
||||
static BOOL collectOpenCircuitVoltageYesFlag = 0;
|
||||
|
||||
|
||||
/* 未进行充电时,3S采集一次开路电压 */
|
||||
if (FALSE == getChargControlFlag()) {
|
||||
if (1 <= collectOpenCircuitVoltageNoNUM++) {
|
||||
if (2 <= collectOpenCircuitVoltageNoNUM++) {
|
||||
setSolarOpenCircuitVoltage();
|
||||
collectOpenCircuitVoltageNoNUM = 0;
|
||||
}
|
||||
collectOpenCircuitVoltageYesNUM = 0;
|
||||
if (collectOpenCircuitVoltageYesFlag == TRUE) {
|
||||
setSolarOpenCircuitVoltage();
|
||||
beginChargWork();
|
||||
collectOpenCircuitVoltageYesFlag = FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
collectOpenCircuitVoltageYesNUM++;
|
||||
|
@ -318,9 +344,10 @@ void Task_collectOpenCircuitVoltage(void)
|
|||
if (collectOpenCircuitVoltageYesNUM == g_cfgParameter.collectOpenCircuitVoltageTime) {
|
||||
/* 有电池才进行开路电压检测 */
|
||||
if (getBatteryState()) {
|
||||
collectOpenCircuitVoltageYesFlag = TRUE;
|
||||
stopChargWork();
|
||||
/* 设置延时为1000-500ms */
|
||||
g_collectOpenCircuitVoltage.count = 500;
|
||||
m_collectOpenCircuitVoltage.count = 500;
|
||||
}
|
||||
collectOpenCircuitVoltageYesNUM = 0;
|
||||
}
|
||||
|
@ -329,9 +356,36 @@ void Task_collectOpenCircuitVoltage(void)
|
|||
if (collectOpenCircuitVoltageYesNUM == g_cfgParameter.collectOpenCircuitVoltageTime + 1) {
|
||||
setSolarOpenCircuitVoltage();
|
||||
beginChargWork();
|
||||
collectOpenCircuitVoltageYesFlag = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 开启HY配置模式后,配置完成后120S后自动退出
|
||||
* @param
|
||||
* @retval
|
||||
*/
|
||||
void Task_beginHYconfigMode(void)
|
||||
{
|
||||
static uint8_t num = 0;
|
||||
num++;
|
||||
if (num >= 120) {
|
||||
TimeSliceOffset_Unregister(&m_beginHYconfigMode);
|
||||
m_beginHYconfigMode.runFlag = 0;
|
||||
num = 0;
|
||||
setHYconfigModeState(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 开启HY配置模式后启动退出任务
|
||||
* @param
|
||||
* @retval
|
||||
*/
|
||||
void beginHYconfigMode(void)
|
||||
{
|
||||
setHYconfigModeState(TRUE);
|
||||
TimeSliceOffset_Register(&m_beginHYconfigMode, Task_beginHYconfigMode
|
||||
, beginHYconfigMode_reloadVal, beginHYconfigMode_offset);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,9 @@ void debug_printf(char *format, ...);
|
|||
void Init_debug_uart(void);
|
||||
void Init_BAT485_uart(void);
|
||||
void Init_GW485_uart(void);
|
||||
uint8_t uart_dev_in_char(device_handle device);
|
||||
int uart_dev_char_present(device_handle device);
|
||||
void uart_dev_write(device_handle device, void *data, int len);
|
||||
|
||||
void start_gw485Rx_It(void);
|
||||
void start_bat485Rx_It(void);
|
||||
|
|
|
@ -193,6 +193,49 @@ void Init_GW485_uart(void)
|
|||
g_gw485_uart2_handle = uart_dev_init(GW485_UART_INDEX, Gw485_in_buff, sizeof(Gw485_in_buff));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 从串口设备循环buff读取一个数据.
|
||||
* @param device 串口句柄
|
||||
* @retval 读取到的字符
|
||||
*/
|
||||
uint8_t uart_dev_in_char(device_handle device)
|
||||
{
|
||||
uart_device_info *device_info = (uart_device_info *)device;
|
||||
char c = 0;
|
||||
|
||||
if (uart_dev_char_present(device))
|
||||
OutRingQueue(&device_info->uart_ring_queue, (u_int8_t*)&c);
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 判断串口设备循环buff是否有数据.
|
||||
* @param device 串口句柄
|
||||
* @retval 0 空 1有数据
|
||||
*/
|
||||
int uart_dev_char_present(device_handle device)
|
||||
{
|
||||
uart_device_info *device_info = (uart_device_info *)device;
|
||||
|
||||
if((!device) || (!device_info->init))
|
||||
return 0;
|
||||
|
||||
return !RingQueueEmpty(&device_info->uart_ring_queue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 串口多字节堵塞发送.
|
||||
* @param device 串口句柄
|
||||
* @param data 待发送数据
|
||||
* @param len 待发送数据长度
|
||||
* @retval None
|
||||
*/
|
||||
void uart_dev_write(device_handle device, void *data, int len)
|
||||
{
|
||||
for (int i = 0; i < len; i++) {
|
||||
uart_putchar(device, ((char *)data)[i]);
|
||||
}
|
||||
}
|
||||
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
|
||||
{
|
||||
if (huart->Instance == USART2) {
|
||||
|
|
|
@ -1096,12 +1096,12 @@
|
|||
<settings>
|
||||
<name>BUILDACTION</name>
|
||||
<archiveVersion>2</archiveVersion>
|
||||
<data></data>
|
||||
<data />
|
||||
</settings>
|
||||
<settings>
|
||||
<name>Coder</name>
|
||||
<archiveVersion>0</archiveVersion>
|
||||
<data></data>
|
||||
<data />
|
||||
</settings>
|
||||
</configuration>
|
||||
<group>
|
||||
|
@ -1129,6 +1129,12 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\bl_comm.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\cfg_protocol.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\hy_protocol.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\inFlash.c</name>
|
||||
</file>
|
||||
|
@ -1197,36 +1203,36 @@
|
|||
<name>User</name>
|
||||
<group>
|
||||
<name>Core</name>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\main.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\gpio.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\adc.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\dma.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\gpio.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\main.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\spi.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\tim.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\usart.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\stm32g4xx_it.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\stm32g4xx_hal_msp.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\stm32g4xx_hal_timebase_tim.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\stm32g4xx_it.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\tim.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Core\Src\usart.c</name>
|
||||
</file>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
|
@ -1241,10 +1247,7 @@
|
|||
<group>
|
||||
<name>STM32G4xx_HAL_Driver</name>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_tim.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_tim_ex.c</name>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_adc.c</name>
|
||||
|
@ -1253,16 +1256,16 @@
|
|||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_adc_ex.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_adc.c</name>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_cortex.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal.c</name>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_dma.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_rcc.c</name>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_dma_ex.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_rcc_ex.c</name>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_exti.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_flash.c</name>
|
||||
|
@ -1276,15 +1279,6 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_gpio.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_exti.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_dma.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_dma_ex.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pwr.c</name>
|
||||
</file>
|
||||
|
@ -1292,7 +1286,10 @@
|
|||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_pwr_ex.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_cortex.c</name>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_rcc.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_rcc_ex.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_spi.c</name>
|
||||
|
@ -1300,12 +1297,33 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_spi_ex.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_tim.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_tim_ex.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_uart.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_hal_uart_ex.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Drivers\STM32G4xx_HAL_Driver\Src\stm32g4xx_ll_adc.c</name>
|
||||
</file>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<name>Middlewares</name>
|
||||
<group>
|
||||
<name>Library</name>
|
||||
<group>
|
||||
<name>DSP Library/DSP Library</name>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\Middlewares\ST\ARM\DSP\Lib\iar_cortexM4lf_math.a</name>
|
||||
</file>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
|
@ -1317,17 +1335,4 @@
|
|||
<name>$PROJ_DIR$\..\tools\TimeSliceOffset\timeSliceOffset.c</name>
|
||||
</file>
|
||||
</group>
|
||||
<group>
|
||||
<name>Middlewares</name>
|
||||
<group>
|
||||
<name>Library</name>
|
||||
<group>
|
||||
<name>DSP Library/DSP Library</name>
|
||||
<file>
|
||||
<name>$PROJ_DIR$/../Middlewares/ST/ARM/DSP/Lib/iar_cortexM4lf_math.a</name>
|
||||
</file>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</project>
|
||||
|
||||
|
|
|
@ -1451,6 +1451,12 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\bl_comm.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\cfg_protocol.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\hy_protocol.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\inFlash.c</name>
|
||||
</file>
|
||||
|
|
|
@ -29,6 +29,7 @@ int InitRingQueue(RingQueue *q, RQ_ElementType *buff, int size);
|
|||
#define RingQueueFull(q) (((q)->rear+1) % (q)->size == (q)->front)
|
||||
#define RingQueueEmpty(q) ((q)->front == (q)->rear)
|
||||
|
||||
|
||||
//遍历队列,
|
||||
//消费者使用,故对生产者可能修改的rear先读取缓存
|
||||
int ShowRingQueue(RingQueue *q);
|
||||
|
|
|
@ -9,11 +9,35 @@ typedef enum _chargMode{
|
|||
floatCharg = 3 /* 浮充充电 */
|
||||
}chargMode;
|
||||
|
||||
typedef enum _mosTState{
|
||||
typedef enum {
|
||||
mosTemperStart = 0, /* 满功率充电mos状态 */
|
||||
mosTemperEnd = 1, /* 降功率充电mos状态 */
|
||||
mosTemperStop = 2, /* 停止充电mos状态 */
|
||||
}mosTState;
|
||||
|
||||
|
||||
/* 注册状态 */
|
||||
typedef enum {
|
||||
UNREGISTER = 0, /* 未注册 */
|
||||
REGISTER_FAIL = 1, /* 注册失败 */
|
||||
REGISTER_SUCCESS = 2, /* 注册成功 */
|
||||
}SL_REGISTERSTATUS;
|
||||
|
||||
/* 接入节点类型 */
|
||||
typedef enum {
|
||||
POWERBOX = 1, /* 电源箱子 */
|
||||
MICROMETEOROLOGY = 2, /* 微气象 */
|
||||
}SL_ACCESSNODETYPE;
|
||||
|
||||
/* 通信方式 */
|
||||
typedef enum {
|
||||
RS485 = 1,
|
||||
RJ45 = 2,
|
||||
// Lora = 3, //暂时未使用
|
||||
}SL_COMMUNICATIONMETHODS;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -14,6 +14,7 @@ typedef unsigned int uint32_t;
|
|||
typedef unsigned long long u_int64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef unsigned char BOOL;
|
||||
typedef float float_t;
|
||||
|
||||
// This type MUST be 8 bit
|
||||
typedef unsigned char BYTE;
|
||||
|
|
Loading…
Reference in New Issue