Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix shutdown logic #123

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions src/stm32_vcu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ days=0,
hours=0, minutes=0, seconds=0,
alarm=0; // != 0 when alarm is pending

static uint8_t rlyDly=25;
static uint16_t rlyDly=25;

// Instantiate Classes
static BMW_E31 e31Vehicle;
Expand Down Expand Up @@ -609,18 +609,19 @@ static void Ms10Task(void)
{
StartSig=true;
opmode = MOD_PRECHARGE;//proceed to precharge if 1)throttle not pressed , 2)ign on , 3)start signal rx
rlyDly=25;//Recharge sequence timer
vehicleStartTime = rtc_get_counter_val();
initbyStart=true;
}
}
if(chargeMode)
{
opmode = MOD_PRECHARGE;//proceed to precharge if charge requested.
rlyDly=25;//Recharge sequence timer
vehicleStartTime = rtc_get_counter_val();
initbyCharge=true;
}
Param::SetInt(Param::opmode, opmode);
rlyDly=25;//Recharge sequence timer
break;

case MOD_PRECHARGE:
Expand Down Expand Up @@ -677,10 +678,13 @@ static void Ms10Task(void)
if(rlyDly==0)
{
DigIo::dcsw_out.Set();
rlyDly=25;//Recharge sequence timer
}
ErrorMessage::UnpostAll();
if(!chargeMode) opmode = MOD_OFF;
if(!chargeMode)
{
opmode = MOD_OFF;
rlyDly=250;//Recharge sequence timer for delayed shutdown
}
Param::SetInt(Param::opmode, opmode);
break;

Expand All @@ -690,11 +694,14 @@ static void Ms10Task(void)
{
DigIo::dcsw_out.Set();
DigIo::inv_out.Set();//inverter power on
rlyDly=25;//Recharge sequence timer
}
Param::SetInt(Param::opmode, MOD_RUN);
ErrorMessage::UnpostAll();
if(!selectedVehicle->Ready()) opmode = MOD_OFF;
if(!selectedVehicle->Ready())
{
opmode = MOD_OFF;
rlyDly=250;//Recharge sequence timer for delayed shutdown
}
Param::SetInt(Param::opmode, opmode);
break;
}
Expand Down