Added calibration setpoints

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@417 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2018-01-11 13:55:17 +00:00
parent 9915a5a349
commit 1bbfa1c7f3
22 changed files with 993 additions and 114 deletions

View File

@@ -33,6 +33,10 @@
#include "PIDParameters.h"
#include "PowerLossDetector.h"
#include "repairMenu.h"
#include "CalibrationParameters.h"
#include "CalibrationSetpoint.h"
#include "CalibrationSetpoints.h"
#include "repairMenus.h"
#include "RepairPreset.h"
#include "repairProcess.h"
@@ -135,6 +139,8 @@ static void repairMenu_configPID(struct MenuCore* self);
static void repairMenu_configConfirmPIDKp(struct MenuCore* self);
static void repairMenu_configConfirmPIDKi(struct MenuCore* self);
static void repairMenu_configConfirmPIDKd(struct MenuCore* self);
static void repairMenu_setDACToLowSetpoint(struct MenuCore* self);
static void repairMenu_setDACToHighSetpoint(struct MenuCore* self);
static void repairMenu_printPINVerification(struct MenuCore* self);
static void repairMenu_printVoltageOutput(struct MenuCore* self);
static void repairMenu_printPIDConstants(struct MenuCore* self);
@@ -142,7 +148,9 @@ static void repairMenu_printInfo(struct MenuCore* self);
static void repairMenu_confirmCalibrationPin(struct MenuCore* self);
static void repairMenu_selectCathodeRepair(struct MenuCore* self);
static void repairMenu_selectCathodeCalibration(struct MenuCore* self);
static void repairMenu_selectMCPRepair(struct MenuCore* self);
static void repairMenu_selectMCPCalibration(struct MenuCore* self);
static void repairMenu_selectPreset(struct MenuCore* self);
static void repairMenu_solenoidLock(struct MenuCore* self);
static void repairMenu_solenoidUnlock(struct MenuCore* self);
@@ -286,6 +294,10 @@ void repairMenu_printCRCFailure(struct RepairMenu* self, T_ErrorCode errorCode)
{
snprintf(self->menuCore->errorMessage, sizeof(self->menuCore->errorMessage) / sizeof(self->menuCore->errorMessage[0]), MenuText_ERROR_CRC_PARAMETERS[languageIndex]);
}
else if (errorCode == ERROR_CRC_CALIBRATION)
{
snprintf(self->menuCore->errorMessage, sizeof(self->menuCore->errorMessage) / sizeof(self->menuCore->errorMessage[0]), MenuText_ERROR_CRC_CALIBRATION[languageIndex]);
}
else if (errorCode == ERROR_CRC_PRESETS)
{
snprintf(self->menuCore->errorMessage, sizeof(self->menuCore->errorMessage) / sizeof(self->menuCore->errorMessage[0]), MenuText_ERROR_CRC_PRESETS[languageIndex]);
@@ -807,6 +819,33 @@ static void repairMenu_configConfirmPIDKd(struct MenuCore* self)
}
static void repairMenu_setDACToLowSetpoint(struct MenuCore* self)
{
struct CalibrationSetpoints* tempSetpoints = CalibrationParameters_getCalibrationSetpoints();
struct CalibrationSetpoint* tempSetpoint = CalibrationSetpoints_getActiveSetpointSet(tempSetpoints);
if (PCBA_getInstance()->pcba != PCBA_Tesla)
{
DAConverter_setOutputVoltage(dacRow1, tempSetpoint->low);
DAConverter_setOutputVoltage(dacRow3, tempSetpoint->low);
}
DAConverter_setOutputVoltage(dacRow2, tempSetpoint->low);
}
static void repairMenu_setDACToHighSetpoint(struct MenuCore* self)
{
struct CalibrationSetpoints* tempSetpoints = CalibrationParameters_getCalibrationSetpoints();
struct CalibrationSetpoint* tempSetpoint = CalibrationSetpoints_getActiveSetpointSet(tempSetpoints);
if (PCBA_getInstance()->pcba != PCBA_Tesla)
{
DAConverter_setOutputVoltage(dacRow1, tempSetpoint->high);
DAConverter_setOutputVoltage(dacRow3, tempSetpoint->high);
}
DAConverter_setOutputVoltage(dacRow2, tempSetpoint->high);
}
static void repairMenu_printAdminVoltageInput(struct MenuCore* self)
{
char buffer[self->display->displayDevice->parameters.numberOfColumns + 1];
@@ -934,20 +973,45 @@ static void repairMenu_confirmCalibrationPin(struct MenuCore* self)
static void repairMenu_selectCathodeRepair(struct MenuCore* self)
{
RepairPresets_loadPresets(REPAIR_PRESETS_CATHODE);
struct RepairMenu* tempMenu = repairMenus_getMainRepairMenu();
tempMenu->repairPreset = RepairPresets_getPreset(1);
// struct RepairMenu* tempMenu = repairMenus_getMainRepairMenu();
// tempMenu->repairPreset = RepairPresets_getPreset(1);
CathodeMCP_switchToCathode();
}
static void repairMenu_selectPCBACalibration(struct MenuCore* self)
{
struct CalibrationSetpoints* tempSetpoints = CalibrationParameters_getCalibrationSetpoints();
if (PCBA_getInstance()->pcba == PCBA_Anode)
{
CalibrationSetpoints_setActiveSetpointSet(tempSetpoints, CALIBRATION_SETPOINT_ANODE);
}
else if (PCBA_getInstance()->pcba == PCBA_Tesla)
{
CalibrationSetpoints_setActiveSetpointSet(tempSetpoints, CALIBRATION_SETPOINT_TESLA);
}
}
static void repairMenu_selectCathodeCalibration(struct MenuCore* self)
{
struct CalibrationSetpoints* tempSetpoints = CalibrationParameters_getCalibrationSetpoints();
CalibrationSetpoints_setActiveSetpointSet(tempSetpoints, CALIBRATION_SETPOINT_CATHODE);
}
static void repairMenu_selectMCPRepair(struct MenuCore* self)
{
RepairPresets_loadPresets(REPAIR_PRESETS_MCP);
struct RepairMenu* tempMenu = repairMenus_getMainRepairMenu();
tempMenu->repairPreset = RepairPresets_getPreset(1);
// struct RepairMenu* tempMenu = repairMenus_getMainRepairMenu();
// tempMenu->repairPreset = RepairPresets_getPreset(1);
CathodeMCP_switchToMCP();
}
static void repairMenu_selectMCPCalibration(struct MenuCore* self)
{
struct CalibrationSetpoints* tempSetpoints = CalibrationParameters_getCalibrationSetpoints();
CalibrationSetpoints_setActiveSetpointSet(tempSetpoints, CALIBRATION_SETPOINT_MCP);
}
static void repairMenu_selectPreset(struct MenuCore* self)
{
@@ -1568,6 +1632,16 @@ void repairMenu_menuStateHandle(struct MenuCore* self)
Display_writeCentered(self->display, MenuText_VOLTAGE_OUT_CLEANUP[languageIndex][1], 4);
}
else if (self->menuState == RM_CALIBRATION_SETPOINT_LOW)
{
repairMenu_printVoltageOutput(self);
}
else if (self->menuState == RM_CALIBRATION_SETPOINT_HIGH)
{
repairMenu_printVoltageOutput(self);
}
}
@@ -2247,12 +2321,73 @@ void repairMenu_createMenuEntries(struct MenuCore* menuCore)
MenuElements_createMenuPage(&menuCore->menuArray[RM_CALIBRATIONMENU], MENU_HAS_NO_CURSOR, 2);
MenuElements_createMenuPage(&menuCore->menuArray[RM_CALIBRATIONMENU], MENU_HAS_CURSOR, 2);
MenuElements_addMenuPageRow(&menuCore->menuArray[RM_CALIBRATIONMENU], MenuText_CALIBRATIONMENU[languageIndex][0], RM_CALIBRATIONMENU, NULL);
MenuElements_addMenuPageRow(&menuCore->menuArray[RM_CALIBRATIONMENU], MenuText_CALIBRATIONMENU[languageIndex][1], RM_CALIBRATIONMENU, NULL);
if (PCBA_getInstance()->pcba == PCBA_CathodeMCP)
{
// For Cathode/MCP PCBA, the type of repair must be selected first
MenuElements_addMenuPageRow(&menuCore->menuArray[RM_CALIBRATIONMENU], MenuText_CALIBRATIONMENU[languageIndex][1], RM_CALIBRATION_CATHOEMCP_SELECT, NULL);
}
else
{
MenuElements_addMenuPageRow(&menuCore->menuArray[RM_CALIBRATIONMENU], MenuText_CALIBRATIONMENU[languageIndex][1], RM_CALIBRATION_SETPOINT_MENU, repairMenu_selectPCBACalibration);
}
MenuElements_addKeyAction_SCROLLUP(&menuCore->menuArray[RM_CALIBRATIONMENU], 'U', PRESSED);
MenuElements_addKeyAction_SCROLLDOWN(&menuCore->menuArray[RM_CALIBRATIONMENU], 'D', PRESSED);
MenuElements_addKeyAction_SELECT(&menuCore->menuArray[RM_CALIBRATIONMENU], 'E', PRESSED);
MenuElements_addKeyAction_HOTKEYSELECT(&menuCore->menuArray[RM_CALIBRATIONMENU], '1', PRESSED, 1);
MenuElements_addKeyAction_GOTOSTATE(&menuCore->menuArray[RM_CALIBRATIONMENU], 'X', PRESSED, RM_MAINMENU);
/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------
* Cathode / MCP selection
* This screen is only required for CATHODE/MCP PCBAs and allows selection between these two repair methods
*
* Key '0' allows control of the Solenoids - Hold to open, release to close
* -------------------------------------------------------------------------------------------------------------------------------------------------------------------
*/
MenuElements_createMenuPage(&menuCore->menuArray[RM_CALIBRATION_CATHOEMCP_SELECT], MENU_HAS_CURSOR, 4);
MenuElements_addMenuPageRow(&menuCore->menuArray[RM_CALIBRATION_CATHOEMCP_SELECT], MenuText_CATHODEMCP_SELECT[languageIndex][0], RM_CALIBRATION_CATHOEMCP_SELECT, NULL);
MenuElements_addMenuPageRow(&menuCore->menuArray[RM_CALIBRATION_CATHOEMCP_SELECT], MenuText_CATHODEMCP_SELECT[languageIndex][1], RM_CALIBRATION_SETPOINT_MENU, repairMenu_selectCathodeCalibration);
MenuElements_addMenuPageRow(&menuCore->menuArray[RM_CALIBRATION_CATHOEMCP_SELECT], MenuText_CATHODEMCP_SELECT[languageIndex][2], RM_CALIBRATION_SETPOINT_MENU, repairMenu_selectMCPCalibration);
MenuElements_addKeyAction_SCROLLUP(&menuCore->menuArray[RM_CALIBRATION_CATHOEMCP_SELECT], 'U', PRESSED);
MenuElements_addKeyAction_SCROLLDOWN(&menuCore->menuArray[RM_CALIBRATION_CATHOEMCP_SELECT], 'D', PRESSED);
MenuElements_addKeyAction_SELECT(&menuCore->menuArray[RM_CALIBRATION_CATHOEMCP_SELECT], 'E', PRESSED);
MenuElements_addKeyAction_HOTKEYSELECT(&menuCore->menuArray[RM_CALIBRATION_CATHOEMCP_SELECT], '1', PRESSED, 1);
MenuElements_addKeyAction_HOTKEYSELECT(&menuCore->menuArray[RM_CALIBRATION_CATHOEMCP_SELECT], '2', PRESSED, 2);
MenuElements_addKeyAction_GOTOSTATE(&menuCore->menuArray[RM_CALIBRATION_CATHOEMCP_SELECT], 'X', PRESSED, RM_CALIBRATIONMENU);
/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------
* Calibration setpoint selection
* -------------------------------------------------------------------------------------------------------------------------------------------------------------------
*/
MenuElements_createMenuPage(&menuCore->menuArray[RM_CALIBRATION_SETPOINT_MENU], MENU_HAS_CURSOR, 3);
MenuElements_addMenuPageRow(&menuCore->menuArray[RM_CALIBRATION_SETPOINT_MENU], MenuText_CALIBRATION_SETPOINTMENU[languageIndex][0], RM_CALIBRATION_SETPOINT_MENU, NULL);
MenuElements_addMenuPageRow(&menuCore->menuArray[RM_CALIBRATION_SETPOINT_MENU], MenuText_CALIBRATION_SETPOINTMENU[languageIndex][1], RM_CALIBRATION_SETPOINT_LOW, repairMenu_setDACToLowSetpoint);
MenuElements_addMenuPageRow(&menuCore->menuArray[RM_CALIBRATION_SETPOINT_MENU], MenuText_CALIBRATION_SETPOINTMENU[languageIndex][2], RM_CALIBRATION_SETPOINT_HIGH, repairMenu_setDACToHighSetpoint);
MenuElements_addKeyAction_SCROLLUP(&menuCore->menuArray[RM_CALIBRATION_SETPOINT_MENU], 'U', PRESSED);
MenuElements_addKeyAction_SCROLLDOWN(&menuCore->menuArray[RM_CALIBRATION_SETPOINT_MENU], 'D', PRESSED);
MenuElements_addKeyAction_SELECT(&menuCore->menuArray[RM_CALIBRATION_SETPOINT_MENU], 'E', PRESSED);
MenuElements_addKeyAction_HOTKEYSELECT(&menuCore->menuArray[RM_CALIBRATION_SETPOINT_MENU], '1', PRESSED, 1);
MenuElements_addKeyAction_HOTKEYSELECT(&menuCore->menuArray[RM_CALIBRATION_SETPOINT_MENU], '2', PRESSED, 2);
MenuElements_addKeyAction_GOTOSTATE(&menuCore->menuArray[RM_CALIBRATION_SETPOINT_MENU], 'X', PRESSED, RM_CALIBRATIONMENU);
/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------
* Calibration LOW setpoint
* -------------------------------------------------------------------------------------------------------------------------------------------------------------------
*/
MenuElements_createMenuPage(&menuCore->menuArray[RM_CALIBRATION_SETPOINT_LOW], MENU_HAS_NO_CURSOR, 3);
MenuElements_addKeyAction_GOTOSTATE(&menuCore->menuArray[RM_CALIBRATION_SETPOINT_LOW], 'X', PRESSED, RM_CALIBRATION_SETPOINT_MENU);
/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------
* Calibration HIGH setpoint
* -------------------------------------------------------------------------------------------------------------------------------------------------------------------
*/
MenuElements_createMenuPage(&menuCore->menuArray[RM_CALIBRATION_SETPOINT_HIGH], MENU_HAS_NO_CURSOR, 3);
MenuElements_addKeyAction_GOTOSTATE(&menuCore->menuArray[RM_CALIBRATION_SETPOINT_HIGH], 'X', PRESSED, RM_CALIBRATION_SETPOINT_MENU);
MenuElements_createMenuPage(&menuCore->menuArray[RM_REPAIR_RUNNING], MENU_HAS_NO_CURSOR, 4);
MenuElements_addKeyAction_GOTOSTATE(&menuCore->menuArray[RM_REPAIR_RUNNING], 'X', PRESSED, RM_REPAIR_ASK_PAUSE);