diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/Makefile b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/Makefile index 7f7e7b9..f932213 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/Makefile +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/Makefile @@ -29,6 +29,7 @@ CoverSolenoid.o \ crc32.o \ DACDevice.o \ DisplayDevice.o \ +HighVoltageDetection.o \ hsb-mrts.o \ Interlock.o \ IODevice.o \ diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/HighVoltageDetection.h b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/HighVoltageDetection.h new file mode 100644 index 0000000..ba207b4 --- /dev/null +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/HighVoltageDetection.h @@ -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 + +#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_ */ diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/Leds.h b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/Leds.h index b41279d..6ee1d1f 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/Leds.h +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/Leds.h @@ -33,6 +33,10 @@ #include +#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); /** ---------------------------------------------------------------------------- diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/HighVoltageDetection.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/HighVoltageDetection.c new file mode 100644 index 0000000..e7330d2 --- /dev/null +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/HighVoltageDetection.c @@ -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; +} diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/Leds.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/Leds.c index ce03124..b3f89f8 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/Leds.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/Leds.c @@ -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; } @@ -146,11 +152,26 @@ extern bool Led_getStatus(Led led) { if (self.leds[led].initialized) { - char value; - IODevice_read(self.leds[led].ioDevice, &value, 1, NULL); - if (value != (char)false) + // IN case of the BICOLOUR ORANGE LED, actually the GREEN and RED LEDs must be read + if (led == LED_BICOLOR_ORANGE) { - returnValue = true; + 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); + if (value != (char)false) + { + returnValue = true; + } } } } diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/Platform/inc/platform.h b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/Platform/inc/platform.h index 0844d25..de38f14 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/Platform/inc/platform.h +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/Platform/inc/platform.h @@ -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; diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/Platform/src/oli_stm32_h107.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/Platform/src/oli_stm32_h107.c index c3404ac..6309d45 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/Platform/src/oli_stm32_h107.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/Platform/src/oli_stm32_h107.c @@ -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) { - /* --------------------------------------------------------------------*/ - /* LOGGER */ - /* --------------------------------------------------------------------*/ returnValue = Logger_construct(mainLog, &uart1->device, 1, 512); } + /* --------------------------------------------------------------------*/ + /* KEYPAD MATRIX */ + /* --------------------------------------------------------------------*/ if (returnValue == SUCCESS) { - /* --------------------------------------------------------------------*/ - /* KEYPAD MATRIX */ - /* --------------------------------------------------------------------*/ 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); } + /* --------------------------------------------------------------------*/ + /* STORM700 Keypad */ + /* --------------------------------------------------------------------*/ if (returnValue == SUCCESS) { - /* --------------------------------------------------------------------*/ - /* STORM700 Keypad */ - /* --------------------------------------------------------------------*/ returnValue = Storm700_construct(storm700, &keypad->device); } + /* --------------------------------------------------------------------*/ + /* NewHavenDispplay 04 20 */ + /* --------------------------------------------------------------------*/ if (returnValue == SUCCESS) { - /* --------------------------------------------------------------------*/ - /* NewHavenDispplay 04 20 */ - /* --------------------------------------------------------------------*/ returnValue = NHD0420_construct(nhd0420, &spiDisplay->device); } + /* --------------------------------------------------------------------*/ + /* MAX5715 external Quad DAC */ + /* --------------------------------------------------------------------*/ if (returnValue == SUCCESS) { - /* --------------------------------------------------------------------*/ - /* MAX5715 external Quad DAC */ - /* --------------------------------------------------------------------*/ // Construct MAX5715 returnValue = MAX5715_construct(max5715, &spiDAC->device); // Set external DAC reference to 2V5, always ON diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/Error.h b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/Error.h index 4feaf38..e53c005 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/Error.h +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/Error.h @@ -61,6 +61,8 @@ typedef enum // Function declarations // ----------------------------------------------------------------------------- +///TODO TEMPORARY +extern TaskHandle_t errorTaskHandle; /** ---------------------------------------------------------------------------- * Error_construct diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/repairMenus.h b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/repairMenus.h index 13c2b2a..3e574e4 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/repairMenus.h +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/repairMenus.h @@ -43,7 +43,7 @@ // Type definitions. // ----------------------------------------------------------------------------- - +extern struct RepairMenu* const mainMenu; // ----------------------------------------------------------------------------- // Function declarations diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/Displays.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/Displays.c index 62e00b8..80eb070 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/Displays.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/Displays.c @@ -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 diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/Error.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/Error.c index deb983d..3c39b0a 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/Error.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/Error.c @@ -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; // ----------------------------------------------------------------------------- diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/PIN.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/PIN.c index 3434cca..023a095 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/PIN.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/PIN.c @@ -132,10 +132,29 @@ static ErrorStatus PIN_verifyInsertedPins(struct PIN* self) { ErrorStatus returnValue = SUCCESS; - if(strncmp(self->pinchangeFirstInsert, self->pinchangeSecondInsert, PIN_NUMBER_OF_DIGITS) != 0) + if (returnValue == SUCCESS) { - // Inserted PINs are not equal - returnValue = ERROR; + 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; } diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/hsb-mrts.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/hsb-mrts.c index 381cd21..4244017 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/hsb-mrts.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/hsb-mrts.c @@ -40,6 +40,7 @@ #include "platform.h" #include "CoverSolenoid.h" +#include "HighVoltageDetection.h" #include "Interlock.h" #include "Logger.h" #include "PCBA.h" @@ -225,27 +226,12 @@ 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); - } + vTaskDelay(100); } + Display_clearLine(mainDisplay, 3); Display_clearLine(mainDisplay, 4); diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/main.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/main.c index 4d76d9f..78239f2 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/main.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/main.c @@ -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