Fixed several issues:

- ADC has now averaging
- Pause screen added
- Fixed display glitches for most parts

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@258 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-10-19 15:24:24 +00:00
parent 51ffde94d7
commit 92bd68d8ba
18 changed files with 257 additions and 99 deletions

View File

@@ -30,8 +30,10 @@
#include "hsb-mrts.h"
#include "Display.h"
#include "Error.h"
#include "platform.h"
#include "Interlock.h"
#include "Logger.h"
#include "PCBA.h"
#include "Version.h"
@@ -104,3 +106,81 @@ ErrorStatus hsb_solenoidUnlock (void)
{
return GPIO_setValue(solenoid, true);
}
ErrorStatus hsb_enableSafety(void)
{
ErrorStatus returnValue = SUCCESS;
// First, Lock the cover
if (returnValue == SUCCESS)
{
hsb_solenoidLock();
}
if (returnValue == SUCCESS)
{
// Check for INTERLOCK CLOSE
if (Interlock_isClosed(interlock))
{
// Enable Interrupt for interlock switch
Interlock_setEXTI(interlock, ENABLE);
}
else
{
Error_postError(INTERLOCK_COMMON_FAIL);
returnValue = ERROR;
}
}
if (returnValue == SUCCESS)
{
// TESLA has a second interlock that must be closed
if (PCBA_getInstance()->pcba == Tesla)
{
if (Interlock_isClosed(teslalock))
{
// Enable Interrupt for tesla interlock switch
Interlock_setEXTI(teslalock, ENABLE);
}
else
{
Error_postError(INTERLOCK_TESLA_FAIL);
returnValue = ERROR;
}
}
}
// if Interlock(s) closed, continue procedure
if (returnValue == SUCCESS)
{
// Power the circuit
if (GPIO_setValue(power6v5Enable, false) != SUCCESS)
{
Error_postError(POWERENABLE_FAIL);
returnValue = ERROR;
}
}
return returnValue;
}
ErrorStatus hsb_disableSafety(void)
{
ErrorStatus returnValue = SUCCESS;
// Power the circuit
if (GPIO_setValue(power6v5Enable, true) != SUCCESS)
{
Error_postError(POWERENABLE_FAIL);
returnValue = ERROR;
}
Interlock_setEXTI(interlock, DISABLE);
// TESLA has a second interlock that must be closed
if (PCBA_getInstance()->pcba == Tesla)
{
Interlock_setEXTI(teslalock, DISABLE);
}
return returnValue;
}