forked from achamaikin/CCSModuleSW30Web
Enhance board and PSU control structures; update connector state handling and stop button logic. Adjust LED color cycles for better visual feedback. Refactor serial communication to improve state management and error handling.
This commit is contained in:
+11
-1
@@ -150,6 +150,7 @@ void PSU_Init(){
|
||||
|
||||
PSU0.power_limit = PSU_MAX_POWER; // kW
|
||||
PSU0.hv_mode = 0;
|
||||
PSU0.hv_tick = 0;
|
||||
|
||||
PSU_Enable(0, 0);
|
||||
}
|
||||
@@ -269,7 +270,15 @@ void PSU_ReadWrite(){
|
||||
PSU_SetVoltageCurrent(0, CONN.RequestedVoltage, CONN.RequestedCurrent); // Normal mode
|
||||
}
|
||||
ED_Delay(CAN_DELAY);
|
||||
if(CONN.MeasuredVoltage>490) PSU0.hv_mode = 1;
|
||||
if(CONN.MeasuredVoltage > 490){
|
||||
if(PSU0.hv_tick == 0){
|
||||
PSU0.hv_tick = HAL_GetTick();
|
||||
}else if((HAL_GetTick() - PSU0.hv_tick) >= 10000){
|
||||
PSU0.hv_mode = 1;
|
||||
}
|
||||
}else{
|
||||
PSU0.hv_tick = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// PSU_SetHVMode(0, PSU0.hv_mode); // auto set, no need
|
||||
@@ -343,6 +352,7 @@ void PSU_Task(void){
|
||||
case PSU_READY:
|
||||
// модуль готов, но выключен
|
||||
PSU0.hv_mode = 0;
|
||||
PSU0.hv_tick = 0;
|
||||
|
||||
RELAY_Write(RELAY_DC, 0);
|
||||
if(!PSU0.ready){
|
||||
|
||||
Reference in New Issue
Block a user