Skip to content

Commit

Permalink
Merge pull request #123 from Tom-evnut/Update-Shutdown-Delay
Browse files Browse the repository at this point in the history
fix shutdown logic
  • Loading branch information
damienmaguire authored Nov 12, 2024
2 parents 3355e90 + 3c7568d commit 643c4a5
Showing 1 changed file with 13 additions and 6 deletions.
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

0 comments on commit 643c4a5

Please sign in to comment.