- 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:
@@ -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