Updated menu. Can now preview presets and preset number is shown when selected and when repair is in process
Fixed negative value handling in DAConverter and ADConverter git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@267 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user