annotate src/divemenu_tree.asm @ 632:0347acdf6d8e

changelog updates
author heinrichsweikamp
date Sat, 29 Feb 2020 16:57:45 +0100
parents 185ba2f91f59
children 4050675965ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
3 ; File divemenu_tree.asm combined next generation V3.08.8
0
heinrichsweikamp
parents:
diff changeset
4 ;
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 249
diff changeset
5 ; OSTC dive mode menu
0
heinrichsweikamp
parents:
diff changeset
6 ;
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all rights reserved.
0
heinrichsweikamp
parents:
diff changeset
8 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
9 ; HISTORY
heinrichsweikamp
parents:
diff changeset
10 ; 2013-02-02 : [mH] Made out of menu_tree.asm
heinrichsweikamp
parents:
diff changeset
11
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
12 #include "hwos.inc" ; Mandatory header
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
13 #include "menu_processor.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
14 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
15 #include "tft_outputs.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
16 #include "customview.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
17 #include "strings.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
18 #include "calibrate.inc"
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
19
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
20 extern timeout_divemode_menu2
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
21 extern restart_deco_engine_wo_ceiling
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
22 extern diveloop_menu_exit
0
heinrichsweikamp
parents:
diff changeset
23
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
24
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
25 dmenu_tree CODE
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
26
0
heinrichsweikamp
parents:
diff changeset
27 ;=============================================================================
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
28 ;
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
29 ; Dive Mode Menu
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
30 ;
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
31
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
32 do_return_main_divemenu:
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
33 call menu_processor_double_pop ; drop exit line and back to last line
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
34 incf selected_item,W ; item numbers start with 0, menu positions with 1
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
35 movwf menu_pos_cur ; position cursor where we came from
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
36 bra do_main_divemenu_common
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
37
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
38 global do_main_divemenu
0
heinrichsweikamp
parents:
diff changeset
39 do_main_divemenu:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
40 movff active_customview,backup_customview ; back up current custom view
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
41 call menu_processor_reset ; restart from first icon
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
42 movlw .1 ; set cursor to first menu item
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
43 movwf menu_pos_cur ; ...
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
44
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
45 do_main_divemenu_common:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
46 IFDEF _ccr_pscr
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
47 btfsc FLAG_ccr_mode
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
48 bra main_divemenu_loop ; goto CCR / pSCR Menu menu
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
49 btfsc FLAG_pscr_mode
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
50 bra main_divemenu_loop ; goto CCR / pSCR Menu menu
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
51 ENDIF
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
52
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
53 main_divemenu_OC:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
54 IFDEF _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
55 bcf is_diluent_menu ; selecting OC gases ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
56 bcf is_bailout_menu ; ... not for bailout reason
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
57 ENDIF
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
58
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
59 IFDEF _cave_mode
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
60 TSTOSS opt_cave_mode ; cave mode switched on?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
61 bra main_divemenu_OC_nocave ; NO - use version without cave mode entry
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
62 ;bra main_divemenu_OC_cave ; YES - use version with cave mode entry
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
63
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
64 main_divemenu_OC_cave:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
65 MENU_BEGIN tMainMenu, .6
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
66 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
67 MENU_CALL tDivemenu_ResetAvg, do_reset_average
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
68 MENU_DYNAMIC label_do_toggle_gf, do_toggle_gf
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
69 MENU_CALL tDivemenu_Marker, do_set_marker
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
70 MENU_CALL tCaveMode, do_main_cavemenu
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
71 MENU_CALL tExit, do_exit_divemode_menu
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
72 MENU_END
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
73 ENDIF
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
74
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
75 main_divemenu_OC_nocave:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
76 MENU_BEGIN tMainMenu, .5
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
77 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
78 MENU_CALL tDivemenu_ResetAvg, do_reset_average
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
79 MENU_DYNAMIC label_do_toggle_gf, do_toggle_gf
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
80 MENU_CALL tDivemenu_Marker, do_set_marker
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
81 MENU_CALL tExit, do_exit_divemode_menu
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
82 MENU_END
0
heinrichsweikamp
parents:
diff changeset
83
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
84
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
85 ;=============================================================================
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
86
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
87 IFDEF _ccr_pscr
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
88
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
89 main_divemenu_loop:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
90 bsf is_diluent_menu ; selecting diluents ...
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
91 bcf is_bailout_menu ; ... (definitely) not for bailout reason
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
92 btfsc FLAG_pscr_mode ; in pSCR mode?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
93 bra main_divemenu_pscr ; YES - show pSCR menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
94
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
95 MENU_BEGIN tMainMenu, .6
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
96 MENU_CALL tDiveBailout, do_divemode_gaslist_bail
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
97 MENU_CALL tDivemenu_Setpoint, do_divemode_splist
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
98 MENU_CALL tDivemenu_Diluent, do_divemode_gaslist
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
99 MENU_CALL tDivemenu_Avg_Mkr, do_reset_avg_set_mkr
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
100 MENU_DYNAMIC label_do_toggle_gf, do_toggle_gf
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
101 MENU_CALL tExit, do_exit_divemode_menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
102 MENU_END
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
103
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
104
485
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
105 main_divemenu_pscr:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
106 IFDEF _external_sensor
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
107 btfsc analog_o2_input ; do we have an analog input (OSTC cR)?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
108 bra main_divemenu_pscr_sensors ; YES - do menu with calibration
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
109 btfsc optical_input ; do we have an optical input (OSTC 3)?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
110 bra main_divemenu_pscr_sensors ; YES - do menu with calibration
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
111 ENDIF
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
112
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
113 main_divemenu_pscr_no_sensors:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
114 MENU_BEGIN tMainMenu, .6
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
115 MENU_CALL tDiveBailout, do_divemode_gaslist_bail
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
116 MENU_CALL tDivemenu_Premix, do_divemode_gaslist
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
117 MENU_CALL tBackToLoop, do_switch_sp_calc
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
118 MENU_CALL tDivemenu_Avg_Mkr, do_reset_avg_set_mkr
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
119 MENU_DYNAMIC label_do_toggle_gf, do_toggle_gf
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
120 MENU_CALL tExit, do_exit_divemode_menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
121 MENU_END
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
122
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
123 main_divemenu_pscr_sensors:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
124 IFDEF _external_sensor
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
125 MENU_BEGIN tMainMenu, .6
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
126 MENU_CALL tDiveBailout, do_divemode_gaslist_bail
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
127 MENU_CALL tCCRSensor, do_divemode_setpoint_pscr
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
128 MENU_CALL tDivemenu_Premix, do_divemode_gaslist
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
129 MENU_CALL tDivemenu_Avg_Mkr, do_reset_avg_set_mkr
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
130 MENU_DYNAMIC label_do_toggle_gf, do_toggle_gf
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
131 MENU_CALL tExit, do_exit_divemode_menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
132 MENU_END
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
133 ENDIF ; _external_sensor
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
134
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
135 ENDIF ; _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
136
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
137 ;=============================================================================
0
heinrichsweikamp
parents:
diff changeset
138
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
139
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
140 do_return_toggle_gf:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
141 call menu_processor_pop ; drop selection from menu stack
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
142 bra do_toggle_gf_1 ; re-draw the custom view and enter the menu again
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
143
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
144 do_toggle_gf:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
145 TSTOSS char_I_model ; toggle GF only in GF modes - in GF mode? (0 = ZH-L16, 1 = ZH-L16-GF)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
146 bra do_main_divemenu_common ; NO - do nothing and return
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
147 TSTOSS opt_enable_aGF ; =1: aGF can be selected underwater
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
148 bra do_main_divemenu_common ; NO - do nothing and return
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
149 bsf custom_view_locked ; lock custom view
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
150 do_toggle_gf_1:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
151 movlw index_gf_factors ; get number of GF factors custom view
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
152 movwf active_customview ; set custom view number
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
153 call dive_customview_callup ; draw custom view
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
154 movlw .1 ; set to first option in dive mode menu
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
155 movwf menu_pos_cur ; ...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
156
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
157 MENU_BEGIN tDivemenu_ToggleGF, .2
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
158 MENU_CALL tDivemenu_ToggleGF, do_toggle_gf_toggle
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
159 MENU_CALL tExit, do_exit_divemode_menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
160 MENU_END
0
heinrichsweikamp
parents:
diff changeset
161
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
162 do_toggle_gf_toggle:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
163 bsf request_toggle_GF ; set request flag to have the deco engine restarted
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
164 btg use_aGF ; toggle normal / alternative GF factor selection
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
165 btfsc use_aGF ; alternative GF factors activated?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
166 bra do_togglegf_agf ; YES - branch to using alternative GF
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
167 ;bra do_togglegf_ngf ; NO - branch to using normal GF
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
168
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
169 do_togglegf_ngf:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
170 movff opt_GF_low, char_I_GF_Low_percentage ; use normal GF factor low
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
171 movff opt_GF_high,char_I_GF_High_percentage ; use normal GF factor high
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
172 bra do_return_toggle_gf ; back to menu
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
173
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
174 do_togglegf_agf:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
175 movff opt_aGF_low, char_I_GF_Low_percentage ; use alternative GF factor low
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
176 movff opt_aGF_high,char_I_GF_High_percentage ; use alternative GF factor high
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
177 bra do_return_toggle_gf ; back to menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
178
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
179
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
180 do_reset_avg_set_mkr:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
181 movlw .1 ; set to first option in dive mode menu
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
182 movwf menu_pos_cur ; ...
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
183
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
184 MENU_BEGIN tDivemenu_Avg_Mkr, .3
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
185 MENU_CALL tDivemenu_ResetAvg, do_reset_average
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
186 MENU_CALL tDivemenu_Marker, do_set_marker
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
187 MENU_CALL tBack, do_return_main_divemenu
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
188 MENU_END
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
189
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
190
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
191 do_reset_average:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
192 bsf request_reset_avg ; request reset of resettable average depth and dive time
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
193 IFDEF _min_depth_option
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
194 bsf reset_trip_pressure ; request ISR to reset the min and max trip-wise pressures
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
195 ENDIF
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
196 bra do_exit_divemode_menu ; continue exiting the menu
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
197
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
198
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
199 do_set_marker:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
200 bsf request_set_marker ; set request flag
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
201 bra do_exit_divemode_menu ; continue exiting the menu
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
202
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
203 ;=============================================================================
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
204
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
205 IFDEF _ccr_pscr
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
206
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
207 do_switch_sp: ; entry point when coming from manual setpoint selection (CCR)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
208 decf menu_pos_cur,W ; 1-5 -> 0-4
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
209 lfsr FSR1,opt_setpoint_cbar ; load base address
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
210 movff PLUSW1,char_I_const_ppO2 ; set selected setpoint
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
211 IFDEF _external_sensor
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
212 call transmit_setpoint ; transmit current setpoint from WREG (in cbar) to external electronics
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
213 ENDIF
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
214 bcf sp_fallback ; clear fallback condition (stops fallback warning)
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
215 clrf WREG ; switch to fixed SP
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
216 movff WREG,opt_ccr_mode ; =0: Fixed SP (CCR) / calculated (pSCR), =1: Sensor, =2: Auto SP
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
217 bra do_switch_sp_com ; continue with common part
0
heinrichsweikamp
parents:
diff changeset
218
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
219
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
220 do_switch_sp_calc: ; entry point when coming from switch to calculated ppO2 (pSCR)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
221 bcf sp_fallback ; clear fallback condition (stops fallback warning)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
222 clrf WREG ; switch to fixed SP
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
223 movff WREG,opt_ccr_mode ; =0: Fixed SP (CCR) / calculated (pSCR), =1: Sensor, =2: Auto SP
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
224 movff WREG,char_I_const_ppO2 ; set setpoint to 0, this forces deco engine to take the computed ppO2
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
225 ;bra do_switch_sp_com ; continue with common part
97
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 53
diff changeset
226
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
227
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
228 do_switch_sp_com: ; common part
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
229 bsf event_occured ; set global event byte
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
230 bsf event_SP_change ; set setpoint event flag
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
231
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
232 ; Clear some flags in case we were in bailout before...
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
233 bcf bailout_mode ; end bailout mode
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
234 bcf better_gas_available ; =1: a better gas is available and a gas change is advised in dive mode
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
235 bcf better_dil_available ; =1: a better diluent is available and a gas change is advised in dive mode
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
236 bcf better_gas_blinking ; clear blinking flag
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
237 bcf better_dil_blinking ; clear blinking flag
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
238 call dive_customview_callup ; redraw custom view mask to (if applicable) rewrite "ppO2(Dil)" to "ppO2" or SAC label
0
heinrichsweikamp
parents:
diff changeset
239
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
240 bsf request_back_to_loop ; indicate that it is a switchback from OC bailout to CCR/pSCR loop
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
241 bsf request_gas_change ; initiate reconfiguration to loop mode on last diluent
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
242
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
243 bra do_exit_divemode_menu ; continue exiting the menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
244
0
heinrichsweikamp
parents:
diff changeset
245
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
246 do_divemode_gaslist_bail: ; entry point from CCR/pSCR to bailout to OC gases
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
247 bcf is_diluent_menu ; select OC gases
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
248 bsf is_bailout_menu ; flag it is a bailout action
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
249 ;bra do_divemode_gaslist
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
250
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
251 ENDIF ; _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
252
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
253 ;=============================================================================
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
254
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
255 do_divemode_gaslist: ; entry point for switching: OC -> gases, loop -> diluents
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
256 IFDEF _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
257 btfsc bailout_mode ; in bailout mode?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
258 bcf is_diluent_menu ; YES - for safety reasons, redirect to selecting OC (bailout) gases
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
259 ENDIF
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
260 bsf short_gas_descriptions ; do not show "Gas x" etc.
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
261 bsf better_gas_hint ; mark the gas which is the best gas/diluent
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
262 bsf color_code_gases ; color-code the gases/diluents by their ppO2 and current depth
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
263 movf best_gas_number,W ; load number of best gas (1-5)into WREG
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
264 IFDEF _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
265 btfsc is_diluent_menu ; in diluent selection?
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
266 movf best_dil_number,W ; YES - overwrite with best diluent (1-5)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
267 ENDIF
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
268 bnz do_divemode_gaslist_1 ; best gas/dil number = 0 (none available) ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
269 movlw .1 ; YES - default to first gas/dil
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
270 btfsc WREG,7 ; best gas/dil number >= 128 (not computed yet) ?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
271 movlw .1 ; YES - default to first gas/dil
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
272 do_divemode_gaslist_1:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
273 movwf menu_pos_cur ; position cursor to best gas/dil (or first option if none avail)
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
274
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
275 MENU_BEGIN tGaslist, .6
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
276 MENU_DYNAMIC gaslist_strcat_gas_cd, do_switch_gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
277 MENU_DYNAMIC gaslist_strcat_gas_cd, do_switch_gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
278 MENU_DYNAMIC gaslist_strcat_gas_cd, do_switch_gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
279 MENU_DYNAMIC gaslist_strcat_gas_cd, do_switch_gas
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
280 MENU_DYNAMIC gaslist_strcat_gas_cd, do_switch_gas
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
281 MENU_CALL tDivemenu_LostGas, do_lost_gas
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
282 MENU_END
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
283
0
heinrichsweikamp
parents:
diff changeset
284
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
285 do_gas6_or_exit:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
286 btfsc gas6_or_EXIT ; shall exit?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
287 bra do_exit_divemode_menu ; YES - continue exiting menu
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
288 movlw .1 ; NO - select first item
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
289 movwf menu_pos_cur ; - set cursor
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
290 movff char_I_O2_ratio,gas6_O2_ratio ; - initialize gas6 with currently breathed gas - O2 ratio
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
291 IFDEF _helium
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
292 movff char_I_He_ratio,gas6_He_ratio ; - initialize gas6 with currently breathed gas - He ratio
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
293 ENDIF
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
294
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
295 do_divemode_gaslist_more_common:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
296 IFDEF _helium
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
297 MENU_BEGIN tGaslist, .6
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
298 MENU_CALL tO2Plus, do_dive_pO2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
299 MENU_CALL tO2Minus, do_dive_mO2
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
300 MENU_CALL tHePlus, do_dive_pHe
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
301 MENU_CALL tHeMinus, do_dive_mHe
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
302 MENU_DYNAMIC gaslist_strcat_gas6, do_switch_gas6
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
303 MENU_CALL tExit, do_exit_divemode_menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
304 MENU_END
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
305 ELSE
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
306 MENU_BEGIN tGaslist, .4
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
307 MENU_CALL tO2Plus, do_dive_pO2
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
308 MENU_CALL tO2Minus, do_dive_mO2
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
309 MENU_DYNAMIC gaslist_strcat_gas6, do_switch_gas6
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
310 MENU_CALL tExit, do_exit_divemode_menu
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
311 MENU_END
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
312 ENDIF
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
313
403
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
314
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
315 do_lost_gas:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
316 movlw .1 ; set to first option in dive mode menu
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
317 movwf menu_pos_cur ; ...
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
318 bcf gas6_or_EXIT ; default to presenting gas6 option
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
319 do_lost_gas_common:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
320 bsf short_gas_descriptions ; do not show "Gas x" etc.
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
321 bcf better_gas_hint ; do not mark the best gas/diluent
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
322 bcf color_code_gases ; do not color-code the gases/diluents by their ppO2
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
323
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
324 MENU_BEGIN tDivemenu_LostGas, .6
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
325 MENU_DYNAMIC gaslist_strcat_gas_cd, do_toggle_staged_lost
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
326 MENU_DYNAMIC gaslist_strcat_gas_cd, do_toggle_staged_lost
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
327 MENU_DYNAMIC gaslist_strcat_gas_cd, do_toggle_staged_lost
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
328 MENU_DYNAMIC gaslist_strcat_gas_cd, do_toggle_staged_lost
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
329 MENU_DYNAMIC gaslist_strcat_gas_cd, do_toggle_staged_lost
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
330 MENU_DYNAMIC label_do_gas6_or_exit, do_gas6_or_exit
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
331 MENU_END
0
heinrichsweikamp
parents:
diff changeset
332
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
333
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
334 do_switch_gas6:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
335 movlw .6 ; gas 6
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
336 movwf menu_pos_cur ; transfer register for selected gas towards gas_switched_common
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
337 bsf event_gas_change_gas6 ; set flag for profile recording
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
338 ;bra do_switch_gas ; continue with common gas-switched code
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
339
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
340
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
341 do_switch_gas:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
342 bsf request_gas_change ; initiate gas change, will also trigger restart of deco_engine
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
343 IFDEF _ccr_pscr
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
344 btfss is_bailout_menu ; doing a bailout?
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
345 bra do_switch_gas_1 ; NO
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
346 bsf bailout_mode ; YES - begin bailout mode
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
347 ENDIF
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
348 IFDEF _cave_mode
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
349 btfsc cave_mode ; - cave mode switched on?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
350 bsf request_turn_turn ; YES - request to turn the dive
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
351 ENDIF
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
352 IFDEF _ccr_pscr
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
353 do_switch_gas_1:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
354 bcf sp_fallback ; terminate fallback mode and get rid of its warning if applicable
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
355 call dive_customview_callup ; redraw custom view mask to rewrite "ppO2(Dil)" to "ppO2" or SAC label if applicable
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
356 ENDIF
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
357 ; revoke staged and lost state on the selected gas
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
358 lfsr FSR1,opt_gas_type ; load base address of gas types
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
359 movff menu_pos_cur,lo ; copy selected gas to lo
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
360 IFDEF _ccr_pscr
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
361 movlw .5 ; load WREG with diluent offset
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
362 btfsc is_diluent_menu ; operating on diluents?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
363 addwf lo,F ; YES - add diluent offset to shift 1-5 -> 6-10
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
364 ENDIF ; _ccr_pscr
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
365 decf lo,W ; 1-10 -> 0-4 for gases / 5-9 for diluents with result into WREG
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
366 bcf PLUSW1,gas_lost ; revoke lost state
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
367 IFDEF _cave_mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
368 bcf PLUSW1,gas_staged ; revoke staged state
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
369 ENDIF
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
370 ;bra do_exit_divemode_menu ; continue exiting the menu
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
371
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
372
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
373 ; +++ Dive Mode and Cave Mode common exit point +++
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
374 do_exit_divemode_menu:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
375 call timeout_divemode_menu2 ; check for timeout and do some cleanup
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
376 clrf STKPTR ; reset the stack
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
377 goto diveloop_menu_exit ; back to the dive loop
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
378
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
379
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
380 do_toggle_staged_lost:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
381 movff menu_pos_cur,lo ; copy selected gas/diluent to lo (1-5)
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
382 movf active_gas,W ; copy currently used gas to WREG (1-5)
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
383 IFDEF _ccr_pscr
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
384 btfsc FLAG_oc_mode ; in OC mode?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
385 bra do_toggle_staged_lost_check ; YES - can't be in diluent menu then, check selected gas against gas in use
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
386 btfsc bailout_mode ; NO - in bailout?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
387 bra do_toggle_staged_lost_check ; YES - can't be in diluent menu then, check selected gas against bailout gas in use
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
388 btfss is_diluent_menu ; NO - breathing a diluent then, in diluent menu?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
389 bra do_toggle_staged_lost_exec ; NO - can modify any gas, no need for a check
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
390 movf active_dil,W ; YES - check selected diluent against diluent in use
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
391 ENDIF
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
392 do_toggle_staged_lost_check:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
393 cpfseq lo ; selected gas/dil = currently used gas/dil?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
394 bra do_toggle_staged_lost_exec ; NO - can set selected gas/dil to lost or staged
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
395 bra do_lost_gas_common ; YES - gas/dil in use, can not set to lost or staged, back to menu
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
396 do_toggle_staged_lost_exec:
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
397 lfsr FSR1,opt_gas_type ; load base address of gas types
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
398 bcf better_gas_blinking ; clear blinking flag for gases to avoid "leftovers"
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
399 IFDEF _ccr_pscr
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
400 bcf better_dil_blinking ; clear blinking flag for diluents to avoid "leftovers"
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
401 movlw .5 ; load WREG with diluent offset
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
402 btfsc is_diluent_menu ; operating on diluents?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
403 addwf lo,F ; YES - add diluent offset to shift 1-5 -> 6-10
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
404 ENDIF ; _ccr_pscr
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
405 IFDEF _cave_mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
406 TSTOSS opt_cave_mode ; cave mode switched on?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
407 bra do_toggle_staged_lost_3 ; NO - just toggle lost state
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
408 decf lo,W ; YES - 1-10 -> 0-4 for gases / 5-9 for diluents with result into WREG
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
409 btfsc PLUSW1,gas_staged ; - gas currently set as staged?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
410 bra do_toggle_staged_lost_1 ; YES - set as lost now
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
411 btfsc PLUSW1,gas_lost ; NO - gas currently set as lost?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
412 bra do_toggle_staged_lost_2 ; YES - set as available now
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
413 ;bra do_toggle_staged_lost_0 ; NO - set as staged now
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
414 do_toggle_staged_lost_0:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
415 bsf PLUSW1,gas_staged ; set staged state
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
416 bra do_toggle_staged_lost_4 ; continue with restarting deco engine
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
417 do_toggle_staged_lost_1:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
418 bcf PLUSW1,gas_staged ; revoke staged state
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
419 bsf PLUSW1,gas_lost ; set lost state
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
420 bra do_toggle_staged_lost_4 ; continue with restarting deco engine
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
421 do_toggle_staged_lost_2:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
422 bcf PLUSW1,gas_lost ; revoke lost state
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
423 bra do_toggle_staged_lost_4 ; continue with restarting deco engine
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
424 ENDIF ; _cave_mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
425 do_toggle_staged_lost_3:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
426 decf lo,W ; 1-10 -> 0-4 for gases / 5-9 for diluents with result into WREG
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
427 btg PLUSW1,gas_lost ; toggle lost state
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
428 do_toggle_staged_lost_4:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
429 bsf request_gas_update ; request to update the gases
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
430 bsf gas6_or_EXIT ; switch 6th menu item from gas6 to exit
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
431 bra do_lost_gas_common ; back to the menu
0
heinrichsweikamp
parents:
diff changeset
432
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
433
0
heinrichsweikamp
parents:
diff changeset
434 do_dive_pO2:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
435 incf gas6_O2_ratio,F ; increment O2 %
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
436 IFDEF _helium
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
437 movf gas6_He_ratio,W ; get He %
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
438 addwf gas6_O2_ratio,W ; add O2 %
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
439 ELSE
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
440 movf gas6_O2_ratio,W ; get O2 %
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
441 ENDIF
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
442 movwf lo ; copy to lo
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
443 movlw .101 ; O2 + He < 101
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
444 cpfslt lo ; ... ?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
445 decf gas6_O2_ratio,F ; NO - decrement O2 again
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
446 bra do_divemode_gaslist_more_common
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
447
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
448
0
heinrichsweikamp
parents:
diff changeset
449 do_dive_mO2:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
450 decf gas6_O2_ratio,F ; decrement O2 %
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
451 movlw gaslist_min_o2 ; get minimum value
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
452 cpfslt gas6_O2_ratio ; O2 < minimum allowed %O2 ?
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
453 bra do_dive_mO2_done ; NO - value is valid
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
454 movwf gas6_O2_ratio ; YES - set O2 % to minimum
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
455 do_dive_mO2_done:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
456 bra do_divemode_gaslist_more_common
0
heinrichsweikamp
parents:
diff changeset
457
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
458 ;=============================================================================
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
459
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
460 IFDEF _helium
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
461
0
heinrichsweikamp
parents:
diff changeset
462 do_dive_pHe:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
463 incf gas6_He_ratio,F ; increment He %
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
464 movf gas6_He_ratio,W ; get He %
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
465 addwf gas6_O2_ratio,W ; add O2 %
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
466 movwf lo ; copy to lo
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
467 movlw .101 ; O2 + He < 101
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
468 cpfslt lo ; ... ?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
469 decf gas6_He_ratio,F ; YES - decrement He again
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
470 bra do_divemode_gaslist_more_common
0
heinrichsweikamp
parents:
diff changeset
471
heinrichsweikamp
parents:
diff changeset
472 do_dive_mHe:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
473 decf gas6_He_ratio,F ; decrement He %
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
474 bnn do_dive_mHe_done ; H2 < 0 ?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
475 clrf gas6_He_ratio ; YES - reset to 0
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
476 do_dive_mHe_done:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
477 bra do_divemode_gaslist_more_common
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
478
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
479 ENDIF
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
480
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
481 ;=============================================================================
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
482
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
483 IFDEF _ccr_pscr
0
heinrichsweikamp
parents:
diff changeset
484
heinrichsweikamp
parents:
diff changeset
485 do_divemode_splist:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
486 bsf short_gas_descriptions ; do not show "SP" etc.
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
487 movlw .1 ; default to first menu item
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
488 movff opt_ccr_mode,lo ; get CCR mode (0: Fixed SP, 1: Sensor, 2: Auto SP)
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
489 dcfsnz lo,F ; mode = sensor ?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
490 movlw .6 ; YES - load menu item number for 'sensor'
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
491 btfsc sp_fallback ; in fallback condition?
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
492 movlw .1 ; YES - revert to first menu item
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
493 movwf menu_pos_cur ; set cursor position
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
494
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
495 do_divemode_splist_common:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
496
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
497 IFDEF _external_sensor
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
498 btfsc analog_o2_input ; do we have an analog or S8 digital input (OSTC cR)?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
499 bra do_divemode_splist_sensor ; YES
604
ca4556fb60b9 bump to 2.99beta, work on 3.00 stable
heinrichsweikamp
parents: 583
diff changeset
500 btfsc optical_input ; do we have an optical input (OSTC 3)?
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
501 bra do_divemode_splist_sensor ; YES
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
502 ENDIF
0
heinrichsweikamp
parents:
diff changeset
503
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
504 do_divemode_splist_no_sensor:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
505 MENU_BEGIN tGaslist, .5
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
506 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
507 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
508 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
509 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
510 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
511 MENU_END
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
512
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
513
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
514 IFDEF _external_sensor
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
515
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
516 do_divemode_splist_sensor:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
517 MENU_BEGIN tGaslist, .6
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
518 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
519 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
520 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
521 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
522 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
523 MENU_CALL tCCRSensor, do_divemode_sensor
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
524 MENU_END
249
94bf757690cf ignore sensor for non-sensor hardware
heinrichsweikamp
parents: 195
diff changeset
525
94bf757690cf ignore sensor for non-sensor hardware
heinrichsweikamp
parents: 195
diff changeset
526
0
heinrichsweikamp
parents:
diff changeset
527 do_divemode_sensor:
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
528 movlw index_ppo2_sensors ; number of ppO2 sensors custom view
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
529 movwf active_customview ; set the custom view number
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
530 call dive_customview_callup ; call-up the custom view
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
531 movlw .1 ; set to 1st option: use sensors
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
532 movwf menu_pos_cur ; ...
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
533
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
534 do_return_divemode_sensor:
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
535 MENU_BEGIN tGaslist, .6
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
536 MENU_CALL tDivemenu_UseSensor, do_switch_sensor
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
537 MENU_CALL tBack, do_divemode_splist
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
538 MENU_CALL tExit, do_exit_divemode_menu
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
539 MENU_CALL tDiveHudMask1, do_toggle_sensor
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
540 MENU_CALL tDiveHudMask2, do_toggle_sensor
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
541 MENU_CALL tDiveHudMask3, do_toggle_sensor
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
542 MENU_END
0
heinrichsweikamp
parents:
diff changeset
543
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
544 do_divemode_setpoint_pscr:
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
545 movlw .1
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
546 movwf menu_pos_cur ; set to 1st option: use calculated ppO2
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
547
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
548 MENU_BEGIN tGaslist, .6
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
549 MENU_CALL tCalculated, do_switch_sp_calc
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
550 MENU_CALL tDivemenu_UseSensor, do_switch_sensor
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
551 MENU_CALL tExit, do_exit_divemode_menu
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
552 MENU_CALL tDiveHudMask1, do_toggle_sensor
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
553 MENU_CALL tDiveHudMask2, do_toggle_sensor
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
554 MENU_CALL tDiveHudMask3, do_toggle_sensor
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
555 MENU_END
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
556
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
557 do_switch_sensor: ; entry point when coming from switch to sensor
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
558 movlw .1 ; switch to sensor
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
559 movff WREG,opt_ccr_mode ; =0: fixed SP (CCR) / calculated (pSCR), =1: Sensor, =2: Auto SP
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
560 bra do_switch_sp_com ; continue with common part
0
heinrichsweikamp
parents:
diff changeset
561
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
562 do_toggle_sensor:
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
563 movff menu_pos_cur,lo ; backup position
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
564 decf menu_pos_cur,f ; 4, 5, 6 -> 3, 4, 5
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
565 decf menu_pos_cur,f ; 3, 4, 5 -> 2, 3, 4
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
566 decf menu_pos_cur,f ; 2, 3, 4 -> 1, 2, 3
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
567 dcfsnz menu_pos_cur ; 1, 2, 3 -> 0, 1, 2
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
568 btg use_O2_sensor1 ; =
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
569 dcfsnz menu_pos_cur ; 0, 1, 2 -> -1, 0, 1
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
570 btg use_O2_sensor2 ; =
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
571 dcfsnz menu_pos_cur ; -1,0, 1 -> -2,-1, 0
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
572 btg use_O2_sensor3 ; =
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
573 movff lo,menu_pos_cur ; restore position
582
b455b31ce022 work on 2.97 stable
heinrichsweikamp
parents: 579
diff changeset
574 bra do_return_divemode_sensor
560
b7eb98dbd800 bump to 2.96beta (REFACTORED VERSION)
heinrichsweikamp
parents: 541
diff changeset
575
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
576 ENDIF ; _external_sensor
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
577 ENDIF ; _ccr_pscr
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
578
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
579 ;=============================================================================
631
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
580 ;
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
581 ; Cave Mode Menu
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
582 ;
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
583
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
584 IFDEF _cave_mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
585
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
586 do_return_main_cavemenu:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
587 call menu_processor_pop ; drop selection from menu stack
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
588 incf selected_item,W ; item numbers start with 0, menu positions with 1
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
589 movwf menu_pos_cur ; position cursor where we came from
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
590 bra do_main_cavemenu_common ; continue with common part
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
591
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
592 global do_main_cavemenu
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
593 do_main_cavemenu:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
594 bsf custom_view_locked ; lock custom view
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
595 movff active_customview,backup_customview ; back up current custom view
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
596 call menu_processor_reset ; restart from first icon
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
597 movlw .1 ; set cursor to first menu item by default
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
598 btfsc dive_turned ; dive turned ?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
599 movlw .4 ; YES - set cursor on waypoint out item
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
600 btfss cave_mode ; cave mode switched off ?
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
601 movlw .3 ; YES - set cursor on cave mode off/on menu item
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
602 movwf menu_pos_cur ; actually set cursor position
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
603
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
604 ; The helper functions for MENU_DYNAMIC can be found in
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
605 ; gaslist.asm as it does not work to include them here.
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
606
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
607 do_main_cavemenu_common:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
608 movlw index_cave_waypoints ; get number of cave waypoints custom view
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
609 movwf active_customview ; set custom view number
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
610 call dive_customview_callup ; draw custom view
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
611
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
612 MENU_BEGIN tMainMenu, .6
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
613 MENU_DYNAMIC label_do_wp_set, do_waypoint_set ; 1
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
614 MENU_DYNAMIC label_do_turn_dive, do_turndive_toggle ; 2
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
615 MENU_CALL tDivemenu_off_on, do_cavemode_toggle ; 3
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
616 MENU_DYNAMIC label_do_wp_out, do_waypoint_out ; 4
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
617 MENU_DYNAMIC label_do_wp_in, do_waypoint_in ; 5
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
618 MENU_CALL tExit, do_exit_divemode_menu ; 6
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
619 MENU_END
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
620
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
621
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
622 do_waypoint_set:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
623 bsf request_waypoint_set ; set request flag
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
624 bra do_return_main_cavemenu ; back to menu
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
625
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
626 do_turndive_toggle:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
627 bsf request_turn_toggle ; set request flag
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
628 bra do_return_main_cavemenu ; back to menu
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
629
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
630 do_cavemode_toggle:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
631 bsf request_cave_toggle ; set request flag
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
632 bra do_return_main_cavemenu ; back to menu
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
633
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
634 do_waypoint_out:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
635 bsf request_waypoint_out ; set request flag
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
636 bra do_return_main_cavemenu ; back to menu
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
637
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
638 do_waypoint_in:
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
639 bsf request_waypoint_in ; set request flag
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
640 bra do_return_main_cavemenu ; back to menu
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
641
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
642 ENDIF ; _cave_mode
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
643
185ba2f91f59 3.09 beta 1 release
heinrichsweikamp
parents: 623
diff changeset
644 ;=============================================================================
623
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
645
c40025d8e750 3.03 beta released
heinrichsweikamp
parents: 604
diff changeset
646 END