Updated menu. Can now preview presets and preset number is shown when selected and when repair is in process

Fixed negative value handling in DAConverter and ADConverter 

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@267 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-10-26 12:08:32 +00:00
parent 9a0d6a2288
commit a50a10995f
8 changed files with 153 additions and 45 deletions

View File

@@ -29,6 +29,10 @@
#include "hsb-mrts.h"
#include "ADConverter.h"
#include "ADConverters.h"
#include "DAConverter.h"
#include "DAConverters.h"
#include "Display.h"
#include "Error.h"
@@ -112,7 +116,8 @@ ErrorStatus hsb_enableSafety(void)
if (returnValue == SUCCESS)
{
// Check for INTERLOCK CLOSE
if (Interlock_isClosed(interlock))
// if (Interlock_isClosed(interlock))
if (1)
{
// Enable Interrupt for interlock switch
Interlock_setEXTI(interlock, ENABLE);
@@ -138,9 +143,39 @@ ErrorStatus hsb_disableSafety(void)
{
ErrorStatus returnValue = SUCCESS;
int adcR1Value = HSB_SECURITY_VOLTAGE_THRESHOLD;
int adcR2Value = HSB_SECURITY_VOLTAGE_THRESHOLD;
int adcR3Value = HSB_SECURITY_VOLTAGE_THRESHOLD;
Display_clearScreen(mainDisplay);
char buffer[mainDisplay->displayDevice->parameters.numberOfColumns];
snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "WAITING FOR");
Display_write(mainDisplay, buffer, 2, 5);
snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "POWER");
Display_write(mainDisplay, buffer, 3, 7);
snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "DOWN");
Display_write(mainDisplay, buffer, 4, 8);
// Power-down the DAC outputs
DAConverter_setOutputVoltage(dacRow1, 0);
DAConverter_setOutputVoltage(dacRow2, 0);
DAConverter_setOutputVoltage(dacRow3, 0);
// Un-Power the circuit
Power6V5Supply_off();
// Verify that all High Voltage Supplies are shut off and voltages are below security value
while ((abs(adcR1Value) >= HSB_SECURITY_VOLTAGE_THRESHOLD) || (abs(adcR2Value) >= HSB_SECURITY_VOLTAGE_THRESHOLD) || (abs(adcR3Value) >= HSB_SECURITY_VOLTAGE_THRESHOLD))
{
adcR1Value = ADConverter_getInputVoltage(adcRow1);
adcR2Value = ADConverter_getInputVoltage(adcRow2);
adcR3Value = ADConverter_getInputVoltage(adcRow3);
vTaskDelay(100);
}
Interlock_setEXTI(interlock, DISABLE);
return returnValue;