Compare commits

...

2 Commits

Author SHA1 Message Date
起床就犯困 25af1a47ff 修改前端输入功率较低时的执行方式 2025-02-13 08:55:55 +08:00
起床就犯困 a31b9af810 MPPT算法异常 2025-02-11 08:57:47 +08:00
12 changed files with 250 additions and 88 deletions

View File

@ -62,6 +62,9 @@ void start(void)
uartCommonInit(); uartCommonInit();
// setDutyRatio(0.15f);
task_Init(); task_Init();
startInfo(); startInfo();
@ -72,7 +75,7 @@ void start(void)
// HAL_Delay(1000); // HAL_Delay(1000);
// } // }
/* 启动事件 */ /* 启动事件 */
insertEventsOrderRecord(startEvent); // insertEventsOrderRecord(startEvent);
TimeSliceOffset_Start(); TimeSliceOffset_Start();
} }

View File

@ -23,7 +23,7 @@ void Init(void)
// HAL_Delay(10000); // HAL_Delay(10000);
config_info_start(); config_info_start();
Init_debug_uart(); Init_debug_uart();
ADC_Capture_Init(); ADC_Capture_Init();
@ -49,8 +49,8 @@ void Init(void)
// POW_OUT_PCON_Open(); // POW_OUT_PCON_Open();
HAL_Delay(100); HAL_Delay(100);
setPowerOutput(TRUE); setPowerOutput(TRUE);
resetCheckImpedanceState();
// EN_PWMOUT_Eable();
// setDutyRatio(0.5); // setDutyRatio(0.5);
// while (1) { // while (1) {
// log_info("Init_debug_uart \n"); // log_info("Init_debug_uart \n");

View File

