Updates:
- Re-located repairprocessrow information in dedicated object - added error conditions to repair row and added condition handling to repair process git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@260 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file ADConverter.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 ADConverter.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
#ifndef ADCONVERTER_H_
|
||||
#define ADCONVERTER_H_
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#endif /* ADCONVERTER_H_ */
|
||||
@@ -0,0 +1,52 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file DAConverter.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 DAConverter.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
#ifndef DACONVERTER_H_
|
||||
#define DACONVERTER_H_
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#endif /* DACONVERTER_H_ */
|
||||
@@ -198,11 +198,11 @@ extern ErrorStatus Display_setContrast(struct Display* self, size_t contrast);
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* Display_write
|
||||
* Description of function
|
||||
* Write a text on the display
|
||||
* Length of string/message gets calculated (and verified) automatically
|
||||
*
|
||||
* @param self The display information to use
|
||||
* @param buffer The message to write
|
||||
* @param length Length of the message
|
||||
* @param row The row of the display to put the message
|
||||
* Starts with 1
|
||||
* @param column The column to start at with the message
|
||||
@@ -217,7 +217,7 @@ extern ErrorStatus Display_setContrast(struct Display* self, size_t contrast);
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus Display_write(struct Display* self, const char* buffer, unsigned int length, size_t row, size_t column);
|
||||
extern ErrorStatus Display_write(struct Display* self, const char* buffer, size_t row, size_t column);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file SignalProfileGenerator.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 SignalProfileGenerator.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
#ifndef INC_SIGNALPROFILEGENERATOR_H_
|
||||
#define INC_SIGNALPROFILEGENERATOR_H_
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "stm32f10x.h"
|
||||
|
||||
#include "repairPreset.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SPG_PREPARE = 0,
|
||||
SPG_SOFTSTART,
|
||||
SPG_VOLTAGE_HOLD,
|
||||
SPG_PAUSE,
|
||||
SPG_PAUSE_RESTORE,
|
||||
SPG_PAUSE_RESTORE_SOFTSTART,
|
||||
SPG_FINISH_VERIFY,
|
||||
SPG_FINISHED
|
||||
} RepairState;
|
||||
|
||||
struct SignalProfileGenerator
|
||||
{
|
||||
bool initialized;
|
||||
int signal;
|
||||
uint32_t secondsCounter;
|
||||
RepairState currentState;
|
||||
|
||||
int startVoltage;
|
||||
uint32_t startTime;
|
||||
uint32_t softStartTimer;
|
||||
uint32_t voltageHoldTimer;
|
||||
|
||||
int pauseStartVoltage;
|
||||
uint32_t pauseStartTime;
|
||||
uint32_t pauseSoftStartTimer;
|
||||
RepairState statePriorToPause;
|
||||
int voltagePriorToPause;
|
||||
//
|
||||
bool isProcessRunning;
|
||||
|
||||
int currentPresetIndex;
|
||||
const struct RepairPreset* repairPreset;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
extern ErrorStatus SignalProfileGenerator_construct(struct SignalProfileGenerator* self, const struct RepairPreset* preset);
|
||||
|
||||
|
||||
extern void SignalProfileGenerator_destruct(struct SignalProfileGenerator* self);
|
||||
|
||||
|
||||
extern void SignalProfileGenerator_calculate(struct SignalProfileGenerator* self);
|
||||
|
||||
|
||||
extern void SignalProfileGenerator_pause(struct SignalProfileGenerator* self);
|
||||
|
||||
|
||||
extern void SignalProfileGenerator_continue(struct SignalProfileGenerator* self);
|
||||
|
||||
|
||||
extern uint32_t SignalProfileGenerator_getRemainingTime(const struct SignalProfileGenerator* self);
|
||||
#endif /* INC_SIGNALPROFILEGENERATOR_H_ */
|
||||
@@ -39,7 +39,7 @@
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#define HSB_MAINMENU_TASK_PRIORITY (2)
|
||||
#define HSB_MAINMENU_TASK_PRIORITY (5)
|
||||
#define HSB_MAINMENU_TASK_STACKSIZE (1024)
|
||||
|
||||
#define HSB_MAINDISP_TASK_PRIORITY (2)
|
||||
@@ -47,6 +47,8 @@
|
||||
|
||||
#define HSB_MAINREPR_TASK_PRIORITY (2)
|
||||
#define HSB_MAINREPR_TASK_STACKSIZE (1024)
|
||||
#define HSB_MAINREPR_OOL_DURATION (10)
|
||||
#define HSB_MAINREPR_OOL_VALUE (100)
|
||||
|
||||
|
||||
// Exports of objects on application level
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
typedef enum
|
||||
{
|
||||
MAINMENU = 0,
|
||||
RM_CATHODEMCP_SELECT,
|
||||
REPAIRMENU,
|
||||
ADMINMENU,
|
||||
CALIBRATIONMENU,
|
||||
@@ -230,4 +231,7 @@ extern void repairMenu_feedSecondsCounterFromISR(struct RepairMenu* self);
|
||||
*/
|
||||
extern void repairMenu_interlockFailed(struct RepairMenu* self, T_INTERLOCK_ID interlockID);
|
||||
|
||||
|
||||
extern void repairMenu_processFailed(struct RepairMenu* self);
|
||||
|
||||
#endif /* INC_REPAIRMENU_H_ */
|
||||
|
||||
@@ -51,7 +51,7 @@ struct RepairPresetParameters
|
||||
|
||||
struct RepairPreset
|
||||
{
|
||||
size_t numberOfStages;
|
||||
int numberOfStages;
|
||||
struct RepairPresetParameters preset[REPAIR_PRESET_MAX_STAGES];
|
||||
};
|
||||
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
#include "stm32f10x.h"
|
||||
|
||||
#include "repairPreset.h"
|
||||
#include "repairProcessRow.h"
|
||||
#include "SignalProfileGenerator.h"
|
||||
|
||||
#include "PID.h"
|
||||
|
||||
@@ -55,17 +57,6 @@
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PREPARE = 0,
|
||||
SOFTSTART,
|
||||
VOLTAGE_HOLD,
|
||||
PAUSE,
|
||||
PAUSE_RESTORE,
|
||||
FINISH_VERIFY,
|
||||
FINISHED
|
||||
} RepairState;
|
||||
|
||||
|
||||
struct RepairProcessParameters
|
||||
{
|
||||
@@ -77,16 +68,6 @@ struct RepairProcessParameters
|
||||
const struct MAX5715_DAC* dacRow3;
|
||||
};
|
||||
|
||||
struct RepairProcessRow
|
||||
{
|
||||
const struct AdcChannel* adcChannel;
|
||||
uint16_t lastADCValue;
|
||||
const struct MAX5715_DAC* dacChannel;
|
||||
uint16_t lastDACValue;
|
||||
int pidError;
|
||||
struct Pid pid;
|
||||
bool rowHasError;
|
||||
};
|
||||
|
||||
struct RepairProcess
|
||||
{
|
||||
@@ -94,16 +75,11 @@ struct RepairProcess
|
||||
int TaskPriority;
|
||||
uint16_t stackSize;
|
||||
bool runTask;
|
||||
bool taskIsDeleted;
|
||||
bool taskIsRunning;
|
||||
SemaphoreHandle_t secondsSyncronisation;
|
||||
uint32_t startTime;
|
||||
uint32_t secondsCounter;
|
||||
uint32_t softStartTimer;
|
||||
uint32_t voltageHoldTimer;
|
||||
RepairState currentState;
|
||||
struct SignalProfileGenerator signalProfileGenerator;
|
||||
bool initialized;
|
||||
bool isProcessRunning;
|
||||
size_t currentPresetIndex;
|
||||
const struct RepairPreset* repairPreset;
|
||||
struct RepairProcessRow row[REPAIRPROCESS_NUMBER_OF_ROWS];
|
||||
struct Observable observable;
|
||||
@@ -148,7 +124,7 @@ extern void repairProcess_destruct(struct RepairProcess* self);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* repairProcess_feedSecondsCounter
|
||||
* repairProcess_secondsFeed
|
||||
* Feeds the seconds counter of the repair process.
|
||||
* The process is designed to be run every second, so this feed function should
|
||||
* be called every second.
|
||||
@@ -160,11 +136,11 @@ extern void repairProcess_destruct(struct RepairProcess* self);
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void repairProcess_feedSecondsCounter(struct RepairProcess* self);
|
||||
extern void repairProcess_secondsFeed(struct RepairProcess* self);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* repairProcess_feedSecondsCounterFromISR
|
||||
* repairProcess_secondsFeedFromISR
|
||||
* Feeds the seconds counter of the repair process.
|
||||
* This function should be called in an ISR context
|
||||
* The process is designed to be run every second, so this feed function should
|
||||
@@ -177,9 +153,12 @@ extern void repairProcess_feedSecondsCounter(struct RepairProcess* self);
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void repairProcess_feedSecondsCounterFromISR(struct RepairProcess* self);
|
||||
extern void repairProcess_secondsFeedFromISR(struct RepairProcess* self);
|
||||
|
||||
|
||||
|
||||
extern bool repairProcess_isProcessRunning(struct RepairProcess* self);
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* repairProcess_getRemainingRepairTime
|
||||
* Returns the currently remaining repair time in seconds
|
||||
@@ -206,7 +185,7 @@ extern uint32_t repairProcess_getRemainingRepairTime(const struct RepairProcess*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern struct RepairProcessRow* repairProcess_getRowInformation(const struct RepairProcess* self, int rowIndex);
|
||||
extern const struct RepairProcessRow* repairProcess_getRowInformation(const struct RepairProcess* self, int rowIndex);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
@@ -222,4 +201,32 @@ extern struct RepairProcessRow* repairProcess_getRowInformation(const struct Rep
|
||||
*/
|
||||
extern const struct Observable* repairProcess_getObservable(struct RepairProcess* self);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* repairProcess_pauseProcess
|
||||
* Description of function
|
||||
*
|
||||
* @param self
|
||||
* @param
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void repairProcess_pauseProcess(struct RepairProcess* self);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* repairProcess_continueProcess
|
||||
* Description of function
|
||||
*
|
||||
* @param self
|
||||
* @param
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void repairProcess_continueProcess(struct RepairProcess* self);
|
||||
|
||||
#endif /* REPAIRPROCESS_H_ */
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file repairProcessRow.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 repairProcessRow.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
#ifndef REPAIRPROCESSROW_H_
|
||||
#define REPAIRPROCESSROW_H_
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "PID.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
struct RepairProcessRowErrorData
|
||||
{
|
||||
bool rowHasError;
|
||||
int outOfLimitsCounter;
|
||||
int outOfLimitsDuration;
|
||||
int outOfLimitsValue;
|
||||
};
|
||||
|
||||
struct RepairProcessRow
|
||||
{
|
||||
bool initialized;
|
||||
const struct AdcChannel* adcChannel;
|
||||
uint16_t lastADCValue;
|
||||
const struct MAX5715_DAC* dacChannel;
|
||||
uint16_t lastDACValue;
|
||||
int pidError;
|
||||
struct Pid pid;
|
||||
struct RepairProcessRowErrorData errorData;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* repairProcessRow_construct
|
||||
* Constructor for a repair row
|
||||
*
|
||||
* @param self The repair row object
|
||||
* @param outOfLimtsDuration Duration limits for outOfLimts. When the
|
||||
* outOfLimits counter reaches this value,
|
||||
* the row is in error state
|
||||
* @param outOfLimitsValue The threshold that marks that the repair
|
||||
* row is outside valid boundaries and in
|
||||
* erro state
|
||||
*
|
||||
* @return ErrorStatus SUCCESS if construction was successful
|
||||
* ERROR otherwise
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus repairProcessRow_construct(struct RepairProcessRow* self, const struct AdcChannel* adcChannel, const struct MAX5715_DAC* dacChannel, int outOfLimitsDuration, int outOfLimitsValue);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* repairProcessRow_destruct
|
||||
* Destructor for a repair row
|
||||
*
|
||||
* @param self The repair row object
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void repairProcessRow_destruct(struct RepairProcessRow* self);
|
||||
|
||||
#endif /* REPAIRPROCESSROW_H_ */
|
||||
Reference in New Issue
Block a user