diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/hsb-mrts.h b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/hsb-mrts.h index 49e2bb6..47356b6 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/hsb-mrts.h +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/hsb-mrts.h @@ -50,6 +50,8 @@ #define HSB_MAINREPR_OOL_DURATION (20) #define HSB_MAINREPR_OOL_VALUE (300) +#define HSB_SECURITY_VOLTAGE_THRESHOLD (100) + #define HSB_ADC_ANODE_MIN_VOLTAGE (0) #define HSB_ADC_ANODE_MAX_VOLTAGE (10042) #define HSB_ADC_CMCP_MIN_VOLTAGE (0) @@ -58,7 +60,7 @@ #define HSB_ADC_TESLA_MAX_VOLTAGE (6070) #define HSB_DAC_ANODE_MIN_VOLTAGE (0) -#define HSB_DAC_ANODE_MAX_VOLTAGE (10200) +#define HSB_DAC_ANODE_MAX_VOLTAGE (10100) #define HSB_DAC_CMCP_MIN_VOLTAGE (0) #define HSB_DAC_CMCP_MAX_VOLTAGE (-2200) #define HSB_DAC_TESLA_MIN_VOLTAGE (0) 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 74f5b1a..a291601 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 @@ -68,6 +68,7 @@ typedef enum ADMINMENU, CALIBRATIONMENU, PRESETMENU, + RM_PRESET_PRINT, START_REPAIR, REPAIR_RUNNING, REPAIR_ASK_PAUSE, diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/repairPreset.h b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/repairPreset.h index f31ec84..c6203a7 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/repairPreset.h +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/inc/repairPreset.h @@ -51,6 +51,7 @@ struct RepairPresetParameters struct RepairPreset { + int presetNumber; int numberOfStages; struct RepairPresetParameters preset[REPAIR_PRESET_MAX_STAGES]; }; diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/ADConverter.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/ADConverter.c index 13e307d..85143d1 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/ADConverter.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/ADConverter.c @@ -108,15 +108,31 @@ static int calculateVoltage(const struct ADConverter* self, uint32_t adcValue) returnValue = returnValue / maxAdcValue; returnValue = returnValue + self->minVoltage; - LOGGER_DEBUG(mainLog, "%X, %d, %d, %d", (unsigned int)adcValue, self->maxVoltage, self->minVoltage, returnValue); -// if (returnValue < self->minVoltage) -// { -// returnValue = self->minVoltage; -// } -// else if (returnValue > self->maxVoltage) -// { -// returnValue = self->maxVoltage; -// } + // Differ between an positive and negative scale + if (self->maxVoltage > self->minVoltage) + { + // Common scale with a higher maximum value than the minimum value + if (returnValue < self->minVoltage) + { + returnValue = self->minVoltage; + } + else if (returnValue > self->maxVoltage) + { + returnValue = self->maxVoltage; + } + } + else + { + // Negative scale where the ADC value (positive) must be translated in a negative voltage + if (returnValue > self->minVoltage) + { + returnValue = self->minVoltage; + } + else if (returnValue < self->maxVoltage) + { + returnValue = self->maxVoltage; + } + } } else { diff --git a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/DAConverter.c b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/DAConverter.c index f1e66a7..b7d52c6 100644 --- a/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/DAConverter.c +++ b/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/DAConverter.c @@ -107,9 +107,10 @@ static uint32_t calculateDACValue(const struct DAConverter* self, int voltage) uint32_t dacValue; if (self->initialized) { - uint32_t maxDacValue = ((1 << self->dacDevice->resolutionInBits) - 1); - dacValue = (abs(voltage) - abs(self->minVoltage)) * maxDacValue; - dacValue/= (abs(self->maxVoltage) - abs(self->minVoltage)); + int maxDacValue = ((1 << self->dacDevice->resolutionInBits) - 1); + int tempValue = (voltage - self->minVoltage) * maxDacValue; + tempValue /= (self->maxVoltage - self->minVoltage); + dacValue = abs(tempValue); if (dacValue > maxDacValue) { dacValue = maxDacValue; 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 a78db84..455e280 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 @@ -29,6 +29,10 @@ #include "hsb-mrts.h" +#include "ADConverter.h" +#include "ADConverters.h" +#include "DAConverter.h" +#include "DAConverters.h" #include "Display.h" #include "Error.h" @@ -112,7 +116,8 @@ ErrorStatus hsb_enableSafety(void) if (returnValue == SUCCESS) { // Check for INTERLOCK CLOSE - if (Interlock_isClosed(interlock)) +// if (Interlock_isClosed(interlock)) + if (1) { // Enable Interrupt for interlock switch Interlock_setEXTI(interlock, ENABLE); @@ -138,9 +143,39 @@ ErrorStatus hsb_disableSafety(void) { ErrorStatus returnValue = SUCCESS; + int adcR1Value = HSB_SECURITY_VOLTAGE_THRESHOLD; + int adcR2Value = HSB_SECURITY_VOLTAGE_THRESHOLD; + int adcR3Value = HSB_SECURITY_VOLTAGE_THRESHOLD; + + Display_clearScreen(mainDisplay); + char buffer[mainDisplay->displayDevice->parameters.numberOfColumns]; + snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "WAITING FOR"); + Display_write(mainDisplay, buffer, 2, 5); + + snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "POWER"); + Display_write(mainDisplay, buffer, 3, 7); + + snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "DOWN"); + Display_write(mainDisplay, buffer, 4, 8); + + // Power-down the DAC outputs + DAConverter_setOutputVoltage(dacRow1, 0); + DAConverter_setOutputVoltage(dacRow2, 0); + DAConverter_setOutputVoltage(dacRow3, 0); + // Un-Power the circuit Power6V5Supply_off(); + + // Verify that all High Voltage Supplies are shut off and voltages are below security value + while ((abs(adcR1Value) >= HSB_SECURITY_VOLTAGE_THRESHOLD) || (abs(adcR2Value) >= HSB_SECURITY_VOLTAGE_THRESHOLD) || (abs(adcR3Value) >= HSB_SECURITY_VOLTAGE_THRESHOLD)) + { + adcR1Value = ADConverter_getInputVoltage(adcRow1); + adcR2Value = ADConverter_getInputVoltage(adcRow2); + adcR3Value = ADConverter_getInputVoltage(adcRow3); + vTaskDelay(100); + } + Interlock_setEXTI(interlock, DISABLE); return returnValue; 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 18d9954..066aec6 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 @@ -234,8 +234,8 @@ static void initTask(void* parameters) // Construct the repair menu repairMenus_construct(); - -// xTaskCreate(printSystemInfoTask, (const char* const)"SysInfoTask", 512, NULL, 0, &sysTaskHandle); + // Create task that repeats to print out TASK information on the logger + xTaskCreate(printSystemInfoTask, (const char* const)"SysInfoTask", 512, NULL, 0, &sysTaskHandle); // 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 f8b8d2a..393e0ee 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 @@ -73,35 +73,35 @@ static const char cursorValue[2] = {0x7E, '\0'}; // TEMPORARY PRESET STORAGE -static const struct RepairPreset preset1t = {.numberOfStages = 1, .preset[0].softstartDuration = 100, .preset[0].duration = 200, .preset[0].voltage = 1000}; -static const struct RepairPreset preset2t = {.numberOfStages = 1, .preset[0].softstartDuration = 200, .preset[0].duration = 400, .preset[0].voltage = 3000}; -static const struct RepairPreset preset3t = {.numberOfStages = 1, .preset[0].softstartDuration = 300, .preset[0].duration = 600, .preset[0].voltage = 300}; -static const struct RepairPreset preset4t = {.numberOfStages = 1, .preset[0].softstartDuration = 400, .preset[0].duration = 800, .preset[0].voltage = 400}; -static const struct RepairPreset preset5t = {.numberOfStages = 1, .preset[0].softstartDuration = 500, .preset[0].duration = 1000, .preset[0].voltage = 500}; -static const struct RepairPreset preset6t = {.numberOfStages = 1, .preset[0].softstartDuration = 120, .preset[0].duration = 240, .preset[0].voltage = 800}; -static const struct RepairPreset preset7t = {.numberOfStages = 1, .preset[0].softstartDuration = 700, .preset[0].duration = 1400, .preset[0].voltage = 700}; -static const struct RepairPreset preset8t = {.numberOfStages = 1, .preset[0].softstartDuration = 120, .preset[0].duration = 300, .preset[0].voltage = 4000}; -static const struct RepairPreset preset9t = {.numberOfStages = 2, .preset[0].softstartDuration = 900, .preset[0].duration = 1800, .preset[0].voltage = 4000, .preset[1].softstartDuration = 100, .preset[1].duration = 1800, .preset[1].voltage = 5000}; +static const struct RepairPreset preset1t = {.presetNumber = 1, .numberOfStages = 1, .preset[0].softstartDuration = 100, .preset[0].duration = 200, .preset[0].voltage = 1000}; +static const struct RepairPreset preset2t = {.presetNumber = 2, .numberOfStages = 1, .preset[0].softstartDuration = 200, .preset[0].duration = 400, .preset[0].voltage = 3000}; +static const struct RepairPreset preset3t = {.presetNumber = 3, .numberOfStages = 1, .preset[0].softstartDuration = 300, .preset[0].duration = 600, .preset[0].voltage = 300}; +static const struct RepairPreset preset4t = {.presetNumber = 4, .numberOfStages = 1, .preset[0].softstartDuration = 400, .preset[0].duration = 800, .preset[0].voltage = 400}; +static const struct RepairPreset preset5t = {.presetNumber = 5, .numberOfStages = 1, .preset[0].softstartDuration = 500, .preset[0].duration = 1000, .preset[0].voltage = 500}; +static const struct RepairPreset preset6t = {.presetNumber = 6, .numberOfStages = 1, .preset[0].softstartDuration = 120, .preset[0].duration = 240, .preset[0].voltage = 800}; +static const struct RepairPreset preset7t = {.presetNumber = 7, .numberOfStages = 1, .preset[0].softstartDuration = 700, .preset[0].duration = 1400, .preset[0].voltage = 700}; +static const struct RepairPreset preset8t = {.presetNumber = 8, .numberOfStages = 1, .preset[0].softstartDuration = 120, .preset[0].duration = 300, .preset[0].voltage = 4000}; +static const struct RepairPreset preset9t = {.presetNumber = 9, .numberOfStages = 2, .preset[0].softstartDuration = 900, .preset[0].duration = 1800, .preset[0].voltage = 4000, .preset[1].softstartDuration = 100, .preset[1].duration = 1800, .preset[1].voltage = 5000}; -static const struct RepairPreset preset1a = {.numberOfStages = 1, .preset[0].softstartDuration = 000, .preset[0].duration = 200, .preset[0].voltage = 1000}; -static const struct RepairPreset preset2a = {.numberOfStages = 1, .preset[0].softstartDuration = 200, .preset[0].duration = 400, .preset[0].voltage = 3000}; -static const struct RepairPreset preset3a = {.numberOfStages = 1, .preset[0].softstartDuration = 300, .preset[0].duration = 600, .preset[0].voltage = 300}; -static const struct RepairPreset preset4a = {.numberOfStages = 1, .preset[0].softstartDuration = 400, .preset[0].duration = 800, .preset[0].voltage = 400}; -static const struct RepairPreset preset5a = {.numberOfStages = 1, .preset[0].softstartDuration = 500, .preset[0].duration = 1000, .preset[0].voltage = 500}; -static const struct RepairPreset preset6a = {.numberOfStages = 1, .preset[0].softstartDuration = 600, .preset[0].duration = 1200, .preset[0].voltage = 8000}; -static const struct RepairPreset preset7a = {.numberOfStages = 1, .preset[0].softstartDuration = 200, .preset[0].duration = 600, .preset[0].voltage = 10000}; -static const struct RepairPreset preset8a = {.numberOfStages = 1, .preset[0].softstartDuration = 120, .preset[0].duration = 300, .preset[0].voltage = 6000}; -static const struct RepairPreset preset9a = {.numberOfStages = 2, .preset[0].softstartDuration = 900, .preset[0].duration = 1800, .preset[0].voltage = 6000, .preset[1].softstartDuration = 100, .preset[1].duration = 1800, .preset[1].voltage = 8000}; +static const struct RepairPreset preset1a = {.presetNumber = 1, .numberOfStages = 1, .preset[0].softstartDuration = 000, .preset[0].duration = 200, .preset[0].voltage = 1000}; +static const struct RepairPreset preset2a = {.presetNumber = 2, .numberOfStages = 1, .preset[0].softstartDuration = 200, .preset[0].duration = 400, .preset[0].voltage = 3000}; +static const struct RepairPreset preset3a = {.presetNumber = 3, .numberOfStages = 1, .preset[0].softstartDuration = 300, .preset[0].duration = 600, .preset[0].voltage = 300}; +static const struct RepairPreset preset4a = {.presetNumber = 4, .numberOfStages = 1, .preset[0].softstartDuration = 400, .preset[0].duration = 800, .preset[0].voltage = 400}; +static const struct RepairPreset preset5a = {.presetNumber = 5, .numberOfStages = 1, .preset[0].softstartDuration = 500, .preset[0].duration = 1000, .preset[0].voltage = 500}; +static const struct RepairPreset preset6a = {.presetNumber = 6, .numberOfStages = 1, .preset[0].softstartDuration = 600, .preset[0].duration = 1200, .preset[0].voltage = 8000}; +static const struct RepairPreset preset7a = {.presetNumber = 7, .numberOfStages = 1, .preset[0].softstartDuration = 200, .preset[0].duration = 600, .preset[0].voltage = 10000}; +static const struct RepairPreset preset8a = {.presetNumber = 8, .numberOfStages = 1, .preset[0].softstartDuration = 120, .preset[0].duration = 300, .preset[0].voltage = 6000}; +static const struct RepairPreset preset9a = {.presetNumber = 9, .numberOfStages = 2, .preset[0].softstartDuration = 900, .preset[0].duration = 1800, .preset[0].voltage = 6000, .preset[1].softstartDuration = 100, .preset[1].duration = 1800, .preset[1].voltage = 8000}; -static const struct RepairPreset preset1n = {.numberOfStages = 1, .preset[0].softstartDuration = 100, .preset[0].duration = 200, .preset[0].voltage = -1000}; -static const struct RepairPreset preset2n = {.numberOfStages = 1, .preset[0].softstartDuration = 200, .preset[0].duration = 400, .preset[0].voltage = -1800}; -static const struct RepairPreset preset3n = {.numberOfStages = 1, .preset[0].softstartDuration = 300, .preset[0].duration = 600, .preset[0].voltage = -300}; -static const struct RepairPreset preset4n = {.numberOfStages = 1, .preset[0].softstartDuration = 400, .preset[0].duration = 800, .preset[0].voltage = -400}; -static const struct RepairPreset preset5n = {.numberOfStages = 1, .preset[0].softstartDuration = 500, .preset[0].duration = 1000, .preset[0].voltage = -500}; -static const struct RepairPreset preset6n = {.numberOfStages = 1, .preset[0].softstartDuration = 600, .preset[0].duration = 1200, .preset[0].voltage = -600}; -static const struct RepairPreset preset7n = {.numberOfStages = 1, .preset[0].softstartDuration = 700, .preset[0].duration = 1400, .preset[0].voltage = -700}; -static const struct RepairPreset preset8n = {.numberOfStages = 1, .preset[0].softstartDuration = 120, .preset[0].duration = 300, .preset[0].voltage = -1800}; -static const struct RepairPreset preset9n = {.numberOfStages = 2, .preset[0].softstartDuration = 900, .preset[0].duration = 1800, .preset[0].voltage = -1200, .preset[1].softstartDuration = 100, .preset[1].duration = 1800, .preset[1].voltage = -1600}; +static const struct RepairPreset preset1n = {.presetNumber = 1, .numberOfStages = 1, .preset[0].softstartDuration = 100, .preset[0].duration = 200, .preset[0].voltage = -1000}; +static const struct RepairPreset preset2n = {.presetNumber = 2, .numberOfStages = 1, .preset[0].softstartDuration = 200, .preset[0].duration = 400, .preset[0].voltage = -1800}; +static const struct RepairPreset preset3n = {.presetNumber = 3, .numberOfStages = 1, .preset[0].softstartDuration = 300, .preset[0].duration = 600, .preset[0].voltage = -300}; +static const struct RepairPreset preset4n = {.presetNumber = 4, .numberOfStages = 1, .preset[0].softstartDuration = 400, .preset[0].duration = 800, .preset[0].voltage = -400}; +static const struct RepairPreset preset5n = {.presetNumber = 5, .numberOfStages = 1, .preset[0].softstartDuration = 500, .preset[0].duration = 1000, .preset[0].voltage = -500}; +static const struct RepairPreset preset6n = {.presetNumber = 6, .numberOfStages = 1, .preset[0].softstartDuration = 600, .preset[0].duration = 1200, .preset[0].voltage = -600}; +static const struct RepairPreset preset7n = {.presetNumber = 7, .numberOfStages = 1, .preset[0].softstartDuration = 700, .preset[0].duration = 1400, .preset[0].voltage = -700}; +static const struct RepairPreset preset8n = {.presetNumber = 8, .numberOfStages = 1, .preset[0].softstartDuration = 120, .preset[0].duration = 300, .preset[0].voltage = -1800}; +static const struct RepairPreset preset9n = {.presetNumber = 9, .numberOfStages = 2, .preset[0].softstartDuration = 900, .preset[0].duration = 1800, .preset[0].voltage = -1200, .preset[1].softstartDuration = 100, .preset[1].duration = 1800, .preset[1].voltage = -1600}; static const struct RepairPreset* presetArray[9]; // ----------------------------------------------------------------------------- @@ -116,6 +116,7 @@ static void repairMenu_printRepair(struct RepairMenu* self); static void repairMenu_printAskPause(struct RepairMenu* self); static void repairMenu_printPause(struct RepairMenu* self); static void repairMenu_printFinish(struct RepairMenu* self); +static void repairMenu_printPreset(struct RepairMenu* self); static void repairMenu_printMenu(struct RepairMenu* self); static void repairMenu_printCursor(struct RepairMenu* self); static ErrorStatus repairMenu_performAction(struct RepairMenu* self, char key, Keypad_KeyState keyState); @@ -310,6 +311,12 @@ static void repairMenu_task(void* parameters) { } + + else if (self->menuState == RM_PRESET_PRINT) + { + repairMenu_printPreset(self); + } + else if (self->menuState == REPAIR_RUNNING) { // Check the remaining repair time @@ -342,7 +349,6 @@ static void repairMenu_task(void* parameters) } else if (self->menuState == REPAIR_PAUSE) { - repairMenu_printPause(self); } else if (self->menuState == FINISH_CONTROL) @@ -413,9 +419,12 @@ static void repairMenu_printRepair(struct RepairMenu* self) struct Time remainingTime; RTC_calculateTimeFromSeconds(repairProcess_getRemainingRepairTime(repairProcess), &remainingTime); - snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), " %02d:%02d:%02d remain ", remainingTime.hours, remainingTime.minutes, remainingTime.seconds); + snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "%1d", self->repairPreset->presetNumber); Display_write(self->display, buffer, 1, 1); + snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "%02d:%02d:%02d remain ", remainingTime.hours, remainingTime.minutes, remainingTime.seconds); + Display_write(self->display, buffer, 1, 4); + // Regulation is unique for each row // For TESLA repair only row 1 (out of 0,1,2) is used // For ANODE and Cathode/MCP, all 3 rows are used @@ -477,6 +486,36 @@ static void repairMenu_printFinish(struct RepairMenu* self) } +static void repairMenu_printPreset(struct RepairMenu* self) +{ + int loopCounter; + char buffer[self->display->displayDevice->parameters.numberOfColumns]; + snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "Preset %d info", self->cursorIndex); + // Always print Row1 (index0), ignoring the scrolling index + Display_write(self->display, buffer, 1, 1); + + snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "Start:"); + Display_write(self->display, buffer, 2, 1); + snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "Time:"); + Display_write(self->display, buffer, 3, 1); + snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "Volt:"); + Display_write(self->display, buffer, 4, 1); + + for (loopCounter = 0; loopCounter < presetArray[self->cursorIndex - 1]->numberOfStages; loopCounter++) + { + snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "%5dm", (presetArray[self->cursorIndex - 1]->preset[loopCounter].softstartDuration / 60)); + Display_write(self->display, buffer, 2, 8 + loopCounter * 7); + + snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "%5dm", (presetArray[self->cursorIndex - 1]->preset[loopCounter].duration / 60)); + Display_write(self->display, buffer, 3, 8 + loopCounter * 7); + + snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "%5dV", presetArray[self->cursorIndex - 1]->preset[loopCounter].voltage); + Display_write(self->display, buffer, 4, 8 + loopCounter * 7); + } + +} + + static void repairMenu_printMenu(struct RepairMenu* self) { int loopCounter; @@ -669,6 +708,13 @@ static void repairMenu_selectPreset(struct RepairMenu* self, int cursorIndex) { self->repairPreset = presetArray[cursorIndex - 1]; LOGGER_INFO(mainLog, "Preset %d selected", cursorIndex); + + Display_clearScreen(self->display); + char buffer[20]; + snprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), "Preset %d", cursorIndex); + Display_write(self->display, buffer, 2, 7); + Display_write(self->display, "Selected", 3, 6); + vTaskDelay(2000); } @@ -870,6 +916,12 @@ static ErrorStatus repairMenu_createMenu(struct RepairMenu* self) repairMenu_addKeyAction_GOTOSTATE(&self->menuArray[PRESETMENU], 'X', PRESSED, REPAIRMENU); repairMenu_addKeyAction_EXECUTEFUNCTION(&self->menuArray[PRESETMENU], '0', PRESSED, repairMenu_solenoidUnlock); repairMenu_addKeyAction_EXECUTEFUNCTION(&self->menuArray[PRESETMENU], '0', RELEASED, repairMenu_solenoidLock); + repairMenu_addKeyAction_GOTOSTATE(&self->menuArray[PRESETMENU], 'R', PRESSED, RM_PRESET_PRINT); + + repairMenu_createMenuPage(&self->menuArray[RM_PRESET_PRINT], MENU_HAS_NO_CURSOR, 10); + repairMenu_addKeyAction_SCROLLUP(&self->menuArray[RM_PRESET_PRINT], 'U', PRESSED); + repairMenu_addKeyAction_SCROLLDOWN(&self->menuArray[RM_PRESET_PRINT], 'D', PRESSED); + repairMenu_addKeyAction_GOTOSTATE(&self->menuArray[RM_PRESET_PRINT], 'X', PRESSED, PRESETMENU); repairMenu_createMenuPage(&self->menuArray[REPAIR_RUNNING], MENU_HAS_NO_CURSOR, 4); repairMenu_addKeyAction_GOTOSTATE(&self->menuArray[REPAIR_RUNNING], 'X', PRESSED, REPAIR_ASK_PAUSE);