506
+ − 1 ///////////////////////////////////////////////////////////////////////////////
+ − 2 /// -*- coding: UTF-8 -*-
+ − 3 ///
+ − 4 /// \file Discovery/Src/tMenuEditXtra.c
+ − 5 /// \brief Menu Edit Xtra - Specials in Divemode like Reset Stopwatch
+ − 6 /// \author heinrichs weikamp gmbh
+ − 7 /// \date 02-Mar-2015
+ − 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 "tMenuEditCustom.h"
+ − 31
+ − 32 #include "gfx_fonts.h"
+ − 33 #include "simulation.h"
+ − 34 #include "timer.h"
+ − 35 #include "tMenuEdit.h"
+ − 36 #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass()
+ − 37 #include "t3.h"
+ − 38 #include "t7.h"
+ − 39 #include "data_exchange_main.h"
+ − 40 #include "motion.h"
521
+ − 41 #include "tMenu.h"
+ − 42 #include "tMenuSystem.h"
552
+ − 43 #include <math.h>
521
+ − 44
506
+ − 45
604
+ − 46 #define CV_PER_PAGE (5u) /* number of cv selections shown at one page */
+ − 47 #define MAX_BACKLIGHT_BOOST (2u) /* max number of backlight levels which may be increased during focus state */
506
+ − 48
626
+ − 49 #define MAX_FOCUS_LIMITER (2u) /* max number for reducing the spot used for focus detection */
+ − 50
506
+ − 51 static uint8_t customviewsSubpage = 0;
+ − 52 static uint8_t customviewsSubpageMax = 0; /* number of pages needed to display all selectable views */
+ − 53 static const uint8_t* pcv_curchangelist;
+ − 54 /* Private function prototypes -----------------------------------------------*/
520
+ − 55 void openEdit_Customview(void);
521
+ − 56 void openEdit_BigScreen(void);
+ − 57 void openEdit_MotionCtrl(void);
552
+ − 58 void openEdit_ViewPort(void);
951
+ − 59 void openEdit_WarningBuz(void);
520
+ − 60 void refresh_Customviews(void);
852
+ − 61 void setMenuContentStructure();
541
+ − 62 char customview_TXT2BYTE_helper(uint8_t customViewId);
820
+ − 63 char customviewBF_TXT2BYTE_helper(uint8_t customViewId);
506
+ − 64 /* Announced function prototypes -----------------------------------------------*/
+ − 65 uint8_t OnAction_CViewTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
+ − 66 uint8_t OnAction_CViewStandard (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
541
+ − 67 uint8_t OnAction_CViewStandardBF(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
834
+ − 68 uint8_t OnAction_CViewAutofocusBF(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
506
+ − 69 uint8_t OnAction_CornerTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
+ − 70 uint8_t OnAction_CornerStandard(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
552
+ − 71 uint8_t OnAction_CViewPortCalib(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
+ − 72 uint8_t OnAction_CViewPortLayout(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
+ − 73 uint8_t OnAction_CViewPortAmbient(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
604
+ − 74 uint8_t OnAction_CViewPortControl(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
626
+ − 75 uint8_t OnAction_CViewPortSpot(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action);
506
+ − 76 /* Exported functions --------------------------------------------------------*/
+ − 77
+ − 78
+ − 79
+ − 80
520
+ − 81 void refresh_Customviews(void)
506
+ − 82 {
+ − 83 char text[32];
+ − 84 uint8_t textpointer = 0;
+ − 85
+ − 86 // header
+ − 87 text[0] = '\001';
+ − 88 text[1] = TXT_2BYTE;
+ − 89 text[2] = TXT2BYTE_Customviews;
+ − 90 text[3] = 0;
+ − 91 write_topline(text);
+ − 92
+ − 93 // custom view center return
+ − 94 textpointer = 0;
+ − 95 text[textpointer++] = TXT_2BYTE;
+ − 96 text[textpointer++] = TXT2BYTE_CViewTimeout;
+ − 97 textpointer += snprintf(&text[textpointer],11," %02u\016\016 %c\017",settingsGetPointer()->tX_customViewTimeout,TXT_Seconds);
+ − 98 write_label_var( 30, 700, ME_Y_LINE1, &FontT48, text);
+ − 99
541
+ − 100 // custom view center primary
506
+ − 101 text[0] = TXT_2BYTE;
+ − 102 text[1] = TXT2BYTE_CViewStandard;
+ − 103 text[2] = ' ';
+ − 104 text[3] = ' ';
541
+ − 105
+ − 106 text[4] = TXT_2BYTE;
+ − 107 text[5] = customview_TXT2BYTE_helper(settingsGetPointer()->tX_customViewPrimary);
506
+ − 108 text[6] = 0;
+ − 109 write_label_var( 30, 700, ME_Y_LINE2, &FontT48, text);
+ − 110
541
+ − 111 // custom view big font
+ − 112 text[0] = TXT_2BYTE;
+ − 113 text[1] = TXT2BYTE_ExtraDisplay;
+ − 114 text[2] = ' ';
+ − 115 text[3] = ' ';
+ − 116 text[4] = TXT_2BYTE;
820
+ − 117 text[5] = customviewBF_TXT2BYTE_helper(settingsGetPointer()->tX_customViewPrimaryBF);
541
+ − 118 text[6] = 0;
+ − 119 write_label_var( 30, 700, ME_Y_LINE3, &FontT48, text);
506
+ − 120
834
+ − 121 /* Bigfont autofocus selector */
+ − 122 textpointer = 0;
+ − 123 text[textpointer++] = TXT_2BYTE;
+ − 124 text[textpointer++] = TXT2BYTE_ExtraDisplay;
+ − 125 textpointer += snprintf(&text[textpointer],20," %c%c",TXT_2BYTE, TXT2BYTE_Autofocus);
+ − 126 write_label_var( 30, 700, ME_Y_LINE4, &FontT48, text);
+ − 127
+ − 128 tMenuEdit_refresh_field(StMCustom1_CViewAutoFocusBF);
+ − 129
506
+ − 130 // field corner return
+ − 131 textpointer = 0;
+ − 132 text[textpointer++] = TXT_2BYTE;
+ − 133 text[textpointer++] = TXT2BYTE_CornerTimeout;
+ − 134 textpointer += snprintf(&text[textpointer],11," %02u\016\016 %c\017",settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout,TXT_Seconds);
541
+ − 135 write_label_var( 30, 700, ME_Y_LINE5, &FontT48, text);
506
+ − 136
+ − 137 // field corner primary
+ − 138 text[0] = TXT_2BYTE;
+ − 139 text[1] = TXT2BYTE_CornerStandard;
+ − 140 text[2] = ' ';
+ − 141 text[3] = ' ';
+ − 142 switch(settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary)
+ − 143 {
+ − 144 /* Temperature */
+ − 145 case LLC_Temperature:
+ − 146 text[4] = TXT_Temperature;
+ − 147 break;
+ − 148 /* Average Depth */
+ − 149 case LLC_AverageDepth:
+ − 150 text[4] = TXT_AvgDepth;
+ − 151 break;
+ − 152 /* ppO2 */
+ − 153 case LLC_ppO2:
+ − 154 text[4] = TXT_ppO2;
+ − 155 break;
+ − 156 /* Stop Uhr */
+ − 157 case LLC_Stopwatch:
+ − 158 text[4] = TXT_Stopwatch;
+ − 159 break;
+ − 160 /* Ceiling */
+ − 161 case LLC_Ceiling:
+ − 162 text[4] = TXT_Ceiling;
+ − 163 break;
+ − 164 /* Future TTS */
+ − 165 case LLC_FutureTTS:
+ − 166 text[4] = TXT_FutureTTS;
+ − 167 break;
+ − 168 /* CNS */
+ − 169 case LLC_CNS:
+ − 170 text[4] = TXT_CNS;
+ − 171 break;
+ − 172 case LLC_GF:
+ − 173 text[4] = TXT_ActualGradient;
+ − 174 break;
656
+ − 175 case LLC_ScrubberTime:
+ − 176 text[4] = TXT_ScrubTime;
+ − 177 break;
+ − 178
506
+ − 179 #ifdef ENABLE_BOTTLE_SENSOR
+ − 180 case LCC_BottleBar:
+ − 181 text[4] = TXT_AtemGasVorrat;
+ − 182 break;
+ − 183 #endif
662
+ − 184
+ − 185 #ifdef ENABLE_PSCR_MODE
+ − 186 case LCC_SimPpo2:
+ − 187 text[4] = TXT_SimPpo2;
+ − 188 break;
+ − 189 #endif
751
+ − 190 #ifdef ENABLE_CO2_SUPPORT
+ − 191 case LCC_CO2:
+ − 192 text[4] = TXT_CO2Sensor;
+ − 193 break;
+ − 194 #endif
737
+ − 195 case LLC_Compass:
+ − 196 text[4] = TXT_2BYTE;
+ − 197 text[5] = TXT2BYTE_Compass;
+ − 198
+ − 199 break;
506
+ − 200 /* none */
+ − 201 case LLC_Empty:
+ − 202 text[4] = '-';
+ − 203 break;
+ − 204 default:
630
+ − 205 text[4] = 'X';
506
+ − 206 break;
+ − 207 }
737
+ − 208 if (text[4] != TXT_2BYTE) {
+ − 209 text[5] = 0;
+ − 210 } else {
+ − 211 text[6] = 0;
+ − 212 }
+ − 213
541
+ − 214 write_label_var( 30, 700, ME_Y_LINE6, &FontT48, text);
506
+ − 215
+ − 216 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
+ − 217 }
+ − 218
552
+ − 219 void refresh_ViewPort(void)
+ − 220 {
+ − 221 char text[32];
+ − 222 uint8_t textIndex = 0;
+ − 223 float distance = 0.0;
+ − 224 SSettings* pSettings = settingsGetPointer();
+ − 225 GFX_DrawCfgScreen* pdrawScreen;
+ − 226 point_t lowerleft = {0,0};
+ − 227 point_t upperright = {799,479};
575
+ − 228 float localLimit = 0.1;
626
+ − 229 uint8_t spotSize = (pSettings->viewPortMode >> 5) & 0x03;
552
+ − 230
+ − 231 text[0] = '\001';
+ − 232 text[1] = TXT_2BYTE;
604
+ − 233 text[2] = TXT2BYTE_MotionCtrl;
552
+ − 234 text[3] = 0;
+ − 235 write_topline(text);
+ − 236
+ − 237 text[0] = TXT_2BYTE;
+ − 238 text[1] = TXT2BYTE_CalibView;
+ − 239 text[2] = 0;
604
+ − 240 write_label_var( 30, 700, ME_Y_LINE2, &FontT48, text);
552
+ − 241
626
+ − 242
+ − 243 textIndex = 0;
+ − 244 text[textIndex++] = TXT_2BYTE;
+ − 245 text[textIndex++] = TXT2BYTE_FocusSpotSize;
+ − 246 text[textIndex++] = 0;
+ − 247 write_label_var( 30, 340, ME_Y_LINE3, &FontT48, text);
+ − 248
+ − 249 textIndex = 0;
+ − 250 text[textIndex++] = TXT_2BYTE;
+ − 251 switch(spotSize)
+ − 252 {
+ − 253 case 2: text[textIndex++] = TXT2BYTE_Minimum; break;
+ − 254 case 1: text[textIndex++] = TXT2BYTE_Normal; break;
+ − 255 default:
+ − 256 case 0: text[textIndex++] = TXT2BYTE_Maximum; break;
+ − 257 }
+ − 258 text[textIndex++] = 0;
+ − 259 write_label_var( 500, 800, ME_Y_LINE3, &FontT48, text);
+ − 260
552
+ − 261 textIndex = 0;
+ − 262 text[textIndex++] = TXT_2BYTE;
+ − 263 text[textIndex++] = TXT2BYTE_IndicateFrame;
+ − 264 text[textIndex++] = 0;
626
+ − 265 write_label_var( 30, 340, ME_Y_LINE4, &FontT48, text);
+ − 266 textIndex = 0;
+ − 267 text[textIndex++] = '\006' - ((settingsGetPointer()->viewPortMode >> 4) & 1);
+ − 268 text[textIndex++] = 0;
+ − 269 write_label_var( 500, 800, ME_Y_LINE4, &FontT48, text);
552
+ − 270 textIndex = 0;
+ − 271 text[textIndex++] = TXT_2BYTE;
+ − 272 text[textIndex++] = TXT2BYTE_BoostBacklight;
626
+ − 273 text[textIndex++] = 0;
+ − 274 write_label_var( 30, 340, ME_Y_LINE5, &FontT48, text);
+ − 275 textIndex = 0;
+ − 276 snprintf(&text[textIndex],32,"%d",(settingsGetPointer()->viewPortMode & 0x3));
+ − 277 write_label_var( 500, 800, ME_Y_LINE5, &FontT48, text);
552
+ − 278
+ − 279 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
+ − 280
+ − 281 /* test if we are in focus */
+ − 282 if((pSettings->viewPitch != 0.0) || (pSettings->viewRoll != 0.0) || (pSettings->viewYaw != 0.0))
+ − 283 {
625
+ − 284 distance = checkViewport(stateUsed->lifeData.compass_roll, stateUsed->lifeData.compass_pitch, stateUsed->lifeData.compass_heading, MOTION_ENABLE_ALL);
552
+ − 285
575
+ − 286 /* show "bar graph" indicating the distance to the center point */
+ − 287 textIndex = 0;
+ − 288 text[textIndex++] = '\001';
+ − 289
626
+ − 290 if(fabs(distance) < localLimit)
575
+ − 291 {
+ − 292 text[textIndex++] = '+';
+ − 293 }
+ − 294 else
+ − 295 {
+ − 296 while (localLimit < 0.6)
+ − 297 {
+ − 298 localLimit += 0.1;
+ − 299 text[textIndex++] = '-';
+ − 300 text[textIndex++] = '-';
626
+ − 301 if(fabs(distance) < localLimit)
575
+ − 302 {
+ − 303 break;
+ − 304 }
+ − 305 }
+ − 306 }
+ − 307 text[textIndex] = 0;
+ − 308 write_label_var( 30, 700, ME_Y_LINE1, &FontT48, text);
+ − 309
604
+ − 310 /* MotionCtrl */
+ − 311 textIndex = 0;
+ − 312
+ − 313 text[textIndex++] = TXT_2BYTE;
+ − 314 text[textIndex++] = TXT2BYTE_MotionCtrl;
626
+ − 315 text[textIndex++] = 0;
+ − 316 write_label_var( 30, 340, ME_Y_LINE6, &FontT48, text);
+ − 317 textIndex = 0;
604
+ − 318 text[textIndex++] = TXT_2BYTE;
+ − 319 switch(settingsGetPointer()->MotionDetection)
+ − 320 {
+ − 321 case MOTION_DETECT_OFF:
+ − 322 text[textIndex++] = TXT2BYTE_MoCtrlNone;
+ − 323 break;
+ − 324 case MOTION_DETECT_MOVE:
+ − 325 text[textIndex++] = TXT2BYTE_MoCtrlPitch;
+ − 326 break;
+ − 327 case MOTION_DETECT_SECTOR:
+ − 328 text[textIndex++] = TXT2BYTE_MoCtrlSector;
+ − 329 break;
+ − 330 case MOTION_DETECT_SCROLL:
+ − 331 text[textIndex++] = TXT2BYTE_MoCtrlScroll;
+ − 332 break;
+ − 333 default:
630
+ − 334 textIndex += snprintf(&text[4],4,"%u",settingsGetPointer()->MotionDetection);
604
+ − 335 break;
+ − 336 }
+ − 337 text[textIndex] = 0;
626
+ − 338 write_label_var(500, 800, ME_Y_LINE6, &FontT48, text);
604
+ − 339
626
+ − 340
+ − 341 if(viewInFocus())
552
+ − 342 {
+ − 343 set_Backlight_Boost(settingsGetPointer()->viewPortMode & 0x03);
626
+ − 344 if((pSettings->viewPortMode >> 4) & 0x01)
552
+ − 345 {
+ − 346 pdrawScreen = getMenuEditScreen();
+ − 347 GFX_draw_box(pdrawScreen,lowerleft,upperright,0,CLUT_NiceGreen);
+ − 348 }
+ − 349 }
+ − 350 else
+ − 351 {
+ − 352 set_Backlight_Boost(0);
626
+ − 353 if((pSettings->viewPortMode >> 4) & 0x01)
552
+ − 354 {
+ − 355 pdrawScreen = getMenuEditScreen();
+ − 356 GFX_draw_box(pdrawScreen,lowerleft,upperright,0,CLUT_MenuTopBackground);
+ − 357 }
+ − 358 }
+ − 359 resetFocusState(); /* no other instance shall be impacted by the local detection */
+ − 360 }
+ − 361 }
+ − 362
506
+ − 363 void openEdit_Custom(uint8_t line)
+ − 364 {
+ − 365 set_globalState_Menu_Line(line);
+ − 366
+ − 367 switch(line)
+ − 368 {
+ − 369 case 1:
706
+ − 370 default: openEdit_Customview();
521
+ − 371 break;
+ − 372 case 2: openEdit_BigScreen();
506
+ − 373 break;
521
+ − 374 case 3: openEdit_CustomviewDivemode(cv_changelist);
506
+ − 375 break;
521
+ − 376 case 4: openEdit_CustomviewDivemode(cv_changelist_BS);
+ − 377 break;
951
+ − 378 #ifdef ENABLE_MOTION_CONTROL
604
+ − 379 case 5: openEdit_ViewPort();
506
+ − 380 break;
951
+ − 381 #endif
+ − 382 #ifdef ENABLE_GPIO_V2
+ − 383 case 5: openEdit_WarningBuz();
+ − 384 break;
+ − 385 #endif
506
+ − 386 }
+ − 387 }
+ − 388
+ − 389 /* Private functions ---------------------------------------------------------*/
520
+ − 390 void openEdit_Customview(void)
506
+ − 391 {
706
+ − 392 resetMenuEdit(CLUT_MenuPageCustomView);
520
+ − 393 refresh_Customviews();
506
+ − 394
+ − 395 write_field_button(StMCustom1_CViewTimeout, 400, 700, ME_Y_LINE1, &FontT48, "");
+ − 396 write_field_button(StMCustom1_CViewStandard, 400, 700, ME_Y_LINE2, &FontT48, "");
541
+ − 397 write_field_button(StMCustom1_CViewStandardBF, 400, 700, ME_Y_LINE3, &FontT48, "");
834
+ − 398 write_field_on_off(StMCustom1_CViewAutoFocusBF, 650, 700, ME_Y_LINE4, &FontT48, "", settingsGetPointer()->cvAutofocus);
541
+ − 399 write_field_button(StMCustom1_CornerTimeout, 400, 700, ME_Y_LINE5, &FontT48, "");
+ − 400 write_field_button(StMCustom1_CornerStandard, 400, 700, ME_Y_LINE6, &FontT48, "");
506
+ − 401
+ − 402 setEvent(StMCustom1_CViewTimeout, (uint32_t)OnAction_CViewTimeout);
+ − 403 setEvent(StMCustom1_CViewStandard, (uint32_t)OnAction_CViewStandard);
541
+ − 404 setEvent(StMCustom1_CViewStandardBF, (uint32_t)OnAction_CViewStandardBF);
834
+ − 405 setEvent(StMCustom1_CViewAutoFocusBF, (uint32_t)OnAction_CViewAutofocusBF);
506
+ − 406 setEvent(StMCustom1_CornerTimeout, (uint32_t)OnAction_CornerTimeout);
541
+ − 407 setEvent(StMCustom1_CornerStandard, (uint32_t)OnAction_CornerStandard);
521
+ − 408 }
506
+ − 409
521
+ − 410 void openEdit_BigScreen(void)
+ − 411 {
+ − 412 uint8_t newValue = 0;
+ − 413 SSettings *pSettings = settingsGetPointer();
+ − 414
+ − 415 newValue = pSettings->extraDisplay + 1;
739
+ − 416
521
+ − 417 if(newValue >= EXTRADISPLAY_END)
+ − 418 {
+ − 419 newValue = EXTRADISPLAY_none;
+ − 420 }
+ − 421 pSettings->extraDisplay = newValue;
+ − 422
+ − 423 exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only();
+ − 424 }
+ − 425
+ − 426 void openEdit_MotionCtrl(void)
+ − 427 {
+ − 428 uint8_t newValue = 0;
+ − 429 SSettings *pSettings = settingsGetPointer();
+ − 430
+ − 431 switch(pSettings->MotionDetection)
+ − 432 {
+ − 433 case MOTION_DETECT_OFF:
+ − 434 newValue = MOTION_DETECT_MOVE;
+ − 435 break;
+ − 436 case MOTION_DETECT_MOVE:
+ − 437 newValue = MOTION_DETECT_SECTOR;
+ − 438 break;
+ − 439 case MOTION_DETECT_SECTOR:
+ − 440 newValue = MOTION_DETECT_SCROLL;
+ − 441 break;
+ − 442 case MOTION_DETECT_SCROLL:
+ − 443 newValue = MOTION_DETECT_OFF;
+ − 444 break;
+ − 445 default:
+ − 446 newValue = MOTION_DETECT_OFF;
+ − 447 break;
+ − 448 }
+ − 449 pSettings->MotionDetection = newValue;
+ − 450 InitMotionDetection();
+ − 451
+ − 452 exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only();
506
+ − 453 }
+ − 454
552
+ − 455
+ − 456
+ − 457 void openEdit_ViewPort(void)
+ − 458 {
951
+ − 459 #ifdef ENABLE_MOTION_CONTROL
706
+ − 460 resetMenuEdit(CLUT_MenuPageCustomView);
552
+ − 461 refresh_ViewPort();
+ − 462
604
+ − 463 write_field_button(StMCustom5_CViewPortCalib, 400, 700, ME_Y_LINE2, &FontT48, "");
626
+ − 464 write_field_button(StMCustom5_CViewPortSpotSize,400, 700, ME_Y_LINE3, &FontT48, "");
+ − 465 write_field_button(StMCustom5_CViewPortLayout, 400, 700, ME_Y_LINE4, &FontT48, "");
+ − 466 write_field_button(StMCustom5_CViewPortAmbient, 400, 700, ME_Y_LINE5, &FontT48, "");
604
+ − 467 write_field_button(StMCustom5_CViewPortControl, 400, 700, ME_Y_LINE6, &FontT48, "");
552
+ − 468
604
+ − 469 setEvent(StMCustom5_CViewPortCalib, (uint32_t)OnAction_CViewPortCalib);
626
+ − 470 setEvent(StMCustom5_CViewPortSpotSize, (uint32_t)OnAction_CViewPortSpot);
604
+ − 471 setEvent(StMCustom5_CViewPortLayout, (uint32_t)OnAction_CViewPortLayout);
+ − 472 setEvent(StMCustom5_CViewPortAmbient, (uint32_t)OnAction_CViewPortAmbient);
+ − 473 setEvent(StMCustom5_CViewPortControl, (uint32_t)OnAction_CViewPortControl);
951
+ − 474 #endif
552
+ − 475 }
951
+ − 476 void openEdit_WarningBuz(void)
+ − 477 {
+ − 478 SSettings *pSettings = settingsGetPointer();
552
+ − 479
951
+ − 480 if(pSettings->warningBuzzer == 0)
+ − 481 {
+ − 482 pSettings->warningBuzzer = 1;
+ − 483 }
+ − 484 else
+ − 485 {
+ − 486 pSettings->warningBuzzer = 0;
+ − 487 }
+ − 488 exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only();
+ − 489 }
552
+ − 490
520
+ − 491 char customview_TXT2BYTE_helper(uint8_t customViewId)
506
+ − 492 {
+ − 493 char text = 0;
+ − 494
+ − 495 switch(customViewId)
+ − 496 {
+ − 497 case CVIEW_sensors:
+ − 498 text = TXT2BYTE_O2monitor;
+ − 499 break;
+ − 500 case CVIEW_sensors_mV:
+ − 501 text = TXT2BYTE_O2voltage;
+ − 502 break;
+ − 503 case CVIEW_Compass:
+ − 504 text = TXT2BYTE_Compass;
+ − 505 break;
+ − 506 case CVIEW_Decolist:
+ − 507 text = TXT2BYTE_Decolist;
+ − 508 break;
+ − 509 case CVIEW_Tissues:
+ − 510 text = TXT2BYTE_Tissues;
+ − 511 break;
+ − 512 case CVIEW_Profile:
+ − 513 text = TXT2BYTE_Profile;
+ − 514 break;
531
+ − 515 case CVIEW_Gaslist:
506
+ − 516 text = TXT2BYTE_Gaslist;
+ − 517 break;
+ − 518 case CVIEW_EADTime:
+ − 519 text = TXT2BYTE_Info;
+ − 520 break;
+ − 521 case CVIEW_SummaryOfLeftCorner:
+ − 522 text = TXT2BYTE_Summary;
+ − 523 break;
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 524 case CVIEW_Timer:
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 525 text = TXT2BYTE_Timer;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 526 break;
899
+ − 527 case CVIEW_Position:
+ − 528 text = TXT2BYTE_Position;
+ − 529 break;
506
+ − 530 case CVIEW_noneOrDebug:
+ − 531 text = TXT2BYTE_DispNoneDbg;
820
+ − 532 break;
+ − 533 default:
+ − 534 break;
+ − 535 }
+ − 536 return text;
+ − 537 }
+ − 538 char customviewBF_TXT2BYTE_helper(uint8_t customViewId)
+ − 539 {
+ − 540 char text = 0;
+ − 541
+ − 542 switch(customViewId)
+ − 543 {
+ − 544 case CVIEW_T3_noneOrDebug:
+ − 545 text = TXT2BYTE_DispNoneDbg;
+ − 546 break;
+ − 547 case CVIEW_T3_sensors:
+ − 548 text = TXT2BYTE_O2monitor;
+ − 549 break;
+ − 550 case CVIEW_T3_Compass:
+ − 551 text = TXT2BYTE_Compass;
+ − 552 break;
+ − 553 case CVIEW_T3_Decostop:
+ − 554 text = TXT2BYTE_Decolist;
+ − 555 break;
+ − 556 #ifdef ENABLE_T3_PROFILE_VIEW
+ − 557 case CVIEW_T3_Profile:
+ − 558 text = TXT2BYTE_Profile;
+ − 559 break;
+ − 560 #endif
836
+ − 561 case CVIEW_T3_Temperature:
+ − 562 text = TXT2BYTE_AmbientTemperature;
+ − 563 break;
820
+ − 564 case CVIEW_T3_GasList:
+ − 565 text = TXT2BYTE_Gaslist;
506
+ − 566 break;
+ − 567 case CVIEW_T3_MaxDepth:
+ − 568 text = TXT2BYTE_MaxDepth;
+ − 569 break;
+ − 570 case CVIEW_T3_StopWatch:
+ − 571 text = TXT2BYTE_Stopwatch;
+ − 572 break;
+ − 573 case CVIEW_T3_TTS:
+ − 574 text = TXT2BYTE_TTS;
+ − 575 break;
+ − 576 case CVIEW_T3_ppO2andGas:
+ − 577 text = TXT2BYTE_ppoNair;
+ − 578 break;
+ − 579 case CVIEW_T3_Navigation:
+ − 580 text = TXT2BYTE_Navigation;
+ − 581 break;
+ − 582 case CVIEW_T3_DepthData:
+ − 583 text = TXT2BYTE_DepthData;
+ − 584 break;
542
+ − 585 case CVIEW_T3_DecoTTS:
+ − 586 text = TXT2BYTE_DecoTTS;
+ − 587 break;
506
+ − 588 default:
+ − 589 break;
+ − 590 }
+ − 591 return text;
+ − 592 }
+ − 593
520
+ − 594 uint8_t OnAction_CViewTimeout(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
506
+ − 595 {
+ − 596 uint8_t value;
+ − 597 value = settingsGetPointer()->tX_customViewTimeout;
+ − 598
+ − 599 if(value < 5)
+ − 600 value = 5;
+ − 601 else if(value < 10)
+ − 602 value = 10;
+ − 603 else if(value < 15)
+ − 604 value = 15;
+ − 605 else if(value < 20)
+ − 606 value = 20;
+ − 607 else if(value < 30)
+ − 608 value = 30;
+ − 609 else if(value < 45)
+ − 610 value = 45;
+ − 611 else if(value < 60)
+ − 612 value = 60;
+ − 613 else
+ − 614 value = 0;
+ − 615
+ − 616 settingsGetPointer()->tX_customViewTimeout = value;
+ − 617 return UPDATE_DIVESETTINGS;
+ − 618 }
+ − 619
+ − 620
520
+ − 621 uint8_t OnAction_CViewStandard(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
506
+ − 622 {
+ − 623 uint8_t newValue;
+ − 624 switch(settingsGetPointer()->tX_customViewPrimary)
+ − 625 {
+ − 626 case CVIEW_sensors:
+ − 627 newValue = CVIEW_sensors_mV;
+ − 628 break;
+ − 629 case CVIEW_sensors_mV:
+ − 630 newValue = CVIEW_Compass;
+ − 631 break;
+ − 632 case CVIEW_Compass:
+ − 633 newValue = CVIEW_Decolist;
+ − 634 break;
+ − 635 case CVIEW_Decolist:
+ − 636 newValue = CVIEW_Tissues;
+ − 637 break;
+ − 638 case CVIEW_Tissues:
+ − 639 newValue = CVIEW_Profile;
+ − 640 break;
+ − 641 case CVIEW_Profile:
+ − 642 newValue = CVIEW_Gaslist;
+ − 643 break;
+ − 644 case CVIEW_Gaslist:
+ − 645 newValue = CVIEW_EADTime;
+ − 646 break;
+ − 647 case CVIEW_EADTime:
+ − 648 newValue = CVIEW_SummaryOfLeftCorner;
+ − 649 break;
+ − 650 case CVIEW_SummaryOfLeftCorner:
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 651 newValue = CVIEW_Timer;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 652 break;
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
diff
changeset
+ − 653 case CVIEW_Timer:
506
+ − 654 newValue = CVIEW_noneOrDebug;
+ − 655 break;
+ − 656 case CVIEW_noneOrDebug:
+ − 657 default:
+ − 658 newValue = CVIEW_sensors;
+ − 659 break;
+ − 660 }
+ − 661 settingsGetPointer()->tX_customViewPrimary = newValue;
+ − 662 return UPDATE_DIVESETTINGS;
+ − 663 }
+ − 664
541
+ − 665 uint8_t OnAction_CViewStandardBF(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 666 {
+ − 667 uint8_t index = 0;
+ − 668 uint8_t newValue;
+ − 669
+ − 670 /* list contains all views which may be selected => get index of current setting */
820
+ − 671 while((settingsGetPointer()->tX_customViewPrimaryBF != cv_changelist_BS[index]) && (cv_changelist_BS[index] != CVIEW_T3_END))
541
+ − 672 {
+ − 673 index++;
+ − 674 }
+ − 675 if((cv_changelist_BS[index] == CVIEW_T3_END) || (cv_changelist_BS[index+1] == CVIEW_T3_END)) /* invalid or last setting */
+ − 676 {
+ − 677 newValue = cv_changelist_BS[0];
+ − 678 }
+ − 679 else
+ − 680 {
+ − 681 newValue = cv_changelist_BS[index + 1];
+ − 682 }
+ − 683
+ − 684 settingsGetPointer()->tX_customViewPrimaryBF = newValue;
+ − 685 return UPDATE_DIVESETTINGS;
+ − 686 }
+ − 687
834
+ − 688 uint8_t OnAction_CViewAutofocusBF(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 689 {
+ − 690 SSettings *pSettings = settingsGetPointer();
+ − 691 if(pSettings->cvAutofocus)
+ − 692 {
+ − 693 pSettings->cvAutofocus = 0;
+ − 694 }
+ − 695 else
+ − 696 {
+ − 697 pSettings->cvAutofocus = 1;
+ − 698 }
+ − 699 tMenuEdit_set_on_off(editId, pSettings->cvAutofocus);
+ − 700 return UPDATE_DIVESETTINGS;
+ − 701 }
506
+ − 702
520
+ − 703 uint8_t OnAction_CornerTimeout(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
506
+ − 704 {
+ − 705 uint8_t value;
+ − 706 value = settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout;
+ − 707
+ − 708 if(value < 5)
+ − 709 value = 5;
+ − 710 else if(value < 10)
+ − 711 value = 10;
+ − 712 else if(value < 15)
+ − 713 value = 15;
+ − 714 else if(value < 20)
+ − 715 value = 20;
+ − 716 else if(value < 30)
+ − 717 value = 30;
+ − 718 else if(value < 45)
+ − 719 value = 45;
+ − 720 else if(value < 60)
+ − 721 value = 60;
+ − 722 else
+ − 723 value = 0;
+ − 724
+ − 725 settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout = value;
+ − 726 return UPDATE_DIVESETTINGS;
+ − 727 }
+ − 728
+ − 729
520
+ − 730 uint8_t OnAction_CornerStandard(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
506
+ − 731 {
+ − 732 uint8_t value;
+ − 733 value = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary;
+ − 734
+ − 735 value += 1;
+ − 736
+ − 737 if(value >= LLC_END)
+ − 738 value = 0;
+ − 739
+ − 740 settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary = value;
+ − 741 return UPDATE_DIVESETTINGS;
+ − 742 }
+ − 743
+ − 744
+ − 745 uint8_t OnAction_Customview_Toggle(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 746 {
+ − 747
+ − 748 uint8_t line = 0;
+ − 749 SSettings *pSettings = settingsGetPointer();
+ − 750
+ − 751 switch(editId)
+ − 752 {
521
+ − 753 case StMCustom3_CViewSelection1: line = 1;
506
+ − 754 break;
521
+ − 755 case StMCustom3_CViewSelection2: line = 2;
506
+ − 756 break;
521
+ − 757 case StMCustom3_CViewSelection3: line = 3;
506
+ − 758 break;
521
+ − 759 case StMCustom3_CViewSelection4: line = 4;
506
+ − 760 break;
521
+ − 761 case StMCustom3_CViewSelection5: line = 5;
506
+ − 762 break;
+ − 763
+ − 764 default:
+ − 765 break;
+ − 766 }
+ − 767 if(pcv_curchangelist == cv_changelist)
+ − 768 {
+ − 769 pSettings->cv_configuration ^= 1 << (pcv_curchangelist[customviewsSubpage * 5 + line-1]);
+ − 770 if(t7_GetEnabled_customviews() == 0)
+ − 771 {
+ − 772 pSettings->cv_configuration ^= (1 << CVIEW_noneOrDebug);
+ − 773 }
+ − 774 }
+ − 775 else
+ − 776 {
+ − 777 pSettings->cv_config_BigScreen ^= 1 << (pcv_curchangelist[customviewsSubpage * 5 + line-1]);
+ − 778 if(t3_GetEnabled_customviews() == 0)
+ − 779 {
+ − 780 pSettings->cv_config_BigScreen ^= (1 << CVIEW_noneOrDebug);
+ − 781 }
+ − 782 }
+ − 783 return UPDATE_DIVESETTINGS;
+ − 784 }
+ − 785
+ − 786
+ − 787 uint8_t OnAction_Customview_NextPage(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 788 {
852
+ − 789 resetMenuContentStructure();
506
+ − 790 customviewsSubpage++;
852
+ − 791
506
+ − 792 if(customviewsSubpage == customviewsSubpageMax)
+ − 793 {
+ − 794 customviewsSubpage = 0;
852
+ − 795 setMenuContentStructure();
+ − 796 tMenuEdit_select(StMCustom3_CViewSelection6);
506
+ − 797 }
852
+ − 798 else
+ − 799 {
+ − 800 setMenuContentStructure();
+ − 801 }
+ − 802
750
+ − 803 CustomviewDivemode_refresh();
506
+ − 804 return UPDATE_DIVESETTINGS;
+ − 805 }
+ − 806
552
+ − 807 uint8_t OnAction_CViewPortCalib(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 808 {
+ − 809 float heading;
+ − 810 if(settingsGetPointer()->compassInertia)
+ − 811 {
+ − 812 heading = (uint16_t)compass_getCompensated();
+ − 813 }
+ − 814 else
+ − 815 {
+ − 816 heading = (uint16_t)stateUsed->lifeData.compass_heading;
+ − 817 }
+ − 818 calibrateViewport(stateUsed->lifeData.compass_roll,stateUsed->lifeData.compass_pitch,heading);
+ − 819
+ − 820 return UPDATE_DIVESETTINGS;
+ − 821 }
+ − 822 uint8_t OnAction_CViewPortLayout(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 823 {
+ − 824 SSettings* pSettings = settingsGetPointer();
700
+ − 825 if((pSettings->viewPortMode & 0x10) != 0)
552
+ − 826 {
640
+ − 827 pSettings->viewPortMode &= 0xEF; /* 1110 1111 */
552
+ − 828 }
+ − 829 else
+ − 830 {
+ − 831 pSettings->viewPortMode |= 0x10;
+ − 832 }
+ − 833
+ − 834 return UPDATE_DIVESETTINGS;
+ − 835 }
+ − 836 uint8_t OnAction_CViewPortAmbient(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 837 {
+ − 838 SSettings* pSettings = settingsGetPointer();
604
+ − 839 if(((pSettings->viewPortMode +1) & 0x03) <= MAX_BACKLIGHT_BOOST)
+ − 840 {
+ − 841 pSettings->viewPortMode++;
+ − 842 }
+ − 843 else
+ − 844 {
+ − 845 pSettings->viewPortMode &= 0xFC;
+ − 846 }
552
+ − 847
+ − 848 return UPDATE_DIVESETTINGS;
+ − 849 }
+ − 850
604
+ − 851 uint8_t OnAction_CViewPortControl(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 852 {
+ − 853 uint8_t newValue = 0;
+ − 854 SSettings *pSettings = settingsGetPointer();
552
+ − 855
604
+ − 856 switch(pSettings->MotionDetection)
+ − 857 {
+ − 858 case MOTION_DETECT_OFF:
+ − 859 newValue = MOTION_DETECT_MOVE;
+ − 860 break;
+ − 861 case MOTION_DETECT_MOVE:
+ − 862 newValue = MOTION_DETECT_SECTOR;
+ − 863 break;
+ − 864 case MOTION_DETECT_SECTOR:
+ − 865 newValue = MOTION_DETECT_SCROLL;
+ − 866 break;
+ − 867 case MOTION_DETECT_SCROLL:
+ − 868 newValue = MOTION_DETECT_OFF;
+ − 869 break;
+ − 870 default:
+ − 871 newValue = MOTION_DETECT_OFF;
+ − 872 break;
+ − 873 }
+ − 874 pSettings->MotionDetection = newValue;
+ − 875 return UPDATE_DIVESETTINGS;
+ − 876 }
552
+ − 877
626
+ − 878 uint8_t OnAction_CViewPortSpot(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 879 {
+ − 880 uint8_t newValue = 0;
+ − 881 SSettings *pSettings = settingsGetPointer();
+ − 882
+ − 883 newValue = ((pSettings->viewPortMode >> 5) + 1) & 0x03;
+ − 884 if(newValue > MAX_FOCUS_LIMITER)
+ − 885 {
+ − 886 newValue = 0;
+ − 887 }
640
+ − 888 pSettings->viewPortMode &= 0x9F; /* 1001 1111 */
626
+ − 889 pSettings->viewPortMode |= (newValue << 5);
+ − 890 return UPDATE_DIVESETTINGS;
+ − 891 }
+ − 892
852
+ − 893 void setMenuContentStructure()
506
+ − 894 {
+ − 895 char text[MAX_PAGE_TEXTSIZE];
+ − 896 uint8_t textPointer = 0;
+ − 897 uint32_t id;
+ − 898
+ − 899 uint8_t i;
836
+ − 900 uint8_t endID = CVIEW_END;
852
+ − 901 SSettings *pSettings = settingsGetPointer();
836
+ − 902
852
+ − 903 if(pcv_curchangelist == cv_changelist_BS)
836
+ − 904 {
+ − 905 endID = CVIEW_T3_END;
+ − 906 }
506
+ − 907
852
+ − 908 for(i=0; i<5;i++) /* fill maximum 5 items and leave last one for sub page selection */
+ − 909 {
+ − 910 textPointer = 0;
+ − 911 id = pcv_curchangelist[customviewsSubpage * 5 + i];
+ − 912 if(id == endID) /* last list item? */
+ − 913 {
+ − 914 break;
+ − 915 }
+ − 916 else
+ − 917 {
+ − 918 if(pcv_curchangelist == cv_changelist)
+ − 919 {
+ − 920 text[textPointer++] = '\006' - CHECK_BIT_THOME(pSettings->cv_configuration,id);
+ − 921 }
+ − 922 else
+ − 923 {
+ − 924 text[textPointer++] = '\006' - CHECK_BIT_THOME(pSettings->cv_config_BigScreen,id);
+ − 925 }
506
+ − 926 text[textPointer++] = ' ';
520
+ − 927 textPointer += snprintf(&text[textPointer], 60, "%c%c\n\r", TXT_2BYTE, customview_TXT2BYTE_helper(id));
506
+ − 928
+ − 929 switch(i)
+ − 930 {
521
+ − 931 case 0: write_field_button(StMCustom3_CViewSelection1, 30, 800, ME_Y_LINE1, &FontT48, "");
506
+ − 932 break;
521
+ − 933 case 1: write_field_button(StMCustom3_CViewSelection2, 30, 800, ME_Y_LINE2, &FontT48, "");
506
+ − 934 break;
521
+ − 935 case 2: write_field_button(StMCustom3_CViewSelection3, 30, 800, ME_Y_LINE3, &FontT48, "");
506
+ − 936 break;
521
+ − 937 case 3: write_field_button(StMCustom3_CViewSelection4, 30, 800, ME_Y_LINE4, &FontT48, "");
506
+ − 938 break;
521
+ − 939 case 4: write_field_button(StMCustom3_CViewSelection5, 30, 800, ME_Y_LINE5, &FontT48, "");
506
+ − 940 break;
+ − 941 default:
+ − 942 break;
+ − 943 }
852
+ − 944 }
+ − 945 }
+ − 946 for(;i<5;i++) /* clear empty lines in case menu shows less than 5 entries */
+ − 947 {
+ − 948 switch(i)
+ − 949 {
+ − 950 case 0: write_label_var( 30, 800, ME_Y_LINE1, &FontT48, "");
+ − 951 break;
+ − 952 case 1: write_label_var( 30, 800, ME_Y_LINE2, &FontT48, "");
+ − 953 break;
+ − 954 case 2: write_label_var( 30, 800, ME_Y_LINE3, &FontT48, "");
+ − 955 break;
+ − 956 case 3: write_label_var( 30, 800, ME_Y_LINE4, &FontT48, "");
+ − 957 break;
+ − 958 case 4: write_label_var( 30, 800, ME_Y_LINE5, &FontT48, "");
+ − 959 break;
+ − 960 default:
+ − 961 break;
+ − 962 };
+ − 963 }
506
+ − 964
852
+ − 965 if(customviewsSubpageMax != 1)
+ − 966 {
+ − 967 textPointer = 0;
+ − 968 text[textPointer++] = TXT_2BYTE;
+ − 969 text[textPointer++] = TXT2BYTE_ButtonNext;
+ − 970 text[textPointer] = 0;
+ − 971 write_field_button(StMCustom3_CViewSelection6, 30, 800, ME_Y_LINE6, &FontT48, text);
+ − 972 }
+ − 973
+ − 974 /* because of the ID handling inside of the functions, all buttons needs to be assigned before the events may be set => have the same loop twice */
+ − 975 for(i=0; i<5;i++) /* fill maximum 5 items and leave last one for sub page selection */
+ − 976 {
+ − 977 id = pcv_curchangelist[customviewsSubpage * 5 + i];
+ − 978 if(id == endID) /* last list item? */
+ − 979 {
+ − 980 break;
+ − 981 }
+ − 982 else
+ − 983 {
506
+ − 984 switch(i)
+ − 985 {
521
+ − 986 case 0: setEvent(StMCustom3_CViewSelection1, (uint32_t)OnAction_Customview_Toggle);
506
+ − 987 break;
521
+ − 988 case 1: setEvent(StMCustom3_CViewSelection2, (uint32_t)OnAction_Customview_Toggle);
506
+ − 989 break;
521
+ − 990 case 2: setEvent(StMCustom3_CViewSelection3, (uint32_t)OnAction_Customview_Toggle);
506
+ − 991 break;
521
+ − 992 case 3: setEvent(StMCustom3_CViewSelection4, (uint32_t)OnAction_Customview_Toggle);
506
+ − 993 break;
521
+ − 994 case 4: setEvent(StMCustom3_CViewSelection5, (uint32_t)OnAction_Customview_Toggle);
506
+ − 995 break;
+ − 996
+ − 997 default:
+ − 998 break;
+ − 999 }
+ − 1000
852
+ − 1001 }
+ − 1002 }
+ − 1003 if(customviewsSubpageMax != 1)
+ − 1004 {
+ − 1005 setEvent(StMCustom3_CViewSelection6,(uint32_t)OnAction_Customview_NextPage);
+ − 1006 }
+ − 1007 }
+ − 1008 void openEdit_CustomviewDivemode(const uint8_t* pcv_changelist)
+ − 1009 {
+ − 1010 resetMenuEdit(CLUT_MenuPageCustomView);
+ − 1011 customviewsSubpageMax = (tHome_getNumberOfAvailableCVs(pcv_changelist) / CV_PER_PAGE) + 1;
750
+ − 1012
852
+ − 1013 if(pcv_curchangelist != pcv_changelist) /* new selection base? => reset page index */
+ − 1014 {
+ − 1015 customviewsSubpage = 0;
+ − 1016 }
+ − 1017 pcv_curchangelist = pcv_changelist;
+ − 1018
+ − 1019 setMenuContentStructure();
+ − 1020
+ − 1021 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
506
+ − 1022 }
+ − 1023
520
+ − 1024 void openEdit_CustomviewDivemodeMenu(uint8_t line)
+ − 1025 {
+ − 1026 static uint8_t customviewsSubpage = 0;
+ − 1027 SSettings *pSettings = settingsGetPointer();
506
+ − 1028
815
+ − 1029 customviewsSubpageMax = (tHome_getNumberOfAvailableCVs(cv_changelist) / CV_PER_PAGE) + 1;
520
+ − 1030
+ − 1031 if((line == 6) || (cv_changelist[customviewsSubpage * 5 + line-1] == CVIEW_END)) /* select next set of views */
+ − 1032 {
+ − 1033 customviewsSubpage++;
815
+ − 1034 if(customviewsSubpage == customviewsSubpageMax)
520
+ − 1035 {
+ − 1036 customviewsSubpage = 0;
+ − 1037 }
+ − 1038 set_CustomsviewsSubpage(customviewsSubpage);
+ − 1039 /* rebuild the selection page with the next set of customer views */
815
+ − 1040 updateSpecificMenu(StMSYS);
520
+ − 1041 openMenu(0);
+ − 1042 }
+ − 1043 else
+ − 1044 {
+ − 1045 pSettings->cv_configuration ^= 1 << (cv_changelist[customviewsSubpage * 5 + line-1]);
+ − 1046 if(t7_GetEnabled_customviews() == 0)
+ − 1047 {
+ − 1048 pSettings->cv_configuration ^= (1 << CVIEW_noneOrDebug);
+ − 1049 }
+ − 1050 InitMotionDetection(); /* consider new view setup for view selection by motion */
+ − 1051 exitMenuEdit_to_Menu_with_Menu_Update();
+ − 1052 }
+ − 1053 }
+ − 1054
+ − 1055 uint8_t OnAction_ExtraDisplay (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
+ − 1056 {
+ − 1057 uint8_t newValue;
+ − 1058
+ − 1059 newValue = settingsGetPointer()->extraDisplay + 1;
739
+ − 1060
520
+ − 1061 if(newValue >= EXTRADISPLAY_END)
+ − 1062 {
+ − 1063 newValue = EXTRADISPLAY_none;
+ − 1064 }
+ − 1065 settingsGetPointer()->extraDisplay = newValue;
+ − 1066 return UNSPECIFIC_RETURN;
+ − 1067 }
+ − 1068
+ − 1069 void CustomviewDivemode_refresh()
506
+ − 1070 {
+ − 1071 SSettings *pSettings = settingsGetPointer();
+ − 1072 char text[MAX_PAGE_TEXTSIZE];
+ − 1073 uint8_t textPointer = 0;
+ − 1074 uint32_t id;
+ − 1075
+ − 1076 uint8_t i;
836
+ − 1077 uint8_t endID = CVIEW_END;
+ − 1078
+ − 1079 if(pcv_curchangelist == cv_changelist_BS)
+ − 1080 {
+ − 1081 endID = CVIEW_T3_END;
+ − 1082 }
506
+ − 1083
531
+ − 1084 text[textPointer++] = '\001';
+ − 1085 text[textPointer++] = TXT_2BYTE;
+ − 1086 text[textPointer++] = TXT2BYTE_SelectCustomviews;
+ − 1087 text[textPointer++] = ' ';
+ − 1088 text[textPointer++] = '1' + customviewsSubpage;
+ − 1089 text[textPointer++] = 0;
506
+ − 1090 write_topline(text);
+ − 1091
+ − 1092
+ − 1093 for(i=0; i<5;i++) /* fill maximum 5 items and leave last one for sub page selection */
+ − 1094 {
+ − 1095 textPointer = 0;
+ − 1096 id = pcv_curchangelist[customviewsSubpage * 5 + i];
836
+ − 1097 if(id == endID) /* last list item? */
506
+ − 1098 {
+ − 1099 break;
+ − 1100 }
+ − 1101 else
+ − 1102 {
+ − 1103 if(pcv_curchangelist == cv_changelist)
+ − 1104 {
+ − 1105 text[textPointer++] = '\006' - CHECK_BIT_THOME(pSettings->cv_configuration,id);
820
+ − 1106 text[textPointer++] = ' ';
+ − 1107 textPointer += snprintf(&text[textPointer], 60, "%c%c\n\r", TXT_2BYTE, customview_TXT2BYTE_helper(id));
506
+ − 1108 }
+ − 1109 else
+ − 1110 {
+ − 1111 text[textPointer++] = '\006' - CHECK_BIT_THOME(pSettings->cv_config_BigScreen,id);
820
+ − 1112 text[textPointer++] = ' ';
+ − 1113 textPointer += snprintf(&text[textPointer], 60, "%c%c\n\r", TXT_2BYTE, customviewBF_TXT2BYTE_helper(id));
506
+ − 1114 }
+ − 1115
820
+ − 1116 switch(i)
+ − 1117 {
+ − 1118 case 0: write_label_var( 30, 800, ME_Y_LINE1, &FontT48, text);
+ − 1119 break;
+ − 1120 case 1: write_label_var( 30, 800, ME_Y_LINE2, &FontT48, text);
+ − 1121 break;
+ − 1122 case 2: write_label_var( 30, 800, ME_Y_LINE3, &FontT48, text);
+ − 1123 break;
+ − 1124 case 3: write_label_var( 30, 800, ME_Y_LINE4, &FontT48, text);
+ − 1125 break;
+ − 1126 case 4: write_label_var( 30, 800, ME_Y_LINE5, &FontT48, text);
+ − 1127 break;
+ − 1128 default:
+ − 1129 break;
+ − 1130 }
506
+ − 1131 }
+ − 1132 }
+ − 1133 if(customviewsSubpageMax != 1)
+ − 1134 {
+ − 1135 textPointer = 0;
+ − 1136 text[textPointer++] = TXT_2BYTE;
+ − 1137 text[textPointer++] = TXT2BYTE_ButtonNext;
+ − 1138 text[textPointer] = 0;
+ − 1139 write_label_var( 30, 800, ME_Y_LINE6, &FontT48, text);
+ − 1140 }
515
+ − 1141 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
506
+ − 1142 }