Compare commits
2 Commits
8053971109
...
bccfc0c450
Author | SHA1 | Date |
---|---|---|
|
bccfc0c450 | |
|
688f925657 |
|
@ -35,6 +35,9 @@
|
|||
"rtc.h": "c",
|
||||
"soe.h": "c",
|
||||
"hd_rtc.h": "c",
|
||||
"flash.h": "c"
|
||||
"flash.h": "c",
|
||||
"configparameter.h": "c",
|
||||
"usart.h": "c",
|
||||
"w25qxx.h": "c"
|
||||
}
|
||||
}
|
|
@ -7,49 +7,51 @@
|
|||
#include "parameter.h"
|
||||
#include "FM_TIM.h"
|
||||
|
||||
|
||||
void startInfo(void)
|
||||
{
|
||||
log_info("uniqueDeviceID : 0x%x%x%x%x%x%x%x \n", g_cfgParameter.uniqueDeviceID[0]
|
||||
, g_cfgParameter.uniqueDeviceID[1]
|
||||
, g_cfgParameter.uniqueDeviceID[2]
|
||||
, g_cfgParameter.uniqueDeviceID[3]
|
||||
, g_cfgParameter.uniqueDeviceID[4]
|
||||
, g_cfgParameter.uniqueDeviceID[5]
|
||||
, g_cfgParameter.uniqueDeviceID[6]);
|
||||
log_info("gw485_Baud : %d \n", g_cfgParameter.gw485_Baud);
|
||||
log_info("bat485_Baud : %d \n", g_cfgParameter.bat485_Baud);
|
||||
log_info("powerBoxType : 0x%x \n", g_cfgParameter.powerBoxType);
|
||||
log_info("constantVoltageV : %f \n", g_cfgParameter.constantVoltageV);
|
||||
log_info("floatI : %f \n", g_cfgParameter.floatI);
|
||||
log_info("startSolarOpenCircuitV : %f \n", g_cfgParameter.startSolarOpenCircuitV);
|
||||
log_info("stopSolarOpenCircuitV : %f \n", g_cfgParameter.stopSolarOpenCircuitV);
|
||||
log_info("stopSolarOutputCircuitV : %f \n", g_cfgParameter.stopSolarOutputCircuitV);
|
||||
log_info("checkCanStartTime : %d \n", g_cfgParameter.checkCanStartTime);
|
||||
log_info("shortCircuitJudgmentDelay : %d \n", g_cfgParameter.shortCircuitJudgmentDelay);
|
||||
log_info("inputPowerLowJudgmentDelay : %d \n", g_cfgParameter.inputPowerLowJudgmentDelay);
|
||||
log_info("inputPowerLowAgainOutputDelay : %d \n", g_cfgParameter.inputPowerLowAgainOutputDelay);
|
||||
log_info("firstStageProtectionDelay : %d \n", g_cfgParameter.firstStageProtectionDelay);
|
||||
log_info("firstStageProtectionValue : %d \n", g_cfgParameter.firstStageProtectionValue);
|
||||
log_info("firstStageProtectionCurr : %f \n", g_cfgParameter.firstStageProtectionCurr);
|
||||
log_info("secondStageProtectionDelay : %d \n", g_cfgParameter.secondStageProtectionDelay);
|
||||
log_info("secondStageProtectionCurr : %f \n", g_cfgParameter.secondStageProtectionCurr);
|
||||
log_info("thirdStageProtectionDelay : %d \n", g_cfgParameter.thirdStageProtectionDelay);
|
||||
log_info("thirdStageProtectionCurr : %f \n", g_cfgParameter.thirdStageProtectionCurr);
|
||||
log_info("inputPowerLowDetectionDelay : %d \n", g_cfgParameter.inputPowerLowDetectionDelay);
|
||||
log_info("inputPowerLowDetectionVolt : %f \n", g_cfgParameter.inputPowerLowDetectionVolt);
|
||||
log_info("maxOpenSolarOutputCircuitV : %f \n", g_cfgParameter.maxOpenSolarOutputCircuitV);
|
||||
log_info("maxChargCurr : %f \n", g_cfgParameter.maxChargCurr);
|
||||
log_info("minCheckLoopImpedanceChargCurr : %f \n", g_cfgParameter.minCheckLoopImpedanceChargCurr);
|
||||
log_info("fullPowerOutputTemperature : %f \n", g_cfgParameter.fullPowerOutputTemperature);
|
||||
log_info("reducePowerOutputTemperature : %f \n", g_cfgParameter.reducePowerOutputTemperature);
|
||||
log_info("stopPowerOutputTemperature : %f \n", g_cfgParameter.stopPowerOutputTemperature);
|
||||
log_info("constantVoltageChargeV : %f \n", g_cfgParameter.constantVoltageChargeV);
|
||||
log_info("FloatV : %f \n", g_cfgParameter.FloatV);
|
||||
log_info("loopImpedance : %f \n", g_cfgParameter.loopImpedance);
|
||||
log_info("HighSideMosTemperature_stop : %f \n", g_cfgParameter.HighSideMosTemperature_stop);
|
||||
log_info("HighSideMosTemperature_end : %f \n", g_cfgParameter.HighSideMosTemperature_end);
|
||||
log_info("HighSideMosTemperature_start : %f \n", g_cfgParameter.HighSideMosTemperature_start);
|
||||
log_info("outputAgainFlagTime : %d \n", g_cfgParameter.outputAgainFlagTime);
|
||||
log_info("excessiveLoadFlagTime : %d \n", g_cfgParameter.excessiveLoadFlagTime);
|
||||
log_info("FloatChargeV : %f \n", g_cfgParameter.FloatChargeV);
|
||||
log_info("collectOpenCircuitVoltageTime : %d \n", g_cfgParameter.collectOpenCircuitVoltageTime);
|
||||
log_info("Access_Node_Type : %d \n", g_cfgParameter.Access_Node_Type);
|
||||
log_info("Communication_Methods : %d \n", g_cfgParameter.Communication_Methods);
|
||||
log_info("Registration_Status : %d \n", g_cfgParameter.Registration_Status);
|
||||
log_info("address : 0x%x%x%x%x%x%x%x \n", g_cfgParameter.address[0]
|
||||
, g_cfgParameter.address[1]
|
||||
, g_cfgParameter.address[2]
|
||||
, g_cfgParameter.address[3]
|
||||
, g_cfgParameter.address[4]
|
||||
, g_cfgParameter.address[5]
|
||||
, g_cfgParameter.address[6]);
|
||||
log_info("Access_Node_Type : %x \n", g_cfgParameter.Access_Node_Type);
|
||||
log_info("Communication_Methods : %x \n", g_cfgParameter.Communication_Methods);
|
||||
log_info("startFlagSL : 0x%x%x \n", g_cfgParameter.startFlagSL[0], g_cfgParameter.startFlagSL[1]);
|
||||
log_info("endFlagSL : 0x%x \n", g_cfgParameter.endFlagSL);
|
||||
log_info("hardwareID : 0x%x%x%x%x%x%x \n", g_cfgParameter.hardwareID[0]
|
||||
, g_cfgParameter.hardwareID[1]
|
||||
, g_cfgParameter.hardwareID[2]
|
||||
, g_cfgParameter.hardwareID[3]
|
||||
, g_cfgParameter.hardwareID[4]
|
||||
, g_cfgParameter.hardwareID[5]);
|
||||
log_info("communicationID : 0x%x%x%x%x \n", g_cfgParameter.communicationID[0]
|
||||
, g_cfgParameter.communicationID[1]
|
||||
, g_cfgParameter.communicationID[2]
|
||||
, g_cfgParameter.communicationID[3]);
|
||||
log_info("protocolType : 0x%x \n", g_cfgParameter.protocolType);
|
||||
log_info("startFlagHY : 0x%x \n", g_cfgParameter.startFlagHY);
|
||||
log_info("endFlagHY : 0x%x \n", g_cfgParameter.endFlagHY);
|
||||
log_info("onlyPower : 0x%x \n", g_cfgParameter.onlyPower);
|
||||
log_info("gw485_Baud : %d \n", g_cfgParameter.gw485_Baud);
|
||||
log_info("gw485_Baud : %d \n", g_cfgParameter.gw485_Baud);
|
||||
|
||||
log_info("loopImpedance : %f \n", getLoopImpedance());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,5 +15,4 @@ void insertEventsOrderRecord(eventsOrderRecordMode mode);
|
|||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
|
||||
#ifndef BL_USART_H_
|
||||
#define BL_USART_H_
|
||||
|
||||
|
||||
#include "comm_types.h"
|
||||
#include "chargControlTypes.h"
|
||||
#include "uart_dev.h"
|
||||
|
||||
|
||||
|
||||
/* SL协议读取寄存器最大地址 */
|
||||
#define maxReadRegAddrMacro 0x0120
|
||||
/* SL协议读取寄存器最小地址 */
|
||||
#define minReadRegAddrMacro 0x0100
|
||||
/* SL协议读取寄存器最大长度 */
|
||||
#define maxReadRegAddrNumMacro 10
|
||||
|
||||
|
||||
/* SL协议写入寄存器最大地址 */
|
||||
#define maxWriteRegAddrMacro 0x0120
|
||||
/* SL协议写入寄存器最小地址 */
|
||||
#define minWriteRegAddrMacro 0x0100
|
||||
/* SL协议写入寄存器最大长度 */
|
||||
#define maxWriteRegAddrNumMacro 10
|
||||
|
||||
/* SL协议寄存器长度 */
|
||||
#define RegAddrNumMacro 32
|
||||
|
||||
/* SL协议下发配置文件内容最长长度 */
|
||||
#define maxDistributionCfgLen 230
|
||||
/* SL协议读取配置文件内容最长长度 */
|
||||
#define maxReadCfgLen 32
|
||||
|
||||
|
||||
#define floatMagnification 10.0f
|
||||
|
||||
|
||||
uint16_t checkModebusCrc(uint8_t *arr_buff, uint8_t len);
|
||||
|
||||
void gw485DataAnalysis(device_handle device);
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,12 +0,0 @@
|
|||
|
||||
#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
|
|
@ -1,14 +0,0 @@
|
|||
|
||||
#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
|
|
@ -5,85 +5,116 @@
|
|||
#include "flash.h"
|
||||
#include "stm32g431xx.h"
|
||||
#include "chargControlTypes.h"
|
||||
#include "bl_usart.h"
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
/* 高字节在前,低字节在后 */
|
||||
typedef struct _recv_config_info{
|
||||
uint8_t start_Flag[2]; /* 开始标志 */
|
||||
/* SL */
|
||||
uint8_t address[7]; /* 地址 */
|
||||
// uint8_t Access_Node_Type[2]; /* 接入节点类型 */
|
||||
// uint8_t Communication_Methods[2]; /* 通信方式 */
|
||||
uint8_t gw485_Baud[4]; /* 串口波特率 */
|
||||
uint8_t bat485_Baud[4]; /* 串口波特率,为0代表bms不支持通信 */
|
||||
// /* 高字节在前,低字节在后 */
|
||||
// typedef struct _recv_config_info{
|
||||
// uint8_t start_Flag[2]; /* 开始标志 */
|
||||
// /* SL */
|
||||
// uint8_t address[7]; /* 地址 */
|
||||
// // uint8_t Access_Node_Type[2]; /* 接入节点类型 */
|
||||
// // uint8_t Communication_Methods[2]; /* 通信方式 */
|
||||
// uint8_t gw485_Baud[4]; /* 串口波特率 */
|
||||
// uint8_t bat485_Baud[4]; /* 串口波特率,为0代表bms不支持通信 */
|
||||
|
||||
/* HY */
|
||||
uint8_t hardwareID[6]; /* 硬件ID */
|
||||
uint8_t communicationID[4]; /* 通信ID */
|
||||
uint8_t protocolType; /* 协议类型; 0x01表示:汇源协议(波特率9600) 0x02表示:南瑞协议(波特率115200)*/
|
||||
// /* HY */
|
||||
// uint8_t hardwareID[6]; /* 硬件ID */
|
||||
// uint8_t communicationID[4]; /* 通信ID */
|
||||
// uint8_t protocolType; /* 协议类型; 0x01表示:汇源协议(波特率9600) 0x02表示:南瑞协议(波特率115200)*/
|
||||
|
||||
|
||||
uint8_t CommunicationProtocolType; /* 0x00:SL
|
||||
0x01:HY*/
|
||||
uint8_t onlyPower; /* 是否只充当电源板:0x00:不是
|
||||
0x01:是*/
|
||||
// uint8_t CommunicationProtocolType; /* 0x00:SL
|
||||
// 0x01:HY*/
|
||||
// uint8_t onlyPower; /* 是否只充当电源板:0x00:不是
|
||||
// 0x01:是*/
|
||||
|
||||
uint8_t ConstantVoltageV[2]; /* 高于该(电压 / 100)且电流大于FloatI * 100进行恒压充电 */
|
||||
uint8_t FloatI[2]; /* 高于该(电压 / 100)且电流低于FloatI * 100进行浮充充电 */
|
||||
uint8_t startSolarOpenCircuitV[2]; /* 高于该(电压 / 100)开始充电 */
|
||||
uint8_t stopSolarOpenCircuitV[2]; /* 太阳能板开路电压高于该电压停止充电 (V) */
|
||||
uint8_t constantVoltageChargeV[2]; /* 恒压充电时的输出电压 (V) */
|
||||
uint8_t FloatChargeV[2]; /* 浮充充电时的输出电压 (V) */
|
||||
uint8_t HighSideMosTemperature_stop[2]; /* 当上桥温度达到该值时,停止输出 (°C) */
|
||||
uint8_t HighSideMosTemperature_end[2]; /* 当上桥温度上升到该值时,降低功率运行 (°C) */
|
||||
uint8_t HighSideMosTemperature_start[2];/* 当上桥温度降低到该值时,按照正常情况输出 (°C) */
|
||||
// uint8_t ConstantVoltageV[2]; /* 高于该(电压 / 100)且电流大于FloatI * 100进行恒压充电 */
|
||||
// uint8_t FloatI[2]; /* 高于该(电压 / 100)且电流低于FloatI * 100进行浮充充电 */
|
||||
// uint8_t startSolarOpenCircuitV[2]; /* 高于该(电压 / 100)开始充电 */
|
||||
// uint8_t stopSolarOpenCircuitV[2]; /* 太阳能板开路电压高于该电压停止充电 (V) */
|
||||
// uint8_t constantVoltageChargeV[2]; /* 恒压充电时的输出电压 (V) */
|
||||
// uint8_t FloatChargeV[2]; /* 浮充充电时的输出电压 (V) */
|
||||
// uint8_t HighSideMosTemperature_stop[2]; /* 当上桥温度达到该值时,停止输出 (°C) */
|
||||
// uint8_t HighSideMosTemperature_end[2]; /* 当上桥温度上升到该值时,降低功率运行 (°C) */
|
||||
// uint8_t HighSideMosTemperature_start[2];/* 当上桥温度降低到该值时,按照正常情况输出 (°C) */
|
||||
|
||||
// uint8_t checkSolarOpenCircuitVTime[2]; /* 启动任务中太阳能板开路电压检测间隔时间 (S) */
|
||||
// uint8_t sensorEnableBroadcastTime[2]; /* 传感器运行再次注册的间隔 (S) */
|
||||
uint8_t outputAgainFlagTime[2]; /* 出现短路保护后延长该段时间再次检测是否短路,仍然短路则关闭输出 (S) */
|
||||
uint8_t excessiveLoadFlagTime[2]; /* 出现过载后,在该间隔时间中多次(2次)出现过载,则关闭输出 (S) */
|
||||
uint8_t eLAgainTime[2]; /* 出现过载过载保护后,在该间隔段时间后,再次尝试输出 (S) */
|
||||
uint8_t crc[2]; /* 校验 */
|
||||
uint8_t end_Flag; /* 结束标志 */
|
||||
}recv_config_info;
|
||||
#define RECV_CONFIG_INFO sizeof(recv_config_info)
|
||||
// // uint8_t checkSolarOpenCircuitVTime[2]; /* 启动任务中太阳能板开路电压检测间隔时间 (S) */
|
||||
// // uint8_t sensorEnableBroadcastTime[2]; /* 传感器运行再次注册的间隔 (S) */
|
||||
// uint8_t outputAgainFlagTime[2]; /* 出现短路保护后延长该段时间再次检测是否短路,仍然短路则关闭输出 (S) */
|
||||
// uint8_t excessiveLoadFlagTime[2]; /* 出现过载后,在该间隔时间中多次(2次)出现过载,则关闭输出 (S) */
|
||||
// uint8_t eLAgainTime[2]; /* 出现过载过载保护后,在该间隔段时间后,再次尝试输出 (S) */
|
||||
// uint8_t crc[2]; /* 校验 */
|
||||
// uint8_t end_Flag; /* 结束标志 */
|
||||
// }recv_config_info;
|
||||
// #define RECV_CONFIG_INFO sizeof(recv_config_info)
|
||||
|
||||
typedef struct _config_info{
|
||||
/* SL */
|
||||
uint8_t address[7]; /* 地址 */
|
||||
// uint16_t Access_Node_Type; /* 接入节点类型 */
|
||||
// uint16_t Communication_Methods; /* 通信方式 */
|
||||
uint32_t gw485_Baud; /* 串口波特率,为0代表bms不支持通信 */
|
||||
uint32_t bat485_Baud; /* 串口波特率 */
|
||||
// /* SL */
|
||||
// uint8_t address[7]; /* 地址 */
|
||||
// // uint16_t Access_Node_Type; /* 接入节点类型 */
|
||||
// // uint16_t Communication_Methods; /* 通信方式 */
|
||||
// uint32_t gw485_Baud; /* 串口波特率,为0代表bms不支持通信 */
|
||||
// uint32_t bat485_Baud; /* 串口波特率 */
|
||||
|
||||
/* HY */
|
||||
uint8_t hardwareID[6]; /* 硬件ID */
|
||||
uint8_t communicationID[4]; /* 通信ID */
|
||||
uint8_t protocolType; /* 协议类型; 0x01表示:汇源协议(波特率9600) 0x02表示:南瑞协议(波特率115200)*/
|
||||
// /* HY */
|
||||
// uint8_t hardwareID[6]; /* 硬件ID */
|
||||
// uint8_t communicationID[4]; /* 通信ID */
|
||||
// uint8_t protocolType; /* 协议类型; 0x01表示:汇源协议(波特率9600) 0x02表示:南瑞协议(波特率115200)*/
|
||||
|
||||
uint8_t CommunicationProtocolType; /* 0x00:SL
|
||||
0x01:HY*/
|
||||
uint8_t onlyPower; /* 是否只充当电源板:0x00:不是
|
||||
0x01:是*/
|
||||
// uint8_t CommunicationProtocolType; /* 0x00:SL
|
||||
// 0x01:HY*/
|
||||
// uint8_t onlyPower; /* 是否只充当电源板:0x00:不是
|
||||
// 0x01:是*/
|
||||
|
||||
float constantVoltageV; /* 电压高于ConstantVoltageV且电流大于FloatI + 0.1)进行恒压充电 */
|
||||
float floatI; /* 电压高于ConstantVoltageV且电流低于FloatI进行浮充充电 */
|
||||
float startSolarOpenCircuitV; /* 太阳能板开路电压高于该电压开始充电 */
|
||||
float stopSolarOpenCircuitV; /* 太阳能板开路电压高于该电压 停止充电 */
|
||||
float constantVoltageChargeV; /* 恒压充电时的输出电压 */
|
||||
float FloatChargeV; /* 浮充电压 */
|
||||
float HighSideMosTemperature_stop; /* 当上桥温度达到该值时,停止输出 */
|
||||
float HighSideMosTemperature_end; /* 当上桥温度上升到该值时,降低功率运行 */
|
||||
float HighSideMosTemperature_start; /* 当上桥温度降低到该值时,按照正常情况输出 */
|
||||
// float constantVoltageV; /* 电压高于ConstantVoltageV且电流大于FloatI + 0.1)进行恒压充电 */
|
||||
// float floatI; /* 电压高于ConstantVoltageV且电流低于FloatI进行浮充充电 */
|
||||
// float startSolarOpenCircuitV; /* 太阳能板开路电压高于该电压开始充电 */
|
||||
// float stopSolarOpenCircuitV; /* 太阳能板开路电压高于该电压 停止充电 */
|
||||
// float constantVoltageChargeV; /* 恒压充电时的输出电压 */
|
||||
// float FloatChargeV; /* 浮充电压 */
|
||||
// float HighSideMosTemperature_stop; /* 当上桥温度达到该值时,停止输出 */
|
||||
// float HighSideMosTemperature_end; /* 当上桥温度上升到该值时,降低功率运行 */
|
||||
// float HighSideMosTemperature_start; /* 当上桥温度降低到该值时,按照正常情况输出 */
|
||||
|
||||
// uint16_t checkSolarOpenCircuitVTime; /* 启动任务中太阳能板开路电压检测时间 */
|
||||
// uint16_t sensorEnableBroadcastTime; /* 传感器运行再次注册的间隔 */
|
||||
uint16_t outputAgainFlagTime; /* 出现短路保护后延长该段时间再次检测是否短路,仍然短路则关闭输出 */
|
||||
uint16_t excessiveLoadFlagTime; /* 出现过载后,在该段时间中再次出现过载,则关闭输出 */
|
||||
uint16_t eLAgainTime; /* 出现过载过载保护后,该段时间后,再次尝试输出 */
|
||||
// // uint16_t checkSolarOpenCircuitVTime; /* 启动任务中太阳能板开路电压检测时间 */
|
||||
// // uint16_t sensorEnableBroadcastTime; /* 传感器运行再次注册的间隔 */
|
||||
// uint16_t outputAgainFlagTime; /* 出现短路保护后延长该段时间再次检测是否短路,仍然短路则关闭输出 */
|
||||
// uint16_t excessiveLoadFlagTime; /* 出现过载后,在该段时间中再次出现过载,则关闭输出 */
|
||||
// uint16_t eLAgainTime; /* 出现过载过载保护后,该段时间后,再次尝试输出 */
|
||||
|
||||
uint16_t crc; /* 校验 */
|
||||
uint8_t uniqueDeviceID[7]; /* 设备唯一ID */
|
||||
uint32_t gw485_Baud; /* 串口波特率 */
|
||||
uint32_t bat485_Baud; /* 串口波特率,为0代表bms不支持通信 */
|
||||
uint8_t powerBoxType; /* 是否只充当电源板:0x00:不是;0x01:是*/
|
||||
float constantVoltageV; /* 恒压充电阈值电压(V) */
|
||||
float floatI; /* 浮充充电阈值电流(A) */
|
||||
float startSolarOpenCircuitV; /* 启动充电太阳能板开路电压(V) */
|
||||
float stopSolarOutputCircuitV; /* 停止充电太阳能板输出电压(V) */
|
||||
uint16_t checkCanStartTime; /* 检测能否启动间隔时间(S) */
|
||||
uint16_t shortCircuitJudgmentDelay; /* 短路判断延时(S) */
|
||||
uint16_t inputPowerLowJudgmentDelay; /* 前端输入功率不足判断延时(S) */
|
||||
uint16_t inputPowerLowAgainOutputDelay; /* 前端输入功率不足再次输出延时(S) */
|
||||
uint16_t firstStageProtectionDelay; /* 第一段保护延时(10uS) */
|
||||
float firstStageProtectionCurr; /* 第一段保护电流(A) */
|
||||
uint16_t secondStageProtectionDelay; /* 第二段保护延时(100uS) */
|
||||
float secondStageProtectionCurr; /* 第二段保护电流(A) */
|
||||
uint32_t thirdStageProtectionDelay; /* 第三段保护延时(100uS) */
|
||||
float thirdStageProtectionCurr; /* 第三段保护电流(A) */
|
||||
uint16_t inputPowerLowDetectionDelay; /* 前端输入功率不足检测延时(100uS) */
|
||||
float inputPowerLowDetectionVolt; /* 前端输入功率不足检测电压(V) */
|
||||
float maxOpenSolarOutputCircuitV; /* 最大太阳能板输出电压(V) */
|
||||
float maxChargCurr; /* 最大充电电流(A) */
|
||||
float minCheckLoopImpedanceChargCurr; /* 检测回路阻抗时的最小充电电流(A) */
|
||||
float fullPowerOutputTemperature; /* 满功率输出温度(℃) */
|
||||
float reducePowerOutputTemperature; /* 降功率输出温度(℃) */
|
||||
float stopPowerOutputTemperature; /* 停止输出温度(℃) */
|
||||
float constantVoltageChargeV; /* 恒压充电时的输出电压(V) */
|
||||
float FloatChargeV; /* 浮充充电时的输出电压(V) */
|
||||
uint16_t collectOpenCircuitVoltageTime; /* 充电时采集开路电压的间隔时间 */
|
||||
|
||||
uint16_t crc; /* 校验 */
|
||||
}config_info;
|
||||
|
||||
#define CONFIG_INFO_SIZE (sizeof(config_info))
|
||||
|
@ -101,9 +132,10 @@ typedef struct _config_info{
|
|||
void read_config_info(config_info *output_config_info);
|
||||
void saveConfigInfo(config_info *config_info);
|
||||
void config_info_start(void);
|
||||
void readFlashContent(config_info *configInfo);
|
||||
|
||||
void saveLoopImpedance(float *loopImpedance);
|
||||
void readLoopImpedance(float *loopImpedance);
|
||||
void saveLoopImpedance();
|
||||
BOOL readLoopImpedance();
|
||||
void savetotalElectricityConsumption(float *totalElectricityConsumption);
|
||||
void readtotalElectricityConsumption(float *totalElectricityConsumption);
|
||||
void savetotalChargCapacity(float *totalChargCapacity);
|
||||
|
|
|
@ -19,4 +19,7 @@ void send_init(void);
|
|||
void check_sendState(void);
|
||||
void uart_interruptSend(device_handle device, uint8_t buff[], uint8_t len);
|
||||
|
||||
uint8_t *getInsertData(void);
|
||||
void uart_insertDataSend(device_handle device, uint8_t len);
|
||||
|
||||
#endif
|
|
@ -4,69 +4,50 @@
|
|||
#include "main.h"
|
||||
#include "comm_types.h"
|
||||
#include "chargControlTypes.h"
|
||||
|
||||
#define softVer "SV01_24101501"
|
||||
#include "configParameter.h"
|
||||
|
||||
// #pragma pack(push,1)
|
||||
|
||||
/* 主要有配置文件读取出来的数据 */
|
||||
typedef struct _config_parameter{
|
||||
float constantVoltageV; /* 电压高于ConstantVoltageV且电流大于(FloatI + 0.1)进行恒压充电
|
||||
电压低于该(ConstantVoltageV - 0.2) 进行恒流充电 (V) */
|
||||
float floatI; /* 电压高于该ConstantVoltageV且电流低于FloatI进行浮充充电 (A) */
|
||||
float startSolarOpenCircuitV; /* 太阳能板开路电压高于该电压开始充电 (V) */
|
||||
float stopSolarOpenCircuitV; /* 太阳能板开路电压高于该电压停止充电 (V) */
|
||||
float constantVoltageChargeV; /* 恒压充电时的输出电压 (V) */
|
||||
float FloatV; /* 浮充充电时的输出电压 (V) */
|
||||
float loopImpedance; /* 回路阻抗大小 (mΩ) */
|
||||
float HighSideMosTemperature_stop; /* 当上桥温度达到该值时,停止输出 (°C) */
|
||||
float HighSideMosTemperature_end; /* 当上桥温度上升到该值时,降低功率运行 (°C) */
|
||||
float HighSideMosTemperature_start; /* 当上桥温度降低到该值时,按照正常情况输出 (°C) */
|
||||
uint8_t uniqueDeviceID[7]; /* 设备唯一ID */
|
||||
|
||||
float firstStageProtectionCurr; /* 第一段保护的电流(单位A) */
|
||||
uint16_t firstStageProtectionValue; /* 第一段保护的电流采集的ADC的值 */
|
||||
uint16_t firstStageProtectionDelay; /* 第一段保护的延时时间(单位10uS) */
|
||||
float secondStageProtectionCurr; /* 第二段保护的电流(单位A) */
|
||||
uint32_t secondStageProtectionDelay; /* 第二段保护的延时时间(单位100uS) */
|
||||
float thirdStageProtectionCurr; /* 第三段保护的电流(单位A) */
|
||||
uint32_t thirdStageProtectionDelay; /* 第三段保护的延时时间(单位100uS) */
|
||||
float checkLoopImpedanceChargCurr; /* 检测回路阻抗时的充电电流要大于该值(单位A) */
|
||||
float lowInputLoadDetectionVolt; /* 输入功率较低延时电压(单位V) */
|
||||
uint16_t lowInputLoadDetectionDelay; /* 输入功率较低延时(单位100uS) */
|
||||
float maxChargCurr; /* 最大充电电流(A) */
|
||||
float maxOpenSolarOpenCircuitV; /* 最大充电电压(V) */
|
||||
|
||||
|
||||
// uint16_t sensorEnableBroadcastTime; /* 传感器运行再次注册的间隔 (S) */
|
||||
// uint16_t checkSolarOpenCircuitVTime; /* 启动任务中太阳能板开路电压检测间隔时间 (S) */
|
||||
uint16_t outputAgainFlagTime; /* 出现短路保护后延长该段时间再次检测是否短路,仍然短路则关闭输出 (S) */
|
||||
uint16_t excessiveLoadFlagTime; /* 出现过载后,在该间隔时间中多次(2次)出现过载,则关闭输出 (S) */
|
||||
uint16_t eLAgainTime; /* 出现过载过载保护后,在该间隔段时间后,再次尝试输出 (S) */
|
||||
// uint16_t softShortTime; /* 软件短路保护延时 时间(100uS) */
|
||||
|
||||
uint32_t collectOpenCircuitVoltageTime; /* 充电时开路电压采集时间间隔(S) */
|
||||
|
||||
uint32_t gw485_Baud; /* 串口波特率 */
|
||||
uint32_t bat485_Baud; /* 串口波特率,为0代表bms不支持通信 */
|
||||
uint8_t powerBoxType; /* 是否只充当电源板:0x00:不是;0x01:是*/
|
||||
float constantVoltageV; /* 恒压充电阈值电压(V) */
|
||||
float floatI; /* 浮充充电阈值电流(A) */
|
||||
float startSolarOpenCircuitV; /* 启动充电太阳能板开路电压(V) */
|
||||
float stopSolarOutputCircuitV; /* 停止充电太阳能板输出电压(V) */
|
||||
uint16_t checkCanStartTime; /* 检测能否启动间隔时间(S) */
|
||||
uint16_t shortCircuitJudgmentDelay; /* 短路判断延时(S) */
|
||||
uint16_t inputPowerLowJudgmentDelay; /* 前端输入功率不足判断延时(S) */
|
||||
uint16_t inputPowerLowAgainOutputDelay; /* 前端输入功率不足再次输出延时(S) */
|
||||
uint16_t firstStageProtectionDelay; /* 第一段保护延时(10uS) */
|
||||
float firstStageProtectionCurr; /* 第一段保护电流(A) */
|
||||
uint16_t firstStageProtectionValue; /* 第一段保护ADC值 */
|
||||
uint16_t secondStageProtectionDelay; /* 第二段保护延时(100uS) */
|
||||
float secondStageProtectionCurr; /* 第二段保护电流(A) */
|
||||
uint16_t thirdStageProtectionDelay; /* 第三段保护延时(100uS) */
|
||||
float thirdStageProtectionCurr; /* 第三段保护电流(A) */
|
||||
uint16_t inputPowerLowDetectionDelay; /* 前端输入功率不足检测延时(100uS) */
|
||||
float inputPowerLowDetectionVolt; /* 前端输入功率不足检测电压(V) */
|
||||
float maxOpenSolarOutputCircuitV; /* 最大太阳能板输出电压(V) */
|
||||
float maxChargCurr; /* 最大充电电流(A) */
|
||||
float minCheckLoopImpedanceChargCurr; /* 检测回路阻抗时的最小充电电流(A) */
|
||||
float fullPowerOutputTemperature; /* 满功率输出温度(℃) */
|
||||
float reducePowerOutputTemperature; /* 降功率输出温度(℃) */
|
||||
float stopPowerOutputTemperature; /* 停止输出温度(℃) */
|
||||
float constantVoltageChargeV; /* 恒压充电时的输出电压(V) */
|
||||
float FloatChargeV; /* 浮充充电时的输出电压(V) */
|
||||
uint16_t collectOpenCircuitVoltageTime; /* 充电时采集开路电压的间隔时间 */
|
||||
|
||||
/* SL */
|
||||
uint16_t Access_Node_Type; /* 接入节点类型 */
|
||||
uint16_t Communication_Methods; /* 通信方式 */
|
||||
uint16_t Registration_Status; /* 注册状态 */
|
||||
uint8_t address[7]; /* 地址 */
|
||||
uint8_t startFlagSL[2]; /* 起始标志 */
|
||||
uint8_t endFlagSL; /* 结束标志 */
|
||||
|
||||
/* HY */
|
||||
uint8_t hardwareID[6]; /* 硬件ID */
|
||||
uint8_t communicationID[4]; /* 通信ID */
|
||||
uint8_t protocolType; /* 协议类型; 0x01表示:汇源协议(波特率9600) 0x02表示:南瑞协议(波特率115200)*/
|
||||
uint8_t startFlagHY; /* 起始码 */
|
||||
uint8_t endFlagHY; /* 结束码 */
|
||||
|
||||
uint8_t onlyPower; /* 是否只充当电源板:0x00:不是
|
||||
0x01:是*/
|
||||
|
||||
uint32_t gw485_Baud; /* 串口波特率 */
|
||||
uint32_t bat485_Baud; /* 串口波特率,为0代表bms不支持通信 */
|
||||
} config_parameter;
|
||||
extern config_parameter g_cfgParameter;
|
||||
typedef struct _otherParameter{
|
||||
|
@ -85,8 +66,11 @@ typedef struct _otherParameter{
|
|||
|
||||
int MPPT_Mode; /* 工作模式 */
|
||||
|
||||
uint8_t versionInformation[13]; /* 软件版本信息 */
|
||||
uint8_t versionInformation[13]; /* 软件版本信息 */
|
||||
|
||||
float loopImpedance; /* 回路阻抗大小 (Ω) */
|
||||
|
||||
uint16_t Registration_Status; /* 注册状态 */
|
||||
}otherParameter;
|
||||
|
||||
// #pragma pack(pop)
|
||||
|
@ -134,8 +118,11 @@ float getChargBatteryCurrent(void);
|
|||
BOOL getChargMosState(void);
|
||||
void setChargMosState(BOOL state);
|
||||
BOOL getDischargMosState(void);
|
||||
uint8_t *getVersionInformation(void);
|
||||
|
||||
uint8_t *getVersionnInformation(void);
|
||||
float getLoopImpedance(void);
|
||||
BOOL setLoopImpedance(float loopImpedance);
|
||||
uint16_t getRegistrationStatus(void);
|
||||
void setRegistrationStatus(uint16_t status);
|
||||
|
||||
|
||||
#endif
|
|
@ -10,8 +10,8 @@ void task_Init(void);
|
|||
|
||||
void beginStartControlTask(void);
|
||||
void beginSoftStartTask(void);
|
||||
void beginHYconfigMode(void);
|
||||
void uartTaskInit(void);
|
||||
// void beginHYconfigMode(void);
|
||||
// void uartTaskInit(void);
|
||||
|
||||
void startShortCircuitProtection(void);
|
||||
void stopShortCircuitProtection(void);
|
||||
|
|
|
@ -23,7 +23,9 @@ void Init(void)
|
|||
|
||||
config_info_start();
|
||||
ADC_Capture_Init();
|
||||
proportionalInt(g_cfgParameter.onlyPower);
|
||||
proportionalInt(g_cfgParameter.powerBoxType);
|
||||
|
||||
g_cfgParameter.firstStageProtectionValue = setfirstStageProtectionValue(g_cfgParameter.firstStageProtectionCurr);
|
||||
|
||||
FM_GPIO_Init();
|
||||
tim_Init();
|
||||
|
@ -41,7 +43,6 @@ void Init(void)
|
|||
send_init();
|
||||
// POW_FF_PCON_Open();
|
||||
// POW_OUT_PCON_Open();
|
||||
|
||||
HAL_Delay(100);
|
||||
setPowerOutput(TRUE);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "stdio.h"
|
||||
#include "parameter.h"
|
||||
#include "FM_RTC.h"
|
||||
|
||||
#include "flash.h"
|
||||
|
||||
#define eventsOrderRecordStartAddr 4096
|
||||
|
||||
|
@ -46,7 +46,7 @@ void eventsOrderRecordStartInit(void)
|
|||
soeInfo.outData = NULL;
|
||||
soeInfo.insertData = &soeInfo.data[soeInfo.insertPos];
|
||||
|
||||
read_Flash((uint8_t *)(&soeParameters), sizeof(soeParameters));
|
||||
// read_Flash((uint8_t *)(&soeParameters), sizeof(soeParameters));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,35 +72,35 @@ void insertEventsOrderRecord(eventsOrderRecordMode mode)
|
|||
}
|
||||
|
||||
soeInfo.count--;
|
||||
soeInfo.insertData->data.mode = mode;
|
||||
soeInfo.insertData->mode = mode;
|
||||
getRTC_Time(&soeInfo.insertData->time);
|
||||
|
||||
if (mode == firstStageProtection) {
|
||||
soeInfo.insertData->data.temp = getDischargCurrent();
|
||||
soeInfo.insertData->temp = getDischargCurrent();
|
||||
}
|
||||
|
||||
else if (mode == secondStageProtection) {
|
||||
soeInfo.insertData->data.temp = getDischargCurrent();
|
||||
soeInfo.insertData->temp = getDischargCurrent();
|
||||
}
|
||||
|
||||
else if (mode == thirdStageProtection) {
|
||||
soeInfo.insertData->data.temp = getDischargCurrent();
|
||||
soeInfo.insertData->temp = getDischargCurrent();
|
||||
}
|
||||
|
||||
else if (mode == lowInputLoad) {
|
||||
soeInfo.insertData->data.temp = getOutputVoltage();
|
||||
soeInfo.insertData->temp = getOutputVoltage();
|
||||
}
|
||||
|
||||
else if (mode == overTemperature) {
|
||||
soeInfo.insertData->data.temp = getHighSideMosTemperature();
|
||||
soeInfo.insertData->temp = getHighSideMosTemperature();
|
||||
}
|
||||
|
||||
else if (mode == stopTemperature) {
|
||||
soeInfo.insertData->data.temp = getHighSideMosTemperature();
|
||||
soeInfo.insertData->temp = getHighSideMosTemperature();
|
||||
}
|
||||
|
||||
else if (mode == overchargCurr) {
|
||||
soeInfo.insertData->data.temp = getChargCurrent();
|
||||
soeInfo.insertData->temp = getChargCurrent();
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,7 +109,7 @@ void insertEventsOrderRecord(eventsOrderRecordMode mode)
|
|||
soeInfo.insertPos = 0;
|
||||
}
|
||||
|
||||
if (count <= 0) {
|
||||
if (soeInfo.count <= 0) {
|
||||
soeInfo.insertData = NULL;
|
||||
} else {
|
||||
soeInfo.insertData = &soeInfo.data[soeInfo.insertPos];
|
||||
|
|
|
@ -259,8 +259,13 @@ BOOL getExcessiveLoadFlag(void)
|
|||
*/
|
||||
void setPowerOutput(BOOL state)
|
||||
{
|
||||
// static volatile float temp_OUT_VOLT_IN;
|
||||
// static volatile float temp_PV_VOLT_OUT;
|
||||
// temp_PV_VOLT_OUT = get_PV_VOLT_OUT();
|
||||
// temp_OUT_VOLT_IN = get_OUT_VOLT_IN();
|
||||
if (state == TRUE) {
|
||||
if (get_OUT_VOLT_IN() < (get_PV_VOLT_OUT() - 0.1f)) {
|
||||
if (get_OUT_VOLT_IN() < (get_PV_VOLT_OUT() - 0.1f)) {
|
||||
// if (temp_OUT_VOLT_IN < (temp_PV_VOLT_OUT - 0.5f)) {
|
||||
POW_FF_PCON_Open();
|
||||
POW_OUT_PCON_Open();
|
||||
}
|
||||
|
@ -348,14 +353,14 @@ void lowInputLoadDetection(void)
|
|||
{
|
||||
static int num = 0;
|
||||
|
||||
if (excessiveLoadInterruptFlag == TRUE && getOutputVoltage() < g_cfgParameter.lowInputLoadDetectionVolt) {
|
||||
if (excessiveLoadInterruptFlag == TRUE && getOutputVoltage() < g_cfgParameter.inputPowerLowDetectionVolt) {
|
||||
num++;
|
||||
} else {
|
||||
num = 0;
|
||||
excessiveLoadInterruptFlag = FALSE;
|
||||
}
|
||||
|
||||
if (excessiveLoadInterruptFlag == TRUE && num == g_cfgParameter.lowInputLoadDetectionDelay) {
|
||||
if (excessiveLoadInterruptFlag == TRUE && num == g_cfgParameter.inputPowerLowDetectionDelay) {
|
||||
setOverLoad();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -360,7 +360,7 @@ void mppt_readJust(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (getMosTemperState() == mosTemperEnd) {
|
||||
if (getMosTemperState() == mosTemperReduce) {
|
||||
SolarInCircuitV = 16;
|
||||
}
|
||||
|
||||
|
@ -487,7 +487,7 @@ void startChargWork(void)
|
|||
*/
|
||||
BOOL stopChargConditions(void)
|
||||
{
|
||||
if (getSolarInCircuitVoltage() < g_cfgParameter.stopSolarOpenCircuitV
|
||||
if (getSolarInCircuitVoltage() < g_cfgParameter.stopSolarOutputCircuitV
|
||||
&& getChargCurrent() < 1) {
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -600,7 +600,7 @@ void judgeYNBattery(void)
|
|||
*/
|
||||
void noBatteryChargControl(void)
|
||||
{
|
||||
mppt_constantVoltageNoBatteryO(g_cfgParameter.FloatV);
|
||||
mppt_constantVoltageNoBatteryO(g_cfgParameter.FloatChargeV);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -633,7 +633,7 @@ void constantVoltageCharge(void)
|
|||
*/
|
||||
void floatCharge(void)
|
||||
{
|
||||
mppt_constantVoltageO(g_cfgParameter.FloatV);
|
||||
mppt_constantVoltageO(g_cfgParameter.FloatChargeV);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,422 +0,0 @@
|
|||
|
||||
#include "cfg_protocol.h"
|
||||
#include "uart_dev.h"
|
||||
#include "inFlash.h"
|
||||
#include "parameter.h"
|
||||
#include "string.h"
|
||||
#include "chargControlTypes.h"
|
||||
#include "pDebug.h"
|
||||
|
||||
#define cfgBuffLen 200
|
||||
static uint8_t configBuff[cfgBuffLen];
|
||||
static 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);
|
||||
// memcpy(configBuff, configBuff + 1, sizeof(configBuff) - 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)
|
||||
{
|
||||
static config_info save_configInfo = {0};
|
||||
recv_config_info *pack = (recv_config_info *)configBuff;
|
||||
while (cfigLen >= RECV_CONFIG_INFO) {
|
||||
/* 判断起始标志是否正确 */
|
||||
// debug_printf(" start_Flag : 0x%x, 0x%x \n", pack->start_Flag[0], pack->start_Flag[1]);
|
||||
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];
|
||||
// if (save_configInfo.Access_Node_Type != POWERBOX) {
|
||||
// // debug(" Access_Node_Type : 0x%x \n", save_configInfo.Access_Node_Type);
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* 判断通信方式是否正确 */
|
||||
// save_configInfo.Communication_Methods = (uint16_t)pack->Communication_Methods[0] << 8
|
||||
// | (uint16_t)pack->Communication_Methods[1];
|
||||
// // if (temp_u16 != RS485 || temp_u16 != RJ45) {
|
||||
// if (save_configInfo.Communication_Methods != RS485) {
|
||||
// debug(" Communication_Methods : 0x%x \n", save_configInfo.Communication_Methods);
|
||||
// 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) {
|
||||
debug(" gw485_Baud : %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];
|
||||
if (save_configInfo.bat485_Baud != 9600
|
||||
&& save_configInfo.bat485_Baud!= 115200
|
||||
&& save_configInfo.bat485_Baud!= 0) {
|
||||
debug(" bat485_Baud : 0x%x, %d \n", save_configInfo.bat485_Baud, save_configInfo.bat485_Baud);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断汇源协议类型是否正确 */
|
||||
if (pack->protocolType != 0x01 && pack->protocolType != 0x02) {
|
||||
debug(" protocolType : 0x%x \n", pack->protocolType);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断通信协议类型是否正确 */
|
||||
if (pack->CommunicationProtocolType != 0x00
|
||||
&& pack->CommunicationProtocolType != 0x01) {
|
||||
debug(" CommunicationProtocolType : 0x%x \n", pack->CommunicationProtocolType);
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
||||
/* 判断电源盒类型是否正确 */
|
||||
if (pack->onlyPower != 0x00 && pack->onlyPower != 0x01) {
|
||||
debug(" onlyPower : 0x%x \n", pack->onlyPower);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断恒压充电阈值是否正确 */
|
||||
save_configInfo.constantVoltageV =
|
||||
(float)(pack->ConstantVoltageV[0] << 8 | pack->ConstantVoltageV[1]) / enlargeScale;
|
||||
if (!((save_configInfo.constantVoltageV < 14.4f && save_configInfo.constantVoltageV > 13.5f)
|
||||
|| save_configInfo.constantVoltageV == 0)) {
|
||||
debug(" constantVoltageV : %f \n", save_configInfo.constantVoltageV);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断浮充充电阈值是否正确 */
|
||||
save_configInfo.floatI = (float)(pack->FloatI[0] << 8 | pack->FloatI[1]) / enlargeScale;
|
||||
if (save_configInfo.floatI > 0.2f || save_configInfo.floatI < 0) {
|
||||
debug(" floatI : %f \n", save_configInfo.floatI);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断太阳能板开路启动电压是否正确 */
|
||||
save_configInfo.startSolarOpenCircuitV =
|
||||
(float)(pack->startSolarOpenCircuitV[0] << 8 | pack->startSolarOpenCircuitV[1]) / enlargeScale;
|
||||
if (!((save_configInfo.startSolarOpenCircuitV < 24 && save_configInfo.startSolarOpenCircuitV > 14)
|
||||
|| save_configInfo.startSolarOpenCircuitV == 0)) {
|
||||
debug(" startSolarOpenCircuitV : %f \n", save_configInfo.startSolarOpenCircuitV);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断太阳能板关闭电压是否正确 */
|
||||
save_configInfo.stopSolarOpenCircuitV =
|
||||
(float)(pack->stopSolarOpenCircuitV[0] << 8 | pack->stopSolarOpenCircuitV[1]) / enlargeScale;
|
||||
if (!((save_configInfo.stopSolarOpenCircuitV < 17 && save_configInfo.stopSolarOpenCircuitV > 13)
|
||||
|| save_configInfo.stopSolarOpenCircuitV == 0)) {
|
||||
debug(" stopSolarOpenCircuitV : %f \n", save_configInfo.stopSolarOpenCircuitV);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断恒压充电时的输出电压是否正确 */
|
||||
save_configInfo.constantVoltageChargeV =
|
||||
(float)(pack->constantVoltageChargeV[0] << 8 | pack->constantVoltageChargeV[1]) / enlargeScale;
|
||||
if (!((save_configInfo.constantVoltageChargeV < 14.6f && save_configInfo.constantVoltageChargeV > 14)
|
||||
|| save_configInfo.constantVoltageChargeV == 0)) {
|
||||
debug(" constantVoltageChargeV : %f \n", save_configInfo.constantVoltageChargeV);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断浮充充电时的输出电压是否正确 */
|
||||
save_configInfo.FloatChargeV =
|
||||
(float)(pack->FloatChargeV[0] << 8 | pack->FloatChargeV[1]) / enlargeScale;
|
||||
if (!((save_configInfo.FloatChargeV < 14.4f && save_configInfo.FloatChargeV > 13.8f)
|
||||
|| save_configInfo.FloatChargeV == 0)) {
|
||||
debug(" FloatChargeV : %f \n", save_configInfo.FloatChargeV);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断mos管停止工作温度是否正确 */
|
||||
save_configInfo.HighSideMosTemperature_stop =
|
||||
(float)(pack->HighSideMosTemperature_stop[0] << 8 | pack->HighSideMosTemperature_stop[1]) / enlargeScale;
|
||||
if (save_configInfo.HighSideMosTemperature_stop < 50 && save_configInfo.HighSideMosTemperature_stop != 0) {
|
||||
debug(" HighSideMosTemperature_stop : %f \n", save_configInfo.HighSideMosTemperature_stop);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断mos管降低工作功率工作温度是否正确 */
|
||||
save_configInfo.HighSideMosTemperature_end =
|
||||
(float)(pack->HighSideMosTemperature_end[0] << 8 | pack->HighSideMosTemperature_end[1]) / enlargeScale;
|
||||
if (save_configInfo.HighSideMosTemperature_end < 40 && save_configInfo.HighSideMosTemperature_end != 0) {
|
||||
debug(" HighSideMosTemperature_end : %f \n", save_configInfo.HighSideMosTemperature_end);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断mos管完全恢复工作温度是否正确 */
|
||||
save_configInfo.HighSideMosTemperature_start =
|
||||
(float)(pack->HighSideMosTemperature_start[0] << 8 | pack->HighSideMosTemperature_start[1]) / enlargeScale;
|
||||
if (save_configInfo.HighSideMosTemperature_start > 70 && save_configInfo.HighSideMosTemperature_start != 0) {
|
||||
debug(" HighSideMosTemperature_start : %d \n", save_configInfo.HighSideMosTemperature_start);
|
||||
goto err;
|
||||
}
|
||||
|
||||
// /* 判断启动任务中太阳能板开路电压检测间隔时间是否正确 */
|
||||
// save_configInfo.checkSolarOpenCircuitVTime =
|
||||
// pack->checkSolarOpenCircuitVTime[0] << 8 | pack->checkSolarOpenCircuitVTime[1];
|
||||
// if (save_configInfo.checkSolarOpenCircuitVTime > 1800 || save_configInfo.checkSolarOpenCircuitVTime < 5) {
|
||||
// debug(" checkSolarOpenCircuitVTime : %d \n", save_configInfo.checkSolarOpenCircuitVTime);
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
// /* 判断传感器运行再次注册的间隔是否正确 */
|
||||
// save_configInfo.sensorEnableBroadcastTime =
|
||||
// pack->sensorEnableBroadcastTime[0] << 8 | pack->sensorEnableBroadcastTime[1];
|
||||
// if (save_configInfo.sensorEnableBroadcastTime > 60 || save_configInfo.sensorEnableBroadcastTime < 10) {
|
||||
// debug(" sensorEnableBroadcastTime : %d \n", save_configInfo.sensorEnableBroadcastTime);
|
||||
// goto err;
|
||||
// }
|
||||
|
||||
/* 判断出现短路保护后延长该段时间再次检测是否短路,仍然短路则关闭输出的间隔是否正确 */
|
||||
save_configInfo.outputAgainFlagTime =
|
||||
pack->outputAgainFlagTime[0] << 8 | pack->outputAgainFlagTime[1];
|
||||
if (!((save_configInfo.outputAgainFlagTime < 30 && save_configInfo.outputAgainFlagTime > 5)
|
||||
|| save_configInfo.outputAgainFlagTime == 0)) {
|
||||
debug(" outputAgainFlagTime : %d \n", save_configInfo.outputAgainFlagTime);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断出现过载后,在该间隔时间中多次(2次)出现过载,则关闭输出的间隔是否正确 */
|
||||
save_configInfo.excessiveLoadFlagTime =
|
||||
pack->excessiveLoadFlagTime[0] << 8 | pack->excessiveLoadFlagTime[1];
|
||||
if (!((save_configInfo.excessiveLoadFlagTime < 90 && save_configInfo.excessiveLoadFlagTime > 20)
|
||||
|| save_configInfo.excessiveLoadFlagTime == 0)) {
|
||||
debug(" excessiveLoadFlagTime : %d \n", save_configInfo.excessiveLoadFlagTime);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 判断出现过载过载保护后,在该间隔段时间后,再次尝试输出的间隔是否正确 */
|
||||
save_configInfo.eLAgainTime = pack->eLAgainTime[0] << 8 | pack->eLAgainTime[1];
|
||||
if (save_configInfo.eLAgainTime > 3000 || save_configInfo.eLAgainTime < 1000) {
|
||||
debug(" eLAgainTime : %d \n", save_configInfo.eLAgainTime);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* crc校验 */
|
||||
save_configInfo.crc = pack->crc[0] << 8 | pack->crc[1];
|
||||
if (save_configInfo.crc != checkModebusCrc(configBuff, RECV_CONFIG_INFO - 3)) {
|
||||
debug(" crc : %x%x \n", pack->crc[0], pack->crc[1]);
|
||||
debug(" checkModebusCrc : %x \n", checkModebusCrc(configBuff, RECV_CONFIG_INFO));
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
||||
/* 结束标志 */
|
||||
if (pack->end_Flag != 0x16) {
|
||||
debug(" end_Flag : %x \n", pack->end_Flag);
|
||||
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);
|
||||
saveConfigInfo(&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());
|
||||
// }
|
||||
uart_dev_write(g_gw485_uart2_handle, "hello world\n", sizeof("hello world\n"));
|
||||
|
||||
HAL_Delay(1000);
|
||||
|
||||
/* 复位 */
|
||||
NVIC_SystemReset();
|
||||
|
||||
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
|
@ -2,7 +2,7 @@
|
|||
#include "inFlash.h"
|
||||
#include "parameter.h"
|
||||
#include "pDebug.h"
|
||||
#include "cfg_protocol.h"
|
||||
//#include "cfg_protocol.h"
|
||||
#include "configParameter.h"
|
||||
|
||||
static void save_config_info(config_info *save_config_info);
|
||||
|
@ -59,22 +59,21 @@ void saveConfigInfo(config_info *configInfo)
|
|||
* @retval None
|
||||
*
|
||||
*/
|
||||
static void readFlashContent(config_info *configInfo)
|
||||
void readFlashContent(config_info *configInfo)
|
||||
{
|
||||
read_config_info(configInfo);
|
||||
/* 配置文件正确就返回 */
|
||||
// static volatile uint16_t tempCrc1, tempCrc2;
|
||||
// static volatile config_info *tempConfigInfo1;
|
||||
// tempConfigInfo1 = configInfo;
|
||||
// tempCrc1 = configInfo->crc;
|
||||
// tempCrc2 = checkModebusCrc((uint8_t *)configInfo, CONFIG_INFO_SIZE - 2);
|
||||
// if (tempCrc1 == tempCrc2) {
|
||||
// return;
|
||||
// }
|
||||
// static volatile uint16_t tempCrc1, tempCrc2;
|
||||
// tempCrc1 = configInfo->crc;
|
||||
// tempCrc2 = checkModebusCrc((uint8_t *)configInfo, CONFIG_INFO_SIZE - 2);
|
||||
// if (tempCrc1 == tempCrc2) {
|
||||
// return;
|
||||
// }
|
||||
if (configInfo->crc == checkModebusCrc((uint8_t *)configInfo, CONFIG_INFO_SIZE - 2)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// /* 更深处的配置文件正确就返回 */
|
||||
// read_backups_config_info(config_info);
|
||||
// if (config_info->crc == configCheckFunc((uint8_t *)config_info, CONFIG_INFO_SIZE - 2)) {
|
||||
|
@ -83,48 +82,65 @@ static void readFlashContent(config_info *configInfo)
|
|||
// }
|
||||
|
||||
/* 配置文件错误使用默认配置 */
|
||||
configInfo->address[0] = 0x11;
|
||||
configInfo->address[1] = 0x11;
|
||||
configInfo->address[2] = 0x11;
|
||||
configInfo->address[3] = 0x11;
|
||||
configInfo->address[4] = 0x11;
|
||||
configInfo->address[5] = 0x11;
|
||||
configInfo->address[6] = 0x11;
|
||||
// config_info->Access_Node_Type = 0x01;
|
||||
// config_info->Communication_Methods = 0x02;
|
||||
configInfo->uniqueDeviceID[0] = 0x11;
|
||||
configInfo->uniqueDeviceID[1] = 0x11;
|
||||
configInfo->uniqueDeviceID[2] = 0x11;
|
||||
configInfo->uniqueDeviceID[3] = 0x11;
|
||||
configInfo->uniqueDeviceID[4] = 0x11;
|
||||
configInfo->uniqueDeviceID[5] = 0x11;
|
||||
configInfo->uniqueDeviceID[6] = 0x11;
|
||||
|
||||
configInfo->gw485_Baud = 115200;
|
||||
configInfo->bat485_Baud = 115200;
|
||||
|
||||
configInfo->hardwareID[0] = 0x48;
|
||||
configInfo->hardwareID[1] = 0x59;
|
||||
configInfo->hardwareID[2] = 0x30;
|
||||
configInfo->hardwareID[3] = 0x30;
|
||||
configInfo->hardwareID[4] = 0x30;
|
||||
configInfo->hardwareID[5] = 0x31;
|
||||
configInfo->communicationID[0] = 0x00;
|
||||
configInfo->communicationID[1] = 0x00;
|
||||
configInfo->communicationID[2] = 0x00;
|
||||
configInfo->communicationID[3] = 0x01;
|
||||
configInfo->protocolType = 0x01;
|
||||
|
||||
configInfo->CommunicationProtocolType = 0x01;
|
||||
configInfo->onlyPower = 0x01;
|
||||
configInfo->powerBoxType = 0x01;
|
||||
|
||||
configInfo->constantVoltageV = 14;
|
||||
configInfo->floatI = 0.1f;
|
||||
configInfo->startSolarOpenCircuitV = 17;
|
||||
configInfo->stopSolarOpenCircuitV = 15;
|
||||
configInfo->stopSolarOutputCircuitV = 15;
|
||||
|
||||
configInfo->checkCanStartTime = 5;
|
||||
configInfo->shortCircuitJudgmentDelay = 10;
|
||||
configInfo->inputPowerLowJudgmentDelay = 30;
|
||||
configInfo->inputPowerLowAgainOutputDelay = 1800;
|
||||
|
||||
configInfo->firstStageProtectionDelay = 2;
|
||||
configInfo->firstStageProtectionCurr = 50;
|
||||
configInfo->secondStageProtectionDelay = 50000;
|
||||
configInfo->secondStageProtectionCurr = 35;
|
||||
configInfo->thirdStageProtectionDelay = 600000;
|
||||
configInfo->thirdStageProtectionCurr = 30;
|
||||
|
||||
configInfo->inputPowerLowDetectionDelay = 10;
|
||||
configInfo->inputPowerLowDetectionVolt = 10.0f;
|
||||
|
||||
configInfo->maxOpenSolarOutputCircuitV = 25;
|
||||
configInfo->maxChargCurr = 35;
|
||||
|
||||
configInfo->minCheckLoopImpedanceChargCurr = 5;
|
||||
|
||||
configInfo->stopPowerOutputTemperature = 100;
|
||||
configInfo->reducePowerOutputTemperature = 90;
|
||||
configInfo->fullPowerOutputTemperature = 50;
|
||||
|
||||
configInfo->constantVoltageChargeV = 14.4f;
|
||||
configInfo->FloatChargeV = 14.2f;
|
||||
configInfo->HighSideMosTemperature_stop = 100;
|
||||
configInfo->HighSideMosTemperature_end = 90;
|
||||
configInfo->HighSideMosTemperature_start = 50;
|
||||
configInfo->collectOpenCircuitVoltageTime = 1800;
|
||||
|
||||
// configInfo->firstStageProtectionCurr = firstStageProtectionCurrMacro;
|
||||
// configInfo->firstStageProtectionDelay = firstStageProtectionDelayMacro;
|
||||
// configInfo->firstStageProtectionValue = firstStageProtectionValueMacro;
|
||||
// configInfo->secondStageProtectionCurr = secondStageProtectionCurrMacro;
|
||||
// configInfo->secondStageProtectionDelay = secondStageProtectionDelayMacro;
|
||||
// configInfo->thirdStageProtectionCurr = thirdStageProtectionCurrMacro;
|
||||
// configInfo->thirdStageProtectionDelay = thirdStageProtectionDelayMacro;
|
||||
// configInfo->checkLoopImpedanceChargCurr = checkLoopImpedanceChargCurrMacro;
|
||||
// configInfo->lowInputLoadDetectionVolt = lowInputLoadDetectionVoltMacro;
|
||||
// configInfo->lowInputLoadDetectionDelay = lowInputLoadDetectionDelayMacro;
|
||||
// configInfo->maxChargCurr = maxChargCurrMacro;
|
||||
// configInfo->maxOpenSolarOpenCircuitV = maxOpenSolarOpenCircuitVMacro;
|
||||
|
||||
// configInfo->checkSolarOpenCircuitVTime = 10;
|
||||
// configInfo->sensorEnableBroadcastTime = 20;
|
||||
configInfo->outputAgainFlagTime = 10;
|
||||
configInfo->excessiveLoadFlagTime = 60;
|
||||
configInfo->eLAgainTime = 1800;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,74 +156,65 @@ void config_info_start(void)
|
|||
config_info temp_configInfo;
|
||||
readFlashContent(&temp_configInfo);
|
||||
|
||||
g_cfgParameter.constantVoltageV = temp_configInfo.constantVoltageV;
|
||||
g_cfgParameter.floatI = temp_configInfo.floatI;
|
||||
g_cfgParameter.startSolarOpenCircuitV = temp_configInfo.startSolarOpenCircuitV;
|
||||
g_cfgParameter.stopSolarOpenCircuitV = temp_configInfo.stopSolarOpenCircuitV;
|
||||
g_cfgParameter.constantVoltageChargeV = temp_configInfo.constantVoltageChargeV;
|
||||
g_cfgParameter.FloatV = temp_configInfo.FloatChargeV;
|
||||
g_cfgParameter.HighSideMosTemperature_stop = temp_configInfo.HighSideMosTemperature_stop;
|
||||
g_cfgParameter.HighSideMosTemperature_end = temp_configInfo.HighSideMosTemperature_end;
|
||||
g_cfgParameter.HighSideMosTemperature_start = temp_configInfo.HighSideMosTemperature_start;
|
||||
// g_cfgParameter.sensorEnableBroadcastTime = temp_configInfo.sensorEnableBroadcastTime;
|
||||
// g_cfgParameter.checkSolarOpenCircuitVTime = temp_configInfo.checkSolarOpenCircuitVTime;
|
||||
g_cfgParameter.outputAgainFlagTime = temp_configInfo.outputAgainFlagTime;
|
||||
g_cfgParameter.excessiveLoadFlagTime = temp_configInfo.excessiveLoadFlagTime;
|
||||
g_cfgParameter.eLAgainTime = temp_configInfo.eLAgainTime;
|
||||
g_cfgParameter.collectOpenCircuitVoltageTime= 3600;
|
||||
g_cfgParameter.address[0] = temp_configInfo.address[0];
|
||||
g_cfgParameter.address[1] = temp_configInfo.address[1];
|
||||
g_cfgParameter.address[2] = temp_configInfo.address[2];
|
||||
g_cfgParameter.address[3] = temp_configInfo.address[3];
|
||||
g_cfgParameter.address[4] = temp_configInfo.address[4];
|
||||
g_cfgParameter.address[5] = temp_configInfo.address[5];
|
||||
g_cfgParameter.address[6] = temp_configInfo.address[6];
|
||||
// g_cfgParameter.Access_Node_Type = temp_configInfo.Access_Node_Type;
|
||||
// g_cfgParameter.Communication_Methods = temp_configInfo.Communication_Methods;
|
||||
g_cfgParameter.hardwareID[0] = temp_configInfo.hardwareID[0];
|
||||
g_cfgParameter.hardwareID[1] = temp_configInfo.hardwareID[1];
|
||||
g_cfgParameter.hardwareID[2] = temp_configInfo.hardwareID[2];
|
||||
g_cfgParameter.hardwareID[3] = temp_configInfo.hardwareID[3];
|
||||
g_cfgParameter.hardwareID[4] = temp_configInfo.hardwareID[4];
|
||||
g_cfgParameter.hardwareID[5] = temp_configInfo.hardwareID[5];
|
||||
g_cfgParameter.communicationID[0] = temp_configInfo.communicationID[0];
|
||||
g_cfgParameter.communicationID[1] = temp_configInfo.communicationID[1];
|
||||
g_cfgParameter.communicationID[2] = temp_configInfo.communicationID[2];
|
||||
g_cfgParameter.communicationID[3] = temp_configInfo.communicationID[3];
|
||||
g_cfgParameter.protocolType = temp_configInfo.protocolType;
|
||||
// g_cfgParameter.CommunicationProtocolType = temp_configInfo.CommunicationProtocolType;
|
||||
g_cfgParameter.onlyPower = temp_configInfo.onlyPower;
|
||||
|
||||
g_cfgParameter.startFlagSL[0] = 'S';
|
||||
g_cfgParameter.startFlagSL[1] = 'L';
|
||||
g_cfgParameter.endFlagSL = 0x16;
|
||||
g_cfgParameter.startFlagHY = 0x68;
|
||||
g_cfgParameter.endFlagHY = 0x16;
|
||||
|
||||
// if (g_cfgParameter.CommunicationProtocolType == 0x00) {
|
||||
// g_cfgParameter.gw485_Baud = temp_configInfo.gw485_Baud;
|
||||
// g_cfgParameter.bat485_Baud = temp_configInfo.bat485_Baud;
|
||||
// } else if (g_cfgParameter.CommunicationProtocolType == 0x01) {
|
||||
// g_cfgParameter.bat485_Baud = temp_configInfo.bat485_Baud;
|
||||
// if (g_cfgParameter.protocolType == 0x01) {
|
||||
// g_cfgParameter.gw485_Baud = 9600;
|
||||
// } else if (g_cfgParameter.protocolType == 0x02) {
|
||||
// g_cfgParameter.gw485_Baud = 115200;
|
||||
// }
|
||||
// }
|
||||
g_cfgParameter.gw485_Baud = 115200;
|
||||
g_cfgParameter.bat485_Baud = 115200;
|
||||
g_cfgParameter.Access_Node_Type = POWERBOX;
|
||||
g_cfgParameter.Communication_Methods = RS485;
|
||||
|
||||
g_cfgParameter.gw485_Baud = temp_configInfo.gw485_Baud;
|
||||
g_cfgParameter.bat485_Baud = temp_configInfo.bat485_Baud;
|
||||
|
||||
g_cfgParameter.uniqueDeviceID[0] = temp_configInfo.uniqueDeviceID[0];
|
||||
g_cfgParameter.uniqueDeviceID[1] = temp_configInfo.uniqueDeviceID[1];
|
||||
g_cfgParameter.uniqueDeviceID[2] = temp_configInfo.uniqueDeviceID[2];
|
||||
g_cfgParameter.uniqueDeviceID[3] = temp_configInfo.uniqueDeviceID[3];
|
||||
g_cfgParameter.uniqueDeviceID[4] = temp_configInfo.uniqueDeviceID[4];
|
||||
g_cfgParameter.uniqueDeviceID[5] = temp_configInfo.uniqueDeviceID[5];
|
||||
g_cfgParameter.uniqueDeviceID[6] = temp_configInfo.uniqueDeviceID[6];
|
||||
|
||||
g_cfgParameter.powerBoxType = temp_configInfo.powerBoxType;
|
||||
|
||||
g_cfgParameter.constantVoltageV = temp_configInfo.constantVoltageV;
|
||||
g_cfgParameter.floatI = temp_configInfo.floatI;
|
||||
|
||||
g_cfgParameter.startSolarOpenCircuitV = temp_configInfo.startSolarOpenCircuitV;
|
||||
g_cfgParameter.stopSolarOutputCircuitV = temp_configInfo.stopSolarOutputCircuitV;
|
||||
|
||||
g_cfgParameter.checkCanStartTime = temp_configInfo.checkCanStartTime;
|
||||
g_cfgParameter.shortCircuitJudgmentDelay = temp_configInfo.shortCircuitJudgmentDelay;
|
||||
g_cfgParameter.inputPowerLowJudgmentDelay = temp_configInfo.inputPowerLowJudgmentDelay;
|
||||
g_cfgParameter.inputPowerLowAgainOutputDelay= temp_configInfo.inputPowerLowAgainOutputDelay;
|
||||
|
||||
g_cfgParameter.firstStageProtectionCurr = temp_configInfo.firstStageProtectionCurr;
|
||||
g_cfgParameter.firstStageProtectionDelay = temp_configInfo.firstStageProtectionDelay;
|
||||
g_cfgParameter.secondStageProtectionCurr = temp_configInfo.secondStageProtectionCurr;
|
||||
g_cfgParameter.secondStageProtectionDelay = temp_configInfo.secondStageProtectionDelay;
|
||||
g_cfgParameter.thirdStageProtectionCurr = temp_configInfo.thirdStageProtectionCurr;
|
||||
g_cfgParameter.thirdStageProtectionDelay = temp_configInfo.thirdStageProtectionDelay;
|
||||
|
||||
g_cfgParameter.inputPowerLowDetectionDelay = temp_configInfo.inputPowerLowDetectionDelay;
|
||||
g_cfgParameter.inputPowerLowDetectionVolt = temp_configInfo.inputPowerLowDetectionVolt;
|
||||
|
||||
g_cfgParameter.maxOpenSolarOutputCircuitV = temp_configInfo.maxOpenSolarOutputCircuitV;
|
||||
g_cfgParameter.maxChargCurr = temp_configInfo.maxChargCurr;
|
||||
g_cfgParameter.minCheckLoopImpedanceChargCurr = temp_configInfo.minCheckLoopImpedanceChargCurr;
|
||||
g_cfgParameter.stopPowerOutputTemperature = temp_configInfo.stopPowerOutputTemperature;
|
||||
g_cfgParameter.reducePowerOutputTemperature = temp_configInfo.reducePowerOutputTemperature;
|
||||
g_cfgParameter.fullPowerOutputTemperature = temp_configInfo.fullPowerOutputTemperature;
|
||||
|
||||
g_cfgParameter.constantVoltageChargeV = temp_configInfo.constantVoltageChargeV;
|
||||
g_cfgParameter.FloatChargeV = temp_configInfo.FloatChargeV;
|
||||
g_cfgParameter.collectOpenCircuitVoltageTime= temp_configInfo.collectOpenCircuitVoltageTime;
|
||||
|
||||
/* 读取的回路阻抗无效则回路阻抗设置为0 */
|
||||
if (readLoopImpedance() == FALSE) {
|
||||
setLoopImpedance(0);
|
||||
saveLoopImpedance();
|
||||
}
|
||||
|
||||
float fTemp;
|
||||
readLoopImpedance(&fTemp);
|
||||
/* 读取的回路阻抗偏差过大则不使用 */
|
||||
if (fTemp > (float)0.005 && fTemp < (float)1) {
|
||||
g_cfgParameter.loopImpedance = fTemp;
|
||||
}
|
||||
else {
|
||||
g_cfgParameter.loopImpedance = 0;
|
||||
saveLoopImpedance(&g_cfgParameter.loopImpedance);
|
||||
}
|
||||
readtotalElectricityConsumption(&fTemp);
|
||||
totalElectricityConsumptionInt(fTemp);
|
||||
readtotalChargCapacity(&fTemp);
|
||||
|
@ -216,39 +223,30 @@ void config_info_start(void)
|
|||
timeInfo time;
|
||||
readTime(&time);
|
||||
setLastTime(time);
|
||||
|
||||
g_cfgParameter.firstStageProtectionCurr = firstStageProtectionCurrMacro;
|
||||
g_cfgParameter.firstStageProtectionDelay = firstStageProtectionDelayMacro;
|
||||
g_cfgParameter.firstStageProtectionValue = firstStageProtectionValueMacro;
|
||||
g_cfgParameter.secondStageProtectionCurr = secondStageProtectionCurrMacro;
|
||||
g_cfgParameter.secondStageProtectionDelay = secondStageProtectionDelayMacro;
|
||||
g_cfgParameter.thirdStageProtectionCurr = thirdStageProtectionCurrMacro;
|
||||
g_cfgParameter.thirdStageProtectionDelay = thirdStageProtectionDelayMacro;
|
||||
g_cfgParameter.checkLoopImpedanceChargCurr = checkLoopImpedanceChargCurrMacro;
|
||||
g_cfgParameter.lowInputLoadDetectionVolt = lowInputLoadDetectionVoltMacro;
|
||||
g_cfgParameter.lowInputLoadDetectionDelay = lowInputLoadDetectionDelayMacro;
|
||||
g_cfgParameter.maxChargCurr = maxChargCurrMacro;
|
||||
g_cfgParameter.maxOpenSolarOpenCircuitV = maxOpenSolarOpenCircuitVMacro;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief 保存回路阻抗在flash中
|
||||
* @param
|
||||
*/
|
||||
void saveLoopImpedance(float *loopImpedance)
|
||||
void saveLoopImpedance(void)
|
||||
{
|
||||
write_Flash((uint8_t *)loopImpedance, LoopImpedance_SAVE_addr, sizeof(float));
|
||||
float loopImpedance;
|
||||
loopImpedance = getLoopImpedance();
|
||||
write_Flash((uint8_t *)&loopImpedance, LoopImpedance_SAVE_addr, sizeof(float));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 读取flash中的回路阻抗
|
||||
* @param
|
||||
*/
|
||||
void readLoopImpedance(float *loopImpedance)
|
||||
BOOL readLoopImpedance(void)
|
||||
{
|
||||
read_Flash((uint8_t *)loopImpedance, LoopImpedance_SAVE_addr, sizeof(float));
|
||||
float loopImpedance;
|
||||
read_Flash((uint8_t *)&loopImpedance, LoopImpedance_SAVE_addr, sizeof(float));
|
||||
return setLoopImpedance(loopImpedance);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "interruptSend.h"
|
||||
|
||||
|
||||
#define RS485_MAX_PACK_DATA_LEN 60
|
||||
#define RS485_MAX_PACK_DATA_LEN 256
|
||||
|
||||
static uint8_t dataLocation1[RS485_MAX_PACK_DATA_LEN];
|
||||
static uint8_t dataLocation2[RS485_MAX_PACK_DATA_LEN];
|
||||
|
@ -55,7 +55,7 @@ typedef struct _uart_send_info {
|
|||
/* 恢复默认的对齐设置 */
|
||||
#pragma pack(pop)
|
||||
|
||||
static uart_send_info uart_send = {0};
|
||||
uart_send_info uart_send = {0};
|
||||
|
||||
/**
|
||||
* @brief 串口中断发送的初始化,通过空闲中断来判断总线空闲状态
|
||||
|
@ -162,6 +162,12 @@ void setBatState(void)
|
|||
*/
|
||||
void setSendOverStateGw(void)
|
||||
{
|
||||
/* 配置文件传输完成,复位 */
|
||||
if (uart_send.sendDataGw->data[9] = 0xD0
|
||||
&& uart_send.sendDataGw->data[12] == 0xAA) {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
uart_send.sendOverStateGw = TRUE;
|
||||
uart_send.sendStateGw = FALSE;
|
||||
uart_send.sendDataGw->dataState = FALSE;
|
||||
|
@ -192,7 +198,7 @@ void setSendOverStateBat(void)
|
|||
uart_send.sendStateBat = FALSE;
|
||||
uart_send.sendDataBat->dataState = FALSE;
|
||||
uart_send.sendDataBat = NULL;
|
||||
uart_send.insertState++;
|
||||
uart_send.insertState++;
|
||||
|
||||
/* 插入指针指向为空时 */
|
||||
if (uart_send.data1.dataState == FALSE) {
|
||||
|
@ -315,3 +321,46 @@ void uart_interruptSend(device_handle device, uint8_t buff[], uint8_t len)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 得到中断发送插入数据指针
|
||||
* @param
|
||||
* @retval
|
||||
*
|
||||
*/
|
||||
uint8_t *getInsertData(void)
|
||||
{
|
||||
return uart_send.insertData->data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 将数据发送指针的内容发送
|
||||
* @param
|
||||
* @retval
|
||||
*
|
||||
*/
|
||||
void uart_insertDataSend(device_handle device, uint8_t len)
|
||||
{
|
||||
uart_send.insertData->Counter = 0;
|
||||
uart_send.insertData->dataLen = len;
|
||||
uart_send.insertData->device = device;
|
||||
|
||||
uart_send.insertData->dataState = TRUE;
|
||||
uart_send.insertState--;
|
||||
|
||||
/* 可插入数据大于0时,将插入指针指向空的储存位置,否则指向NULL */
|
||||
if (uart_send.insertState > 0) {
|
||||
if (uart_send.data1.dataState == FALSE) {
|
||||
uart_send.insertData = &uart_send.data1;
|
||||
}
|
||||
else if (uart_send.data2.dataState == FALSE) {
|
||||
uart_send.insertData = &uart_send.data2;
|
||||
}
|
||||
else if (uart_send.data3.dataState == FALSE) {
|
||||
uart_send.insertData = &uart_send.data3;
|
||||
}
|
||||
} else {
|
||||
uart_send.insertData = NULL;
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ static otherParameter g_otherParameter = {0};
|
|||
|
||||
static BOOL batteryState = FALSE; /* 有无电池(估计) */
|
||||
static float dutyRatio = 0; /* 占空比 */
|
||||
static uint8_t mosTemperState = mosTemperStart; /* mos管温度状态 */
|
||||
static uint8_t mosTemperState = mosTemperFull; /* mos管温度状态 */
|
||||
static BOOL checkImpedanceState = FALSE; /* 启动后是否进行了回路阻抗检测 */
|
||||
static timeInfo lastTime = {0}; /* 上次读取充放电量参数的时间 */
|
||||
|
||||
|
@ -98,7 +98,7 @@ uint8_t getMosTemperState(void)
|
|||
*/
|
||||
void setMosTemperState(uint8_t state)
|
||||
{
|
||||
if (state == mosTemperStart || state == mosTemperEnd || state == mosTemperStop) {
|
||||
if (state == mosTemperFull || state == mosTemperReduce || state == mosTemperStop) {
|
||||
mosTemperState = state;
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ float getBatteryVoltage(void)
|
|||
void setBatteryVoltage(void)
|
||||
{
|
||||
g_otherParameter.Battery_Voltage = g_otherParameter.Output_Voltage
|
||||
- getChargBatteryCurrent() * g_cfgParameter.loopImpedance;
|
||||
- getChargBatteryCurrent() * getLoopImpedance();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -456,7 +456,7 @@ void setChargMosState(BOOL state)
|
|||
*/
|
||||
BOOL getDischargMosState(void)
|
||||
{
|
||||
if (g_cfgParameter.onlyPower) {
|
||||
if (g_cfgParameter.powerBoxType) {
|
||||
return readOnlyPowerOutputState();
|
||||
} else {
|
||||
return readOutputState();
|
||||
|
@ -468,8 +468,55 @@ BOOL getDischargMosState(void)
|
|||
* @param
|
||||
* @retval softVer 软件版本号
|
||||
*/
|
||||
uint8_t *getVersionInformation(void)
|
||||
uint8_t *getVersionnInformation(void)
|
||||
{
|
||||
return softVer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 得到回路阻抗大小
|
||||
* @param
|
||||
* @retval 回路阻抗大小
|
||||
*/
|
||||
float getLoopImpedance(void)
|
||||
{
|
||||
return g_otherParameter.loopImpedance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 设置回路阻抗大小
|
||||
* @param loopImpedance 回路阻抗大小
|
||||
* @retval
|
||||
*/
|
||||
BOOL setLoopImpedance(float loopImpedance)
|
||||
{
|
||||
/* 读取的回路阻抗偏差过大则不使用 */
|
||||
if (loopImpedance < 0 || loopImpedance > 0.3f) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_otherParameter.loopImpedance = loopImpedance;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 得到注册状态
|
||||
* @param
|
||||
* @retval 注册状态
|
||||
*/
|
||||
uint16_t getRegistrationStatus(void)
|
||||
{
|
||||
return g_otherParameter.Registration_Status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 设置注册状态
|
||||
* @param 注册状态
|
||||
* @retval
|
||||
*/
|
||||
void setRegistrationStatus(uint16_t status)
|
||||
{
|
||||
if (status == UNREGISTER || status == REGISTER_FAIL || status == REGISTER_SUCCESS) {
|
||||
g_otherParameter.Registration_Status = status;
|
||||
}
|
||||
}
|
|
@ -5,16 +5,20 @@
|
|||
#include "FM_GPIO.h"
|
||||
#include "chargControlTypes.h"
|
||||
#include "bl_chargControl.h"
|
||||
#include "hy_protocol.h"
|
||||
#include "cfg_protocol.h"
|
||||
//#include "hy_protocol.h"
|
||||
//#include "cfg_protocol.h"
|
||||
#include "uart_dev.h"
|
||||
#include "abnormalManage.h"
|
||||
#include "interruptSend.h"
|
||||
#include "configParameter.h"
|
||||
#include "capture.h"
|
||||
#include "bl_usart.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
|
||||
/* 控制运行指示灯和喂狗 */
|
||||
#define runled_reloadVal 2000 /* 任务执行间隔 */
|
||||
// static uint16_t runled_reloadVal = 1000; /* 任务执行间隔 */
|
||||
|
@ -23,7 +27,7 @@ static STR_TimeSliceOffset m_runled;
|
|||
static void Task_Runled(void);
|
||||
|
||||
/* 喂狗 */
|
||||
#define wdi_reloadVal 1000 /* 任务执行间隔 */
|
||||
#define wdi_reloadVal 3000 /* 任务执行间隔 */
|
||||
#define wdi_offset 0 /* 任务执行偏移量 */
|
||||
static STR_TimeSliceOffset m_wdi;
|
||||
static void Task_wdi(void);
|
||||
|
@ -58,31 +62,31 @@ static void Task_impedanceCalculation(void);
|
|||
STR_TimeSliceOffset m_collectOpenCircuitVoltage;
|
||||
void Task_collectOpenCircuitVoltage(void);
|
||||
|
||||
/* 限时开启HY协议配置模式 */
|
||||
#define beginHYconfigMode_reloadVal 1000 /* 任务执行间隔 */
|
||||
#define beginHYconfigMode_offset 0 /* 任务执行偏移量 */
|
||||
static STR_TimeSliceOffset m_beginHYconfigMode;
|
||||
static void Task_beginHYconfigMode(void);
|
||||
// /* 限时开启HY协议配置模式 */
|
||||
// #define beginHYconfigMode_reloadVal 1000 /* 任务执行间隔 */
|
||||
// #define beginHYconfigMode_offset 0 /* 任务执行偏移量 */
|
||||
// static STR_TimeSliceOffset m_beginHYconfigMode;
|
||||
// static void Task_beginHYconfigMode(void);
|
||||
|
||||
/* 串口数据接收判断 */
|
||||
#define usartJudge_reloadVal 100 /* 任务执行间隔 */
|
||||
#define usartJudge_offset 0 /* 任务执行偏移量 */
|
||||
static STR_TimeSliceOffset m_usartJudge;
|
||||
static void Task_usartJudge(void);
|
||||
// /* 串口数据接收判断 */
|
||||
// #define usartJudge_reloadVal 100 /* 任务执行间隔 */
|
||||
// #define usartJudge_offset 0 /* 任务执行偏移量 */
|
||||
// static STR_TimeSliceOffset m_usartJudge;
|
||||
// static void Task_usartJudge(void);
|
||||
|
||||
/* 串口数据解析和处理 */
|
||||
#define usartHandle_reloadVal 20 /* 任务执行间隔 */
|
||||
#define usartHandle_offset 0 /* 任务执行偏移量 */
|
||||
static STR_TimeSliceOffset m_usartHandle;
|
||||
static void Task_usartHandle(void);
|
||||
typedef void (*uartJudgeHandle)(device_handle device);
|
||||
static uartJudgeHandle uart_judge_handle;
|
||||
// /* 串口数据解析和处理 */
|
||||
// #define usartHandle_reloadVal 20 /* 任务执行间隔 */
|
||||
// #define usartHandle_offset 0 /* 任务执行偏移量 */
|
||||
// static STR_TimeSliceOffset m_usartHandle;
|
||||
// static void Task_usartHandle(void);
|
||||
// typedef void (*uartJudgeHandle)(device_handle device);
|
||||
// static uartJudgeHandle uart_judge_handle;
|
||||
|
||||
/* 配置文件数据解析和处理 */
|
||||
#define usartCfg_reloadVal 200 /* 任务执行间隔 */
|
||||
#define usartCfg_offset 0 /* 任务执行偏移量 */
|
||||
static STR_TimeSliceOffset m_usartCfg;
|
||||
static void Task_usartCfg(void);
|
||||
// /* 配置文件数据解析和处理 */
|
||||
// #define usartCfg_reloadVal 200 /* 任务执行间隔 */
|
||||
// #define usartCfg_offset 0 /* 任务执行偏移量 */
|
||||
// static STR_TimeSliceOffset m_usartCfg;
|
||||
// static void Task_usartCfg(void);
|
||||
|
||||
/* 短路保护 */
|
||||
#define shortCircuitProtection_reloadVal 1000 /* 任务执行间隔 */
|
||||
|
@ -120,6 +124,13 @@ void Task_busFree(void);
|
|||
STR_TimeSliceOffset m_softShortCircuit;
|
||||
void Task_softShortCircuit(void);
|
||||
|
||||
|
||||
/* 串口任务 */
|
||||
#define uart_reloadVal 10 /* 任务执行间隔 */
|
||||
#define uart_offset 0 /* 任务执行偏移量 */
|
||||
STR_TimeSliceOffset m_uart;
|
||||
void Task_uart(void);
|
||||
|
||||
/**
|
||||
* @brief 启动时初始化各任务
|
||||
* @param None
|
||||
|
@ -136,9 +147,7 @@ void task_Init(void)
|
|||
TimeSliceOffset_Register(&m_collectOpenCircuitVoltage, Task_collectOpenCircuitVoltage
|
||||
, collectOpenCircuitVoltage_reloadVal, collectOpenCircuitVoltage_offset);
|
||||
|
||||
uartTaskInit();
|
||||
TimeSliceOffset_Register(&m_usartJudge, Task_usartJudge, usartJudge_reloadVal, usartJudge_offset);
|
||||
TimeSliceOffset_Register(&m_usartCfg, Task_usartCfg, usartCfg_reloadVal, usartCfg_offset);
|
||||
TimeSliceOffset_Register(&m_uart, Task_uart, uart_reloadVal, uart_offset);
|
||||
TimeSliceOffset_Register(&m_busFree, Task_busFree, busFree_reloadVal, busFree_offset);
|
||||
}
|
||||
|
||||
|
@ -179,17 +188,22 @@ void Task_wdi(void)
|
|||
{
|
||||
feedDog();
|
||||
|
||||
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());
|
||||
// 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", getLoopImpedance());
|
||||
// debug_printf("DutyRatio:%f \n", getDutyRatio());
|
||||
// debug_printf("OUT_VOLT_IN:%f \n", get_OUT_VOLT_IN());
|
||||
// debug_printf("HAL_GetTick:%d \n", HAL_GetTick());
|
||||
|
||||
|
||||
|
||||
|
||||
// char buf[100];
|
||||
// sprintf(buf, "chargCurrent:%f \n", getChargCurrent());
|
||||
|
@ -252,7 +266,6 @@ void Task_wdi(void)
|
|||
saveTime(&time);
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -278,8 +291,8 @@ void Task_refreshJudgeData(void)
|
|||
}
|
||||
|
||||
/* 有电池,太阳能输出功率大,电池电压低于14V,同时回路阻抗未测试或需要重新测试 */
|
||||
if ((getCheckImpedanceState() == FALSE || g_cfgParameter.loopImpedance == 0.0f)
|
||||
&& (getBatteryState() == TRUE) && (getChargCurrent() > g_cfgParameter.checkLoopImpedanceChargCurr)
|
||||
if ((getCheckImpedanceState() == FALSE || getLoopImpedance() == 0.0f)
|
||||
&& (getBatteryState() == TRUE) && (getChargCurrent() > g_cfgParameter.maxChargCurr)
|
||||
&& (getOutputVoltage() > 9) && (getSolarInCircuitVoltage() > 14)
|
||||
&& (getBatteryVoltage() < 14)) {
|
||||
TimeSliceOffset_Register(&m_impedanceCalculation, Task_impedanceCalculation
|
||||
|
@ -287,20 +300,20 @@ void Task_refreshJudgeData(void)
|
|||
}
|
||||
|
||||
/* 温度检测 */
|
||||
if ((getMosTemperState() != mosTemperStart)
|
||||
&& (getHighSideMosTemperature() < g_cfgParameter.HighSideMosTemperature_start)) {
|
||||
if ((getMosTemperState() != mosTemperFull)
|
||||
&& (getHighSideMosTemperature() < g_cfgParameter.fullPowerOutputTemperature)) {
|
||||
/* 状态处于停止运行则打开充电开关 */
|
||||
if (getMosTemperState() == mosTemperStop) {
|
||||
beginChargWork();
|
||||
}
|
||||
setMosTemperState(mosTemperStart);
|
||||
setMosTemperState(mosTemperFull);
|
||||
}
|
||||
else if ((getMosTemperState() == mosTemperStart)
|
||||
&& getHighSideMosTemperature() > g_cfgParameter.HighSideMosTemperature_end) {
|
||||
setMosTemperState(mosTemperEnd);
|
||||
else if ((getMosTemperState() == mosTemperFull)
|
||||
&& getHighSideMosTemperature() > g_cfgParameter.reducePowerOutputTemperature) {
|
||||
setMosTemperState(mosTemperReduce);
|
||||
}
|
||||
else if ((getMosTemperState() == mosTemperEnd)
|
||||
&& getHighSideMosTemperature() > g_cfgParameter.HighSideMosTemperature_stop) {
|
||||
else if ((getMosTemperState() == mosTemperReduce)
|
||||
&& getHighSideMosTemperature() > g_cfgParameter.stopPowerOutputTemperature) {
|
||||
setMosTemperState(mosTemperStop);
|
||||
/* 停止充电 */
|
||||
stopChargWork();
|
||||
|
@ -320,7 +333,7 @@ void Task_startControl(void)
|
|||
{
|
||||
/* 是否达到启动条件 */
|
||||
if (getSolarInCircuitVoltage() > g_cfgParameter.startSolarOpenCircuitV
|
||||
&& getSolarInCircuitVoltage() < g_cfgParameter.maxOpenSolarOpenCircuitV) {
|
||||
&& getSolarInCircuitVoltage() < g_cfgParameter.maxOpenSolarOutputCircuitV) {
|
||||
TimeSliceOffset_Unregister(&m_startControl);
|
||||
m_startControl.runFlag = 0;
|
||||
|
||||
|
@ -435,12 +448,16 @@ void Task_impedanceCalculation(void)
|
|||
float tempLoopImpedance = 0;
|
||||
tempLoopImpedance = (voltOne - voltTwo) / (currOne - currTwo);
|
||||
|
||||
// if (tempLoopImpedance < 1.0f && tempLoopImpedance > 0.05f) {
|
||||
// g_cfgParameter.loopImpedance = tempLoopImpedance;
|
||||
// saveLoopImpedance(&g_cfgParameter.loopImpedance);
|
||||
// setCheckImpedanceState();
|
||||
// }
|
||||
/* 判断回路阻抗是否合理 */
|
||||
if (tempLoopImpedance < 1.0f && tempLoopImpedance > 0.05f) {
|
||||
g_cfgParameter.loopImpedance = tempLoopImpedance;
|
||||
saveLoopImpedance(&g_cfgParameter.loopImpedance);
|
||||
if (setLoopImpedance(tempLoopImpedance) == TRUE) {
|
||||
saveLoopImpedance();
|
||||
setCheckImpedanceState();
|
||||
}
|
||||
}
|
||||
|
||||
setMPPT_Mode(MPPT);
|
||||
setChargControlFlag(TRUE);
|
||||
|
@ -502,86 +519,86 @@ void Task_collectOpenCircuitVoltage(void)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @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配置模式后,配置完成后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);
|
||||
}
|
||||
// /**
|
||||
// * @brief 开启HY配置模式后启动退出任务
|
||||
// * @param
|
||||
// * @retval
|
||||
// */
|
||||
// void beginHYconfigMode(void)
|
||||
// {
|
||||
// setHYconfigModeState(TRUE);
|
||||
// TimeSliceOffset_Register(&m_beginHYconfigMode, Task_beginHYconfigMode
|
||||
// , beginHYconfigMode_reloadVal, beginHYconfigMode_offset);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @brief 初始化串口任务,确定使用的协议
|
||||
* @param
|
||||
* @retval
|
||||
*/
|
||||
void uartTaskInit(void)
|
||||
{
|
||||
// if (g_cfgParameter.CommunicationProtocolType == 0x00) {
|
||||
// uart_judge_handle = read_and_process_uart_data;
|
||||
// } else if (g_cfgParameter.CommunicationProtocolType == 0x01) {
|
||||
// uart_judge_handle = HY_read_and_process_uart_data;
|
||||
// }
|
||||
// /**
|
||||
// * @brief 初始化串口任务,确定使用的协议
|
||||
// * @param
|
||||
// * @retval
|
||||
// */
|
||||
// void uartTaskInit(void)
|
||||
// {
|
||||
// // if (g_cfgParameter.CommunicationProtocolType == 0x00) {
|
||||
// // uart_judge_handle = read_and_process_uart_data;
|
||||
// // } else if (g_cfgParameter.CommunicationProtocolType == 0x01) {
|
||||
// // uart_judge_handle = HY_read_and_process_uart_data;
|
||||
// // }
|
||||
|
||||
uart_judge_handle = HY_read_and_process_uart_data;
|
||||
}
|
||||
// uart_judge_handle = HY_read_and_process_uart_data;
|
||||
// }
|
||||
|
||||
/**
|
||||
* @brief 检测有无通信数据传来
|
||||
* @param
|
||||
* @retval
|
||||
*/
|
||||
void Task_usartJudge(void)
|
||||
{
|
||||
/* 检测到对上通信串口有数据启动读取并解析任务 */
|
||||
if (uart_dev_char_present(g_gw485_uart2_handle)) {
|
||||
TimeSliceOffset_Register(&m_usartHandle, Task_usartHandle
|
||||
, usartHandle_reloadVal, usartHandle_offset);
|
||||
}
|
||||
}
|
||||
// /**
|
||||
// * @brief 检测有无通信数据传来
|
||||
// * @param
|
||||
// * @retval
|
||||
// */
|
||||
// void Task_usartJudge(void)
|
||||
// {
|
||||
// /* 检测到对上通信串口有数据启动读取并解析任务 */
|
||||
// if (uart_dev_char_present(g_gw485_uart2_handle)) {
|
||||
// TimeSliceOffset_Register(&m_usartHandle, Task_usartHandle
|
||||
// , usartHandle_reloadVal, usartHandle_offset);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* @brief 读取并解析对上通讯的数据
|
||||
* @param
|
||||
* @retval
|
||||
*/
|
||||
void Task_usartHandle(void)
|
||||
{
|
||||
TimeSliceOffset_Unregister(&m_usartHandle);
|
||||
m_usartHandle.runFlag = 0;
|
||||
uart_judge_handle(g_gw485_uart2_handle);
|
||||
}
|
||||
// /**
|
||||
// * @brief 读取并解析对上通讯的数据
|
||||
// * @param
|
||||
// * @retval
|
||||
// */
|
||||
// void Task_usartHandle(void)
|
||||
// {
|
||||
// TimeSliceOffset_Unregister(&m_usartHandle);
|
||||
// m_usartHandle.runFlag = 0;
|
||||
// uart_judge_handle(g_gw485_uart2_handle);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @brief 读取并解析配置文件的数据
|
||||
* @param
|
||||
* @retval
|
||||
*/
|
||||
void Task_usartCfg(void)
|
||||
{
|
||||
read_and_process_config_data();
|
||||
}
|
||||
// /**
|
||||
// * @brief 读取并解析配置文件的数据
|
||||
// * @param
|
||||
// * @retval
|
||||
// */
|
||||
// void Task_usartCfg(void)
|
||||
// {
|
||||
// read_and_process_config_data();
|
||||
// }
|
||||
|
||||
/**
|
||||
* @brief 短路保护任务,短路后启动该任务
|
||||
|
@ -594,7 +611,7 @@ void Task_shortCircuitProtection(void)
|
|||
num++;
|
||||
|
||||
/* 设定输出短路保护时间 */
|
||||
if (num == g_cfgParameter.outputAgainFlagTime) {
|
||||
if (num == g_cfgParameter.shortCircuitJudgmentDelay) {
|
||||
num = 0;
|
||||
zeroShortCircuit();
|
||||
TimeSliceOffset_Unregister(&m_shortCircuitProtection);
|
||||
|
@ -670,7 +687,7 @@ void Task_excessiveLoad(void)
|
|||
}
|
||||
|
||||
/* 仅过载一次,达到时间后关闭该任务 */
|
||||
if (num == g_cfgParameter.excessiveLoadFlagTime) {
|
||||
if (num == g_cfgParameter.inputPowerLowJudgmentDelay) {
|
||||
num = 0;
|
||||
setExcessiveLoadFlag(FALSE);
|
||||
TimeSliceOffset_Unregister(&m_excessiveLoad);
|
||||
|
@ -684,7 +701,7 @@ void Task_excessiveLoad(void)
|
|||
}
|
||||
|
||||
/* 达到时间就重新尝试输出 */
|
||||
if (numLong == g_cfgParameter.eLAgainTime) {
|
||||
if (numLong == g_cfgParameter.inputPowerLowAgainOutputDelay) {
|
||||
numLong = 0;
|
||||
TimeSliceOffset_Unregister(&m_excessiveLoad);
|
||||
m_excessiveLoad.runFlag = 0;
|
||||
|
@ -753,7 +770,7 @@ void Task_softShortCircuit(void)
|
|||
setPowerOutput(TRUE);
|
||||
}
|
||||
|
||||
if (num >= g_cfgParameter.outputAgainFlagTime) {
|
||||
if (num >= g_cfgParameter.shortCircuitJudgmentDelay) {
|
||||
num = 0;
|
||||
if (getShortCircuit() == 1) {
|
||||
setShortCircuitFlag(FALSE);
|
||||
|
@ -774,4 +791,15 @@ void startSoftShortCircuitProtection(void)
|
|||
{
|
||||
TimeSliceOffset_Register(&m_softShortCircuit, Task_softShortCircuit
|
||||
, softShortCircuit_reloadVal, softShortCircuit_offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 启动软件解析任务
|
||||
* @param
|
||||
* @retval
|
||||
*/
|
||||
void Task_uart(void)
|
||||
{
|
||||
gw485DataAnalysis(g_gw485_uart2_handle);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ typedef struct _adcCapture
|
|||
|
||||
void ADC_Capture_Init(void);
|
||||
void proportionalInt(int mode);
|
||||
uint16_t setfirstStageProtectionValue(float curr);
|
||||
|
||||
float get_CHG_CURR(void);
|
||||
float get_PV_VOLT_OUT(void);
|
||||
|
|
|
@ -178,7 +178,8 @@ BOOL readOverCurrState(void)
|
|||
*/
|
||||
BOOL readOnlyPowerOutputState(void)
|
||||
{
|
||||
static volatile GPIO_PinState gpioTemp1, gpioTemp2, gpioTemp3;
|
||||
// static volatile GPIO_PinState gpioTemp1, gpioTemp2, gpioTemp3;
|
||||
GPIO_PinState gpioTemp1, gpioTemp2, gpioTemp3;
|
||||
|
||||
gpioTemp1 = HAL_GPIO_ReadPin(POW_FF_CON_GPIO_Port, POW_FF_CON_Pin);
|
||||
gpioTemp2 = HAL_GPIO_ReadPin(POW_OUT_CON_GPIO_Port, POW_OUT_CON_Pin);
|
||||
|
|
|
@ -213,7 +213,8 @@ void proportionalInt(int mode)
|
|||
/* 输出外部电压比例 */
|
||||
P_OUT_VOLT_IN = ((47.0 + 4.7) / 4.7) * Proportion;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// /* 光伏充电输出电流比例,放大倍数*电阻 */
|
||||
// P_CHG_CURR = (1.0 / (50 * (1 / (1 / 0.01 + 1 / 0.002)))) * Proportion;
|
||||
// /* 充电控制盒输出电压比例,分压系数 */
|
||||
|
@ -226,6 +227,18 @@ void proportionalInt(int mode)
|
|||
// P_PV_VOLT_IN1 = ((47 + 4.7) / 4.7) * Proportion;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 设置第一段保护ADC采样的值
|
||||
* @param
|
||||
* @retval None
|
||||
*/
|
||||
uint16_t setfirstStageProtectionValue(float curr)
|
||||
{
|
||||
return (uint16_t)(curr / P_DSG_CURR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define N 4
|
||||
/**
|
||||
* @brief 中位值平均滤波
|
||||
|
@ -424,7 +437,8 @@ float get_OUT_VOLT_IN(void)
|
|||
{
|
||||
float V;
|
||||
uint16_t V_ADC;
|
||||
static uint16_t V_ADCTemp = (uint16_t)(0.55f / 3.0f * 4095);
|
||||
static uint16_t V_ADCTemp = (uint16_t)(0.52f / 3.0f * 4095);
|
||||
// static uint16_t V_ADCTemp = (uint16_t)(0.17f / 3.0f * 4095);
|
||||
|
||||
V_ADC = ADC2_Capture(OUT_VOLT_IN_CHANNEL);
|
||||
|
||||
|
@ -432,7 +446,10 @@ float get_OUT_VOLT_IN(void)
|
|||
if (HAL_GPIO_ReadPin(POW_FF_CON_GPIO_Port, POW_FF_CON_Pin)) {
|
||||
V = (float)(V_ADC) * P_OUT_VOLT_IN;
|
||||
} else {
|
||||
V = (float)(V_ADC - V_ADCTemp) * P_OUT_VOLT_IN;
|
||||
if (V_ADC > V_ADCTemp) {
|
||||
V = (float)(V_ADC - V_ADCTemp) * P_OUT_VOLT_IN;
|
||||
}
|
||||
V = (float)(V_ADC) * P_OUT_VOLT_IN;
|
||||
}
|
||||
|
||||
#ifdef enable_Printf_VI
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1449,10 +1449,7 @@
|
|||
<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>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\bl_usart.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\inFlash.c</name>
|
||||
|
@ -1466,6 +1463,9 @@
|
|||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\parameter.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\SOE.c</name>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\..\APP\businessLogic\Src\task.c</name>
|
||||
</file>
|
||||
|
|
|
@ -13,12 +13,11 @@ typedef enum _chargMode{
|
|||
}chargMode;
|
||||
|
||||
typedef enum {
|
||||
mosTemperStart = 0, /* 满功率充电mos状态 */
|
||||
mosTemperEnd = 1, /* 降功率充电mos状态 */
|
||||
mosTemperFull = 0, /* 满功率充电mos状态 */
|
||||
mosTemperReduce = 1, /* 降功率充电mos状态 */
|
||||
mosTemperStop = 2, /* 停止充电mos状态 */
|
||||
}mosTState;
|
||||
|
||||
|
||||
/* 注册状态 */
|
||||
typedef enum {
|
||||
UNREGISTER = 0, /* 未注册 */
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "comm_types.h"
|
||||
|
||||
|
||||
#define softVer "SV01_24101501"
|
||||
|
||||
// /* 第一段保护的延时时间(单位100uS) */
|
||||
// const uint32_t firstStageProtectionDelay = 2; // 200uS
|
||||
|
@ -64,4 +65,8 @@
|
|||
/* 最大充电电压(V) */
|
||||
#define maxOpenSolarOpenCircuitVMacro 25.0f
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
// #define NDEBUG
|
||||
|
||||
#define log_info_enable 1
|
||||
#define log_warn_enable 0
|
||||
#define log_error_enable 0
|
||||
#define log_warn_enable 1
|
||||
#define log_error_enable 1
|
||||
|
||||
/* Comment out this define to include log messages */
|
||||
// #define NLOG
|
||||
|
|
Loading…
Reference in New Issue