diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/Makefile b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/Makefile index bf8470b..b77adbd 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/Makefile +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/Makefile @@ -7,6 +7,8 @@ RELEASE_PATCH = 0 PLATFORM_OLIMEX_STM32_H107 = OLI_STM32_H107 + + export RELEASE_DEFINES = \ -DRELEASE_PRODUCT=$(RELEASE_PRODUCT) \ -DRELEASE_MAJOR=$(RELEASE_MAJOR) \ @@ -19,6 +21,8 @@ export PLATFORM = -D$(PLATFORM_OLIMEX_STM32_H107) export ADDITIONAL_SWITCHES = \ -DENABLE_SERIAL_LOGGING +BINARY = hsb_mrts_$(PLATFORM_OLIMEX_STM32_H107).bin + all: $(MAKE) pho_hsb_olimex_stm32_h107 @@ -33,7 +37,14 @@ pho_hsb_olimex_stm32_h107: $(MAKE) -C HAL $(MAKE) -C hsb-mrts - +flash: + openocd -f /usr/share/openocd/scripts/board/stm32f1discovery.cfg \ + -c "init" \ + -c "reset halt" \ + -c "flash write_image erase $(BINARY) 0x08000000" \ + -c "verify_image $(BINARY) 0x08000000" \ + -c "reset run" \ + -c "shutdown" clean: diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/repairMenu.h b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/repairMenu.h index d899ffc..1cacaa8 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/repairMenu.h +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/repairMenu.h @@ -87,6 +87,7 @@ struct RepairMenu struct RepairProcess repairProcess; const struct RepairPreset* repairPreset; struct RepairProcessParameters rpParameters; + static struct MenuPage menuArray[NUMBER_OF_MENUS]; }; // ----------------------------------------------------------------------------- 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 5867f39..9f7c41a 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 @@ -96,8 +96,6 @@ struct MenuPage static struct RepairProcess* rp = NULL; static const char cursorValue = 0x7E; -static struct MenuPage menuArray[NUMBER_OF_MENUS]; - // TEMPORARY PRESET STORAGE static const struct RepairPreset preset1 = {.numberOfStages = 1, .preset[0].softstartDuration = 100, .preset[0].duration = 200, .preset[0].voltage = 100}; @@ -129,9 +127,11 @@ static ErrorStatus repairMenu_feedProcessSecondsCounter(const void* const data); static void repairMenu_selectPreset(struct RepairMenu* self, int cursorIndex); -static void repairMenu_createMenuPage (struct MenuPage* self, bool hasCursor, int numberOfRows); -static void repairMenu_addMenuPageRow (struct MenuPage* self, int rowIndex, char* text, int newState, RepairMenuFunctionCall actionCall); -static void repairMenu_addMenuPageKeyAction (struct MenuPage* self, int keyActionIndex, char key, T_KeyAction action, int argument); + +static ErrorStatus repairMenu_createMenu(struct RepairMenu* self); +static ErrorStatus repairMenu_createMenuPage (struct MenuPage* self, bool hasCursor, int numberOfRows); +static ErrorStatus repairMenu_addMenuPageRow (struct MenuPage* self, int rowIndex, char* text, int newState, RepairMenuFunctionCall actionCall); +static ErrorStatus repairMenu_addMenuPageKeyAction (struct MenuPage* self, int keyActionIndex, char key, T_KeyAction action, int argument); // ----------------------------------------------------------------------------- // Function definitions @@ -175,70 +175,7 @@ ErrorStatus repairMenu_construct(struct RepairMenu* self, struct Display* displa xSemaphoreGive(self->secondsSyncronisation); // Construct the menu based on PCBA information - repairMenu_createMenuPage(&menuArray[MAINMENU], MENU_HAS_CURSOR, 4); - repairMenu_addMenuPageRow(&menuArray[MAINMENU], 0, PCBA_getInstance()->name, MAINMENU, NULL); - repairMenu_addMenuPageRow(&menuArray[MAINMENU], 1, " 1.Tube repair", REPAIRMENU, NULL); - repairMenu_addMenuPageRow(&menuArray[MAINMENU], 2, " 2.Administrator", ADMINMENU, NULL); - repairMenu_addMenuPageRow(&menuArray[MAINMENU], 3, " 3.Calibration", CALIBRATIONMENU, NULL); - repairMenu_addMenuPageKeyAction(&menuArray[MAINMENU], 0, 'U', SCROLL_UP, 0); - repairMenu_addMenuPageKeyAction(&menuArray[MAINMENU], 1, 'D', SCROLL_DOWN, 0); - repairMenu_addMenuPageKeyAction(&menuArray[MAINMENU], 2, 'E', SELECT, 0); - repairMenu_addMenuPageKeyAction(&menuArray[MAINMENU], 3, '1', HOTKEY_SELECT, 1); - repairMenu_addMenuPageKeyAction(&menuArray[MAINMENU], 4, '2', HOTKEY_SELECT, 2); - repairMenu_addMenuPageKeyAction(&menuArray[MAINMENU], 5, '3', HOTKEY_SELECT, 3); - - repairMenu_createMenuPage(&menuArray[REPAIRMENU], MENU_HAS_CURSOR, 4); - repairMenu_addMenuPageRow(&menuArray[REPAIRMENU], 0, "Tube repair", REPAIRMENU, NULL); - repairMenu_addMenuPageRow(&menuArray[REPAIRMENU], 1, " 1.Select preset", PRESETMENU, NULL); - repairMenu_addMenuPageRow(&menuArray[REPAIRMENU], 2, " 2.Start", START_REPAIR, repairMenu_startRepairProcess); - repairMenu_addMenuPageRow(&menuArray[REPAIRMENU], 3, " 3.To main menu", MAINMENU, NULL); - repairMenu_addMenuPageKeyAction(&menuArray[REPAIRMENU], 0, 'U', SCROLL_UP, 0); - repairMenu_addMenuPageKeyAction(&menuArray[REPAIRMENU], 1, 'D', SCROLL_DOWN, 0); - repairMenu_addMenuPageKeyAction(&menuArray[REPAIRMENU], 2, 'E', SELECT, 0); - repairMenu_addMenuPageKeyAction(&menuArray[REPAIRMENU], 3, '1', HOTKEY_SELECT, 1); - repairMenu_addMenuPageKeyAction(&menuArray[REPAIRMENU], 4, '2', HOTKEY_SELECT, 2); - repairMenu_addMenuPageKeyAction(&menuArray[REPAIRMENU], 5, 'X', HOTKEY_SELECT, 3); - - repairMenu_createMenuPage(&menuArray[ADMINMENU], MENU_HAS_NO_CURSOR, 2); - repairMenu_addMenuPageRow(&menuArray[ADMINMENU], 0, "Administration", ADMINMENU, NULL); - repairMenu_addMenuPageRow(&menuArray[ADMINMENU], 1, " 1.To main menu", MAINMENU, NULL); - repairMenu_addMenuPageKeyAction(&menuArray[ADMINMENU], 0, 'E', SELECT, 0); - repairMenu_addMenuPageKeyAction(&menuArray[ADMINMENU], 1, '1', HOTKEY_SELECT, 1); - repairMenu_addMenuPageKeyAction(&menuArray[ADMINMENU], 2, 'X', HOTKEY_SELECT, 1); - - repairMenu_createMenuPage(&menuArray[CALIBRATIONMENU], MENU_HAS_NO_CURSOR, 2); - repairMenu_addMenuPageRow(&menuArray[CALIBRATIONMENU], 0, "Calibration", CALIBRATIONMENU, NULL); - repairMenu_addMenuPageRow(&menuArray[CALIBRATIONMENU], 1, " 1.To main menu", MAINMENU, NULL); - repairMenu_addMenuPageKeyAction(&menuArray[CALIBRATIONMENU], 0, 'E', SELECT, 0); - repairMenu_addMenuPageKeyAction(&menuArray[CALIBRATIONMENU], 1, '1', HOTKEY_SELECT, 1); - repairMenu_addMenuPageKeyAction(&menuArray[CALIBRATIONMENU], 2, 'X', HOTKEY_SELECT, 1); - - - repairMenu_createMenuPage(&menuArray[PRESETMENU], MENU_HAS_CURSOR, 11); - repairMenu_addMenuPageRow(&menuArray[PRESETMENU], 0, "Select preset", PRESETMENU, NULL); - repairMenu_addMenuPageRow(&menuArray[PRESETMENU], 1, " 1.Preset1", REPAIRMENU, repairMenu_selectPreset); - repairMenu_addMenuPageRow(&menuArray[PRESETMENU], 2, " 2.Preset2", REPAIRMENU, repairMenu_selectPreset); - repairMenu_addMenuPageRow(&menuArray[PRESETMENU], 3, " 3.Preset3", REPAIRMENU, repairMenu_selectPreset); - repairMenu_addMenuPageRow(&menuArray[PRESETMENU], 4, " 4.Preset4", REPAIRMENU, repairMenu_selectPreset); - repairMenu_addMenuPageRow(&menuArray[PRESETMENU], 5, " 5.Preset5", REPAIRMENU, repairMenu_selectPreset); - repairMenu_addMenuPageRow(&menuArray[PRESETMENU], 6, " 6.Preset6", REPAIRMENU, repairMenu_selectPreset); - repairMenu_addMenuPageRow(&menuArray[PRESETMENU], 7, " 7.Preset7", REPAIRMENU, repairMenu_selectPreset); - repairMenu_addMenuPageRow(&menuArray[PRESETMENU], 8, " 8.Preset8", REPAIRMENU, repairMenu_selectPreset); - repairMenu_addMenuPageRow(&menuArray[PRESETMENU], 9, " 9.Preset9", REPAIRMENU, repairMenu_selectPreset); - repairMenu_addMenuPageRow(&menuArray[PRESETMENU], 10, " 10.To repair menu", REPAIRMENU, NULL); - repairMenu_addMenuPageKeyAction(&menuArray[PRESETMENU], 0, 'U', SCROLL_UP, 0); - repairMenu_addMenuPageKeyAction(&menuArray[PRESETMENU], 1, 'D', SCROLL_DOWN, 0); - repairMenu_addMenuPageKeyAction(&menuArray[PRESETMENU], 2, 'E', SELECT, 0); - repairMenu_addMenuPageKeyAction(&menuArray[PRESETMENU], 3, '1', HOTKEY_SELECT, 1); - repairMenu_addMenuPageKeyAction(&menuArray[PRESETMENU], 4, '2', HOTKEY_SELECT, 2); - repairMenu_addMenuPageKeyAction(&menuArray[PRESETMENU], 5, '3', HOTKEY_SELECT, 3); - repairMenu_addMenuPageKeyAction(&menuArray[PRESETMENU], 6, '4', HOTKEY_SELECT, 4); - repairMenu_addMenuPageKeyAction(&menuArray[PRESETMENU], 7, '5', HOTKEY_SELECT, 5); - repairMenu_addMenuPageKeyAction(&menuArray[PRESETMENU], 8, '6', HOTKEY_SELECT, 6); - repairMenu_addMenuPageKeyAction(&menuArray[PRESETMENU], 9, '7', HOTKEY_SELECT, 7); - repairMenu_addMenuPageKeyAction(&menuArray[PRESETMENU], 10, '8', HOTKEY_SELECT, 8); - repairMenu_addMenuPageKeyAction(&menuArray[PRESETMENU], 11, '9', HOTKEY_SELECT, 9); - repairMenu_addMenuPageKeyAction(&menuArray[PRESETMENU], 12, 'X', HOTKEY_SELECT, 10); + returnValue = repairMenu_createMenu(self); self->menuState = MAINMENU; @@ -339,18 +276,18 @@ static void repairMenu_printMenu(struct RepairMenu* self) int loopCounter; // Always print Row1 (index0), ignoring the scrolling index - Display_write(self->display, menuArray[self->menuState].row[0].text, strlen(menuArray[self->menuState].row[0].text), 1, 1); + Display_write(self->display, self->menuArray[self->menuState].row[0].text, strlen(self->menuArray[self->menuState].row[0].text), 1, 1); for (loopCounter = 1 ; loopCounter < self->display->displayDevice->parameters.numberOfRows; loopCounter++) { - Display_write(self->display, menuArray[self->menuState].row[loopCounter + self->scrollOffset].text, strlen(menuArray[self->menuState].row[loopCounter + self->scrollOffset].text), loopCounter + 1, 1); + Display_write(self->display, self->menuArray[self->menuState].row[loopCounter + self->scrollOffset].text, strlen(self->menuArray[self->menuState].row[loopCounter + self->scrollOffset].text), loopCounter + 1, 1); } } static void repairMenu_printCursor(struct RepairMenu* self) { - if (menuArray[self->menuState].hasCursor) + if (self->menuArray[self->menuState].hasCursor) { Display_write(self->display, &cursorValue, 1, 1 + self->cursorIndex - self->scrollOffset, 1); } @@ -372,24 +309,24 @@ static void repairMenu_performAction(struct RepairMenu* self, char key) case HOTKEY_SELECT: { - LOGGER_INFO(mainLog, "HOTKEY SELECT ITEM: char %c, argument %d - Going to state %d", keyAction.key, keyAction.argument, menuArray[self->menuState].row[keyAction.argument].newState); - if (menuArray[self->menuState].row[keyAction.argument].actionPointer != NULL) + LOGGER_INFO(mainLog, "HOTKEY SELECT ITEM: char %c, argument %d - Going to state %d", keyAction.key, keyAction.argument, self->menuArray[self->menuState].row[keyAction.argument].newState); + if (self->menuArray[self->menuState].row[keyAction.argument].actionPointer != NULL) { - menuArray[self->menuState].row[keyAction.argument].actionPointer(self, keyAction.argument); + self->menuArray[self->menuState].row[keyAction.argument].actionPointer(self, keyAction.argument); } - self->menuState = menuArray[self->menuState].row[keyAction.argument].newState; + self->menuState = self->menuArray[self->menuState].row[keyAction.argument].newState; repairMenu_scrollIndexHandlerReset(self); break; } case SELECT: { - LOGGER_INFO(mainLog, "SELECT ITEM %d - going to state %d", self->cursorIndex, menuArray[self->menuState].row[self->cursorIndex].newState); - if (menuArray[self->menuState].row[self->cursorIndex].actionPointer != NULL) + LOGGER_INFO(mainLog, "SELECT ITEM %d - going to state %d", self->cursorIndex, self->menuArray[self->menuState].row[self->cursorIndex].newState); + if (self->menuArray[self->menuState].row[self->cursorIndex].actionPointer != NULL) { - menuArray[self->menuState].row[self->cursorIndex].actionPointer(self, self->cursorIndex); + self->menuArray[self->menuState].row[self->cursorIndex].actionPointer(self, self->cursorIndex); } - self->menuState = menuArray[self->menuState].row[self->cursorIndex].newState; + self->menuState = self->menuArray[self->menuState].row[self->cursorIndex].newState; repairMenu_scrollIndexHandlerReset(self); break; } @@ -423,9 +360,9 @@ static struct KeyActionBinding repairMenu_findKeyAction(struct RepairMenu* self, for (loopCounter = 0; loopCounter < REPAIRMENU_MAX_NUMBER_OF_KEYS; loopCounter++) { - if (menuArray[self->menuState].keyActionBinding[loopCounter].key == key) + if (self->menuArray[self->menuState].keyActionBinding[loopCounter].key == key) { - returnValue = menuArray[self->menuState].keyActionBinding[loopCounter]; + returnValue = self->menuArray[self->menuState].keyActionBinding[loopCounter]; break; } } @@ -467,19 +404,19 @@ static void repairMenu_scrollDownIndexHandler(struct RepairMenu* self) { if (self->cursorIndex < self->display->displayDevice->parameters.numberOfRows - 1) { - if (self->cursorIndex < menuArray[self->menuState].numberOfRows - 1) + if (self->cursorIndex < self->menuArray[self->menuState].numberOfRows - 1) { self->cursorIndex++; } } else { - if (self->cursorIndex < menuArray[self->menuState].numberOfRows - 1) + if (self->cursorIndex < self->menuArray[self->menuState].numberOfRows - 1) { self->cursorIndex++; } - if (self->scrollOffset < (menuArray[self->menuState].numberOfRows - self->display->displayDevice->parameters.numberOfRows)) + if (self->scrollOffset < (self->menuArray[self->menuState].numberOfRows - self->display->displayDevice->parameters.numberOfRows)) { self->scrollOffset++; } @@ -515,31 +452,121 @@ static void repairMenu_selectPreset(struct RepairMenu* self, int cursorIndex) } -static void repairMenu_createMenuPage (struct MenuPage* self, bool hasCursor, int numberOfRows) +static ErrorStatus repairMenu_createMenu(struct RepairMenu* self) { + ErrorStatus returnValue = SUCCESS; + + repairMenu_createMenuPage(&self->menuArray[MAINMENU], MENU_HAS_CURSOR, 4); + repairMenu_addMenuPageRow(&self->menuArray[MAINMENU], 0, PCBA_getInstance()->name, MAINMENU, NULL); + repairMenu_addMenuPageRow(&self->menuArray[MAINMENU], 1, " 1.Tube repair", REPAIRMENU, NULL); + repairMenu_addMenuPageRow(&self->menuArray[MAINMENU], 2, " 2.Administrator", ADMINMENU, NULL); + repairMenu_addMenuPageRow(&self->menuArray[MAINMENU], 3, " 3.Calibration", CALIBRATIONMENU, NULL); + repairMenu_addMenuPageKeyAction(&self->menuArray[MAINMENU], 0, 'U', SCROLL_UP, 0); + repairMenu_addMenuPageKeyAction(&self->menuArray[MAINMENU], 1, 'D', SCROLL_DOWN, 0); + repairMenu_addMenuPageKeyAction(&self->menuArray[MAINMENU], 2, 'E', SELECT, 0); + repairMenu_addMenuPageKeyAction(&self->menuArray[MAINMENU], 3, '1', HOTKEY_SELECT, 1); + repairMenu_addMenuPageKeyAction(&self->menuArray[MAINMENU], 4, '2', HOTKEY_SELECT, 2); + repairMenu_addMenuPageKeyAction(&self->menuArray[MAINMENU], 5, '3', HOTKEY_SELECT, 3); + + repairMenu_createMenuPage(&self->menuArray[REPAIRMENU], MENU_HAS_CURSOR, 4); + repairMenu_addMenuPageRow(&self->menuArray[REPAIRMENU], 0, "Tube repair", REPAIRMENU, NULL); + repairMenu_addMenuPageRow(&self->menuArray[REPAIRMENU], 1, " 1.Select preset", PRESETMENU, NULL); + repairMenu_addMenuPageRow(&self->menuArray[REPAIRMENU], 2, " 2.Start", START_REPAIR, repairMenu_startRepairProcess); + repairMenu_addMenuPageRow(&self->menuArray[REPAIRMENU], 3, " 3.To main menu", MAINMENU, NULL); + repairMenu_addMenuPageKeyAction(&self->menuArray[REPAIRMENU], 0, 'U', SCROLL_UP, 0); + repairMenu_addMenuPageKeyAction(&self->menuArray[REPAIRMENU], 1, 'D', SCROLL_DOWN, 0); + repairMenu_addMenuPageKeyAction(&self->menuArray[REPAIRMENU], 2, 'E', SELECT, 0); + repairMenu_addMenuPageKeyAction(&self->menuArray[REPAIRMENU], 3, '1', HOTKEY_SELECT, 1); + repairMenu_addMenuPageKeyAction(&self->menuArray[REPAIRMENU], 4, '2', HOTKEY_SELECT, 2); + repairMenu_addMenuPageKeyAction(&self->menuArray[REPAIRMENU], 5, 'X', HOTKEY_SELECT, 3); + + repairMenu_createMenuPage(&self->menuArray[ADMINMENU], MENU_HAS_NO_CURSOR, 2); + repairMenu_addMenuPageRow(&self->menuArray[ADMINMENU], 0, "Administration", ADMINMENU, NULL); + repairMenu_addMenuPageRow(&self->menuArray[ADMINMENU], 1, " 1.To main menu", MAINMENU, NULL); + repairMenu_addMenuPageKeyAction(&self->menuArray[ADMINMENU], 0, 'E', SELECT, 0); + repairMenu_addMenuPageKeyAction(&self->menuArray[ADMINMENU], 1, '1', HOTKEY_SELECT, 1); + repairMenu_addMenuPageKeyAction(&self->menuArray[ADMINMENU], 2, 'X', HOTKEY_SELECT, 1); + + repairMenu_createMenuPage(&self->menuArray[CALIBRATIONMENU], MENU_HAS_NO_CURSOR, 2); + repairMenu_addMenuPageRow(&self->menuArray[CALIBRATIONMENU], 0, "Calibration", CALIBRATIONMENU, NULL); + repairMenu_addMenuPageRow(&self->menuArray[CALIBRATIONMENU], 1, " 1.To main menu", MAINMENU, NULL); + repairMenu_addMenuPageKeyAction(&self->menuArray[CALIBRATIONMENU], 0, 'E', SELECT, 0); + repairMenu_addMenuPageKeyAction(&self->menuArray[CALIBRATIONMENU], 1, '1', HOTKEY_SELECT, 1); + repairMenu_addMenuPageKeyAction(&self->menuArray[CALIBRATIONMENU], 2, 'X', HOTKEY_SELECT, 1); + + + repairMenu_createMenuPage(&self->menuArray[PRESETMENU], MENU_HAS_CURSOR, 11); + repairMenu_addMenuPageRow(&self->menuArray[PRESETMENU], 0, "Select preset", PRESETMENU, NULL); + repairMenu_addMenuPageRow(&self->menuArray[PRESETMENU], 1, " 1.Preset1", REPAIRMENU, repairMenu_selectPreset); + repairMenu_addMenuPageRow(&self->menuArray[PRESETMENU], 2, " 2.Preset2", REPAIRMENU, repairMenu_selectPreset); + repairMenu_addMenuPageRow(&self->menuArray[PRESETMENU], 3, " 3.Preset3", REPAIRMENU, repairMenu_selectPreset); + repairMenu_addMenuPageRow(&self->menuArray[PRESETMENU], 4, " 4.Preset4", REPAIRMENU, repairMenu_selectPreset); + repairMenu_addMenuPageRow(&self->menuArray[PRESETMENU], 5, " 5.Preset5", REPAIRMENU, repairMenu_selectPreset); + repairMenu_addMenuPageRow(&self->menuArray[PRESETMENU], 6, " 6.Preset6", REPAIRMENU, repairMenu_selectPreset); + repairMenu_addMenuPageRow(&self->menuArray[PRESETMENU], 7, " 7.Preset7", REPAIRMENU, repairMenu_selectPreset); + repairMenu_addMenuPageRow(&self->menuArray[PRESETMENU], 8, " 8.Preset8", REPAIRMENU, repairMenu_selectPreset); + repairMenu_addMenuPageRow(&self->menuArray[PRESETMENU], 9, " 9.Preset9", REPAIRMENU, repairMenu_selectPreset); + repairMenu_addMenuPageRow(&self->menuArray[PRESETMENU], 10, " 10.To repair menu", REPAIRMENU, NULL); + repairMenu_addMenuPageKeyAction(&self->menuArray[PRESETMENU], 0, 'U', SCROLL_UP, 0); + repairMenu_addMenuPageKeyAction(&self->menuArray[PRESETMENU], 1, 'D', SCROLL_DOWN, 0); + repairMenu_addMenuPageKeyAction(&self->menuArray[PRESETMENU], 2, 'E', SELECT, 0); + repairMenu_addMenuPageKeyAction(&self->menuArray[PRESETMENU], 3, '1', HOTKEY_SELECT, 1); + repairMenu_addMenuPageKeyAction(&self->menuArray[PRESETMENU], 4, '2', HOTKEY_SELECT, 2); + repairMenu_addMenuPageKeyAction(&self->menuArray[PRESETMENU], 5, '3', HOTKEY_SELECT, 3); + repairMenu_addMenuPageKeyAction(&self->menuArray[PRESETMENU], 6, '4', HOTKEY_SELECT, 4); + repairMenu_addMenuPageKeyAction(&self->menuArray[PRESETMENU], 7, '5', HOTKEY_SELECT, 5); + repairMenu_addMenuPageKeyAction(&self->menuArray[PRESETMENU], 8, '6', HOTKEY_SELECT, 6); + repairMenu_addMenuPageKeyAction(&self->menuArray[PRESETMENU], 9, '7', HOTKEY_SELECT, 7); + repairMenu_addMenuPageKeyAction(&self->menuArray[PRESETMENU], 10, '8', HOTKEY_SELECT, 8); + repairMenu_addMenuPageKeyAction(&self->menuArray[PRESETMENU], 11, '9', HOTKEY_SELECT, 9); + repairMenu_addMenuPageKeyAction(&self->menuArray[PRESETMENU], 12, 'X', HOTKEY_SELECT, 10); + + return returnValue; +} + +static ErrorStatus repairMenu_createMenuPage (struct MenuPage* self, bool hasCursor, int numberOfRows) +{ + ErrorStatus returnValue = SUCCESS; self->hasCursor = hasCursor; if (numberOfRows <= REPAIRMENU_MAX_NUMBER_OF_ROWS) { self->numberOfRows = numberOfRows; } + else + { + returnValue = ERROR; + } + return returnValue; } -static void repairMenu_addMenuPageRow (struct MenuPage* self, int rowIndex, char* text, int newState, RepairMenuFunctionCall actionCall) +static ErrorStatus repairMenu_addMenuPageRow (struct MenuPage* self, int rowIndex, char* text, int newState, RepairMenuFunctionCall actionCall) { + ErrorStatus returnValue = SUCCESS; if (rowIndex < self->numberOfRows) { memcpy(self->row[rowIndex].text, text, 20); self->row[rowIndex].newState = newState; self->row[rowIndex].actionPointer = actionCall; } + else + { + returnValue = ERROR; + } + return returnValue; } -static void repairMenu_addMenuPageKeyAction (struct MenuPage* self, int keyActionIndex, char key, T_KeyAction action, int argument) +static ErrorStatus repairMenu_addMenuPageKeyAction (struct MenuPage* self, int keyActionIndex, char key, T_KeyAction action, int argument) { + ErrorStatus returnValue = SUCCESS; if (keyActionIndex < REPAIRMENU_MAX_NUMBER_OF_KEYS) { self->keyActionBinding[keyActionIndex].key = key; self->keyActionBinding[keyActionIndex].argument = argument; self->keyActionBinding[keyActionIndex].action = action; } + else + { + returnValue = ERROR; + } + return returnValue; } 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 24edf81..f61514b 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 @@ -105,9 +105,9 @@ ErrorStatus repairProcess_construct(struct RepairProcess* self, struct RepairPro self->pid[2].initialized = false; - PID_construct(&self->pid[0], 5000, 3000, 5000, 0, 10000000); - PID_construct(&self->pid[1], 5000, 3000, 5000, 0, 100000000); - PID_construct(&self->pid[2], 5000, 3000, 5000, 0, 10000000); + PID_construct(&self->pid[0], 5000, 3000, 1000, 0, 10000000); + PID_construct(&self->pid[1], 5000, 3000, 1000, 0, 10000000); + PID_construct(&self->pid[2], 5000, 3000, 1000, 0, 10000000); LOGGER_INFO(mainLog, "Repair Process task started"); }