Fixed some major issues with RAM shortage. Also moved the cached storage to a MALLOC design instead of fixed memory usage. Using freertos porteds malloc and free required to move to HEAP4 to make sure memory does not get fragmented.

Resized nearly all task stacks

Also: 
- Menu fixes for insertion. Almost done, just need to fix the negative voltage insertion for mcp and cathode
- Added Device parameters, must be filled in

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@271 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-11-07 15:50:25 +00:00
parent 27755498e6
commit 17207a3a4b
32 changed files with 1833 additions and 280 deletions

View File

@@ -0,0 +1,111 @@
// -----------------------------------------------------------------------------
/// @file DeviceParameters.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 DeviceParameters.h
/// @ingroup {group_name}
#ifndef DEVICEPARAMETERS_H_
#define DEVICEPARAMETERS_H_
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include "stm32f10x.h"
#include "PIDParameters.h"
#include "PIN.h"
#include "CachedStorage.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
/** ----------------------------------------------------------------------------
* RepairPresets_construct
* Constructor for repair presets
*
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus DeviceParameters_construct(struct CachedStorage* parametersStorage, struct MemoryDevice* memoryDevice);
/** ----------------------------------------------------------------------------
* DeviceParameters_destruct
* Description of function
*
* @param para1_name
* @param para2_name
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void DeviceParameters_destruct(void);
/** ----------------------------------------------------------------------------
* DeviceParameters_getPIDParameters
* Description of function
*
* @param para1_name
* @param para2_name
* @return struct PIDParameters*
*
* @todo
* -----------------------------------------------------------------------------
*/
extern struct PIDParameters* DeviceParameters_getPIDParameters(void);
/** ----------------------------------------------------------------------------
* DeviceParameters_getPIN
* Description of function
*
* @param para1_name
* @param para2_name
* @return struct PIN*
*
* @todo
* -----------------------------------------------------------------------------
*/
extern struct PIN* DeviceParameters_getPIN(void);
#endif /* DEVICEPARAMETERS_H_ */

View File

