- Added initial version of Hierarchical Menu
- Beautified the Message Box a bit
This commit is contained in:
@@ -37,6 +37,7 @@ static float _Current_BusVoltage_V;
|
||||
// Function Declarations
|
||||
void Screen_Setup_Graph(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration);
|
||||
|
||||
static void Screen_Init (Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration);
|
||||
static void Screen_Tick (void);
|
||||
static void Screen_Click (uint button_return_value);
|
||||
static void Screen_Touch_Event (int16_t x, int16_t y);
|
||||
@@ -53,7 +54,19 @@ static void Screen_On_Object_Deselect (Object_ID object_id);
|
||||
*******************************************************************/
|
||||
void Screen_Setup_Graph(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration)
|
||||
{
|
||||
_Screen_Tick = Screen_Tick;
|
||||
Screen_Init(direction_out, direction_in, type, frame_duration);
|
||||
|
||||
for(int i=0;i<GRAPH_DATA_WDITH;i++) {
|
||||
_Data_BusVoltage[i] = 0;
|
||||
_Data_BusVoltage_Threshold_Overvoltage[i] = THRESHOLD_OVERVOLTAGE_mV;
|
||||
_Data_BusVoltage_Threshold_Undervoltage[i] = THRESHOLD_UNDERVOLTAGE_mV;
|
||||
}
|
||||
}
|
||||
|
||||
void Screen_Init(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration)
|
||||
{
|
||||
_Screen_Last = Screen_Init;
|
||||
_Screen_Tick = Screen_Tick;
|
||||
_Screen_Click = Screen_Click;
|
||||
_Screen_Touch_Event = Screen_Touch_Event;
|
||||
_Screen_Action_CW = Screen_Action_CW;
|
||||
@@ -64,21 +77,12 @@ void Screen_Setup_Graph(Screen_Transition_Direction direction_out, Screen_Transi
|
||||
_Screen_On_Object_Deselect = Screen_On_Object_Deselect;
|
||||
|
||||
Display_Objects_Clear();
|
||||
|
||||
Display_Screen_Transition_Start(direction_out, direction_in, type, frame_duration);
|
||||
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//////////////////////////////
|
||||
// Add Display Objects here //
|
||||
//////////////////////////////
|
||||
for(int i=0;i<GRAPH_DATA_WDITH;i++) {
|
||||
_Data_BusVoltage[i] = 0;
|
||||
_Data_BusVoltage_Threshold_Overvoltage[i] = THRESHOLD_OVERVOLTAGE_mV;
|
||||
_Data_BusVoltage_Threshold_Undervoltage[i] = THRESHOLD_UNDERVOLTAGE_mV;
|
||||
}
|
||||
|
||||
Font_ID Font_10_1 = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_10x17, 1);
|
||||
Font_ID Font_10_1 = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_10x17, 1);
|
||||
|
||||
Display_Objects_Add_Graph(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, false, _Data_BusVoltage, GRAPH_DATA_WDITH, 32000, 0, DISPLAY_COLOR_WHITE, 200, NO_STYLE, NO_ANIMATION);
|
||||
Display_Objects_Add_Graph(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, false, _Data_BusVoltage_Threshold_Overvoltage, GRAPH_DATA_WDITH, 32000, 0, DISPLAY_COLOR_RED, 200, NO_STYLE, NO_ANIMATION);
|
||||
|
||||
@@ -41,9 +41,6 @@
|
||||
|
||||
// ============================================================================================
|
||||
// Variables
|
||||
extern const unsigned char _Font_Victor_Mono_Bold_8x19[];
|
||||
extern const unsigned char _Font_Victor_Mono_Regular_6x11[];
|
||||
extern const unsigned char _Font_Victor_Mono_Regular_7x13[];
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_10x17[];
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_6x12[];
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_Bold_Oblique_10x19[];
|
||||
|
||||
@@ -56,18 +56,29 @@ static int16_t _X_Data_Info = 10+25;
|
||||
static int16_t _X_Data_Timestamp = 10+89;
|
||||
static int16_t _X_Data_Timestamp_Text = 10+25;
|
||||
|
||||
static int16_t _Y_Offest_Scroll;
|
||||
static int32_t _Y_Offest_Scroll;
|
||||
static int16_t _Y_Offset_1st_Entry = 20;
|
||||
static int16_t _Y_Offset_Rows = 10;
|
||||
static int16_t _Y_Between_Entries = 38;
|
||||
|
||||
static int16_t _Y_Scroll_Speed = 10;
|
||||
|
||||
// Default configuration
|
||||
static const Encoder_Acceleration_Config _MIDI_Log_Acceleration_Config = {
|
||||
.Base_Step = 10,
|
||||
.Base_Threshold = 5, // Requires more steps to trigger
|
||||
.Level_Step = 3, // Bigger jumps between levels
|
||||
.Max_Level = 3, // Fewer levels
|
||||
.Timeout_ms = 100, // Longer timeout
|
||||
.Multipliers = {1, 2, 3, 5, 7, 10, 13, 16, 20, 25}
|
||||
};
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Function Declarations
|
||||
void Screen_Setup_MIDI_Log(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration);
|
||||
|
||||
static void Screen_Init (Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration);
|
||||
static void Screen_Tick (void);
|
||||
static void Screen_Click (uint button_return_value);
|
||||
static void Screen_Action_CW (Object_ID object_id);
|
||||
@@ -89,7 +100,15 @@ bool Check_Entry_Is_Command(uint entry_id);
|
||||
*******************************************************************/
|
||||
void Screen_Setup_MIDI_Log(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration)
|
||||
{
|
||||
_Screen_Tick = Screen_Tick;
|
||||
Screen_Init(direction_out, direction_in, type, frame_duration);
|
||||
|
||||
_Y_Offest_Scroll = 0;
|
||||
}
|
||||
|
||||
void Screen_Init(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration)
|
||||
{
|
||||
_Screen_Last = Screen_Init;
|
||||
_Screen_Tick = Screen_Tick;
|
||||
_Screen_Click = Screen_Click;
|
||||
_Screen_Action_CW = Screen_Action_CW;
|
||||
_Screen_Action_CCW = Screen_Action_CCW;
|
||||
@@ -101,6 +120,10 @@ void Screen_Setup_MIDI_Log(Screen_Transition_Direction direction_out, Screen_Tra
|
||||
Display_Objects_Clear();
|
||||
Display_Screen_Transition_Start(direction_out, direction_in, type, frame_duration);
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
// Add Display Objects here //
|
||||
//////////////////////////////
|
||||
Font_ID Font_10_0 = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_6x12, 0);
|
||||
Font_ID Font_10_1 = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_6x12, 1);
|
||||
|
||||
@@ -110,12 +133,6 @@ void Screen_Setup_MIDI_Log(Screen_Transition_Direction direction_out, Screen_Tra
|
||||
|
||||
Style_ID Style_Header = Display_Objects_Add_Style(DISPLAY_COLOR_LIGHTGREY, DISPLAY_COLOR_BLACK, 0, 2, PADDING_1(2), STYLE_WIDTH_HEIGHT_RATIO_AUTO);
|
||||
|
||||
//////////////////////////////
|
||||
// Add Display Objects here //
|
||||
//////////////////////////////
|
||||
|
||||
_Y_Offest_Scroll = 0;
|
||||
|
||||
_Object_Text_Top = Display_Objects_Add_Text(CENTER_TOP, X_IN_PERCENT_Y_IN_PIXEL, 50, 0, NOT_SELECTABLE, "Received MIDI Data", Font_10_0, DISPLAY_COLOR_BLACK, Style_Header, NO_ANIMATION);
|
||||
|
||||
for(int16_t i=0;i<RECEIVED_MIDI_HISTORY_BUFFER_SIZE;i++)
|
||||
@@ -141,6 +158,10 @@ void Screen_Setup_MIDI_Log(Screen_Transition_Direction direction_out, Screen_Tra
|
||||
|
||||
Update_Object_Coordinates();
|
||||
Display_Select_Object();
|
||||
|
||||
UI_Control_Acceleration_Reset();
|
||||
UI_Control_Acceleration_Init_Custom(&_MIDI_Log_Acceleration_Config);
|
||||
UI_Control_Acceleration_Set_Enabled(true);
|
||||
}
|
||||
|
||||
void Screen_Tick(void)
|
||||
@@ -155,13 +176,15 @@ void Screen_Click(uint button_return_value)
|
||||
|
||||
void Screen_Action_CW(Object_ID object_id)
|
||||
{
|
||||
_Y_Offest_Scroll -= _Y_Scroll_Speed;
|
||||
// _Y_Offest_Scroll -= _Y_Scroll_Speed;
|
||||
UI_Control_Selector_Dec(&_Y_Offest_Scroll, INT16_MIN, INT16_MAX, false);
|
||||
Update_Object_Coordinates();
|
||||
}
|
||||
|
||||
void Screen_Action_CCW(Object_ID object_id)
|
||||
{
|
||||
_Y_Offest_Scroll += _Y_Scroll_Speed;
|
||||
// _Y_Offest_Scroll += _Y_Scroll_Speed;
|
||||
UI_Control_Selector_Inc(&_Y_Offest_Scroll, INT16_MIN, INT16_MAX, false);
|
||||
Update_Object_Coordinates();
|
||||
}
|
||||
|
||||
@@ -182,7 +205,10 @@ void Screen_On_Object_Select(Object_ID object_id)
|
||||
|
||||
void Screen_On_Object_Deselect(Object_ID object_id)
|
||||
{
|
||||
Screen_Setup_Menu_Main(TRANSITION_RIGHT, TRANSITION_RIGHT, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, false, 0);
|
||||
UI_Control_Init(); // Reset to default configuration
|
||||
UI_Control_Acceleration_Set_Enabled(false);
|
||||
|
||||
Screen_Setup_Menu_Main(TRANSITION_RIGHT, TRANSITION_RIGHT, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, false, 0);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
@@ -190,22 +216,22 @@ void Screen_On_Object_Deselect(Object_ID object_id)
|
||||
*******************************************************************/
|
||||
void Update_Object_Coordinates(void)
|
||||
{
|
||||
Display_Objects_Update_Coordinates(_Object_Text_Top, CENTER_TOP, X_IN_PERCENT_Y_IN_PIXEL, 50, _Y_Offest_Scroll);
|
||||
Display_Objects_Update_Coordinates(_Object_Text_Top, CENTER_TOP, X_IN_PERCENT_Y_IN_PIXEL, 50, (int16_t)_Y_Offest_Scroll);
|
||||
|
||||
for(uint i=0;i<RECEIVED_MIDI_HISTORY_BUFFER_SIZE;i++)
|
||||
{
|
||||
Object_History_Entry_s *E = &Objects_History[i];
|
||||
|
||||
Display_Objects_Update_Coordinates(E->Object_Number , LEFT_TOP, BOTH_IN_PIXEL, _X_Number , _Y_Offset_1st_Entry + _Y_Offest_Scroll + i*_Y_Between_Entries);
|
||||
Display_Objects_Update_Coordinates(E->Object_Data_Hex , LEFT_TOP, BOTH_IN_PIXEL, _X_Data_Hex , _Y_Offset_1st_Entry + _Y_Offest_Scroll + i*_Y_Between_Entries);
|
||||
Display_Objects_Update_Coordinates(E->Object_Data_Dec , LEFT_TOP, BOTH_IN_PIXEL, _X_Data_Dec , _Y_Offset_1st_Entry + _Y_Offest_Scroll + i*_Y_Between_Entries);
|
||||
Display_Objects_Update_Coordinates(E->Object_Type_Info , LEFT_TOP, BOTH_IN_PIXEL, _X_Data_Info , _Y_Offset_1st_Entry + _Y_Offest_Scroll + i*_Y_Between_Entries + 1 * _Y_Offset_Rows);
|
||||
Display_Objects_Update_Coordinates(E->Object_Timestamp , LEFT_TOP, BOTH_IN_PIXEL, _X_Data_Timestamp , _Y_Offset_1st_Entry + _Y_Offest_Scroll + i*_Y_Between_Entries + 2 * _Y_Offset_Rows);
|
||||
Display_Objects_Update_Coordinates(E->Object_Timestamp_Text , LEFT_TOP, BOTH_IN_PIXEL, _X_Data_Timestamp_Text , _Y_Offset_1st_Entry + _Y_Offest_Scroll + i*_Y_Between_Entries + 2 * _Y_Offset_Rows);
|
||||
Display_Objects_Update_Coordinates(E->Object_Number , LEFT_TOP, BOTH_IN_PIXEL, _X_Number , _Y_Offset_1st_Entry + (int16_t)_Y_Offest_Scroll + i*_Y_Between_Entries);
|
||||
Display_Objects_Update_Coordinates(E->Object_Data_Hex , LEFT_TOP, BOTH_IN_PIXEL, _X_Data_Hex , _Y_Offset_1st_Entry + (int16_t)_Y_Offest_Scroll + i*_Y_Between_Entries);
|
||||
Display_Objects_Update_Coordinates(E->Object_Data_Dec , LEFT_TOP, BOTH_IN_PIXEL, _X_Data_Dec , _Y_Offset_1st_Entry + (int16_t)_Y_Offest_Scroll + i*_Y_Between_Entries);
|
||||
Display_Objects_Update_Coordinates(E->Object_Type_Info , LEFT_TOP, BOTH_IN_PIXEL, _X_Data_Info , _Y_Offset_1st_Entry + (int16_t)_Y_Offest_Scroll + i*_Y_Between_Entries + 1 * _Y_Offset_Rows);
|
||||
Display_Objects_Update_Coordinates(E->Object_Timestamp , LEFT_TOP, BOTH_IN_PIXEL, _X_Data_Timestamp , _Y_Offset_1st_Entry + (int16_t)_Y_Offest_Scroll + i*_Y_Between_Entries + 2 * _Y_Offset_Rows);
|
||||
Display_Objects_Update_Coordinates(E->Object_Timestamp_Text , LEFT_TOP, BOTH_IN_PIXEL, _X_Data_Timestamp_Text , _Y_Offset_1st_Entry + (int16_t)_Y_Offest_Scroll + i*_Y_Between_Entries + 2 * _Y_Offset_Rows);
|
||||
}
|
||||
|
||||
Display_Objects_Update_Coordinates(_Object_Text_Bottom, CENTER_TOP, X_IN_PERCENT_Y_IN_PIXEL, 50, _Y_Offset_1st_Entry + _Y_Offest_Scroll + RECEIVED_MIDI_HISTORY_BUFFER_SIZE*_Y_Between_Entries);
|
||||
Display_Objects_Update_Coordinates(_Object_Text_Return, CENTER_TOP, X_IN_PERCENT_Y_IN_PIXEL, 50, _Y_Offset_1st_Entry + _Y_Offest_Scroll + RECEIVED_MIDI_HISTORY_BUFFER_SIZE*_Y_Between_Entries + _Y_Offset_1st_Entry);
|
||||
Display_Objects_Update_Coordinates(_Object_Text_Bottom, CENTER_TOP, X_IN_PERCENT_Y_IN_PIXEL, 50, _Y_Offset_1st_Entry + (int16_t)_Y_Offest_Scroll + RECEIVED_MIDI_HISTORY_BUFFER_SIZE*_Y_Between_Entries);
|
||||
Display_Objects_Update_Coordinates(_Object_Text_Return, CENTER_TOP, X_IN_PERCENT_Y_IN_PIXEL, 50, _Y_Offset_1st_Entry + (int16_t)_Y_Offest_Scroll + RECEIVED_MIDI_HISTORY_BUFFER_SIZE*_Y_Between_Entries + _Y_Offset_1st_Entry);
|
||||
}
|
||||
|
||||
void Update_Object_Values(void)
|
||||
|
||||
@@ -80,11 +80,14 @@ static Configuration_Menu_Ring _Ring_Menu_Config = {
|
||||
.Enable_Appear_Animation = false
|
||||
};
|
||||
|
||||
static bool _Do_Menu_Animation;
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Function Declarations
|
||||
void Screen_Setup_Menu_Main(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, bool do_menu_animation, uint32_t selected_entry);
|
||||
|
||||
static void Screen_Init (Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration);
|
||||
static void Screen_Tick (void);
|
||||
static void Screen_Click (uint button_return_value);
|
||||
static void Screen_Touch_Event (int16_t x, int16_t y);
|
||||
@@ -102,7 +105,21 @@ static void Screen_On_Object_Deselect (Object_ID object_id);
|
||||
*******************************************************************/
|
||||
void Screen_Setup_Menu_Main(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, bool do_menu_animation, uint32_t selected_entry)
|
||||
{
|
||||
_Screen_Tick = Screen_Tick;
|
||||
_Do_Menu_Animation = do_menu_animation;
|
||||
|
||||
Screen_Init(direction_out, direction_in, type, frame_duration);
|
||||
|
||||
// Initialize values
|
||||
_Ring_Menu_Selected = 0;
|
||||
if(selected_entry < ENTRY_COUNT) {
|
||||
_Ring_Menu_Selected = selected_entry;
|
||||
}
|
||||
}
|
||||
|
||||
void Screen_Init(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration)
|
||||
{
|
||||
_Screen_Last = Screen_Init;
|
||||
_Screen_Tick = Screen_Tick;
|
||||
_Screen_Click = Screen_Click;
|
||||
_Screen_Touch_Event = Screen_Touch_Event;
|
||||
_Screen_Action_CW = Screen_Action_CW;
|
||||
@@ -116,26 +133,20 @@ void Screen_Setup_Menu_Main(Screen_Transition_Direction direction_out, Screen_Tr
|
||||
|
||||
Display_Screen_Transition_Start(direction_out, direction_in, type, frame_duration);
|
||||
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//////////////////////////////
|
||||
// Add Display Objects here //
|
||||
//////////////////////////////
|
||||
|
||||
_Object_Ring_Menu = Display_Objects_Add_Menu_Ring(_Ring_Menu_Items, ENTRY_COUNT, &_Ring_Menu_Selected, &_Ring_Menu_Config);
|
||||
_Object_Ring_Menu = Display_Objects_Add_Menu_Ring(_Ring_Menu_Items, ENTRY_COUNT, &_Ring_Menu_Selected, &_Ring_Menu_Config);
|
||||
|
||||
if(do_menu_animation) {
|
||||
if(_Do_Menu_Animation) {
|
||||
Display_Objects_Menu_Ring_Start_Appear_Animation(_Object_Ring_Menu);
|
||||
}
|
||||
|
||||
Display_Select_First_Object();
|
||||
Display_Select_Object();
|
||||
_Do_Menu_Animation = false;
|
||||
|
||||
// Initialize values
|
||||
_Ring_Menu_Selected = 0;
|
||||
if(selected_entry < ENTRY_COUNT) {
|
||||
_Ring_Menu_Selected = selected_entry;
|
||||
}
|
||||
Display_Select_First_Object();
|
||||
Display_Select_Object();
|
||||
}
|
||||
|
||||
void Screen_Tick(void)
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
// Function Declarations
|
||||
void Screen_Setup_Mode(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration);
|
||||
|
||||
static void Screen_Init (Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration);
|
||||
static void Screen_Tick (void);
|
||||
static void Screen_Click (uint button_return_value);
|
||||
static void Screen_Touch_Event (int16_t x, int16_t y);
|
||||
@@ -43,7 +44,13 @@ static void Screen_On_Object_Deselect (Object_ID object_id);
|
||||
*******************************************************************/
|
||||
void Screen_Setup_Mode(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration)
|
||||
{
|
||||
_Screen_Tick = Screen_Tick;
|
||||
Screen_Init(direction_out, direction_in, type, frame_duration);
|
||||
}
|
||||
|
||||
void Screen_Init(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration)
|
||||
{
|
||||
_Screen_Last = Screen_Init;
|
||||
_Screen_Tick = Screen_Tick;
|
||||
_Screen_Click = Screen_Click;
|
||||
_Screen_Touch_Event = Screen_Touch_Event;
|
||||
_Screen_Action_CW = Screen_Action_CW;
|
||||
@@ -60,8 +67,7 @@ void Screen_Setup_Mode(Screen_Transition_Direction direction_out, Screen_Transit
|
||||
//////////////////////////////
|
||||
// Add Display Objects here //
|
||||
//////////////////////////////
|
||||
|
||||
Display_Objects_Add_Rectangle_Frame(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, NOT_SELECTABLE, DISPLAY_COLOR_RED, 80, 80, 1, NO_STYLE, NO_ANIMATION);
|
||||
Display_Objects_Add_Rectangle_Frame(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, NOT_SELECTABLE, DISPLAY_COLOR_RED, 80, 80, 1, NO_STYLE, NO_ANIMATION);
|
||||
// Display_Objects_Add_Rounded_Rectangle_Frame(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, NOT_SELECTABLE, DISPLAY_COLOR_GREEN, 80, 80, 10, 4, NO_STYLE, NO_ANIMATION);
|
||||
// Display_Objects_Add_Rounded_Rectangle_Frame(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, NOT_SELECTABLE, DISPLAY_COLOR_GREEN, 100, 100, 15, 1, NO_STYLE, NO_ANIMATION);
|
||||
// Display_Objects_Add_Rounded_Rectangle_Frame(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, NOT_SELECTABLE, DISPLAY_COLOR_GREEN, 80, 80, 5, 1, NO_STYLE, NO_ANIMATION);
|
||||
|
||||
@@ -9,10 +9,11 @@
|
||||
// Includes
|
||||
#include "../Screens.h"
|
||||
#include "../UI_Control.h"
|
||||
#include "../Display_Default_Configurations.h"
|
||||
#include "../Hierarchical_Menu.h"
|
||||
|
||||
#include "../Display.h"
|
||||
#include "../Display_Objects.h"
|
||||
#include "../Display_Default_Configurations.h"
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
@@ -21,16 +22,25 @@
|
||||
|
||||
// ============================================================================================
|
||||
// Variables
|
||||
static void (*_Return_Function)(Screen_Transition_Direction, Screen_Transition_Direction, Easing, uint32_t, int32_t);
|
||||
static int32_t _Return_Value;
|
||||
static Object_ID _Object_Message_Box;
|
||||
|
||||
static const Hierarchical_Menu* _Return_Menu = NULL;
|
||||
static const Menu_List* _Return_List = NULL;
|
||||
static int32_t _Return_Selected_Item;
|
||||
|
||||
static char* _Title;
|
||||
static uint32_t _Title_Length;
|
||||
static uint8_t* _Value;
|
||||
static bool _Bool_Value;
|
||||
static bool _Bool_Value;
|
||||
static bool _Decision_Made;
|
||||
static uint32_t _Counter;
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Function Declarations
|
||||
void Screen_Setup_Select_Bool(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, char* title, uint32_t title_length, uint8_t *value, void (*return_function)(Screen_Transition_Direction, Screen_Transition_Direction, Easing, uint32_t, int32_t), int32_t return_value);
|
||||
void Screen_Setup_Select_Bool(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, char* title, uint32_t title_length, uint8_t *value, const Hierarchical_Menu* return_menu, const Menu_List* return_list, int32_t return_selected_item);
|
||||
|
||||
static void Screen_Init (Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration);
|
||||
static void Screen_Tick (void);
|
||||
static void Screen_Click (uint button_return_value);
|
||||
static void Screen_Touch_Event (int16_t x, int16_t y);
|
||||
@@ -45,9 +55,26 @@ static void Screen_On_Object_Deselect (Object_ID object_id);
|
||||
/*******************************************************************
|
||||
Functions
|
||||
*******************************************************************/
|
||||
void Screen_Setup_Select_Bool(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, char* title, uint32_t title_length, uint8_t *value, void (*return_function)(Screen_Transition_Direction, Screen_Transition_Direction, Easing, uint32_t, int32_t), int32_t return_value)
|
||||
void Screen_Setup_Select_Bool(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, char* title, uint32_t title_length, uint8_t *value, const Hierarchical_Menu* return_menu, const Menu_List* return_list, int32_t return_selected_item)
|
||||
{
|
||||
_Screen_Tick = Screen_Tick;
|
||||
_Title = title;
|
||||
_Title_Length = title_length;
|
||||
_Value = value;
|
||||
_Bool_Value = (*_Value) > 0;
|
||||
|
||||
Screen_Init(direction_out, direction_in, type, frame_duration);
|
||||
|
||||
_Return_Menu = return_menu;
|
||||
_Return_List = return_list;
|
||||
_Return_Selected_Item = return_selected_item;
|
||||
|
||||
_Decision_Made = false;
|
||||
_Counter = 0;
|
||||
}
|
||||
|
||||
void Screen_Init(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration)
|
||||
{
|
||||
_Screen_Tick = Screen_Tick;
|
||||
_Screen_Click = Screen_Click;
|
||||
_Screen_Touch_Event = Screen_Touch_Event;
|
||||
_Screen_Action_CW = Screen_Action_CW;
|
||||
@@ -61,23 +88,24 @@ void Screen_Setup_Select_Bool(Screen_Transition_Direction direction_out, Screen_
|
||||
Display_Screen_Transition_Start(direction_out, direction_in, type, frame_duration);
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//////////////////////////////
|
||||
// Add Display Objects here //
|
||||
//////////////////////////////
|
||||
|
||||
_Return_Function = return_function;
|
||||
_Return_Value = return_value;
|
||||
_Value = value;
|
||||
_Bool_Value = (*_Value) > 0;
|
||||
|
||||
Display_Objects_Add_Select_YesNo(title, title_length, &_Bool_Value, &_Configuration_Default_Select_YesNo);
|
||||
Display_Objects_Add_Select_YesNo(_Title, _Title_Length, &_Bool_Value, &_Configuration_Default_Select_YesNo);
|
||||
_Object_Message_Box = Display_Objects_Add_Message_Box(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, "Saved", MESSAGE_BOX_ICON_CIRCLE_CHECKMARK, &_Message_Box_Style_Regular);
|
||||
|
||||
Display_Select_Object();
|
||||
}
|
||||
|
||||
void Screen_Tick(void)
|
||||
{
|
||||
if(_Decision_Made) {
|
||||
_Counter++;
|
||||
}
|
||||
|
||||
if(_Counter == MESSAGE_BOX_DEFAULT_TICKS) {
|
||||
Screen_Setup_Settings_Hierarchical_Menu(TRANSITION_DOWN, TRANSITION_RIGHT, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, _Return_Menu, _Return_List, _Return_Selected_Item);
|
||||
}
|
||||
}
|
||||
|
||||
void Screen_Click(uint button_return_value)
|
||||
@@ -92,7 +120,11 @@ void Screen_Touch_Event(int16_t x, int16_t y)
|
||||
|
||||
void Screen_Action_CW(Object_ID object_id)
|
||||
{
|
||||
(*_Value) ^= 0x01;
|
||||
if(_Decision_Made) {
|
||||
return;
|
||||
}
|
||||
|
||||
(*_Value) ^= 0x01;
|
||||
|
||||
_Bool_Value = (*_Value) > 0;
|
||||
}
|
||||
@@ -119,7 +151,10 @@ void Screen_On_Object_Select(Object_ID object_id)
|
||||
|
||||
void Screen_On_Object_Deselect(Object_ID object_id)
|
||||
{
|
||||
_Return_Function(TRANSITION_DOWN, TRANSITION_DOWN, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, _Return_Value);
|
||||
if(!_Decision_Made) {
|
||||
Display_Objects_Show_Message_Box(_Object_Message_Box, MESSAGE_BOX_DEFAULT_TICKS);
|
||||
_Decision_Made = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
// Includes
|
||||
#include "../Screens.h"
|
||||
#include "../UI_Control.h"
|
||||
#include "../Command_Definition.h"
|
||||
|
||||
#include "../Display.h"
|
||||
#include "../Display_Objects.h"
|
||||
@@ -17,17 +18,28 @@
|
||||
|
||||
// ============================================================================================
|
||||
// Variables
|
||||
static Object_ID _RGB_Selector_Object;
|
||||
static RGB_Color* _RGB_Color;
|
||||
static Object_ID _Object_Message_Box;
|
||||
|
||||
static const Hierarchical_Menu* _Return_Menu = NULL;
|
||||
static const Menu_List* _Return_List = NULL;
|
||||
static int32_t _Return_Selected_Item;
|
||||
|
||||
static char* _Title;
|
||||
static uint32_t _Title_Length;
|
||||
static LED_Data_t* _RGB_Color;
|
||||
|
||||
static uint8_t _Current_Component;
|
||||
static uint8_t* _Color;
|
||||
|
||||
static bool _Decision_Made;
|
||||
static uint32_t _Counter;
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Function Declarations
|
||||
void Screen_Setup_Select_RGB(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, RGB_Color* rgb_color);
|
||||
void Screen_Setup_Select_RGB(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, char* title, uint32_t title_length, LED_Data_t* rgb_color, const Hierarchical_Menu* return_menu, const Menu_List* return_list, int32_t return_selected_item);
|
||||
|
||||
static void Screen_Init (Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration);
|
||||
static void Screen_Tick (void);
|
||||
static void Screen_Click (uint button_return_value);
|
||||
static void Screen_Touch_Event (int16_t x, int16_t y);
|
||||
@@ -42,9 +54,26 @@ static void Screen_On_Object_Deselect (Object_ID object_id);
|
||||
/*******************************************************************
|
||||
Functions
|
||||
*******************************************************************/
|
||||
void Screen_Setup_Select_RGB(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, RGB_Color* rgb_color)
|
||||
void Screen_Setup_Select_RGB(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, char* title, uint32_t title_length, LED_Data_t* rgb_color, const Hierarchical_Menu* return_menu, const Menu_List* return_list, int32_t return_selected_item)
|
||||
{
|
||||
_Screen_Tick = Screen_Tick;
|
||||
_Current_Component = 0;
|
||||
_RGB_Color = rgb_color;
|
||||
_Color = &(rgb_color->Array[_Current_Component]);
|
||||
|
||||
Screen_Init(direction_out, direction_in, type, frame_duration);
|
||||
|
||||
_Return_Menu = return_menu;
|
||||
_Return_List = return_list;
|
||||
_Return_Selected_Item = return_selected_item;
|
||||
|
||||
_Decision_Made = false;
|
||||
_Counter = 0;
|
||||
}
|
||||
|
||||
void Screen_Init(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration)
|
||||
{
|
||||
_Screen_Tick = Screen_Tick;
|
||||
_Screen_Tick = Screen_Tick;
|
||||
_Screen_Click = Screen_Click;
|
||||
_Screen_Touch_Event = Screen_Touch_Event;
|
||||
_Screen_Action_CW = Screen_Action_CW;
|
||||
@@ -55,25 +84,14 @@ void Screen_Setup_Select_RGB(Screen_Transition_Direction direction_out, Screen_T
|
||||
_Screen_On_Object_Deselect = Screen_On_Object_Deselect;
|
||||
|
||||
Display_Objects_Clear();
|
||||
|
||||
Display_Screen_Transition_Start(direction_out, direction_in, type, frame_duration);
|
||||
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//////////////////////////////
|
||||
// Add Display Objects here //
|
||||
//////////////////////////////
|
||||
|
||||
_Current_Component = 0;
|
||||
_RGB_Color = rgb_color;
|
||||
_Color = &(rgb_color->Array[_Current_Component]);
|
||||
|
||||
// Create the RGB selector object
|
||||
_RGB_Selector_Object = Display_Objects_Add_Select_RGB(
|
||||
_RGB_Color, // Pointer to color to modify
|
||||
&_Current_Component, // Indicater for active RGB Base Color
|
||||
&_Configuration_Default_Select_RGB // Use configuration
|
||||
);
|
||||
Display_Objects_Add_Select_RGB(_RGB_Color, &_Current_Component, &_Configuration_Default_Select_RGB);
|
||||
_Object_Message_Box = Display_Objects_Add_Message_Box(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, "Saved", MESSAGE_BOX_ICON_CIRCLE_CHECKMARK, &_Message_Box_Style_Regular);
|
||||
|
||||
Display_Select_Object();
|
||||
|
||||
@@ -83,7 +101,13 @@ void Screen_Setup_Select_RGB(Screen_Transition_Direction direction_out, Screen_T
|
||||
|
||||
void Screen_Tick(void)
|
||||
{
|
||||
if(_Decision_Made) {
|
||||
_Counter++;
|
||||
}
|
||||
|
||||
if(_Counter == MESSAGE_BOX_DEFAULT_TICKS) {
|
||||
Screen_Setup_Settings_Hierarchical_Menu(TRANSITION_DOWN, TRANSITION_RIGHT, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, _Return_Menu, _Return_List, _Return_Selected_Item);
|
||||
}
|
||||
}
|
||||
|
||||
void Screen_Click(uint button_return_value)
|
||||
@@ -98,6 +122,10 @@ void Screen_Touch_Event(int16_t x, int16_t y)
|
||||
|
||||
void Screen_Action_CW(Object_ID object_id)
|
||||
{
|
||||
if(_Decision_Made) {
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t Color = *_Color;
|
||||
UI_Control_Selector_Inc(&Color, 0, UINT8_MAX, false);
|
||||
*_Color = (uint8_t)Color;
|
||||
@@ -105,6 +133,10 @@ void Screen_Action_CW(Object_ID object_id)
|
||||
|
||||
void Screen_Action_CCW(Object_ID object_id)
|
||||
{
|
||||
if(_Decision_Made) {
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t Color = *_Color;
|
||||
UI_Control_Selector_Dec(&Color, 0, UINT8_MAX, false);
|
||||
*_Color = (uint8_t)Color;
|
||||
@@ -136,7 +168,10 @@ void Screen_On_Object_Deselect(Object_ID object_id)
|
||||
return;
|
||||
}
|
||||
|
||||
// Screen_Setup_Menu_Main(TRANSITION_DOWN, TRANSITION_DOWN, INOUT_SINE, 15, false, 1);
|
||||
if(!_Decision_Made) {
|
||||
Display_Objects_Show_Message_Box(_Object_Message_Box, MESSAGE_BOX_DEFAULT_TICKS);
|
||||
_Decision_Made = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
// Includes
|
||||
#include "../Screens.h"
|
||||
#include "../UI_Control.h"
|
||||
#include "../Display_Default_Configurations.h"
|
||||
|
||||
#include "../Display.h"
|
||||
#include "../Display_Objects.h"
|
||||
#include "../Display_Default_Configurations.h"
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
@@ -58,11 +58,14 @@ static Configuration_Menu_Icon_Row _Configuration_Menu_Icon_Row = {
|
||||
|
||||
static int32_t _Selected_Item;
|
||||
|
||||
extern const Hierarchical_Menu _Hierarchical_Menu_MIDI;
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Function Declarations
|
||||
void Screen_Setup_Settings(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, int32_t selected_item);
|
||||
|
||||
static void Screen_Init (Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration);
|
||||
static void Screen_Tick (void);
|
||||
static void Screen_Click (uint button_return_value);
|
||||
static void Screen_Touch_Event (int16_t x, int16_t y);
|
||||
@@ -80,7 +83,15 @@ static void Screen_On_Object_Deselect (Object_ID object_id);
|
||||
*******************************************************************/
|
||||
void Screen_Setup_Settings(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, int32_t selected_item)
|
||||
{
|
||||
_Screen_Tick = Screen_Tick;
|
||||
Screen_Init(direction_out, direction_in, type, frame_duration);
|
||||
|
||||
_Selected_Item = selected_item;
|
||||
}
|
||||
|
||||
void Screen_Init(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration)
|
||||
{
|
||||
_Screen_Last = Screen_Init;
|
||||
_Screen_Tick = Screen_Tick;
|
||||
_Screen_Click = Screen_Click;
|
||||
_Screen_Touch_Event = Screen_Touch_Event;
|
||||
_Screen_Action_CW = Screen_Action_CW;
|
||||
@@ -94,9 +105,7 @@ void Screen_Setup_Settings(Screen_Transition_Direction direction_out, Screen_Tra
|
||||
|
||||
Display_Screen_Transition_Start(direction_out, direction_in, type, frame_duration);
|
||||
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
//////////////////////////////
|
||||
// Add Display Objects here //
|
||||
//////////////////////////////
|
||||
|
||||
@@ -107,11 +116,8 @@ void Screen_Setup_Settings(Screen_Transition_Direction direction_out, Screen_Tra
|
||||
Display_Objects_Add_Text(CENTER_MIDDLE, X_IN_PERCENT_Y_IN_PIXEL, 50, 45, NOT_SELECTABLE, "Settings", Font_Title, DISPLAY_COLOR_LIGHTGREY, NO_STYLE, NO_ANIMATION);
|
||||
Display_Objects_Add_Rectangle_Filled(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, NOT_SELECTABLE, DISPLAY_COLOR_FROM_RGB888(32, 32, 32), DISPLAY_WIDTH, 85, NO_STYLE, NO_ANIMATION);
|
||||
_Object_Menu = Display_Objects_Add_Menu_Icon_Row(_Icon_Row_Items, MENU_ENTRY_COUNT, &_Selected_Item, &_Configuration_Menu_Icon_Row);
|
||||
// Display_Objects_Add_Rounded_Rectangle_Frame(CENTER_MIDDLE, BOTH_IN_PERCENT, 50, 50, NOT_SELECTABLE, DISPLAY_COLOR_FROM_RGB888(255, 223, 0), 70, 70, 21, 4, NO_STYLE, NO_ANIMATION);
|
||||
|
||||
_Selected_Item = selected_item;
|
||||
|
||||
Display_Select_First_Object();
|
||||
Display_Select_First_Object();
|
||||
Display_Select_Object();
|
||||
}
|
||||
|
||||
@@ -159,7 +165,8 @@ void Screen_On_Object_Deselect(Object_ID object_id)
|
||||
{
|
||||
switch (_Selected_Item)
|
||||
{
|
||||
case 0: Screen_Setup_Settings_MIDI(TRANSITION_UP, TRANSITION_UP, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, 0); break;
|
||||
// case 0: Screen_Setup_Settings_MIDI(TRANSITION_UP, TRANSITION_UP, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, 0); break;
|
||||
case 0: Screen_Setup_Settings_Hierarchical_Menu(TRANSITION_UP, TRANSITION_UP, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, &_Hierarchical_Menu_MIDI, _Hierarchical_Menu_MIDI.List, 0); break;
|
||||
case 1: break;
|
||||
case 2: break;
|
||||
case 3: break;
|
||||
|
||||
258
Firmware/Screens_Display/Screen_Settings_Hierarchical_Menu.c
Normal file
258
Firmware/Screens_Display/Screen_Settings_Hierarchical_Menu.c
Normal file
@@ -0,0 +1,258 @@
|
||||
/*
|
||||
* File: Screen_Settings_Hierarchical_Menu.c
|
||||
*
|
||||
* Created: Created: Sunday September 2025 19:19:34
|
||||
* Author: Chris
|
||||
*/
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Includes
|
||||
#include "../Screens.h"
|
||||
#include "../UI_Control.h"
|
||||
#include "../Hierarchical_Menu.h"
|
||||
#include "../Command_Definition.h"
|
||||
|
||||
#include "../Display.h"
|
||||
#include "../Display_Objects.h"
|
||||
#include "../Display_Default_Configurations.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Defines
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Variables
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_6x12[];
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_7x15[];
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_Bold_7x15[];
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_Bold_15x26[];
|
||||
|
||||
static const Hierarchical_Menu* _Menu = NULL;
|
||||
static const Menu_List* _Current_List = NULL;
|
||||
|
||||
static int32_t _Selected_Item;
|
||||
static int32_t _Scroll_Offset;
|
||||
static int32_t _Visible_Items;
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Function Declarations
|
||||
void Screen_Setup_Settings_Hierarchical_Menu(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, const Hierarchical_Menu* menu, const Menu_List* list, int32_t selected_item);
|
||||
|
||||
static void Screen_Init (Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration);
|
||||
static void Screen_Tick (void);
|
||||
static void Screen_Click (uint button_return_value);
|
||||
static void Screen_Touch_Event (int16_t x, int16_t y);
|
||||
static void Screen_Action_CW (Object_ID object_id);
|
||||
static void Screen_Action_CCW (Object_ID object_id);
|
||||
static void Screen_On_Object_Focused (Object_ID object_id);
|
||||
static void Screen_On_Object_Defocused (Object_ID object_id);
|
||||
static void Screen_On_Object_Select (Object_ID object_id);
|
||||
static void Screen_On_Object_Deselect (Object_ID object_id);
|
||||
|
||||
static void Navigate_To_List(const Menu_List* new_list);
|
||||
static void Handle_Back_Navigation(void);
|
||||
static void Calculate_Scroll_Offset(void);
|
||||
static void Handle_Item_Selection(void);
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
Functions
|
||||
*******************************************************************/
|
||||
void Screen_Setup_Settings_Hierarchical_Menu(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, const Hierarchical_Menu* menu, const Menu_List* list, int32_t selected_item)
|
||||
{
|
||||
_Menu = menu;
|
||||
_Current_List = list;
|
||||
_Selected_Item = selected_item;
|
||||
|
||||
Screen_Init(direction_out, direction_in, type, frame_duration);
|
||||
|
||||
|
||||
_Scroll_Offset = 0;
|
||||
_Visible_Items = _Configuration_Menu_Hierarchical_Default.Visible_Items;
|
||||
}
|
||||
|
||||
void Screen_Init(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration)
|
||||
{
|
||||
_Screen_Tick = Screen_Tick;
|
||||
_Screen_Click = Screen_Click;
|
||||
_Screen_Touch_Event = Screen_Touch_Event;
|
||||
_Screen_Action_CW = Screen_Action_CW;
|
||||
_Screen_Action_CCW = Screen_Action_CCW;
|
||||
_Screen_On_Objects_Focused = Screen_On_Object_Focused;
|
||||
_Screen_On_Objects_Defocused = Screen_On_Object_Defocused;
|
||||
_Screen_On_Object_Select = Screen_On_Object_Select;
|
||||
_Screen_On_Object_Deselect = Screen_On_Object_Deselect;
|
||||
|
||||
Display_Objects_Clear();
|
||||
Display_Screen_Transition_Start(direction_out, direction_in, type, frame_duration);
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
// Add Display Objects here //
|
||||
//////////////////////////////
|
||||
Display_Objects_Add_Menu_Hierarchical(&_Current_List, &_Selected_Item, &_Scroll_Offset, &_Configuration_Menu_Hierarchical_Default);
|
||||
|
||||
Calculate_Scroll_Offset();
|
||||
Display_Select_Object();
|
||||
}
|
||||
|
||||
void Screen_Tick(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_Click(uint button_return_value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_Touch_Event(int16_t x, int16_t y)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_Action_CW(Object_ID object_id)
|
||||
{
|
||||
// Move selection down (the renderer will automatically show the change)
|
||||
UI_Control_Selector_Inc(&_Selected_Item, 0, (int32_t)_Current_List->Item_Count - 1, false);
|
||||
Calculate_Scroll_Offset();
|
||||
}
|
||||
|
||||
void Screen_Action_CCW(Object_ID object_id)
|
||||
{
|
||||
// Move selection up (the renderer will automatically show the change)
|
||||
UI_Control_Selector_Dec(&_Selected_Item, 0, (int32_t)_Current_List->Item_Count - 1, false);
|
||||
Calculate_Scroll_Offset();
|
||||
}
|
||||
|
||||
void Screen_On_Object_Focused(Object_ID object_id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_On_Object_Defocused(Object_ID object_id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_On_Object_Select(Object_ID object_id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_On_Object_Deselect(Object_ID object_id)
|
||||
{
|
||||
Handle_Item_Selection();
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
Internal Functions
|
||||
*******************************************************************/
|
||||
void Navigate_To_List(const Menu_List* new_list)
|
||||
{
|
||||
if (new_list == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Update menu state
|
||||
_Current_List = new_list;
|
||||
_Selected_Item = 0;
|
||||
_Scroll_Offset = 0;
|
||||
|
||||
Calculate_Scroll_Offset();
|
||||
Display_Select_Object();
|
||||
}
|
||||
|
||||
void Handle_Back_Navigation(void)
|
||||
{
|
||||
if (_Current_List->Parent != NULL)
|
||||
{
|
||||
// Navigate to parent list
|
||||
const Menu_List* Parent_List = _Current_List->Parent->Containing_List;
|
||||
|
||||
// Find the index of the item that led to current list
|
||||
_Selected_Item = 0;
|
||||
for (uint32_t i = 0; i < Parent_List->Item_Count; i++)
|
||||
{
|
||||
if (Parent_List->Items[i].List == _Current_List) {
|
||||
_Selected_Item = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_Current_List = Parent_List;
|
||||
|
||||
Calculate_Scroll_Offset();
|
||||
Display_Select_Object();
|
||||
}
|
||||
else if (_Menu->Parent_Function != NULL)
|
||||
{
|
||||
// Exit to parent screen
|
||||
_Menu->Parent_Function(TRANSITION_DOWN, TRANSITION_DOWN, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, _Menu->Parent_Selected_Setting);
|
||||
}
|
||||
}
|
||||
|
||||
void Calculate_Scroll_Offset(void)
|
||||
{
|
||||
// Auto-scroll to keep selected item visible
|
||||
if (_Selected_Item < _Scroll_Offset) {
|
||||
_Scroll_Offset = 0;
|
||||
}
|
||||
else {
|
||||
_Scroll_Offset = _Selected_Item - _Visible_Items + 1;
|
||||
}
|
||||
|
||||
// Ensure scroll offset is within bounds
|
||||
int32_t Max_Scroll = (int32_t)_Current_List->Item_Count - _Visible_Items;
|
||||
if (Max_Scroll < 0) {
|
||||
Max_Scroll = 0;
|
||||
}
|
||||
|
||||
if (_Scroll_Offset > Max_Scroll) {
|
||||
_Scroll_Offset = Max_Scroll;
|
||||
}
|
||||
|
||||
if (_Scroll_Offset < 0) {
|
||||
_Scroll_Offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Handle_Item_Selection(void)
|
||||
{
|
||||
if (_Selected_Item < 0 || _Selected_Item >= (int32_t)_Current_List->Item_Count) {
|
||||
return;
|
||||
}
|
||||
|
||||
const Menu_Item* Selected_Item = &_Current_List->Items[_Selected_Item];
|
||||
|
||||
if (Selected_Item->Is_Back) {
|
||||
Handle_Back_Navigation();
|
||||
return;
|
||||
}
|
||||
|
||||
if (Selected_Item->List != NULL) {
|
||||
Navigate_To_List(Selected_Item->List);
|
||||
return;
|
||||
}
|
||||
|
||||
switch(Selected_Item->Type)
|
||||
{
|
||||
case BOOL:
|
||||
Screen_Setup_Select_Bool(TRANSITION_LEFT, TRANSITION_UP, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, (char*)Selected_Item->Variable_Title, strlen(Selected_Item->Variable_Title), (uint8_t*)Selected_Item->Variable, _Menu, Selected_Item->Containing_List, _Selected_Item);
|
||||
break;
|
||||
|
||||
case RGB:
|
||||
Screen_Setup_Select_RGB(TRANSITION_LEFT, TRANSITION_UP, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, (char*)Selected_Item->Variable_Title, strlen(Selected_Item->Variable_Title), (LED_Data_t*)Selected_Item->Variable, _Menu, Selected_Item->Containing_List, _Selected_Item);
|
||||
break;
|
||||
|
||||
case NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1,144 +0,0 @@
|
||||
/*
|
||||
* File: Screen_Settings_MIDI.c
|
||||
*
|
||||
* Created: Created: Thursday August 2025 14:24:40
|
||||
* Author: Chris
|
||||
*/
|
||||
|
||||
// ============================================================================================
|
||||
// Includes
|
||||
#include "../Screens.h"
|
||||
#include "../UI_Control.h"
|
||||
#include "../Display_Default_Configurations.h"
|
||||
|
||||
#include "../Display.h"
|
||||
#include "../Display_Objects.h"
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Defines
|
||||
#define MENU_ENTRY_COUNT 4
|
||||
#define MENU_CHAR_LENGTH 11
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Variables
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_Bold_15x26[];
|
||||
|
||||
static int32_t _Selected_Item;
|
||||
|
||||
static char _Menu_Titles[MENU_ENTRY_COUNT][MENU_CHAR_LENGTH] = {
|
||||
{ "MIDI Config" },
|
||||
{ "Color Notes" },
|
||||
{ "Pause Light" },
|
||||
{ "Back " }
|
||||
};
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Function Declarations
|
||||
void Screen_Setup_Settings_MIDI(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, int32_t selected_item);
|
||||
|
||||
static void Screen_Tick (void);
|
||||
static void Screen_Click (uint button_return_value);
|
||||
static void Screen_Touch_Event (int16_t x, int16_t y);
|
||||
static void Screen_Action_CW (Object_ID object_id);
|
||||
static void Screen_Action_CCW (Object_ID object_id);
|
||||
static void Screen_On_Object_Focused (Object_ID object_id);
|
||||
static void Screen_On_Object_Defocused (Object_ID object_id);
|
||||
static void Screen_On_Object_Select (Object_ID object_id);
|
||||
static void Screen_On_Object_Deselect (Object_ID object_id);
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
Functions
|
||||
*******************************************************************/
|
||||
void Screen_Setup_Settings_MIDI(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, int32_t selected_item)
|
||||
{
|
||||
_Screen_Tick = Screen_Tick;
|
||||
_Screen_Click = Screen_Click;
|
||||
_Screen_Touch_Event = Screen_Touch_Event;
|
||||
_Screen_Action_CW = Screen_Action_CW;
|
||||
_Screen_Action_CCW = Screen_Action_CCW;
|
||||
_Screen_On_Objects_Focused = Screen_On_Object_Focused;
|
||||
_Screen_On_Objects_Defocused = Screen_On_Object_Defocused;
|
||||
_Screen_On_Object_Select = Screen_On_Object_Select;
|
||||
_Screen_On_Object_Deselect = Screen_On_Object_Deselect;
|
||||
|
||||
Display_Objects_Clear();
|
||||
Display_Screen_Transition_Start(direction_out, direction_in, type, frame_duration);
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
// Add Display Objects here //
|
||||
//////////////////////////////
|
||||
|
||||
Font_ID Font_Title = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_Bold_15x26, 0);
|
||||
|
||||
Display_Objects_Add_Text(CENTER_MIDDLE, X_IN_PERCENT_Y_IN_PIXEL, 50, 45, NOT_SELECTABLE, "MIDI", Font_Title, DISPLAY_COLOR_LIGHTGREY, NO_STYLE, NO_ANIMATION);
|
||||
Display_Objects_Add_Select_List((char*)_Menu_Titles, MENU_ENTRY_COUNT, MENU_CHAR_LENGTH, &_Selected_Item, &_Configuration_Default_Select_List);
|
||||
|
||||
_Selected_Item = selected_item;
|
||||
|
||||
Display_Select_First_Object();
|
||||
Display_Select_Object();
|
||||
}
|
||||
|
||||
void Screen_Tick(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_Click(uint button_return_value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_Touch_Event(int16_t x, int16_t y)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_Action_CW(Object_ID object_id)
|
||||
{
|
||||
UI_Control_Selector_Inc(&_Selected_Item, 0, MENU_ENTRY_COUNT-1, false);
|
||||
}
|
||||
|
||||
void Screen_Action_CCW(Object_ID object_id)
|
||||
{
|
||||
UI_Control_Selector_Dec(&_Selected_Item, 0, MENU_ENTRY_COUNT-1, false);
|
||||
}
|
||||
|
||||
void Screen_On_Object_Focused(Object_ID object_id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_On_Object_Defocused(Object_ID object_id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_On_Object_Select(Object_ID object_id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_On_Object_Deselect(Object_ID object_id)
|
||||
{
|
||||
switch (_Selected_Item)
|
||||
{
|
||||
case 0: Screen_Setup_Settings_MIDI_Config(TRANSITION_UP, TRANSITION_UP, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, 0); break;
|
||||
case 1: break;
|
||||
case 2: break;
|
||||
case 3: Screen_Setup_Settings(TRANSITION_DOWN, TRANSITION_DOWN, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, 0); break;
|
||||
}
|
||||
|
||||
Display_Select_Object();
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
Internal Functions
|
||||
*******************************************************************/
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
/*
|
||||
* File: Screen_Settings_MIDI_Config.c
|
||||
*
|
||||
* Created: Created: Thursday August 2025 15:53:58
|
||||
* Author: Chris
|
||||
*/
|
||||
|
||||
// ============================================================================================
|
||||
// Includes
|
||||
#include "../Screens.h"
|
||||
#include "../UI_Control.h"
|
||||
#include "../Display_Default_Configurations.h"
|
||||
|
||||
#include "../Display.h"
|
||||
#include "../Display_Objects.h"
|
||||
|
||||
#include "../EEPROM_M24C64.h"
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Defines
|
||||
#define MENU_ENTRY_COUNT 4
|
||||
#define MENU_CHAR_LENGTH 13
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Variables
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_Bold_11x17[];
|
||||
extern const unsigned char _Font_DejaVu_Sans_Mono_Bold_15x26[];
|
||||
|
||||
static int32_t _Selected_Item;
|
||||
|
||||
static char _Menu_Titles[MENU_ENTRY_COUNT][MENU_CHAR_LENGTH] = {
|
||||
{ "MIDI Channel " },
|
||||
{ "Select Octave" },
|
||||
{ "Skip Note Off" },
|
||||
{ "Back " }
|
||||
};
|
||||
|
||||
|
||||
// ============================================================================================
|
||||
// Function Declarations
|
||||
void Screen_Setup_Settings_MIDI_Config(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, int32_t selected_item);
|
||||
|
||||
static void Screen_Tick (void);
|
||||
static void Screen_Click (uint button_return_value);
|
||||
static void Screen_Touch_Event (int16_t x, int16_t y);
|
||||
static void Screen_Action_CW (Object_ID object_id);
|
||||
static void Screen_Action_CCW (Object_ID object_id);
|
||||
static void Screen_On_Object_Focused (Object_ID object_id);
|
||||
static void Screen_On_Object_Defocused (Object_ID object_id);
|
||||
static void Screen_On_Object_Select (Object_ID object_id);
|
||||
static void Screen_On_Object_Deselect (Object_ID object_id);
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
Functions
|
||||
*******************************************************************/
|
||||
void Screen_Setup_Settings_MIDI_Config(Screen_Transition_Direction direction_out, Screen_Transition_Direction direction_in, Easing type, uint32_t frame_duration, int32_t selected_item)
|
||||
{
|
||||
_Screen_Tick = Screen_Tick;
|
||||
_Screen_Click = Screen_Click;
|
||||
_Screen_Touch_Event = Screen_Touch_Event;
|
||||
_Screen_Action_CW = Screen_Action_CW;
|
||||
_Screen_Action_CCW = Screen_Action_CCW;
|
||||
_Screen_On_Objects_Focused = Screen_On_Object_Focused;
|
||||
_Screen_On_Objects_Defocused = Screen_On_Object_Defocused;
|
||||
_Screen_On_Object_Select = Screen_On_Object_Select;
|
||||
_Screen_On_Object_Deselect = Screen_On_Object_Deselect;
|
||||
|
||||
Display_Objects_Clear();
|
||||
Display_Screen_Transition_Start(direction_out, direction_in, type, frame_duration);
|
||||
|
||||
|
||||
//////////////////////////////
|
||||
// Add Display Objects here //
|
||||
//////////////////////////////
|
||||
Font_ID Font_Title = Display_Objects_Add_Font(_Font_DejaVu_Sans_Mono_Bold_11x17, 0);
|
||||
|
||||
|
||||
Display_Objects_Add_Text(CENTER_MIDDLE, X_IN_PERCENT_Y_IN_PIXEL, 50, 45, NOT_SELECTABLE, "MIDI Config", Font_Title, DISPLAY_COLOR_LIGHTGREY, NO_STYLE, NO_ANIMATION);
|
||||
Display_Objects_Add_Select_List((char*)_Menu_Titles, MENU_ENTRY_COUNT, MENU_CHAR_LENGTH, &_Selected_Item, &_Configuration_Default_Select_List);
|
||||
|
||||
_Selected_Item = selected_item;
|
||||
|
||||
Display_Select_First_Object();
|
||||
Display_Select_Object();
|
||||
}
|
||||
|
||||
void Screen_Tick(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_Click(uint button_return_value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_Touch_Event(int16_t x, int16_t y)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_Action_CW(Object_ID object_id)
|
||||
{
|
||||
UI_Control_Selector_Inc(&_Selected_Item, 0, MENU_ENTRY_COUNT-1, false);
|
||||
}
|
||||
|
||||
void Screen_Action_CCW(Object_ID object_id)
|
||||
{
|
||||
UI_Control_Selector_Dec(&_Selected_Item, 0, MENU_ENTRY_COUNT-1, false);
|
||||
}
|
||||
|
||||
void Screen_On_Object_Focused(Object_ID object_id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_On_Object_Defocused(Object_ID object_id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_On_Object_Select(Object_ID object_id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Screen_On_Object_Deselect(Object_ID object_id)
|
||||
{
|
||||
switch (_Selected_Item)
|
||||
{
|
||||
case 0: break;
|
||||
case 1: break;
|
||||
case 2: Screen_Setup_Select_Bool(TRANSITION_UP, TRANSITION_UP, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, "Skip Note Off?", 14, (uint8_t*)&_EEPROM_Content.Channel_MIDI_Configuration->Skip_Note_Off_Event, Screen_Setup_Settings_MIDI_Config, 2); break;
|
||||
case 3: Screen_Setup_Settings_MIDI(TRANSITION_DOWN, TRANSITION_DOWN, SCREEN_TRANSITION_DEFAULT_EASING, SCREEN_TRANSITION_DEFAULT_FRAMES, 0); break;
|
||||
}
|
||||
|
||||
Display_Select_Object();
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
Internal Functions
|
||||
*******************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user