Mercurial > public > ostc4
comparison Discovery/Src/tMenu.c @ 1028:3d9552e4997c GasConsumption
Code improvment: line <=> menu id function:
In generell the structure of the menus is defined by the tStructure.h using global state defines. In some implementation hardcoded line numbers are used. Risk: In case the order of menu items change the update of other code sections could be forgotten (in the case the update of the top menu) causing unintended behavior. To avoid this the hard coded lines have been replaced by a function connecting the intended function to the menu item defined in the tstructure.h.
| author | Ideenmodellierer |
|---|---|
| date | Sun, 07 Sep 2025 19:08:43 +0200 |
| parents | 808153ba3fec |
| children | 2af07aa38531 |
comparison
equal
deleted
inserted
replaced
| 1027:158100a84ebd | 1028:3d9552e4997c |
|---|---|
| 795 case StMXTRA: | 795 case StMXTRA: |
| 796 tMXtra_refresh(0, text, &tabPosition, subtext); | 796 tMXtra_refresh(0, text, &tabPosition, subtext); |
| 797 update_content_with_new_frame(page, text, tabPosition, subtext); | 797 update_content_with_new_frame(page, text, tabPosition, subtext); |
| 798 break; | 798 break; |
| 799 case StMDECO: | 799 case StMDECO: |
| 800 if((line == 1) || (line == 3)) // dive mode or ppO2 limits (the later for correct MOD in gaslists) | 800 if((line == get_lineOfID(StMDECO1_OC)) || (line == get_lineOfID(StMDECO3_PPO2Max))) // dive mode or ppO2 limits (the later for correct MOD in gaslists) |
| 801 { | 801 { |
| 802 tM_rebuild_pages(); | 802 tM_rebuild_pages(); |
| 803 menu.lineMemoryForNavigationForPage[page] = line; // fix 160623 | 803 menu.lineMemoryForNavigationForPage[page] = line; // fix 160623 |
| 804 GFX_SetFrameTop(menu.StartAddressForPage[page]); | 804 GFX_SetFrameTop(menu.StartAddressForPage[page]); |
| 805 } | 805 } |
| 824 tMHardware_refresh(line, text, &tabPosition, subtext); | 824 tMHardware_refresh(line, text, &tabPosition, subtext); |
| 825 clean_line_actual_page(); | 825 clean_line_actual_page(); |
| 826 update_content_actual_page(text, tabPosition, subtext); | 826 update_content_actual_page(text, tabPosition, subtext); |
| 827 break; | 827 break; |
| 828 case StMSYS: | 828 case StMSYS: |
| 829 if((line == 2) || (line == 3) || (line == 6)) | 829 if((line == get_lineOfID(StMSYS1_DateTime)) || (line == get_lineOfID(StMSYS2_English)) || (line == get_lineOfID(StMSYS_Profile))) |
| 830 { | 830 { |
| 831 tM_rebuild_pages(); | 831 tM_rebuild_pages(); |
| 832 menu.lineMemoryForNavigationForPage[page] = line; // fix 160623 | 832 menu.lineMemoryForNavigationForPage[page] = line; // fix 160623 |
| 833 GFX_SetFrameTop(menu.StartAddressForPage[page]); | 833 GFX_SetFrameTop(menu.StartAddressForPage[page]); |
| 834 menu.lineMemoryForNavigationForPage[page] = line; | 834 menu.lineMemoryForNavigationForPage[page] = line; |
