testing calc enable

This commit is contained in:
Janosch
2022-10-14 13:08:23 +01:00
parent b45c29f89e
commit 100821e68c
7 changed files with 90 additions and 30 deletions
-30
View File
@@ -211,36 +211,6 @@ static void ChargerStateMachine()
Param::SetInt(Param::state, state);
}
static void CalcEnable()
{
static int recheckCan = 10;
bool enablePol = Param::GetBool(Param::enablepol);
bool enable = DigIo::enable_in.Get() ^ enablePol;
enable &= !Param::GetBool(Param::cancontrol) || Param::GetBool(Param::canenable);
if (Param::GetBool(Param::cancontrol))
{
if (recheckCan == 0)
{
if (Param::GetInt(Param::canenable) == 3)
{
Param::SetInt(Param::canenable, 0);
ErrorMessage::Post(ERR_EXTCAN);
}
else
{
Param::SetInt(Param::canenable, 3); //Must be overwritten by CAN message within the next second
}
recheckCan = 10;
}
recheckCan--;
}
Param::SetInt(Param::enable, enable);
}
//sample 100ms task
static void Ms100Task(void)
{