jonny_jr9 2fcf17feda Major Rework all files - Pass pointers to tasks, Remove gloabl variables
- All files:
  Modify almost all files to adjust functions and classes to
  work with pointers to objects passed at task creation
  instead of global variables from config.hpp

- Remove/clear config.hpp to get rid of all global variables

- main.cpp
    - Create pointer to all shared (used in multiple tasks) objects in main

- remove evaluatedSwitch button object,
  since joystick library is used to get switch events

- changes HTTP-mode
    - always init http-server (do not enable/disable at mode change)
    - pass url-handle function to init-htpp function
    - add lambda function to pass method of instance for thatMajor Rework all files - Remove global variables, pass pointers to tasks

- All files:
  Modify almost all files to adjust functions and classes to
  work with pointers to objects passed at task creation
  instead of global variables from config.hpp

- Remove/clear config.hpp to get rid of all global variables

- main.cpp
    - Create pointer to all shared (used in multiple tasks) objects in main

- remove evaluatedSwitch button object,
  since joystick library is used to get switch events

- changes HTTP-mode
    - always init http-server (do not enable/disable at mode change)
    - pass url-handle function to init-htpp function
    - add lambda function to pass method of instance for that

NOTES:  - tested on breakoutboard only
        - known issue that slow encoder events are not recognized
        (especially in menu) - slowing down motorctl helps
2024-02-18 10:00:34 +01:00

32 lines
1.0 KiB
C++

#pragma once
#include "display.hpp"
//--- menuState_t ---
// modes the menu can be in
typedef enum {
MAIN_MENU = 0,
SET_VALUE
} menuState_t;
//--- menuItem_t ---
// struct describes one menu element (all defined in menu.cpp)
typedef struct
{
void (*action)(display_task_parameters_t * objects, SSD1306_t * display, int value); // pointer to function run when confirmed
int (*currentValue)(display_task_parameters_t * objects); // pointer to function to get currently configured value
int valueMin; // min allowed value
int valueMax; // max allowed value
int valueIncrement; // amount changed at one encoder tick (+/-)
const char title[17]; // shown in list
const char line1[17]; // above value
const char line2[17]; // above value
const char line4[17]; // below value *
const char line5[17]; // below value *
const char line6[17]; // below value
const char line7[17]; // below value
} menuItem_t;
void handleMenu(display_task_parameters_t * objects, SSD1306_t *display);