Replaced verification of voltageFree rows with HighVoltageDetection module
Added LED module git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@338 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -29,6 +29,7 @@ CoverSolenoid.o \
|
||||
crc32.o \
|
||||
DACDevice.o \
|
||||
DisplayDevice.o \
|
||||
HighVoltageDetection.o \
|
||||
hsb-mrts.o \
|
||||
Interlock.o \
|
||||
IODevice.o \
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file HighVoltageDetection.h
|
||||
/// @brief File description
|
||||
// -----------------------------------------------------------------------------
|
||||
// Micro-Key bv
|
||||
// Industrieweg 28, 9804 TG Noordhorn
|
||||
// Postbus 92, 9800 AB Zuidhorn
|
||||
// The Netherlands
|
||||
// Tel: +31 594 503020
|
||||
// Fax: +31 594 505825
|
||||
// Email: support@microkey.nl
|
||||
// Web: www.microkey.nl
|
||||
// -----------------------------------------------------------------------------
|
||||
/// $Revision$
|
||||
/// $Author$
|
||||
/// $Date$
|
||||
// (c) 2015 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// @defgroup {group_name} {group_description}
|
||||
/// Description
|
||||
|
||||
/// @file HighVoltageDetection.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
#ifndef INC_HIGHVOLTAGEDETECTION_H_
|
||||
#define INC_HIGHVOLTAGEDETECTION_H_
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "stm32f10x.h"
|
||||
|
||||
#include "gpio.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* HighVoltageDetection_construct
|
||||
* Constructs a HighVoltage detection
|
||||
*
|
||||
* @param HV0_gpio
|
||||
* @param HV1_gpio
|
||||
* @param HV2_gpio
|
||||
*
|
||||
* @return ErrorStatus SUCCESS if construction was successful
|
||||
* ERROR otherwise
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus HighVoltageDetection_construct(struct Gpio* HV0_gpio, struct Gpio* HV1_gpio, struct Gpio* HV2_gpio);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* HighVoltageDetection_destruct
|
||||
* Destructor for High Voltage detection
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void HighVoltageDetection_destruct(void);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* HighVoltageDetection_isVoltagePresent
|
||||
* Determines whether or not a High Voltage is present on the given inputs
|
||||
*
|
||||
* @return bool TRUE if at least one of the given inputs
|
||||
* has HIGH voltage present
|
||||
* FALSE otherwise
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern bool HighVoltageDetection_isVoltagePresent(void);
|
||||
|
||||
#endif /* INC_HIGHVOLTAGEDETECTION_H_ */
|
||||
@@ -33,6 +33,10 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "stm32f10x.h"
|
||||
|
||||
#include "gpio.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -61,12 +65,17 @@ typedef enum
|
||||
* Led_construct
|
||||
* Constructor for LEDs
|
||||
*
|
||||
* @param onboardGreen
|
||||
* @param onboardOrange
|
||||
* @param bicolourGreen
|
||||
* @param bicolourRed
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void Led_construct(void);
|
||||
extern ErrorStatus Led_construct(struct Gpio* onboardGreen, struct Gpio* onboardOrange, struct Gpio* bicolourGreen, struct Gpio* bicolourRed);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file HighVoltageDetection.c
|
||||
/// @brief Description
|
||||
// -----------------------------------------------------------------------------
|
||||
// Micro-Key bv
|
||||
// Industrieweg 28, 9804 TG Noordhorn
|
||||
// Postbus 92, 9800 AB Zuidhorn
|
||||
// The Netherlands
|
||||
// Tel: +31 594 503020
|
||||
// Fax: +31 594 505825
|
||||
// Email: support@microkey.nl
|
||||
// Web: www.microkey.nl
|
||||
// -----------------------------------------------------------------------------
|
||||
/// $Revision$
|
||||
/// $Author$
|
||||
/// $Date$
|
||||
// (c) 2017 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// @file HighVoltageDetection.c
|
||||
/// @ingroup {group_name}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "HighVoltageDetection.h"
|
||||
#include "IODevice.h"
|
||||
|
||||
#include "PCBA.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
struct HighVoltageDetection
|
||||
{
|
||||
struct IODevice* hv0;
|
||||
struct IODevice* hv1;
|
||||
struct IODevice* hv2;
|
||||
bool initialized;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// File-scope variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static struct HighVoltageDetection _hvDetection = {.initialized = false};
|
||||
struct HighVoltageDetection* const hvDetection = &_hvDetection;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
ErrorStatus HighVoltageDetection_construct(struct Gpio* HV0_gpio, struct Gpio* HV1_gpio, struct Gpio* HV2_gpio)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (!hvDetection->initialized)
|
||||
{
|
||||
hvDetection->hv0 = &HV0_gpio->device;
|
||||
hvDetection->hv1 = &HV1_gpio->device;
|
||||
hvDetection->hv2 = &HV2_gpio->device;
|
||||
hvDetection->initialized = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern void HighVoltageDetection_destruct(void)
|
||||
{
|
||||
hvDetection->initialized = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool HighVoltageDetection_isVoltagePresent(void)
|
||||
{
|
||||
bool returnValue = false;
|
||||
|
||||
if (hvDetection->initialized)
|
||||
{
|
||||
char value0;
|
||||
char value1;
|
||||
char value2;
|
||||
|
||||
IODevice_read(hvDetection->hv0, &value0, 1, NULL);
|
||||
IODevice_read(hvDetection->hv1, &value1, 1, NULL);
|
||||
IODevice_read(hvDetection->hv2, &value2, 1, NULL);
|
||||
|
||||
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
||||
{
|
||||
// For TESLA repair, only ROW2 (HV1) is used
|
||||
if (value1 != (char)false)
|
||||
{
|
||||
// At least on voltage is present, so returnValue must be TRUE
|
||||
returnValue = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// For CathodeMCP or Anode, all three rows are used
|
||||
if ((value0 != (char)false) || (value1 != (char)false) || (value2 != (char)false))
|
||||
{
|
||||
// At least on voltage is present, so returnValue must be TRUE
|
||||
returnValue = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
@@ -71,24 +71,30 @@ static struct Leds self = { .initialized = false };
|
||||
// Function definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void Led_construct(void)
|
||||
ErrorStatus Led_construct(struct Gpio* onboardGreen, struct Gpio* onboardOrange, struct Gpio* bicolourGreen, struct Gpio* bicolourRed)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
if (!self.initialized)
|
||||
{
|
||||
self.initialized = true;
|
||||
|
||||
self.leds[LED_ONBOARD_GREEN].ioDevice = &ledInternGreen->device;
|
||||
self.leds[LED_ONBOARD_GREEN].ioDevice = &onboardGreen->device;
|
||||
self.leds[LED_ONBOARD_GREEN].initialized = true;
|
||||
|
||||
self.leds[LED_ONBOARD_ORANGE].ioDevice = &ledInternOrange->device;
|
||||
self.leds[LED_ONBOARD_ORANGE].ioDevice = &onboardOrange->device;
|
||||
self.leds[LED_ONBOARD_ORANGE].initialized = true;
|
||||
|
||||
self.leds[LED_BICOLOR_GREEN].ioDevice = &ledBicolourGreen->device;
|
||||
self.leds[LED_BICOLOR_GREEN].ioDevice = &bicolourGreen->device;
|
||||
self.leds[LED_BICOLOR_GREEN].initialized = true;
|
||||
|
||||
self.leds[LED_BICOLOR_RED].ioDevice = &ledBicolourRed->device;
|
||||
self.leds[LED_BICOLOR_RED].ioDevice = &bicolourRed->device;
|
||||
self.leds[LED_BICOLOR_RED].initialized = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,6 +151,20 @@ extern bool Led_getStatus(Led led)
|
||||
if (self.initialized)
|
||||
{
|
||||
if (self.leds[led].initialized)
|
||||
{
|
||||
// IN case of the BICOLOUR ORANGE LED, actually the GREEN and RED LEDs must be read
|
||||
if (led == LED_BICOLOR_ORANGE)
|
||||
{
|
||||
char valueRed;
|
||||
char valueGreen;
|
||||
IODevice_read(self.leds[LED_BICOLOR_RED].ioDevice, &valueRed, 1, NULL);
|
||||
IODevice_read(self.leds[LED_BICOLOR_GREEN].ioDevice, &valueGreen, 1, NULL);
|
||||
if ((valueRed != (char)false) && (valueGreen != (char)false))
|
||||
{
|
||||
returnValue = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char value;
|
||||
IODevice_read(self.leds[led].ioDevice, &value, 1, NULL);
|
||||
@@ -154,5 +174,6 @@ extern bool Led_getStatus(Led led)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -82,10 +82,7 @@ extern struct Storm700* const storm700;
|
||||
// internal FLASH
|
||||
extern struct InternalFlash* const iFlash;
|
||||
// Export of GPIOs
|
||||
extern struct Gpio* const ledInternGreen;
|
||||
extern struct Gpio* const ledInternOrange;
|
||||
extern struct Gpio* const ledBicolourGreen;
|
||||
extern struct Gpio* const ledBicolourRed;
|
||||
|
||||
|
||||
extern struct Interlock* const interlock;
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include "stm32f10x_rcc.h"
|
||||
#include "stm32f10x_it.h"
|
||||
|
||||
#include "HighVoltageDetection.h"
|
||||
#include "Leds.h"
|
||||
#include "Logger.h"
|
||||
|
||||
#include "platform.h"
|
||||
@@ -194,7 +196,16 @@ struct Gpio* const ledInternGreen = &_ledInternGreen;
|
||||
struct Gpio* const ledInternOrange = &_ledInternOrange;
|
||||
struct Gpio* const ledBicolourGreen = &_ledBicolourGreen;
|
||||
struct Gpio* const ledBicolourRed = &_ledBicolourRed;
|
||||
struct Gpio* const solenoid = &_solenoid;
|
||||
struct Gpio* const buzzer = &_buzzer;
|
||||
struct Gpio* const mcp0Relay = &_mcp0Relay;
|
||||
struct Gpio* const mcp1Relay = &_mcp1Relay;
|
||||
struct Gpio* const mcp2Relay = &_mcp2Relay;
|
||||
struct Gpio* const cat0Relay = &_cat0Relay;
|
||||
struct Gpio* const cat1Relay = &_cat1Relay;
|
||||
struct Gpio* const cat2Relay = &_cat2Relay;
|
||||
struct Gpio* const teslaRelay = &_teslaRelay;
|
||||
|
||||
struct Gpio* const hv0Present = &_hv0Present;
|
||||
struct Gpio* const hv1Present = &_hv1Present;
|
||||
struct Gpio* const hv2Present = &_hv2Present;
|
||||
@@ -622,10 +633,14 @@ static ErrorStatus initPeriphery(void)
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* GPIOs */
|
||||
/* --------------------------------------------------------------------*/
|
||||
// Green LED
|
||||
// Green onboard LED
|
||||
GPIO_construct(ledInternGreen, OUTPUT, ledInternGreen->gpio);
|
||||
// Orange LED
|
||||
// Orange onboard LED
|
||||
GPIO_construct(ledInternOrange, OUTPUT, ledInternOrange->gpio);
|
||||
// Bicolour green
|
||||
GPIO_construct(ledBicolourGreen, OUTPUT, ledBicolourGreen->gpio);
|
||||
// Bicolour red
|
||||
GPIO_construct(ledBicolourRed, OUTPUT, ledBicolourRed->gpio);
|
||||
|
||||
IRQ_setInterruptProperties(EXTI0_IRQn, 12, 0, ENABLE);
|
||||
IRQ_setInterruptProperties(EXTI1_IRQn, 12, 0, ENABLE);
|
||||
@@ -637,27 +652,32 @@ static ErrorStatus initPeriphery(void)
|
||||
GPIO_construct(&_interlockNC, INPUT, _interlockNC.gpio);
|
||||
|
||||
// Solenoid
|
||||
GPIO_construct(&_solenoid, OUTPUT, _solenoid.gpio);
|
||||
GPIO_construct(solenoid, OUTPUT, solenoid->gpio);
|
||||
|
||||
// HV detection
|
||||
GPIO_construct(hv0Present, INPUT, hv0Present->gpio);
|
||||
GPIO_construct(hv1Present, INPUT, hv1Present->gpio);
|
||||
GPIO_construct(hv2Present, INPUT, hv2Present->gpio);
|
||||
|
||||
|
||||
if (PCBA_getInstance()->pcba == PCBA_CathodeMCP)
|
||||
{
|
||||
// MCP0Relay
|
||||
GPIO_construct(&_mcp0Relay, OUTPUT, _mcp0Relay.gpio);
|
||||
GPIO_construct(mcp0Relay, OUTPUT, mcp0Relay->gpio);
|
||||
// MCP1Relay
|
||||
GPIO_construct(&_mcp1Relay, OUTPUT, _mcp1Relay.gpio);
|
||||
GPIO_construct(mcp1Relay, OUTPUT, mcp1Relay->gpio);
|
||||
// MCP2Relay
|
||||
GPIO_construct(&_mcp2Relay, OUTPUT, _mcp2Relay.gpio);
|
||||
GPIO_construct(mcp2Relay, OUTPUT, mcp2Relay->gpio);
|
||||
// CAT0Relay
|
||||
GPIO_construct(&_cat0Relay, OUTPUT, _cat0Relay.gpio);
|
||||
GPIO_construct(cat0Relay, OUTPUT, cat0Relay->gpio);
|
||||
// CAT1Relay
|
||||
GPIO_construct(&_cat1Relay, OUTPUT, _cat1Relay.gpio);
|
||||
GPIO_construct(cat1Relay, OUTPUT, cat1Relay->gpio);
|
||||
// CAT2Relay
|
||||
GPIO_construct(&_cat2Relay, OUTPUT, _cat2Relay.gpio);
|
||||
GPIO_construct(cat2Relay, OUTPUT, cat2Relay->gpio);
|
||||
}
|
||||
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
||||
{
|
||||
GPIO_construct(&_teslaRelay, OUTPUT, _teslaRelay.gpio);
|
||||
GPIO_construct(teslaRelay, OUTPUT, teslaRelay->gpio);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
@@ -668,63 +688,96 @@ static ErrorStatus initPlatformDevices (void)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* LEDs */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
CathodeMCP_setIO(&_mcp0Relay, &_mcp1Relay, &_mcp2Relay, &_cat0Relay, &_cat1Relay, &_cat2Relay);
|
||||
// Construct the LEDs
|
||||
returnValue = Led_construct(ledInternGreen, ledInternOrange, ledBicolourGreen, ledBicolourRed);
|
||||
}
|
||||
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
Interlock_construct(interlock, COMMON_INTERLOCK, &_interlockNO, _interlockNOEXTI, &_interlockNC, _interlockNCEXTI, INTERLOCK_DEBOUNCE_TIME_MS);
|
||||
returnValue = HighVoltageDetection_construct(hv0Present, hv1Present, hv2Present);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* CathodeMCP switches */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
CoverSolenoid_construct(&_solenoid);
|
||||
if (PCBA_getInstance()->pcba == PCBA_CathodeMCP)
|
||||
{
|
||||
returnValue = CathodeMCP_setIO(mcp0Relay, mcp1Relay, mcp2Relay, cat0Relay, cat1Relay, cat2Relay);
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* Interlock */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
TeslaGunSafety_construct(&_teslaRelay);
|
||||
returnValue = Interlock_construct(interlock, COMMON_INTERLOCK, &_interlockNO, _interlockNOEXTI, &_interlockNC, _interlockNCEXTI, INTERLOCK_DEBOUNCE_TIME_MS);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* Solenoids */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
returnValue = CoverSolenoid_construct(solenoid);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* TeslaGun Safety */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
||||
{
|
||||
returnValue = TeslaGunSafety_construct(teslaRelay);
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* LOGGER */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
returnValue = Logger_construct(mainLog, &uart1->device, 1, 512);
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* KEYPAD MATRIX */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
returnValue = Keypad_construct(keypad, STORM700_NUMBER_OF_ROWS, STORM700_NUMBER_OF_COLUMNS, KEYPAD_DEBOUNCE_TIME_MS, KEYPAD_TASK_PRIORITY, KEYPAD_STACK_SIZE, KEYPAD_DEF_QUEUESIZE);
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* STORM700 Keypad */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
returnValue = Storm700_construct(storm700, &keypad->device);
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* NewHavenDispplay 04 20 */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
returnValue = NHD0420_construct(nhd0420, &spiDisplay->device);
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
/* --------------------------------------------------------------------*/
|
||||
/* MAX5715 external Quad DAC */
|
||||
/* --------------------------------------------------------------------*/
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
// Construct MAX5715
|
||||
returnValue = MAX5715_construct(max5715, &spiDAC->device);
|
||||
// Set external DAC reference to 2V5, always ON
|
||||
|
||||
@@ -61,6 +61,8 @@ typedef enum
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
///TODO TEMPORARY
|
||||
extern TaskHandle_t errorTaskHandle;
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* Error_construct
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
extern struct RepairMenu* const mainMenu;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#define MAINDISP_REFRESH_FEED_MS (1000)
|
||||
#define MAINDISP_REFRESH_PERIOD (5000)
|
||||
|
||||
#define MAINDISP_DEFAULT_BRIGHTNESS (8) // Set to MAX to avoid background light issue
|
||||
#define MAINDISP_DEFAULT_BRIGHTNESS (5) // Set to MAX to avoid background light issue
|
||||
#define MAINDISP_DEFAULT_CONTRAST (40)
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions
|
||||
|
||||
@@ -51,7 +51,8 @@ struct ErrorQueueItem
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static struct Observable observable;
|
||||
static TaskHandle_t errorTaskHandle;
|
||||
///TODO TEMPORARY NOT STATIC
|
||||
TaskHandle_t errorTaskHandle;
|
||||
static QueueHandle_t errorQueue;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -132,10 +132,29 @@ static ErrorStatus PIN_verifyInsertedPins(struct PIN* self)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
if (strlen(self->pinchangeFirstInsert) != PIN_NUMBER_OF_DIGITS)
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
if (strlen(self->pinchangeSecondInsert) != PIN_NUMBER_OF_DIGITS)
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
if(strncmp(self->pinchangeFirstInsert, self->pinchangeSecondInsert, PIN_NUMBER_OF_DIGITS) != 0)
|
||||
{
|
||||
// Inserted PINs are not equal
|
||||
returnValue = ERROR;
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
#include "platform.h"
|
||||
#include "CoverSolenoid.h"
|
||||
#include "HighVoltageDetection.h"
|
||||
#include "Interlock.h"
|
||||
#include "Logger.h"
|
||||
#include "PCBA.h"
|
||||
@@ -225,26 +226,11 @@ ErrorStatus hsb_disableSafety(void)
|
||||
DAConverter_setOutputVoltage(dacRow3, 0);
|
||||
|
||||
|
||||
if (PCBA_getInstance()->pcba != PCBA_Tesla)
|
||||
while (HighVoltageDetection_isVoltagePresent())
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Verify that all High Voltage Supplies are shut off and voltages are below security value
|
||||
while (abs(adcR2Value) >= HSB_SECURITY_VOLTAGE_THRESHOLD)
|
||||
{
|
||||
adcR2Value = ADConverter_getInputVoltage(adcRow2);
|
||||
vTaskDelay(100);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Display_clearLine(mainDisplay, 3);
|
||||
Display_clearLine(mainDisplay, 4);
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "Error.h"
|
||||
#include "hsb-mrts.h"
|
||||
#include "hwValidationMenu.h"
|
||||
#include "repairMenu.h"
|
||||
#include "repairMenus.h"
|
||||
#include "Warning.h"
|
||||
|
||||
@@ -163,6 +164,19 @@ static ErrorStatus systeminfoCommandHandler(void)
|
||||
snprintf(text, sizeof(text), "Free heap memory: %d bytes", (int)freeMemory);
|
||||
LOGGER_INFO(mainLog, text);
|
||||
|
||||
vTaskDelay(10);
|
||||
OS_logTaskInfo(initTaskHandle);
|
||||
vTaskDelay(10);
|
||||
OS_logTaskInfo(ledTaskHandle);
|
||||
vTaskDelay(10);
|
||||
OS_logTaskInfo(sysTaskHandle);
|
||||
vTaskDelay(10);
|
||||
OS_logTaskInfo(mainMenu->menuCore->taskHandle);
|
||||
vTaskDelay(10);
|
||||
OS_logTaskInfo(mainDisplay->taskHandle);
|
||||
vTaskDelay(10);
|
||||
OS_logTaskInfo(errorTaskHandle);
|
||||
|
||||
|
||||
|
||||
return errorStatus;
|
||||
@@ -193,12 +207,6 @@ static void initTask(void* parameters)
|
||||
initPlatform();
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
// Construct the LEDs
|
||||
Led_construct();
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
// Construct the displays
|
||||
|
||||
Reference in New Issue
Block a user