diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/CoverSolenoid.h b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/CoverSolenoid.h index bf9e60d..9ad7ead 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/CoverSolenoid.h +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/CoverSolenoid.h @@ -109,4 +109,18 @@ extern ErrorStatus CoverSolenoid_unlock(void); */ extern ErrorStatus CoverSolenoid_lock(void); + +/** ---------------------------------------------------------------------------- + * CoverSolenoid_getGpio + * Description of function + * + * @param + * @param + * @return struct Gpio* + * + * @todo + * ----------------------------------------------------------------------------- + */ +extern struct Gpio* CoverSolenoid_getGpio(void); + #endif /* SOLENOID_H_ */ diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/DisplayDevice.h b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/DisplayDevice.h index 7f57fbe..cbb7464 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/DisplayDevice.h +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/DisplayDevice.h @@ -58,22 +58,23 @@ typedef ErrorStatus (*DisplayResetFunction)(const struct DisplayDevice* self); typedef ErrorStatus (*DisplaySetStateFunction)(const struct DisplayDevice* self, DisplayDevice_functionalState state); typedef ErrorStatus (*DisplayBackspaceFunction)(const struct DisplayDevice* self); typedef ErrorStatus (*DisplayCursorPositionFunction)(const struct DisplayDevice* self, unsigned int row, unsigned int column); -typedef ErrorStatus (*DisplayWriteFunction)(const struct DisplayDevice* self, const char* buffer, size_t length, size_t row, size_t column); +typedef ErrorStatus (*DisplayWriteFunction)(const struct DisplayDevice* self, const char* buffer, unsigned int length, unsigned int row, unsigned int column); +typedef ErrorStatus (*DisplayWriteCharacterFunction)(const struct DisplayDevice* self, const char* buffer, unsigned int row, unsigned int column); typedef ErrorStatus (*DisplayClearFunction)(const struct DisplayDevice* self); -typedef ErrorStatus (*DisplayClearLineFunction)(const struct DisplayDevice* self, size_t row); -typedef ErrorStatus (*DisplaySetBrightnessFunction)(const struct DisplayDevice* self, size_t brightness); -typedef ErrorStatus (*DisplaySetContrastFunction)(const struct DisplayDevice* self, size_t contrast); +typedef ErrorStatus (*DisplayClearLineFunction)(const struct DisplayDevice* self, unsigned int row); +typedef ErrorStatus (*DisplaySetBrightnessFunction)(const struct DisplayDevice* self, unsigned int brightness); +typedef ErrorStatus (*DisplaySetContrastFunction)(const struct DisplayDevice* self, unsigned int contrast); typedef ErrorStatus (*DisplayInvertFunction)(const struct DisplayDevice* self); typedef ErrorStatus (*DisplaySetBlinkingCursor)(const struct DisplayDevice* self, DisplayDevice_functionalState state); struct DisplayDeviceParameters { - size_t numberOfRows; - size_t numberOfColumns; - size_t contrastMin; - size_t contrastMax; - size_t brightnessMin; - size_t brightnessMax; + unsigned int numberOfRows; + unsigned int numberOfColumns; + unsigned int contrastMin; + unsigned int contrastMax; + unsigned int brightnessMin; + unsigned int brightnessMax; }; struct DisplayDevice @@ -82,6 +83,7 @@ struct DisplayDevice DisplaySetStateFunction _setState; DisplayBackspaceFunction _backspace; DisplayCursorPositionFunction _setCursorToPosition; + DisplayWriteCharacterFunction _writeCharacter; DisplayWriteFunction _write; DisplayClearFunction _clear; DisplayClearLineFunction _clearLine; @@ -102,6 +104,7 @@ extern ErrorStatus DisplayDevice_construct (struct DisplayDevice* self, struct D DisplaySetStateFunction setState, DisplayBackspaceFunction backspace, DisplayCursorPositionFunction setCursorToPosition, + DisplayWriteCharacterFunction writeCharacter, DisplayWriteFunction write, DisplayClearFunction clear, DisplayClearLineFunction clearLine, @@ -114,11 +117,12 @@ extern ErrorStatus DisplayDevice_reset(const struct DisplayDevice* self); extern ErrorStatus DisplayDevice_setState(const struct DisplayDevice* self, DisplayDevice_functionalState state); extern ErrorStatus DisplayDevice_backspace(const struct DisplayDevice* self); extern ErrorStatus DisplayDevice_setCursorToPosition(const struct DisplayDevice* self, unsigned int row, unsigned int column); -extern ErrorStatus DisplayDevice_write(const struct DisplayDevice* self, const char* buffer, size_t length, size_t row, size_t column); +extern ErrorStatus DisplayDevice_writeCharacter(const struct DisplayDevice* self, const char* buffer, unsigned int row, unsigned int column); +extern ErrorStatus DisplayDevice_write(const struct DisplayDevice* self, const char* buffer, unsigned int length, unsigned int row, unsigned int column); extern ErrorStatus DisplayDevice_clear(const struct DisplayDevice* self); -extern ErrorStatus DisplayDevice_clearLine(const struct DisplayDevice* self, size_t row); -extern ErrorStatus DisplayDevice_setBrightness(const struct DisplayDevice* self, size_t brightness); -extern ErrorStatus DisplayDevice_setContrast(const struct DisplayDevice* self, size_t contrast); +extern ErrorStatus DisplayDevice_clearLine(const struct DisplayDevice* self, unsigned int row); +extern ErrorStatus DisplayDevice_setBrightness(const struct DisplayDevice* self, unsigned int brightness); +extern ErrorStatus DisplayDevice_setContrast(const struct DisplayDevice* self, unsigned int contrast); extern ErrorStatus DisplayDevice_invert(const struct DisplayDevice* self); extern ErrorStatus DisplayDevice_setBlinkingCursorState(const struct DisplayDevice* self, DisplayDevice_functionalState state); diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/PID.h b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/PID.h index 27ddd60..fe3f22f 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/PID.h +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/PID.h @@ -95,6 +95,20 @@ extern ErrorStatus PID_construct(struct Pid* self, int Kp, int Ki, int Kd, int i extern void PID_destruct(struct Pid* self); +/** ---------------------------------------------------------------------------- + * PID_reset + * Resets the pid regulator and cleans all history + * + * @param self PID object to reset + * + * @return void + * + * @todo + * ----------------------------------------------------------------------------- + */ +extern void PID_reset(struct Pid* self); + + /** ---------------------------------------------------------------------------- * PID_calculate * Calculate diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/Power6V5Supply.h b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/Power6V5Supply.h index 7b635fb..085cb0c 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/Power6V5Supply.h +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/Power6V5Supply.h @@ -104,4 +104,18 @@ extern ErrorStatus Power6V5Supply_off(void); */ extern ErrorStatus Power6V5Supply_on(void); + +/** ---------------------------------------------------------------------------- + * Power6V5Supply_getGPIO + * Description of function + * + * @param + * @param + * @return struct Gpio* + * + * @todo + * ----------------------------------------------------------------------------- + */ +extern struct Gpio* Power6V5Supply_getGPIO(void); + #endif /* INC_POWER6V5SUPPLY_H_ */ diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/TeslaGunSafety.h b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/TeslaGunSafety.h index 5b86d38..33ad897 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/TeslaGunSafety.h +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/TeslaGunSafety.h @@ -109,4 +109,16 @@ extern ErrorStatus TeslaGunSafety_release(void); * ----------------------------------------------------------------------------- */ extern ErrorStatus TeslaGunSafety_block(void); + + +/** ---------------------------------------------------------------------------- + * TeslaGunSafety_getGpio + * Description of function + * + * @return struct Gpio* + * + * @todo + * ----------------------------------------------------------------------------- + */ +extern struct Gpio* TeslaGunSafety_getGpio(void); #endif /* INC_TESLASAFETY_H_ */ diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/nhd0420.h b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/nhd0420.h index 3a0c26f..c1b18cb 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/nhd0420.h +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/nhd0420.h @@ -185,7 +185,7 @@ extern ErrorStatus NHD0420_getSpiParameters(struct SpiParameters* parameters); * @todo * ----------------------------------------------------------------------------- */ -extern ErrorStatus NHD0420_setCursorToPosition(const struct NHD0420* self, size_t row, size_t column); +extern ErrorStatus NHD0420_setCursorToPosition(const struct NHD0420* self, unsigned int row, unsigned int column); /** ---------------------------------------------------------------------------- @@ -286,6 +286,6 @@ extern ErrorStatus NHD0420_setI2CAddress(const struct NHD0420* self, char addres */ extern ErrorStatus NHD0420_sendCommand(const struct NHD0420* self, char command); -extern ErrorStatus NHD0420_sendData(const struct NHD0420* self, const char* buffer, size_t length); +extern ErrorStatus NHD0420_sendData(const struct NHD0420* self, const char* buffer, unsigned int length); #endif /* DISPLAY_INC_NHD0420_H_ */ diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/CoverSolenoid.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/CoverSolenoid.c index 042fc00..9781481 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/CoverSolenoid.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/CoverSolenoid.c @@ -112,3 +112,9 @@ ErrorStatus CoverSolenoid_lock(void) } return returnValue; } + + +struct Gpio* CoverSolenoid_getGpio(void) +{ + return self.gpio; +} diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/DisplayDevice.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/DisplayDevice.c index 9ba78f1..5d294af 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/DisplayDevice.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/DisplayDevice.c @@ -62,6 +62,7 @@ ErrorStatus DisplayDevice_construct (struct DisplayDevice* self, struct DisplayD DisplaySetStateFunction setState, DisplayBackspaceFunction backspace, DisplayCursorPositionFunction setCursorToPosition, + DisplayWriteCharacterFunction writeCharacter, DisplayWriteFunction write, DisplayClearFunction clear, DisplayClearLineFunction clearLine, @@ -78,6 +79,7 @@ ErrorStatus DisplayDevice_construct (struct DisplayDevice* self, struct DisplayD self->_setState = setState; self->_backspace = backspace; self->_setCursorToPosition = setCursorToPosition; + self->_writeCharacter = writeCharacter; self->_write = write; self->_clear = clear; self->_clearLine = clearLine, @@ -170,7 +172,25 @@ ErrorStatus DisplayDevice_setCursorToPosition(const struct DisplayDevice* self, } -ErrorStatus DisplayDevice_write(const struct DisplayDevice* self, const char* buffer, size_t length, size_t row, size_t column) +ErrorStatus DisplayDevice_writeCharacter(const struct DisplayDevice* self, const char* buffer, unsigned int row, unsigned int column) +{ + ErrorStatus returnValue = SUCCESS; + if (self->initialized) + { + if (self->_writeCharacter != NULL) + { + returnValue = self->_writeCharacter(self, buffer, row, column); + } + } + else + { + returnValue = ERROR; + } + return returnValue; +} + + +ErrorStatus DisplayDevice_write(const struct DisplayDevice* self, const char* buffer, unsigned int length, unsigned int row, unsigned int column) { ErrorStatus returnValue = SUCCESS; if (self->initialized) @@ -206,7 +226,7 @@ ErrorStatus DisplayDevice_clear(const struct DisplayDevice* self) } -ErrorStatus DisplayDevice_clearLine(const struct DisplayDevice* self, size_t row) +ErrorStatus DisplayDevice_clearLine(const struct DisplayDevice* self, unsigned int row) { ErrorStatus returnValue = SUCCESS; if (self->initialized) @@ -224,7 +244,7 @@ ErrorStatus DisplayDevice_clearLine(const struct DisplayDevice* self, size_t row } -ErrorStatus DisplayDevice_setBrightness(const struct DisplayDevice* self, size_t brightness) +ErrorStatus DisplayDevice_setBrightness(const struct DisplayDevice* self, unsigned int brightness) { ErrorStatus returnValue = SUCCESS; if (self->initialized) @@ -242,7 +262,7 @@ ErrorStatus DisplayDevice_setBrightness(const struct DisplayDevice* self, size_t } -ErrorStatus DisplayDevice_setContrast(const struct DisplayDevice* self, size_t contrast) +ErrorStatus DisplayDevice_setContrast(const struct DisplayDevice* self, unsigned int contrast) { ErrorStatus returnValue = SUCCESS; if (self->initialized) diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/PID.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/PID.c index 1e34ed7..a96fa6e 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/PID.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/PID.c @@ -95,6 +95,16 @@ void PID_destruct(struct Pid* self) } +void PID_reset(struct Pid* self) +{ + if (self->initialized) + { + self->iTerm = 0; + self->input_d1 = 0; + } +} + + int PID_calculate(struct Pid* self, int error) { int returnValue = 0; diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/Power6V5Supply.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/Power6V5Supply.c index 1f6accc..98bfcdf 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/Power6V5Supply.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/Power6V5Supply.c @@ -112,3 +112,9 @@ ErrorStatus Power6V5Supply_on(void) } return returnValue; } + + +struct Gpio* Power6V5Supply_getGPIO(void) +{ + return self.gpio; +} diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/TeslaGunSafety.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/TeslaGunSafety.c index 004f902..d674a1d 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/TeslaGunSafety.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/TeslaGunSafety.c @@ -112,3 +112,9 @@ ErrorStatus TeslaGunSafety_block(void) } return returnValue; } + + +struct Gpio* TeslaGunSafety_getGpio(void) +{ + return self.gpio; +} diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/nhd0420.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/nhd0420.c index 6b4d906..3f6b025 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/nhd0420.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/src/nhd0420.c @@ -69,10 +69,11 @@ static int nhd0420_cursorRowOffset[NHD0420_NUMBER_OF_ROWS] = static ErrorStatus setState(const struct DisplayDevice* self, DisplayDevice_functionalState state); static ErrorStatus backspace(const struct DisplayDevice* self); static ErrorStatus setCursorToPosition(const struct DisplayDevice* self, unsigned int row, unsigned int column); -static ErrorStatus write(const struct DisplayDevice* self, const char* buffer, size_t length, size_t row, size_t column); +static ErrorStatus writeCharacter(const struct DisplayDevice* self, const char* buffer, unsigned int row, unsigned int column); +static ErrorStatus write(const struct DisplayDevice* self, const char* buffer, unsigned int length, unsigned int row, unsigned int column); static ErrorStatus clear(const struct DisplayDevice* self); -static ErrorStatus setBrightness(const struct DisplayDevice* self, size_t brightness); -static ErrorStatus setContrast(const struct DisplayDevice* self, size_t contrast); +static ErrorStatus setBrightness(const struct DisplayDevice* self, unsigned int brightness); +static ErrorStatus setContrast(const struct DisplayDevice* self, unsigned int contrast); static ErrorStatus setBlinkingCursorState(const struct DisplayDevice* self, DisplayDevice_functionalState state); // ----------------------------------------------------------------------------- @@ -98,7 +99,7 @@ ErrorStatus NHD0420_construct(struct NHD0420* self, const struct IODevice* devic ddParameters.contrastMin = NHD0420_CONTRAST_MIN; ddParameters.contrastMax = NHD0420_CONTRAST_MAX; - returnValue = DisplayDevice_construct(&self->displayDevice, &ddParameters, NULL, setState, backspace, setCursorToPosition, write, clear, NULL, setBrightness, setContrast, NULL, setBlinkingCursorState); + returnValue = DisplayDevice_construct(&self->displayDevice, &ddParameters, NULL, setState, backspace, setCursorToPosition, writeCharacter, write, clear, NULL, setBrightness, setContrast, NULL, setBlinkingCursorState); if (returnValue == SUCCESS) { @@ -170,7 +171,7 @@ ErrorStatus NHD0420_getSpiParameters(struct SpiParameters* parameters) } -ErrorStatus NHD0420_setCursorToPosition(const struct NHD0420* self, size_t row, size_t column) +ErrorStatus NHD0420_setCursorToPosition(const struct NHD0420* self, unsigned int row, unsigned int column) { ErrorStatus returnValue = SUCCESS; if (self->initialized) @@ -357,7 +358,7 @@ ErrorStatus NHD0420_sendCommand(const struct NHD0420* self, char command) } -ErrorStatus NHD0420_sendData(const struct NHD0420* self, const char* buffer, size_t length) +ErrorStatus NHD0420_sendData(const struct NHD0420* self, const char* buffer, unsigned int length) { ErrorStatus returnValue = SUCCESS; if (self->initialized) @@ -405,10 +406,34 @@ ErrorStatus setCursorToPosition(const struct DisplayDevice* self, unsigned int r } -static ErrorStatus write(const struct DisplayDevice* self, const char* buffer, size_t length, size_t row, size_t column) +ErrorStatus writeCharacter(const struct DisplayDevice* self, const char* buffer, unsigned int row, unsigned int column) +{ + ErrorStatus returnValue = SUCCESS; + if (self->initialized) + { + if ((column) > NHD0420_NUMBER_OF_COLUMNS) + { + returnValue = ERROR; + } + + // Set cursor on display + returnValue = NHD0420_setCursorToPosition((const struct NHD0420*)self, row, column); + + if (returnValue == SUCCESS) + { + returnValue = NHD0420_sendData((const struct NHD0420*)self, buffer, 1); + } + } + else + { + returnValue = ERROR; + } + return returnValue; +} + + +static ErrorStatus write(const struct DisplayDevice* self, const char* buffer, unsigned int length, unsigned int row, unsigned int column) { - ///TODO REMOVE -// volatile int i; ErrorStatus returnValue = SUCCESS; if (self->initialized) { @@ -420,8 +445,6 @@ static ErrorStatus write(const struct DisplayDevice* self, const char* buffer, s // Set cursor on display returnValue = NHD0420_setCursorToPosition((const struct NHD0420*)self, row, column); -// for (i = 0; i < 3000; i++); - if (returnValue == SUCCESS) { // Send one byte at a time (display requirement) @@ -431,7 +454,6 @@ static ErrorStatus write(const struct DisplayDevice* self, const char* buffer, s returnValue = NHD0420_sendData((const struct NHD0420*)self, &buffer[loopcounter], 1); } } -// for (i = 0; i < 1000; i++); } else { @@ -455,7 +477,7 @@ static ErrorStatus clear(const struct DisplayDevice* self) } -static ErrorStatus setBrightness(const struct DisplayDevice* self, size_t brightness) +static ErrorStatus setBrightness(const struct DisplayDevice* self, unsigned int brightness) { if (self->initialized) { @@ -468,7 +490,7 @@ static ErrorStatus setBrightness(const struct DisplayDevice* self, size_t bright } -static ErrorStatus setContrast(const struct DisplayDevice* self, size_t contrast) +static ErrorStatus setContrast(const struct DisplayDevice* self, unsigned int contrast) { if (self->initialized) { diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/Platform/src/spiDevice.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/Platform/src/spiDevice.c index 69563fd..f96acba 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/Platform/src/spiDevice.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/Platform/src/spiDevice.c @@ -83,6 +83,7 @@ static ErrorStatus write(const struct IODevice* self, const char* buffer, size_t return SpiDevice_write((const struct SpiDevice*)self, buffer, length); } + ErrorStatus SpiDevice_write (const struct SpiDevice* self, const char* buffer, int length) { struct spiQueueItem txItem; diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/buglist.txt b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/buglist.txt index 675ca96..69f64a4 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/buglist.txt +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/buglist.txt @@ -1,6 +1,5 @@ - Display backlight unstable - Display cursor unstable -- HW validation menu outdated/unfunctional - repairMenu has bad reference to getmainrepairmenu @@ -8,4 +7,5 @@ FIXED - PIN change verification not functional - Multi-Language support added to menu. All strings/messages outsourced to dedicated file. MakeFile adapted -- NumberOfStages Macro for presets not implemented well. It will be ignored when generating DEFAULT presets \ No newline at end of file +- NumberOfStages Macro for presets not implemented well. It will be ignored when generating DEFAULT presets +- HW validation menu outdated/unfunctional \ No newline at end of file diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/FreeRTOSConfig.h b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/FreeRTOSConfig.h index 85caf03..ff7a9fc 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/FreeRTOSConfig.h +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/FreeRTOSConfig.h @@ -43,8 +43,8 @@ #define configCPU_CLOCK_HZ ( ( unsigned long ) 8000000 ) #define configTICK_RATE_HZ ( ( TickType_t ) 1000 ) #define configMAX_PRIORITIES ( 5 ) -#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 256 ) -#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 0x7000 ) ) +#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 ) +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 0x8000 ) ) #define configMAX_TASK_NAME_LEN ( 16 ) #define configUSE_TRACE_FACILITY 1 #define configUSE_16_BIT_TICKS 0 diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/hwValidationMenu.h b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/hwValidationMenu.h index fb97646..4f795e9 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/hwValidationMenu.h +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/hwValidationMenu.h @@ -63,8 +63,7 @@ struct HwValidationMenuItems struct Gpio* power6v5Enable; struct Gpio* interlockNO; struct Gpio* interlockNC; - struct Gpio* teslaNO; - struct Gpio* teslaNC; + struct Gpio* TeslaSecurity; struct Gpio* solenoid; struct Gpio* mcp0Relay; struct Gpio* mcp1Relay; @@ -74,7 +73,7 @@ struct HwValidationMenuItems struct Gpio* cat2Relay; struct Pcba* pcba; struct Keypad *keypad; -// struct Eeprom* eeprom; // Not implemented yet +// struct Buzzer* buzzer; }; struct HwValidationMenu diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/Display.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/Display.c index 41e8f12..e04ef77 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/Display.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/Display.c @@ -347,7 +347,7 @@ static void DisplayTask(void* parameters) if (DisplayContent_isCharacterUpdated(&self->displayContent, rowCounter, colCounter)) { buffer = DisplayContent_getCharacter(&self->displayContent, rowCounter, colCounter); - DisplayDevice_write(self->displayDevice, &buffer, 1, rowCounter + 1, colCounter + 1); + DisplayDevice_writeCharacter(self->displayDevice, &buffer, rowCounter + 1, colCounter + 1); } } } diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/hwValidationMenu.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/hwValidationMenu.c index f4244f5..2c72755 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/hwValidationMenu.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/hwValidationMenu.c @@ -60,6 +60,7 @@ typedef enum CONSOLE_TEST_ADC, CONSOLE_TEST_DAC, CONSOLE_TEST_INTERLOCK, + CONSOLE_TEST_TESLA_SECURITY, CONSOLE_TEST_SOLENOID, CONSOLE_TEST_RELAY, CONSOLE_TEST_GENERIC, @@ -74,6 +75,7 @@ typedef enum DISPLAY_MENU_ADC, DISPLAY_MENU_DAC, DISPLAY_MENU_INTERLOCK, + DISPLAY_MENU_TESLA_SECURITY, DISPLAY_MENU_SOLENOID, DISPLAY_MENU_RELAY, DISPLAY_MENU_GENERIC @@ -97,7 +99,7 @@ typedef enum static const char conInfHeader[] = "*******************************************************************************\r\n" - "** Photonis - something **\r\n" + "** Photonis - HSB MRTS **\r\n" "** **\r\n" "*******************************************************************************\r\n" " \r\n"; @@ -111,10 +113,11 @@ static const char conInfMainMenu[] = " [%c] Test Display \r\n" " [%c] Test ADCs \r\n" " [%c] Test DACs \r\n" - " [%c] Test Interlocks \r\n" + " [%c] Test Interlock \r\n" + " [%c] Test Tesla security \r\n" " [%c] Test Solenoids \r\n" " [%c] Test relays \r\n" - " [%c] Test Keypad/EEPROM/PCB variant \r\n" + " [%c] Test Keypad/PCB variant \r\n" " \r\n"; enum @@ -124,6 +127,7 @@ enum MENU_MAIN_ADC, MENU_MAIN_DAC, MENU_MAIN_INTERLOCK, + MENU_MAIN_TESLA_SECURITY, MENU_MAIN_SOLENOID, MENU_MAIN_RELAY, MENU_MAIN_GENERIC, @@ -159,9 +163,9 @@ static const char conTestDisplay[] = " \r\n" " Test the display and backlight \r\n" " \r\n" - " [%c] Set backlight to 10%% \r\n" - " [%c] Set backlight to 50%% \r\n" - " [%c] Set backlight to 100%% \r\n" + " [%c] Set backlight to 10%% \r\n" + " [%c] Set backlight to 50%% \r\n" + " [%c] Set backlight to 100%% \r\n" " [%c] Show text on display \r\n" " [%c] Clear display content \r\n" " [%c] Back \r\n" @@ -248,18 +252,34 @@ static const char conTestInterlock[] = " Test the interlock [1-2] \r\n" " \r\n" " [%c] Read Interlock 1 \r\n" - " [%c] Read Interlock 2 (Tesla only) \r\n" " [%c] Back \r\n" " \r\n"; enum { MENU_TEST_INTERLOCK_1, - MENU_TEST_INTERLOCK_2, MENU_TEST_INTERLOCK_BACK, MENU_TEST_INTERLOCK_LAST }; +static const char conTestTeslaSecurity[] = + ANSI_TERMINAL_RESET + ANSI_TERMINAL_HOME + " TEST Tesla security \r\n" + " \r\n" + " Test the Tesla security relais \r\n" + " \r\n" + " [%c] Toggle relais \r\n" + " [%c] Back \r\n" + " \r\n"; + +enum +{ + MENU_TEST_TESLA_TOGGLE, + MENU_TEST_TESLA_BACK, + MENU_TEST_TESLA_LAST +}; + static const char conTestSolenoid[] = ANSI_TERMINAL_RESET ANSI_TERMINAL_HOME @@ -310,12 +330,11 @@ enum static const char conTestGeneric[] = ANSI_TERMINAL_RESET ANSI_TERMINAL_HOME - " TEST KEYPAD/EEPROM/PCB VARIANT \r\n" + " TEST KEYPAD/PCB VARIANT \r\n" " \r\n" - " Test the relays [1-6] \r\n" + " Test keypad / PCBa \r\n" " \r\n" " [%c] Read keypad \r\n" - " [%c] Test EEPROM \r\n" " [%c] Get PCB variant \r\n" " [%c] Back \r\n" " \r\n"; @@ -323,7 +342,6 @@ static const char conTestGeneric[] = enum { MENU_TEST_GENERIC_KEYPAD, - MENU_TEST_GENERIC_EEPROM, MENU_TEST_GENERIC_PCB_VARIANT, MENU_TEST_GENERIC_BACK, MENU_TEST_GENERIC_LAST @@ -518,7 +536,13 @@ static void hwValidationMenuSM(struct HwValidationMenu* self, Button_Pressed_t b self->menuItemSelected = 0; menuState = CONSOLE_TEST_INTERLOCK; hwValidationMenuDisplay(self, DISPLAY_MENU_INTERLOCK ); - } + } + else if( self->menuItemSelected == MENU_MAIN_TESLA_SECURITY ) + { + self->menuItemSelected = 0; + menuState = CONSOLE_TEST_TESLA_SECURITY; + hwValidationMenuDisplay(self, DISPLAY_MENU_TESLA_SECURITY ); + } else if( self->menuItemSelected == MENU_MAIN_SOLENOID ) { self->menuItemSelected = 0; @@ -892,28 +916,6 @@ static void hwValidationMenuSM(struct HwValidationMenu* self, Button_Pressed_t b } IODevice_write(self->ioDevice, self->outputBuffer, outputBufferLength); } - else if (self->menuItemSelected == MENU_TEST_INTERLOCK_2 ) - { - - if(self->testItems->pcba->pcba == PCBA_Tesla) - { - - if( GPIO_getValue(self->testItems->teslaNO, &value1) == SUCCESS && - GPIO_getValue(self->testItems->teslaNC, &value2) == SUCCESS - ){ - outputBufferLength = sprintf(self->outputBuffer, "Interlock (tesla): NO: %d - NC: %d\r\n", value1, value2); - } - else - { - outputBufferLength = sprintf(self->outputBuffer, "Interlock: Failure\r\n"); - } - } - else - { - outputBufferLength = sprintf(self->outputBuffer, "Interlock: Only available on Tesla PCBA\r\n"); - } - IODevice_write(self->ioDevice, self->outputBuffer, outputBufferLength); - } else if (self->menuItemSelected == MENU_TEST_INTERLOCK_BACK ) { // Back to main menu @@ -924,6 +926,59 @@ static void hwValidationMenuSM(struct HwValidationMenu* self, Button_Pressed_t b } break; + case CONSOLE_TEST_TESLA_SECURITY: + if( button == BUTTON_UP ) + { + if( self->menuItemSelected == 0 ) + self->menuItemSelected = (MENU_TEST_TESLA_LAST- 1); + else + self->menuItemSelected--; + + hwValidationMenuDisplay(self, DISPLAY_MENU_TESLA_SECURITY ); + } + else if( button == BUTTON_DOWN ) + { + if( self->menuItemSelected == (MENU_TEST_TESLA_LAST - 1) ) + self->menuItemSelected = 0; + else + self->menuItemSelected++; + + hwValidationMenuDisplay(self, DISPLAY_MENU_TESLA_SECURITY ); + } + else if( button == BUTTON_ENTER ) + { + bool value = false; + if( self->menuItemSelected == MENU_TEST_TESLA_TOGGLE) + { + if( GPIO_getValue(self->testItems->TeslaSecurity, &value) == SUCCESS) + { + // Invert current value + value = !value; + if( GPIO_setValue(self->testItems->TeslaSecurity, value) == SUCCESS) + { + outputBufferLength = sprintf(self->outputBuffer, "TESLA relais: Toggled\r\n"); + } + else + { + outputBufferLength = sprintf(self->outputBuffer, "TESLA relais: Failed to set value\r\n"); + } + } + else + { + outputBufferLength = sprintf(self->outputBuffer, "TESLA relais: Failed to get value\r\n"); + } + IODevice_write(self->ioDevice, self->outputBuffer, outputBufferLength); + } + else if (self->menuItemSelected == MENU_TEST_TESLA_BACK ) + { + // Back to main menu + self->menuItemSelected = 0; + menuState = CONSOLE_MAIN_MENU; + hwValidationMenuDisplay(self, DISPLAY_MENU_MAIN ); + } + } + break; + case CONSOLE_TEST_SOLENOID: if( button == BUTTON_UP ) { @@ -1157,11 +1212,6 @@ static void hwValidationMenuSM(struct HwValidationMenu* self, Button_Pressed_t b outputBufferLength = sprintf(self->outputBuffer, "Keypad test exited\r\n"); IODevice_write(self->ioDevice, self->outputBuffer, outputBufferLength); } - else if( self->menuItemSelected == MENU_TEST_GENERIC_EEPROM) - { - outputBufferLength = sprintf(self->outputBuffer, "[TODO] EEPROM TEST\r\n"); - IODevice_write(self->ioDevice, self->outputBuffer, outputBufferLength); - } else if( self->menuItemSelected == MENU_TEST_GENERIC_PCB_VARIANT) { if(self->testItems->pcba) @@ -1214,6 +1264,7 @@ static void hwValidationMenuDisplay(struct HwValidationMenu* self, Display_State menuItems[MENU_MAIN_ADC], menuItems[MENU_MAIN_DAC], menuItems[MENU_MAIN_INTERLOCK], + menuItems[MENU_MAIN_TESLA_SECURITY], menuItems[MENU_MAIN_SOLENOID], menuItems[MENU_MAIN_RELAY], menuItems[MENU_MAIN_GENERIC] @@ -1326,7 +1377,6 @@ static void hwValidationMenuDisplay(struct HwValidationMenu* self, Display_State char interlockMenuBuffer[ sizeof( conTestInterlock ) ]; menu_length = sprintf( interlockMenuBuffer, conTestInterlock, menuItems[MENU_TEST_INTERLOCK_1], - menuItems[MENU_TEST_INTERLOCK_2], menuItems[MENU_TEST_INTERLOCK_BACK] ); @@ -1334,6 +1384,24 @@ static void hwValidationMenuDisplay(struct HwValidationMenu* self, Display_State IODevice_write(self->ioDevice, interlockMenuBuffer, menu_length); break; + case DISPLAY_MENU_TESLA_SECURITY: + // Put an asterisk (*) at the selected item in the menu + for( menuIndex = 0; menuIndex < MENU_TEST_TESLA_LAST; menuIndex++ ) + { + MENU_DRAW_SELECTED(menuIndex); + } + + // Fill buffer with menu items + char teslaSecurityMenuBuffer[ sizeof( conTestTeslaSecurity ) ]; + menu_length = sprintf( teslaSecurityMenuBuffer, conTestTeslaSecurity, + menuItems[MENU_TEST_TESLA_TOGGLE], + menuItems[MENU_TEST_TESLA_BACK] + ); + + // Write message to debout interface + IODevice_write(self->ioDevice, teslaSecurityMenuBuffer, menu_length); + break; + case DISPLAY_MENU_SOLENOID: // Put an asterisk (*) at the selected item in the menu @@ -1398,7 +1466,6 @@ static void hwValidationMenuDisplay(struct HwValidationMenu* self, Display_State char genericMenuBuffer[ sizeof( conTestGeneric) ]; menu_length = sprintf( genericMenuBuffer, conTestGeneric, menuItems[MENU_TEST_GENERIC_KEYPAD], - menuItems[MENU_TEST_GENERIC_EEPROM], menuItems[MENU_TEST_GENERIC_PCB_VARIANT], menuItems[MENU_TEST_GENERIC_BACK] ); 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 99a6f33..322d9df 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 @@ -33,6 +33,10 @@ #include "FreeRTOS.h" #include "task.h" +#include "stm32f10x.h" + +#include "misc.h" + #include "ADConverters.h" #include "DAConverters.h" #include "DeviceParameters.h" @@ -40,35 +44,20 @@ #include "Error.h" #include "hsb-mrts.h" #include "hwValidationMenu.h" -#include "repairMenu.h" #include "repairMenus.h" -#include "repairProcess.h" -#include "repairProcesses.h" #include "Warning.h" -#include "misc.h" -#include "stm32f10x_rcc.h" - -#include "CachedStorage.h" -#include "DisplayDevice.h" -#include "KeyboardDevice.h" -#include "MAX5715.h" -#include "nhd0420.h" - -#include "platform.h" #include "CathodeMCP.h" +#include "CoverSolenoid.h" #include "Interlock.h" -#include "internalADC.h" -#include "InternalFlash.h" -#include "gpio.h" -#include "IODevice.h" -#include "keypadMatrix.h" #include "Logger.h" -#include "MemoryDevice.h" +#include "nhd0420.h" +#include "Power6V5Supply.h" +#include "TeslaGunSafety.h" + #include "PCBA.h" #include "uart.h" -#include "spi.h" -#include "spiDevice.h" + // ----------------------------------------------------------------------------- // Constant and macro definitions @@ -89,6 +78,7 @@ struct LedTaskArguments int frequency; }; + // ----------------------------------------------------------------------------- // File-scope variables // ----------------------------------------------------------------------------- @@ -102,9 +92,9 @@ static xTaskHandle initTaskHandle; static xTaskHandle ledTaskHandle; static xTaskHandle sysTaskHandle; -//static struct HwValidationMenu _hwValidation = {.initialized = false}; -//static struct HwValidationMenuItems hwTestItems; -//struct HwValidationMenu* hwValidation = &_hwValidation; +static struct HwValidationMenu _hwValidation = {.initialized = false}; +static struct HwValidationMenuItems hwTestItems; +struct HwValidationMenu* hwValidation = &_hwValidation; static struct CachedStorage cs = {.initialized = false}; static struct CachedStorage deviceParameters = {.initialized = false}; @@ -153,7 +143,7 @@ void vApplicationTickHook () static void printSystemInfoTask(void* parameters) { -// while (1) + while (1) { LOGGER_INFO(mainLog, "---------------------------------------"); systeminfoCommandHandler(); @@ -168,25 +158,9 @@ static ErrorStatus systeminfoCommandHandler(void) char text[128]; freeMemory = xPortGetFreeHeapSize(); - snprintf(text, sizeof(text), "Free heap memory: %d bytes", freeMemory); + 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(interlock->taskHandle); - vTaskDelay(10); - OS_logTaskInfo(keypad->taskHandle); - vTaskDelay(10); - OS_logTaskInfo(mainDisplay->taskHandle); - vTaskDelay(10); - OS_logTaskInfo(repairMenus_getMainRepairMenu()->menuCore->taskHandle); - vTaskDelay(10); - OS_logTaskInfo(repairProcesses_getMainRepairProcess()->taskHandle); return errorStatus; @@ -194,65 +168,101 @@ static ErrorStatus systeminfoCommandHandler(void) static void initTask(void* parameters) { - // Create the error handler - Error_construct(); + ErrorStatus returnValue = SUCCESS; - // Create the warning handler - Warning_construct(); + if (returnValue == SUCCESS) + { + // Create the error handler + Error_construct(); + } - // Initialize the platform first - // All IO is initialized here - // Also, all periphery and platform-specifics are initialized here - // IRQs are defined here - initPlatform(); + if (returnValue == SUCCESS) + { + // Create the warning handler + Warning_construct(); + } - // Create a small task that only blinks a LED and flashes the identification letter on the display - xTaskCreate(ledBlinkTask, (const char* const)"ledTask", 100, &ledTaskArguments, 0, &ledTaskHandle); + if (returnValue == SUCCESS) + { + // Initialize the platform first + // All IO is initialized here + // Also, all periphery and platform-specifics are initialized here + // IRQs are defined here + initPlatform(); + } - // Construct the displays - Displays_construct(); + if (returnValue == SUCCESS) + { + // Construct the displays + Displays_construct(); + } - // Construct the AD Converters - ADConverters_construct(); + if (returnValue == SUCCESS) + { + // Construct the AD Converters + ADConverters_construct(); + } - // Construct the DA Converters - DAConverters_construct(); + if (returnValue == SUCCESS) + { + // Construct the DA Converters + DAConverters_construct(); + } - hsb_generateStartScreen(mainDisplay); - // Let start screen stay for 5 seconds - vTaskDelay(INIT_START_SCREEN_DELAY); + if (returnValue == SUCCESS) + { + hsb_generateStartScreen(mainDisplay); + // Let start screen stay for 5 seconds + vTaskDelay(INIT_START_SCREEN_DELAY); + } - // Construct/Load the device parameters - DeviceParameters_construct(&deviceParameters, &iFlash->memoryDevice); + if (returnValue == SUCCESS) + { + // Construct/Load the device parameters + DeviceParameters_construct(&deviceParameters, &iFlash->memoryDevice); + } - // Construct the repair presets - RepairPresets_construct(&cs, &iFlash->memoryDevice); + if (returnValue == SUCCESS) + { + // Construct the repair presets + RepairPresets_construct(&cs, &iFlash->memoryDevice); + } - ///TODO MUST BE UPDATED -// hwTestItems.display = &nhd0420->displayDevice; -// hwTestItems.internalADC = adc1; -// hwTestItems.externalDAC = max5715; -// hwTestItems.power6v5Enable = power6v5Enable; -// hwTestItems.interlockNO = interlockNO; -// hwTestItems.interlockNC = interlockNC; -// hwTestItems.solenoid = solenoid; -// hwTestItems.mcp0Relay = mcp0Relay; -// hwTestItems.mcp1Relay = mcp1Relay; -// hwTestItems.mcp2Relay = mcp2Relay; -// hwTestItems.cat0Relay = cat0Relay; -// hwTestItems.cat1Relay = cat1Relay; -// hwTestItems.cat2Relay = cat2Relay; -// hwTestItems.pcba = PCBA_getInstance(); -// hwTestItems.keypad = keypad; - // EEPROM TO BE DONE -// HwValidationMenu_construct(hwValidation, &uart1->device, &hwTestItems, 1, 1024); + if (returnValue == SUCCESS) + { + hwTestItems.display = &nhd0420->displayDevice; + hwTestItems.internalADC = adc1; + hwTestItems.externalDAC = max5715; + hwTestItems.power6v5Enable = Power6V5Supply_getGPIO(); + hwTestItems.interlockNO = interlock->NO.io; + hwTestItems.interlockNC = interlock->NC.io; + hwTestItems.TeslaSecurity = TeslaGunSafety_getGpio(); + hwTestItems.solenoid = CoverSolenoid_getGpio(); + hwTestItems.mcp0Relay = CathodeMCP_getInstance()->mcp0; + hwTestItems.mcp1Relay = CathodeMCP_getInstance()->mcp1; + hwTestItems.mcp2Relay = CathodeMCP_getInstance()->mcp2; + hwTestItems.cat0Relay = CathodeMCP_getInstance()->cat0; + hwTestItems.cat1Relay = CathodeMCP_getInstance()->cat1; + hwTestItems.cat2Relay = CathodeMCP_getInstance()->cat2; + hwTestItems.pcba = PCBA_getInstance(); + hwTestItems.keypad = keypad; + // EEPROM TO BE DONE + HwValidationMenu_construct(hwValidation, &uart1->device, &hwTestItems, 1, 1024); + } - // Construct the repair menu - repairMenus_construct(); + if (returnValue == SUCCESS) + { + // Create task that repeats to print out TASK information on the logger + xTaskCreate(printSystemInfoTask, (const char* const)"SysInfoTask", 512, NULL, 0, &sysTaskHandle); + // Create a small task that only blinks a LED and flashes the identification letter on the display + xTaskCreate(ledBlinkTask, (const char* const)"ledTask", 100, &ledTaskArguments, 0, &ledTaskHandle); + } - - // Create task that repeats to print out TASK information on the logger - xTaskCreate(printSystemInfoTask, (const char* const)"SysInfoTask", 512, NULL, 0, &sysTaskHandle); + if (returnValue == SUCCESS) + { + // Construct the repair menu + repairMenus_construct(); + } // Delete this init task vTaskDelete(NULL); diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairMenu.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairMenu.c index 3f24164..f5a6023 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairMenu.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairMenu.c @@ -318,13 +318,13 @@ static void repairMenu_printWarning(struct MenuCore* self) static void repairMenu_printRepair(struct MenuCore* self) { - int loopCounter = 0; - char buffer[20]; struct RepairMenu* repairMenu = repairMenus_getMainRepairMenu(); struct RepairProcess* repairProcess = repairProcesses_getMainRepairProcess(); if (repairProcess_isProcessRunning(repairProcess)) { + int loopCounter = 0; + char buffer[20]; if (xSemaphoreTake(repairMenu->repairScreenUpdateSemaphore, 0) != pdTRUE) { // Taking semaphore failed - no update on the screen diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairMenus.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairMenus.c index 980bec0..b0a2a75 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairMenus.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairMenus.c @@ -83,7 +83,10 @@ ErrorStatus repairMenus_construct(void) { // Create the Menu core returnValue = MenuCore_construct(menuCore, mainDisplay, &storm700->keyboardDevice, HSB_MAINMENU_TASK_PRIORITY, HSB_MAINMENU_TASK_STACKSIZE, repairMenu_createMenuEntries, repairMenu_menuStateHandle); + } + if (returnValue == SUCCESS) + { // Create first repair menu returnValue = repairMenu_construct(mainMenu, menuCore,&iFlash->memoryDevice, repairMenus_freeMainMenuRepairScreenUpdateSemaphore); } diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairProcess.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairProcess.c index 5e46d00..e9e303a 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairProcess.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairProcess.c @@ -229,12 +229,10 @@ static void repairProcess_task(void* parameters) while(self->runTask) { -// LOGGER_DEBUG(mainLog, "----------------------------------------"); xSemaphoreTake(self->secondsSyncronisation, portMAX_DELAY); // The signal profile is identical for all rows in the regulation process SignalProfileGenerator_calculate(&self->signalProfileGenerator); -// LOGGER_DEBUG(mainLog, "Signal: %d, TimeToRemain %d", self->signalProfileGenerator.signal, (unsigned int)SignalProfileGenerator_getRemainingTime(&self->signalProfileGenerator)); // Check for correct signal if (!SignalProfileGenerator_isPaused(&self->signalProfileGenerator)) @@ -278,8 +276,7 @@ static void repairProcess_task(void* parameters) // Send the PID value to the DAC DAConverter_setOutputVoltage(self->row[loopCounter].dacChannel, self->row[loopCounter].lastDACValue); -// LOGGER_DEBUG(mainLog, "Row %d --- ADC: %d Error: %d PID: %d", loopCounter, self->row[loopCounter].lastADCValue, self->row[loopCounter].pidError, self->row[loopCounter].lastDACValue); - } + } else { // ROW is in error state @@ -289,6 +286,15 @@ static void repairProcess_task(void* parameters) } } } + else + { + // Process is paused + // RESET the PIDs + for (loopCounter = ((PCBA_getInstance()->pcba == PCBA_Tesla) ? 1 : 0); loopCounter <= ((PCBA_getInstance()->pcba == PCBA_Tesla) ? 1 : 2); loopCounter++) + { + PID_reset(&self->row[loopCounter].pid); + } + } // Notify observers that an update is available Observable_notifyObservers(&self->observable, NULL); diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairProcessRow.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairProcessRow.c index 055ca86..3f276df 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairProcessRow.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/repairProcessRow.c @@ -60,11 +60,10 @@ ErrorStatus repairProcessRow_construct(struct RepairProcessRow* self, const stru { ErrorStatus returnValue = SUCCESS; - int iMin = 0; - int iMax = 0; - if (!self->initialized) { + int iMin = 0; + int iMax = 0; if (returnValue == SUCCESS) { self->adcChannel = adcChannel;