Mercurial > public > ostc4
diff Discovery/Src/tMenuEditCvOption.c @ 1071:b4a79464caf7 Icon_Integration
Dynamic menu creation for CV views:
Because of the increasing features of the OSTC the maintenance of the the menus becomes difficult. Some are not available because of HW version or connected sensors. To keep the "legacy" menus stable the functionality of the cv options page has been increased. Based on enabled cv views and connected sensors the page will be filled dynamically. The page items allow quick acces to the view related options. For the first implementation the views: compass, timer, sensor O2 and sensor CO2 are supported.
| author | Ideenmodellierer |
|---|---|
| date | Thu, 19 Feb 2026 13:28:37 +0100 |
| parents | 195bfbdf961d |
| children | 734f84b72b30 |
line wrap: on
line diff
--- a/Discovery/Src/tMenuEditCvOption.c Thu Feb 19 13:17:25 2026 +0100 +++ b/Discovery/Src/tMenuEditCvOption.c Thu Feb 19 13:28:37 2026 +0100 @@ -28,6 +28,7 @@ /* Includes ------------------------------------------------------------------*/ #include "tMenuEditCvOption.h" +#include "tMenuCvOptionText.h" #include "tMenuEdit.h" #include "gfx_fonts.h" @@ -37,6 +38,9 @@ #include "cv_heartbeat.h" + +static openFunc_t openFctPointerTable[MAXLINES]; /* function pointer for refresh */ + /* Private function prototypes -----------------------------------------------*/ static void openEdit_Timer(void); void openEdit_Compass(void); @@ -51,22 +55,30 @@ /* Exported functions --------------------------------------------------------*/ + +void tMCvOption_SetOpenFnct(uint8_t cvOptId, uint8_t index) +{ + if(index < MAXLINES) + { + switch(cvOptId) + { + case CVOPT_Compass: openFctPointerTable[index] = openEdit_Compass; + break; + case CVOPT_Timer: openFctPointerTable[index] = openEdit_Timer; + break; + case CVOPT_END: openFctPointerTable[index] = NULL; + break; + default: break; + } + } +} + + void openEdit_CvOption(uint8_t line) { - set_globalState_Menu_Line(line); - - switch(line) + if(openFctPointerTable[line - 1] != NULL) { - case 1: - default: resetMenuEdit(CLUT_MenuPageHardware); - openEdit_Compass(); - break; - case 2: openEdit_Timer(); - break; -#ifdef ENABLE_PULSE_SENSOR_BT - case 3: openEdit_Heartbeat(); -#endif - break; + openFctPointerTable[line - 1](); } }
