From af04d91130922bf8d6013525f92184e79e5837af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B7=E5=BA=8A=E5=B0=B1=E7=8A=AF=E5=9B=B0?= <11730503+psx123456@user.noreply.gitee.com> Date: Fri, 24 Jan 2025 16:27:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=90=AF=E5=8A=A8=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=AE=B0=E5=BD=95=EF=BC=8C=E6=9B=B4=E6=94=B9=E7=A1=AC?= =?UTF-8?q?=E4=BB=B6=E7=9F=AD=E8=B7=AF=E4=BF=9D=E6=8A=A4=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- APP/application/Src/start.c | 4 +++- APP/businessLogic/Src/SOE.c | 4 ++++ APP/businessLogic/Src/abnormalManage.c | 5 ++--- APP/businessLogic/Src/task.c | 9 ++++++++- APP/functionalModule/Src/capture.c | 2 ++ Core/Src/main.c | 2 +- Core/Src/stm32g4xx_it.c | 2 +- tools/chargControlTypes.h | 1 + 8 files changed, 22 insertions(+), 7 deletions(-) diff --git a/APP/application/Src/start.c b/APP/application/Src/start.c index 63be0f9..31f5b63 100644 --- a/APP/application/Src/start.c +++ b/APP/application/Src/start.c @@ -7,7 +7,7 @@ #include "parameter.h" #include "FM_TIM.h" #include "inFlash.h" - +#include "SOE.h" void startInfo(void) { @@ -68,6 +68,8 @@ void start(void) // cfgTest(); // HAL_Delay(1000); // } + /* 启动事件 */ + insertEventsOrderRecord(startEvent); TimeSliceOffset_Start(); } diff --git a/APP/businessLogic/Src/SOE.c b/APP/businessLogic/Src/SOE.c index 44f4985..a780c01 100644 --- a/APP/businessLogic/Src/SOE.c +++ b/APP/businessLogic/Src/SOE.c @@ -141,6 +141,10 @@ void insertEventsOrderRecord(eventsOrderRecordMode mode) soeInfo.insertData->temp = get_EXCHG_CURR(); } + else if (mode == startEvent) { + soeInfo.insertData->temp = 0; + } + else { soeInfo.count++; return; diff --git a/APP/businessLogic/Src/abnormalManage.c b/APP/businessLogic/Src/abnormalManage.c index d0f0c68..36690e7 100644 --- a/APP/businessLogic/Src/abnormalManage.c +++ b/APP/businessLogic/Src/abnormalManage.c @@ -402,7 +402,7 @@ void checkAbnormal(void) // checkTimeInit(); /* 滤波 */ adcCaptureFir(); - + /* 转换 */ setChargCurrent(); setDischargCurrent(); @@ -416,7 +416,7 @@ void checkAbnormal(void) lowInputLoadDetection(); judgeChargCurr(); - + // checkAbnormalTime = getCheckTime(); } @@ -455,7 +455,6 @@ void DSG_PROT_Interrupt(void) setShortCircuit(); /* 第一次进入输出短路,启动短路任务 */ if (getShortCircuit() == 1) { - setPowerOutput(FALSE); setShortCircuitFlag(TRUE); startShortCircuitProtection(); } diff --git a/APP/businessLogic/Src/task.c b/APP/businessLogic/Src/task.c index 37e4e0b..f2127e4 100644 --- a/APP/businessLogic/Src/task.c +++ b/APP/businessLogic/Src/task.c @@ -275,7 +275,7 @@ void Task_wdi(void) timeInfo time; time = getLastTime(); saveTime(&time); - NVIC_SystemReset(); + // NVIC_SystemReset(); } } @@ -680,6 +680,13 @@ void Task_shortCircuitProtection(void) static uint8_t num = 0; num++; + /* 设定输出短路保护时间 */ + if (num == 2) { + setPowerOutput(FALSE); + setPowerOutput(TRUE); + } + + /* 设定输出短路保护时间 */ if (num == g_cfgParameter.shortCircuitJudgmentDelay) { num = 0; diff --git a/APP/functionalModule/Src/capture.c b/APP/functionalModule/Src/capture.c index 45d35ed..0bcf7a4 100644 --- a/APP/functionalModule/Src/capture.c +++ b/APP/functionalModule/Src/capture.c @@ -528,6 +528,8 @@ void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hdma) PV_VOLT_IN_capture.outData = (adcBuff[3] + adcBuff[7] + adcBuff[11] + adcBuff[15] + adcBuff[19] + adcBuff[23] + adcBuff[27] + adcBuff[31] + adcBuff[35] + adcBuff[39]) / indata16_size; + // WORK_VOLT_capture.outData = ; + setSoftShortCircuit(DSG_CURR_capture.outData); chargControl(); diff --git a/Core/Src/main.c b/Core/Src/main.c index 1166c51..7d18c24 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -196,7 +196,7 @@ void Error_Handler(void) /* User can add his own implementation to report the HAL error return state */ __disable_irq(); while (1) - { + { } /* USER CODE END Error_Handler_Debug */ } diff --git a/Core/Src/stm32g4xx_it.c b/Core/Src/stm32g4xx_it.c index a335e8a..dacac84 100644 --- a/Core/Src/stm32g4xx_it.c +++ b/Core/Src/stm32g4xx_it.c @@ -89,7 +89,7 @@ void NMI_Handler(void) void HardFault_Handler(void) { /* USER CODE BEGIN HardFault_IRQn 0 */ - + NVIC_SystemReset(); /* USER CODE END HardFault_IRQn 0 */ while (1) { diff --git a/tools/chargControlTypes.h b/tools/chargControlTypes.h index 5a05a5a..cb171ca 100644 --- a/tools/chargControlTypes.h +++ b/tools/chargControlTypes.h @@ -67,6 +67,7 @@ typedef enum { hardwareShortCircuitProtection, //硬件短路保护 hardwareInputProtection, //硬件防反输入保护 InputProtection, //软件防反输入保护 + startEvent, //启动 }eventsOrderRecordMode;