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