@ -299,12 +299,23 @@ void checkFFMOS_CON(void)
// FFMOS_CON_Close(); // FFMOS_CON_Close();
// } // }
if (getChargCurrent() > 5.0f && FALSE == FFMOS_CON_read()) { static uint8_t num = 100;
FFMOS_CON_Open(); if (getChargCurrent() > 8.0f && FALSE == FFMOS_CON_read()) {
num--;
if (!num) {
FFMOS_CON_Open();
}
} }
else if (getChargCurrent() < 2.0f && TRUE == FFMOS_CON_read()) { else if (getChargCurrent() < 2.0f && TRUE == FFMOS_CON_read()) {
// num--;
// if (!num) {
// FFMOS_CON_Close();
// }
FFMOS_CON_Close(); FFMOS_CON_Close();
} }
else {
num = 100;
}
} }
// /** // /**
@ -360,16 +371,18 @@ void setOverLoad(void)
*/ */
void lowInputLoadDetection(void) void lowInputLoadDetection(void)
{ {
static int num = 0; static int num = 0;
if (excessiveLoadInterruptFlag == TRUE && getOutputVoltage() < g_cfgParameter.inputPowerLowDetectionVolt) { if (excessiveLoadInterruptFlag == TRUE && getOutputVoltage() < g_cfgParameter.inputPowerLowDetectionVolt) {
num++; num++;
// setOverLoad();
} else { } else {
num = 0; num = 0;
excessiveLoadInterruptFlag = FALSE; excessiveLoadInterruptFlag = FALSE;
} }
if (excessiveLoadInterruptFlag == TRUE && num == g_cfgParameter.inputPowerLowDetectionDelay) { if (excessiveLoadInterruptFlag == TRUE && num == g_cfgParameter.inputPowerLowDetectionDelay) {
excessiveLoadInterruptFlag = FALSE;
setOverLoad(); setOverLoad();
} }
} }
@ -468,6 +481,13 @@ void DSG_PROT_Interrupt(void)
} }
} }
/**
* @brief
* @param
* @retval
*
*/
void EXCHG_PROT_Interrupt(void) void EXCHG_PROT_Interrupt(void)
{ {
setPowerOutput(FALSE); setPowerOutput(FALSE);

View File

@ -334,20 +334,34 @@ void mppt_readJust(void)
// return; // return;
/* 调节电压,两个电压步调节 */ /* 调节电压,两个电压步调节 */
static float stepV1 = 0.2;
static float stepV2 = 0.05;
static float Power = 0; static float Power = 0;
static float totalPower = 0; // static float totalPower = 0;
static float powerData[50] = {0}; // static float powerData[50] = {0};
static uint8_t powerIndex = 0; // static uint8_t powerIndex = 0;
/* 获取50次的平均值 */ static float totalChargeCurr = 0;
totalPower -= powerData[powerIndex]; static float chargeCurrData[50] = {0};
powerData[powerIndex] = getOutputVoltage() * getChargCurrent(); static uint8_t chargeCurrIndex = 0;
totalPower += powerData[powerIndex];
powerIndex++; /* 获取50次值的和 */
if (powerIndex >= 50) { totalChargeCurr -= chargeCurrData[chargeCurrIndex];
powerIndex = 0; chargeCurrData[chargeCurrIndex] = getChargCurrent();
totalChargeCurr += chargeCurrData[chargeCurrIndex];
chargeCurrIndex++;
if (chargeCurrIndex >= 50) {
chargeCurrIndex = 0;
} }
// totalPower -= powerData[powerIndex];
// powerData[powerIndex] = getOutputVoltage() * getChargCurrent();
// totalPower += powerData[powerIndex];
// powerIndex++;
// if (powerIndex >= 50) {
// powerIndex = 0;
// }
static float lPower = 0; static float lPower = 0;
static float lLPower = 0; static float lLPower = 0;
// static float lLLPower = 0; // static float lLLPower = 0;
@ -356,9 +370,6 @@ void mppt_readJust(void)
// static float kp = 0.005; // static float kp = 0.005;
// static float ki = 0.00001; // static float ki = 0.00001;
static float stepV1 = 0.2;
static float stepV2 = 0.1;
static uint8_t flag1 = 0; //表明上次运算是加还是减 static uint8_t flag1 = 0; //表明上次运算是加还是减
/* 延时一段时间才判断 */ /* 延时一段时间才判断 */
@ -378,12 +389,14 @@ void mppt_readJust(void)
} }
if (getMosTemperState() == mosTemperReduce) { if (getMosTemperState() == mosTemperReduce) {
SolarInCircuitV = 16; SolarInCircuitV = 20;
} }
flag = 0; flag = 0;
Power = totalPower / 50.0f; // Power = totalPower / 30.0f;
// Power = totalPower;
Power = totalChargeCurr * getOutputVoltage();
static float powerT = 0; static float powerT = 0;
powerT = Power - lPower; powerT = Power - lPower;
@ -391,10 +404,88 @@ void mppt_readJust(void)
powerT = -powerT; powerT = -powerT;
} }
/* 滞环值 */
float hysteresisValue1;
float hysteresisValue2;
/* 一段时间内电流都很小则固定电压输出 */
static uint8_t currMinFlag = 0;
static uint8_t currMinFlag1 = 0;
// if (getChargCurrent() < 0.8f) {
if (totalChargeCurr < 40) {
// hysteresisValue1 = getChargCurrent() * 1.7f;
// hysteresisValue2 = getChargCurrent() * 12;
currMinFlag++;
if (currMinFlag == 8) {
currMinFlag = 0;
SolarInCircuitV = 18.0f;
currMinFlag1 = 1;
}
return;
}
// else if (getChargCurrent() < 3 && currMinFlag1) {
else if (totalChargeCurr < 150 && currMinFlag1) {
currMinFlag1 = 0;
currMinFlag = 0;
return;
}
// else if (getChargCurrent() < 7) {
else if (totalChargeCurr < 350) {
currMinFlag1 = 0;
currMinFlag = 0;
// hysteresisValue1 = getChargCurrent() * 1.1f;
// hysteresisValue2 = getChargCurrent() * 10;
hysteresisValue1 = totalChargeCurr / 45.0f;
hysteresisValue2 = totalChargeCurr / 5.0f;
}
// else if (getChargCurrent() < 20) {
else if (totalChargeCurr < 1000) {
currMinFlag1 = 0;
currMinFlag = 0;
// hysteresisValue1 = getChargCurrent() * 0.7f;
// hysteresisValue2 = getChargCurrent() * 7;
hysteresisValue1 = totalChargeCurr / 70.0f;
hysteresisValue2 = totalChargeCurr / 7.0f;
}
// else if (getChargCurrent() < 25) {
else if (totalChargeCurr < 1250) {
currMinFlag1 = 0;
currMinFlag = 0;
// hysteresisValue1 = getChargCurrent() * 0.5f;
// hysteresisValue2 = getChargCurrent() * 5;
hysteresisValue1 = totalChargeCurr / 100.0f;
hysteresisValue2 = totalChargeCurr / 10.0f;
}
else {
currMinFlag1 = 0;
currMinFlag = 0;
// hysteresisValue1 = getChargCurrent() * 0.3f;
// hysteresisValue2 = getChargCurrent() * 3;
hysteresisValue1 = totalChargeCurr / 150.0f;
hysteresisValue2 = totalChargeCurr / 16.0f;
}
// else {
// currMinFlag1 = 0;
// currMinFlag = 0;
// hysteresisValue1 = 120;
// hysteresisValue2 = 100;
// }
static uint8_t numFlag = 0;
// if ((lPower + 0.8f < Power) && (lLPower + 0.8f < Power) && (lLLPower + 0.8f < Power)) { // if ((lPower + 0.8f < Power) && (lLPower + 0.8f < Power) && (lLLPower + 0.8f < Power)) {
if ((lPower + 0.1f < Power) && (lLPower + 0.1f < Power)) { // if ((lPower + 0.1f < Power) && (lLPower + 0.1f < Power)) {
if ((lPower + hysteresisValue1 < Power) && (lLPower + hysteresisValue1 < Power)) {
numFlag = 0;
// if ((lPower + 0.3f < Power)) { // if ((lPower + 0.3f < Power)) {
if (powerT > 5) { if (powerT > hysteresisValue2) {
if (flag1) { if (flag1) {
SolarInCircuitV += stepV1; SolarInCircuitV += stepV1;
flag1 = 1; flag1 = 1;
@ -412,9 +503,10 @@ void mppt_readJust(void)
} }
} }
// } else if ((lPower - 0.8f > Power) && (lLPower - 0.8f > Power) && (lLLPower - 0.8f > Power)) { // } else if ((lPower - 0.8f > Power) && (lLPower - 0.8f > Power) && (lLLPower - 0.8f > Power)) {
} else if ((lPower - 0.1f > Power) && (lLPower - 0.1f > Power)) { } else if ((lPower - hysteresisValue1 > Power) && (lLPower - hysteresisValue1 > Power)) {
// } else if ((lPower - 0.3f > Power)) { // } else if ((lPower - 0.3f > Power)) {
if (powerT > 5) { if (powerT > hysteresisValue2) {
numFlag = 0;
if (flag1) { if (flag1) {
SolarInCircuitV -= stepV1; SolarInCircuitV -= stepV1;
flag1 = 0; flag1 = 0;
@ -431,11 +523,30 @@ void mppt_readJust(void)
flag1 = 1; flag1 = 1;
} }
} }
} else {
numFlag++;
} }
if (SolarInCircuitV > 20.0f) { /* 一段时间内都未调节 */
SolarInCircuitV = 20.0f; if (numFlag == 10) {
if (Power < 300) {
SolarInCircuitV = 17.0f;
}
else if (flag1) {
SolarInCircuitV -= stepV2;
flag1 = 0;
}
else {
SolarInCircuitV += stepV2;
flag1 = 1;
}
} }
if (SolarInCircuitV > 19.0f) {
SolarInCircuitV = 19.0f;
}
else if (SolarInCircuitV < 16.0f) { else if (SolarInCircuitV < 16.0f) {
SolarInCircuitV = 16.0f; SolarInCircuitV = 16.0f;
} }
@ -456,7 +567,8 @@ void endChargWork(void)
setChargControlFlag(FALSE); setChargControlFlag(FALSE);
setDutyRatioToZero(); setDutyRatioToZero();
setMPPT_Mode(noWork); setMPPT_Mode(noWork);
beginStartControlTask(); beginStartControlTask();
EN_PWMOUT_Diseable();
} }
/** /**
@ -470,6 +582,7 @@ void stopChargWork(void)
setChargControlFlag(FALSE); setChargControlFlag(FALSE);
setDutyRatioToZero(); setDutyRatioToZero();
setMPPT_Mode(noWork); setMPPT_Mode(noWork);
EN_PWMOUT_Diseable();
} }
/** /**
@ -481,6 +594,7 @@ void stopChargWork(void)
void beginChargWork(void) void beginChargWork(void)
{ {
beginStartControlTask(); beginStartControlTask();
EN_PWMOUT_Eable();
} }
/** /**
@ -492,6 +606,7 @@ void beginChargWork(void)
void startChargWork(void) void startChargWork(void)
{ {
beginSoftStartTask(); beginSoftStartTask();
EN_PWMOUT_Eable();
} }
@ -539,7 +654,7 @@ BOOL floatChargConditions(void)
BOOL mpptChargConditions(void) BOOL mpptChargConditions(void)
{ {
if (((g_cfgParameter.constantVoltageChargeV - 0.2f) > getBatteryVoltage()) if (((g_cfgParameter.constantVoltageChargeV - 0.2f) > getBatteryVoltage())
&& (getChargCurrent() > 0.1f)) { && (getChargCurrent() > 0.05f)) {
return TRUE; return TRUE;
} }
@ -666,7 +781,8 @@ void BatteryChargControl(void)
case MPPT: case MPPT:
mpptCharge(); mpptCharge();
// mppt_constantVoltage(17.0f); // mppt_constantVoltage(17.5f);
// setDutyRatio(0.1f);
break; break;
case constantVoltage: case constantVoltage:

View File

@ -658,6 +658,7 @@ void stateMachine(device_handle device)
#endif #endif
} }
/* 串口通信协议的初始化 */
void uartCommonInit(void) void uartCommonInit(void)
{ {
#ifdef HY_ChargeControlBox_PROTOCOL_ENABLE #ifdef HY_ChargeControlBox_PROTOCOL_ENABLE
@ -1446,6 +1447,9 @@ uint16_t SL_ReadRegisterYearMonth(void *pMsg)
{ {
timeInfo time; timeInfo time;
getRTC_Time(&time); getRTC_Time(&time);
// debug_printf("%d-%d\n", time.year, time.month);
return (time.year << 8) | time.month; return (time.year << 8) | time.month;
} }
@ -1458,6 +1462,9 @@ uint16_t SL_ReadRegisterDayHour(void *pMsg)
{ {
timeInfo time; timeInfo time;
getRTC_Time(&time); getRTC_Time(&time);
// debug_printf("%d-%d\n", time.day, time.hour);
return (time.day << 8) | time.hour; return (time.day << 8) | time.hour;
} }
@ -1470,6 +1477,9 @@ uint16_t SL_ReadRegisterMinuteSecond(void *pMsg)
{ {
timeInfo time; timeInfo time;
getRTC_Time(&time); getRTC_Time(&time);
// debug_printf("%d-%d\n", time.minute, time.second);
return (time.minute << 8) | time.second; return (time.minute << 8) | time.second;
} }
@ -1611,6 +1621,10 @@ uint16_t SL_WriteRegisterMinuteSecond(void *pMsg)
tempU8 = (uint8_t)(*(uint16_t*)pMsg); tempU8 = (uint8_t)(*(uint16_t*)pMsg);
writeTime.second = tempU8; writeTime.second = tempU8;
// debug_printf("%d-%d\n", writeTime.year, writeTime.month);
// debug_printf("%d-%d\n", writeTime.day, writeTime.hour);
// debug_printf("%d-%d\n", writeTime.minute, writeTime.second);
setRTC_Time(&writeTime); setRTC_Time(&writeTime);
return 0; return 0;

View File

@ -123,17 +123,17 @@ void cfgTest(void)
*/ */
void readFlashContent(config_info *configInfo) void readFlashContent(config_info *configInfo)
{ {
read_config_info(configInfo); read_config_info(configInfo);
/* 配置文件正确就返回 */ /* 配置文件正确就返回 */
// static volatile uint16_t tempCrc1, tempCrc2; // static volatile uint16_t tempCrc1, tempCrc2;
// tempCrc1 = configInfo->crc; // tempCrc1 = configInfo->crc;
// tempCrc2 = checkModebusCrc((uint8_t *)configInfo, CONFIG_INFO_SIZE - 2); // tempCrc2 = checkModebusCrc((uint8_t *)configInfo, CONFIG_INFO_SIZE - 2);
// if (tempCrc1 == tempCrc2) { // if (tempCrc1 == tempCrc2) {
// return; // return;
// } // }
if (configInfo->crc == checkModebusCrc((uint8_t *)configInfo, CONFIG_INFO_SIZE - 2)) { if (configInfo->crc == checkModebusCrc((uint8_t *)configInfo, CONFIG_INFO_SIZE - 2)) {
return; return;
} }
// /* 更深处的配置文件正确就返回 */ // /* 更深处的配置文件正确就返回 */
@ -277,26 +277,25 @@ void config_info_start(void)
g_cfgParameter.reverseChargProtectionCurr = temp_configInfo.reverseChargProtectionCurr; g_cfgParameter.reverseChargProtectionCurr = temp_configInfo.reverseChargProtectionCurr;
/* 读取的回路阻抗无效则回路阻抗设置为0 */ /* 读取的回路阻抗无效则回路阻抗设置为0 */
float fTemp; float fTemp;
// fTemp = 0.01f; // fTemp = 0.01f;
// saveLoopImpedance(&fTemp); // saveLoopImpedance(&fTemp);
readLoopImpedance(&fTemp); readLoopImpedance(&fTemp);
// setLoopImpedance(fTemp); // setLoopImpedance(fTemp);
// if (getLoopImpedance() < 0 || getLoopImpedance() > 0.3f) { // if (getLoopImpedance() < 0 || getLoopImpedance() > 0.3f) {
if (!setLoopImpedance(fTemp)) { if (!setLoopImpedance(fTemp)) {
setLoopImpedance(0.01f); setLoopImpedance(0);
fTemp = getLoopImpedance(); fTemp = getLoopImpedance();
saveLoopImpedance(&fTemp); saveLoopImpedance(&fTemp);
} }
readtotalElectricityConsumption(&fTemp); // readtotalElectricityConsumption(&fTemp);
totalElectricityConsumptionInt(fTemp); // totalElectricityConsumptionInt(fTemp);
readtotalChargCapacity(&fTemp); // readtotalChargCapacity(&fTemp);
totalChargCapacityInt(fTemp); // totalChargCapacityInt(fTemp);
// timeInfo time;
timeInfo time; // readTime(&time);
readTime(&time); // setLastTime(time);
setLastTime(time);
} }

View File

@ -59,8 +59,8 @@ float getDutyRatio(void)
*/ */
void setDutyRatio(float DutyRatio) void setDutyRatio(float DutyRatio)
{ {
if (DutyRatio > 0.95f) { if (DutyRatio > 0.9f) {
dutyRatio = 0.95f; dutyRatio = 0.9f;
} }
else if (DutyRatio < 0.05f) { else if (DutyRatio < 0.05f) {
dutyRatio = 0.05f; dutyRatio = 0.05f;

View File

@ -160,7 +160,7 @@ void task_Init(void)
TimeSliceOffset_Register(&m_uart, Task_uart, uart_reloadVal, uart_offset); TimeSliceOffset_Register(&m_uart, Task_uart, uart_reloadVal, uart_offset);
TimeSliceOffset_Register(&m_busFree, Task_busFree, busFree_reloadVal, busFree_offset); TimeSliceOffset_Register(&m_busFree, Task_busFree, busFree_reloadVal, busFree_offset);
TimeSliceOffset_Register(&m_SOE, Task_SOE, SOE_reloadVal, SOE_offset); TimeSliceOffset_Register(&m_SOE, Task_SOE, SOE_reloadVal, SOE_offset);
} }
/** /**
@ -268,14 +268,14 @@ void Task_wdi(void)
// static uint32_t temp = 60 * 30; // static uint32_t temp = 60 * 30;
if (!(--temp)) { if (!(--temp)) {
temp = 0; temp = 0;
float tempF; // float tempF;
tempF = getTotalElectricityConsumption(); // tempF = getTotalElectricityConsumption();
savetotalElectricityConsumption(&tempF); // savetotalElectricityConsumption(&tempF);
tempF = getTotalChargCapacity(); // tempF = getTotalChargCapacity();
savetotalChargCapacity(&tempF); // savetotalChargCapacity(&tempF);
timeInfo time; // timeInfo time;
time = getLastTime(); // time = getLastTime();
saveTime(&time); // saveTime(&time);
// NVIC_SystemReset(); // NVIC_SystemReset();
resetCheckImpedanceState(); resetCheckImpedanceState();
temp = 60 * 60 * 24; temp = 60 * 60 * 24;
@ -307,7 +307,7 @@ void Task_refreshJudgeData(void)
/* 有电池太阳能输出功率大电池电压低于14V同时回路阻抗未测试或需要重新测试 */ /* 有电池太阳能输出功率大电池电压低于14V同时回路阻抗未测试或需要重新测试 */
if ((getCheckImpedanceState() == FALSE || getLoopImpedance() == 0.0f) if ((getCheckImpedanceState() == FALSE || getLoopImpedance() == 0.0f)
&& (getBatteryState() == TRUE) && (getChargCurrent() > g_cfgParameter.maxChargCurr) && (getBatteryState() == TRUE) && (getChargCurrent() > g_cfgParameter.minCheckLoopImpedanceChargCurr)
&& (getOutputVoltage() > 9) && (getSolarInCircuitVoltage() > 14) && (getOutputVoltage() > 9) && (getSolarInCircuitVoltage() > 14)
&& (getBatteryVoltage() < 14)) { && (getBatteryVoltage() < 14)) {
TimeSliceOffset_Register(&m_impedanceCalculation, Task_impedanceCalculation TimeSliceOffset_Register(&m_impedanceCalculation, Task_impedanceCalculation
@ -378,7 +378,15 @@ void Task_startControl(void)
} }
/* 启动软起动任务 */ /* 启动软起动任务 */
TimeSliceOffset_Register(&m_softStart, Task_softStart, softStart_reloadVal, softStart_offset); // TimeSliceOffset_Register(&m_softStart, Task_softStart, softStart_reloadVal, softStart_offset);
if (getBatteryState() == TRUE) {
setMPPT_Mode(MPPT);
} else {
setMPPT_Mode(floatCharg);
}
setChargControlFlag(TRUE);
EN_PWMOUT_Eable();
} }
} }
/** /**
@ -387,7 +395,7 @@ void Task_startControl(void)
* @retval * @retval
*/ */
void beginStartControlTask(void) void beginStartControlTask(void)
{ {
TimeSliceOffset_Register(&m_startControl, Task_startControl, startControl_reloadVal, startControl_offset); TimeSliceOffset_Register(&m_startControl, Task_startControl, startControl_reloadVal, startControl_offset);
m_startControl.runFlag = 1; m_startControl.runFlag = 1;
} }
@ -409,7 +417,7 @@ void Task_softStart(void)
EN_PWMOUT_Eable(); EN_PWMOUT_Eable();
} }
else if (num > 70 || dutyRatio > 0.75f) { else if (num > 70 || dutyRatio > 0.6f) {
TimeSliceOffset_Unregister(&m_softStart); TimeSliceOffset_Unregister(&m_softStart);
m_softStart.runFlag = 0; m_softStart.runFlag = 0;
@ -423,7 +431,7 @@ void Task_softStart(void)
setMPPT_Mode(floatCharg); setMPPT_Mode(floatCharg);
} }
setChargControlFlag(TRUE); setChargControlFlag(TRUE);
} }
else { else {
setDutyRatio(getDutyRatio() + 0.01f); setDutyRatio(getDutyRatio() + 0.01f);

View File

@ -182,24 +182,25 @@ BOOL readOnlyPowerOutputState(void)
{ {
// static volatile GPIO_PinState gpioTemp1, gpioTemp2, gpioTemp3; // static volatile GPIO_PinState gpioTemp1, gpioTemp2, gpioTemp3;
// GPIO_PinState gpioTemp1, gpioTemp2, gpioTemp3; // GPIO_PinState gpioTemp1, gpioTemp2, gpioTemp3;
GPIO_PinState gpioTemp1, gpioTemp2; // GPIO_PinState gpioTemp1, gpioTemp2;
gpioTemp1 = HAL_GPIO_ReadPin(POW_FF_CON_GPIO_Port, POW_FF_CON_Pin); // 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); // gpioTemp2 = HAL_GPIO_ReadPin(POW_OUT_CON_GPIO_Port, POW_OUT_CON_Pin);
// gpioTemp3 = HAL_GPIO_ReadPin(DSG_PROT_GPIO_Port, DSG_PROT_Pin); // gpioTemp3 = HAL_GPIO_ReadPin(DSG_PROT_GPIO_Port, DSG_PROT_Pin);
if (gpioTemp1 == GPIO_PIN_SET // if (gpioTemp1 == GPIO_PIN_SET
&& gpioTemp2 == GPIO_PIN_SET // && gpioTemp2 == GPIO_PIN_SET
// && gpioTemp3 == GPIO_PIN_SET) { // // && gpioTemp3 == GPIO_PIN_SET) {
) { // ) {
return TRUE; // return TRUE;
} // }
// if (HAL_GPIO_ReadPin(POW_FF_CON_GPIO_Port, POW_FF_CON_Pin) if (!HAL_GPIO_ReadPin(POW_FF_CON_GPIO_Port, POW_FF_CON_Pin)
// && HAL_GPIO_ReadPin(POW_OUT_CON_GPIO_Port, POW_OUT_CON_Pin) && HAL_GPIO_ReadPin(POW_OUT_CON_GPIO_Port, POW_OUT_CON_Pin)
// && HAL_GPIO_ReadPin(DSG_PROT_GPIO_Port, DSG_PROT_Pin)) { && !HAL_GPIO_ReadPin(DSG_PROT_GPIO_Port, DSG_PROT_Pin)
// return TRUE; && !HAL_GPIO_ReadPin(EXCHG_CURR_GPIO_Port, EXCHG_CURR_Pin)) {
// } return TRUE;
}
return FALSE; return FALSE;
} }

View File

@ -104,6 +104,7 @@ void MX_GPIO_Init(void)
HAL_NVIC_SetPriority(EXTI15_10_IRQn, 0, 0); HAL_NVIC_SetPriority(EXTI15_10_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(EXTI15_10_IRQn); HAL_NVIC_EnableIRQ(EXTI15_10_IRQn);
} }
/* USER CODE BEGIN 2 */ /* USER CODE BEGIN 2 */

