Mercurial > public > ostc4
annotate Discovery/Src/tMenu.c @ 1073:734f84b72b30 Icon_Integration tip
CV Option Menu added sub menus for O2 and CO2 sensors:
In the previous implementation by the external sensor menu the problem exists that only three sensor could be displayed. If three o2 sensors were active then the CO2 sensor was not accessible. With the new dynamic view the CO2 sensor is a standalone menu element. The three sensor view was reused from the external sensor menu by introducing a filter (sensor type) functionality. O" and CO2 sensors may now be calibrated using the cv option sub menus.
| author | Ideenmodellierer |
|---|---|
| date | Fri, 20 Feb 2026 17:26:46 +0100 |
| parents | b4a79464caf7 |
| children |
| rev | line source |
|---|---|
| 38 | 1 /////////////////////////////////////////////////////////////////////////////// |
| 2 /// -*- coding: UTF-8 -*- | |
| 3 /// | |
| 4 /// \file Discovery/Src/tMenu.c | |
| 5 /// \brief Major menu with extra page 0 for edit functionality since V0.0.2 | |
| 6 /// \author heinrichs weikamp gmbh | |
| 7 /// \date 30-April-2014 | |
| 8 /// | |
| 9 /// \details | |
| 10 /// | |
| 11 /// $Id$ | |
| 12 /////////////////////////////////////////////////////////////////////////////// | |
| 13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
| 14 /// | |
| 15 /// This program is free software: you can redistribute it and/or modify | |
| 16 /// it under the terms of the GNU General Public License as published by | |
| 17 /// the Free Software Foundation, either version 3 of the License, or | |
| 18 /// (at your option) any later version. | |
| 19 /// | |
| 20 /// This program is distributed in the hope that it will be useful, | |
| 21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 23 /// GNU General Public License for more details. | |
| 24 /// | |
| 25 /// You should have received a copy of the GNU General Public License | |
| 26 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 27 ////////////////////////////////////////////////////////////////////////////// | |
| 28 | |
| 29 /* Includes ------------------------------------------------------------------*/ | |
| 30 #include "tMenu.h" | |
| 31 | |
| 32 #include "gfx_fonts.h" | |
| 33 #include "tHome.h" | |
| 34 #include "tMenuDeco.h" | |
| 35 #include "tMenuDecoParameter.h" | |
| 36 #include "tMenuEditDeco.h" | |
| 37 #include "tMenuEditDecoParameter.h" | |
| 38 #include "tMenuEditGasOC.h" | |
| 39 #include "tMenuEditHardware.h" | |
| 40 #include "tMenuEditPlanner.h" | |
| 41 #include "tMenuEditSetpoint.h" | |
| 42 #include "tMenuEditSystem.h" | |
| 43 #include "tMenuEditXtra.h" | |
| 507 | 44 #include "tMenuEditCustom.h" |
| 1071 | 45 #include "tMenuCvOptionText.h" |
| 999 | 46 #include "tMenuEditCvOption.h" |
| 38 | 47 #include "tMenuGas.h" |
| 48 #include "tMenuHardware.h" | |
| 49 #include "tMenuPlanner.h" | |
| 50 #include "tMenuSetpoint.h" | |
| 51 #include "tMenuSystem.h" | |
| 52 #include "tMenuXtra.h" | |
| 507 | 53 #include "tMenuCustom.h" |
| 1053 | 54 #include "tStructure.h" |
| 38 | 55 |
| 56 /* Private types -------------------------------------------------------------*/ | |
| 999 | 57 #define MAXPAGES 12 |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
58 #define CURSOR_HIGH 25 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
59 #define TAB_HEADER_HIGH 25 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
60 #define TAB_BAR_HIGH 5 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
61 #define MENU_WDW_HIGH 390 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
62 #define KEY_LABEL_HIGH 25 /* Height of the label used for the the user keys */ |
| 38 | 63 |
| 999 | 64 #define TAB_BAR_WIDTH 50 |
| 65 #define TAB_BAR_SPACING 5 | |
| 66 | |
| 662 | 67 #define SLOW_UPDATE_CNT 10 /* Some content shall not be update in short intervals => add prescalar */ |
| 68 | |
| 38 | 69 typedef struct |
| 70 { | |
| 71 uint32_t StartAddressForPage[MAXPAGES+1]; | |
| 72 uint8_t lineMemoryForNavigationForPage[MAXPAGES+1]; | |
| 73 uint8_t pageMemoryForNavigation; | |
| 74 uint8_t linesAvailableForPage[MAXPAGES+1]; | |
| 75 uint8_t pagesAvailable; | |
| 76 uint8_t pageCountNumber[MAXPAGES+1]; | |
| 77 uint8_t pageCountTotal; | |
| 78 uint8_t modeFlipPages; | |
|
811
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
79 uint8_t shadowPage[MAXPAGES+1]; /* the page is switched in the context of another page */ |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
80 uint8_t activeShadow; /* Base page which is used for the shadow */ |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
81 uint8_t disableLineMask[MAXPAGES+1]; /* Bitfield used to disable a line. The line is visible but will not be selected by cursor) */ |
| 38 | 82 } SMenuMemory; |
| 83 | |
| 84 /* Exported variables --------------------------------------------------------*/ | |
| 85 | |
| 86 /* Announced Private variables -----------------------------------------------*/ | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
87 static GFX_DrawCfgScreen tMdesignSolo; |
|
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
88 static GFX_DrawCfgScreen tMdesignCursor; |
| 38 | 89 |
| 90 /* Private variables ---------------------------------------------------------*/ | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
91 static GFX_DrawCfgWindow tMwindow; |
|
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
92 static GFX_DrawCfgScreen tMscreen; |
| 38 | 93 |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
94 static SMenuMemory menu; |
| 38 | 95 |
| 96 uint8_t actual_menu_content = MENU_UNDEFINED; | |
| 97 | |
|
811
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
98 |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
99 |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
100 |
| 38 | 101 /* Private function prototypes -----------------------------------------------*/ |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
102 static void draw_tMheader(uint8_t page); |
|
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
103 static void draw_tMcursorDesign(void); |
| 38 | 104 |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
105 static void draw_tMdesignSubUnselected(uint32_t *ppDestination); |
|
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
106 static void draw_tMdesignSubSelected(uint32_t *ppDestination); |
|
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
107 static void draw_tMdesignSubSelectedBorder(uint32_t *ppDestination); |
|
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
108 static void tMenu_write(uint8_t page, char *text, char *subtext); |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
109 static void nextLine(void); |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
110 static void clean_line_actual_page(void); |
| 38 | 111 void tM_build_pages(void); |
| 112 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
113 static void gotoMenuEdit(void); |
| 38 | 114 |
| 115 /* Exported functions --------------------------------------------------------*/ | |
| 116 | |
| 117 GFX_DrawCfgScreen * get_PointerMenuCursorScreen(void) | |
| 118 { | |
| 119 return &tMdesignCursor; | |
| 120 } | |
| 121 | |
| 122 | |
| 123 GFX_DrawCfgScreen * get_PointerMenuCursorDesignSoloScreen(void) | |
| 124 { | |
| 125 return &tMdesignSolo; | |
| 126 } | |
| 127 | |
| 128 | |
| 129 void nextline(char * text, uint8_t *textPointer) | |
| 130 { | |
| 131 text[(*textPointer)++] = '\n'; | |
| 132 text[(*textPointer)++] = '\r'; | |
| 133 text[*textPointer] = 0; | |
| 134 } | |
| 135 | |
| 136 | |
|
816
c4ee952b9425
Fix a bug that disables arbitrary menu lines in dive mode if lines are disabled / inactive in surface mode. (mikeller)
heinrichsweikamp
parents:
815
diff
changeset
|
137 void clearDisabledMenuLines(void) |
|
c4ee952b9425
Fix a bug that disables arbitrary menu lines in dive mode if lines are disabled / inactive in surface mode. (mikeller)
heinrichsweikamp
parents:
815
diff
changeset
|
138 { |
|
c4ee952b9425
Fix a bug that disables arbitrary menu lines in dive mode if lines are disabled / inactive in surface mode. (mikeller)
heinrichsweikamp
parents:
815
diff
changeset
|
139 for(unsigned i = 0; i <= MAXPAGES; i++) { |
|
c4ee952b9425
Fix a bug that disables arbitrary menu lines in dive mode if lines are disabled / inactive in surface mode. (mikeller)
heinrichsweikamp
parents:
815
diff
changeset
|
140 menu.disableLineMask[i] = 0; |
|
c4ee952b9425
Fix a bug that disables arbitrary menu lines in dive mode if lines are disabled / inactive in surface mode. (mikeller)
heinrichsweikamp
parents:
815
diff
changeset
|
141 } |
|
c4ee952b9425
Fix a bug that disables arbitrary menu lines in dive mode if lines are disabled / inactive in surface mode. (mikeller)
heinrichsweikamp
parents:
815
diff
changeset
|
142 } |
|
c4ee952b9425
Fix a bug that disables arbitrary menu lines in dive mode if lines are disabled / inactive in surface mode. (mikeller)
heinrichsweikamp
parents:
815
diff
changeset
|
143 |
|
c4ee952b9425
Fix a bug that disables arbitrary menu lines in dive mode if lines are disabled / inactive in surface mode. (mikeller)
heinrichsweikamp
parents:
815
diff
changeset
|
144 |
| 38 | 145 void tM_init(void) |
| 146 { | |
| 147 uint8_t i; | |
| 148 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
149 SSettings* pSettings; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
150 pSettings = settingsGetPointer(); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
151 |
| 38 | 152 tMdesignCursor.FBStartAdress = getFrame(3); |
| 153 tMdesignCursor.ImageHeight = 390; | |
| 154 tMdesignCursor.ImageWidth = 800; | |
| 155 tMdesignCursor.LayerIndex = 0; | |
| 156 | |
| 157 tMdesignSolo.FBStartAdress = getFrame(4); | |
| 158 tMdesignSolo.ImageHeight = 390; | |
| 159 tMdesignSolo.ImageWidth = 800; | |
| 160 tMdesignSolo.LayerIndex = 0; | |
| 161 | |
| 162 menu.pagesAvailable = 0; | |
| 163 menu.pageMemoryForNavigation = 0; | |
| 164 for(i=0;i<=MAXPAGES;i++) | |
| 165 { | |
| 166 menu.lineMemoryForNavigationForPage[i] = 0; | |
| 167 menu.StartAddressForPage[i] = 0; | |
| 168 menu.linesAvailableForPage[i] = 0; | |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
169 menu.shadowPage[i] = 0; |
| 38 | 170 } |
| 171 | |
|
816
c4ee952b9425
Fix a bug that disables arbitrary menu lines in dive mode if lines are disabled / inactive in surface mode. (mikeller)
heinrichsweikamp
parents:
815
diff
changeset
|
172 clearDisabledMenuLines(); |
|
c4ee952b9425
Fix a bug that disables arbitrary menu lines in dive mode if lines are disabled / inactive in surface mode. (mikeller)
heinrichsweikamp
parents:
815
diff
changeset
|
173 |
| 38 | 174 tMscreen.FBStartAdress = 0; |
| 175 tMscreen.ImageHeight = 480; | |
| 176 tMscreen.ImageWidth = 800; | |
| 177 tMscreen.LayerIndex = 1; | |
| 178 | |
| 179 draw_tMcursorDesign(); | |
| 180 | |
| 181 tMwindow.Image = &tMscreen; | |
| 182 tMwindow.WindowNumberOfTextLines = 6; | |
| 183 tMwindow.WindowLineSpacing = 65; | |
| 184 tMwindow.WindowTab = 400; | |
| 185 tMwindow.WindowX0 = 20; | |
| 186 tMwindow.WindowX1 = 779; | |
| 187 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
188 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
189 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
190 tMwindow.WindowY0 = 4 + KEY_LABEL_HIGH; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
191 tMwindow.WindowY1 = 390 + KEY_LABEL_HIGH; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
192 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
193 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
194 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
195 tMwindow.WindowY0 = 480 - MENU_WDW_HIGH - TAB_HEADER_HIGH;// - TAB_BAR_HIGH; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
196 tMwindow.WindowY1 = 480 - TAB_HEADER_HIGH - TAB_BAR_HIGH; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
197 } |
| 38 | 198 actual_menu_content = MENU_UNDEFINED; |
| 199 } | |
| 200 | |
| 201 void tM_refresh(char *text, uint8_t *textPointer, uint8_t line, const char content[6]) | |
| 202 { | |
| 203 for(uint8_t i=0; i<6; i++) | |
| 204 { | |
| 205 if(((line == 0) || (line == i)) && content[i]) | |
| 206 { | |
| 207 text[(*textPointer)++] = content[i]; | |
| 208 } | |
| 209 text[(*textPointer)++] = '\n'; | |
| 210 text[(*textPointer)++] = '\r'; | |
| 211 text[*textPointer] = 0; | |
| 212 } | |
| 213 } | |
| 214 | |
| 215 | |
| 216 void tM_rebuild_pages(void) | |
| 217 { | |
| 218 menu.pagesAvailable = 0; | |
| 219 // menu.pageMemoryForNavigation = 0; | |
| 220 for(int i=0;i<=MAXPAGES;i++) | |
| 221 { | |
| 222 menu.lineMemoryForNavigationForPage[i] = 0; | |
| 223 menu.linesAvailableForPage[i] = 0; | |
| 224 menu.StartAddressForPage[i] = 0; // only with GFX_forceReleaseFramesWithId(5); !!!!! | |
| 225 } | |
| 226 GFX_forceReleaseFramesWithId(5); | |
| 227 tM_build_pages(); | |
| 228 } | |
| 229 | |
| 230 | |
| 231 void tM_rebuild_menu_after_tComm(void) | |
| 232 { | |
| 233 tM_rebuild_pages(); | |
| 234 } | |
| 235 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
236 void tM_check_content(void) |
| 38 | 237 { |
| 238 uint8_t mode = 0; | |
| 239 | |
| 240 if(stateUsed->mode == MODE_DIVE) | |
| 241 { | |
| 242 if(stateUsed == stateRealGetPointer()) | |
| 243 mode = MENU_DIVE_REAL; | |
| 244 else | |
| 245 mode = MENU_DIVE_SIM; | |
| 246 } | |
| 247 else | |
| 248 mode = MENU_SURFACE; | |
| 249 | |
| 250 if(actual_menu_content != mode) | |
| 251 { | |
| 252 actual_menu_content = mode; | |
| 253 tM_rebuild_pages(); | |
| 254 } | |
| 255 } | |
| 256 | |
|
811
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
257 void disableLine(uint32_t lineId) |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
258 { |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
259 SStateList idList; |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
260 |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
261 get_idSpecificStateList(lineId, &idList); |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
262 |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
263 if((idList.page < MAXPAGES) && (idList.line < MAXLINES)) |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
264 { |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
265 menu.disableLineMask[idList.page] |= (1 << idList.line); |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
266 } |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
267 } |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
268 |
|
850
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
269 uint8_t getLineMask(uint32_t lineId) |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
270 { |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
271 SStateList idList; |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
272 get_idSpecificStateList(lineId, &idList); |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
273 return(menu.disableLineMask[idList.page]); |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
274 } |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
275 |
|
815
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
276 void resetLineMask(uint32_t lineId) |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
277 { |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
278 SStateList idList; |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
279 get_idSpecificStateList(lineId, &idList); |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
280 if(idList.page < MAXPAGES) |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
281 { |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
282 menu.disableLineMask[idList.page] = 0; |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
283 } |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
284 } |
|
811
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
285 void enableLine(uint32_t lineId) |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
286 { |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
287 SStateList idList; |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
288 |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
289 get_idSpecificStateList(lineId, &idList); |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
290 |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
291 if((idList.page < MAXPAGES) && (idList.line < MAXLINES)) |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
292 { |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
293 menu.disableLineMask[idList.page] &= ~(1 << idList.line); |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
294 } |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
295 } |
| 38 | 296 |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
297 static void clean_line_actual_page(void) |
| 38 | 298 { |
| 299 uint8_t line, page; | |
| 300 | |
| 301 page = menu.pageMemoryForNavigation; | |
| 302 line = menu.lineMemoryForNavigationForPage[page]; | |
|
122
871baf20776b
Take care for display orientation if deleting lines
Ideenmodellierer
parents:
110
diff
changeset
|
303 if(settingsGetPointer()->FlipDisplay) /* Reselect line to be deleted if display is rotated */ |
|
871baf20776b
Take care for display orientation if deleting lines
Ideenmodellierer
parents:
110
diff
changeset
|
304 { |
|
871baf20776b
Take care for display orientation if deleting lines
Ideenmodellierer
parents:
110
diff
changeset
|
305 line = 6 - line + 1; |
|
871baf20776b
Take care for display orientation if deleting lines
Ideenmodellierer
parents:
110
diff
changeset
|
306 } |
| 38 | 307 tMscreen.FBStartAdress = menu.StartAddressForPage[page]; |
| 308 GFX_clean_line(&tMwindow, line); | |
| 309 } | |
| 310 | |
| 311 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
312 static void update_content_actual_page(char *text, uint16_t tab, char *subtext) |
| 38 | 313 { |
| 314 uint8_t page; | |
| 315 | |
| 316 page = menu.pageMemoryForNavigation; | |
| 317 | |
| 318 tMscreen.FBStartAdress = menu.StartAddressForPage[page]; | |
| 319 if(tab == 0) | |
| 320 tMwindow.WindowTab = 400; | |
| 321 else | |
| 322 tMwindow.WindowTab = tab; | |
| 323 | |
| 324 tMenu_write(page, text, subtext); | |
| 325 } | |
| 326 | |
| 327 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
328 static void update_content_with_new_frame(uint8_t page, char *text, uint16_t tab, char *subtext) |
| 38 | 329 { |
| 330 char localtext[32]; | |
| 331 | |
| 332 uint32_t rememberPage = menu.StartAddressForPage[page]; | |
| 333 menu.StartAddressForPage[page] = getFrame(5); | |
| 334 tMscreen.FBStartAdress = menu.StartAddressForPage[page]; | |
| 335 | |
| 336 if(tab == 0) | |
| 337 tMwindow.WindowTab = 400; | |
| 338 else | |
| 339 tMwindow.WindowTab = tab; | |
| 340 | |
| 341 draw_tMheader(page); | |
| 342 tMenu_write(page, text, subtext); | |
| 343 | |
| 344 localtext[0] = TXT_2BYTE; | |
| 345 localtext[1] = TXT2BYTE_ButtonBack; | |
| 346 localtext[2] = 0; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
347 write_content_simple(&tMscreen, 0, 800, 480-KEY_LABEL_HIGH, &FontT24,localtext,CLUT_ButtonSurfaceScreen); |
| 38 | 348 |
| 349 localtext[0] = '\001'; | |
| 350 localtext[1] = TXT_2BYTE; | |
| 351 localtext[2] = TXT2BYTE_ButtonEnter; | |
| 352 localtext[3] = 0; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
353 write_content_simple(&tMscreen, 0, 800, 480-KEY_LABEL_HIGH, &FontT24,localtext,CLUT_ButtonSurfaceScreen); |
| 38 | 354 |
| 355 localtext[0] = '\002'; | |
| 356 localtext[1] = TXT_2BYTE; | |
| 357 localtext[2] = TXT2BYTE_ButtonNext; | |
| 358 localtext[3] = 0; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
359 write_content_simple(&tMscreen, 0, 800, 480-KEY_LABEL_HIGH, &FontT24,localtext,CLUT_ButtonSurfaceScreen); |
| 38 | 360 |
| 361 // gfx_write_page_number(&tMscreen ,menu.pageCountNumber[page],menu.pageCountTotal,0); | |
| 362 | |
| 363 if(page == menu.pageMemoryForNavigation) | |
| 364 GFX_SetFrameTop(tMscreen.FBStartAdress); | |
| 365 releaseFrame(5,rememberPage); | |
| 366 } | |
| 367 | |
| 368 | |
|
169
842f57bbaaad
Bugfix: highlight the menu underline correctly on selected state
Jan Mulder <jlmulder@xs4all.nl>
parents:
167
diff
changeset
|
369 static void tM_create_pagenumbering(void) |
| 38 | 370 { |
| 371 menu.pageCountTotal = 0; | |
| 372 | |
| 373 for(int i=0;i<=MAXPAGES;i++) | |
| 374 { | |
| 375 if(menu.pageCountNumber[i]) | |
| 376 { | |
| 377 menu.pageCountTotal++; | |
| 378 menu.pageCountNumber[i] = menu.pageCountTotal; | |
| 379 } | |
| 380 } | |
| 381 } | |
| 382 | |
| 383 | |
| 379 | 384 void tM_build_page(uint32_t id, char *text, uint16_t tab, char *subtext) |
| 38 | 385 { |
| 386 uint8_t linesFound; | |
| 387 uint16_t i; | |
| 388 SStateList idList; | |
| 389 uint8_t page; | |
| 390 | |
| 391 char localtext[32]; | |
| 392 | |
| 393 if(menu.pagesAvailable > MAXPAGES) | |
| 394 return; | |
| 395 | |
| 396 get_idSpecificStateList(id, &idList); | |
| 397 | |
| 398 if(idList.base != BaseMenu) | |
| 399 return; | |
| 400 | |
| 401 if(idList.page == 0) | |
| 402 return; | |
| 403 | |
| 404 if(idList.page > MAXPAGES) | |
| 405 return; | |
| 406 | |
| 407 page = idList.page; | |
| 408 | |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
409 if((!menu.pageCountNumber[page]) && (!menu.shadowPage[page])) /* shadow pages are not visible on top level */ |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
410 { |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
411 return; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
412 } |
| 38 | 413 |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
414 if(menu.pagesAvailable == 0) |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
415 tM_create_pagenumbering(); |
| 38 | 416 |
| 417 if(*text == 0) | |
| 418 return; | |
| 419 | |
| 420 linesFound = 1; | |
| 421 | |
| 422 if(menu.StartAddressForPage[page]) | |
| 423 releaseFrame(5,menu.StartAddressForPage[page]); | |
| 424 | |
| 425 menu.StartAddressForPage[page] = getFrame(5); | |
| 426 | |
| 427 if(menu.StartAddressForPage[page] == 0) | |
| 428 return; | |
| 429 | |
| 430 i = 0; | |
| 431 while((i < MAX_PAGE_TEXTSIZE) && text[i]) | |
| 432 { | |
| 433 if((text[i] == '\n') && ((i + 2) < MAX_PAGE_TEXTSIZE) && text[i+1] && text[i+2]) | |
| 434 linesFound += 1; | |
| 435 i++; | |
| 436 } | |
| 437 | |
| 438 menu.linesAvailableForPage[page] = linesFound; | |
| 439 menu.pagesAvailable++; /* even if it was used before */ | |
| 440 | |
| 441 tMscreen.FBStartAdress = menu.StartAddressForPage[page]; | |
| 442 if(tab == 0) | |
| 443 tMwindow.WindowTab = 400; | |
| 444 else | |
| 445 tMwindow.WindowTab = tab; | |
| 446 | |
| 447 draw_tMheader(page); | |
| 448 | |
| 449 tMenu_write(page, text, subtext); | |
| 450 | |
| 451 localtext[0] = TXT_2BYTE; | |
| 452 localtext[1] = TXT2BYTE_ButtonBack; | |
| 453 localtext[2] = 0; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
454 write_content_simple(&tMscreen, 0, 800, 480-KEY_LABEL_HIGH, &FontT24,localtext,CLUT_ButtonSurfaceScreen); |
| 38 | 455 |
| 456 localtext[0] = '\001'; | |
| 457 localtext[1] = TXT_2BYTE; | |
| 458 localtext[2] = TXT2BYTE_ButtonEnter; | |
| 459 localtext[3] = 0; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
460 write_content_simple(&tMscreen, 0, 800, 480-KEY_LABEL_HIGH, &FontT24,localtext,CLUT_ButtonSurfaceScreen); |
| 38 | 461 |
| 462 localtext[0] = '\002'; | |
| 463 localtext[1] = TXT_2BYTE; | |
| 464 localtext[2] = TXT2BYTE_ButtonNext; | |
| 465 localtext[3] = 0; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
466 write_content_simple(&tMscreen, 0, 800, 480-KEY_LABEL_HIGH, &FontT24,localtext,CLUT_ButtonSurfaceScreen); |
| 38 | 467 } |
| 468 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
469 static void findValidPosition(uint8_t *pageOuput, uint8_t *lineOutput) |
| 38 | 470 { |
|
51
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
471 uint8_t page = 0; |
|
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
472 uint8_t line = 0; |
|
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
473 uint8_t first = 0; |
| 38 | 474 |
| 475 *pageOuput = 0; | |
| 476 *lineOutput = 0; | |
| 477 | |
| 478 /* test */ | |
| 479 if(menu.pagesAvailable == 0) | |
| 480 return; | |
| 481 | |
| 482 for(int i=1;i<=MAXPAGES;i++) | |
| 483 { | |
| 484 if((menu.pageCountNumber[i] != 0) | |
| 485 && (menu.linesAvailableForPage[i] != 0) | |
| 486 && (menu.StartAddressForPage[i] != 0)) | |
| 487 { | |
| 488 first = i; | |
| 489 break; | |
| 490 } | |
| 491 } | |
| 492 | |
| 493 /* select */ | |
| 494 if(menu.pageMemoryForNavigation > MAXPAGES) | |
| 495 menu.pageMemoryForNavigation = first; | |
| 496 | |
| 497 page = menu.pageMemoryForNavigation; | |
| 498 | |
| 499 if(page == 0) | |
| 500 page = first; | |
| 501 | |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
502 while((page <= MAXPAGES) && ((menu.linesAvailableForPage[page] == 0) || (menu.StartAddressForPage[page] == 0) || ((menu.pageCountNumber[page] == 0) && !((menu.shadowPage[page]) && (menu.pageMemoryForNavigation == page))))) |
| 38 | 503 page += 1; |
| 504 | |
| 505 if(page > MAXPAGES) | |
| 506 page = first; | |
| 507 | |
| 508 line = menu.lineMemoryForNavigationForPage[page]; | |
| 509 | |
| 510 if(line == 0) | |
| 511 line = 1; | |
| 512 | |
|
815
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
513 while(menu.disableLineMask[page] & ( 1 << line)) |
|
811
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
514 { |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
515 line++; |
|
815
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
516 if(line > menu.linesAvailableForPage[page]) |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
517 { |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
518 line = 1; |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
519 } |
|
811
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
520 } |
|
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
521 |
| 38 | 522 if(line > menu.linesAvailableForPage[page]) |
| 523 line = 1; | |
| 524 | |
| 525 *pageOuput = page; | |
| 526 *lineOutput = line; | |
| 527 } | |
| 528 | |
| 529 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
530 static void tM_add(uint32_t id) |
| 38 | 531 { |
| 532 SStateList idList; | |
| 533 uint8_t page; | |
| 534 | |
| 535 get_idSpecificStateList(id, &idList); | |
| 536 | |
| 537 page = idList.page; | |
| 538 | |
| 539 if(page > MAXPAGES) | |
| 540 return; | |
| 541 | |
| 542 menu.pageCountNumber[page] = 1; | |
| 543 } | |
| 544 | |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
545 static void tM_addShadow(uint32_t id) |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
546 { |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
547 SStateList idList; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
548 uint8_t page; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
549 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
550 get_idSpecificStateList(id, &idList); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
551 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
552 page = idList.page; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
553 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
554 if(page > MAXPAGES) |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
555 return; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
556 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
557 menu.shadowPage[page] = 1; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
558 } |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
559 |
| 38 | 560 |
| 561 void tM_build_pages(void) | |
| 562 { | |
| 563 char text[MAX_PAGE_TEXTSIZE]; | |
| 564 char subtext[MAX_PAGE_TEXTSIZE]; | |
| 565 uint32_t id; | |
| 566 uint16_t tabPosition; | |
| 567 SSettings *pSettings = settingsGetPointer(); | |
| 568 | |
| 569 menu.pagesAvailable = 0; | |
| 570 for(int i=0;i<=MAXPAGES;i++) | |
| 571 menu.pageCountNumber[i] = 0; | |
| 572 | |
| 573 tabPosition = 400; | |
| 574 *text = 0; | |
| 575 *subtext = 0; | |
| 576 | |
| 577 /* 2015 Feb 02, hw | |
| 578 * max 8 Menu Pages | |
| 579 */ | |
| 580 | |
| 581 | |
| 1041 | 582 tM_add(StMSYS); //now in both modes |
| 38 | 583 if(actual_menu_content == MENU_SURFACE) |
| 584 { | |
| 585 tM_add(StMDECO); | |
| 586 tM_add(StMHARD); | |
| 1041 | 587 tM_add(StMCustom); |
|
1039
f8e2895c91e5
Reorder the 'SYS' menus so that they follow 'features / hardware / display' which should be less confusing for users.
heinrichsweikamp
parents:
1037
diff
changeset
|
588 tM_add(StMOption); |
| 1041 | 589 // tM_add(StMSYS); now in both modes |
| 38 | 590 } |
| 591 else | |
| 592 { | |
| 593 tM_add(StMXTRA); | |
| 594 } | |
| 595 if(actual_menu_content == MENU_SURFACE) | |
| 596 { | |
| 597 tM_add(StMPLAN); | |
| 598 } | |
| 599 // if((pSettings->dive_mode != DIVEMODE_Gauge) && (pSettings->dive_mode != DIVEMODE_Apnea)) | |
| 600 // { | |
| 601 tM_add(StMDECOP); | |
| 602 // } | |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
603 |
| 662 | 604 if((isLoopMode(pSettings->dive_mode)) || (stateUsed->diveSettings.ccrOption == 1)) |
| 38 | 605 { |
| 606 tM_add(StMCG); | |
|
856
af035b883382
Do not show SP tab if PSCR mode is active:
Ideenmodellierer
parents:
851
diff
changeset
|
607 if((stateUsed->diveSettings.diveMode != DIVEMODE_PSCR) || (actual_menu_content != MENU_SURFACE)) |
|
af035b883382
Do not show SP tab if PSCR mode is active:
Ideenmodellierer
parents:
851
diff
changeset
|
608 { |
|
af035b883382
Do not show SP tab if PSCR mode is active:
Ideenmodellierer
parents:
851
diff
changeset
|
609 tM_add(StMSP); |
|
af035b883382
Do not show SP tab if PSCR mode is active:
Ideenmodellierer
parents:
851
diff
changeset
|
610 } |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
611 if (actual_menu_content == MENU_SURFACE) /* StMOG is now accessed using StMCG in CCR mode*/ |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
612 { |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
613 tM_add(StMXTRA); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
614 tM_addShadow(StMOG); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
615 } |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
616 else |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
617 { |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
618 tM_add(StMOG); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
619 } |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
620 } |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
621 else |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
622 { |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
623 tM_add(StMOG); |
| 38 | 624 } |
| 625 | |
| 626 id = tMOG_refresh(0, text, &tabPosition, subtext); | |
| 627 tM_build_page(id, text, tabPosition, subtext); | |
| 628 | |
| 629 id = tMCG_refresh(0, text, &tabPosition, subtext); | |
| 630 tM_build_page(id, text, tabPosition, subtext); | |
| 631 | |
|
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
774
diff
changeset
|
632 id = tMSP_refresh(text, &tabPosition, subtext); |
| 38 | 633 tM_build_page(id, text, tabPosition, subtext); |
| 634 | |
| 635 id = tMXtra_refresh(0, text, &tabPosition, subtext); | |
| 636 tM_build_page(id, text, tabPosition, subtext); | |
| 637 | |
| 638 id = tMPlanner_refresh(0, text, &tabPosition, subtext); | |
| 639 tM_build_page(id, text, tabPosition, subtext); | |
| 640 | |
| 641 id = tMDeco_refresh(0, text, &tabPosition, subtext); | |
| 642 tM_build_page(id, text, tabPosition, subtext); | |
| 643 | |
| 644 id = tMDecoParameters_refresh(0, text, &tabPosition, subtext); | |
| 645 tM_build_page(id, text, tabPosition, subtext); | |
| 646 | |
| 647 id = tMPlanner_refresh(0, text, &tabPosition, subtext); | |
| 648 tM_build_page(id, text, tabPosition, subtext); | |
| 649 | |
| 650 id = tMHardware_refresh(0, text, &tabPosition, subtext); | |
| 651 tM_build_page(id, text, tabPosition, subtext); | |
| 652 | |
| 653 id = tMSystem_refresh(0, text, &tabPosition, subtext); | |
| 654 tM_build_page(id, text, tabPosition, subtext); | |
| 507 | 655 |
| 656 id = tMCustom_refresh(0, text, &tabPosition, subtext); | |
| 657 tM_build_page(id, text, tabPosition, subtext); | |
| 999 | 658 |
| 1071 | 659 tMCvOptText_BuildDynamicContentList(); |
| 999 | 660 id = tMCvOption_refresh(0, text, &tabPosition, subtext); |
| 661 tM_build_page(id, text, tabPosition, subtext); | |
| 38 | 662 } |
| 663 | |
| 664 | |
| 665 void tM_refresh_live_content(void) | |
| 666 { | |
| 662 | 667 static uint8_t slowUpdate = SLOW_UPDATE_CNT; |
|
51
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
668 uint8_t page = 0; |
| 38 | 669 char text[MAX_PAGE_TEXTSIZE]; |
| 670 char subtext[MAX_PAGE_TEXTSIZE]; | |
| 671 uint16_t tabPosition; | |
| 672 | |
| 662 | 673 uint32_t globalState = get_globalState(); |
| 674 | |
| 675 slowUpdate--; | |
| 676 page = menu.pageMemoryForNavigation; | |
| 677 switch(globalState) | |
| 38 | 678 { |
| 662 | 679 case StMSYS: if(actual_menu_content == MENU_SURFACE) |
| 680 { | |
| 681 tMSystem_refresh(0, text, &tabPosition, subtext); | |
| 682 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 683 } | |
| 684 break; | |
| 685 case StMHARD: tMHardware_refresh(0, text, &tabPosition, subtext); | |
| 686 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 687 break; | |
| 688 case StMOG: if((actual_menu_content != MENU_SURFACE) && (slowUpdate == 0)) | |
| 689 { | |
| 690 tMOG_refresh(0, text, &tabPosition, subtext); | |
| 691 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 692 } | |
| 693 break; | |
| 1071 | 694 case StMCG: |
| 695 #ifndef ENABLE_ADVANCED_GAS | |
| 696 if((actual_menu_content != MENU_SURFACE) && (slowUpdate == 0)) | |
| 697 #else | |
| 698 if(slowUpdate == 0) | |
| 699 #endif | |
| 662 | 700 { |
| 701 tMCG_refresh(0, text, &tabPosition, subtext); | |
| 702 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 703 } | |
| 704 break; | |
| 1071 | 705 case StMOption: tMCvOption_refresh(0, text, &tabPosition, subtext); |
| 706 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 707 break; | |
| 662 | 708 default: |
| 709 break; | |
| 38 | 710 } |
| 662 | 711 if(slowUpdate == 0) |
| 38 | 712 { |
| 662 | 713 slowUpdate = SLOW_UPDATE_CNT; |
| 38 | 714 } |
| 715 | |
| 716 tMscreen.FBStartAdress = menu.StartAddressForPage[page]; | |
| 717 tHome_show_lost_connection_count(&tMscreen); | |
| 718 /* | |
| 719 SStateList idList; | |
| 720 if(actual_menu_content == MENU_SURFACE) | |
| 721 { | |
| 722 page = menu.pageMemoryForNavigation; | |
| 723 get_idSpecificStateList(StMSYS, &idList); | |
| 724 if(page == idList.page) | |
| 725 { | |
| 726 tMSystem_refresh(0, text, &tabPosition, subtext); | |
| 727 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 728 } | |
| 729 } | |
| 730 */ | |
| 731 } | |
| 732 | |
| 733 | |
| 734 /* new frame only! */ | |
| 735 void updateSpecificMenu(uint32_t id) | |
| 736 { | |
| 737 uint8_t page; | |
| 738 SStateList idList; | |
| 739 | |
| 740 char text[MAX_PAGE_TEXTSIZE]; | |
| 741 char subtext[MAX_PAGE_TEXTSIZE]; | |
| 742 uint16_t tabPosition; | |
| 743 | |
| 744 *subtext = 0; | |
| 745 *text = 0; | |
| 746 tabPosition = 400; | |
| 747 | |
| 748 get_idSpecificStateList(id, &idList); | |
| 749 page = idList.page; | |
| 750 | |
| 751 switch(id) | |
| 752 { | |
| 753 case StMOG: | |
| 754 tMOG_refresh(0, text, &tabPosition, subtext); | |
| 755 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 756 break; | |
| 757 case StMCG: | |
| 758 tMCG_refresh(0, text, &tabPosition, subtext); | |
| 759 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 760 break; | |
| 761 case StMSP: | |
|
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
774
diff
changeset
|
762 tMSP_refresh(text, &tabPosition, subtext); |
| 38 | 763 update_content_with_new_frame(page, text, tabPosition, subtext); |
| 764 break; | |
|
815
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
765 case StMSYS: |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
766 tMSystem_refresh(0, text, &tabPosition, NULL); |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
767 update_content_with_new_frame(page, text, tabPosition, subtext); |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
768 break; |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
769 |
| 38 | 770 default: |
| 771 break; | |
| 772 } | |
| 773 } | |
| 774 | |
| 775 | |
| 776 void updateMenu(void) | |
| 777 { | |
| 778 uint8_t page, line; | |
| 779 | |
| 780 char text[MAX_PAGE_TEXTSIZE]; | |
| 781 char subtext[MAX_PAGE_TEXTSIZE]; | |
| 782 uint16_t tabPosition; | |
| 783 | |
| 784 *subtext = 0; | |
| 785 *text = 0; | |
| 786 tabPosition = 400; | |
| 787 | |
| 788 page = menu.pageMemoryForNavigation; | |
| 789 line = menu.lineMemoryForNavigationForPage[page]; | |
| 790 | |
| 791 switch(get_globalState()) | |
| 792 { | |
| 793 case StMOG: | |
| 794 tMOG_refresh(0, text, &tabPosition, subtext); | |
| 795 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 796 break; | |
| 797 case StMCG: | |
| 798 tMCG_refresh(0, text, &tabPosition, subtext); | |
| 799 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 800 break; | |
| 801 case StMSP: | |
|
788
4abfb8a2a435
Define explicit setpoints for low / high / deco. Add an option to delay the switch to SPlow until all decompression has been cleared. (mikeller)
heinrichsweikamp
parents:
774
diff
changeset
|
802 tMSP_refresh(text, &tabPosition, subtext); |
| 38 | 803 update_content_with_new_frame(page, text, tabPosition, subtext); |
| 804 break; | |
| 805 case StMXTRA: | |
| 806 tMXtra_refresh(0, text, &tabPosition, subtext); | |
| 807 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 808 break; | |
| 809 case StMDECO: | |
|
1028
3d9552e4997c
Code improvment: line <=> menu id function:
Ideenmodellierer
parents:
1018
diff
changeset
|
810 if((line == get_lineOfID(StMDECO1_OC)) || (line == get_lineOfID(StMDECO3_PPO2Max))) // dive mode or ppO2 limits (the later for correct MOD in gaslists) |
| 38 | 811 { |
| 812 tM_rebuild_pages(); | |
| 813 menu.lineMemoryForNavigationForPage[page] = line; // fix 160623 | |
| 814 GFX_SetFrameTop(menu.StartAddressForPage[page]); | |
| 815 } | |
| 816 else | |
| 817 { | |
| 818 tMDeco_refresh(line, text, &tabPosition, subtext); | |
| 819 clean_line_actual_page(); | |
| 820 update_content_actual_page(text, tabPosition, subtext); | |
| 821 } | |
| 822 break; | |
| 823 case StMDECOP: | |
| 824 tMDecoParameters_refresh(line, text, &tabPosition, subtext); | |
| 825 clean_line_actual_page(); | |
| 826 update_content_actual_page(text, tabPosition, subtext); | |
| 827 break; | |
| 828 case StMPLAN: | |
| 829 tMPlanner_refresh(line, text, &tabPosition, subtext); | |
| 830 clean_line_actual_page(); | |
| 831 update_content_actual_page(text, tabPosition, subtext); | |
| 832 break; | |
| 833 case StMHARD: | |
| 834 tMHardware_refresh(line, text, &tabPosition, subtext); | |
| 835 clean_line_actual_page(); | |
| 836 update_content_actual_page(text, tabPosition, subtext); | |
| 837 break; | |
| 838 case StMSYS: | |
|
1037
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1028
diff
changeset
|
839 if((line == get_lineOfID(StMSYS1_DateTime)) || (line == get_lineOfID(StMSYS2_English)) |
|
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1028
diff
changeset
|
840 #ifdef ENABLE_SETTING_PROFILES |
|
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1028
diff
changeset
|
841 || (line == get_lineOfID(StMSYS_Profile))) |
|
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1028
diff
changeset
|
842 #else |
|
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1028
diff
changeset
|
843 ) |
|
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1028
diff
changeset
|
844 #endif |
| 38 | 845 { |
| 846 tM_rebuild_pages(); | |
| 847 menu.lineMemoryForNavigationForPage[page] = line; // fix 160623 | |
| 848 GFX_SetFrameTop(menu.StartAddressForPage[page]); | |
| 849 menu.lineMemoryForNavigationForPage[page] = line; | |
| 850 } | |
| 851 else | |
| 852 { | |
| 853 tMSystem_refresh(line, text, &tabPosition, subtext); | |
| 854 clean_line_actual_page(); | |
| 855 update_content_actual_page(text, tabPosition, subtext); | |
| 856 } | |
| 857 break; | |
| 507 | 858 case StMCustom: |
| 859 tMCustom_refresh(line, text, &tabPosition, subtext); | |
| 860 clean_line_actual_page(); | |
| 861 update_content_actual_page(text, tabPosition, subtext); | |
| 862 break; | |
|
1001
21142f4fa968
Cleanup menu structucture afer menu shift:
Ideenmodellierer
parents:
999
diff
changeset
|
863 case StMOption: |
|
21142f4fa968
Cleanup menu structucture afer menu shift:
Ideenmodellierer
parents:
999
diff
changeset
|
864 tMCvOption_refresh(line, text, &tabPosition, subtext); |
|
21142f4fa968
Cleanup menu structucture afer menu shift:
Ideenmodellierer
parents:
999
diff
changeset
|
865 clean_line_actual_page(); |
|
21142f4fa968
Cleanup menu structucture afer menu shift:
Ideenmodellierer
parents:
999
diff
changeset
|
866 update_content_actual_page(text, tabPosition, subtext); |
|
21142f4fa968
Cleanup menu structucture afer menu shift:
Ideenmodellierer
parents:
999
diff
changeset
|
867 break; |
| 38 | 868 default: |
| 869 break; | |
| 870 } | |
| 871 } | |
| 872 | |
| 873 void openMenu_first_page_with_OC_gas_update(void) | |
| 874 { | |
| 875 menu.pageMemoryForNavigation = 1; | |
| 876 for(int i=0;i<=MAXPAGES;i++) | |
| 877 menu.lineMemoryForNavigationForPage[i] = 0; | |
| 878 | |
| 879 set_globalState(StMOG); | |
| 880 updateMenu(); | |
| 881 openMenu(1); | |
| 882 } | |
| 883 | |
| 884 | |
| 885 void openMenu(uint8_t freshWithFlipPages) | |
| 886 { | |
| 887 uint8_t page, line; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
888 SSettings* pSettings; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
889 pSettings = settingsGetPointer(); |
| 38 | 890 |
| 891 findValidPosition(&page, &line); | |
| 892 if((page == 0) || (line == 0)) | |
| 893 return; | |
| 894 | |
| 996 | 895 if( getBuzzerActivationRequest() != REQUEST_BUZZER_ONCE) |
| 896 { | |
| 897 requestBuzzerActivation(REQUEST_BUZZER_OFF); | |
| 898 } | |
| 951 | 899 |
| 38 | 900 menu.pageMemoryForNavigation = page; |
| 901 /* new test for 3button design */ | |
| 902 if(freshWithFlipPages) | |
| 903 { | |
| 904 menu.lineMemoryForNavigationForPage[page] = 0; | |
| 905 menu.modeFlipPages = 1; | |
| 906 } | |
| 907 else | |
| 908 { | |
| 909 menu.lineMemoryForNavigationForPage[page] = line; | |
| 910 menu.modeFlipPages = 0; | |
| 911 } | |
| 912 | |
| 913 set_globalState_Menu_Page(page); | |
| 914 | |
| 915 | |
| 916 change_CLUT_entry(CLUT_MenuLineSelectedSides, (CLUT_MenuPageGasOC + page - 1)); | |
| 917 change_CLUT_entry(CLUT_MenuLineSelectedSeperator, (CLUT_MenuPageGasOC + page - 1)); | |
| 918 | |
| 919 | |
| 920 if(((page == 6) || (page == 8)) && (menu.pageCountNumber[page-1] == 0)) | |
| 921 { | |
| 922 change_CLUT_entry(CLUT_MenuLineSelectedSides, (CLUT_MenuPageGasOC + page - 2)); | |
| 923 change_CLUT_entry(CLUT_MenuLineSelectedSeperator, (CLUT_MenuPageGasOC + page - 2)); | |
| 924 | |
| 925 } | |
| 926 | |
| 927 GFX_SetFrameTop(menu.StartAddressForPage[page]); | |
| 928 /* new test for 3button design */ | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
929 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
930 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
931 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
932 if(freshWithFlipPages) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
933 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 25, 800, 390); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
934 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
935 GFX_SetFrameBottom((tMdesignCursor.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
936 } |
| 38 | 937 else |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
938 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
939 if(freshWithFlipPages) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
940 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
941 GFX_SetFrameBottom((tMdesignSolo.FBStartAdress), 0, 480-390-KEY_LABEL_HIGH, 800, 390); //- (25 * 2 * 800), 0, 25, 800, 390); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
942 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
943 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
944 GFX_SetFrameBottom((tMdesignCursor.FBStartAdress + (390 - 65 *(line)) *2), 0,480-390-KEY_LABEL_HIGH, 800, 390); //480-390-KEY_LABEL_HIGH + 65*2*(line - 1) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
945 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
946 |
| 38 | 947 } |
| 948 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
949 static void block_diluent_handler(_Bool Unblock) |
| 38 | 950 { |
| 951 SStateList list; | |
| 952 static uint8_t linesAvailableForPageDiluent = 0; | |
| 953 get_idSpecificStateList(StMCG, &list); | |
| 954 | |
| 955 if(Unblock && linesAvailableForPageDiluent) | |
| 956 { | |
| 957 menu.linesAvailableForPage[list.page] = linesAvailableForPageDiluent; | |
| 958 } | |
| 959 else | |
| 960 { | |
| 961 linesAvailableForPageDiluent = menu.linesAvailableForPage[list.page]; | |
| 962 menu.linesAvailableForPage[list.page] = 0; | |
| 963 } | |
| 964 } | |
| 965 | |
|
1073
734f84b72b30
CV Option Menu added sub menus for O2 and CO2 sensors:
Ideenmodellierer
parents:
1071
diff
changeset
|
966 tM_setLinesForPage(uint32_t pageID, uint8_t lineCnt) |
|
734f84b72b30
CV Option Menu added sub menus for O2 and CO2 sensors:
Ideenmodellierer
parents:
1071
diff
changeset
|
967 { |
|
734f84b72b30
CV Option Menu added sub menus for O2 and CO2 sensors:
Ideenmodellierer
parents:
1071
diff
changeset
|
968 SStateList list; |
|
734f84b72b30
CV Option Menu added sub menus for O2 and CO2 sensors:
Ideenmodellierer
parents:
1071
diff
changeset
|
969 get_idSpecificStateList(pageID, &list); |
|
734f84b72b30
CV Option Menu added sub menus for O2 and CO2 sensors:
Ideenmodellierer
parents:
1071
diff
changeset
|
970 |
|
734f84b72b30
CV Option Menu added sub menus for O2 and CO2 sensors:
Ideenmodellierer
parents:
1071
diff
changeset
|
971 if(list.page < MAXPAGES) |
|
734f84b72b30
CV Option Menu added sub menus for O2 and CO2 sensors:
Ideenmodellierer
parents:
1071
diff
changeset
|
972 { |
|
734f84b72b30
CV Option Menu added sub menus for O2 and CO2 sensors:
Ideenmodellierer
parents:
1071
diff
changeset
|
973 menu.linesAvailableForPage[list.page] = lineCnt; |
|
734f84b72b30
CV Option Menu added sub menus for O2 and CO2 sensors:
Ideenmodellierer
parents:
1071
diff
changeset
|
974 } |
|
734f84b72b30
CV Option Menu added sub menus for O2 and CO2 sensors:
Ideenmodellierer
parents:
1071
diff
changeset
|
975 } |
|
734f84b72b30
CV Option Menu added sub menus for O2 and CO2 sensors:
Ideenmodellierer
parents:
1071
diff
changeset
|
976 |
| 38 | 977 void block_diluent_page(void) |
| 978 { | |
| 979 block_diluent_handler(0); | |
| 980 } | |
| 981 | |
| 982 | |
| 983 void unblock_diluent_page(void) | |
| 984 { | |
| 985 block_diluent_handler(1); | |
| 986 } | |
| 987 | |
|
850
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
988 static void checkLineStatus() |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
989 { |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
990 switch(get_globalState()) |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
991 { |
|
1001
21142f4fa968
Cleanup menu structucture afer menu shift:
Ideenmodellierer
parents:
999
diff
changeset
|
992 case StMOption: tMCvOption_checkLineStatus(); |
| 851 | 993 break; |
|
850
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
994 case StMXTRA: tMXtra_checkLineStatus(); |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
995 break; |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
996 default: |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
997 break; |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
998 } |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
999 } |
| 38 | 1000 |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1001 static void nextPage(void) |
| 38 | 1002 { |
| 1003 uint8_t page, line; | |
| 1004 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1005 SSettings* pSettings; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1006 pSettings = settingsGetPointer(); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1007 |
| 38 | 1008 menu.pageMemoryForNavigation += 1; |
| 1009 | |
| 1010 findValidPosition(&page, &line); | |
| 1011 menu.pageMemoryForNavigation = page; | |
| 1012 /* new test for 3button design */ | |
| 1013 //menu.lineMemoryForNavigationForPage[page] = line; | |
| 1014 menu.lineMemoryForNavigationForPage[page] = 0; | |
| 1015 menu.modeFlipPages = 1; | |
| 1016 | |
| 1017 set_globalState_Menu_Page(page); | |
| 1018 | |
|
850
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
1019 checkLineStatus(); /* some lines may be enabled / disabled depending on condition occuring outside the page scope => check if update is necessary */ |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
1020 |
| 38 | 1021 change_CLUT_entry(CLUT_MenuLineSelectedSides, (CLUT_MenuPageGasOC + page - 1)); |
| 1022 change_CLUT_entry(CLUT_MenuLineSelectedSeperator, (CLUT_MenuPageGasOC + page - 1)); | |
| 1023 | |
| 1024 GFX_SetFrameTop(menu.StartAddressForPage[page]); | |
| 1025 /* new test for 3button design */ | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1026 //GFX_SetFrameBottom((.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1027 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1028 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1029 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 25, 800, 390); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1030 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1031 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1032 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1033 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 65, 800, 390); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1034 } |
| 38 | 1035 } |
| 1036 | |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1037 void selectPage(uint32_t selection) |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1038 { |
| 650 | 1039 uint8_t page; |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1040 SStateList idList; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1041 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1042 SSettings* pSettings; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1043 pSettings = settingsGetPointer(); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1044 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1045 // menu.pageMemoryForNavigation = selection; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1046 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1047 // findValidPosition(&page, &line); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1048 if(selection > MAXPAGES) /* selection via structure */ |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1049 { |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1050 get_idSpecificStateList(selection, &idList); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1051 page = idList.page; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1052 } |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1053 else |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1054 { |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1055 page = selection; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1056 } |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1057 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1058 if(menu.shadowPage[page]) /* backup base page in case a shadow was selected */ |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1059 { |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1060 menu.activeShadow = menu.pageMemoryForNavigation; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1061 } |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1062 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1063 menu.pageMemoryForNavigation = page; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1064 /* new test for 3button design */ |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1065 //menu.lineMemoryForNavigationForPage[page] = line; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1066 menu.lineMemoryForNavigationForPage[page] = 0; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1067 menu.modeFlipPages = 1; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1068 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1069 set_globalState_Menu_Page(page); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1070 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1071 change_CLUT_entry(CLUT_MenuLineSelectedSides, (CLUT_MenuPageGasOC + page - 1)); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1072 change_CLUT_entry(CLUT_MenuLineSelectedSeperator, (CLUT_MenuPageGasOC + page - 1)); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1073 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1074 GFX_SetFrameTop(menu.StartAddressForPage[page]); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1075 /* new test for 3button design */ |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1076 //GFX_SetFrameBottom((.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1077 if(!pSettings->FlipDisplay) |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1078 { |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1079 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 25, 800, 390); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1080 } |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1081 else |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1082 { |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1083 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 65, 800, 390); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1084 } |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1085 nextLine(); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1086 } |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1087 |
| 38 | 1088 |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1089 static void nextLine(void) |
| 38 | 1090 { |
| 1091 uint8_t page, line; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1092 SSettings* pSettings; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1093 pSettings = settingsGetPointer(); |
| 38 | 1094 |
| 1095 page = menu.pageMemoryForNavigation; | |
| 1096 menu.lineMemoryForNavigationForPage[page] += 1; | |
| 1097 | |
| 1098 findValidPosition(&page, &line); | |
| 1099 menu.lineMemoryForNavigationForPage[page] = line; | |
| 1100 | |
| 1101 /* new test for 3button design */ | |
| 1102 menu.modeFlipPages = 0; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1103 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1104 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1105 GFX_SetFrameBottom((tMdesignCursor.FBStartAdress) + 65*2*(line - 1), 0, 25, 800, 390); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1106 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1107 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1108 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1109 GFX_SetFrameBottom((tMdesignCursor.FBStartAdress)+ (390 - 65 *(line)) *2, 0, 480-390-KEY_LABEL_HIGH, 800, 390); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1110 } |
| 38 | 1111 } |
| 1112 | |
| 1113 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1114 static void stepBackMenu(void) |
| 38 | 1115 { |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1116 if(menu.activeShadow) /* restore base page */ |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1117 { |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1118 selectPage(menu.activeShadow); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1119 menu.activeShadow = 0; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1120 } |
| 38 | 1121 if(menu.modeFlipPages == 0) |
| 1122 { | |
| 1123 menu.lineMemoryForNavigationForPage[menu.pageMemoryForNavigation] = 0; | |
| 1124 menu.modeFlipPages = 1; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1125 if(!settingsGetPointer()->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1126 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1127 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 25, 800, 390); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1128 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1129 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1130 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1131 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 480-390-KEY_LABEL_HIGH, 800, 390); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1132 } |
| 38 | 1133 } |
| 1134 else | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1135 { |
| 38 | 1136 exitMenu(); |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1137 } |
| 38 | 1138 } |
| 1139 | |
| 1140 | |
| 1141 void exitMenu(void) | |
| 1142 { | |
| 1143 set_globalState_tHome(); | |
| 1144 } | |
| 1145 | |
| 1146 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1147 static void stepForwardMenu(void) |
| 38 | 1148 { |
| 1149 if(menu.modeFlipPages == 1) | |
| 1150 { | |
| 1151 nextLine(); | |
| 1152 } | |
| 1153 else | |
| 1154 gotoMenuEdit(); | |
| 1155 } | |
| 1156 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1157 static void gotoMenuEdit(void) |
| 38 | 1158 { |
| 1159 uint8_t line; | |
| 1160 | |
| 1161 line = menu.lineMemoryForNavigationForPage[menu.pageMemoryForNavigation]; | |
| 1162 | |
| 1163 switch(get_globalState()) | |
| 1164 { | |
| 1165 case StMOG: | |
| 1166 openEdit_GasOC(line); | |
| 1167 break; | |
| 1168 case StMCG: | |
| 1169 openEdit_GasCC(line); | |
| 1170 break; | |
| 1171 case StMSP: | |
| 1172 openEdit_Setpoint(line); | |
| 1173 break; | |
| 1174 case StMXTRA: | |
| 1175 openEdit_Xtra(line); | |
| 1176 break; | |
| 1177 case StMDECO: | |
| 1178 openEdit_Deco(line); | |
| 1179 break; | |
| 1180 case StMDECOP: | |
| 1181 openEdit_DecoParameter(line); | |
| 1182 break; | |
| 1183 case StMPLAN: | |
| 1184 openEdit_Planner(line); | |
| 1185 break; | |
| 1186 case StMHARD: | |
| 1187 openEdit_Hardware(line); | |
| 1188 break; | |
| 1189 case StMSYS: | |
| 1190 openEdit_System(line); | |
| 1191 break; | |
| 507 | 1192 case StMCustom: |
| 1193 openEdit_Custom(line); | |
| 1194 break; | |
| 999 | 1195 case StMOption: |
| 1196 openEdit_CvOption(line); | |
| 1197 break; | |
| 38 | 1198 default: |
| 1199 break; | |
| 1200 } | |
| 1201 } | |
| 1202 | |
| 1203 | |
| 1204 void sendActionToMenu(uint8_t sendAction) | |
| 1205 { | |
| 1206 switch(sendAction) | |
| 1207 { | |
| 1208 case ACTION_BUTTON_ENTER: | |
| 1209 stepForwardMenu(); | |
| 1210 break; | |
| 1211 case ACTION_BUTTON_NEXT: | |
| 1212 if(menu.modeFlipPages) | |
| 1213 nextPage(); | |
| 1214 else | |
| 1215 nextLine(); | |
| 1216 break; | |
| 1217 case ACTION_TIMEOUT: | |
| 1218 case ACTION_MODE_CHANGE: | |
| 1219 case ACTION_BUTTON_BACK: | |
| 1220 /* new test for 3button design */ | |
| 1221 stepBackMenu(); | |
| 1222 break; | |
| 1223 default: | |
| 1224 break; | |
| 1225 case ACTION_IDLE_TICK: | |
| 1226 case ACTION_IDLE_SECOND: | |
| 1227 break; | |
| 1228 } | |
| 1229 /* tMC_OC_Gas(StMOG1, pSettings); */ | |
| 1230 } | |
| 1231 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1232 static void tMenu_write(uint8_t page, char *text, char *subtext) |
| 38 | 1233 { |
| 1234 if(page > MAXPAGES) | |
| 1235 return; | |
| 1236 if(menu.linesAvailableForPage[page] == 0) | |
| 1237 return; | |
| 1238 | |
| 1239 tMscreen.FBStartAdress = menu.StartAddressForPage[page]; | |
| 1240 GFX_write_string(&FontT48, &tMwindow, text,1); | |
| 1241 if((*subtext) && (menu.linesAvailableForPage[page] < 6)) | |
| 1242 { | |
| 1243 GFX_write_string(&FontT42, &tMwindow, subtext, (menu.linesAvailableForPage[page] + 1)); | |
| 1244 } | |
| 1245 } | |
| 1246 | |
| 1247 | |
| 1248 /* Private functions ---------------------------------------------------------*/ | |
| 1249 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1250 static void draw_tMdesignSubUnselected(uint32_t *ppDestination) |
| 38 | 1251 { |
| 1252 union al88_u | |
| 1253 { | |
| 1254 uint8_t al8[2]; | |
| 1255 uint16_t al88; | |
| 1256 }; | |
| 1257 | |
|
130
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
122
diff
changeset
|
1258 uint16_t* prunning = (uint16_t*)*ppDestination; |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1259 |
| 38 | 1260 union al88_u color_seperator; |
| 1261 union al88_u color_unselected; | |
| 1262 int i; | |
| 1263 | |
| 1264 color_seperator.al8[0] = CLUT_MenuLineUnselectedSeperator; | |
| 1265 color_unselected.al8[0] = CLUT_MenuLineUnselected; | |
| 1266 | |
| 1267 color_seperator.al8[1] = 0xFF; | |
| 1268 color_unselected.al8[1] = 0xFF; | |
| 1269 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1270 *(__IO uint16_t*)prunning++ = color_seperator.al88; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1271 *(__IO uint16_t*)prunning++ = color_seperator.al88; |
| 38 | 1272 |
| 1273 for(i = 61; i > 0; i--) | |
| 1274 { | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1275 *(__IO uint16_t*)prunning++ = color_unselected.al88; |
| 38 | 1276 } |
| 1277 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1278 *(__IO uint16_t*)prunning++ = color_seperator.al88; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1279 *(__IO uint16_t*)prunning++ = color_seperator.al88; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1280 |
|
130
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
122
diff
changeset
|
1281 *ppDestination = (uint32_t)prunning; |
| 38 | 1282 } |
| 1283 | |
| 1284 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1285 static void draw_tMdesignSubSelected(uint32_t *ppDestination) |
| 38 | 1286 { |
| 1287 union al88_u | |
| 1288 { | |
| 1289 uint8_t al8[2]; | |
| 1290 uint16_t al88; | |
| 1291 }; | |
| 1292 | |
| 1293 union al88_u color_selected; | |
| 1294 union al88_u color_seperator; | |
| 1295 int i; | |
| 1296 | |
| 1297 color_selected.al8[0] = CLUT_MenuLineSelected; | |
| 1298 color_selected.al8[1] = 0xFF; | |
| 1299 | |
| 1300 color_seperator.al8[0] = CLUT_MenuLineSelectedSeperator; | |
| 1301 color_seperator.al8[1] = 0xFF; | |
| 1302 | |
| 1303 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
| 1304 *ppDestination += 2; | |
| 1305 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
| 1306 *ppDestination += 2; | |
| 1307 | |
| 1308 for(i = 61; i > 0; i--) | |
| 1309 { | |
| 1310 *(__IO uint16_t*)*ppDestination = color_selected.al88; | |
| 1311 *ppDestination += 2; | |
| 1312 } | |
| 1313 | |
| 1314 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
| 1315 *ppDestination += 2; | |
| 1316 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
| 1317 *ppDestination += 2; | |
| 1318 } | |
| 1319 | |
| 1320 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1321 static void draw_tMdesignSubSelectedBorder(uint32_t *ppDestination) |
| 38 | 1322 { |
| 1323 union al88_u | |
| 1324 { | |
| 1325 uint8_t al8[2]; | |
| 1326 uint16_t al88; | |
| 1327 }; | |
| 1328 | |
| 1329 union al88_u color_selected_sides; | |
| 1330 | |
| 1331 int i; | |
| 1332 | |
| 1333 color_selected_sides.al8[0] = CLUT_MenuLineSelectedSides; | |
| 1334 color_selected_sides.al8[1] = 0xFF; | |
| 1335 | |
| 1336 for(i = 65; i > 0; i--) | |
| 1337 { | |
| 1338 *(__IO uint16_t*)*ppDestination = color_selected_sides.al88; | |
| 1339 *ppDestination += 2; | |
| 1340 } | |
| 1341 } | |
| 1342 | |
| 1343 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1344 static void draw_tMcursorDesign(void) |
| 38 | 1345 { |
| 1346 int i,j; | |
| 1347 uint32_t pDestination; | |
| 1348 | |
| 1349 pDestination = tMdesignCursor.FBStartAdress; | |
| 1350 | |
| 1351 for(j = 801; j > 0; j--) | |
| 1352 { | |
| 1353 for(i = 5; i > 0; i--) | |
| 1354 { | |
| 1355 draw_tMdesignSubUnselected(&pDestination); | |
| 1356 } | |
| 1357 if((j > 787) || (j < 17)) | |
| 1358 draw_tMdesignSubSelectedBorder(&pDestination); | |
| 1359 else | |
| 1360 draw_tMdesignSubSelected(&pDestination); | |
| 1361 } | |
| 1362 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1363 /* Draw menu background boxes which are visible if nothing is selected */ |
| 38 | 1364 pDestination = tMdesignSolo.FBStartAdress; |
| 1365 | |
| 1366 for(j = 801; j > 0; j--) | |
| 1367 { | |
| 1368 for(i = 6; i > 0; i--) | |
| 1369 { | |
| 1370 draw_tMdesignSubUnselected(&pDestination); | |
| 1371 } | |
| 1372 } | |
| 1373 } | |
| 1374 | |
| 1375 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1376 static void draw_tMheader(uint8_t page) |
| 38 | 1377 { |
| 1378 union al88_u | |
| 1379 { | |
| 1380 uint8_t al8[2]; | |
| 1381 uint16_t al88; | |
| 1382 }; | |
| 1383 union al88_u color_top; | |
| 1384 int i,j, k, k4text; | |
| 1385 uint32_t pBackup; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1386 uint16_t* pDestination; |
| 38 | 1387 uint8_t colorText; |
| 1388 uint16_t positionText; | |
| 1389 uint8_t pageText; | |
| 1390 | |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1391 char text8max[MAXPAGES+1][8] = |
| 38 | 1392 { "", |
| 1393 "OC", | |
| 1394 "CC", | |
| 999 | 1395 "", |
| 38 | 1396 "DATA", |
| 1397 "DECO", | |
| 1398 "", | |
| 1399 "SYS", | |
| 1400 "", | |
| 507 | 1401 "", |
| 999 | 1402 "", |
| 1041 | 1403 "SIM", |
| 1404 "" | |
| 38 | 1405 }; |
| 1406 | |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1407 _Bool spacing[MAXPAGES+1] = |
| 38 | 1408 { 0, |
| 999 | 1409 1, // behind OC |
| 38 | 1410 0, // behind CC |
| 1411 1, // behind SP | |
| 1412 1, // behind DATA | |
| 1413 0, // behind DECO1 | |
| 1414 1, // behind DECO2 | |
| 1415 0, // behind SYS1 | |
| 507 | 1416 0, // behind SYS2 |
| 999 | 1417 0, // behind SYS3 |
| 1418 1, // behind SYS4 | |
| 38 | 1419 1, // behind SIM |
| 1420 0 | |
| 1421 }; | |
| 1422 | |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1423 if(actual_menu_content == MENU_SURFACE) |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1424 { |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1425 spacing[3] = 0; /* Display extra menu directly after setpoint */ |
| 999 | 1426 memset(text8max[4],0,8); |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1427 } |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1428 |
| 38 | 1429 pBackup = tMscreen.FBStartAdress; |
| 1430 tMscreen.FBStartAdress = menu.StartAddressForPage[page]; | |
|
130
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
122
diff
changeset
|
1431 pDestination = (uint16_t*) menu.StartAddressForPage[page]; |
| 38 | 1432 positionText = 10; |
| 1433 pageText = page; | |
| 1434 | |
| 1435 gfx_write_page_number(&tMscreen ,menu.pageCountNumber[page],menu.pageCountTotal,0); | |
| 1436 | |
| 1041 | 1437 /* Find the matching master text if a tab has no direct name e.g. SYS subtabs */ |
| 38 | 1438 while((text8max[pageText][0] == 0) && (pageText > 1)) |
| 1439 { | |
| 1440 pageText--; | |
| 1441 } | |
| 1442 | |
| 1443 for(k = 1; k <= MAXPAGES; k++) | |
| 1444 { | |
| 1445 if(menu.pageCountNumber[k] != 0) | |
| 1446 { | |
| 1447 k4text = k; // new hw 170522 | |
| 1448 if((text8max[k][0] == 0) && (menu.pageCountNumber[k-1] == 0)) | |
| 1449 k4text = k-1; | |
| 1450 | |
| 1451 color_top.al8[0] = CLUT_MenuPageGasOC + k - 1; | |
|
169
842f57bbaaad
Bugfix: highlight the menu underline correctly on selected state
Jan Mulder <jlmulder@xs4all.nl>
parents:
167
diff
changeset
|
1452 if (k == page) |
| 38 | 1453 { |
| 1454 color_top.al8[1] = 0xFF; | |
| 1455 } | |
| 1456 else | |
| 1457 { | |
| 1458 color_top.al8[1] = 0x50; | |
| 1459 } | |
| 1460 | |
| 1461 if(k4text == pageText) | |
| 1462 { | |
| 1463 colorText = CLUT_Font020; | |
| 1464 } | |
| 1465 else | |
| 1466 { | |
| 1467 colorText = CLUT_Font021; | |
| 1468 } | |
| 1469 | |
| 1470 write_content_simple(&tMscreen,positionText,775,0,&FontT42,text8max[k4text],colorText); | |
| 1471 /* | |
| 1472 write_content_simple(&tMscreen,positionText,775,0,&FontT42,text8max[k],colorText); | |
| 1473 if((text8max[k][0] == 0) && (menu.pageCountNumber[k-1] == 0)) | |
| 1474 write_content_simple(&tMscreen,positionText,775,0,&FontT42,text8max[k-1],colorText); | |
| 1475 */ | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1476 /* Draw color bars */ |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1477 if(!settingsGetPointer()->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1478 { |
| 999 | 1479 pDestination += TAB_BAR_SPACING * 480; |
| 38 | 1480 |
| 999 | 1481 for(j = TAB_BAR_WIDTH; j > 0; j--) |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1482 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1483 pDestination += (390 + 26); |
| 38 | 1484 |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1485 for(i = 16; i > 0; i--) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1486 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1487 *(__IO uint16_t*)pDestination++ = color_top.al88; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1488 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1489 pDestination += 48; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1490 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1491 |
| 999 | 1492 pDestination += TAB_BAR_SPACING * 480; |
| 1493 positionText += TAB_BAR_WIDTH + 2* TAB_BAR_SPACING; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1494 |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1495 if(((k == 4) && (actual_menu_content != MENU_SURFACE)) || ((k == 6) && (menu.pageCountNumber[5] == 0))) |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1496 { |
| 999 | 1497 pDestination += (TAB_BAR_WIDTH + 2* TAB_BAR_SPACING) * 480; |
| 1498 positionText += TAB_BAR_WIDTH + 2* TAB_BAR_SPACING; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1499 } |
| 38 | 1500 |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1501 if(spacing[k]) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1502 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1503 pDestination += 35 * 480; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1504 positionText += 35; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1505 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1506 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1507 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1508 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1509 pDestination += (800 - 5)* 480; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1510 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1511 for(j = 60; j > 0; j--) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1512 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1513 pDestination -= (390 + 26); |
| 38 | 1514 |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1515 for(i = 16; i > 0; i--) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1516 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1517 *(__IO uint16_t*)pDestination-- = color_top.al88; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1518 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1519 pDestination -= 48; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1520 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1521 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1522 pDestination -= (800) * 480; |
| 824 | 1523 positionText += 66; |
| 38 | 1524 |
|
658
4df22790dc0c
Bugfix handling of new menu tab in flipped mode:
Ideenmodellierer
parents:
650
diff
changeset
|
1525 if(((k == 4) && (actual_menu_content != MENU_SURFACE)) || ((k == 6) && (menu.pageCountNumber[5] == 0))) |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1526 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1527 pDestination -= 70 * 480; |
| 824 | 1528 positionText += 66; |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1529 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1530 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1531 if(spacing[k]) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1532 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1533 pDestination -= 35 * 480; |
| 824 | 1534 positionText += 31; |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1535 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1536 } |
| 38 | 1537 } |
| 1538 } | |
| 1539 tMscreen.FBStartAdress = pBackup; | |
| 1540 } | |
|
774
6169309d6eb9
more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
1541 |
|
6169309d6eb9
more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
1542 |
|
6169309d6eb9
more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
1543 char *makeGrey(bool isGrey) |
|
6169309d6eb9
more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
1544 { |
|
6169309d6eb9
more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
1545 return isGrey ? "\031" : ""; |
|
6169309d6eb9
more menu items for the compass menu: Delete bearing, and reset to land based bearing. I have also re-enabled the real time bearing display in the menu - makes it easier to set the correct bearing. (mikeller)
heinrichsweikamp
parents:
662
diff
changeset
|
1546 } |
|
1018
808153ba3fec
Disable the menu items for editing scrubber timer parameters if an
heinrichsweikamp
parents:
1001
diff
changeset
|
1547 |
|
808153ba3fec
Disable the menu items for editing scrubber timer parameters if an
heinrichsweikamp
parents:
1001
diff
changeset
|
1548 |
|
808153ba3fec
Disable the menu items for editing scrubber timer parameters if an
heinrichsweikamp
parents:
1001
diff
changeset
|
1549 char printCheckbox(bool isChecked) |
|
808153ba3fec
Disable the menu items for editing scrubber timer parameters if an
heinrichsweikamp
parents:
1001
diff
changeset
|
1550 { |
|
808153ba3fec
Disable the menu items for editing scrubber timer parameters if an
heinrichsweikamp
parents:
1001
diff
changeset
|
1551 return isChecked ? '\005' : '\006'; |
|
808153ba3fec
Disable the menu items for editing scrubber timer parameters if an
heinrichsweikamp
parents:
1001
diff
changeset
|
1552 } |
