Added calibration setpoints
git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@417 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-1529458100419697121" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-588156928289845281" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
@@ -16,7 +16,7 @@
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-1529458100419697121" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-588156928289845281" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
||||
@@ -127,66 +127,66 @@ ErrorStatus Keypad_construct(struct Keypad* self, size_t numberOfRows, size_t nu
|
||||
LOGGER_INFO(mainLog, "Keypad task started");
|
||||
self->initialized = true;
|
||||
|
||||
// TUBE REPAIR
|
||||
struct KeypadQueueItem rxQueueItem;
|
||||
rxQueueItem.rowCoordinate = 0;
|
||||
rxQueueItem.columnCoordinate = 0;
|
||||
rxQueueItem.keyEvent = PRESSED;
|
||||
// Put event in queue
|
||||
xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
rxQueueItem.rowCoordinate = 0;
|
||||
rxQueueItem.columnCoordinate = 0;
|
||||
rxQueueItem.keyEvent = RELEASED;
|
||||
// Put event in queue
|
||||
xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
|
||||
// SELECT CATHODE
|
||||
rxQueueItem.rowCoordinate = 0;
|
||||
rxQueueItem.columnCoordinate = 0;
|
||||
rxQueueItem.keyEvent = PRESSED;
|
||||
// Put event in queue
|
||||
xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
rxQueueItem.rowCoordinate = 0;
|
||||
rxQueueItem.columnCoordinate = 0;
|
||||
rxQueueItem.keyEvent = RELEASED;
|
||||
// Put event in queue
|
||||
xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
|
||||
// SELECT PRESET
|
||||
rxQueueItem.rowCoordinate = 0;
|
||||
rxQueueItem.columnCoordinate = 0;
|
||||
rxQueueItem.keyEvent = PRESSED;
|
||||
// Put event in queue
|
||||
xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
rxQueueItem.rowCoordinate = 0;
|
||||
rxQueueItem.columnCoordinate = 0;
|
||||
rxQueueItem.keyEvent = RELEASED;
|
||||
// Put event in queue
|
||||
xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
|
||||
// SELECT PRESET 7
|
||||
rxQueueItem.rowCoordinate = 2;
|
||||
rxQueueItem.columnCoordinate = 0;
|
||||
rxQueueItem.keyEvent = PRESSED;
|
||||
// Put event in queue
|
||||
xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
rxQueueItem.rowCoordinate = 2;
|
||||
rxQueueItem.columnCoordinate = 0;
|
||||
rxQueueItem.keyEvent = RELEASED;
|
||||
// Put event in queue
|
||||
xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
|
||||
// START
|
||||
rxQueueItem.rowCoordinate = 0;
|
||||
rxQueueItem.columnCoordinate = 1;
|
||||
rxQueueItem.keyEvent = PRESSED;
|
||||
// Put event in queue
|
||||
xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
rxQueueItem.rowCoordinate = 0;
|
||||
rxQueueItem.columnCoordinate = 1;
|
||||
rxQueueItem.keyEvent = RELEASED;
|
||||
// Put event in queue
|
||||
xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
// // TUBE REPAIR
|
||||
// struct KeypadQueueItem rxQueueItem;
|
||||
// rxQueueItem.rowCoordinate = 0;
|
||||
// rxQueueItem.columnCoordinate = 0;
|
||||
// rxQueueItem.keyEvent = PRESSED;
|
||||
// // Put event in queue
|
||||
// xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
// rxQueueItem.rowCoordinate = 0;
|
||||
// rxQueueItem.columnCoordinate = 0;
|
||||
// rxQueueItem.keyEvent = RELEASED;
|
||||
// // Put event in queue
|
||||
// xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
//
|
||||
// // SELECT CATHODE
|
||||
// rxQueueItem.rowCoordinate = 0;
|
||||
// rxQueueItem.columnCoordinate = 0;
|
||||
// rxQueueItem.keyEvent = PRESSED;
|
||||
// // Put event in queue
|
||||
// xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
// rxQueueItem.rowCoordinate = 0;
|
||||
// rxQueueItem.columnCoordinate = 0;
|
||||
// rxQueueItem.keyEvent = RELEASED;
|
||||
// // Put event in queue
|
||||
// xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
//
|
||||
// // SELECT PRESET
|
||||
// rxQueueItem.rowCoordinate = 0;
|
||||
// rxQueueItem.columnCoordinate = 0;
|
||||
// rxQueueItem.keyEvent = PRESSED;
|
||||
// // Put event in queue
|
||||
// xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
// rxQueueItem.rowCoordinate = 0;
|
||||
// rxQueueItem.columnCoordinate = 0;
|
||||
// rxQueueItem.keyEvent = RELEASED;
|
||||
// // Put event in queue
|
||||
// xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
//
|
||||
// // SELECT PRESET 7
|
||||
// rxQueueItem.rowCoordinate = 2;
|
||||
// rxQueueItem.columnCoordinate = 0;
|
||||
// rxQueueItem.keyEvent = PRESSED;
|
||||
// // Put event in queue
|
||||
// xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
// rxQueueItem.rowCoordinate = 2;
|
||||
// rxQueueItem.columnCoordinate = 0;
|
||||
// rxQueueItem.keyEvent = RELEASED;
|
||||
// // Put event in queue
|
||||
// xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
//
|
||||
// // START
|
||||
// rxQueueItem.rowCoordinate = 0;
|
||||
// rxQueueItem.columnCoordinate = 1;
|
||||
// rxQueueItem.keyEvent = PRESSED;
|
||||
// // Put event in queue
|
||||
// xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
// rxQueueItem.rowCoordinate = 0;
|
||||
// rxQueueItem.columnCoordinate = 1;
|
||||
// rxQueueItem.keyEvent = RELEASED;
|
||||
// // Put event in queue
|
||||
// xQueueSend(self->rxQueue, &rxQueueItem, 0);
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
@@ -112,4 +112,5 @@
|
||||
</target>
|
||||
</buildTargets>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cproject>
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
<comment></comment>
|
||||
<projects>
|
||||
<project>FreeRTOS</project>
|
||||
<project>HAL</project>
|
||||
<project>Platform</project>
|
||||
<project>STM32F10x_StdPeriph_Lib_V3.5.0</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
|
||||
@@ -16,6 +16,9 @@ ADConverter.o \
|
||||
ADConverters.o \
|
||||
DAConverter.o \
|
||||
DAConverters.o \
|
||||
CalibrationParameters.o \
|
||||
CalibrationSetpoint.o \
|
||||
CalibrationSetpoints.o \
|
||||
DeviceParameters.o \
|
||||
Display.o \
|
||||
Displays.o \
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file CalibrationSetpoints.h
|
||||
/// @brief File description
|
||||
// -----------------------------------------------------------------------------
|
||||
// Micro-Key bv
|
||||
// Industrieweg 28, 9804 TG Noordhorn
|
||||
// Postbus 92, 9800 AB Zuidhorn
|
||||
// The Netherlands
|
||||
// Tel: +31 594 503020
|
||||
// Fax: +31 594 505825
|
||||
// Email: support@microkey.nl
|
||||
// Web: www.microkey.nl
|
||||
// -----------------------------------------------------------------------------
|
||||
/// $Revision$
|
||||
/// $Author$
|
||||
/// $Date$
|
||||
// (c) 2015 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// @defgroup {group_name} {group_description}
|
||||
/// Description
|
||||
|
||||
/// @file CalibrationSetpoints.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
#ifndef CALIBRATIONPARAMETERS_H_
|
||||
#define CALIBRATIONPARAMETERS_H_
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "CalibrationParameters.h"
|
||||
#include "MemoryDevice.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* CalibrationParameters_construct
|
||||
* Description of function
|
||||
*
|
||||
* @param para1_name
|
||||
* @param para2_name
|
||||
* @return return_type
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus CalibrationParameters_construct(struct MemoryDevice* memoryDevice);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* CalibrationParameters_destruct
|
||||
* Description of function
|
||||
*
|
||||
* @param
|
||||
* @param
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void CalibrationParameters_destruct(void);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* CalibrationParameters_getCalibrationSetpoints
|
||||
* Description of function
|
||||
*
|
||||
* @param
|
||||
* @param
|
||||
* @return struct CalibrationSetpoints*
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern struct CalibrationSetpoints* CalibrationParameters_getCalibrationSetpoints(void);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* CalibrationParameters_setCalibrationSetpoints
|
||||
* Description of function
|
||||
*
|
||||
* @param setpoints
|
||||
*
|
||||
* @return ErrorStatus
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus CalibrationParameters_setCalibrationSetpoints(struct CalibrationSetpoints* setpoints);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* CalibrationParameters_saveParameters
|
||||
* Description of function
|
||||
*
|
||||
* @param
|
||||
* @param
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void CalibrationParameters_saveParameters(void);
|
||||
|
||||
|
||||
#endif /* CALIBRATIONPARAMETERS_H_ */
|
||||
@@ -0,0 +1,85 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file CalibrationSetpoint.h
|
||||
/// @brief File description
|
||||
// -----------------------------------------------------------------------------
|
||||
// Micro-Key bv
|
||||
// Industrieweg 28, 9804 TG Noordhorn
|
||||
// Postbus 92, 9800 AB Zuidhorn
|
||||
// The Netherlands
|
||||
// Tel: +31 594 503020
|
||||
// Fax: +31 594 505825
|
||||
// Email: support@microkey.nl
|
||||
// Web: www.microkey.nl
|
||||
// -----------------------------------------------------------------------------
|
||||
/// $Revision$
|
||||
/// $Author$
|
||||
/// $Date$
|
||||
// (c) 2015 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// @defgroup {group_name} {group_description}
|
||||
/// Description
|
||||
|
||||
/// @file CalibrationSetpoint.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
#ifndef CALIBRATIONSETPOINT_H_
|
||||
#define CALIBRATIONSETPOINT_H_
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
struct CalibrationSetpoint
|
||||
{
|
||||
int low; // Low calibration setpoint
|
||||
int high; // High calibration setpoint
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* CalibrationSetpoint_LowSetpoint
|
||||
* Description of function
|
||||
*
|
||||
* @param self
|
||||
* @param lowSetpoint
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void CalibrationSetpoint_setLowSetpoint(struct CalibrationSetpoint* self, int lowSetpoint);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* CalibrationSetpoints_setHighSetpoint
|
||||
* Description of function
|
||||
*
|
||||
* @param self
|
||||
* @param highSetpoint
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void CalibrationSetpoint_setHighSetpoint(struct CalibrationSetpoint* self, int highSetpoint);
|
||||
|
||||
|
||||
#endif /* CALIBRATIONSETPOINT_H_ */
|
||||
@@ -0,0 +1,121 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file CalibrationSetpoints.h
|
||||
/// @brief File description
|
||||
// -----------------------------------------------------------------------------
|
||||
// Micro-Key bv
|
||||
// Industrieweg 28, 9804 TG Noordhorn
|
||||
// Postbus 92, 9800 AB Zuidhorn
|
||||
// The Netherlands
|
||||
// Tel: +31 594 503020
|
||||
// Fax: +31 594 505825
|
||||
// Email: support@microkey.nl
|
||||
// Web: www.microkey.nl
|
||||
// -----------------------------------------------------------------------------
|
||||
/// $Revision$
|
||||
/// $Author$
|
||||
/// $Date$
|
||||
// (c) 2015 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// @defgroup {group_name} {group_description}
|
||||
/// Description
|
||||
|
||||
/// @file CalibrationSetpoints.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
#ifndef CALIBRATIONSETPOINTS_H_
|
||||
#define CALIBRATIONSETPOINTS_H_
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "CalibrationSetpoint.h"
|
||||
|
||||
enum CALIBRATION_SETPOINT_ID
|
||||
{
|
||||
CALIBRATION_SETPOINT_CATHODE,
|
||||
CALIBRATION_SETPOINT_MCP,
|
||||
CALIBRATION_SETPOINT_TESLA,
|
||||
CALIBRATION_SETPOINT_ANODE,
|
||||
CALIBRATION_SETPOINT_LAST
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
struct CalibrationSetpoints
|
||||
{
|
||||
struct CalibrationSetpoint setpoints[CALIBRATION_SETPOINT_LAST];
|
||||
enum CALIBRATION_SETPOINT_ID currentActiveSetpointSet;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* CalibrationSetpoints_generateDefaultParameters
|
||||
* Description of function
|
||||
*
|
||||
* @param self
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void CalibrationSetpoints_generateDefaultParameters(struct CalibrationSetpoints* self);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* CalibrationSetpoints_getSetpoint
|
||||
* Description of function
|
||||
*
|
||||
* @param self
|
||||
* @param setpointIdentifier
|
||||
* @return struct CalibrationSetpoint*
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern struct CalibrationSetpoint* CalibrationSetpoints_getSetpoint(struct CalibrationSetpoints* self, enum CALIBRATION_SETPOINT_ID setpointIdentifier);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* CalibrationSetpoints_setActiveSetpointSet
|
||||
* Description of function
|
||||
*
|
||||
* @param para1_name
|
||||
* @param para2_name
|
||||
* @return return_type
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void CalibrationSetpoints_setActiveSetpointSet(struct CalibrationSetpoints* self, enum CALIBRATION_SETPOINT_ID setpointIdentifier);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* CalibrationSetpoints_getActiveSetpointSet
|
||||
* Description of function
|
||||
*
|
||||
* @param self
|
||||
* @param setpointIdentifier
|
||||
* @return struct CalibrationSetpoint*
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern struct CalibrationSetpoint* CalibrationSetpoints_getActiveSetpointSet(struct CalibrationSetpoints* self);
|
||||
|
||||
|
||||
|
||||
#endif /* CALIBRATIONSETPOINTS_H_ */
|
||||
@@ -11,9 +11,9 @@
|
||||
// Email: support@microkey.nl
|
||||
// Web: www.microkey.nl
|
||||
// -----------------------------------------------------------------------------
|
||||
/// $Revision: $
|
||||
/// $Author: $
|
||||
/// $Date: $
|
||||
/// $Revision$
|
||||
/// $Author$
|
||||
/// $Date$
|
||||
// (c) 2015 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -36,7 +36,8 @@
|
||||
#include "PIDParameters.h"
|
||||
#include "PIN.h"
|
||||
|
||||
#include "CachedStorage.h"
|
||||
#include "MemoryDevice.h"
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
@@ -64,7 +65,7 @@
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus DeviceParameters_construct(struct CachedStorage* parametersStorage, struct MemoryDevice* memoryDevice);
|
||||
extern ErrorStatus DeviceParameters_construct(struct MemoryDevice* memoryDevice);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
@@ -121,6 +122,8 @@ extern struct PIN* DeviceParameters_getPIN(void);
|
||||
extern void DeviceParameters_saveParameters(void);
|
||||
|
||||
ErrorStatus DeviceParameters_writePIDParameters(struct PIDParameters* parameters);
|
||||
|
||||
|
||||
ErrorStatus DeviceParameters_writePIN(struct PIN* pin);
|
||||
|
||||
#endif /* DEVICEPARAMETERS_H_ */
|
||||
|
||||
@@ -55,6 +55,7 @@ typedef enum
|
||||
REPAIR_FAIL,
|
||||
ERROR_CRC_PIN,
|
||||
ERROR_CRC_PARAMETERS,
|
||||
ERROR_CRC_CALIBRATION,
|
||||
ERROR_CRC_PRESETS
|
||||
} T_ErrorCode;
|
||||
|
||||
|
||||
@@ -103,6 +103,10 @@ typedef enum
|
||||
// --------------------------------------------------------------------------
|
||||
RM_CALIBRATIONMENU_PIN_VERIFICATION,
|
||||
RM_CALIBRATIONMENU,
|
||||
RM_CALIBRATION_CATHOEMCP_SELECT,
|
||||
RM_CALIBRATION_SETPOINT_MENU,
|
||||
RM_CALIBRATION_SETPOINT_LOW,
|
||||
RM_CALIBRATION_SETPOINT_HIGH,
|
||||
|
||||
RM_ERROR_STATE,
|
||||
RM_WARNING_STATE,
|
||||
|
||||
@@ -146,6 +146,17 @@ static const char MenuText_ERROR_CRC_PARAMETERS[MENUTEXT_NUMBER_OF_LANGUAGES][ME
|
||||
}
|
||||
};
|
||||
|
||||
static const char MenuText_ERROR_CRC_CALIBRATION[MENUTEXT_NUMBER_OF_LANGUAGES][MENUTEXT_POPUP_MESSAGE_LENGTH] =
|
||||
{
|
||||
// MAX 20 CHARACTERS
|
||||
{
|
||||
"SETPOINT CRC ERROR"
|
||||
},
|
||||
{
|
||||
"ERREUR SETPOINT CRC"
|
||||
}
|
||||
};
|
||||
|
||||
static const char MenuText_ERROR_CRC_PRESETS[MENUTEXT_NUMBER_OF_LANGUAGES][MENUTEXT_POPUP_MESSAGE_LENGTH] =
|
||||
{
|
||||
// MAX 20 CHARACTERS
|
||||
@@ -665,7 +676,7 @@ static const char MenuText_CALIBRATIONMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCOR
|
||||
// MAX 20 CHARACTERS - MIND THE TWO BLANKS AT STRING START - THIS IS WHERE THE CURSOR IS PUT
|
||||
{
|
||||
"Calibration",
|
||||
" 1.To be written",
|
||||
" 1.Setpoint check",
|
||||
|
||||
},
|
||||
{
|
||||
@@ -674,6 +685,24 @@ static const char MenuText_CALIBRATIONMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCOR
|
||||
}
|
||||
};
|
||||
|
||||
// Calibration SETPOINT CHECK
|
||||
static const char MenuText_CALIBRATION_SETPOINTMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_NUMBER_OF_ROWS][MENUCORE_DISPLAY_ROW_LENGTH] =
|
||||
{
|
||||
// MAX 20 CHARACTERS - MIND THE TWO BLANKS AT STRING START - THIS IS WHERE THE CURSOR IS PUT
|
||||
{
|
||||
"Setpoint check",
|
||||
" 1.Low Setpoint",
|
||||
" 2.High Setpoint"
|
||||
|
||||
},
|
||||
{
|
||||
"Setpoint check",
|
||||
" 1.Low Setpoint",
|
||||
" 2.High Setpoint"
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -68,7 +68,7 @@ typedef enum
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus RepairPresets_construct(struct CachedStorage* presetStorage, struct MemoryDevice* memoryDevice);
|
||||
extern ErrorStatus RepairPresets_construct(struct MemoryDevice* memoryDevice);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
|
||||
@@ -73,16 +73,20 @@
|
||||
// Define storage for presets, which is the biggest storage part
|
||||
// Each set of presets is written/saved on a dedicated page. This reduces
|
||||
// cache size when erasing page prior to write
|
||||
#define APP_FLASH_PRESET_ANODE_PAGE (122)
|
||||
#define APP_FLASH_PRESET_CATHODE_PAGE (123)
|
||||
#define APP_FLASH_PRESET_MCP_PAGE (124)
|
||||
#define APP_FLASH_PRESET_TESLA_PAGE (125)
|
||||
#define APP_FLASH_PRESET_ANODE_PAGE (121)
|
||||
#define APP_FLASH_PRESET_CATHODE_PAGE (122)
|
||||
#define APP_FLASH_PRESET_MCP_PAGE (123)
|
||||
#define APP_FLASH_PRESET_TESLA_PAGE (124)
|
||||
#define APP_FLASH_STORAGE_PRESET_SIZE (sizeof(struct RepairPreset) * REPAIR_PRESETS_NUMBER_OF_PRESETS)
|
||||
#define APP_FLASH_STORAGE_PRESET_ANODE (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_PRESET_ANODE_PAGE)
|
||||
#define APP_FLASH_STORAGE_PRESET_CATHODE (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_PRESET_CATHODE_PAGE)
|
||||
#define APP_FLASH_STORAGE_PRESET_MCP (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_PRESET_MCP_PAGE)
|
||||
#define APP_FLASH_STORAGE_PRESET_TESLA (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_PRESET_TESLA_PAGE)
|
||||
|
||||
// Define storage for Calibration parameters (setpoints etc)
|
||||
#define APP_FLASH_CALIBRATION_PAGE (125)
|
||||
#define APP_FLASH_STORAGE_CALIBRATION (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_CALIBRATION_PAGE)
|
||||
|
||||
// Define storage for device parameters like PID constants and others
|
||||
#define APP_FLASH_PARAMETERS_PAGE (126)
|
||||
#define APP_FLASH_STORAGE_PARAMETERS (INTERNAL_FLASH_BASE_ADDRESS + INTERNAL_FLASH_PAGE_SIZE * APP_FLASH_PARAMETERS_PAGE)
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file CalibrationParameters.c
|
||||
/// @brief Description
|
||||
// -----------------------------------------------------------------------------
|
||||
// Micro-Key bv
|
||||
// Industrieweg 28, 9804 TG Noordhorn
|
||||
// Postbus 92, 9800 AB Zuidhorn
|
||||
// The Netherlands
|
||||
// Tel: +31 594 503020
|
||||
// Fax: +31 594 505825
|
||||
// Email: support@microkey.nl
|
||||
// Web: www.microkey.nl
|
||||
// -----------------------------------------------------------------------------
|
||||
/// $Revision$
|
||||
/// $Author$
|
||||
/// $Date$
|
||||
// (c) 2018 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// @file CalibrationParameters.c
|
||||
/// @ingroup {group_name}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "hsb-mrts.h"
|
||||
#include "Error.h"
|
||||
|
||||
#include "CalibrationParameters.h"
|
||||
#include "CalibrationSetpoint.h"
|
||||
#include "CalibrationSetpoints.h"
|
||||
|
||||
#include "CachedStorage.h"
|
||||
#include "crc32.h"
|
||||
|
||||
#include "Logger.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
struct CalibrationParameters
|
||||
{
|
||||
bool initialized;
|
||||
struct CachedStorage cache;
|
||||
struct MemoryDevice* memoryDevice;
|
||||
unsigned int CalibrationSetpointsOffset;
|
||||
};
|
||||
|
||||
struct CalibrationSetpointsStorageClass
|
||||
{
|
||||
uint32_t crc;
|
||||
struct CalibrationSetpoints setpoints;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// File-scope variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static struct CalibrationParameters _self = {.initialized = false, .cache.initialized = false};
|
||||
struct CalibrationParameters* const cpSelf = &_self;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static void CalibrationParameters_verifyCRCs(void);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
ErrorStatus CalibrationParameters_construct(struct MemoryDevice* memoryDevice)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
if (!cpSelf->initialized)
|
||||
{
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
if (memoryDevice != NULL)
|
||||
{
|
||||
if (memoryDevice->initialized)
|
||||
{
|
||||
cpSelf->memoryDevice = memoryDevice;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
// Create new cachedStorage with preset page number
|
||||
returnValue = CachedStorage_construct(&cpSelf->cache, cpSelf->memoryDevice, APP_FLASH_CALIBRATION_PAGE, sizeof(struct CalibrationSetpointsStorageClass) / 4);
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
cpSelf->initialized = 0;
|
||||
cpSelf->initialized = true;
|
||||
}
|
||||
|
||||
// Check the CRC on the loaded parameters
|
||||
// If a CRC fails, corrupted data will automatically be replaced with defaults
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
CalibrationParameters_verifyCRCs();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
void CalibrationParameters_destruct(void)
|
||||
{
|
||||
if (cpSelf->initialized)
|
||||
{
|
||||
cpSelf->cache.initialized = false;
|
||||
cpSelf->initialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct CalibrationSetpoints* CalibrationParameters_getCalibrationSetpoints(void)
|
||||
{
|
||||
struct CalibrationSetpoints* returnValue = NULL;
|
||||
if (cpSelf->initialized)
|
||||
{
|
||||
struct CalibrationSetpointsStorageClass* tempValue;
|
||||
tempValue = (struct CalibrationSetpointsStorageClass*)CachedStorage_readBlob(&cpSelf->cache, cpSelf->CalibrationSetpointsOffset);
|
||||
returnValue = &tempValue->setpoints;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus CalibrationParameters_setCalibrationSetpoints(struct CalibrationSetpoints* setpoints)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
if (cpSelf->initialized)
|
||||
{
|
||||
struct CalibrationSetpointsStorageClass tempStorage;
|
||||
tempStorage.setpoints = *setpoints;
|
||||
// Calculate CRC over preset
|
||||
tempStorage.crc = crc32_calculate(0, &tempStorage.setpoints, sizeof(struct CalibrationSetpoints));
|
||||
// Put default preset on Cache
|
||||
CachedStorage_writeBlob(&cpSelf->cache, cpSelf->CalibrationSetpointsOffset, &tempStorage, sizeof(struct CalibrationSetpointsStorageClass) / 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
void CalibrationParameters_saveParameters(void)
|
||||
{
|
||||
if (cpSelf->initialized)
|
||||
{
|
||||
// Commit cache to memory - will not write if no changes have been made
|
||||
CachedStorage_commit(&cpSelf->cache);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void CalibrationParameters_verifyCRCs(void)
|
||||
{
|
||||
uint32_t tempCRC;
|
||||
if (cpSelf->initialized)
|
||||
{
|
||||
// PID PARAMETERS CHECK
|
||||
struct CalibrationSetpointsStorageClass _tempParameters;
|
||||
struct CalibrationSetpointsStorageClass* tempParameters = &_tempParameters;
|
||||
tempParameters = (struct CalibrationSetpointsStorageClass*)CachedStorage_readBlob(&cpSelf->cache, cpSelf->CalibrationSetpointsOffset);
|
||||
|
||||
// Calculate the CRC of the parameters
|
||||
tempCRC = crc32_calculate(0, &tempParameters->setpoints, sizeof(struct CalibrationSetpoints));
|
||||
// Compare CRC
|
||||
if (tempCRC != tempParameters->crc)
|
||||
{
|
||||
Error_postError(ERROR_CRC_CALIBRATION);
|
||||
// CRC do not match
|
||||
LOGGER_ERROR(mainLog, "CRC ERROR at Calibration Parameters (calculated %X but loaded %X)", (unsigned int)tempCRC, (unsigned int)tempParameters->crc);
|
||||
// Replace corrupt Device parameters with defaults
|
||||
CalibrationSetpoints_generateDefaultParameters(&tempParameters->setpoints);
|
||||
// Write parameters to cache including the CRC (calculated inside write function)
|
||||
CalibrationParameters_setCalibrationSetpoints(&tempParameters->setpoints);
|
||||
}
|
||||
|
||||
CalibrationParameters_saveParameters();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file CalibrationSetpoint.c
|
||||
/// @brief Description
|
||||
// -----------------------------------------------------------------------------
|
||||
// Micro-Key bv
|
||||
// Industrieweg 28, 9804 TG Noordhorn
|
||||
// Postbus 92, 9800 AB Zuidhorn
|
||||
// The Netherlands
|
||||
// Tel: +31 594 503020
|
||||
// Fax: +31 594 505825
|
||||
// Email: support@microkey.nl
|
||||
// Web: www.microkey.nl
|
||||
// -----------------------------------------------------------------------------
|
||||
/// $Revision$
|
||||
/// $Author$
|
||||
/// $Date$
|
||||
// (c) 2018 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// @file CalibrationSetpoint.c
|
||||
/// @ingroup {group_name}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "CalibrationSetpoint.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// File-scope variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
void CalibrationSetpoint_setLowSetpoint(struct CalibrationSetpoint* self, int lowSetpoint)
|
||||
{
|
||||
self->low = lowSetpoint;
|
||||
}
|
||||
|
||||
|
||||
void CalibrationSetpoint_setHighSetpoint(struct CalibrationSetpoint* self, int highSetpoint)
|
||||
{
|
||||
self->high = highSetpoint;
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file CalibrationSetpoints.c
|
||||
/// @brief Description
|
||||
// -----------------------------------------------------------------------------
|
||||
// Micro-Key bv
|
||||
// Industrieweg 28, 9804 TG Noordhorn
|
||||
// Postbus 92, 9800 AB Zuidhorn
|
||||
// The Netherlands
|
||||
// Tel: +31 594 503020
|
||||
// Fax: +31 594 505825
|
||||
// Email: support@microkey.nl
|
||||
// Web: www.microkey.nl
|
||||
// -----------------------------------------------------------------------------
|
||||
/// $Revision$
|
||||
/// $Author$
|
||||
/// $Date$
|
||||
// (c) 2018 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// @file CalibrationSetpoints.c
|
||||
/// @ingroup {group_name}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "CalibrationSetpoints.h"
|
||||
|
||||
#include "PCBA.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#define CATHODE_LOW (200)
|
||||
#define CATHODE_HIGH (1000)
|
||||
|
||||
#define MCP_LOW (500)
|
||||
#define MCP_HIGH (2000)
|
||||
|
||||
#define TESLA_LOW (3000)
|
||||
#define TESLA_HIGH (6000)
|
||||
|
||||
#define ANODE_LOW (6000)
|
||||
#define ANODE_HIGH (10000)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// File-scope variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void CalibrationSetpoints_generateDefaultParameters(struct CalibrationSetpoints* self)
|
||||
{
|
||||
self->setpoints[CALIBRATION_SETPOINT_CATHODE].low = CATHODE_LOW;
|
||||
self->setpoints[CALIBRATION_SETPOINT_CATHODE].high = CATHODE_HIGH;
|
||||
|
||||
self->setpoints[CALIBRATION_SETPOINT_MCP].low = MCP_LOW;
|
||||
self->setpoints[CALIBRATION_SETPOINT_MCP].high = MCP_HIGH;
|
||||
|
||||
self->setpoints[CALIBRATION_SETPOINT_TESLA].low = TESLA_LOW;
|
||||
self->setpoints[CALIBRATION_SETPOINT_TESLA].high = TESLA_HIGH;
|
||||
|
||||
self->setpoints[CALIBRATION_SETPOINT_ANODE].low = ANODE_LOW;
|
||||
self->setpoints[CALIBRATION_SETPOINT_ANODE].high = ANODE_HIGH;
|
||||
}
|
||||
|
||||
|
||||
struct CalibrationSetpoint* CalibrationSetpoints_getSetpoint(struct CalibrationSetpoints* self, enum CALIBRATION_SETPOINT_ID setpointIdentifier)
|
||||
{
|
||||
return &self->setpoints[setpointIdentifier];
|
||||
}
|
||||
|
||||
|
||||
void CalibrationSetpoints_setActiveSetpointSet(struct CalibrationSetpoints* self, enum CALIBRATION_SETPOINT_ID setpointIdentifier)
|
||||
{
|
||||
self->currentActiveSetpointSet = setpointIdentifier;
|
||||
}
|
||||
|
||||
|
||||
struct CalibrationSetpoint* CalibrationSetpoints_getActiveSetpointSet(struct CalibrationSetpoints* self)
|
||||
{
|
||||
return &self->setpoints[self->currentActiveSetpointSet];
|
||||
}
|
||||
@@ -11,9 +11,9 @@
|
||||
// Email: support@microkey.nl
|
||||
// Web: www.microkey.nl
|
||||
// -----------------------------------------------------------------------------
|
||||
/// $Revision: $
|
||||
/// $Author: $
|
||||
/// $Date: $
|
||||
/// $Revision$
|
||||
/// $Author$
|
||||
/// $Date$
|
||||
// (c) 2017 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -72,8 +72,9 @@ struct PINStorageClass
|
||||
// -----------------------------------------------------------------------------
|
||||
// File-scope variables
|
||||
// -----------------------------------------------------------------------------
|
||||
static struct CachedStorage deviceParameters = {.initialized = false};
|
||||
|
||||
static struct DeviceParameters _dParam = {.initialized = false};
|
||||
static struct DeviceParameters _dParam = {.initialized = false, .parametersStorage = &deviceParameters};
|
||||
struct DeviceParameters* const dParam = &_dParam;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -86,23 +87,12 @@ static void DeviceParameters_verifyCRCs(void);
|
||||
// Function definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
ErrorStatus DeviceParameters_construct(struct CachedStorage* parametersStorage, struct MemoryDevice* memoryDevice)
|
||||
ErrorStatus DeviceParameters_construct(struct MemoryDevice* memoryDevice)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (!dParam->initialized)
|
||||
{
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
if (parametersStorage != NULL)
|
||||
{
|
||||
dParam->parametersStorage = parametersStorage;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
|
||||
@@ -65,8 +65,9 @@ struct RepairPresetStorageClass
|
||||
// -----------------------------------------------------------------------------
|
||||
// File-scope variables
|
||||
// -----------------------------------------------------------------------------
|
||||
static struct CachedStorage cache = {.initialized = false};
|
||||
|
||||
static struct RepairPresets _self = {.initialized = false, .presetsLoaded = false};
|
||||
static struct RepairPresets _self = {.initialized = false, .presetStorage = &cache, .presetsLoaded = false};
|
||||
struct RepairPresets* const self = &_self;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -81,23 +82,11 @@ static ErrorStatus RepairPresets_verifyPresetCRC(struct RepairPresetStorageClass
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
ErrorStatus RepairPresets_construct(struct CachedStorage* presetStorage, struct MemoryDevice* memoryDevice)
|
||||
ErrorStatus RepairPresets_construct(struct MemoryDevice* memoryDevice)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
if (!self->initialized)
|
||||
{
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
if (presetStorage != NULL)
|
||||
{
|
||||
self->presetStorage = presetStorage;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
if (memoryDevice != NULL)
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#include "ADConverters.h"
|
||||
#include "DAConverters.h"
|
||||
#include "CalibrationParameters.h"
|
||||
#include "DeviceParameters.h"
|
||||
#include "Displays.h"
|
||||
#include "Error.h"
|
||||
@@ -101,8 +102,6 @@ static struct HwValidationMenuItems hwTestItems;
|
||||
struct HwValidationMenu* hwValidation = &_hwValidation;
|
||||
#endif
|
||||
|
||||
static struct CachedStorage cs = {.initialized = false};
|
||||
static struct CachedStorage deviceParameters = {.initialized = false};
|
||||
|
||||
//static char taskList[600];
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -272,13 +271,19 @@ static void initTask(void* parameters)
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
// Construct/Load the device parameters
|
||||
returnValue = DeviceParameters_construct(&deviceParameters, &iFlash->memoryDevice);
|
||||
returnValue = DeviceParameters_construct(&iFlash->memoryDevice);
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
// Construct/Load the device calibration parameters
|
||||
returnValue = CalibrationParameters_construct(&iFlash->memoryDevice);
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
// Construct the repair presets
|
||||
returnValue = RepairPresets_construct(&cs, &iFlash->memoryDevice);
|
||||
returnValue = RepairPresets_construct(&iFlash->memoryDevice);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_HW_VALIDATION
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -149,6 +149,7 @@ static ErrorStatus repairMenus_errorReceive(const void* const data)
|
||||
}
|
||||
case ERROR_CRC_PIN:
|
||||
case ERROR_CRC_PARAMETERS:
|
||||
case ERROR_CRC_CALIBRATION:
|
||||
case ERROR_CRC_PRESETS:
|
||||
{
|
||||
repairMenu_printCRCFailure(mainMenu, errorCode);
|
||||
|
||||
Reference in New Issue
Block a user