comparison src/menu_tree.asm @ 631:185ba2f91f59

3.09 beta 1 release
author heinrichsweikamp
date Fri, 28 Feb 2020 15:45:07 +0100
parents 237931377539
children 4050675965ea
comparison
equal deleted inserted replaced
630:4cd81bdbf15c 631:185ba2f91f59
1 ;============================================================================= 1 ;=============================================================================
2 ; 2 ;
3 ; File menu_tree.asm next combined generation V3.04.3 3 ; File menu_tree.asm next combined generation V3.08.8
4 ; 4 ;
5 ; OSTC Surface Menus 5 ; OSTC Surface Menus
6 ; 6 ;
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
8 ;============================================================================= 8 ;=============================================================================
28 #include "rtc.inc" 28 #include "rtc.inc"
29 29
30 30
31 extern do_demo_divemode 31 extern do_demo_divemode
32 extern restart 32 extern restart
33 extern option_save_all 33 extern option_check_and_store_all
34 extern option_reset 34 extern option_reset
35 extern do_demo_planner 35 extern do_demo_planner
36 extern comm_mode_ble ; will also set CPU speed to normal 36 extern comm_mode_ble ; will also set CPU speed to normal
37 extern piezo_config 37 extern piezo_config
38 extern option_reset_all 38 extern option_reset_all
39 extern rtc_set_rtc
40 extern surfloop 39 extern surfloop
41 extern oColorSetDive 40 extern oColorSetDive
42 extern vault_decodata_into_eeprom 41 extern eeprom_deco_data_write
43 42
44 IFDEF _ccr_pscr 43 IFDEF _ccr_pscr
45 extern option_cleanup_oCCRMode 44 extern option_cleanup_oCCRMode
46 ENDIF 45 ENDIF
47 46
66 do_main_menu: 65 do_main_menu:
67 movff active_customview,customview_surfmode ; save last custom view 66 movff active_customview,customview_surfmode ; save last custom view
68 clrf MS_flags_imprint ; clear all flags for data imprinting 67 clrf MS_flags_imprint ; clear all flags for data imprinting
69 68
70 global do_main_menu2 69 global do_main_menu2
71 do_main_menu2: ; entry point used by logbook.asm 70 do_main_menu2: ; entry point used by logbook.asm
72 call TFT_boot ; initialize display 71 call TFT_boot ; initialize display
73 call menu_processor_reset ; reset menu stack 72 call menu_processor_reset ; reset menu stack
74 73
75 do_main_menu_common: 74 do_main_menu_common:
76 IFDEF _ccr_pscr 75 IFDEF _ccr_pscr
77 MENU_BEGIN tMainMenu, .7 76 MENU_BEGIN tMainMenu, .7
78 MENU_CALL tLogbook, logbook 77 MENU_CALL tLogbook, logbook
79 MENU_CALL tGasSetup, do_gas_menu 78 MENU_CALL tGasSetup, do_gas_menu
80 MENU_CALL tCCRSetup, do_ccr_menu 79 MENU_CALL tCCRSetup, do_ccr_menu
81 MENU_CALL tPlan, do_planner_menu
82 MENU_CALL tDiveModeMenu, do_divemode_menu 80 MENU_CALL tDiveModeMenu, do_divemode_menu
81 MENU_CALL tSimulator, do_simulator_menu
83 MENU_CALL tSystSets, do_settings_menu 82 MENU_CALL tSystSets, do_settings_menu
84 MENU_CALL tExit, do_restart 83 MENU_CALL tExit, do_restart
85 MENU_END 84 MENU_END
86 ELSE 85 ELSE
87 MENU_BEGIN tMainMenu, .6 86 MENU_BEGIN tMainMenu, .6
88 MENU_CALL tLogbook, logbook 87 MENU_CALL tLogbook, logbook
89 MENU_CALL tGasSetup, do_gas_menu 88 MENU_CALL tGasSetup, do_gas_menu
90 MENU_CALL tPlan, do_planner_menu
91 MENU_CALL tDiveModeMenu, do_divemode_menu 89 MENU_CALL tDiveModeMenu, do_divemode_menu
90 MENU_CALL tSimulator, do_simulator_menu
92 MENU_CALL tSystSets, do_settings_menu 91 MENU_CALL tSystSets, do_settings_menu
93 MENU_CALL tExit, do_restart 92 MENU_CALL tExit, do_restart
94 MENU_END 93 MENU_END
95 ENDIF 94 ENDIF
96 95
208 MENU_CALL tBack, do_return_fixed_setpoints 207 MENU_CALL tBack, do_return_fixed_setpoints
209 MENU_END 208 MENU_END
210 209
211 210
212 do_ccr_menu_more: 211 do_ccr_menu_more:
212 IFDEF _external_sensor
213 MENU_BEGIN tCCRSetup, .6 ; CCR/pSCR more menu
214 MENU_OPTION tS8Mode, oS8Mode, 0
215 MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0
216 MENU_OPTION tDilppO2Check, oDilppO2Check, 0
217 MENU_OPTION tPSCR_O2_drop, oPSCR_drop, 0
218 MENU_OPTION tPSCR_lungratio, oPSCR_lungratio, 0
219 MENU_CALL tBack, do_return_ccr_menu
220 MENU_END
221 ELSE
213 MENU_BEGIN tCCRSetup, .5 ; CCR/pSCR more menu 222 MENU_BEGIN tCCRSetup, .5 ; CCR/pSCR more menu
214 MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0 223 MENU_OPTION tCCmaxFracO2, oCCmaxFracO2, 0
215 MENU_OPTION tDilppO2Check, oDilppO2Check, 0 224 MENU_OPTION tDilppO2Check, oDilppO2Check, 0
216 MENU_OPTION tPSCR_O2_drop, oPSCR_drop, 0 225 MENU_OPTION tPSCR_O2_drop, oPSCR_drop, 0
217 MENU_OPTION tPSCR_lungratio, oPSCR_lungratio, 0 226 MENU_OPTION tPSCR_lungratio, oPSCR_lungratio, 0
218 MENU_CALL tBack, do_return_ccr_menu 227 MENU_CALL tBack, do_return_ccr_menu
219 MENU_END 228 MENU_END
229 ENDIF ; _external_sensor
220 230
221 ENDIF ; _ccr_pscr 231 ENDIF ; _ccr_pscr
222 232
223 ;============================================================================= 233 ;=============================================================================
224 ; OC Gas Setup 234 ; OC Gas Setup
361 global do_return_demo_planner 371 global do_return_demo_planner
362 do_return_demo_planner: 372 do_return_demo_planner:
363 call menu_processor_pop ; back to last line 373 call menu_processor_pop ; back to last line
364 bra do_planner_common 374 bra do_planner_common
365 375
366 do_planner_menu: 376 do_simulator_menu:
367 ; ensure correct simulator results after mode changes without prior excursion to surface mode
368 call option_save_all
369
370 ; reset planning parameters to default values 377 ; reset planning parameters to default values
371 lfsr FSR0,odiveInterval 378 lfsr FSR0,odiveInterval
372 call option_reset 379 call option_reset
373 lfsr FSR0,obottomTime 380 lfsr FSR0,obottomTime
374 call option_reset 381 call option_reset
376 call option_reset 383 call option_reset
377 lfsr FSR0,oSimAGF 384 lfsr FSR0,oSimAGF
378 call option_reset 385 call option_reset
379 386
380 IFDEF _gas_contingency 387 IFDEF _gas_contingency
381 ; switch off gas contingency mode by default 388 ; switch off gas contingency mode by default when entering the simulator menu
382 clrf WREG 389 clrf WREG
383 movff WREG,char_I_gas_contingency 390 movff WREG,opt_gas_contingency_sim
384 ENDIF 391 ENDIF
385 392
386 do_planner_common: 393 do_planner_common:
387 call restart_set_modes_and_flags ; initialize dive mode settings 394 call restart_set_modes_and_flags ; initialize dive mode settings
388 do_planner_common_1: 395 do_planner_common_1:
389 movff opt_dive_mode,WREG ; get dive mode: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR 396 movff opt_dive_mode,WREG ; get dive mode: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR
390 dcfsnz WREG,W ; subtract one, became zero? 397 dcfsnz WREG,W ; subtract one, became zero?
391 bra do_planner_common_ccr ; YES - use CCR version 398 bra do_planner_common_ccr ; YES - use CCR version
392 399
393 MENU_BEGIN tPlan, .7 400 MENU_BEGIN tSimulator, .7
394 MENU_OPTION tIntvl, odiveInterval, 0 401 MENU_OPTION tIntvl, odiveInterval, 0
395 MENU_OPTION tBtDep, obottomDepth, 0 402 MENU_OPTION tBtDep, obottomDepth, 0
396 MENU_CALL tInter, do_demo_divemode 403 MENU_CALL tInter, do_demo_divemode
397 MENU_OPTION tBtTm, obottomTime, 0 404 MENU_OPTION tBtTm, obottomTime, 0
398 MENU_OPTION tuseAGF, oSimAGF, 0 405 MENU_OPTION tuseAGF, oSimAGF, 0
399 MENU_CALL tDeco, do_demo_planner 406 MENU_CALL tDeco, do_demo_planner
400 MENU_CALL tBack, do_return_main_menu 407 MENU_CALL tBack, do_return_main_menu
401 MENU_END 408 MENU_END
402 409
403 do_planner_common_ccr: 410 do_planner_common_ccr:
404 MENU_BEGIN tPlan, .7 411 MENU_BEGIN tSimulator, .7
405 MENU_OPTION tIntvl, odiveInterval, 0 412 MENU_OPTION tIntvl, odiveInterval, 0
406 MENU_OPTION tBtDep, obottomDepth, 0 413 MENU_OPTION tBtDep, obottomDepth, 0
407 MENU_CALL tInter, do_demo_divemode 414 MENU_CALL tInter, do_demo_divemode
408 MENU_OPTION tBtTm, obottomTime, 0 415 MENU_OPTION tBtTm, obottomTime, 0
409 MENU_CALL tDecoSetup, do_planner_config 416 MENU_CALL tCalculatorSetup, do_planner_config
410 MENU_CALL tDeco, do_demo_planner 417 MENU_CALL tDeco, do_demo_planner
411 MENU_CALL tBack, do_return_main_menu 418 MENU_CALL tBack, do_return_main_menu
412 MENU_END 419 MENU_END
413 420
414 do_planner_config: 421 do_planner_config:
415 IFDEF _gas_contingency 422 IFDEF _gas_contingency
416 MENU_BEGIN tPlan, .4 423 MENU_BEGIN tSimulator, .4
417 MENU_OPTION tSelectSetpoint, oSimSetpoint, 0 424 MENU_OPTION tSelectSetpoint, oSimSetpoint, 0
418 MENU_OPTION tuseAGF, oSimAGF, 0 425 MENU_OPTION tuseAGF, oSimAGF, 0
419 MENU_OPTION tGasContingency, oGasContingency, 0 426 MENU_OPTION tGasContingencySim, oGasContingencySim, 0
420 MENU_CALL tBack, do_return_planner_menu 427 MENU_CALL tBack, do_return_planner_menu
421 MENU_END 428 MENU_END
422 ELSE 429 ELSE
423 MENU_BEGIN tPlan, .3 430 MENU_BEGIN tSimulator, .3
424 MENU_OPTION tSelectSetpoint, oSimSetpoint, 0 431 MENU_OPTION tSelectSetpoint, oSimSetpoint, 0
425 MENU_OPTION tuseAGF, oSimAGF, 0 432 MENU_OPTION tuseAGF, oSimAGF, 0
426 MENU_CALL tBack, do_return_planner_menu 433 MENU_CALL tBack, do_return_planner_menu
427 MENU_END 434 MENU_END
428 ENDIF 435 ENDIF
433 440
434 do_return_divemode_menu: 441 do_return_divemode_menu:
435 call menu_processor_double_pop ; drop exit line and back to last line 442 call menu_processor_double_pop ; drop exit line and back to last line
436 443
437 do_divemode_menu: 444 do_divemode_menu:
438 MENU_BEGIN tDiveModeMenu, .7 445 MENU_BEGIN tDiveModeMenu, .6
439 MENU_OPTION tDvMode, oDiveMode, 0 446 MENU_CALL tDiveSetup, do_dive_menu ; dive setup
440 MENU_OPTION tDkMode, oDecoMode, 0 447 MENU_CALL tDecoSetup, do_deco_menu ; deco setup
441 MENU_CALL tppO2settings, do_ppo2_menu 448 MENU_CALL tSACSetup, do_SAC_menu ; SAC setup
442 MENU_OPTION tsafetystopmenu, oSafetyStop, 0 449 MENU_CALL tppO2Setup, do_ppo2_menu ; ppO2 limits
443 MENU_CALL tDecoparameters, do_decoparameters_menu 450 MENU_CALL tStopsSetup, do_stops_menu ; stops setup
444 MENU_CALL t2ndDecoPlanMenu, do_2nd_deco_plan_menu
445 MENU_CALL tBack, do_return_main_menu 451 MENU_CALL tBack, do_return_main_menu
446 MENU_END 452 MENU_END
453
454
455 do_dive_menu:
456 IFDEF _cave_mode
457 MENU_BEGIN tDiveModeMenu, .6
458 MENU_OPTION tDvMode, oDiveMode, 0 ; dive mode
459 MENU_OPTION tCvMode, oCaveMode, 0 ; cave mode
460 MENU_OPTION tFTTSMenu, oExtraTime, 0 ; fTTS/delay
461 MENU_OPTION tTimeoutDive, oDiveTimeout, 0 ; dive timeout
462 MENU_OPTION tStoreApnoeDive, oStoreApnoe, 0 ; store apnoe
463 MENU_CALL tBack, do_return_divemode_menu
464 MENU_END
465 ELSE
466 MENU_BEGIN tDiveModeMenu, .5
467 MENU_OPTION tDvMode, oDiveMode, 0 ; dive mode
468 MENU_OPTION tFTTSMenu, oExtraTime, 0 ; fTTS/delay
469 MENU_OPTION tTimeoutDive, oDiveTimeout, 0 ; dive timeout
470 MENU_OPTION tStoreApnoeDive, oStoreApnoe, 0 ; store apnoe
471 MENU_CALL tBack, do_return_divemode_menu
472 MENU_END
473 ENDIF
474
475
476 do_return_deco_menu:
477 call menu_processor_double_pop ; drop exit line and back to last line
478
479 do_deco_menu:
480 MENU_BEGIN tDecoSetup, .6
481 MENU_OPTION tDkMode, oDecoMode, 0 ; ZH-L16 /GF
482 MENU_OPTION tSaturationMult, osatmultgf, 0 ; saturation
483 MENU_OPTION tDesaturationMult, odesatmultgf, 0 ; desaturation
484 MENU_OPTION tAltMode, oAltMode, 0 ; altitude mode
485 MENU_CALL tGFMenu, do_GF_menu ; GF settings
486 MENU_CALL tBack, do_return_divemode_menu
487 MENU_END
488
489
490 do_SAC_menu:
491 IFDEF _gas_contingency
492 MENU_BEGIN tSACSetup, .6
493 MENU_OPTION tCalcGasNeeds, oCalcAscGas, 0 ; calc.gas
494 MENU_OPTION tGasContingencyDive, oGasContingencyDive, 0 ; switch tank if used up
495 MENU_OPTION tGasChangeTime, oGasChangeTime, 0 ; gas change time
496 MENU_OPTION tSetWorkSAC, oWork_SAC, 0 ; work SAC
497 MENU_OPTION tSetDecoSAC, oDeco_SAC, 0 ; deco SAC
498 MENU_CALL tBack, do_return_divemode_menu
499 MENU_END
500 ELSE
501 MENU_BEGIN tSACSetup, .5
502 MENU_OPTION tCalcGasNeeds, oCalcAscGas, 0 ; calc.gas
503 MENU_OPTION tGasChangeTime, oGasChangeTime, 0 ; gas change time
504 MENU_OPTION tSetWorkSAC, oWork_SAC, 0 ; work SAC
505 MENU_OPTION tSetDecoSAC, oDeco_SAC, 0 ; deco SAC
506 MENU_CALL tBack, do_return_divemode_menu
507 MENU_END
508 ENDIF
447 509
448 510
449 do_ppo2_menu: 511 do_ppo2_menu:
450 IFDEF _ccr_pscr 512 IFDEF _ccr_pscr
451 MENU_BEGIN tppO2settings, .6 513 IFDEF _helium
452 MENU_DYNAMIC divesets_ppo2_max, do_toggle_ppo2_max_work 514 MENU_BEGIN tppO2Setup, .6
453 MENU_DYNAMIC divesets_ppo2_max_deco, do_toggle_ppo2_max_deco 515 MENU_DYNAMIC divesets_ppo2_max, do_toggle_ppo2_max_work ; max work
454 MENU_DYNAMIC divesets_ppo2_min, do_toggle_ppo2_min 516 MENU_DYNAMIC divesets_ppo2_max_deco, do_toggle_ppo2_max_deco ; max deco
455 MENU_DYNAMIC divesets_ppo2_min_cc, do_toggle_ppo2_min_cc 517 MENU_DYNAMIC divesets_ppo2_min, do_toggle_ppo2_min ; min OC
456 MENU_OPTION tShowppO2, oShowppO2, 0 518 MENU_DYNAMIC divesets_ppo2_min_cc, do_toggle_ppo2_min_cc ; min loop
519 MENU_OPTION tIBCDwarning, oEnable_IBCD, 0 ; IBCD warning
457 MENU_CALL tBack, do_return_divemode_menu 520 MENU_CALL tBack, do_return_divemode_menu
458 MENU_END 521 MENU_END
459 ELSE 522 ELSE
460 MENU_BEGIN tppO2settings, .5 523 MENU_BEGIN tppO2Setup, .5
461 MENU_DYNAMIC divesets_ppo2_max, do_toggle_ppo2_max_work 524 MENU_DYNAMIC divesets_ppo2_max, do_toggle_ppo2_max_work ; max work
462 MENU_DYNAMIC divesets_ppo2_max_deco, do_toggle_ppo2_max_deco 525 MENU_DYNAMIC divesets_ppo2_max_deco, do_toggle_ppo2_max_deco ; max deco
463 MENU_DYNAMIC divesets_ppo2_min, do_toggle_ppo2_min 526 MENU_DYNAMIC divesets_ppo2_min, do_toggle_ppo2_min ; min OC
464 MENU_OPTION tShowppO2, oShowppO2, 0 527 MENU_DYNAMIC divesets_ppo2_min_cc, do_toggle_ppo2_min_cc ; min loop
465 MENU_CALL tBack, do_return_divemode_menu 528 MENU_CALL tBack, do_return_divemode_menu
466 MENU_END 529 MENU_END
467 ENDIF 530 ENDIF ; _helium
468 531 ELSE
469 532 IFDEF _helium
470 do_return_decoparameters_menu: 533 MENU_BEGIN tppO2Setup, .5
471 call menu_processor_double_pop ; drop exit line and back to last line 534 MENU_DYNAMIC divesets_ppo2_max, do_toggle_ppo2_max_work ; max work
472 535 MENU_DYNAMIC divesets_ppo2_max_deco, do_toggle_ppo2_max_deco ; max deco
473 do_decoparameters_menu: 536 MENU_DYNAMIC divesets_ppo2_min, do_toggle_ppo2_min ; min OC
474 movff char_I_deco_model,lo ; 0 = ZH-L16, 1 = ZH-L16-GF 537 MENU_OPTION tIBCDwarning, oEnable_IBCD, 0 ; IBCD warning
475 tstfsz lo
476 bra do_decoparameters_menu_gf ; <> 0 -> GF menu!
477 ; NON-GF menu
478 MENU_BEGIN tDecoparameters, .6
479 MENU_OPTION tSetBotUse, obottom_usage, 0
480 MENU_OPTION tSetDecoUse, odeco_usage, 0
481 MENU_OPTION tSaturationMult, osatmult, 0
482 MENU_OPTION tDesaturationMult, odesatmult, 0
483 MENU_CALL tMore, do_decoparameters_menu_more
484 MENU_CALL tBack, do_return_divemode_menu 538 MENU_CALL tBack, do_return_divemode_menu
485 MENU_END 539 ELSE
486 540 MENU_BEGIN tppO2Setup, .4
487 do_decoparameters_menu_gf: 541 MENU_DYNAMIC divesets_ppo2_max, do_toggle_ppo2_max_work ; max work
488 ; GF menu 542 MENU_DYNAMIC divesets_ppo2_max_deco, do_toggle_ppo2_max_deco ; max deco
489 MENU_BEGIN tDecoparameters, .7 543 MENU_DYNAMIC divesets_ppo2_min, do_toggle_ppo2_min ; min OC
490 MENU_OPTION tSetBotUse, obottom_usage, 0
491 MENU_OPTION tSetDecoUse, odeco_usage, 0
492 MENU_CALL tGFMenu, do_GF_menu
493 MENU_OPTION tSaturationMult, osatmultgf, 0
494 MENU_OPTION tDesaturationMult, odesatmultgf, 0
495 MENU_CALL tMore, do_decoparameters_menu_more
496 MENU_CALL tBack, do_return_divemode_menu 544 MENU_CALL tBack, do_return_divemode_menu
497 MENU_END 545 MENU_END
498 546 ENDIF ; _helium
499 547 ENDIF ; _ccr_pscr
500 do_decoparameters_menu_more: 548
501 MENU_BEGIN tDecoparameters, .7 549
502 MENU_OPTION tLastDecostop, oLastDeco, 0 550 do_stops_menu:
503 MENU_OPTION tAscentSpeed, oAscentSpeed, 0 551 MENU_BEGIN tStopsSetup, .6
504 MENU_OPTION tGasChangeTime, oGasChangeTime, 0 552 MENU_OPTION tSafetyStop, oSafetyStop, 0 ; safety stop
505 MENU_OPTION tExtendedStops, oExtendedStops, 0 553 MENU_OPTION tExtendedStops, oExtendedStops, 0 ; extended stops
506 MENU_OPTION tTimeoutDive, oDiveTimeout, 0 554 MENU_OPTION tLastDecostop, oLastDeco, 0 ; last deco stop
507 MENU_OPTION tStoreApnoeDive, oStoreApnoeDive, 0 555 MENU_OPTION tDvSalinity, oDiveSalinity, 0 ; salinity
508 MENU_CALL tBack, do_return_decoparameters_menu 556 MENU_OPTION tDepthWarn, oMaxDepth, 0 ; depth limit
509 MENU_END
510
511
512 do_2nd_deco_plan_menu:
513 MENU_BEGIN t2ndDecoPlanMenu, .3
514 MENU_OPTION tFTTSMenu, oExtraTime, 0
515 MENU_OPTION tCalcAscGas, oCalcAscGas, 0
516 MENU_CALL tBack, do_return_divemode_menu 557 MENU_CALL tBack, do_return_divemode_menu
517 MENU_END 558 MENU_END
518 559
519 560
520 do_GF_menu: 561 do_GF_menu:
521 MENU_BEGIN tGFMenu, .6 562 MENU_BEGIN tGFMenu, .6
522 MENU_OPTION tGF_low, oGF_low, 0 563 MENU_OPTION tGF_low, oGF_low, 0 ; GF low
523 MENU_OPTION tGF_high, oGF_high, 0 564 MENU_OPTION tGF_high, oGF_high, 0 ; GF high
524 MENU_OPTION taGF_enable, oEnable_aGF, 0 565 MENU_OPTION taGFenable, oEnable_aGF, 0 ; aGF selectable
525 MENU_OPTION taGF_low, oaGF_low, 0 566 MENU_OPTION taGF_low, oaGF_low, 0 ; aGF low
526 MENU_OPTION taGF_high, oaGF_high, 0 567 MENU_OPTION taGF_high, oaGF_high, 0 ; aGF high
527 MENU_CALL tBack, do_return_decoparameters_menu 568 MENU_CALL tBack, do_return_deco_menu
528 MENU_END 569 MENU_END
529 570
530 571
531 ;============================================================================= 572 ;=============================================================================
532 ; Setup Menu 573 ; Setup Menu
533 do_return_settings_deeper: ; entry point for return from info menu 2 574 do_return_settings_deeper: ; entry point for return from info menu 2
534 call menu_processor_pop ; drop one more stack entry 575 call menu_processor_pop ; drop one more stack entry
535 576
536 do_return_settings: 577 do_return_settings:
537 bcf imprint_time_date ; stop imprinting of current time & date 578 bcf imprint_time_date ; stop imprinting of current time & date
538 call menu_processor_double_pop ; drop exit line and back to last line 579 call menu_processor_double_pop ; drop exit line and back to last line
580
539 IFDEF _rx_mode 581 IFDEF _rx_mode
540 bcf tr_functions_activated ; set TR functions as deactivated by default 582 bcf tr_functions_activated ; set TR functions as deactivated by default
541 btfss ostc_rx_present ; TR model / TR module up & running? 583 btfss ostc_rx_present ; TR model / TR module up & running?
542 bra do_settings_menu ; NO 584 bra do_settings_menu ; NO - use version w/o TR
543 movff opt_TR_mode,WREG ; YES - get TR mode 585 movff opt_TR_mode,WREG ; YES - get TR mode
544 tstfsz WREG ; - TR mode <> off ? 586 tstfsz WREG ; - TR mode <> off ?
545 bsf tr_functions_activated ; YES - set TR functions as activated 587 bsf tr_functions_activated ; YES - set TR functions as activated
546 ENDIF 588 ENDIF
547 589
548 do_settings_menu: 590 do_settings_menu:
549 IFDEF _hwos_sport 591 IFDEF _hwos_sport
550 bsf ble_available ; For very old OSTC sport 592 bsf ble_available ; for very old OSTC sport
551 ENDIF 593 ENDIF
552
553 btfsc ble_available ; BLE available? 594 btfsc ble_available ; BLE available?
554 bra do_settings_menu_ble ; YES 595 bra do_settings_menu_ble ; YES
555 596
556 MENU_BEGIN tSystSets, .5 597 MENU_BEGIN tSystSets, .5
557 MENU_CALL tInfoMenu, do_info_menu 598 MENU_CALL tInfoMenu, do_info_menu
558 MENU_CALL tSetTimeDate, do_date_time_menu 599 MENU_CALL tSetTimeDate, do_date_time_menu
559 MENU_CALL tDispSets, do_dispsets_menu 600 MENU_CALL tDispSets, do_dispsets_menu
560 MENU_CALL tMore, do_settings_menu_more 601 MENU_CALL tSysSets, do_syssets_menu
561 MENU_CALL tBack, do_return_main_menu 602 MENU_CALL tBack, do_return_main_menu
562 MENU_END 603 MENU_END
604
563 605
564 do_settings_menu_ble: 606 do_settings_menu_ble:
565 IFDEF _rx_functions 607 IFDEF _rx_functions
566 btfsc ostc_rx_present ; TR model? 608 btfss ostc_rx_present ; TR model and TR activated?
567 bra do_settings_menu_rx ; YES 609 bra do_settings_menu_noRX ; NO
568 ENDIF 610
569
570 MENU_BEGIN tSystSets, .6
571 MENU_CALL tInfoMenu, do_info_menu
572 MENU_CALL tBleTitle, comm_mode_ble
573 MENU_CALL tSetTimeDate, do_date_time_menu
574 MENU_CALL tDispSets, do_dispsets_menu
575 MENU_CALL tMore, do_settings_menu_more
576 MENU_CALL tBack, do_return_main_menu
577 MENU_END
578
579 IFDEF _rx_functions
580 do_settings_menu_rx:
581 MENU_BEGIN tSystSets, .7 611 MENU_BEGIN tSystSets, .7
582 MENU_CALL tInfoMenu, do_info_menu 612 MENU_CALL tInfoMenu, do_info_menu
583 MENU_CALL tBleTitle, comm_mode_ble 613 MENU_CALL tBleTitle, comm_mode_ble
584 MENU_CALL tTrSettings, do_settings_menu_TR 614 MENU_CALL tTrSettings, do_settings_menu_TR
585 MENU_CALL tSetTimeDate, do_date_time_menu 615 MENU_CALL tSetTimeDate, do_date_time_menu
586 MENU_CALL tDispSets, do_dispsets_menu 616 MENU_CALL tDispSets, do_dispsets_menu
587 MENU_CALL tMore, do_settings_menu_more 617 MENU_CALL tSysSets, do_syssets_menu
588 MENU_CALL tBack, do_return_main_menu 618 MENU_CALL tBack, do_return_main_menu
589 MENU_END 619 MENU_END
590 ENDIF 620 ENDIF
621
622 do_settings_menu_noRX:
623 MENU_BEGIN tSystSets, .6
624 MENU_CALL tInfoMenu, do_info_menu
625 MENU_CALL tBleTitle, comm_mode_ble
626 MENU_CALL tSetTimeDate, do_date_time_menu
627 MENU_CALL tDispSets, do_dispsets_menu
628 MENU_CALL tSysSets, do_syssets_menu
629 MENU_CALL tBack, do_return_main_menu
630 MENU_END
591 631
592 632
593 do_info_menu: 633 do_info_menu:
594 IFDEF _rx_functions 634 IFDEF _rx_functions
595 btfsc ostc_rx_present ; TR model? 635 btfss ostc_rx_present ; TR model?
596 bra do_info_menu_TR ; YES 636 bra do_info_menu_noRX ; NO
597 ENDIF 637
598 638 MENU_BEGIN tInfoMenu, .7
599 MENU_BEGIN tInfoMenu, .6 639 MENU_DYNAMIC info_menu_uptime, 0
600 MENU_DYNAMIC info_menu_serial, 0 640 MENU_DYNAMIC info_menu_serial, 0
601 MENU_DYNAMIC info_menu_firmware, 0 641 MENU_DYNAMIC info_menu_firmware, 0
602 MENU_DYNAMIC info_menu_config, 0 642 MENU_DYNAMIC info_menu_fw_cration_date, 0
603 MENU_DYNAMIC info_menu_battery_volts, 0 643 MENU_DYNAMIC info_menu_firmware_rx, 0
644 MENU_DYNAMIC info_menu_total_dives, 0
645 MENU_CALL tMore, do_info_menu2
646 MENU_END
647 ENDIF
648
649 do_info_menu_noRX:
650 MENU_BEGIN tInfoMenu, .6
604 MENU_DYNAMIC info_menu_uptime, 0 651 MENU_DYNAMIC info_menu_uptime, 0
605 MENU_CALL tMore, do_info_menu2
606 MENU_END
607
608 IFDEF _rx_functions
609 do_info_menu_TR:
610 MENU_BEGIN tInfoMenu, .7
611 MENU_DYNAMIC info_menu_serial, 0 652 MENU_DYNAMIC info_menu_serial, 0
612 MENU_DYNAMIC info_menu_firmware, 0 653 MENU_DYNAMIC info_menu_firmware, 0
613 MENU_DYNAMIC info_menu_firmware_rx, 0 654 MENU_DYNAMIC info_menu_fw_cration_date, 0
655 MENU_DYNAMIC info_menu_total_dives, 0
656 MENU_CALL tMore, do_info_menu2
657 MENU_END
658
659 do_info_menu2:
660 MENU_BEGIN tInfoMenu, .5
661 MENU_DYNAMIC info_menu_battery_volts, 0
614 MENU_DYNAMIC info_menu_config, 0 662 MENU_DYNAMIC info_menu_config, 0
615 MENU_DYNAMIC info_menu_battery_volts, 0 663 MENU_DYNAMIC info_menu_sensor_calib, 0
616 MENU_DYNAMIC info_menu_uptime, 0 664 MENU_DYNAMIC info_menu_sensor_offset, 0
617 MENU_CALL tMore, do_info_menu2
618 MENU_END
619 ENDIF
620
621 do_info_menu2: ;same for all hardware versions
622 MENU_BEGIN tInfoMenu, .2
623 MENU_DYNAMIC info_menu_total_dives, 0
624 MENU_CALL tBack, do_return_settings_deeper 665 MENU_CALL tBack, do_return_settings_deeper
625 MENU_END 666 MENU_END
626 667
627
628 668
629 IFDEF _rx_functions 669 IFDEF _rx_functions
630 670
631 do_settings_menu_TR: 671 do_settings_menu_TR:
632 movff opt_dive_mode,WREG ; get dive mode: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR 672 movff opt_dive_mode,WREG ; get dive mode: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR
694 call menu_processor_pop ; drop one more stack entry 734 call menu_processor_pop ; drop one more stack entry
695 735
696 do_return_settings_more: 736 do_return_settings_more:
697 call menu_processor_double_pop ; drop exit line and back to last line 737 call menu_processor_double_pop ; drop exit line and back to last line
698 738
699 do_settings_menu_more: 739 do_syssets_menu:
700 btfsc battery_gauge_available ; piezo buttons available? 740 btfsc battery_gauge_available ; piezo buttons available?
701 bra do_settings_menu_more_piezo ; YES 741 bra do_syssets_menu_piezo ; YES
702 742
703 IFDEF _compass 743 IFDEF _compass
704 MENU_BEGIN tSystSets, .6 ; All MENU_CALLs 744 MENU_BEGIN tSystSets, .4 ; All MENU_CALLs in this menu
705 MENU_CALL tCompassMenu, do_compass_menu ; in this menu need to 745 MENU_CALL tCompassMenu, do_compass_menu ; need to stay together on this
706 MENU_CALL tLogOffset, do_log_offset_menu ; stay together on this 746 MENU_CALL tLogOffset, do_log_offset_menu ; menu level in order to not
707 MENU_OPTION tAltMode, oAltMode, 0 ; menu level in order to 747 MENU_CALL tResetMenu, do_reset_menu ; mess up the menu stack on doing
708 MENU_OPTION tDvSalinity, oDiveSalinity, 0 ; not mess up the menu 748 MENU_CALL tBack, do_return_settings ; the do_return_settings !
709 MENU_CALL tResetMenu, do_reset_menu ; stack on doing the 749 MENU_END
710 MENU_CALL tBack, do_return_settings ; do_return_settings ! 750 ELSE
711 MENU_END 751 MENU_BEGIN tSystSets, .3 ; see above
712 ELSE
713 MENU_BEGIN tSystSets, .5 ; see above
714 MENU_CALL tLogOffset, do_log_offset_menu ; 752 MENU_CALL tLogOffset, do_log_offset_menu ;
715 MENU_OPTION tAltMode, oAltMode, 0 ;
716 MENU_OPTION tDvSalinity, oDiveSalinity, 0 ;
717 MENU_CALL tResetMenu, do_reset_menu ; 753 MENU_CALL tResetMenu, do_reset_menu ;
718 MENU_CALL tBack, do_return_settings ; 754 MENU_CALL tBack, do_return_settings ;
719 MENU_END 755 MENU_END
720 ENDIF ; _compass 756 ENDIF ; _compass
721 757
722 758
723 do_return_settings_menu_more_pz: 759 do_return_syssets_menu_piezo:
724 call TFT_ClearScreen 760 call TFT_ClearScreen
725 call piezo_config ; configure buttons 761 call piezo_config ; configure buttons
726 call menu_processor_double_pop ; drop exit line and back to last line 762 call menu_processor_double_pop ; drop exit line and back to last line
727 763
728 do_settings_menu_more_piezo: 764 do_syssets_menu_piezo:
729 IFDEF _compass 765 IFDEF _compass
730 MENU_BEGIN tSystSets, .7 766 MENU_BEGIN tSystSets, .6
731 MENU_CALL tCompassMenu, do_compass_menu ; see above 767 MENU_CALL tCompassMenu, do_compass_menu ; see above
732 MENU_CALL tLogOffset, do_log_offset_menu ; 768 MENU_CALL tLogOffset, do_log_offset_menu ;
733 MENU_OPTION tAltMode, oAltMode, 0 ; 769 MENU_DYNAMIC info_menu_total_dives, 0
734 MENU_OPTION tDvSalinity, oDiveSalinity, 0 ;
735 MENU_CALL tResetMenu, do_reset_menu ; 770 MENU_CALL tResetMenu, do_reset_menu ;
736 MENU_CALL tMore, do_settings_piezo_menu ; 771 MENU_CALL tPiezo, do_settings_piezo_menu ;
737 MENU_CALL tBack, do_return_settings ; 772 MENU_CALL tBack, do_return_settings ;
738 MENU_END 773 MENU_END
739 ELSE 774 ELSE
740 MENU_BEGIN tSystSets, .6 775 MENU_BEGIN tSystSets, .5
741 MENU_CALL tLogOffset, do_log_offset_menu ; see above 776 MENU_CALL tLogOffset, do_log_offset_menu ; see above
742 MENU_OPTION tAltMode, oAltMode, 0 ; 777 MENU_DYNAMIC info_menu_total_dives, 0
743 MENU_OPTION tDvSalinity, oDiveSalinity, 0 ;
744 MENU_CALL tResetMenu, do_reset_menu ; 778 MENU_CALL tResetMenu, do_reset_menu ;
745 MENU_CALL tMore, do_settings_piezo_menu ; 779 MENU_CALL tPiezo, do_settings_piezo_menu ;
746 MENU_CALL tBack, do_return_settings ; 780 MENU_CALL tBack, do_return_settings ;
747 MENU_END 781 MENU_END
748 ENDIF 782 ENDIF
749 783
750 784
751 do_settings_piezo_menu: 785 do_settings_piezo_menu:
752 ; Menu with features only available in piezo button hardware 786 ; Menu with features only available in piezo button hardware
753 MENU_BEGIN tSystSets, .3 787 MENU_BEGIN tPiezo, .3
754 MENU_OPTION tButtonleft, ocR_button_left, 0 ; left button sensitivity 788 MENU_OPTION tButtonleft, ocR_button_left, 0 ; left button sensitivity
755 MENU_OPTION tButtonright, ocR_button_right, 0 ; right button sensitivity 789 MENU_OPTION tButtonright, ocR_button_right, 0 ; right button sensitivity
756 MENU_CALL tBack, do_return_settings_menu_more_pz 790 MENU_CALL tBack, do_return_syssets_menu_piezo
757 MENU_END 791 MENU_END
758 792
759 793
760 IFDEF _compass 794 IFDEF _compass
761 795
762 do_compass_menu: 796 do_compass_menu:
763 MENU_BEGIN tSystSets, .5 797 MENU_BEGIN tCompassMenu, .5
764 MENU_CALL tCompassMenu, compass_calibration_loop ; exits to surface loop 798 MENU_CALL tCompassMenu, compass_calibration_loop ; exits to surface loop
765 ; MENU_OPTION tCompassGain, oCompassGain, 0 799 ; MENU_OPTION tCompassGain, oCompassGain, 0
766 MENU_DYNAMIC menu_cal_x, 0 800 MENU_DYNAMIC menu_cal_x, 0
767 MENU_DYNAMIC menu_cal_y, 0 801 MENU_DYNAMIC menu_cal_y, 0
768 MENU_DYNAMIC menu_cal_z, 0 802 MENU_DYNAMIC menu_cal_z, 0
809 MENU_CALL tResetLogbook, do_reset_logbook ; reset logbook and return to main reset menu 843 MENU_CALL tResetLogbook, do_reset_logbook ; reset logbook and return to main reset menu
810 MENU_END 844 MENU_END
811 845
812 846
813 do_reset_logbook: 847 do_reset_logbook:
814 clrf EEADRH ; make sure to select EEPROM bank 0 848 call erase_complete_logbook ; erase complete logbook
815 clrf EEDATA
816 read_int_eeprom .2
817 write_int_eeprom .16
818 read_int_eeprom .3
819 write_int_eeprom .17 ; copy number of dives
820 clrf EEDATA
821 write_int_eeprom .2
822 write_int_eeprom .3 ; clear total dives
823 write_int_eeprom .4
824 write_int_eeprom .5
825 write_int_eeprom .6 ; reset logbook pointers
826 call ext_flash_erase_logbook ; and complete logbook
827 bra do_return_settings_more_deeper 849 bra do_return_settings_more_deeper
828
829 850
830 do_reset_deco: 851 do_reset_deco:
831 call deco_clear_tissue ; set all tissues to absolute pressure * N2_ratio (C-code) 852 call deco_clear_tissue ; set all tissues to absolute pressure * N2_ratio (C-code)
832 call deco_calc_dive_interval_1min ; update tissues by 1 minute to calculate current GF factor (C-code) 853 call deco_calc_dive_interval_1min ; update tissues by 1 minute to calculate current GF factor (C-code)
833 call deco_calc_desaturation_time ; calculate desaturation and no-fly/no-altitude time (C-code) 854 call deco_calc_desaturation_time ; calculate desaturation and no-fly/no-altitude time (C-code)
834 banksel common 855 banksel common
835 call vault_decodata_into_eeprom ; store updated deco data to EEPROM 856 call eeprom_deco_data_write ; store updated deco data into EEPROM
836 bra do_return_settings_more_deeper 857 bra do_return_settings_more_deeper
837 858
838 859
839 do_reset_settings: 860 do_reset_settings:
840 call TFT_ClearScreen ; clear screen 861 call TFT_ClearScreen ; clear screen to show start of activity
841 call option_reset_all ; reset all options to factory default 862 call option_reset_all ; reset all options to factory default
842 call do_logoffset_reset ; reset log offset 863 call do_logoffset_reset ; reset log offset
843 goto restart ; restart into surface mode 864 goto restart ; restart into surface mode
844 865
845 do_reboot: 866 do_reboot:
846 call ext_flash_enable_protection ; set write protection on external EEPROM 867 call ext_flash_enable_protection ; set write protection on external flash
847 call rtc_init ; reset the real time clock (will reset to firmware creation date) 868 call eeprom_deco_data_write ; update deco data in EEPROM
848 reset 869 call eeprom_battery_gauge_write ; update battery gauge in EEPROM
870 btfsc options_changed ; do the options need to be stored to EEPROM ?
871 call option_check_and_store_all ; YES - check and store all option values in EEPROM
872 reset ; cold-start the processor
849 873
850 do_return_date_time_menu: 874 do_return_date_time_menu:
851 call menu_processor_double_pop ; drop exit line and back to last line 875 call menu_processor_double_pop ; drop exit line and back to last line
852 876
853 do_date_time_menu: 877 do_date_time_menu:
882 MENU_OPTION tSetSeconds, oClearSeconds, 0 906 MENU_OPTION tSetSeconds, oClearSeconds, 0
883 MENU_CALL tBack, do_return_date_time_menu 907 MENU_CALL tBack, do_return_date_time_menu
884 MENU_END 908 MENU_END
885 909
886 910
887 do_toggle_ppo2_max_work: ; add 0.1 bar, with hard-coded max. 911 do_toggle_ppo2_max_work: ; add 0.1 bar
888 movff char_I_ppO2_max_work,lo ; bank-safe copy 912 movff char_I_ppO2_max_work,lo ; bank-safe copy
889 movlw .10 913 movlw .10
890 addwf lo,F 914 addwf lo,F
891 movlw ppo2_warning_high_highest 915 movlw ppo2_warning_high_highest
892 cpfsgt lo 916 cpfsgt lo
895 movwf lo 919 movwf lo
896 do_toggle_ppo2_max2: 920 do_toggle_ppo2_max2:
897 movff lo,char_I_ppO2_max_work 921 movff lo,char_I_ppO2_max_work
898 return 922 return
899 923
900 do_toggle_ppo2_max_deco: ; add 0.1 bar, with hard-coded max. 924 do_toggle_ppo2_max_deco: ; add 0.1 bar
901 movff char_I_ppO2_max_deco,lo ; bank-safe copy 925 movff char_I_ppO2_max_deco,lo ; bank-safe copy
902 movlw .10 926 movlw .10
903 addwf lo,F 927 addwf lo,F
904 movlw ppo2_warning_deco_highest 928 movlw ppo2_warning_deco_highest
905 cpfsgt lo 929 cpfsgt lo
908 movwf lo 932 movwf lo
909 do_toggle_ppo2_max_deco2: 933 do_toggle_ppo2_max_deco2:
910 movff lo,char_I_ppO2_max_deco 934 movff lo,char_I_ppO2_max_deco
911 return 935 return
912 936
913 do_toggle_ppo2_min: ; sub 0.1 bar, with hard-coded min. 937 do_toggle_ppo2_min: ; sub 0.1 bar
914 movff char_I_ppO2_min,lo ; bank-safe copy 938 movff char_I_ppO2_min,lo ; bank-safe copy
915 incf lo,F 939 incf lo,F
916 movlw ppo2_warning_low_highest 940 movlw ppo2_warning_low_highest
917 cpfsgt lo 941 cpfsgt lo
918 bra do_toggle_ppo2_min2 942 bra do_toggle_ppo2_min2
920 movwf lo 944 movwf lo
921 do_toggle_ppo2_min2: 945 do_toggle_ppo2_min2:
922 movff lo,char_I_ppO2_min 946 movff lo,char_I_ppO2_min
923 return 947 return
924 948
925 do_toggle_ppo2_min_cc: ; sub 0.1 bar, with hard-coded min. 949 do_toggle_ppo2_min_cc: ; sub 0.1 bar
926 movff char_I_ppO2_min_loop,lo ; bank-safe copy 950 movff char_I_ppO2_min_loop,lo ; bank-safe copy
927 incf lo,F 951 incf lo,F
928 movlw ppo2_warning_loop_highest 952 movlw ppo2_warning_loop_highest
929 cpfsgt lo 953 cpfsgt lo
930 bra do_toggle_ppo2_min_cc2 954 bra do_toggle_ppo2_min_cc2
949 MENU_CALL tBack, do_return_settings_more 973 MENU_CALL tBack, do_return_settings_more
950 MENU_END 974 MENU_END
951 975
952 976
953 do_logoffset_common: 977 do_logoffset_common:
954 call do_logoffset_common_read ; read current offset into mpr+1:mpr+0 978 call eeprom_log_offset_read ; read current offset into mpr+1:mpr+0
955 movff opt_logoffset_step,ul ; get step size: 0=1, 1=10, 2=100, 3=1000 979 movff opt_logoffset_step,ul ; get step size: 0=1, 1=10, 2=100, 3=1000
956 incf ul,F ; 0...3 -> 1...4 980 incf ul,F ; 0...3 -> 1...4
957 clrf mpr+3 ; clear step size, high byte 981 clrf mpr+3 ; clear step size, high byte
958 movlw .1 ; set a step size of 1 982 movlw .1 ; set a step size of 1
959 movwf mpr+2 ; copy to step size, low byte 983 movwf mpr+2 ; copy to step size, low byte
998 subwfb mpr+1,F ; subtract from offset, high byte, considering borrow flag 1022 subwfb mpr+1,F ; subtract from offset, high byte, considering borrow flag
999 ; check if new offset is within limit 1023 ; check if new offset is within limit
1000 btfsc STATUS,C ; borrow to propagate (B == /CARRY) ? 1024 btfsc STATUS,C ; borrow to propagate (B == /CARRY) ?
1001 bra do_logoffset_exit ; NO - result >= 0, store and return 1025 bra do_logoffset_exit ; NO - result >= 0, store and return
1002 do_logoffset_reset: 1026 do_logoffset_reset:
1003 clrf mpr+0 ; YES - revert offset to 0, low byte 1027 CLRI mpr ; YES - revert offset to 0
1004 clrf mpr+1 ; - ... high byte
1005 ;bra do_logoffset_exit ; - store offset and return 1028 ;bra do_logoffset_exit ; - store offset and return
1006 1029
1007 do_logoffset_exit: 1030 do_logoffset_exit:
1008 goto do_logoffset_common_write ; store offset and return 1031 goto eeprom_log_offset_write ; store offset and return
1009 1032
1010 1033
1011 do_return_dispsets_menu: 1034 do_return_dispsets_menu:
1012 bcf imprint_color_schemes ; not in color schemes menu any more 1035 bcf imprint_color_schemes ; not in color schemes menu any more
1013 call menu_processor_double_pop ; drop exit line and back to last line 1036 call menu_processor_double_pop ; drop exit line and back to last line
1014 1037
1015 do_dispsets_menu: 1038 do_dispsets_menu:
1016 IF _language_2!=none 1039 IF _language_2!=none
1017 MENU_BEGIN tDispSets, .7 1040 MENU_BEGIN tDispSets, .7
1018 MENU_OPTION tBright, oBrightness, 0 1041 MENU_OPTION tBright, oBrightness, 0
1042 MENU_OPTION tLayout, oLayout, 0
1043 MENU_OPTION tUnits, oUnits, 0
1019 MENU_OPTION tLanguage, oLanguage, 0 1044 MENU_OPTION tLanguage, oLanguage, 0
1020 MENU_OPTION tUnits, oUnits, 0 1045 MENU_OPTION tFlip, oFlipScreen, 0
1021 MENU_CALL tColorScheme, do_color_scheme 1046 MENU_CALL tColorScheme, do_color_scheme
1022 MENU_OPTION tFlip, oFlipScreen, 0
1023 MENU_CALL tMore, do_dispsets_menu_more 1047 MENU_CALL tMore, do_dispsets_menu_more
1024 MENU_CALL tBack, do_return_settings
1025 MENU_END 1048 MENU_END
1026 ELSE 1049 ELSE
1027 MENU_BEGIN tDispSets, .6 1050 MENU_BEGIN tDispSets, .6
1028 MENU_OPTION tBright, oBrightness, 0 1051 MENU_OPTION tBright, oBrightness, 0
1052 MENU_OPTION tLayout, oLayout, 0
1029 MENU_OPTION tUnits, oUnits, 0 1053 MENU_OPTION tUnits, oUnits, 0
1054 MENU_OPTION tFlip, oFlipScreen, 0
1030 MENU_CALL tColorScheme, do_color_scheme 1055 MENU_CALL tColorScheme, do_color_scheme
1031 MENU_OPTION tFlip, oFlipScreen, 0
1032 MENU_CALL tMore, do_dispsets_menu_more 1056 MENU_CALL tMore, do_dispsets_menu_more
1033 MENU_CALL tBack, do_return_settings
1034 MENU_END 1057 MENU_END
1035 ENDIF 1058 ENDIF
1036 1059
1037 1060
1038 do_dispsets_menu_more: 1061 do_dispsets_menu_more:
1039 IFDEF _helium 1062 IFDEF _helium
1040 MENU_BEGIN tDispSets, .7 1063 MENU_BEGIN tDispSets, .7
1041 MENU_OPTION tMODwarning, oMODwarning, 0
1042 ; MENU_OPTION tIBCDwarning, oEnable_IBCD, 0 ; taken out in favor of option oLayout
1043 MENU_OPTION tVSItext2, oVSItextv2, 0
1044 MENU_OPTION tVSIgraph, oVSIgraph, 0 1064 MENU_OPTION tVSIgraph, oVSIgraph, 0
1045 MENU_OPTION tLayout, oLayout, 0 1065 MENU_OPTION tVSItext2, oVSItext, 0
1066 MENU_OPTION tShowppO2, oShowppO2, 0
1067 MENU_OPTION tDepthWarning, oDepthWarn, 0
1046 MENU_OPTION t2ndDepth, o2ndDepthDisp, 0 1068 MENU_OPTION t2ndDepth, o2ndDepthDisp, 0
1047 MENU_OPTION tTissueGraphics, oTissueGraphics, 0 1069 MENU_OPTION tTissueGraphics, oTissueGraphics, 0
1048 MENU_CALL tBack, do_return_dispsets_menu 1070 MENU_CALL tBack, do_return_settings_deeper
1049 MENU_END 1071 MENU_END
1050 ELSE 1072 ELSE
1051 MENU_BEGIN tDispSets, .6 1073 MENU_BEGIN tDispSets, .6
1052 MENU_OPTION tMODwarning, oMODwarning, 0
1053 ; MENU_OPTION tIBCDwarning, oEnable_IBCD, 0 ; taken out in favor of option oLayout
1054 MENU_OPTION tVSItext2, oVSItextv2, 0
1055 MENU_OPTION tVSIgraph, oVSIgraph, 0 1074 MENU_OPTION tVSIgraph, oVSIgraph, 0
1056 MENU_OPTION tLayout, oLayout, 0 1075 MENU_OPTION tVSItext2, oVSItext, 0
1076 MENU_OPTION tShowppO2, oShowppO2, 0
1077 MENU_OPTION tDepthWarning, oDepthWarn, 0
1057 MENU_OPTION t2ndDepth, o2ndDepthDisp, 0 1078 MENU_OPTION t2ndDepth, o2ndDepthDisp, 0
1058 MENU_CALL tBack, do_return_dispsets_menu 1079 MENU_CALL tBack, do_return_settings_deeper
1059 MENU_END 1080 MENU_END
1060 ENDIF 1081 ENDIF
1061 1082
1062 1083
1063 do_color_scheme: 1084 do_color_scheme:
1088 ; make sure to reset battery percentage 1109 ; make sure to reset battery percentage
1089 movlw .100 1110 movlw .100
1090 movwf batt_percent ; set battery level to full 1111 movwf batt_percent ; set battery level to full
1091 1112
1092 ; default (in cases of timeout or USB): use old battery 1113 ; default (in cases of timeout or USB): use old battery
1093 call retrieve_battery_registers ; retrieve stored battery gauge value from EEPROM 1114 call eeprom_battery_gauge_read ; retrieve stored battery gauge value from EEPROM
1094 1115
1095 IFDEF _screendump 1116 IFDEF _screendump
1096 bsf screen_dump_avail ; enable screen dump function to prevent exiting into COMM mode immediately 1117 bsf screen_dump_avail ; enable screen dump function to prevent exiting into COMM mode immediately
1097 ELSE 1118 ELSE
1098 bsf comm_mode_disabled ; disable COMM mode to prevent exiting into COMM mode immediately 1119 bsf comm_mode_disabled ; disable COMM mode to prevent exiting into COMM mode immediately
1191 MENU_END 1212 MENU_END
1192 1213
1193 1214
1194 global use_old_prior_209 1215 global use_old_prior_209
1195 use_old_prior_209: 1216 use_old_prior_209:
1196 clrf EEADRH 1217 EEPROM_CC_READ eeprom_battery_type,WREG ; read battery type from EEPROM
1197 read_int_eeprom 0x0F ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah 1218 incfsz WREG,W ; battery type = 0xFF (undefined) ?
1198 incfsz EEDATA,F ; was 0xFF? 1219 return ; NO - done
1199 return ; NO - done 1220 call lt2942_get_status ; YES - check for gauge IC
1200 1221 movlw .3 ; - default to a 18650 (LiIon 3.7V/3.1Ah)
1201 call lt2942_get_status ; check for gauge IC 1222 btfss battery_gauge_available ; - OSTC 2 or cR hardware?
1202 movlw .3 ; Assume a 18650 1223 movlw .1 ; - NO - assume a Saft (disposable 3.6 V)
1203 btfss battery_gauge_available ; cR/2 hardware? 1224 EEPROM_CC_WRITE WREG,eeprom_battery_type; - write battery type to EEPROM
1204 movlw .1 ; assume a Saft 1225 return ; - done
1205 movwf EEDATA
1206 write_int_eeprom 0x0F ; store the new battery type into EEPROM
1207 return
1208 1226
1209 1227
1210 use_old_batteries: 1228 use_old_batteries:
1211 rcall get_battery_data ; load data of old battery 1229 rcall get_battery_data ; load data of old battery
1212 goto surfloop ; proceed to surface loop 1230 goto surfloop ; proceed to surface loop
1213 1231
1214 1232
1215 global get_battery_data 1233 global get_battery_data
1216 get_battery_data: 1234 get_battery_data:
1217 call retrieve_battery_registers ; retrieve stored battery gauge value from EEPROM 1235 call eeprom_battery_gauge_read ; retrieve stored battery gauge value from EEPROM
1218 movff battery_type,lo ; copy retrieved battery type to lo 1236 movff battery_type,lo ; copy retrieved battery type to lo
1219 rcall setup_new_saft ; default battery configuration 1237 rcall setup_new_saft ; default battery configuration
1220 incf lo,F ; (0-4) -> (1-5) 1238 incf lo,F ; (0-4) -> (1-5)
1221 dcfsnz lo,F 1239 dcfsnz lo,F
1222 rcall setup_new_15v ; =0 1240 rcall setup_new_15v ; =0
1298 rcall setup_new_saft 1316 rcall setup_new_saft
1299 bra use_batt_exit 1317 bra use_batt_exit
1300 1318
1301 use_37V_rechargeable: 1319 use_37V_rechargeable:
1302 rcall setup_new_panasonic 1320 rcall setup_new_panasonic
1303 call reset_battery_internal_only 1321 call reset_battery_gauge
1304 bra use_batt_exit_1 1322 bra use_batt_exit_1
1305 1323
1306 use_16650_battery: 1324 use_16650_battery:
1307 rcall setup_new_16650 1325 rcall setup_new_16650
1308 bra use_batt_exit 1326 bra use_batt_exit
1310 use_18650_battery: 1328 use_18650_battery:
1311 rcall setup_new_18650 1329 rcall setup_new_18650
1312 ;bra use_batt_exit 1330 ;bra use_batt_exit
1313 1331
1314 use_batt_exit: 1332 use_batt_exit:
1315 call reset_battery_pointer ; reset battery pointer 0x07-0x0C and battery gauge 1333 call reset_battery_gauge_and_lt2942 ; reset battery pointer 0x07-0x0C and battery gauge
1316 use_batt_exit_1: 1334 use_batt_exit_1:
1317 IFNDEF _screendump 1335 IFNDEF _screendump
1318 bcf comm_mode_disabled ; re-enable COMM mode again 1336 bcf comm_mode_disabled ; re-enable COMM mode again
1319 ENDIF 1337 ENDIF
1320 goto surfloop ; jump to surface loop 1338 goto surfloop ; jump to surface loop