- 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:
@@ -115,7 +115,6 @@ ErrorStatus InternalFlash_write(const struct InternalFlash* self, uint32_t* buff
|
||||
{
|
||||
// Start address is NOT OK
|
||||
returnValue = ERROR;
|
||||
LOGGER_DEBUG(mainLog, "StartAddress error %X (%X %X)", _address, self->startAddress, self->endAddress);
|
||||
}
|
||||
}
|
||||
if (returnValue == SUCCESS)
|
||||
@@ -125,7 +124,6 @@ ErrorStatus InternalFlash_write(const struct InternalFlash* self, uint32_t* buff
|
||||
{
|
||||
// End address is NOT OK
|
||||
returnValue = ERROR;
|
||||
LOGGER_DEBUG(mainLog, "EndAddress error %X (%X)", _endAddress, self->endAddress);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +131,6 @@ ErrorStatus InternalFlash_write(const struct InternalFlash* self, uint32_t* buff
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
|
||||
LOGGER_DEBUG(mainLog, "Writing on address %X with length %d until address %X", _address, length *4, _endAddress);
|
||||
|
||||
// Unlock the FLASH bank
|
||||
FLASH_Unlock();
|
||||
@@ -142,14 +139,11 @@ ErrorStatus InternalFlash_write(const struct InternalFlash* self, uint32_t* buff
|
||||
int bufferIndex = 0;
|
||||
while((_address < _endAddress) && (FLASHStatus == FLASH_COMPLETE))
|
||||
{
|
||||
LOGGER_DEBUG(mainLog, "address %X --- Data %d", _address, buffer[bufferIndex]);
|
||||
FLASHStatus = FLASH_ProgramWord(_address, buffer[bufferIndex++]);
|
||||
// 32bit data register requires increment by 4 for next word address
|
||||
_address = _address + 4;
|
||||
vTaskDelay(100);
|
||||
}
|
||||
|
||||
LOGGER_DEBUG(mainLog, "Writing done = flash status is %d", FLASHStatus);
|
||||
// After programming, lock the FLASH
|
||||
FLASH_Lock();
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ DisplayContent.o \
|
||||
Error.o \
|
||||
FreeRTOSFixes.o \
|
||||
hwValidationMenu.o \
|
||||
MenuCore.o \
|
||||
MenuElements.o \
|
||||
repairMenu.o \
|
||||
repairMenus.o \
|
||||
RepairPreset.o \
|
||||
|
||||
@@ -0,0 +1,199 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file MenuCore.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 MenuCore.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
#ifndef MENUCORE_H_
|
||||
#define MENUCORE_H_
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "stm32f10x.h"
|
||||
|
||||
#include "Display.h"
|
||||
#include "KeyboardDevice.h"
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#define MENUCORE_MAX_NUMBER_OF_ROWS (11)
|
||||
#define MENUCORE_MAX_NUMBER_OF_KEYS (16)
|
||||
#define MENUCORE_DISPLAY_ROW_LENGTH (20)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RM_MAINMENU = 0,
|
||||
RM_CATHODEMCP_SELECT,
|
||||
RM_REPAIRMENU,
|
||||
RM_ADMINMENU,
|
||||
RM_CALIBRATIONMENU,
|
||||
RM_PRESETMENU,
|
||||
RM_PRESET_PRINT,
|
||||
RM_START_REPAIR,
|
||||
RM_REPAIR_RUNNING,
|
||||
RM_REPAIR_ASK_PAUSE,
|
||||
RM_REPAIR_PAUSE,
|
||||
RM_FINISH_CONTROL,
|
||||
RM_FINISH,
|
||||
RM_ERROR_STATE,
|
||||
RM_WARNING_STATE,
|
||||
RM_NO_MENU,
|
||||
RM_NUMBER_OF_MENUS
|
||||
} T_MenuState;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NO_ACTION = 0,
|
||||
HOTKEY_SELECT,
|
||||
SELECT,
|
||||
GOTO_STATE,
|
||||
EXECUTE_FUNCTION,
|
||||
SCROLL_UP,
|
||||
SCROLL_DOWN,
|
||||
DIGIT_INSERT
|
||||
} T_KeyAction;
|
||||
|
||||
struct MenuCore;
|
||||
typedef void (*MenuCoreFunctionCall)(struct MenuCore* self);
|
||||
|
||||
struct MenuRow
|
||||
{
|
||||
char text[MENUCORE_DISPLAY_ROW_LENGTH];
|
||||
int newState;
|
||||
MenuCoreFunctionCall actionPointer;
|
||||
};
|
||||
|
||||
struct KeyActionBinding
|
||||
{
|
||||
char key;
|
||||
Keypad_KeyState keyState;
|
||||
T_KeyAction action;
|
||||
int argument;
|
||||
MenuCoreFunctionCall actionPointer;
|
||||
};
|
||||
|
||||
struct MenuPage
|
||||
{
|
||||
bool hasCursor;
|
||||
int numberOfRows;
|
||||
int maxNumberOfRows;
|
||||
int numberOfKeys;
|
||||
int maxNumberOfKeys;
|
||||
struct MenuRow row[MENUCORE_MAX_NUMBER_OF_ROWS];
|
||||
struct KeyActionBinding keyActionBinding[NUMBER_OF_KEY_EVENTS * MENUCORE_MAX_NUMBER_OF_KEYS];
|
||||
};
|
||||
|
||||
struct MenuCore
|
||||
{
|
||||
TaskHandle_t taskHandle;
|
||||
int TaskPriority;
|
||||
uint16_t stackSize;
|
||||
bool runTask;
|
||||
bool initialized;
|
||||
struct Display* display;
|
||||
struct KeyboardDevice* keyboardDevice;
|
||||
int cursorIndex;
|
||||
int scrollOffset;
|
||||
T_MenuState menuState;
|
||||
uint32_t popUpCounter;
|
||||
T_MenuState lastMenuState;
|
||||
struct MenuPage menuArray[RM_NUMBER_OF_MENUS];
|
||||
MenuCoreFunctionCall _handleStateFunction;
|
||||
char errorMessage[MENUCORE_DISPLAY_ROW_LENGTH];
|
||||
char warningMessage[MENUCORE_DISPLAY_ROW_LENGTH];
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* MenuCore_construct
|
||||
* Description of function
|
||||
*
|
||||
* @param self Menu core object to construct
|
||||
* @param display Display device to use for output
|
||||
* @param keyboardDevice KeyboardDevice for menu input
|
||||
* @param taskPriority Priority for the menu task
|
||||
* @param stacksize Task stacksize
|
||||
* @param createMenu Functionpointer to a function that
|
||||
* creates the menu entries
|
||||
* must be provided in order to generate
|
||||
* the entries of the menu at the right
|
||||
* time.
|
||||
* @param stateHandle Functionpointer to a function that gets
|
||||
* called from the menu task everytime
|
||||
* PRIOR to the keyboard readout.
|
||||
* Handy for display printouts or other
|
||||
* functionality that is state-dependent
|
||||
*
|
||||
* @return ErrorStatus SUCCESS if construction was successful
|
||||
* ERROR otherwise
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern ErrorStatus MenuCore_construct(struct MenuCore* self, struct Display* display, struct KeyboardDevice* keyboardDevice, int taskPriority, uint16_t stackSize, MenuCoreFunctionCall createMenu, MenuCoreFunctionCall stateHandle);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* MenuCore_destruct
|
||||
* Destructor for menu Core
|
||||
*
|
||||
* @param self Menu core object to destruct
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void MenuCore_destruct(struct MenuCore* self);
|
||||
|
||||
|
||||
/** ----------------------------------------------------------------------------
|
||||
* MenuCore_changeState
|
||||
* Requests the menu to change its state
|
||||
*
|
||||
* @param self Menu core object
|
||||
* @param newState New state of the menu
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @todo
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
extern void MenuCore_changeState(struct MenuCore* self, T_MenuState newState);
|
||||
|
||||
|
||||
#endif /* MENUCORE_H_ */
|
||||
@@ -0,0 +1,76 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file MenuElements.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 MenuElements.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
#ifndef MENUELEMENTS_H_
|
||||
#define MENUELEMENTS_H_
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "MenuCore.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
extern ErrorStatus MenuElements_createMenuPage (struct MenuPage* self, bool hasCursor, int maxNumberOfRows);
|
||||
|
||||
|
||||
extern ErrorStatus MenuElements_addMenuPageRow (struct MenuPage* self, const char* text, int newState, MenuCoreFunctionCall actionCall);
|
||||
|
||||
|
||||
extern ErrorStatus MenuElements_addKeyAction_HOTKEYSELECT (struct MenuPage* self, char key, Keypad_KeyState keyState, int rowToSelect);
|
||||
|
||||
|
||||
extern ErrorStatus MenuElements_addKeyAction_SELECT (struct MenuPage* self, char key, Keypad_KeyState keyState);
|
||||
|
||||
|
||||
extern ErrorStatus MenuElements_addKeyAction_GOTOSTATE (struct MenuPage* self, char key, Keypad_KeyState keyState, T_MenuState state);
|
||||
|
||||
|
||||
extern ErrorStatus MenuElements_addKeyAction_EXECUTEFUNCTION (struct MenuPage* self, char key, Keypad_KeyState keyState, MenuCoreFunctionCall actionPointer);
|
||||
|
||||
|
||||
extern ErrorStatus MenuElements_addKeyAction_SCROLLUP (struct MenuPage* self, char key, Keypad_KeyState keyState);
|
||||
|
||||
|
||||
extern ErrorStatus MenuElements_addKeyAction_SCROLLDOWN (struct MenuPage* self, char key, Keypad_KeyState keyState);
|
||||
|
||||
#endif /* MENUELEMENTS_H_ */
|
||||
@@ -0,0 +1,149 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file MenuText.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 MenuText.h
|
||||
/// @ingroup {group_name}
|
||||
|
||||
#ifndef MENUTEXT_H_
|
||||
#define MENUTEXT_H_
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "MenuCore.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#define MENUTEXT_NUMBER_OF_LANGUAGES (2)
|
||||
#define MENUTEXT_ENGLISH (0)
|
||||
|
||||
// -----------------------
|
||||
// OPERATOR MENU
|
||||
// -----------------------
|
||||
static const char MenuText_MAINMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_NUMBER_OF_ROWS][MENUCORE_DISPLAY_ROW_LENGTH] =
|
||||
{
|
||||
{
|
||||
"",
|
||||
" 1.Tube repair",
|
||||
" 2.Administrator",
|
||||
" 3.Calibration"
|
||||
},
|
||||
{
|
||||
//FRENCH TBW
|
||||
}
|
||||
};
|
||||
|
||||
static const char MenuText_CATHODEMCP_SELECT[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_NUMBER_OF_ROWS][MENUCORE_DISPLAY_ROW_LENGTH] =
|
||||
{
|
||||
{
|
||||
"Tube repair",
|
||||
" 1.Cathode repair",
|
||||
" 2.MCP repair",
|
||||
},
|
||||
{
|
||||
//FRENCH TBW
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static const char MenuText_REPAIRMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_NUMBER_OF_ROWS][MENUCORE_DISPLAY_ROW_LENGTH] =
|
||||
{
|
||||
{
|
||||
"Tube repair",
|
||||
" 1.Select preset",
|
||||
" 2.Start",
|
||||
},
|
||||
{
|
||||
//FRENCH TBW
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static const char MenuText_PRESETMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_NUMBER_OF_ROWS][MENUCORE_DISPLAY_ROW_LENGTH] =
|
||||
{
|
||||
{
|
||||
"Select preset",
|
||||
" 1.Preset 1",
|
||||
" 2.Preset 2",
|
||||
" 3.Preset 3",
|
||||
" 4.Preset 4",
|
||||
" 5.Preset 5",
|
||||
" 6.Preset 6",
|
||||
" 7.Preset 7",
|
||||
" 8.Preset 8",
|
||||
" 9.Preset 9",
|
||||
},
|
||||
{
|
||||
//FRENCH TBW
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// -----------------------
|
||||
// ADMINISTRATION MENU
|
||||
// -----------------------
|
||||
static const char MenuText_ADMINMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_NUMBER_OF_ROWS][MENUCORE_DISPLAY_ROW_LENGTH] =
|
||||
{
|
||||
{
|
||||
"Administration",
|
||||
" 1.Change Pin",
|
||||
" 2.I/O control",
|
||||
" 3.Info & Version"
|
||||
},
|
||||
{
|
||||
//FRENCH TBW
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// -----------------------
|
||||
// CALIBRATION MENU
|
||||
// -----------------------
|
||||
static const char MenuText_CALIBRATIONMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_NUMBER_OF_ROWS][MENUCORE_DISPLAY_ROW_LENGTH] =
|
||||
{
|
||||
{
|
||||
"Calibration",
|
||||
" 1.NOTHING YET",
|
||||
|
||||
},
|
||||
{
|
||||
//FRENCH TBW
|
||||
}
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#endif /* MENUTEXT_H_ */
|
||||
@@ -100,6 +100,9 @@ extern void SignalProfileGenerator_calculate(struct SignalProfileGenerator* self
|
||||
extern void SignalProfileGenerator_pause(struct SignalProfileGenerator* self);
|
||||
|
||||
|
||||
extern bool SignalProfileGenerator_isPaused(struct SignalProfileGenerator* self);
|
||||
|
||||
|
||||
extern void SignalProfileGenerator_continue(struct SignalProfileGenerator* self);
|
||||
|
||||
|
||||
|
||||
@@ -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_ */
|
||||
|
||||
@@ -93,7 +93,6 @@ extern ErrorStatus DAConverter_setOutputVoltage(const struct DAConverter* self,
|
||||
uint32_t dacValue;
|
||||
dacValue = calculateDACValue(self, voltage);
|
||||
DACDevice_write(self->dacDevice, dacValue);
|
||||
LOGGER_DEBUG(mainLog, "Voltage %d --- value %X", voltage, (unsigned int)dacValue);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -0,0 +1,362 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file MenuCore.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) 2017 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// @file MenuCore.c
|
||||
/// @ingroup {group_name}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "MenuCore.h"
|
||||
|
||||
#include "Logger.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// File-scope variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static const char cursorValue[2] = {0x7E, '\0'};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// TASK prototype
|
||||
static void MenuCore_task(void* parameters);
|
||||
// Additional functions
|
||||
static void MenuCore_printMenu(struct MenuCore* self);
|
||||
static void MenuCore_printCursor(struct MenuCore* self);
|
||||
static ErrorStatus MenuCore_performAction(struct MenuCore* self, char key, Keypad_KeyState keyState);
|
||||
static struct KeyActionBinding MenuCore_findKeyAction(struct MenuCore* self, char key, Keypad_KeyState keyState);
|
||||
static void MenuCore_scrollIndexHandlerReset (struct MenuCore* self);
|
||||
static void MenuCore_scrollUpIndexHandler(struct MenuCore* self);
|
||||
static void MenuCore_scrollDownIndexHandler(struct MenuCore* self);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
ErrorStatus MenuCore_construct(struct MenuCore* self, struct Display* display, struct KeyboardDevice* keyboardDevice, int taskPriority, uint16_t stackSize, MenuCoreFunctionCall createMenu, MenuCoreFunctionCall stateHandle)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (!self->initialized)
|
||||
{
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
if (display->initialized)
|
||||
{
|
||||
self->display = display;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
if (keyboardDevice->initialized)
|
||||
{
|
||||
self->keyboardDevice = keyboardDevice;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
// Let Task run as soon as it has been created
|
||||
self->runTask = true;
|
||||
// Create the menucore task
|
||||
BaseType_t rv = xTaskCreate(MenuCore_task, "MenuCore", stackSize, self, taskPriority, &self->taskHandle);
|
||||
if (rv != pdTRUE)
|
||||
{
|
||||
returnValue = ERROR;
|
||||
LOGGER_ERROR(mainLog, "FAILED to start repair Menu with code %d", (int)rv);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER_INFO(mainLog, "MenuCore task started");
|
||||
// Create the menu entries
|
||||
createMenu(self);
|
||||
// Set all internal variables
|
||||
self->_handleStateFunction = stateHandle;
|
||||
self->scrollOffset = 0;
|
||||
self->cursorIndex = 1;
|
||||
self->menuState = 0;
|
||||
// Menu core is initialised - Menu core is good to go
|
||||
self->initialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
void MenuCore_destruct(struct MenuCore* self)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void MenuCore_task(void* parameters)
|
||||
{
|
||||
struct MenuCore* self = (struct MenuCore*)parameters;
|
||||
|
||||
// Clear the screen for a new menu
|
||||
Display_clearScreen(self->display);
|
||||
// Print menu content to output device
|
||||
MenuCore_printMenu(self);
|
||||
// Add cursor if necessary
|
||||
MenuCore_printCursor(self);
|
||||
|
||||
while(self->runTask)
|
||||
{
|
||||
char key;
|
||||
Keypad_KeyState keyState;
|
||||
|
||||
// Take care of potential actions that must be taken prior to reading the keyboard/input
|
||||
self->_handleStateFunction(self);
|
||||
|
||||
if (KeyboardDevice_read(self->keyboardDevice, &key, &keyState) == SUCCESS)
|
||||
{
|
||||
if (MenuCore_performAction(self, key, keyState) == SUCCESS)
|
||||
{
|
||||
// The key had an action
|
||||
// Clear the screen for a new menu
|
||||
Display_clearScreen(self->display);
|
||||
// Print menu content to output device
|
||||
MenuCore_printMenu(self);
|
||||
// Add cursor if necessary
|
||||
MenuCore_printCursor(self);
|
||||
}
|
||||
}
|
||||
vTaskDelay(50);
|
||||
}
|
||||
|
||||
LOGGER_INFO(mainLog, "Deleting MenuCore task");
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
|
||||
void MenuCore_changeState(struct MenuCore* self, T_MenuState newState)
|
||||
{
|
||||
Display_clearScreen(self->display);
|
||||
self->menuState = newState;
|
||||
LOGGER_WARNING(mainLog, "New menu index is %d", self->menuState);
|
||||
}
|
||||
|
||||
static void MenuCore_printMenu(struct MenuCore* self)
|
||||
{
|
||||
int loopCounter;
|
||||
|
||||
// Always print Row1 (index0), ignoring the scrolling index
|
||||
Display_write(self->display, self->menuArray[self->menuState].row[0].text, 1, 1);
|
||||
|
||||
for (loopCounter = 1 ; loopCounter < self->display->displayDevice->parameters.numberOfRows; loopCounter++)
|
||||
{
|
||||
Display_write(self->display, self->menuArray[self->menuState].row[loopCounter + self->scrollOffset].text, loopCounter + 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void MenuCore_printCursor(struct MenuCore* self)
|
||||
{
|
||||
if (self->menuArray[self->menuState].hasCursor)
|
||||
{
|
||||
Display_write(self->display, cursorValue, 1 + self->cursorIndex - self->scrollOffset, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static ErrorStatus MenuCore_performAction(struct MenuCore* self, char key, Keypad_KeyState keyState)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
struct KeyActionBinding keyAction = MenuCore_findKeyAction(self, key, keyState);
|
||||
LOGGER_DEBUG(mainLog, "Action: received key %c, action to perform %d,", key, keyAction.action);
|
||||
|
||||
switch (keyAction.action)
|
||||
{
|
||||
case NO_ACTION:
|
||||
{
|
||||
LOGGER_INFO(mainLog, "This button has no action");
|
||||
returnValue = ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
case HOTKEY_SELECT:
|
||||
{
|
||||
LOGGER_INFO(mainLog, "HOTKEY SELECT ITEM: char %c, argument %d - Going to state %d", keyAction.key, keyAction.argument, self->menuArray[self->menuState].row[keyAction.argument].newState);
|
||||
self->cursorIndex = keyAction.argument;
|
||||
T_MenuState tempState = self->menuState;
|
||||
MenuCore_changeState(self, self->menuArray[self->menuState].row[keyAction.argument].newState);
|
||||
if (self->menuArray[tempState].row[keyAction.argument].actionPointer != NULL)
|
||||
{
|
||||
self->menuArray[tempState].row[keyAction.argument].actionPointer(self);
|
||||
}
|
||||
MenuCore_scrollIndexHandlerReset(self);
|
||||
break;
|
||||
}
|
||||
|
||||
case SELECT:
|
||||
{
|
||||
LOGGER_INFO(mainLog, "SELECT ITEM %d - going to state %d", self->cursorIndex, self->menuArray[self->menuState].row[self->cursorIndex].newState);
|
||||
T_MenuState tempState = self->menuState;
|
||||
MenuCore_changeState(self, self->menuArray[self->menuState].row[self->cursorIndex].newState);
|
||||
if (self->menuArray[tempState].row[self->cursorIndex].actionPointer != NULL)
|
||||
{
|
||||
self->menuArray[tempState].row[self->cursorIndex].actionPointer(self);
|
||||
}
|
||||
MenuCore_scrollIndexHandlerReset(self);
|
||||
break;
|
||||
}
|
||||
|
||||
case GOTO_STATE:
|
||||
{
|
||||
LOGGER_INFO(mainLog, "Going to new state %d directly", keyAction.argument);
|
||||
MenuCore_changeState(self, keyAction.argument);
|
||||
// MenuCore_scrollIndexHandlerReset(self);
|
||||
break;
|
||||
}
|
||||
|
||||
case EXECUTE_FUNCTION:
|
||||
{
|
||||
LOGGER_INFO(mainLog, "Executing function directly");
|
||||
if (keyAction.actionPointer != NULL)
|
||||
{
|
||||
keyAction.actionPointer(self);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SCROLL_UP:
|
||||
{
|
||||
LOGGER_INFO(mainLog, "Scrolling up");
|
||||
MenuCore_scrollUpIndexHandler(self);
|
||||
break;
|
||||
}
|
||||
case SCROLL_DOWN:
|
||||
{
|
||||
LOGGER_INFO(mainLog, "Scrolling down");
|
||||
MenuCore_scrollDownIndexHandler(self);
|
||||
break;
|
||||
}
|
||||
case DIGIT_INSERT:
|
||||
{
|
||||
LOGGER_INFO(mainLog, "Key is allowed as insert");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
static struct KeyActionBinding MenuCore_findKeyAction(struct MenuCore* self, char key, Keypad_KeyState keyState)
|
||||
{
|
||||
int loopCounter;
|
||||
struct KeyActionBinding returnValue;
|
||||
returnValue.action = NO_ACTION;
|
||||
|
||||
for (loopCounter = 0; loopCounter < MENUCORE_MAX_NUMBER_OF_KEYS; loopCounter++)
|
||||
{
|
||||
if ((self->menuArray[self->menuState].keyActionBinding[loopCounter].key == key) && (self->menuArray[self->menuState].keyActionBinding[loopCounter].keyState == keyState))
|
||||
{
|
||||
returnValue = self->menuArray[self->menuState].keyActionBinding[loopCounter];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
static void MenuCore_scrollIndexHandlerReset (struct MenuCore* self)
|
||||
{
|
||||
self->cursorIndex = 1;
|
||||
self->scrollOffset = 0;
|
||||
}
|
||||
|
||||
static void MenuCore_scrollUpIndexHandler(struct MenuCore* self)
|
||||
{
|
||||
if (self->cursorIndex - self->scrollOffset > 1)
|
||||
{
|
||||
if (self->cursorIndex > 1)
|
||||
{
|
||||
self->cursorIndex--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (self->cursorIndex > 1)
|
||||
{
|
||||
self->cursorIndex--;
|
||||
}
|
||||
|
||||
if (self->scrollOffset > 0)
|
||||
{
|
||||
self->scrollOffset--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void MenuCore_scrollDownIndexHandler(struct MenuCore* self)
|
||||
{
|
||||
if (self->cursorIndex < self->display->displayDevice->parameters.numberOfRows - 1)
|
||||
{
|
||||
if (self->cursorIndex < self->menuArray[self->menuState].numberOfRows - 1)
|
||||
{
|
||||
self->cursorIndex++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (self->cursorIndex < self->menuArray[self->menuState].numberOfRows - 1)
|
||||
{
|
||||
self->cursorIndex++;
|
||||
}
|
||||
|
||||
if (self->scrollOffset < (self->menuArray[self->menuState].numberOfRows - self->display->displayDevice->parameters.numberOfRows))
|
||||
{
|
||||
self->scrollOffset++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file MenuElements.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) 2017 Micro-Key bv
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// @file MenuElements.c
|
||||
/// @ingroup {group_name}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "string.h"
|
||||
|
||||
#include "MenuElements.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// File-scope variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
ErrorStatus MenuElements_createMenuPage (struct MenuPage* self, bool hasCursor, int maxNumberOfRows)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (maxNumberOfRows <= MENUCORE_MAX_NUMBER_OF_ROWS)
|
||||
{
|
||||
self->maxNumberOfKeys = NUMBER_OF_KEY_EVENTS * MENUCORE_MAX_NUMBER_OF_KEYS;
|
||||
self->numberOfRows = 0;
|
||||
self->numberOfKeys = 0;
|
||||
self->maxNumberOfRows = maxNumberOfRows;
|
||||
self->hasCursor = hasCursor;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus MenuElements_addMenuPageRow (struct MenuPage* self, const char* text, int newState, MenuCoreFunctionCall actionCall)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
if (self->numberOfRows < self->maxNumberOfRows)
|
||||
{
|
||||
memcpy(self->row[self->numberOfRows].text, text, 20);
|
||||
self->row[self->numberOfRows].newState = newState;
|
||||
self->row[self->numberOfRows].actionPointer = actionCall;
|
||||
self->numberOfRows++;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus MenuElements_addKeyAction_HOTKEYSELECT (struct MenuPage* self, char key, Keypad_KeyState keyState, int rowToSelect)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->numberOfKeys < self->maxNumberOfKeys)
|
||||
{
|
||||
self->keyActionBinding[self->numberOfKeys].key = key;
|
||||
self->keyActionBinding[self->numberOfKeys].keyState = keyState;
|
||||
self->keyActionBinding[self->numberOfKeys].action = HOTKEY_SELECT;
|
||||
self->keyActionBinding[self->numberOfKeys].argument = rowToSelect;
|
||||
self->keyActionBinding[self->numberOfKeys].actionPointer = NULL;
|
||||
self->numberOfKeys++;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus MenuElements_addKeyAction_SELECT (struct MenuPage* self, char key, Keypad_KeyState keyState)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->numberOfKeys < self->maxNumberOfKeys)
|
||||
{
|
||||
self->keyActionBinding[self->numberOfKeys].key = key;
|
||||
self->keyActionBinding[self->numberOfKeys].keyState = keyState;
|
||||
self->keyActionBinding[self->numberOfKeys].action = SELECT;
|
||||
self->keyActionBinding[self->numberOfKeys].argument = 0;
|
||||
self->keyActionBinding[self->numberOfKeys].actionPointer = NULL;
|
||||
self->numberOfKeys++;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus MenuElements_addKeyAction_GOTOSTATE (struct MenuPage* self, char key, Keypad_KeyState keyState, T_MenuState state)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->numberOfKeys < self->maxNumberOfKeys)
|
||||
{
|
||||
self->keyActionBinding[self->numberOfKeys].key = key;
|
||||
self->keyActionBinding[self->numberOfKeys].keyState = keyState;
|
||||
self->keyActionBinding[self->numberOfKeys].action = GOTO_STATE;
|
||||
self->keyActionBinding[self->numberOfKeys].argument = state;
|
||||
self->keyActionBinding[self->numberOfKeys].actionPointer = NULL;
|
||||
self->numberOfKeys++;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus MenuElements_addKeyAction_EXECUTEFUNCTION (struct MenuPage* self, char key, Keypad_KeyState keyState, MenuCoreFunctionCall actionPointer)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->numberOfKeys < self->maxNumberOfKeys)
|
||||
{
|
||||
self->keyActionBinding[self->numberOfKeys].key = key;
|
||||
self->keyActionBinding[self->numberOfKeys].keyState = keyState;
|
||||
self->keyActionBinding[self->numberOfKeys].action = EXECUTE_FUNCTION;
|
||||
self->keyActionBinding[self->numberOfKeys].argument = 0;
|
||||
self->keyActionBinding[self->numberOfKeys].actionPointer = actionPointer;
|
||||
self->numberOfKeys++;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus MenuElements_addKeyAction_SCROLLUP (struct MenuPage* self, char key, Keypad_KeyState keyState)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->numberOfKeys < self->maxNumberOfKeys)
|
||||
{
|
||||
self->keyActionBinding[self->numberOfKeys].key = key;
|
||||
self->keyActionBinding[self->numberOfKeys].keyState = keyState;
|
||||
self->keyActionBinding[self->numberOfKeys].action = SCROLL_UP;
|
||||
self->keyActionBinding[self->numberOfKeys].argument = 0;
|
||||
self->keyActionBinding[self->numberOfKeys].actionPointer = NULL;
|
||||
self->numberOfKeys++;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
ErrorStatus MenuElements_addKeyAction_SCROLLDOWN (struct MenuPage* self, char key, Keypad_KeyState keyState)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
if (self->numberOfKeys < self->maxNumberOfKeys)
|
||||
{
|
||||
self->keyActionBinding[self->numberOfKeys].key = key;
|
||||
self->keyActionBinding[self->numberOfKeys].keyState = keyState;
|
||||
self->keyActionBinding[self->numberOfKeys].action = SCROLL_DOWN;
|
||||
self->keyActionBinding[self->numberOfKeys].argument = 0;
|
||||
self->keyActionBinding[self->numberOfKeys].actionPointer = NULL;
|
||||
self->numberOfKeys++;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = ERROR;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
@@ -249,6 +249,21 @@ void SignalProfileGenerator_pause(struct SignalProfileGenerator* self)
|
||||
}
|
||||
|
||||
|
||||
bool SignalProfileGenerator_isPaused(struct SignalProfileGenerator* self)
|
||||
{
|
||||
bool returnValue;
|
||||
if (self->currentState == SPG_PAUSE)
|
||||
{
|
||||
returnValue = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = false;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
void SignalProfileGenerator_continue(struct SignalProfileGenerator* self)
|
||||
{
|
||||
self->currentState = SPG_PAUSE_RESTORE;
|
||||
|
||||
@@ -180,8 +180,6 @@ static ErrorStatus systeminfoCommandHandler(void)
|
||||
vTaskDelay(10);
|
||||
OS_logTaskInfo(mainDisplay->taskHandle);
|
||||
vTaskDelay(10);
|
||||
OS_logTaskInfo(repairMenus_getMainRepairMenu()->taskHandle);
|
||||
vTaskDelay(10);
|
||||
OS_logTaskInfo(repairProcesses_getMainRepairProcess()->taskHandle);
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,6 +30,7 @@
|
||||
#include "hsb-mrts.h"
|
||||
|
||||
#include "Error.h"
|
||||
#include "MenuCore.h"
|
||||
#include "repairMenus.h"
|
||||
#include "repairMenu.h"
|
||||
|
||||
@@ -49,6 +50,9 @@
|
||||
// Type definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static struct MenuCore _menuCore = {.initialized = false};
|
||||
struct MenuCore* const menuCore = &_menuCore;
|
||||
|
||||
static struct RepairMenu _mainMenu = {.initialized = false};
|
||||
struct RepairMenu* const mainMenu = &_mainMenu;
|
||||
|
||||
@@ -62,8 +66,8 @@ struct RepairMenu* const mainMenu = &_mainMenu;
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static ErrorStatus repairMenu_errorReceive(const void* const data);
|
||||
static ErrorStatus repairMenu_freeMainMenuRepairScreenUpdateSemaphore(const void* const data);
|
||||
static ErrorStatus repairMenus_errorReceive(const void* const data);
|
||||
static ErrorStatus repairMenus_freeMainMenuRepairScreenUpdateSemaphore(const void* const data);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function definitions
|
||||
@@ -75,13 +79,16 @@ ErrorStatus repairMenus_construct(void)
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
// Create the Menu core
|
||||
returnValue = MenuCore_construct(menuCore, mainDisplay, &storm700->keyboardDevice, HSB_MAINMENU_TASK_PRIORITY, HSB_MAINMENU_TASK_STACKSIZE, repairMenu_createMenuEntries, repairMenu_menuStateHandle);
|
||||
|
||||
// Create first repair menu
|
||||
returnValue = repairMenu_construct(mainMenu, mainDisplay, &storm700->keyboardDevice, &iFlash->memoryDevice, HSB_MAINMENU_TASK_PRIORITY, HSB_MAINMENU_TASK_STACKSIZE, repairMenu_freeMainMenuRepairScreenUpdateSemaphore);
|
||||
returnValue = repairMenu_construct(mainMenu, menuCore,&iFlash->memoryDevice, repairMenus_freeMainMenuRepairScreenUpdateSemaphore);
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
returnValue = Observable_addObserver(Error_getObservable(), repairMenu_errorReceive);
|
||||
returnValue = Observable_addObserver(Error_getObservable(), repairMenus_errorReceive);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
@@ -90,7 +97,7 @@ ErrorStatus repairMenus_construct(void)
|
||||
|
||||
void repairMenus_destruct(void)
|
||||
{
|
||||
Observable_deleteObserver(Error_getObservable(), repairMenu_errorReceive);
|
||||
Observable_deleteObserver(Error_getObservable(), repairMenus_errorReceive);
|
||||
repairMenu_destruct(mainMenu);
|
||||
}
|
||||
|
||||
@@ -101,7 +108,7 @@ struct RepairMenu* repairMenus_getMainRepairMenu(void)
|
||||
}
|
||||
|
||||
|
||||
static ErrorStatus repairMenu_errorReceive(const void* const data)
|
||||
static ErrorStatus repairMenus_errorReceive(const void* const data)
|
||||
{
|
||||
|
||||
T_ErrorCode errorCode = (T_ErrorCode)data;
|
||||
@@ -122,7 +129,7 @@ static ErrorStatus repairMenu_errorReceive(const void* const data)
|
||||
}
|
||||
|
||||
|
||||
static ErrorStatus repairMenu_freeMainMenuRepairScreenUpdateSemaphore(const void* const data)
|
||||
static ErrorStatus repairMenus_freeMainMenuRepairScreenUpdateSemaphore(const void* const data)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
if (xSemaphoreGive(mainMenu->repairScreenUpdateSemaphore) != pdTRUE)
|
||||
|
||||
@@ -231,7 +231,7 @@ static void repairProcess_task(void* parameters)
|
||||
LOGGER_DEBUG(mainLog, "Signal: %d, TimeToRemain %d", self->signalProfileGenerator.signal, (unsigned int)SignalProfileGenerator_getRemainingTime(&self->signalProfileGenerator));
|
||||
|
||||
// Check for correct signal
|
||||
// if (self->signalProfileGenerator.signal >= 0)
|
||||
if (!SignalProfileGenerator_isPaused(&self->signalProfileGenerator))
|
||||
{
|
||||
// Regulation is unique for each row
|
||||
// For TESLA repair only row 1 (out of 0,1,2) is used
|
||||
|
||||
Reference in New Issue
Block a user