Mercurial > public > ostc4
annotate Discovery/Src/tMenu.c @ 1053:36fa1c44e597 Icon_Integration
Added upload command for icon:
It is now possible to upload a custom icon which is shown during startup and while writing settings (instead of the HW string). The icons are limited to 256 colors and 800x480 pixels. The icon may not be larger than 200kByte because of storage avability. For upload the same CRC functions as for the common firmware updates are in use,
| author | Ideenmodellierer |
|---|---|
| date | Wed, 31 Dec 2025 17:49:05 +0100 |
| parents | 93c98a28406c |
| 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" |
| 999 | 45 #include "tMenuEditCvOption.h" |
| 38 | 46 #include "tMenuGas.h" |
| 47 #include "tMenuHardware.h" | |
| 48 #include "tMenuPlanner.h" | |
| 49 #include "tMenuSetpoint.h" | |
| 50 #include "tMenuSystem.h" | |
| 51 #include "tMenuXtra.h" | |
| 507 | 52 #include "tMenuCustom.h" |
| 1053 | 53 #include "tStructure.h" |
| 38 | 54 |
| 55 /* Private types -------------------------------------------------------------*/ | |
| 999 | 56 #define MAXPAGES 12 |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
57 #define CURSOR_HIGH 25 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
58 #define TAB_HEADER_HIGH 25 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
59 #define TAB_BAR_HIGH 5 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
60 #define MENU_WDW_HIGH 390 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
61 #define KEY_LABEL_HIGH 25 /* Height of the label used for the the user keys */ |
| 38 | 62 |
| 999 | 63 #define TAB_BAR_WIDTH 50 |
| 64 #define TAB_BAR_SPACING 5 | |
| 65 | |
| 662 | 66 #define SLOW_UPDATE_CNT 10 /* Some content shall not be update in short intervals => add prescalar */ |
|
811
4c41d9a18c7f
Added function to skip lines which are not needed for operation:
Ideenmodellierer
parents:
788
diff
changeset
|
67 #define MAXLINES 6 |
| 662 | 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 |
| 659 id = tMCvOption_refresh(0, text, &tabPosition, subtext); | |
| 660 tM_build_page(id, text, tabPosition, subtext); | |
| 38 | 661 } |
| 662 | |
| 663 | |
| 664 void tM_refresh_live_content(void) | |
| 665 { | |
| 662 | 666 static uint8_t slowUpdate = SLOW_UPDATE_CNT; |
|
51
8f8ea3a32e82
Resolved warnings pointing to possible invalid memory access
Ideenmodellierer
parents:
38
diff
changeset
|
667 uint8_t page = 0; |
| 38 | 668 char text[MAX_PAGE_TEXTSIZE]; |
| 669 char subtext[MAX_PAGE_TEXTSIZE]; | |
| 670 uint16_t tabPosition; | |
| 671 | |
| 662 | 672 uint32_t globalState = get_globalState(); |
| 673 | |
| 674 slowUpdate--; | |
| 675 page = menu.pageMemoryForNavigation; | |
| 676 switch(globalState) | |
| 38 | 677 { |
| 662 | 678 case StMSYS: if(actual_menu_content == MENU_SURFACE) |
| 679 { | |
| 680 tMSystem_refresh(0, text, &tabPosition, subtext); | |
| 681 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 682 } | |
| 683 break; | |
| 684 case StMHARD: tMHardware_refresh(0, text, &tabPosition, subtext); | |
| 685 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 686 break; | |
| 687 case StMOG: if((actual_menu_content != MENU_SURFACE) && (slowUpdate == 0)) | |
| 688 { | |
| 689 tMOG_refresh(0, text, &tabPosition, subtext); | |
| 690 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 691 } | |
| 692 break; | |
| 693 case StMCG: if((actual_menu_content != MENU_SURFACE) && (slowUpdate == 0)) | |
| 694 { | |
| 695 tMCG_refresh(0, text, &tabPosition, subtext); | |
| 696 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 697 } | |
| 698 break; | |
| 699 default: | |
| 700 break; | |
| 38 | 701 } |
| 662 | 702 if(slowUpdate == 0) |
| 38 | 703 { |
| 662 | 704 slowUpdate = SLOW_UPDATE_CNT; |
| 38 | 705 } |
| 706 | |
| 707 tMscreen.FBStartAdress = menu.StartAddressForPage[page]; | |
| 708 tHome_show_lost_connection_count(&tMscreen); | |
| 709 /* | |
| 710 SStateList idList; | |
| 711 if(actual_menu_content == MENU_SURFACE) | |
| 712 { | |
| 713 page = menu.pageMemoryForNavigation; | |
| 714 get_idSpecificStateList(StMSYS, &idList); | |
| 715 if(page == idList.page) | |
| 716 { | |
| 717 tMSystem_refresh(0, text, &tabPosition, subtext); | |
| 718 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 719 } | |
| 720 } | |
| 721 */ | |
| 722 } | |
| 723 | |
| 724 | |
| 725 /* new frame only! */ | |
| 726 void updateSpecificMenu(uint32_t id) | |
| 727 { | |
| 728 uint8_t page; | |
| 729 SStateList idList; | |
| 730 | |
| 731 char text[MAX_PAGE_TEXTSIZE]; | |
| 732 char subtext[MAX_PAGE_TEXTSIZE]; | |
| 733 uint16_t tabPosition; | |
| 734 | |
| 735 *subtext = 0; | |
| 736 *text = 0; | |
| 737 tabPosition = 400; | |
| 738 | |
| 739 get_idSpecificStateList(id, &idList); | |
| 740 page = idList.page; | |
| 741 | |
| 742 switch(id) | |
| 743 { | |
| 744 case StMOG: | |
| 745 tMOG_refresh(0, text, &tabPosition, subtext); | |
| 746 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 747 break; | |
| 748 case StMCG: | |
| 749 tMCG_refresh(0, text, &tabPosition, subtext); | |
| 750 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 751 break; | |
| 752 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
|
753 tMSP_refresh(text, &tabPosition, subtext); |
| 38 | 754 update_content_with_new_frame(page, text, tabPosition, subtext); |
| 755 break; | |
|
815
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
756 case StMSYS: |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
757 tMSystem_refresh(0, text, &tabPosition, NULL); |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
758 update_content_with_new_frame(page, text, tabPosition, subtext); |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
759 break; |
|
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
811
diff
changeset
|
760 |
| 38 | 761 default: |
| 762 break; | |
| 763 } | |
| 764 } | |
| 765 | |
| 766 | |
| 767 void updateMenu(void) | |
| 768 { | |
| 769 uint8_t page, line; | |
| 770 | |
| 771 char text[MAX_PAGE_TEXTSIZE]; | |
| 772 char subtext[MAX_PAGE_TEXTSIZE]; | |
| 773 uint16_t tabPosition; | |
| 774 | |
| 775 *subtext = 0; | |
| 776 *text = 0; | |
| 777 tabPosition = 400; | |
| 778 | |
| 779 page = menu.pageMemoryForNavigation; | |
| 780 line = menu.lineMemoryForNavigationForPage[page]; | |
| 781 | |
| 782 switch(get_globalState()) | |
| 783 { | |
| 784 case StMOG: | |
| 785 tMOG_refresh(0, text, &tabPosition, subtext); | |
| 786 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 787 break; | |
| 788 case StMCG: | |
| 789 tMCG_refresh(0, text, &tabPosition, subtext); | |
| 790 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 791 break; | |
| 792 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
|
793 tMSP_refresh(text, &tabPosition, subtext); |
| 38 | 794 update_content_with_new_frame(page, text, tabPosition, subtext); |
| 795 break; | |
| 796 case StMXTRA: | |
| 797 tMXtra_refresh(0, text, &tabPosition, subtext); | |
| 798 update_content_with_new_frame(page, text, tabPosition, subtext); | |
| 799 break; | |
| 800 case StMDECO: | |
|
1028
3d9552e4997c
Code improvment: line <=> menu id function:
Ideenmodellierer
parents:
1018
diff
changeset
|
801 if((line == get_lineOfID(StMDECO1_OC)) || (line == get_lineOfID(StMDECO3_PPO2Max))) // dive mode or ppO2 limits (the later for correct MOD in gaslists) |
| 38 | 802 { |
| 803 tM_rebuild_pages(); | |
| 804 menu.lineMemoryForNavigationForPage[page] = line; // fix 160623 | |
| 805 GFX_SetFrameTop(menu.StartAddressForPage[page]); | |
| 806 } | |
| 807 else | |
| 808 { | |
| 809 tMDeco_refresh(line, text, &tabPosition, subtext); | |
| 810 clean_line_actual_page(); | |
| 811 update_content_actual_page(text, tabPosition, subtext); | |
| 812 } | |
| 813 break; | |
| 814 case StMDECOP: | |
| 815 tMDecoParameters_refresh(line, text, &tabPosition, subtext); | |
| 816 clean_line_actual_page(); | |
| 817 update_content_actual_page(text, tabPosition, subtext); | |
| 818 break; | |
| 819 case StMPLAN: | |
| 820 tMPlanner_refresh(line, text, &tabPosition, subtext); | |
| 821 clean_line_actual_page(); | |
| 822 update_content_actual_page(text, tabPosition, subtext); | |
| 823 break; | |
| 824 case StMHARD: | |
| 825 tMHardware_refresh(line, text, &tabPosition, subtext); | |
| 826 clean_line_actual_page(); | |
| 827 update_content_actual_page(text, tabPosition, subtext); | |
| 828 break; | |
| 829 case StMSYS: | |
|
1037
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1028
diff
changeset
|
830 if((line == get_lineOfID(StMSYS1_DateTime)) || (line == get_lineOfID(StMSYS2_English)) |
|
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1028
diff
changeset
|
831 #ifdef ENABLE_SETTING_PROFILES |
|
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1028
diff
changeset
|
832 || (line == get_lineOfID(StMSYS_Profile))) |
|
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1028
diff
changeset
|
833 #else |
|
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1028
diff
changeset
|
834 ) |
|
2af07aa38531
Merge with external development branches:
Ideenmodellierer
parents:
1028
diff
changeset
|
835 #endif |
| 38 | 836 { |
| 837 tM_rebuild_pages(); | |
| 838 menu.lineMemoryForNavigationForPage[page] = line; // fix 160623 | |
| 839 GFX_SetFrameTop(menu.StartAddressForPage[page]); | |
| 840 menu.lineMemoryForNavigationForPage[page] = line; | |
| 841 } | |
| 842 else | |
| 843 { | |
| 844 tMSystem_refresh(line, text, &tabPosition, subtext); | |
| 845 clean_line_actual_page(); | |
| 846 update_content_actual_page(text, tabPosition, subtext); | |
| 847 } | |
| 848 break; | |
| 507 | 849 case StMCustom: |
| 850 tMCustom_refresh(line, text, &tabPosition, subtext); | |
| 851 clean_line_actual_page(); | |
| 852 update_content_actual_page(text, tabPosition, subtext); | |
| 853 break; | |
|
1001
21142f4fa968
Cleanup menu structucture afer menu shift:
Ideenmodellierer
parents:
999
diff
changeset
|
854 case StMOption: |
|
21142f4fa968
Cleanup menu structucture afer menu shift:
Ideenmodellierer
parents:
999
diff
changeset
|
855 tMCvOption_refresh(line, text, &tabPosition, subtext); |
|
21142f4fa968
Cleanup menu structucture afer menu shift:
Ideenmodellierer
parents:
999
diff
changeset
|
856 clean_line_actual_page(); |
|
21142f4fa968
Cleanup menu structucture afer menu shift:
Ideenmodellierer
parents:
999
diff
changeset
|
857 update_content_actual_page(text, tabPosition, subtext); |
|
21142f4fa968
Cleanup menu structucture afer menu shift:
Ideenmodellierer
parents:
999
diff
changeset
|
858 break; |
| 38 | 859 default: |
| 860 break; | |
| 861 } | |
| 862 } | |
| 863 | |
| 864 void openMenu_first_page_with_OC_gas_update(void) | |
| 865 { | |
| 866 menu.pageMemoryForNavigation = 1; | |
| 867 for(int i=0;i<=MAXPAGES;i++) | |
| 868 menu.lineMemoryForNavigationForPage[i] = 0; | |
| 869 | |
| 870 set_globalState(StMOG); | |
| 871 updateMenu(); | |
| 872 openMenu(1); | |
| 873 } | |
| 874 | |
| 875 | |
| 876 void openMenu(uint8_t freshWithFlipPages) | |
| 877 { | |
| 878 uint8_t page, line; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
879 SSettings* pSettings; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
880 pSettings = settingsGetPointer(); |
| 38 | 881 |
| 882 findValidPosition(&page, &line); | |
| 883 if((page == 0) || (line == 0)) | |
| 884 return; | |
| 885 | |
| 996 | 886 if( getBuzzerActivationRequest() != REQUEST_BUZZER_ONCE) |
| 887 { | |
| 888 requestBuzzerActivation(REQUEST_BUZZER_OFF); | |
| 889 } | |
| 951 | 890 |
| 38 | 891 menu.pageMemoryForNavigation = page; |
| 892 /* new test for 3button design */ | |
| 893 if(freshWithFlipPages) | |
| 894 { | |
| 895 menu.lineMemoryForNavigationForPage[page] = 0; | |
| 896 menu.modeFlipPages = 1; | |
| 897 } | |
| 898 else | |
| 899 { | |
| 900 menu.lineMemoryForNavigationForPage[page] = line; | |
| 901 menu.modeFlipPages = 0; | |
| 902 } | |
| 903 | |
| 904 set_globalState_Menu_Page(page); | |
| 905 | |
| 906 | |
| 907 change_CLUT_entry(CLUT_MenuLineSelectedSides, (CLUT_MenuPageGasOC + page - 1)); | |
| 908 change_CLUT_entry(CLUT_MenuLineSelectedSeperator, (CLUT_MenuPageGasOC + page - 1)); | |
| 909 | |
| 910 | |
| 911 if(((page == 6) || (page == 8)) && (menu.pageCountNumber[page-1] == 0)) | |
| 912 { | |
| 913 change_CLUT_entry(CLUT_MenuLineSelectedSides, (CLUT_MenuPageGasOC + page - 2)); | |
| 914 change_CLUT_entry(CLUT_MenuLineSelectedSeperator, (CLUT_MenuPageGasOC + page - 2)); | |
| 915 | |
| 916 } | |
| 917 | |
| 918 GFX_SetFrameTop(menu.StartAddressForPage[page]); | |
| 919 /* new test for 3button design */ | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
920 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
921 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
922 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
923 if(freshWithFlipPages) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
924 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 25, 800, 390); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
925 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
926 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
|
927 } |
| 38 | 928 else |
|
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(freshWithFlipPages) |
|
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 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
|
933 } |
|
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 + (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
|
936 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
937 |
| 38 | 938 } |
| 939 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
940 static void block_diluent_handler(_Bool Unblock) |
| 38 | 941 { |
| 942 SStateList list; | |
| 943 static uint8_t linesAvailableForPageDiluent = 0; | |
| 944 get_idSpecificStateList(StMCG, &list); | |
| 945 | |
| 946 if(Unblock && linesAvailableForPageDiluent) | |
| 947 { | |
| 948 menu.linesAvailableForPage[list.page] = linesAvailableForPageDiluent; | |
| 949 } | |
| 950 else | |
| 951 { | |
| 952 linesAvailableForPageDiluent = menu.linesAvailableForPage[list.page]; | |
| 953 menu.linesAvailableForPage[list.page] = 0; | |
| 954 } | |
| 955 } | |
| 956 | |
| 957 void block_diluent_page(void) | |
| 958 { | |
| 959 block_diluent_handler(0); | |
| 960 } | |
| 961 | |
| 962 | |
| 963 void unblock_diluent_page(void) | |
| 964 { | |
| 965 block_diluent_handler(1); | |
| 966 } | |
| 967 | |
|
850
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
968 static void checkLineStatus() |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
969 { |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
970 switch(get_globalState()) |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
971 { |
|
1001
21142f4fa968
Cleanup menu structucture afer menu shift:
Ideenmodellierer
parents:
999
diff
changeset
|
972 case StMOption: tMCvOption_checkLineStatus(); |
| 851 | 973 break; |
|
850
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
974 case StMXTRA: tMXtra_checkLineStatus(); |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
975 break; |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
976 default: |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
977 break; |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
978 } |
|
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
979 } |
| 38 | 980 |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
981 static void nextPage(void) |
| 38 | 982 { |
| 983 uint8_t page, line; | |
| 984 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
985 SSettings* pSettings; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
986 pSettings = settingsGetPointer(); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
987 |
| 38 | 988 menu.pageMemoryForNavigation += 1; |
| 989 | |
| 990 findValidPosition(&page, &line); | |
| 991 menu.pageMemoryForNavigation = page; | |
| 992 /* new test for 3button design */ | |
| 993 //menu.lineMemoryForNavigationForPage[page] = line; | |
| 994 menu.lineMemoryForNavigationForPage[page] = 0; | |
| 995 menu.modeFlipPages = 1; | |
| 996 | |
| 997 set_globalState_Menu_Page(page); | |
| 998 | |
|
850
bc2fcd002fc4
Check line enable/disable state when a new page is selected:
Ideenmodellierer
parents:
824
diff
changeset
|
999 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
|
1000 |
| 38 | 1001 change_CLUT_entry(CLUT_MenuLineSelectedSides, (CLUT_MenuPageGasOC + page - 1)); |
| 1002 change_CLUT_entry(CLUT_MenuLineSelectedSeperator, (CLUT_MenuPageGasOC + page - 1)); | |
| 1003 | |
| 1004 GFX_SetFrameTop(menu.StartAddressForPage[page]); | |
| 1005 /* new test for 3button design */ | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1006 //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
|
1007 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1008 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1009 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 25, 800, 390); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1010 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1011 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1012 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1013 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 65, 800, 390); |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1014 } |
| 38 | 1015 } |
| 1016 | |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1017 void selectPage(uint32_t selection) |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1018 { |
| 650 | 1019 uint8_t page; |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1020 SStateList idList; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1021 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1022 SSettings* pSettings; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1023 pSettings = settingsGetPointer(); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1024 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1025 // menu.pageMemoryForNavigation = selection; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1026 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1027 // findValidPosition(&page, &line); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1028 if(selection > MAXPAGES) /* selection via structure */ |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1029 { |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1030 get_idSpecificStateList(selection, &idList); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1031 page = idList.page; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1032 } |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1033 else |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1034 { |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1035 page = selection; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1036 } |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1037 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1038 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
|
1039 { |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1040 menu.activeShadow = menu.pageMemoryForNavigation; |
|
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 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1043 menu.pageMemoryForNavigation = page; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1044 /* new test for 3button design */ |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1045 //menu.lineMemoryForNavigationForPage[page] = line; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1046 menu.lineMemoryForNavigationForPage[page] = 0; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1047 menu.modeFlipPages = 1; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1048 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1049 set_globalState_Menu_Page(page); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1050 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1051 change_CLUT_entry(CLUT_MenuLineSelectedSides, (CLUT_MenuPageGasOC + page - 1)); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1052 change_CLUT_entry(CLUT_MenuLineSelectedSeperator, (CLUT_MenuPageGasOC + page - 1)); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1053 |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1054 GFX_SetFrameTop(menu.StartAddressForPage[page]); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1055 /* new test for 3button design */ |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1056 //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
|
1057 if(!pSettings->FlipDisplay) |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1058 { |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1059 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 25, 800, 390); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1060 } |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1061 else |
|
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 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 65, 800, 390); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1064 } |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1065 nextLine(); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1066 } |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1067 |
| 38 | 1068 |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1069 static void nextLine(void) |
| 38 | 1070 { |
| 1071 uint8_t page, line; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1072 SSettings* pSettings; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1073 pSettings = settingsGetPointer(); |
| 38 | 1074 |
| 1075 page = menu.pageMemoryForNavigation; | |
| 1076 menu.lineMemoryForNavigationForPage[page] += 1; | |
| 1077 | |
| 1078 findValidPosition(&page, &line); | |
| 1079 menu.lineMemoryForNavigationForPage[page] = line; | |
| 1080 | |
| 1081 /* new test for 3button design */ | |
| 1082 menu.modeFlipPages = 0; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1083 if(!pSettings->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1084 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1085 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
|
1086 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1087 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1088 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1089 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
|
1090 } |
| 38 | 1091 } |
| 1092 | |
| 1093 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1094 static void stepBackMenu(void) |
| 38 | 1095 { |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1096 if(menu.activeShadow) /* restore base page */ |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1097 { |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1098 selectPage(menu.activeShadow); |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1099 menu.activeShadow = 0; |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1100 } |
| 38 | 1101 if(menu.modeFlipPages == 0) |
| 1102 { | |
| 1103 menu.lineMemoryForNavigationForPage[menu.pageMemoryForNavigation] = 0; | |
| 1104 menu.modeFlipPages = 1; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1105 if(!settingsGetPointer()->FlipDisplay) |
|
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 GFX_SetFrameBottom(tMdesignSolo.FBStartAdress, 0, 25, 800, 390); |
|
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 else |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1110 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1111 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
|
1112 } |
| 38 | 1113 } |
| 1114 else | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1115 { |
| 38 | 1116 exitMenu(); |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1117 } |
| 38 | 1118 } |
| 1119 | |
| 1120 | |
| 1121 void exitMenu(void) | |
| 1122 { | |
| 1123 set_globalState_tHome(); | |
| 1124 } | |
| 1125 | |
| 1126 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1127 static void stepForwardMenu(void) |
| 38 | 1128 { |
| 1129 if(menu.modeFlipPages == 1) | |
| 1130 { | |
| 1131 nextLine(); | |
| 1132 } | |
| 1133 else | |
| 1134 gotoMenuEdit(); | |
| 1135 } | |
| 1136 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1137 static void gotoMenuEdit(void) |
| 38 | 1138 { |
| 1139 uint8_t line; | |
| 1140 | |
| 1141 line = menu.lineMemoryForNavigationForPage[menu.pageMemoryForNavigation]; | |
| 1142 | |
| 1143 switch(get_globalState()) | |
| 1144 { | |
| 1145 case StMOG: | |
| 1146 openEdit_GasOC(line); | |
| 1147 break; | |
| 1148 case StMCG: | |
| 1149 openEdit_GasCC(line); | |
| 1150 break; | |
| 1151 case StMSP: | |
| 1152 openEdit_Setpoint(line); | |
| 1153 break; | |
| 1154 case StMXTRA: | |
| 1155 openEdit_Xtra(line); | |
| 1156 break; | |
| 1157 case StMDECO: | |
| 1158 openEdit_Deco(line); | |
| 1159 break; | |
| 1160 case StMDECOP: | |
| 1161 openEdit_DecoParameter(line); | |
| 1162 break; | |
| 1163 case StMPLAN: | |
| 1164 openEdit_Planner(line); | |
| 1165 break; | |
| 1166 case StMHARD: | |
| 1167 openEdit_Hardware(line); | |
| 1168 break; | |
| 1169 case StMSYS: | |
| 1170 openEdit_System(line); | |
| 1171 break; | |
| 507 | 1172 case StMCustom: |
| 1173 openEdit_Custom(line); | |
| 1174 break; | |
| 999 | 1175 case StMOption: |
| 1176 openEdit_CvOption(line); | |
| 1177 break; | |
| 38 | 1178 default: |
| 1179 break; | |
| 1180 } | |
| 1181 } | |
| 1182 | |
| 1183 | |
| 1184 void sendActionToMenu(uint8_t sendAction) | |
| 1185 { | |
| 1186 switch(sendAction) | |
| 1187 { | |
| 1188 case ACTION_BUTTON_ENTER: | |
| 1189 stepForwardMenu(); | |
| 1190 break; | |
| 1191 case ACTION_BUTTON_NEXT: | |
| 1192 if(menu.modeFlipPages) | |
| 1193 nextPage(); | |
| 1194 else | |
| 1195 nextLine(); | |
| 1196 break; | |
| 1197 case ACTION_TIMEOUT: | |
| 1198 case ACTION_MODE_CHANGE: | |
| 1199 case ACTION_BUTTON_BACK: | |
| 1200 /* new test for 3button design */ | |
| 1201 stepBackMenu(); | |
| 1202 break; | |
| 1203 default: | |
| 1204 break; | |
| 1205 case ACTION_IDLE_TICK: | |
| 1206 case ACTION_IDLE_SECOND: | |
| 1207 break; | |
| 1208 } | |
| 1209 /* tMC_OC_Gas(StMOG1, pSettings); */ | |
| 1210 } | |
| 1211 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1212 static void tMenu_write(uint8_t page, char *text, char *subtext) |
| 38 | 1213 { |
| 1214 if(page > MAXPAGES) | |
| 1215 return; | |
| 1216 if(menu.linesAvailableForPage[page] == 0) | |
| 1217 return; | |
| 1218 | |
| 1219 tMscreen.FBStartAdress = menu.StartAddressForPage[page]; | |
| 1220 GFX_write_string(&FontT48, &tMwindow, text,1); | |
| 1221 if((*subtext) && (menu.linesAvailableForPage[page] < 6)) | |
| 1222 { | |
| 1223 GFX_write_string(&FontT42, &tMwindow, subtext, (menu.linesAvailableForPage[page] + 1)); | |
| 1224 } | |
| 1225 } | |
| 1226 | |
| 1227 | |
| 1228 /* Private functions ---------------------------------------------------------*/ | |
| 1229 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1230 static void draw_tMdesignSubUnselected(uint32_t *ppDestination) |
| 38 | 1231 { |
| 1232 union al88_u | |
| 1233 { | |
| 1234 uint8_t al8[2]; | |
| 1235 uint16_t al88; | |
| 1236 }; | |
| 1237 | |
|
130
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
122
diff
changeset
|
1238 uint16_t* prunning = (uint16_t*)*ppDestination; |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1239 |
| 38 | 1240 union al88_u color_seperator; |
| 1241 union al88_u color_unselected; | |
| 1242 int i; | |
| 1243 | |
| 1244 color_seperator.al8[0] = CLUT_MenuLineUnselectedSeperator; | |
| 1245 color_unselected.al8[0] = CLUT_MenuLineUnselected; | |
| 1246 | |
| 1247 color_seperator.al8[1] = 0xFF; | |
| 1248 color_unselected.al8[1] = 0xFF; | |
| 1249 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1250 *(__IO uint16_t*)prunning++ = color_seperator.al88; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1251 *(__IO uint16_t*)prunning++ = color_seperator.al88; |
| 38 | 1252 |
| 1253 for(i = 61; i > 0; i--) | |
| 1254 { | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1255 *(__IO uint16_t*)prunning++ = color_unselected.al88; |
| 38 | 1256 } |
| 1257 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1258 *(__IO uint16_t*)prunning++ = color_seperator.al88; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1259 *(__IO uint16_t*)prunning++ = color_seperator.al88; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1260 |
|
130
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
122
diff
changeset
|
1261 *ppDestination = (uint32_t)prunning; |
| 38 | 1262 } |
| 1263 | |
| 1264 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1265 static void draw_tMdesignSubSelected(uint32_t *ppDestination) |
| 38 | 1266 { |
| 1267 union al88_u | |
| 1268 { | |
| 1269 uint8_t al8[2]; | |
| 1270 uint16_t al88; | |
| 1271 }; | |
| 1272 | |
| 1273 union al88_u color_selected; | |
| 1274 union al88_u color_seperator; | |
| 1275 int i; | |
| 1276 | |
| 1277 color_selected.al8[0] = CLUT_MenuLineSelected; | |
| 1278 color_selected.al8[1] = 0xFF; | |
| 1279 | |
| 1280 color_seperator.al8[0] = CLUT_MenuLineSelectedSeperator; | |
| 1281 color_seperator.al8[1] = 0xFF; | |
| 1282 | |
| 1283 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
| 1284 *ppDestination += 2; | |
| 1285 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
| 1286 *ppDestination += 2; | |
| 1287 | |
| 1288 for(i = 61; i > 0; i--) | |
| 1289 { | |
| 1290 *(__IO uint16_t*)*ppDestination = color_selected.al88; | |
| 1291 *ppDestination += 2; | |
| 1292 } | |
| 1293 | |
| 1294 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
| 1295 *ppDestination += 2; | |
| 1296 *(__IO uint16_t*)*ppDestination = color_seperator.al88; | |
| 1297 *ppDestination += 2; | |
| 1298 } | |
| 1299 | |
| 1300 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1301 static void draw_tMdesignSubSelectedBorder(uint32_t *ppDestination) |
| 38 | 1302 { |
| 1303 union al88_u | |
| 1304 { | |
| 1305 uint8_t al8[2]; | |
| 1306 uint16_t al88; | |
| 1307 }; | |
| 1308 | |
| 1309 union al88_u color_selected_sides; | |
| 1310 | |
| 1311 int i; | |
| 1312 | |
| 1313 color_selected_sides.al8[0] = CLUT_MenuLineSelectedSides; | |
| 1314 color_selected_sides.al8[1] = 0xFF; | |
| 1315 | |
| 1316 for(i = 65; i > 0; i--) | |
| 1317 { | |
| 1318 *(__IO uint16_t*)*ppDestination = color_selected_sides.al88; | |
| 1319 *ppDestination += 2; | |
| 1320 } | |
| 1321 } | |
| 1322 | |
| 1323 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1324 static void draw_tMcursorDesign(void) |
| 38 | 1325 { |
| 1326 int i,j; | |
| 1327 uint32_t pDestination; | |
| 1328 | |
| 1329 pDestination = tMdesignCursor.FBStartAdress; | |
| 1330 | |
| 1331 for(j = 801; j > 0; j--) | |
| 1332 { | |
| 1333 for(i = 5; i > 0; i--) | |
| 1334 { | |
| 1335 draw_tMdesignSubUnselected(&pDestination); | |
| 1336 } | |
| 1337 if((j > 787) || (j < 17)) | |
| 1338 draw_tMdesignSubSelectedBorder(&pDestination); | |
| 1339 else | |
| 1340 draw_tMdesignSubSelected(&pDestination); | |
| 1341 } | |
| 1342 | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1343 /* Draw menu background boxes which are visible if nothing is selected */ |
| 38 | 1344 pDestination = tMdesignSolo.FBStartAdress; |
| 1345 | |
| 1346 for(j = 801; j > 0; j--) | |
| 1347 { | |
| 1348 for(i = 6; i > 0; i--) | |
| 1349 { | |
| 1350 draw_tMdesignSubUnselected(&pDestination); | |
| 1351 } | |
| 1352 } | |
| 1353 } | |
| 1354 | |
| 1355 | |
|
167
5e41365ff0d8
cleanup: local data and functions can be static (tMenu)
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
1356 static void draw_tMheader(uint8_t page) |
| 38 | 1357 { |
| 1358 union al88_u | |
| 1359 { | |
| 1360 uint8_t al8[2]; | |
| 1361 uint16_t al88; | |
| 1362 }; | |
| 1363 union al88_u color_top; | |
| 1364 int i,j, k, k4text; | |
| 1365 uint32_t pBackup; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1366 uint16_t* pDestination; |
| 38 | 1367 uint8_t colorText; |
| 1368 uint16_t positionText; | |
| 1369 uint8_t pageText; | |
| 1370 | |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1371 char text8max[MAXPAGES+1][8] = |
| 38 | 1372 { "", |
| 1373 "OC", | |
| 1374 "CC", | |
| 999 | 1375 "", |
| 38 | 1376 "DATA", |
| 1377 "DECO", | |
| 1378 "", | |
| 1379 "SYS", | |
| 1380 "", | |
| 507 | 1381 "", |
| 999 | 1382 "", |
| 1041 | 1383 "SIM", |
| 1384 "" | |
| 38 | 1385 }; |
| 1386 | |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1387 _Bool spacing[MAXPAGES+1] = |
| 38 | 1388 { 0, |
| 999 | 1389 1, // behind OC |
| 38 | 1390 0, // behind CC |
| 1391 1, // behind SP | |
| 1392 1, // behind DATA | |
| 1393 0, // behind DECO1 | |
| 1394 1, // behind DECO2 | |
| 1395 0, // behind SYS1 | |
| 507 | 1396 0, // behind SYS2 |
| 999 | 1397 0, // behind SYS3 |
| 1398 1, // behind SYS4 | |
| 38 | 1399 1, // behind SIM |
| 1400 0 | |
| 1401 }; | |
| 1402 | |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1403 if(actual_menu_content == MENU_SURFACE) |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1404 { |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1405 spacing[3] = 0; /* Display extra menu directly after setpoint */ |
| 999 | 1406 memset(text8max[4],0,8); |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1407 } |
|
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1408 |
| 38 | 1409 pBackup = tMscreen.FBStartAdress; |
| 1410 tMscreen.FBStartAdress = menu.StartAddressForPage[page]; | |
|
130
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
122
diff
changeset
|
1411 pDestination = (uint16_t*) menu.StartAddressForPage[page]; |
| 38 | 1412 positionText = 10; |
| 1413 pageText = page; | |
| 1414 | |
| 1415 gfx_write_page_number(&tMscreen ,menu.pageCountNumber[page],menu.pageCountTotal,0); | |
| 1416 | |
| 1041 | 1417 /* Find the matching master text if a tab has no direct name e.g. SYS subtabs */ |
| 38 | 1418 while((text8max[pageText][0] == 0) && (pageText > 1)) |
| 1419 { | |
| 1420 pageText--; | |
| 1421 } | |
| 1422 | |
| 1423 for(k = 1; k <= MAXPAGES; k++) | |
| 1424 { | |
| 1425 if(menu.pageCountNumber[k] != 0) | |
| 1426 { | |
| 1427 k4text = k; // new hw 170522 | |
| 1428 if((text8max[k][0] == 0) && (menu.pageCountNumber[k-1] == 0)) | |
| 1429 k4text = k-1; | |
| 1430 | |
| 1431 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
|
1432 if (k == page) |
| 38 | 1433 { |
| 1434 color_top.al8[1] = 0xFF; | |
| 1435 } | |
| 1436 else | |
| 1437 { | |
| 1438 color_top.al8[1] = 0x50; | |
| 1439 } | |
| 1440 | |
| 1441 if(k4text == pageText) | |
| 1442 { | |
| 1443 colorText = CLUT_Font020; | |
| 1444 } | |
| 1445 else | |
| 1446 { | |
| 1447 colorText = CLUT_Font021; | |
| 1448 } | |
| 1449 | |
| 1450 write_content_simple(&tMscreen,positionText,775,0,&FontT42,text8max[k4text],colorText); | |
| 1451 /* | |
| 1452 write_content_simple(&tMscreen,positionText,775,0,&FontT42,text8max[k],colorText); | |
| 1453 if((text8max[k][0] == 0) && (menu.pageCountNumber[k-1] == 0)) | |
| 1454 write_content_simple(&tMscreen,positionText,775,0,&FontT42,text8max[k-1],colorText); | |
| 1455 */ | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1456 /* Draw color bars */ |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1457 if(!settingsGetPointer()->FlipDisplay) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1458 { |
| 999 | 1459 pDestination += TAB_BAR_SPACING * 480; |
| 38 | 1460 |
| 999 | 1461 for(j = TAB_BAR_WIDTH; j > 0; j--) |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1462 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1463 pDestination += (390 + 26); |
| 38 | 1464 |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1465 for(i = 16; i > 0; i--) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1466 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1467 *(__IO uint16_t*)pDestination++ = color_top.al88; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1468 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1469 pDestination += 48; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1470 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1471 |
| 999 | 1472 pDestination += TAB_BAR_SPACING * 480; |
| 1473 positionText += TAB_BAR_WIDTH + 2* TAB_BAR_SPACING; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1474 |
|
647
15f6f0b5786c
Integrated selection of bailout in the diluent selection page:
Ideenmodellierer
parents:
521
diff
changeset
|
1475 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
|
1476 { |
| 999 | 1477 pDestination += (TAB_BAR_WIDTH + 2* TAB_BAR_SPACING) * 480; |
| 1478 positionText += TAB_BAR_WIDTH + 2* TAB_BAR_SPACING; | |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1479 } |
| 38 | 1480 |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1481 if(spacing[k]) |
|
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 += 35 * 480; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1484 positionText += 35; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1485 } |
|
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 else |
|
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 += (800 - 5)* 480; |
|
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 for(j = 60; j > 0; j--) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1492 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1493 pDestination -= (390 + 26); |
| 38 | 1494 |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1495 for(i = 16; i > 0; i--) |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1496 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1497 *(__IO uint16_t*)pDestination-- = color_top.al88; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1498 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1499 pDestination -= 48; |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1500 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1501 |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1502 pDestination -= (800) * 480; |
| 824 | 1503 positionText += 66; |
| 38 | 1504 |
|
658
4df22790dc0c
Bugfix handling of new menu tab in flipped mode:
Ideenmodellierer
parents:
650
diff
changeset
|
1505 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
|
1506 { |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1507 pDestination -= 70 * 480; |
| 824 | 1508 positionText += 66; |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1509 } |
|
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 if(spacing[k]) |
|
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 -= 35 * 480; |
| 824 | 1514 positionText += 31; |
|
110
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1515 } |
|
cc8e24374b83
Added option to handled mirrored display to existing functions
Ideenmodellierer
parents:
51
diff
changeset
|
1516 } |
| 38 | 1517 } |
| 1518 } | |
| 1519 tMscreen.FBStartAdress = pBackup; | |
| 1520 } | |
|
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
|
1521 |
|
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
|
1522 |
|
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
|
1523 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
|
1524 { |
|
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
|
1525 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
|
1526 } |
|
1018
808153ba3fec
Disable the menu items for editing scrubber timer parameters if an
heinrichsweikamp
parents:
1001
diff
changeset
|
1527 |
|
808153ba3fec
Disable the menu items for editing scrubber timer parameters if an
heinrichsweikamp
parents:
1001
diff
changeset
|
1528 |
|
808153ba3fec
Disable the menu items for editing scrubber timer parameters if an
heinrichsweikamp
parents:
1001
diff
changeset
|
1529 char printCheckbox(bool isChecked) |
|
808153ba3fec
Disable the menu items for editing scrubber timer parameters if an
heinrichsweikamp
parents:
1001
diff
changeset
|
1530 { |
|
808153ba3fec
Disable the menu items for editing scrubber timer parameters if an
heinrichsweikamp
parents:
1001
diff
changeset
|
1531 return isChecked ? '\005' : '\006'; |
|
808153ba3fec
Disable the menu items for editing scrubber timer parameters if an
heinrichsweikamp
parents:
1001
diff
changeset
|
1532 } |
