Update firmware version to 1.0.10, add hv_tick parameter to PSU control, enhance serial control with response handling, and improve stop button control logic.
This commit is contained in:
+11
-1
@@ -149,6 +149,7 @@ void PSU_Init(){
|
||||
|
||||
PSU0.power_limit = PSU_MAX_POWER; // kW
|
||||
PSU0.hv_mode = 0;
|
||||
PSU0.hv_tick = 0;
|
||||
|
||||
PSU_Enable(0, 0);
|
||||
}
|
||||
@@ -265,7 +266,15 @@ void PSU_ReadWrite(){
|
||||
if(PSU0.ready){
|
||||
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
|
||||
@@ -339,6 +348,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