Compare commits

..

1 Commits

Author SHA1 Message Date
起床就犯困 1b9253b0dc 修改电流采集,添加总能量计算 2024-10-14 15:22:50 +08:00
48 changed files with 13308 additions and 13819 deletions

View File

@ -71,6 +71,7 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/mppt_Nos_V0.4/Hardware/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/mppt_Nos_V0.4/Drivers/RingQueue}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/mppt_Nos_V0.4/Drivers/TimeSliceOffset}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/mppt_Nos_V0.4/Drivers/RingQueue2}&quot;"/>
</option>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.2020844713" name="Language standard" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std" useByScannerDiscovery="true" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.std.gnu99" valueType="enumerated"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs.177116515" name="Defined symbols (-D)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols"/>
@ -150,4 +151,5 @@
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
<storageModule moduleId="refreshScope"/>
</cproject>

View File

@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="998107432084761222" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1028566790370062624" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

View File

@ -10,6 +10,16 @@
#include "debug.h"
#include "adc.h"
#include "ring_queue2.h"
#define adcBuffSize 100
typedef struct _ADC_DATA{
RingQueue2 RQCHG_CURR;
RingQueue2 RQDSG_CURR;
int32_t total_CHG_CURR; /* 充电电流adc之和 */
int32_t total_DSG_CURR; /* 放电电流adc之和 */
}ADC_DATA;
extern ADC_DATA g_adcData;
float get_CHG_CURR(void);
float get_PV_VOLT_OUT(void);
@ -18,5 +28,6 @@ float get_PV1_VOLT_IN(void);
float get_PV_VOLT_IN1(void);
float get_MOSFET_Temper(void);
float get_PV2_VOLT_IN(void);
void currBuffInit(void);
#endif /* APP_INC_COLLECT_CONVERSION_H_ */

View File