View File

@ -47,7 +47,7 @@ void MX_TIM3_Init(void)
htim3.Instance = TIM3; htim3.Instance = TIM3;
htim3.Init.Prescaler = 0; htim3.Init.Prescaler = 0;
htim3.Init.CounterMode = TIM_COUNTERMODE_UP; htim3.Init.CounterMode = TIM_COUNTERMODE_UP;
htim3.Init.Period = 720; htim3.Init.Period = 719;
htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; htim3.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; htim3.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
if (HAL_TIM_PWM_Init(&htim3) != HAL_OK) if (HAL_TIM_PWM_Init(&htim3) != HAL_OK)

View File

@ -413,7 +413,7 @@ TIM16.PeriodNoDither=999
TIM16.Prescaler=71 TIM16.Prescaler=71
TIM3.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4 TIM3.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4
TIM3.IPParameters=PeriodNoDither,Channel-PWM Generation4 CH4 TIM3.IPParameters=PeriodNoDither,Channel-PWM Generation4 CH4
TIM3.PeriodNoDither=720 TIM3.PeriodNoDither=719
TIM6.IPParameters=Prescaler,PeriodNoDither,TIM_MasterOutputTrigger TIM6.IPParameters=Prescaler,PeriodNoDither,TIM_MasterOutputTrigger
TIM6.PeriodNoDither=9 TIM6.PeriodNoDither=9
TIM6.Prescaler=71 TIM6.Prescaler=71