- Moved the menu texts to dedicated file to support future language switch option
- split the menu into core, elements as generic modules git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@270 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
#include "semphr.h"
|
||||
|
||||
#include "stm32f10x.h"
|
||||
#include "MenuCore.h"
|
||||
#include "RepairPreset.h"
|
||||
#include "repairProcess.h"
|
||||
|
||||
@@ -51,8 +52,6 @@
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#define REPAIRMENU_MAX_NUMBER_OF_ROWS (11)
|
||||
#define REPAIRMENU_MAX_NUMBER_OF_KEYS (16)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
@@ -60,93 +59,16 @@
|
||||
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MAINMENU = 0,
|
||||
RM_CATHODEMCP_SELECT,
|
||||
REPAIRMENU,
|
||||
ADMINMENU,
|
||||
CALIBRATIONMENU,
|
||||
PRESETMENU,
|
||||
RM_PRESET_PRINT,
|
||||
START_REPAIR,
|
||||
REPAIR_RUNNING,
|
||||
REPAIR_ASK_PAUSE,
|
||||
REPAIR_PAUSE,
|
||||
FINISH_CONTROL,
|
||||
FINISH,
|
||||
ERROR_STATE,
|
||||
WARNING_STATE,
|
||||
NO_MENU,
|
||||
NUMBER_OF_MENUS
|
||||
} T_MenuState;
|
||||
|
||||
struct RepairMenu;
|
||||
typedef void (*RepairMenuFunctionCall)(struct RepairMenu* self, int cursorIndex);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NO_ACTION = 0,
|
||||
HOTKEY_SELECT,
|
||||
SELECT,
|
||||
GOTO_STATE,
|
||||
EXECUTE_FUNCTION,
|
||||
SCROLL_UP,
|
||||
SCROLL_DOWN,
|
||||
DIGIT_INSERT
|
||||
} T_KeyAction;
|
||||
|
||||
struct MenuRow
|
||||
{
|
||||
char text[20];
|
||||
int newState;
|
||||
RepairMenuFunctionCall actionPointer;
|
||||
};
|
||||
|
||||
|
||||
struct KeyActionBinding
|
||||
{
|
||||
char key;
|
||||
Keypad_KeyState keyState;
|
||||
T_KeyAction action;
|
||||
int argument;
|
||||
RepairMenuFunctionCall actionPointer;
|
||||
};
|
||||
|
||||
|
||||
struct MenuPage
|
||||
{
|
||||
bool hasCursor;
|
||||
int numberOfRows;
|
||||
int maxNumberOfRows;
|
||||
int numberOfKeys;
|
||||
int maxNumberOfKeys;
|
||||
struct MenuRow row[REPAIRMENU_MAX_NUMBER_OF_ROWS];
|
||||
struct KeyActionBinding keyActionBinding[NUMBER_OF_KEY_EVENTS * REPAIRMENU_MAX_NUMBER_OF_KEYS];
|
||||
};
|
||||
|
||||
struct RepairMenu
|
||||
{
|
||||
TaskHandle_t taskHandle;
|
||||
int TaskPriority;
|
||||
uint16_t stackSize;
|
||||
bool runTask;
|
||||
bool initialized;
|
||||
struct Display* display;
|
||||
struct KeyboardDevice* keyboardDevice;
|
||||
struct MemoryDevice* memoryDevice;
|
||||
struct CachedStorage presetStorage;
|
||||
T_MenuState menuState;
|
||||
int cursorIndex;
|
||||
int scrollOffset;
|
||||
SemaphoreHandle_t repairScreenUpdateSemaphore;
|
||||
const struct RepairPreset* repairPreset;
|
||||
struct RepairProcessParameters rpParameters;
|
||||
struct MenuPage menuArray[NUMBER_OF_MENUS];
|
||||
char errorMessage[20];
|
||||
char warningMessage[20];
|
||||
Observer observer;
|
||||
struct MenuCore* menuCore;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -170,7 +92,7 @@ struct RepairMenu
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus repairMenu_construct(struct RepairMenu* self, struct Display* display, struct KeyboardDevice* keyboardDevice, struct MemoryDevice* memoryDevice, int taskPriority, uint16_t stackSize, Observer repairScreenUpdateObserver);
|
||||
extern ErrorStatus repairMenu_construct(struct RepairMenu* self, struct MenuCore* menuCore, struct MemoryDevice* memoryDevice, Observer repairScreenUpdateObserver);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
@@ -238,4 +160,10 @@ extern void repairMenu_interlockFailed(struct RepairMenu* self, T_INTERLOCK_ID i
|
||||
|
||||
extern void repairMenu_processFailed(struct RepairMenu* self);
|
||||
|
||||
|
||||
extern void repairMenu_menuStateHandle(struct MenuCore* menuCore);
|
||||
|
||||
|
||||
extern void repairMenu_createMenuEntries(struct MenuCore* menuCore);
|
||||
|
||||
#endif /* INC_REPAIRMENU_H_ */
|
||||
|
||||
Reference in New Issue
Block a user