@ -1,572 +0,0 @@
/*
* hy_protocol.h
*
* Created on: 20241011
* Author: psx
*/
#ifndef APP_INC_HY_PROTOCOL_H_
#define APP_INC_HY_PROTOCOL_H_
#include "debug.h"
#include "uart_dev.h"
#include "math.h"
/* 功能码 */
typedef enum
{
HY_batteryStatus = 0x60, /* 电池状态数据报 */
HY_electricityStatistics = 0x61, /* 电量统计数据报 */
HY_sensorNumberConfiguration = 0x62, /* 传感器号码配置 */
HY_sensorNumberInquiry = 0x63, /* 传感器号码查询 */
HY_chargingThresholdVoltageConfiguration = 0x64, /* 充电阈值电压配置 */
HY_chargingRangeVoltageQuery = 0x65, /* 充电域值电压查询 */
HY_resetInstruction = 0x66, /* 复位指令 */
HY_chargingControlConfiguration = 0x6C, /* 充电控制配置 */
HY_chargingControlQuery = 0x6D, /* 充电控制查询 */
HY_configureProtocolType = 0x70, /* 配置协议类型 */
HY_responseConfigureProtocolType = 0x71, /* 响应配置协议类型 */
HY_queryControlBoxConfiguration = 0x74, /* 查询电池控制盒当前配置 */
HY_querySoftwareVersion = 0x75, /* 查询电池控制盒软件版本 */
HY_enterConfigurationMode = 0x76, /* 进入配置模式 */
HY_configureHardwareID = 0x7B, /* 配置控制盒硬件ID号 */
HY_hardwareID_communicationIDQuery = 0x7C, /* 控制盒硬件ID号及通信ID号原传感器号查询 */
HY_modifyCommunicationID = 0x7D, /* 修改通信ID号原传感器号 */
HY_checkMotherboardTemperature = 0x7E, /* 查询主板温度值 */
}HY_MsgFunctionCode;
/* 解析数据包的长度 */
typedef enum
{
HY_analyzeStartFlag = 1, /* 长度为1时解析起始标志 */
HY_analyzeHardwareID = 7, /* 长度为7时解析硬件ID */
HY_analyzeCommunicationID = 11, /* 长度为10时解析通信ID */
HY_analyzeControlWord = 12, /* 长度为12时解析控制字 */
HY_analyzeDataLen = 14, /* 长度为14时解析数据长度 */
}HY_AnalyzeDataLen;
/* 指定对齐方式为1字节 */
#pragma pack(push,1)
/* 默认参数 */
typedef struct _HY_default_Value{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t end_Flag; /* 结束标志 */
}HY_default_Value;
extern HY_default_Value HY_defaultValue;
/* 默认参数 */
typedef struct _HY_Recv_pack{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
}HY_Recv_pack;
/* 功能码处理函数 */
typedef void (*HYMsgProcFunc)(device_handle device, void*, uint32_t MsgLen);
typedef struct _HY_FunctionMsgProcTable{
u_int32_t msgId;
HYMsgProcFunc pMsgProc;
}HY_FuncionMsgProcTable;
/* 电池状态数据报查询 */
typedef struct _HY_batteryStatusQuery{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_batteryStatusQuery;
#define HY_batteryStatusQuery_PACK_SIZE (sizeof(HY_batteryStatusQuery))
/* 电池状态数据报响应 */
typedef struct _HY_batteryStatusResponse{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
float_t batteryVoltage; /* 电池电压 */
float_t dischargCurrent; /* 输出电流(流向负载) */
float_t chargCurrent1; /* 充电电流(流向电池+负载) */
float_t SOC; /* 剩余电量 */
float_t openCircuitVoltage1; /* 充电开路电压 */
uint8_t chargSwitchStatus1; /* 充电开关状态 */
float_t chargCurrent2; /* 充电电流(流向电池+负载) */
float_t openCircuitVoltage2; /* 充电开路电压 */
uint8_t chargSwitchStatus2; /* 充电开关状态 */
float_t Mos_Temperature; /* 工作温度 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_batteryStatusResponse;
#define HY_batteryStatusResponse_PACK_SIZE (sizeof(HY_batteryStatusResponse))
/* 电量统计数据报查询 */
typedef struct _HY_electricityStatisticsQuery{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_electricityStatisticsQuery;
#define HY_electricityStatisticsQuery_PACK_SIZE (sizeof(HY_electricityStatisticsQuery))
/* 电池状态数据报响应 */
typedef struct _HY_electricityStatisticsResponse{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
float_t statisticalDuration; /* 统计时长 */
float_t totalElectricityConsumption; /* 总电量消耗 */
float_t totalChargCapacity; /* 总充电电量 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_electricityStatisticsResponse;
#define HY_electricityStatisticsResponse_PACK_SIZE (sizeof(HY_electricityStatisticsResponse))
/* 传感器号码配置 */
typedef struct _HY_sensorNumberConfig{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint32_t frameNumber; /* 帧序号 */
uint8_t newHardwareID[6]; /* 新硬件ID高字节在前低字节在后保持不变 */
uint8_t newCommunicationID[4]; /* 新通信ID高字节在前低字节在后 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_sensorNumberConfig;
#define HY_sensorNumberConfiguration_PACK_SIZE (sizeof(HY_sensorNumberConfig))
/* 传感器号码配置响应 */
typedef struct _HY_sensorNumberConfigurationResponse{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint8_t state; /* 状态 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_sensorNumberConfigurationResponse;
#define HY_sensorNumberConfigurationResponse_PACK_SIZE (sizeof(HY_sensorNumberConfigurationResponse))
/* 传感器号码查询 */
typedef struct _HY_sensorNumberInquiryQuery{
uint8_t start_Flag; /* 起始标志 */
uint8_t broadcastTerminal[6]; /* 广播终端ID:0xFF 0xFF 0xFF 0xFF 0xFF 0xFF */
uint8_t broadcastCommunication[4]; /* 广播通信ID:0xFF 0xFF 0xFF 0xFF */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_sensorNumberInquiryQuery;
#define HY_sensorNumberInquiryQuery_PACK_SIZE (sizeof(HY_sensorNumberInquiryQuery))
/* 传感器号码查询响应 */
typedef struct _HY_sensorNumberInquiryResponse{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint8_t hardwareIDR[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationIDR[4]; /* 通信ID高字节在前低字节在后 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_sensorNumberInquiryResponse;
#define HY_sensorNumberInquiryResponse_PACK_SIZE (sizeof(HY_sensorNumberInquiryResponse))
/* 充电阈值电压配置 */
typedef struct _HY_chargingThresholdVoltageConfig{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint32_t frameNumber; /* 帧序号 */
float_t chargOpenVoltage; /* 充电开电池电压 */
float_t chargCloseVoltage; /* 充电关电池电压 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_chargingThresholdVoltageConfig;
#define HY_chargingThresholdVoltageConfig_PACK_SIZE (sizeof(HY_chargingThresholdVoltageConfig))
/* 充电阈值电压配置响应 */
typedef struct _HY_chargingThresholdVoltageConfigResponse{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint8_t state; /* 状态 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_chargingThresholdVoltageConfigResponse;
#define HY_chargingThresholdVoltageConfigResponse_PACK_SIZE (sizeof(HY_chargingThresholdVoltageConfigResponse))
/* 充电域值电压查询 */
typedef struct _HY_chargRangeVoltageQuery{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_chargRangeVoltageQuery;
#define HY_chargRangeVoltageQuery_PACK_SIZE (sizeof(HY_chargRangeVoltageQuery))
/* 充电域值电压查询响应 */
typedef struct _HY_chargRangeVoltageQueryResponse{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
float_t chargOpenVoltage; /* 充电开电池电压 */
float_t chargCloseVoltage; /* 充电关电池电压 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_chargRangeVoltageQueryResponse;
#define HY_chargRangeVoltageQueryResponse_PACK_SIZE (sizeof(HY_chargRangeVoltageQueryResponse))
/* 复位指令 */
typedef struct _HY_resetInstructionQuery{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_resetInstructionQuery;
#define HY_resetInstructionQuery_PACK_SIZE (sizeof(HY_resetInstructionQuery))
/* 复位指令响应 */
typedef struct _HY_resetInstructionResponse{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint8_t state; /* 状态 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_resetInstructionResponse;
#define HY_resetInstructionResponse_PACK_SIZE (sizeof(HY_resetInstructionResponse))
/* 充电控制配置 */
typedef struct _HY_chargingControlConfig{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint32_t frameNumber; /* 帧序号 */
uint8_t chargInterface; /* 充电接口 */
uint8_t chargInterfaceControl; /* 充电接口控制 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_chargingControlConfig;
#define HY_chargingControlConfig_PACK_SIZE (sizeof(HY_chargingControlConfig))
/* 充电控制配置响应 */
typedef struct _HY_chargingControlConfigResponse{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint8_t state; /* 状态 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_chargingControlConfigResponse;
#define HY_chargingControlConfigResponse_PACK_SIZE (sizeof(HY_chargingControlConfigResponse))
/* 充电控制查询 */
typedef struct _HY_QueryChargingControl{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_QueryChargingControl;
#define HY_QueryChargingControl_PACK_SIZE (sizeof(HY_QueryChargingControl))
/* 充电控制查询响应 */
typedef struct _HY_QueryChargingControlResponse{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint8_t chargInterface; /* 充电接口状态 */
uint8_t chargInterfaceControl; /* 充电接口状态 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_QueryChargingControlResponse;
#define HY_QueryChargingControlResponse_PACK_SIZE (sizeof(HY_QueryChargingControlResponse))
/* 配置协议类型 */
typedef struct _HY_configProtocolType{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint32_t frameNumber; /* 帧序号 */
uint8_t protocolType; /* 协议类型; 0x01表示汇源协议(波特率9600) 0x02表示南瑞协议(波特率115200)*/
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_configProtocolType;
#define HY_configProtocolType_PACK_SIZE (sizeof(HY_configProtocolType))
/* 配置协议类型响应 */
typedef struct _HY_configProtocolTypeResponse{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint8_t state; /* 状态 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_configProtocolTypeResponse;
#define HY_configProtocolTypeResponse_PACK_SIZE (sizeof(HY_configProtocolTypeResponse))
/* 查询电池控制盒当前配置 */
typedef struct _HY_queryControlBoxConfigurationQuery{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_queryControlBoxConfigurationQuery;
#define HY_queryControlBoxConfigurationQuery_PACK_SIZE (sizeof(HY_queryControlBoxConfigurationQuery))
/* 查询电池控制盒当前配置响应 */
typedef struct _HY_queryControlBoxConfigurationResponse{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint8_t protocolType; /* 协议类型; 0x01表示汇源协议(波特率9600) 0x02表示南瑞协议(波特率115200)*/
uint8_t voltageLevel; /* 电压等级 */
uint8_t mainBoardTemperatureSensorType; /* 主板温度传感器类型 */
uint8_t batteryTemperatureSensorType; /* 电池温度传感器类型 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_queryControlBoxConfigurationResponse;
#define HY_queryControlBoxConfigurationResponse_PACK_SIZE (sizeof(HY_queryControlBoxConfigurationResponse))
/* 查询电池控制盒软件版本 */
typedef struct _HY_SoftwareVersionQuery{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_SoftwareVersionQuery;
#define HY_SoftwareVersionQuery_PACK_SIZE (sizeof(HY_SoftwareVersionQuery))
/* 查询电池控制盒软件版本 */
typedef struct _HY_SoftwareVersionQueryResponse{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint8_t versionInformation[13]; /* 版本信息 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_SoftwareVersionQueryResponse;
#define HY_SoftwareVersionQueryResponse_PACK_SIZE (sizeof(HY_SoftwareVersionQueryResponse))
/* 进入配置模式 */
typedef struct _HY_enterConfigMode{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_enterConfigMode;
#define HY_enterConfigMode_PACK_SIZE (sizeof(HY_enterConfigMode))
/* 进入配置模式响应 */
typedef struct _HY_enterConfigModeResponse{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint8_t state; /* 状态 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_enterConfigModeResponse;
#define HY_enterConfigModeResponse_PACK_SIZE (sizeof(HY_enterConfigModeResponse))
/* 配置控制盒硬件ID号 */
typedef struct _HY_configHardwareID{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint32_t frameNumber; /* 帧序号 */
uint8_t newHardwareID[6]; /* 新硬件ID高字节在前低字节在后 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_configHardwareID;
#define HY_configHardwareID_PACK_SIZE (sizeof(HY_configHardwareID))
/* 配置控制盒硬件ID号 响应*/
typedef struct _HY_configHardwareIDResponse{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint8_t state; /* 状态 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_configHardwareIDResponse;
#define HY_configHardwareIDResponse_PACK_SIZE (sizeof(HY_configHardwareIDResponse))
///* 控制盒硬件ID号及通信ID号原传感器号查询 */
//typedef struct _HY_QueryhardwareID_communicationID{
// uint8_t start_Flag; /* 起始标志 */
// uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
// uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
// uint8_t controlWord; /* 控制字 */
// uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
// uint32_t frameNumber; /* 帧序号 */
// uint8_t check_Bit; /* 校验码 */
// uint8_t end_Flag; /* 结束标志 */
//}HY_QueryhardwareID_communicationID;
//#define HY_QueryhardwareID_communicationID_PACK_SIZE (sizeof(HY_QueryhardwareID_communicationID))
/* 修改通信ID号原传感器号 */
typedef struct _HY_modifyCommunicationIDChange{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint32_t frameNumber; /* 帧序号 */
uint8_t nowHardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t newcommunicationID[4]; /* 新通信ID高字节在前低字节在后 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_modifyCommunicationIDChange;
#define HY_modifyCommunicationIDChange_PACK_SIZE (sizeof(HY_modifyCommunicationIDChange))
/* 修改通信ID号原传感器号响应 */
typedef struct _HY_modifyCommunicationIDChangeResponse{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint8_t state; /* 状态 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_modifyCommunicationIDChangeResponse;
#define HY_modifyCommunicationIDChangeResponse_PACK_SIZE (sizeof(HY_modifyCommunicationIDChangeResponse))
/* 查询主板温度值 */
typedef struct _HY_checkMotherboardTemperatureQuery{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_checkMotherboardTemperatureQuery;
#define HY_checkMotherboardTemperatureQuery_PACK_SIZE (sizeof(HY_checkMotherboardTemperatureQuery))
/* 查询主板温度值响应 */
typedef struct _HY_checkMotherboardTemperatureResponse{
uint8_t start_Flag; /* 起始标志 */
uint8_t hardwareID[6]; /* 硬件ID高字节在前低字节在后 */
uint8_t communicationID[4]; /* 通信ID高字节在前低字节在后 */
uint8_t controlWord; /* 控制字 */
uint8_t dataLen[2]; /* 数据长度;高字节在前,低字节在后 */
float_t MotherboardTemperature; /* 主板温度 */
uint32_t frameNumber; /* 帧序号 */
uint8_t check_Bit; /* 校验码 */
uint8_t end_Flag; /* 结束标志 */
}HY_checkMotherboardTemperatureResponse;
#define HY_checkMotherboardTemperatureResponse_PACK_SIZE (sizeof(HY_checkMotherboardTemperatureResponse))
/* 恢复默认的对齐设置 */
#pragma pack(pop)
uint8_t HY_CheckFunc(uint8_t *arr_buff, uint8_t len);
void HY_read_and_process_uart_data(device_handle device);
#endif /* APP_INC_HY_PROTOCOL_H_ */

View File

@ -233,6 +233,8 @@ typedef struct _SL_Mppt_para{
float_t HighSideMos_Temperature; /* 高端mos的温度 */
uint16_t DischargMos_State; /* 放电mos的状态 */
uint16_t MPPT_Mode; /* 工作模式 */
float_t inPower; /* ×ܳäµçµçÁ¿ */
float_t outPower; /* ×ÜÏûºÄµçÁ¿ */
}SL_Mppt_para;
extern SL_Mppt_para g_Mppt_Para;

View File

@ -13,6 +13,8 @@
#include "uart_dev.h"
#include "math.h"
//extern uint8_t g_interruptNum;
void stop_mpptWork(void);
void start_mpptWork(void);

View File

@ -129,6 +129,10 @@ const uint16_t mosTemperADC[mosTemperADCLen] = {
336 /* 100 ¡æ */
};
ADC_DATA g_adcData;
static uint16_t CHG_buff[adcBuffSize];
static uint16_t DSG_buff[adcBuffSize];
static uint16_t get_adc(uint8_t ADC_Channel);
static uint16_t get_aftercalculationAdc(uint8_t ADC_Channel);
@ -144,7 +148,7 @@ uint16_t get_aftercalculationAdc(uint8_t ADC_Channel)
return middleAverageFilter(ADC_Channel);
}
#define N 6
#define N 4
/**
* @brief ÖÐλֵƽ¾ùÂ˲¨
* @param ADC_Channel ADCͨµÀ
@ -172,11 +176,11 @@ uint16_t middleAverageFilter(uint8_t ADC_Channel)
}
}
}
for(i = 2; i < N-2; ++i)
for(i = 1; i < N-1; ++i)
{
sum += value_buf[i];
}
return sum/(N-4);
return sum/(N-2);
}
/**
@ -221,7 +225,16 @@ float get_CHG_CURR(void)
uint16_t I_ADC;
// I_ADC = Get_ConversionVal(get_adc(CHG_CURR));
OutRingQueue2(&g_adcData.RQCHG_CURR, &I_ADC);
g_adcData.total_CHG_CURR -= I_ADC;
I_ADC = get_aftercalculationAdc(CHG_CURR);
InRingQueue2(&g_adcData.RQCHG_CURR, I_ADC);
g_adcData.total_CHG_CURR += I_ADC;
I_ADC = g_adcData.total_CHG_CURR / (adcBuffSize - 1);
// I_ADC = get_adc(CHG_CURR);
// I = (float)(I_ADC) / 4095 * 3.3 * P_CHG_CURR * 2;
@ -276,9 +289,21 @@ float get_DSG_CURR(void)
uint16_t I_ADC;
// I_ADC = Get_ConversionVal(get_adc(DSG_CURR));
I_ADC = get_aftercalculationAdc(DSG_CURR);
// I_ADC = get_aftercalculationAdc(DSG_CURR);
// I_ADC = get_adc(DSG_CURR);
OutRingQueue2(&g_adcData.RQDSG_CURR, &I_ADC);
g_adcData.total_DSG_CURR -= I_ADC;
I_ADC = get_aftercalculationAdc(DSG_CURR);
InRingQueue2(&g_adcData.RQDSG_CURR, I_ADC);
g_adcData.total_DSG_CURR += I_ADC;
I_ADC = g_adcData.total_DSG_CURR / (adcBuffSize - 1);
// I = (float)(I_ADC) / 4095 * 3.3 * P_DSG_CURR * 2;
I = (float)(I_ADC) / 4095 * 2.5 * P_DSG_CURR;
@ -415,6 +440,19 @@ float get_PV2_VOLT_IN(void)
return V;
}
void currBuffInit(void)
{
InitRingQueue2(&g_adcData.RQCHG_CURR, CHG_buff, adcBuffSize);
InitRingQueue2(&g_adcData.RQDSG_CURR, DSG_buff, adcBuffSize);
while (InRingQueue2(&g_adcData.RQCHG_CURR, 0) != -2);
while (InRingQueue2(&g_adcData.RQDSG_CURR, 0) != -2);
g_adcData.total_CHG_CURR = 0;
g_adcData.total_DSG_CURR = 0;
printf("%d \n", RingQueueLength2(&g_adcData.RQCHG_CURR));
printf("%d \n", RingQueueLength2(&g_adcData.RQDSG_CURR));
}

View File

@ -1,412 +0,0 @@
/*
* hy_protocol.c
*
* Created on: 20241011
* Author: psx
*/
#include "hy_protocol.h"
#include <string.h>
#include "inflash.h"
#include "pdebug.h"
#include "mppt_control.h"
#include <stdlib.h>
#include "task.h"
#include "tim.h"
HY_default_Value HY_defaultValue = {0x68\
, 0x48, 0x59, 0x30, 0x30, 0x30, 0x31\
, 0x00, 0x00, 0x00, 0x01\
, 0x16};
/* 读取串口数据时用该数组解析 */
static uint8_t rs485_buff[100]={0x00};
/* 电池状态数据报 */
static void HY_MsgProcFunc_batteryStatus(device_handle device, void *pMsg, uint32_t MsgLen);
/* 电量统计数据报 */
static void HY_MsgProcFunc_electricityStatistics(device_handle device, void *pMsg, uint32_t MsgLen);
/* 传感器号码配置 */
static void HY_MsgProcFunc_sensorNumberConfiguration(device_handle device, void *pMsg, uint32_t MsgLen);
/* 传感器号码查询 */
static void HY_MsgProcFunc_sensorNumberInquiry(device_handle device, void *pMsg, uint32_t MsgLen);
/* 充电阈值电压配置 */
static void HY_MsgProcFunc_chargingThresholdVoltageConfiguration(device_handle device, void *pMsg, uint32_t MsgLen);
/* 充电域值电压查询 */
static void HY_MsgProcFunc_chargingRangeVoltageQuery(device_handle device, void *pMsg, uint32_t MsgLen);
/* 复位指令 */
static void HY_MsgProcFunc_resetInstruction(device_handle device, void *pMsg, uint32_t MsgLen);
/* 充电控制配置 */
static void HY_MsgProcFunc_chargingControlConfiguration(device_handle device, void *pMsg, uint32_t MsgLen);
/* 充电控制查询 */
static void HY_MsgProcFunc_chargingControlQuery(device_handle device, void *pMsg, uint32_t MsgLen);
/* 配置协议类型 */
static void HY_MsgProcFunc_configureProtocolType(device_handle device, void *pMsg, uint32_t MsgLen);
///* 响应配置协议类型 */
//static void HY_MsgProcFunc_batteryStatus(device_handle device, void *pMsg, uint32_t MsgLen);
/* 查询电池控制盒当前配置 */
static void HY_MsgProcFunc_queryControlBoxConfiguration(device_handle device, void *pMsg, uint32_t MsgLen);
/* 查询电池控制盒软件版本 */
static void HY_MsgProcFunc_querySoftwareVersion(device_handle device, void *pMsg, uint32_t MsgLen);
/* 进入配置模式 */
static void HY_MsgProcFunc_enterConfigurationMode(device_handle device, void *pMsg, uint32_t MsgLen);
/* 配置控制盒硬件ID号 */
static void HY_MsgProcFunc_configureHardwareID(device_handle device, void *pMsg, uint32_t MsgLen);
/* 控制盒硬件ID号及通信ID号原传感器号查询 */
static void HY_MsgProcFunc_hardwareID_communicationIDQuery(device_handle device, void *pMsg, uint32_t MsgLen);
/* 修改通信ID号原传感器号 */
static void HY_MsgProcFunc_modifyCommunicationID(device_handle device, void *pMsg, uint32_t MsgLen);
/* 查询主板温度值 */
static void HY_MsgProcFunc_checkMotherboardTemperature(device_handle device, void *pMsg, uint32_t MsgLen);
/* 功能码处理表 */
HY_FuncionMsgProcTable g_hyMsgTbl[] =
{
{HY_batteryStatus, HY_MsgProcFunc_batteryStatus},
{HY_electricityStatistics, HY_MsgProcFunc_electricityStatistics},
{HY_sensorNumberConfiguration, HY_MsgProcFunc_sensorNumberConfiguration},
{HY_sensorNumberInquiry, HY_MsgProcFunc_sensorNumberInquiry},
{HY_chargingThresholdVoltageConfiguration, HY_MsgProcFunc_chargingThresholdVoltageConfiguration},
{HY_chargingRangeVoltageQuery, HY_MsgProcFunc_chargingRangeVoltageQuery},
{HY_resetInstruction, HY_MsgProcFunc_resetInstruction},
{HY_chargingControlConfiguration, HY_MsgProcFunc_chargingControlConfiguration},
{HY_chargingControlQuery, HY_MsgProcFunc_chargingControlQuery},
{HY_configureProtocolType, HY_MsgProcFunc_configureProtocolType},
// {HY_responseConfigureProtocolType, HY_MsgProcFunc_batteryStatus},
{HY_queryControlBoxConfiguration, HY_MsgProcFunc_queryControlBoxConfiguration},
{HY_querySoftwareVersion, HY_MsgProcFunc_querySoftwareVersion},
{HY_enterConfigurationMode, HY_MsgProcFunc_enterConfigurationMode},
{HY_configureHardwareID, HY_MsgProcFunc_configureHardwareID},
{HY_hardwareID_communicationIDQuery, HY_MsgProcFunc_hardwareID_communicationIDQuery},
{HY_modifyCommunicationID, HY_MsgProcFunc_modifyCommunicationID},
{HY_checkMotherboardTemperature, HY_MsgProcFunc_checkMotherboardTemperature},
};
/**
* @brief 485线
* @param
* @retval 1
* 0
*/
uint8_t Check_485_bus_busy(device_handle device)
{
if (device == g_bat485_uart3_handle) {
USART_ITConfig(USART3, USART_IT_RXNE, ENABLE);
} else {
USART_ITConfig(USART4, USART_IT_RXNE, ENABLE);
}
uint16_t num_ago = ring_queue_length(device);
Delay_Ms(2);
uint16_t num_now = ring_queue_length(device);
if (device == g_bat485_uart3_handle) {
USART_ITConfig(USART3, USART_IT_RXNE, DISABLE);
} else {
USART_ITConfig(USART4, USART_IT_RXNE, DISABLE);
}
if (num_now == num_ago) {
return 0;
}
return 1;
}
/**
* @brief
* @param
* @retval
*/
uint8_t HY_CheckFunc(uint8_t *arr_buff, uint8_t len)
{
uint8_t temp = 0x00;
uint32_t sum = 0x00;
for(uint8_t i = 0; i < len; i++) {
sum += *arr_buff++;
}
temp = (~sum) & 0xff;
return temp;
}
/**
* @brief
* @param address
* @retval 1
* 0
*/
static int HY_matchhardwareID(u_int8_t hardwareID[6])
{
// if (!strcmp(address, g_slConfigInfo.address)) {
// log_info("Match_address fail \r\n");
// return 1;
// }
if ((hardwareID[0] == g_slConfigInfo.address[0]) && \
(hardwareID[1] == g_slConfigInfo.address[1]) && \
(hardwareID[2] == g_slConfigInfo.address[2]) && \
(hardwareID[3] == g_slConfigInfo.address[3]) && \
(hardwareID[4] == g_slConfigInfo.address[4]) && \
(hardwareID[5] == g_slConfigInfo.address[5]) && \
(hardwareID[6] == g_slConfigInfo.address[6])) {
log_info("Match_address success \r\n");
return 1;
}
return 0;
}
/**
* @brief 广
* @param address
* @retval 1
* 0
*/
static int Match_Broadcastaddress(u_int8_t address[6])
{
if (address[0] == 0xFF && \
address[1] == 0xFF && \
address[2] == 0xFF && \
address[3] == 0xFF && \
address[4] == 0xFF && \
address[5] == 0xFF && \
address[6] == 0xFF) {
log_info("Match_Broadcastaddress success\r\n");
return 1;
}
return 0;
}
/**
* @brief
* @param uart_handle
* @param buff
* @param buff_size
* @retval
*/
static int HY_uart_read_climate_pack(device_handle uart_handle,uint8_t *buff, uint32_t buff_size)
{
uint32_t offset = 0;
uint32_t len = 0;
uint8_t flag_run = 0;
char c = 0;
HY_Recv_pack *pack = (HY_Recv_pack *)buff;
buff_size--; //预留一个'\0'位置
for (; offset < buff_size;){
if (ring_queue_length(uart_handle) == 0) {
break;
}
c = uart_dev_in_char(uart_handle);
buff[offset++] = c;
/* 匹配起始标志位 */
if (offset == HY_analyzeStartFlag || (flag_run > 0)) {
if (pack->start_Flag != HY_defaultValue.start_Flag) {
memcpy(buff, buff+1, offset-1);
offset--;
continue;
}
}
/* 匹配硬件ID */
if (offset == HY_analyzeHardwareID || (flag_run > 1)) {
if (HY_matchhardwareID(pack->hardwareID) || Match_Broadcastaddress(pack->hardwareID)) {
if (flag_run < 1) {
flag_run = 1;
}
memcpy(buff, buff+1, offset-1);
offset--;
continue;
}
}
}
return 0;
}
/**
* @brief
* @param
* @retval
*/
static void HY_FRT_MsgHandler(device_handle device, uint8_t *pMsg, uint32_t MsgLen)
{
HY_Recv_pack *pack = (HY_Recv_pack *)pMsg;
for (u_int16_t i = 0; i < sizeof(g_hyMsgTbl) / sizeof(HY_FuncionMsgProcTable); i++){
if (pack->controlWord == g_hyMsgTbl[i].msgId){
g_hyMsgTbl[i].pMsgProc(device, pMsg, MsgLen);
}
}
}
/**
* @brief
* @param
* @retval
*/
void HY_read_and_process_uart_data(device_handle device)
{
// printf("ring_queue_length = %d \n", ring_queue_length(device));
// if (ring_queue_length(device) > 10) {uart_dev_char_present(device_handle device)
if (uart_dev_char_present(device)) {
Delay_Ms(20);
// printf("ring_queue_length = %d \n", ring_queue_length(device));
memset(rs485_buff, 0, sizeof(rs485_buff));
int ret = HY_uart_read_climate_pack(device, rs485_buff, sizeof(rs485_buff));
if(ret > 0){
HY_FRT_MsgHandler(device, rs485_buff, ret);
}
}
}
/* 电池状态数据报 */
void HY_MsgProcFunc_batteryStatus(device_handle device, void *pMsg, uint32_t MsgLen)
{
}
/* 电量统计数据报 */
void HY_MsgProcFunc_electricityStatistics(device_handle device, void *pMsg, uint32_t MsgLen)
{
}
/* 传感器号码配置 */
void HY_MsgProcFunc_sensorNumberConfiguration(device_handle device, void *pMsg, uint32_t MsgLen)
{
}
/* 传感器号码查询 */
void HY_MsgProcFunc_sensorNumberInquiry(device_handle device, void *pMsg, uint32_t MsgLen)
{
}
/* 充电阈值电压配置 */
void HY_MsgProcFunc_chargingThresholdVoltageConfiguration(device_handle device, void *pMsg, uint32_t MsgLen)
{
}
/* 充电域值电压查询 */
void HY_MsgProcFunc_chargingRangeVoltageQuery(device_handle device, void *pMsg, uint32_t MsgLen)
{
}
/* 复位指令 */
void HY_MsgProcFunc_resetInstruction(device_handle device, void *pMsg, uint32_t MsgLen)
{
}
/* 充电控制配置 */
void HY_MsgProcFunc_chargingControlConfiguration(device_handle device, void *pMsg, uint32_t MsgLen)
{
}
/* 充电控制查询 */
static void HY_MsgProcFunc_chargingControlQuery(device_handle device, void *pMsg, uint32_t MsgLen)
{
}
/* 配置协议类型 */
void HY_MsgProcFunc_configureProtocolType(device_handle device, void *pMsg, uint32_t MsgLen)
{
}
///* 响应配置协议类型 */
//static void HY_MsgProcFunc_batteryStatus(device_handle device, void *pMsg, uint32_t MsgLen);
/* 查询电池控制盒当前配置 */
void HY_MsgProcFunc_queryControlBoxConfiguration(device_handle device, void *pMsg, uint32_t MsgLen)
{
}
/* 查询电池控制盒软件版本 */
void HY_MsgProcFunc_querySoftwareVersion(device_handle device, void *pMsg, uint32_t MsgLen)
{
}
/* 进入配置模式 */
void HY_MsgProcFunc_enterConfigurationMode(device_handle device, void *pMsg, uint32_t MsgLen)
{
}
/* 配置控制盒硬件ID号 */
void HY_MsgProcFunc_configureHardwareID(device_handle device, void *pMsg, uint32_t MsgLen)
{
}
/* 控制盒硬件ID号及通信ID号原传感器号查询 */
void HY_MsgProcFunc_hardwareID_communicationIDQuery(device_handle device, void *pMsg, uint32_t MsgLen)
{
}
/* 修改通信ID号原传感器号 */
void HY_MsgProcFunc_modifyCommunicationID(device_handle device, void *pMsg, uint32_t MsgLen)
{
}
/* 查询主板温度值 */
void HY_MsgProcFunc_checkMotherboardTemperature(device_handle device, void *pMsg, uint32_t MsgLen)
{
}

View File

@ -836,8 +836,7 @@ void test(void)
// g_Mppt_Para.Discharg_Current = get_capturedata(get_DSG_CURR);
// g_Mppt_Para.Output_Voltage = get_capturedata(get_PV_VOLT_OUT);
// g_Mppt_Para.Battery_Voltage = g_Mppt_Para.Output_Voltage;
g_Mppt_Para.Charg_Current = get_CHG_CURR();
g_Mppt_Para.Discharg_Current = get_DSG_CURR();
g_Mppt_Para.Output_Voltage = get_PV_VOLT_OUT();
g_Mppt_Para.Input_Voltage = get_PV1_VOLT_IN();

View File

@ -834,7 +834,7 @@ static int uart_read_climate_pack(device_handle uart_handle,uint8_t *buff, uint3
* @param
* @retval
*/
static void FRT_MsgHandler(device_handle device, uint8_t *pMsg, uint32_t MsgLen)
void FRT_MsgHandler(device_handle device, uint8_t *pMsg, uint32_t MsgLen)
{
SL_Mppt_Recv_pack *pack = (SL_Mppt_Recv_pack *)pMsg;

View File

@ -133,6 +133,14 @@ void Task_RunLED(void)
sprintf(buffer, " excessiveLoadFlag : %d \n", excessiveLoadFlag);
uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
memset(buffer, 0, sizeof(buffer));
sprintf(buffer, " inPower : %d \n", (int)(g_Mppt_Para.inPower));
uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
memset(buffer, 0, sizeof(buffer));
sprintf(buffer, " outPower : %d \n", (int)(g_Mppt_Para.outPower));
uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
memset(buffer, 0, sizeof(buffer));
sprintf(buffer, " 0.没有工作; 1.涓流模式; 2.恒流模式; 3.恒压模式; 4.浮充模式; 5.没有电池 : %d \n", g_Mppt_Para.MPPT_Mode);
uart_dev_write(g_bat485_uart3_handle, buffer, sizeof(buffer));
@ -140,7 +148,6 @@ void Task_RunLED(void)
uart_dev_write(g_bat485_uart3_handle, " \n", sizeof(" \n"));
// printf("vout : %d/100 \n", (int)(get_capturedata(get_PV_VOLT_OUT) * 100));
// get_CHG_CURR();
@ -809,7 +816,6 @@ void task_Init(void)
*/
void hardware_Init(void)
{
TIM2_Init(1);
uart_dev_init();
PWM_TIM_Configuration();
// TIM_SetCompare4(TIM4, 0);
@ -826,7 +832,10 @@ void hardware_Init(void)
// uart_dev_write(g_bat485_uart3_handle, " hello world \n", sizeof(" hello world \n"));
TIM3_Init(10);
TIM3_Init(1);
// TIM_Cmd(TIM3, ENABLE); //TIM3使能
currBuffInit();
TIM2_Init(1);
}

View File

@ -0,0 +1,91 @@
/*
* ring_queue.c
*
* Created on: 2024621
* Author: psx
*/
//循环队列
#include <stdio.h>
#include <stdlib.h>
#include "ring_queue2.h"
//#define RING_QUEUE_DEBUG
//#ifdef RING_QUEUE_DEBUG
//#define //rq_debug term_printf
//#else
//void rq_debug(const char *fmt, ...){};
//#endif
#define RQ_OK 1
#define RQ_ERROR 0
#define RQ_OVERFLOW -2
//初始化队列
int InitRingQueue2(RingQueue2 *q, RQ_ElementType2 *buff, int size)
{
q->elems = buff;
q->size = size;
q->front=q->rear=0;
return RQ_OK;
}
//遍历队列,
//消费者使用故对生产者可能修改的rear先读取缓存
int ShowRingQueue2(RingQueue2 *q)
{
//int i;
int rear = q->rear;
if(q->front == rear)
{
//rq_debug("队列为空\n");
return RQ_ERROR;
}
//rq_debug("队列中的元素为:\n");
//for(i=((q->front)%q->size); i != rear; i=((i+1)%q->size))
//rq_debug(" %c\n",q->elems[i]);
//rq_debug("\n");
//rq_debug("队首元素为%c\n",q->elems[q->front]);
//rq_debug("队尾元素为%c\n",q->elems[rear - 1]);
return RQ_OK;
}
//向队尾插入元素e
int InRingQueue2(RingQueue2 *q,RQ_ElementType2 e)
{
if(RingQueueFull2(q))
{
//rq_debug("空间不足\n");
return(RQ_OVERFLOW);
}
q->elems[q->rear] = e;
q->rear = (q->rear+1) % q->size;
//rq_debug("rear = %d\n",q->rear);
return RQ_OK;
}
//从队首取回并删除元素
int OutRingQueue2(RingQueue2 *q, RQ_ElementType2 *e)
{
if(RingQueueEmpty2(q))
{
//rq_debug("队列为空\n");
return RQ_ERROR;
}
*e = q->elems[q->front];
//rq_debug("被删除的队首元素为%c\n",q->elems[q->front]);
q->front = (q->front+1) % q->size;
return RQ_OK;
}
//队列中的元素个数
int RingQueueLength2(RingQueue2 *q)
{
return ((q->rear - q->front) + q->size) % q->size;
}

View File

@ -0,0 +1,44 @@
/*
* ring_queue.h
*
* Created on: 2024621
* Author: psx
*/
#ifndef DRIVERS_RINGQUEUE_RING_QUEUE2_H_
#define DRIVERS_RINGQUEUE_RING_QUEUE2_H_
//#define RING_QUEUE_DEBUG //定义本宏会打印RingQueue的调试信息
//typedef unsigned char RQ_ElementType2;//元素类型
typedef uint16_t RQ_ElementType2;//元素类型
typedef struct _ring_queue2
{
RQ_ElementType2 *elems;
int size;
volatile int front, rear;
}RingQueue2;
//初始化队列,需传入保存队列状态的结构q队列使用的buffer和buffer大小
int InitRingQueue2(RingQueue2 *q, RQ_ElementType2 *buff, int size);
#define RingQueueFull2(q) (((q)->rear+1) % (q)->size == (q)->front)
#define RingQueueEmpty2(q) ((q)->front == (q)->rear)
//遍历队列,
//消费者使用故对生产者可能修改的rear先读取缓存
int ShowRingQueue2(RingQueue2 *q);
//向队尾插入元素e
int InRingQueue2(RingQueue2 *q,RQ_ElementType2 e);
//从队首删除元素
int OutRingQueue2(RingQueue2 *q, RQ_ElementType2 *e);
//队列中的元素个数
int RingQueueLength2(RingQueue2 *q);
#endif /* DRIVERS_RINGQUEUE_RING_QUEUE_H_ */

View File

@ -13,7 +13,7 @@ void ADC_all_Init(void)
RCC_PB2PeriphClockCmd(RCC_PB2Periph_ADC1, ENABLE);
RCC_ADCCLKConfig(RCC_PCLK2_Div2);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7; //PA1~7对应ADC通道1~7
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6; //PA1~7对应ADC通道1~7
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
GPIO_Init(GPIOA, &GPIO_InitStructure);

View File

@ -10,6 +10,8 @@
#include "pwm.h"
#include "mppt_control.h"
#include "task.h"
#include "collect_Conversion.h"
#include "sl_protocol.h"
void TIM3_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
void TIM2_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast")));
@ -23,7 +25,7 @@ void TIM3_Init(uint16_t delay_ms)
/* 分频系数 */
uint16_t psc = (SystemCoreClock / 10000) - 1;
/* 周期数 */
uint16_t arr = delay_ms * 1 - 1;
uint16_t arr = delay_ms * 10 - 1;
TIM3_Int_Init(arr, psc);
}
@ -103,9 +105,12 @@ void TIM2_IRQHandler(void)
if (TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET) { //检查TIM2中断是否发生。
TIM_ClearITPendingBit(TIM2, TIM_IT_Update); //清除TIM1的中断挂起位。
TimeSliceOffset_Produce();
// if (outputAgainFlag == 1) {
// outputAgainFlag = 0;
// }
g_Mppt_Para.Charg_Current = get_CHG_CURR();
g_Mppt_Para.Discharg_Current = get_DSG_CURR();
g_Mppt_Para.inPower += g_Mppt_Para.Charg_Current * g_Mppt_Para.Output_Voltage;
g_Mppt_Para.outPower += g_Mppt_Para.Discharg_Current * g_Mppt_Para.Output_Voltage;
}
}

View File

@ -26,8 +26,9 @@ App/src/collect_Conversion.o: ../App/src/collect_Conversion.c \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_misc.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_lptim.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_opa.h \
D:\psx\MPPT\git\Hardware\inc/adc.h D:\psx\MPPT\git\Hardware\inc/gpio.h \
D:\psx\MPPT\git\App\inc/uart_dev.h \
D:\psx\MPPT\git\Hardware\inc/adc.h \
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h \
D:\psx\MPPT\git\Hardware\inc/gpio.h D:\psx\MPPT\git\App\inc/uart_dev.h \
D:\psx\MPPT\git\Drivers\RingQueue/ring_queue.h \
D:\psx\MPPT\git\Hardware\inc/rs485.h
@ -91,6 +92,8 @@ D:\psx\MPPT\git\Peripheral\inc/ch32l103_opa.h:
D:\psx\MPPT\git\Hardware\inc/adc.h:
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h:
D:\psx\MPPT\git\Hardware\inc/gpio.h:
D:\psx\MPPT\git\App\inc/uart_dev.h:

Binary file not shown.

View File

@ -1,113 +0,0 @@
App/src/hy_protocol.o: ../App/src/hy_protocol.c \
D:\psx\MPPT\git\App\inc/hy_protocol.h D:\psx\MPPT\git\Debug/debug.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103.h \
D:\psx\MPPT\git\Core/core_riscv.h D:\psx\MPPT\git\User/system_ch32l103.h \
D:\psx\MPPT\git\User/ch32l103_conf.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_adc.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_bkp.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_can.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_crc.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_dbgmcu.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_dma.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_exti.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_flash.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_gpio.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_i2c.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_iwdg.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_pwr.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_rcc.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_rtc.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_spi.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_tim.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_usart.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_wwdg.h \
D:\psx\MPPT\git\User/ch32l103_it.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_misc.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_lptim.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_opa.h \
D:\psx\MPPT\git\App\inc/uart_dev.h \
D:\psx\MPPT\git\Drivers\RingQueue/ring_queue.h \
D:\psx\MPPT\git\Hardware\inc/rs485.h D:\psx\MPPT\git\App\inc/inflash.h \
D:\psx\MPPT\git\App\inc/pdebug.h D:\psx\MPPT\git\App\inc/mppt_control.h \
D:\psx\MPPT\git\App\inc/task.h \
D:\psx\MPPT\git\Drivers\TimeSliceOffset/timeSliceOffset.h \
D:\psx\MPPT\git\App\inc/uart_dev.h D:\psx\MPPT\git\Hardware\inc/tim.h
D:\psx\MPPT\git\App\inc/hy_protocol.h:
D:\psx\MPPT\git\Debug/debug.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103.h:
D:\psx\MPPT\git\Core/core_riscv.h:
D:\psx\MPPT\git\User/system_ch32l103.h:
D:\psx\MPPT\git\User/ch32l103_conf.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_adc.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_bkp.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_can.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_crc.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_dbgmcu.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_dma.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_exti.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_flash.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_gpio.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_i2c.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_iwdg.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_pwr.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_rcc.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_rtc.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_spi.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_tim.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_usart.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_wwdg.h:
D:\psx\MPPT\git\User/ch32l103_it.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_misc.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_lptim.h:
D:\psx\MPPT\git\Peripheral\inc/ch32l103_opa.h:
D:\psx\MPPT\git\App\inc/uart_dev.h:
D:\psx\MPPT\git\Drivers\RingQueue/ring_queue.h:
D:\psx\MPPT\git\Hardware\inc/rs485.h:
D:\psx\MPPT\git\App\inc/inflash.h:
D:\psx\MPPT\git\App\inc/pdebug.h:
D:\psx\MPPT\git\App\inc/mppt_control.h:
D:\psx\MPPT\git\App\inc/task.h:
D:\psx\MPPT\git\Drivers\TimeSliceOffset/timeSliceOffset.h:
D:\psx\MPPT\git\App\inc/uart_dev.h:
D:\psx\MPPT\git\Hardware\inc/tim.h:

Binary file not shown.

Binary file not shown.

View File

@ -27,8 +27,10 @@ App/src/mppt_control.o: ../App/src/mppt_control.c \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_lptim.h \
D:\psx\MPPT\git\Peripheral\inc/ch32l103_opa.h \
D:\psx\MPPT\git\App\inc/collect_Conversion.h \
D:\psx\MPPT\git\Hardware\inc/adc.h D:\psx\MPPT\git\Hardware\inc/pwm.h \
D:\psx\MPPT\git\App\inc/inflash.h D:\psx\MPPT\git\Hardware\inc/gpio.h \
D:\psx\MPPT\git\Hardware\inc/adc.h \
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h \
D:\psx\MPPT\git\Hardware\inc/pwm.h D:\psx\MPPT\git\App\inc/inflash.h \
D:\psx\MPPT\git\Hardware\inc/gpio.h \
D:\psx\MPPT\git\App\inc/sl_protocol.h D:\psx\MPPT\git\App\inc/uart_dev.h \
D:\psx\MPPT\git\Drivers\RingQueue/ring_queue.h \
D:\psx\MPPT\git\Hardware\inc/rs485.h D:\psx\MPPT\git\App\inc/task.h \
@ -97,6 +99,8 @@ D:\psx\MPPT\git\App\inc/collect_Conversion.h:
D:\psx\MPPT\git\Hardware\inc/adc.h:
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h:
D:\psx\MPPT\git\Hardware\inc/pwm.h:
D:\psx\MPPT\git\App\inc/inflash.h:

Binary file not shown.

Binary file not shown.

View File

@ -6,7 +6,6 @@
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../App/src/collect_Conversion.c \
../App/src/hy_protocol.c \
../App/src/inflash.c \
../App/src/mppt_control.c \
../App/src/sl_protocol.c \
@ -15,7 +14,6 @@ C_SRCS += \
OBJS += \
./App/src/collect_Conversion.o \
./App/src/hy_protocol.o \
./App/src/inflash.o \
./App/src/mppt_control.o \
./App/src/sl_protocol.o \
@ -24,7 +22,6 @@ OBJS += \
C_DEPS += \
./App/src/collect_Conversion.d \
./App/src/hy_protocol.d \
./App/src/inflash.d \
./App/src/mppt_control.d \
./App/src/sl_protocol.d \
@ -34,6 +31,6 @@ C_DEPS += \
# Each subdirectory must supply rules for building sources it contributes
App/src/%.o: ../App/src/%.c
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @

View File

@ -34,7 +34,8 @@ App/src/task.o: ../App/src/task.c D:\psx\MPPT\git\App\inc/task.h \
D:\psx\MPPT\git\Hardware\inc/flash.h \
D:\psx\MPPT\git\App\inc/sl_protocol.h \
D:\psx\MPPT\git\App\inc/mppt_control.h D:\psx\MPPT\git\App\inc/inflash.h \
D:\psx\MPPT\git\App\inc/collect_Conversion.h
D:\psx\MPPT\git\App\inc/collect_Conversion.h \
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h
D:\psx\MPPT\git\App\inc/task.h:
@ -121,3 +122,5 @@ D:\psx\MPPT\git\App\inc/mppt_control.h:
D:\psx\MPPT\git\App\inc/inflash.h:
D:\psx\MPPT\git\App\inc/collect_Conversion.h:
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h:

Binary file not shown.

View File

@ -16,6 +16,6 @@ C_DEPS += \
# Each subdirectory must supply rules for building sources it contributes
Core/%.o: ../Core/%.c
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @

View File

@ -16,6 +16,6 @@ C_DEPS += \
# Each subdirectory must supply rules for building sources it contributes
Debug/%.o: ../Debug/%.c
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @

View File

@ -16,6 +16,6 @@ C_DEPS += \
# Each subdirectory must supply rules for building sources it contributes
Drivers/RingQueue/%.o: ../Drivers/RingQueue/%.c
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @

View File

@ -0,0 +1,4 @@
Drivers/RingQueue2/ring_queue2.o: ../Drivers/RingQueue2/ring_queue2.c \
../Drivers/RingQueue2/ring_queue2.h
../Drivers/RingQueue2/ring_queue2.h:

Binary file not shown.

View File

@ -0,0 +1,21 @@
################################################################################
# MRS Version: 1.9.0
# 自动生成的文件。不要编辑!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../Drivers/RingQueue2/ring_queue2.c
OBJS += \
./Drivers/RingQueue2/ring_queue2.o
C_DEPS += \
./Drivers/RingQueue2/ring_queue2.d
# Each subdirectory must supply rules for building sources it contributes
Drivers/RingQueue2/%.o: ../Drivers/RingQueue2/%.c
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @

View File

@ -16,6 +16,6 @@ C_DEPS += \
# Each subdirectory must supply rules for building sources it contributes
Drivers/TimeSliceOffset/%.o: ../Drivers/TimeSliceOffset/%.c
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @

Binary file not shown.

Binary file not shown.

View File

@ -31,6 +31,6 @@ C_DEPS += \
# Each subdirectory must supply rules for building sources it contributes
Hardware/src/%.o: ../Hardware/src/%.c
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @

View File

@ -31,7 +31,11 @@ Hardware/src/tim.o: ../Hardware/src/tim.c \
D:\psx\MPPT\git\Drivers\RingQueue/ring_queue.h \
D:\psx\MPPT\git\Hardware\inc/rs485.h D:\psx\MPPT\git\Hardware\inc/pwm.h \
D:\psx\MPPT\git\App\inc/mppt_control.h D:\psx\MPPT\git\App\inc/task.h \
D:\psx\MPPT\git\App\inc/uart_dev.h
D:\psx\MPPT\git\App\inc/uart_dev.h \
D:\psx\MPPT\git\App\inc/collect_Conversion.h \
D:\psx\MPPT\git\Hardware\inc/adc.h \
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h \
D:\psx\MPPT\git\App\inc/sl_protocol.h
D:\psx\MPPT\git\Hardware\inc/tim.h:
@ -106,3 +110,11 @@ D:\psx\MPPT\git\App\inc/mppt_control.h:
D:\psx\MPPT\git\App\inc/task.h:
D:\psx\MPPT\git\App\inc/uart_dev.h:
D:\psx\MPPT\git\App\inc/collect_Conversion.h:
D:\psx\MPPT\git\Hardware\inc/adc.h:
D:\psx\MPPT\git\Drivers\RingQueue2/ring_queue2.h:
D:\psx\MPPT\git\App\inc/sl_protocol.h:

Binary file not shown.

View File

@ -76,6 +76,6 @@ C_DEPS += \
# Each subdirectory must supply rules for building sources it contributes
Peripheral/src/%.o: ../Peripheral/src/%.c
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @

Binary file not shown.

View File

@ -22,6 +22,6 @@ C_DEPS += \
# Each subdirectory must supply rules for building sources it contributes
User/%.o: ../User/%.c
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @ riscv-none-embed-gcc -march=rv32imacxw -mabi=ilp32 -msmall-data-limit=8 -msave-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common -Wunused -Wuninitialized -g -I"D:\psx\MPPT\git\Debug" -I"D:\psx\MPPT\git\Core" -I"D:\psx\MPPT\git\User" -I"D:\psx\MPPT\git\Peripheral\inc" -I"D:\psx\MPPT\git\App\inc" -I"D:\psx\MPPT\git\Hardware\inc" -I"D:\psx\MPPT\git\Drivers\RingQueue" -I"D:\psx\MPPT\git\Drivers\TimeSliceOffset" -I"D:\psx\MPPT\git\Drivers\RingQueue2" -std=gnu99 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -c -o "$@" "$<"
@ @

View File

@ -14,6 +14,7 @@ RM := rm -rf
-include Peripheral/src/subdir.mk
-include Hardware/src/subdir.mk
-include Drivers/TimeSliceOffset/subdir.mk
-include Drivers/RingQueue2/subdir.mk
-include Drivers/RingQueue/subdir.mk
-include Debug/subdir.mk
-include Core/subdir.mk

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -27,6 +27,7 @@ App/src \
Core \
Debug \
Drivers/RingQueue \
Drivers/RingQueue2 \
Drivers/TimeSliceOffset \
Hardware/src \
Peripheral/src \