|
|
|
|
@@ -180,6 +180,7 @@ ErrorStatus repairMenu_construct(struct RepairMenu* self, struct MenuCore* menuC
|
|
|
|
|
if (menuCore->initialized)
|
|
|
|
|
{
|
|
|
|
|
self->menuCore = menuCore;
|
|
|
|
|
self->menuCore->parent = self;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@@ -210,12 +211,12 @@ ErrorStatus repairMenu_construct(struct RepairMenu* self, struct MenuCore* menuC
|
|
|
|
|
else if (PCBA_getInstance()->pcba == PCBA_Anode)
|
|
|
|
|
{
|
|
|
|
|
RepairPresets_loadPresets(REPAIR_PRESETS_ANODE);
|
|
|
|
|
self->repairPreset = RepairPresets_getPreset(1);
|
|
|
|
|
self->repairPreset = RepairPresets_getPreset(REPAIR_PRESETS_DEFAULT_PRESET);
|
|
|
|
|
}
|
|
|
|
|
else if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
|
|
|
|
{
|
|
|
|
|
RepairPresets_loadPresets(REPAIR_PRESETS_TESLA);
|
|
|
|
|
self->repairPreset = RepairPresets_getPreset(1);
|
|
|
|
|
self->repairPreset = RepairPresets_getPreset(REPAIR_PRESETS_DEFAULT_PRESET);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MenuCore_changeState(self->menuCore, RM_MAINMENU);
|
|
|
|
|
@@ -416,8 +417,30 @@ static void repairMenu_printPause(struct MenuCore* self)
|
|
|
|
|
|
|
|
|
|
static void repairMenu_printFinish(struct MenuCore* self)
|
|
|
|
|
{
|
|
|
|
|
Display_writeCentered(self->display, MenuText_FINISH[languageIndex][0], 2);
|
|
|
|
|
Display_writeCentered(self->display, MenuText_FINISH[languageIndex][1], 4);
|
|
|
|
|
char buffer[self->display->displayDevice->parameters.numberOfColumns];
|
|
|
|
|
buffer[0] = '\0';
|
|
|
|
|
int loopCounter;
|
|
|
|
|
bool printErrorMessage = false;
|
|
|
|
|
Display_writeCentered(self->display, MenuText_FINISH[languageIndex][0], 1);
|
|
|
|
|
|
|
|
|
|
// Check if any error has appeared
|
|
|
|
|
for (loopCounter = ((PCBA_getInstance()->pcba == PCBA_Tesla) ? 1 : 0); loopCounter <= ((PCBA_getInstance()->pcba == PCBA_Tesla) ? 1 : 2); loopCounter++)
|
|
|
|
|
{
|
|
|
|
|
if (((struct RepairMenu*)self->parent)->processResult[loopCounter])
|
|
|
|
|
{
|
|
|
|
|
printErrorMessage = true;
|
|
|
|
|
snprintf(buffer, sizeof(buffer), "%s %d ", buffer, loopCounter + 1); // +1 for human-readable row numbers
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Error string only needs single printing
|
|
|
|
|
if (printErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
Display_writeCentered(self->display, MenuText_FINISH[languageIndex][1], 2);
|
|
|
|
|
Display_writeCentered(self->display, buffer, 3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Display_writeCentered(self->display, MenuText_FINISH[languageIndex][2], 4);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1052,6 +1075,7 @@ static void repairMenu_teslagunBlock(struct MenuCore* self)
|
|
|
|
|
static void repairMenu_startRepairProcess(struct MenuCore* self)
|
|
|
|
|
{
|
|
|
|
|
ErrorStatus returnValue = SUCCESS;
|
|
|
|
|
int loopCounter;
|
|
|
|
|
|
|
|
|
|
struct RepairMenu* repairMenu = repairMenus_getMainRepairMenu();
|
|
|
|
|
|
|
|
|
|
@@ -1071,13 +1095,30 @@ static void repairMenu_startRepairProcess(struct MenuCore* self)
|
|
|
|
|
// If all is OK, start the repair process
|
|
|
|
|
if (returnValue == SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
// Check if a preset has been selected - otherwise go to default preset
|
|
|
|
|
if (repairMenu->repairPreset == NULL)
|
|
|
|
|
{
|
|
|
|
|
repairMenu->repairPreset = RepairPresets_getPreset(REPAIR_PRESETS_DEFAULT_PRESET);
|
|
|
|
|
}
|
|
|
|
|
returnValue = repairProcesses_startMainRepairProcess(repairMenu->repairPreset, &repairMenu->rpParameters);
|
|
|
|
|
|
|
|
|
|
if (returnValue != SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
Error_postError(REPAIR_FAIL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (returnValue == SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
((struct RepairMenu*)self->parent)->repairProcess = repairProcesses_getMainRepairProcess();
|
|
|
|
|
|
|
|
|
|
// Reset the test results (just in case)
|
|
|
|
|
for (loopCounter = ((PCBA_getInstance()->pcba == PCBA_Tesla) ? 1 : 0); loopCounter <= ((PCBA_getInstance()->pcba == PCBA_Tesla) ? 1 : 2); loopCounter++)
|
|
|
|
|
{
|
|
|
|
|
((struct RepairMenu*)self->parent)->processResult[loopCounter] = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (returnValue == SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
returnValue = repairProcesses_mainRepairProcessAddObserver(repairMenu->observer);
|
|
|
|
|
@@ -1136,6 +1177,7 @@ static void repairMenu_gotoLastState(struct MenuCore* self)
|
|
|
|
|
|
|
|
|
|
void repairMenu_menuStateHandle(struct MenuCore* self)
|
|
|
|
|
{
|
|
|
|
|
int loopCounter;
|
|
|
|
|
|
|
|
|
|
// Stop the buzzer from recovered error or warning
|
|
|
|
|
if (self->lastMenuState == RM_ERROR_STATE)
|
|
|
|
|
@@ -1188,6 +1230,26 @@ void repairMenu_menuStateHandle(struct MenuCore* self)
|
|
|
|
|
uint32_t remainingTime = repairProcess_getRemainingRepairTime(repairProcesses_getMainRepairProcess());
|
|
|
|
|
|
|
|
|
|
Led_on(LED_BICOLOR_GREEN);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// For the TESLA REPAIR, the tesla gun is only allowed to be released when the VOLTAGE HOLD state has been reached
|
|
|
|
|
// and the voltage is within the limits
|
|
|
|
|
if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
|
|
|
|
{
|
|
|
|
|
if (!TeslaGunSafety_isReleased())
|
|
|
|
|
{
|
|
|
|
|
if (repairProcesses_getMainRepairProcess()->signalProfileGenerator.currentState == SPG_VOLTAGE_HOLD)
|
|
|
|
|
{
|
|
|
|
|
if (!repairProcesses_getMainRepairProcess()->row[1].errorData.rowHasError)
|
|
|
|
|
{
|
|
|
|
|
TeslaGunSafety_release();
|
|
|
|
|
LOGGER_INFO(mainLog, "Tesla Gun is released");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (remainingTime > (2 * REPAIRMENU_POPUPSCREEN_TIME_MS / 1000))
|
|
|
|
|
{
|
|
|
|
|
self->popUpCounter = remainingTime - (2 * REPAIRMENU_POPUPSCREEN_TIME_MS / 1000);
|
|
|
|
|
@@ -1222,6 +1284,14 @@ void repairMenu_menuStateHandle(struct MenuCore* self)
|
|
|
|
|
}
|
|
|
|
|
else if (self->menuState == RM_FINISH_CONTROL)
|
|
|
|
|
{
|
|
|
|
|
LOGGER_DEBUG(mainLog, "Result %d %d %d", ((struct RepairMenu*)self->parent)->processResult[0], ((struct RepairMenu*)self->parent)->processResult[1], ((struct RepairMenu*)self->parent)->processResult[2]);
|
|
|
|
|
// Receive the final repair row status
|
|
|
|
|
for (loopCounter = ((PCBA_getInstance()->pcba == PCBA_Tesla) ? 1 : 0); loopCounter <= ((PCBA_getInstance()->pcba == PCBA_Tesla) ? 1 : 2); loopCounter++)
|
|
|
|
|
{
|
|
|
|
|
((struct RepairMenu*)self->parent)->processResult[loopCounter] = ((struct RepairMenu*)self->parent)->repairProcess->row[loopCounter].errorData.rowHasError;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
repairMenu_stopRepairProcess(self);
|
|
|
|
|
PowerLossDetector_clearBusyFlag();
|
|
|
|
|
MenuCore_changeState(self, RM_FINISH);
|
|
|
|
|
|