Progress on the menu

- Debounced the interlocks
- Created a specified screen for pre-compliance tests

ADCs must be averaged
menu handling of screens is not OK
destructing tasks is not OK

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@257 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-10-18 15:26:05 +00:00
parent 97a42de2ea
commit 51ffde94d7
20 changed files with 649 additions and 215 deletions

View File

@@ -45,6 +45,9 @@
#define HSB_MAINDISP_TASK_PRIORITY (2)
#define HSB_MAINDISP_TASK_STACKSIZE (512)
#define HSB_MAINREPR_TASK_PRIORITY (2)
#define HSB_MAINREPR_TASK_STACKSIZE (1024)
// Exports of objects on application level
extern struct Display* const mainDisplay;

View File

@@ -71,6 +71,7 @@ typedef enum
REPAIR_RUNNING,
REPAIR_ASK_PAUSE,
REPAIR_PAUSE,
FINISH,
ERROR_STATE,
WARNING_STATE,
NO_MENU,
@@ -133,12 +134,13 @@ struct RepairMenu
T_MenuState menuState;
int cursorIndex;
int scrollOffset;
struct RepairProcess repairProcess;
SemaphoreHandle_t repairScreenUpdateSemaphore;
const struct RepairPreset* repairPreset;
struct RepairProcessParameters rpParameters;
struct MenuPage menuArray[NUMBER_OF_MENUS];
char errorMessage[20];
char warningMessage[20];
Observer observer;
};
// -----------------------------------------------------------------------------
@@ -155,14 +157,14 @@ struct RepairMenu
* @param keyboardDevice
* @param taskPriority
* @param stackSize
* @param keyStateTrigger
* @param repairScreenUpdateObserver
*
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus repairMenu_construct(struct RepairMenu* self, struct Display* display, struct KeyboardDevice* keyboardDevice, int taskPriority, uint16_t stackSize, Keypad_KeyState keyStateTrigger);
extern ErrorStatus repairMenu_construct(struct RepairMenu* self, struct Display* display, struct KeyboardDevice* keyboardDevice, int taskPriority, uint16_t stackSize, Observer repairScreenUpdateObserver);
/** ----------------------------------------------------------------------------

View File

@@ -74,4 +74,9 @@ extern ErrorStatus repairMenus_construct(void);
extern void repairMenus_destruct(void);
extern struct RepairMenu* repairMenus_getMainRepairMenu(void);
#endif /* REPAIRMENUS_H_ */

View File

@@ -42,6 +42,9 @@
#include "PID.h"
#include "Observable.h"
#include "rtc.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
@@ -74,6 +77,17 @@ 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
{
TaskHandle_t taskHandle;
@@ -87,11 +101,11 @@ struct RepairProcess
uint32_t voltageHoldTimer;
RepairState currentState;
bool initialized;
bool isProcessRunning;
size_t currentPresetIndex;
struct RepairPreset* repairPreset;
const struct AdcChannel* adc[REPAIRPROCESS_NUMBER_OF_ROWS];
const struct MAX5715_DAC* dac[REPAIRPROCESS_NUMBER_OF_ROWS];
struct Pid pid[REPAIRPROCESS_NUMBER_OF_ROWS];
const struct RepairPreset* repairPreset;
struct RepairProcessRow row[REPAIRPROCESS_NUMBER_OF_ROWS];
struct Observable observable;
};
// -----------------------------------------------------------------------------
@@ -166,20 +180,45 @@ extern void repairProcess_feedSecondsCounterFromISR(struct RepairProcess* self);
/** ----------------------------------------------------------------------------
* repairProcess_getRepairTime
* Returns the current active repair time in seconds.
* repairProcess_getRemainingRepairTime
* Returns the currently remaining repair time in a struct Time
*
* @param self
* @param repairTime
* @param hours
* @param minutes
* @param seconds
* @param self The repair process object
*
* @return ErrorStatus
* @return struct Time The remaining repair time
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus repairProcess_getRepairTime(const struct RepairProcess* self, uint32_t* repairTime, int* hours, int* minutes, int* seconds);
extern struct Time repairProcess_getRemainingRepairTime(const struct RepairProcess* self);
/** ----------------------------------------------------------------------------
* repairProcess_getRowInformation
* Returns the current active repair time in seconds.
*
* @param self The repair process object
* @param rowIndex Index of the requested row. Starts with 0
*
* @return struct RepairProcessRow* The requested row object
*
* @todo
* -----------------------------------------------------------------------------
*/
extern struct RepairProcessRow* repairProcess_getRowInformation(const struct RepairProcess* self, int rowIndex);
/** ----------------------------------------------------------------------------
* repairProcess_getObservable
* Returns the observable of the repair process
*
* @param self THe repair process object
*
* @return struct Observable* The observable object
*
* @todo
* -----------------------------------------------------------------------------
*/
extern struct Observable* repairProcess_getObservable(struct RepairProcess* self);
#endif /* REPAIRPROCESS_H_ */

View File

@@ -0,0 +1,69 @@
// -----------------------------------------------------------------------------
/// @file repairProcesses.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 repairProcesses.h
/// @ingroup {group_name}
#ifndef REPAIRPROCESSES_H_
#define REPAIRPROCESSES_H_
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include "stm32f10x.h"
#include "repairPreset.h"
#include "repairProcess.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
extern ErrorStatus repairProcesses_startMainRepairProcess(const struct RepairPreset* repairPreset, struct RepairProcessParameters* rpParameters);
extern void repairProcesses_abortMainRepairProcess(void);
extern ErrorStatus repairProcesses_mainRepairProcessAddObserver (const Observer observer);
extern void repairProcesses_mainRepairProcessRemoveObserver (const Observer observer);
extern struct RepairProcess* repairProcesses_getMainRepairProcess(void);
#endif /* REPAIRPROCESSES_H_ */