@@ -191,6 +191,52 @@ extern ErrorStatus Display_setBrightness(struct Display* self, size_t brightness
extern ErrorStatus Display_setContrast(struct Display* self, size_t contrast);
/** ----------------------------------------------------------------------------
* Display_setBlinkingCursorState
* Sets the status of the blinking cursor
*
* @param self The display information to use
* @param state The state of the blinking cursor to set
*
* @return ErrorStatus SUCCESS if clearing display was OK
* ERROR otherwise
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus Display_setBlinkingCursorState(struct Display* self, DisplayDevice_functionalState state);
/** ----------------------------------------------------------------------------
* Display_setCurosrToPosition
* Sets didplay cursor to given position
*
* @param self
* @param row
* @param column
*
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus Display_setCursorToPosition(struct Display* self, unsigned int row, unsigned int column);
/** ----------------------------------------------------------------------------
* Display_backspace
* puts the cursor back one column and removes the character
*
* @param self
*
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus Display_backspace(struct Display* self);
/** ----------------------------------------------------------------------------
* Display_write
* Write a text on the display

View File

@@ -35,12 +35,13 @@
#include "Observable.h"
#include "FreeRTOS.h"
#include "task.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------

View File

@@ -44,7 +44,7 @@
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configMAX_PRIORITIES ( 5 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 256 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 0x8000 ) )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 0x7000 ) )
#define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0

View File

@@ -37,6 +37,7 @@
#include "Display.h"
#include "KeyboardDevice.h"
#include "MenuStates.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
@@ -49,27 +50,6 @@
// 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
{
@@ -80,7 +60,9 @@ typedef enum
EXECUTE_FUNCTION,
SCROLL_UP,
SCROLL_DOWN,
DIGIT_INSERT
DIGIT_INSERT,
DIGIT_REMOVE,
DIGIT_INSERT_CONFIRM
} T_KeyAction;
struct MenuCore;
@@ -88,49 +70,51 @@ typedef void (*MenuCoreFunctionCall)(struct MenuCore* self);
struct MenuRow
{
char text[MENUCORE_DISPLAY_ROW_LENGTH];
const char* text;
int newState;
MenuCoreFunctionCall actionPointer;
};
struct KeyActionBinding
{
char key;
MenuCoreFunctionCall actionPointer;
int argument;
Keypad_KeyState keyState;
T_KeyAction action;
int argument;
MenuCoreFunctionCall actionPointer;
};
char key;
} __attribute__((packed));
struct MenuPage
{
struct MenuRow row[MENUCORE_MAX_NUMBER_OF_ROWS];
struct KeyActionBinding keyActionBinding[NUMBER_OF_KEY_EVENTS * MENUCORE_MAX_NUMBER_OF_KEYS];
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 MenuPage menuArray[RM_NUMBER_OF_MENUS];
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];
TaskHandle_t taskHandle;
int TaskPriority;
bool runTask;
bool initialized;
int cursorIndex;
int selectionIndex;
int scrollOffset;
int insertValue;
uint32_t popUpCounter;
MenuCoreFunctionCall _handleStateFunction;
uint16_t stackSize;
T_MenuState lastMenuState;
T_MenuState menuState;
};
// -----------------------------------------------------------------------------

View File

@@ -73,4 +73,12 @@ extern ErrorStatus MenuElements_addKeyAction_SCROLLUP (struct MenuPage* self, ch
extern ErrorStatus MenuElements_addKeyAction_SCROLLDOWN (struct MenuPage* self, char key, Keypad_KeyState keyState);
extern ErrorStatus MenuElements_addKeyAction_DIGITINSERT (struct MenuPage* self, char key, Keypad_KeyState keyState, unsigned int maxNumberOfDigits);
extern ErrorStatus MenuElements_addKeyAction_DIGITREMOVE (struct MenuPage* self, char key, Keypad_KeyState keyState);
extern ErrorStatus MenuElements_addKeyAction_DIGITINSERTCONFIRM (struct MenuPage* self, char key, Keypad_KeyState keyState, MenuCoreFunctionCall actionPointer);
#endif /* MENUELEMENTS_H_ */

View File

@@ -0,0 +1,109 @@
// -----------------------------------------------------------------------------
/// @file MenuStates.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 MenuStates.h
/// @ingroup {group_name}
#ifndef MENUSTATES_H_
#define MENUSTATES_H_
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
typedef enum
{
// --------------------------------------------------------------------------
// MAIN MENU
// --------------------------------------------------------------------------
RM_MAINMENU = 0,
// For Cathode/MCP, a menu screen is required prior to the repair menu
RM_REPAIR_CATHODEMCP_SELECT,
// --------------------------------------------------------------------------
// REPAIR TUBE MENUs
// --------------------------------------------------------------------------
// The repair menu screen
RM_REPAIRMENU,
// Select and show presets
RM_PRESETMENU,
RM_PRESET_PRINT,
// Repair screens
RM_START_REPAIR,
RM_REPAIR_RUNNING,
RM_FINISH_CONTROL,
RM_FINISH,
// Pause screens
RM_REPAIR_ASK_PAUSE,
RM_REPAIR_PAUSE,
// --------------------------------------------------------------------------
// ADMINISTRATION MENUs
// --------------------------------------------------------------------------
RM_ADMIN_CATHODEMCP_SELECT,
RM_ADMINMENU,
RM_ADMIN_CHANGEPIN,
RM_ADMIN_IOCONTROL,
RM_ADMIN_PRESET_CONFIG_SELECT,
RM_ADMIN_PRESET_CONFIG_FIRST_SOFTSTART,
RM_ADMIN_PRESET_CONFIG_FIRST_DURATION,
RM_ADMIN_PRESET_CONFIG_FIRST_VOLTAGE,
RM_ADMIN_PRESET_CONFIG_SECOND_SOFTSTART,
RM_ADMIN_PRESET_CONFIG_SECOND_DURATION,
RM_ADMIN_PRESET_CONFIG_SECOND_VOLTAGE,
RM_ADMIN_INFO,
RM_ADMIN_IO_INTERLOCK,
RM_ADMIN_IO_SOLENOID,
RM_ADMIN_IO_VOLTAGE_IN,
RM_ADMIN_IO_VOLTAGE_OUT,
RM_ADMIN_IO_TESLAGUN,
// --------------------------------------------------------------------------
// CALIBRATION MENUs
// --------------------------------------------------------------------------
RM_CALIBRATIONMENU,
RM_ERROR_STATE,
RM_WARNING_STATE,
RM_NO_MENU,
RM_NUMBER_OF_MENUS
} T_MenuState;
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
#endif /* MENUSTATES_H_ */

View File

@@ -68,6 +68,18 @@ static const char MenuText_CATHODEMCP_SELECT[MENUTEXT_NUMBER_OF_LANGUAGES][MENUC
}
};
static const char MenuText_ADMIN_CATHODEMCP_SELECT[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_NUMBER_OF_ROWS][MENUCORE_DISPLAY_ROW_LENGTH] =
{
{
"Administration",
" 1.Cathode",
" 2.MCP",
},
{
//FRENCH TBW
}
};
static const char MenuText_REPAIRMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_NUMBER_OF_ROWS][MENUCORE_DISPLAY_ROW_LENGTH] =
{
@@ -106,13 +118,149 @@ static const char MenuText_PRESETMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX
// -----------------------
// ADMINISTRATION MENU
// -----------------------
// Administration main screen
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"
" 3.Preset config",
" 4.Info & Version",
},
{
//FRENCH TBW
}
};
// Administration main screen
static const char MenuText_ADMINCHANGEPINMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_NUMBER_OF_ROWS][MENUCORE_DISPLAY_ROW_LENGTH] =
{
{
"Change PIN",
},
{
//FRENCH TBW
}
};
// Administration I/O Control screen
static const char MenuText_ADMINIOMAINMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_NUMBER_OF_ROWS][MENUCORE_DISPLAY_ROW_LENGTH] =
{
{
"I/O control",
" 1.Read interlock",
" 2.Solenoids",
" 3.Get voltage in",
" 4.Set voltage out",
" 5.Teslagun relais",
},
{
//FRENCH TBW
}
};
// Administration I/O Control screen
static const char MenuText_ADMINIOINTERLOCKMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_NUMBER_OF_ROWS][MENUCORE_DISPLAY_ROW_LENGTH] =
{
{
"Read interlock",
},
{
//FRENCH TBW
}
};
// Administration solenoids toggle screen
static const char MenuText_ADMINSOLENOIDMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_NUMBER_OF_ROWS][MENUCORE_DISPLAY_ROW_LENGTH] =
{
{
"Solenoids",
" Hold 0 to toggle",
"",
},
{
//FRENCH TBW
}
};
// Administration Get Voltage input screen
static const char MenuText_ADMINVOLTAGINMAINMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_NUMBER_OF_ROWS][MENUCORE_DISPLAY_ROW_LENGTH] =
{
{
"Get voltage in",
" 1.Channel 1",
" 2.Channel 2",
" 3.Channel 3",
},
{
//FRENCH TBW
}
};
// Administration Get Voltage output screen
static const char MenuText_ADMINVOLTAGOUTMAINMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_NUMBER_OF_ROWS][MENUCORE_DISPLAY_ROW_LENGTH] =
{
{
"Set voltage out",
" 1.Channel 1",
" 2.Channel 2",
" 3.Channel 3",
},
{
//FRENCH TBW
}
};
// Administration solenoids toggle screen
static const char MenuText_ADMINTESLAGUNMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_NUMBER_OF_ROWS][MENUCORE_DISPLAY_ROW_LENGTH] =
{
{
"Teslagun relais",
" Hold 0 to toggle",
"",
},
{
//FRENCH TBW
}
};
// Administration Preset configuration
static const char MenuText_ADMINPRESETCONFIGSELECTMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_NUMBER_OF_ROWS][MENUCORE_DISPLAY_ROW_LENGTH] =
{
{
"Preset config",
" 1.Preset 1 config",
" 2.Preset 2 config",
" 3.Preset 3 config",
" 4.Preset 4 config",
" 5.Preset 5 config",
" 6.Preset 6 config",
" 7.Preset 7 config",
" 8.Preset 8 config",
" 9.Preset 9 config",
},
{
//FRENCH TBW
}
};
// Administration INFO&VERSION
static const char MenuText_ADMININFOMENU[MENUTEXT_NUMBER_OF_LANGUAGES][MENUCORE_MAX_NUMBER_OF_ROWS][MENUCORE_DISPLAY_ROW_LENGTH] =
{
{
"Info & Version",
},
{
//FRENCH TBW

View File

@@ -0,0 +1,55 @@
// -----------------------------------------------------------------------------
/// @file PIDParameters.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 PIDParameters.h
/// @ingroup {group_name}
#ifndef PIDPARAMETERS_H_
#define PIDPARAMETERS_H_
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
struct PIDParameters
{
};
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
#endif /* PIDPARAMETERS_H_ */

View File

@@ -0,0 +1,55 @@
// -----------------------------------------------------------------------------
/// @file PIN.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 PIN.h
/// @ingroup {group_name}
#ifndef PIN_H_
#define PIN_H_
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
struct PIN
{
};
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
#endif /* PIN_H_ */

View File

@@ -37,7 +37,9 @@
// Constant and macro definitions
// -----------------------------------------------------------------------------
#define REPAIR_PRESET_MAX_STAGES (2)
#define REPAIR_PRESET_MAX_STAGES (2)
#define REPAIR_PRESET_MAX_ONE_STAGE_PRESETS (6)
#define REPAIR_PRESET_MAX_TWO_STAGE_PRESETS (3)
// -----------------------------------------------------------------------------
// Type definitions.
@@ -82,4 +84,46 @@ struct RepairPreset
*/
extern ErrorStatus RepairPreset_generateDefaultPreset(struct RepairPreset* self, unsigned int presetNumber);
/** ----------------------------------------------------------------------------
* RepairPreset_setSoftstartValue
* Description of function
*
* @param self
* @param value
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void RepairPreset_setSoftstartValue(struct RepairPresetParameters* self, unsigned int value);
/** ----------------------------------------------------------------------------
* RepairPreset_setSoftstartValue
* Description of function
*
* @param self
* @param value
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void RepairPreset_setDurationValue(struct RepairPresetParameters* self, unsigned int value);
/** ----------------------------------------------------------------------------
* RepairPreset_setSoftstartValue
* Description of function
*
* @param self
* @param value
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void RepairPreset_setVoltageValue(struct RepairPresetParameters* self, int value);
#endif /* REPAIRPRESET_H_ */

View File

@@ -108,12 +108,27 @@ extern ErrorStatus RepairPresets_loadPresets(REPAIR_PRESETS_ID presetID);
* must be between 1 and
* REPAIR_PRESETS_NUMBER_OF_PRESETS
*
* @return const struct RepairPreset*
* @return struct RepairPreset*
*
* @todo
* -----------------------------------------------------------------------------
*/
extern const struct RepairPreset* RepairPresets_getPreset(unsigned int index);
extern struct RepairPreset* RepairPresets_getPreset(unsigned int index);
extern ErrorStatus RepairPresets_writePreset(struct RepairPreset* preset);
/** ----------------------------------------------------------------------------
* RepairPresets_savePreset
* Description of function
*
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void RepairPresets_savePresets(void);

View File

@@ -44,13 +44,13 @@
// -----------------------------------------------------------------------------
#define HSB_MAINMENU_TASK_PRIORITY (2)
#define HSB_MAINMENU_TASK_STACKSIZE (1024)
#define HSB_MAINMENU_TASK_STACKSIZE (512)
#define HSB_MAINDISP_TASK_PRIORITY (2)
#define HSB_MAINDISP_TASK_STACKSIZE (512)
#define HSB_MAINDISP_TASK_STACKSIZE (256)
#define HSB_MAINREPR_TASK_PRIORITY (2)
#define HSB_MAINREPR_TASK_STACKSIZE (1024)
#define HSB_MAINREPR_TASK_STACKSIZE (512)
#define HSB_MAINREPR_OOL_DURATION (20)
#define HSB_MAINREPR_OOL_VALUE (300)