Mercurial > public > hwos_code
comparison src/divemenu_tree.asm @ 560:b7eb98dbd800
bump to 2.96beta (REFACTORED VERSION)
author | heinrichsweikamp |
---|---|
date | Wed, 31 Jan 2018 19:39:37 +0100 |
parents | ad7dc231c180 |
children | 54346c651b6a |
comparison
equal
deleted
inserted
replaced
559:9cb967d844f0 | 560:b7eb98dbd800 |
---|---|
1 ;============================================================================= | 1 ;============================================================================= |
2 ; | 2 ; |
3 ; File divemenu_tree.asm | 3 ; File divemenu_tree.asm REFACTORED VERSION V2.96a |
4 ; | 4 ; |
5 ; OSTC dive mode menu | 5 ; OSTC dive mode menu |
6 ; | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. |
8 ;============================================================================= | 8 ;============================================================================= |
15 #include "tft_outputs.inc" | 15 #include "tft_outputs.inc" |
16 #include "customview.inc" | 16 #include "customview.inc" |
17 #include "strings.inc" | 17 #include "strings.inc" |
18 #include "calibrate.inc" | 18 #include "calibrate.inc" |
19 | 19 |
20 | |
20 divegui CODE | 21 divegui CODE |
21 ;============================================================================= | 22 ;============================================================================= |
22 ; Main Menu | 23 ; Main Menu |
23 global do_main_divemenu | 24 global do_main_divemenu |
24 do_main_divemenu: | 25 do_main_divemenu: |
25 call menu_processor_reset ; restart from first icon. | 26 call menu_processor_reset ; restart from first icon. |
26 | 27 |
27 do_continue_main_divemenu: | 28 do_continue_main_divemenu: |
28 call menu_processor_pop ; drop exit line. | 29 call menu_processor_pop ; drop exit line. |
29 call menu_processor_pop ; drop exit line. | 30 call menu_processor_pop ; drop exit line. |
30 | 31 |
31 btfsc FLAG_ccr_mode | 32 btfsc FLAG_ccr_mode |
32 bra main_divemenu_ccr ; CCR Menu | 33 bra main_divemenu_loop ; goto CCR / pSCR Menu menu |
33 | 34 btfsc FLAG_pscr_mode |
34 btfsc FLAG_pscr_mode | 35 bra main_divemenu_loop ; goto CCR / pSCR Menu menu |
35 bra main_divemenu_ccr ; Proceeds to PSCR menu then... | 36 |
36 | 37 main_divemenu_OC: |
37 bcf ccr_diluent_setup ; For OC gases | 38 bcf ccr_diluent_setup |
38 bcf is_bailout_menu | 39 bcf is_bailout_menu |
39 movlw .1 | 40 movlw .1 |
40 movwf menupos ; Set to first option in divemode menu | 41 movwf menupos ; Set to first option in divemode menu |
41 MENU_BEGIN tMainMenu, .5 | 42 |
42 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist | 43 MENU_BEGIN tMainMenu, .5 |
43 MENU_CALL tDivemenu_ResetAvg, do_divemode_resetavg | 44 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist |
44 MENU_CALL tDivemenu_ToggleGF, do_divemode_togglegf | 45 MENU_CALL tDivemenu_ResetAvg, do_reset_average |
45 MENU_CALL tDivemenu_Marker, do_set_marker | 46 MENU_CALL tDivemenu_ToggleGF, do_toggle_gf |
46 MENU_CALL tExit, do_exit_divemode_menu | 47 MENU_CALL tDivemenu_Marker, do_set_marker |
47 MENU_END | 48 MENU_CALL tExit, do_exit_divemode_menu |
48 | 49 MENU_END |
49 do_set_marker: | 50 |
50 movlw d'6' ; Type of Alarm (Manual Marker) | 51 main_divemenu_loop: |
51 movwf AlarmType ; Copy to Alarm Register | 52 bsf ccr_diluent_setup ; default to operations on diluents |
52 bsf event_occured ; Set Event Flag | 53 bcf is_bailout_menu ; default to none-bailout menu |
53 bra do_exit_divemode_menu ; And exit | |
54 | |
55 main_divemenu_ccr: | |
56 bsf ccr_diluent_setup ; For diluents | |
57 movlw .1 | 54 movlw .1 |
58 movwf menupos ; Set to first option in divemode menu | 55 movwf menupos ; Set to first option in divemode menu |
59 | 56 |
60 btfsc FLAG_pscr_mode | 57 btfsc FLAG_pscr_mode |
61 bra main_divemenu_pscr ; PSCR Menu | 58 bra main_divemenu_pscr ; PSCR Menu |
62 | 59 |
63 MENU_BEGIN tMainMenu, .6 | 60 MENU_BEGIN tMainMenu, .6 |
64 MENU_CALL tDiveBailout, do_divemode_gaslist_bail | 61 MENU_CALL tDiveBailout, do_divemode_gaslist_bail |
65 MENU_CALL tDivemenu_Setpoint, do_divemode_splist | 62 MENU_CALL tDivemenu_Setpoint, do_divemode_splist |
66 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist | 63 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist |
67 MENU_CALL tDivemenu_ResetAvg, do_divemode_resetavg | 64 MENU_CALL tDivemenu_ResetAvg, do_reset_average |
68 MENU_CALL tDivemenu_ToggleGF, do_divemode_togglegf | 65 MENU_CALL tDivemenu_ToggleGF, do_toggle_gf |
69 MENU_CALL tExit, do_exit_divemode_menu | 66 MENU_CALL tExit, do_exit_divemode_menu |
70 MENU_END | 67 MENU_END |
71 | 68 |
72 main_divemenu_pscr: | 69 main_divemenu_pscr: |
70 movf hardware_flag,W | |
71 sublw 0x11 ; 2 with BLE | |
72 btfsc STATUS,Z | |
73 bra main_divemenu_pscr_no_sensors | |
74 movf hardware_flag,W | |
75 sublw 0x13 ; + | |
76 btfsc STATUS,Z | |
77 bra main_divemenu_pscr_no_sensors | |
78 | |
73 MENU_BEGIN tMainMenu, .6 | 79 MENU_BEGIN tMainMenu, .6 |
74 MENU_CALL tDiveBailout, do_divemode_gaslist_bail | 80 MENU_CALL tDiveBailout, do_divemode_gaslist_bail |
75 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist_pscr ; quit bailout and always use diluents here | 81 MENU_CALL tCCRSensor, do_divemode_setpoint_pscr |
76 MENU_CALL tDivemenu_ResetAvg, do_divemode_resetavg | 82 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist |
77 MENU_CALL tDivemenu_ToggleGF, do_divemode_togglegf | 83 MENU_CALL tDivemenu_ResetAvg, do_reset_average |
78 MENU_CALL tDivemenu_Marker, do_set_marker | 84 MENU_CALL tDivemenu_ToggleGF, do_toggle_gf |
79 MENU_CALL tExit, do_exit_divemode_menu | 85 MENU_CALL tExit, do_exit_divemode_menu |
80 MENU_END | 86 MENU_END |
81 | 87 |
88 main_divemenu_pscr_no_sensors: | |
89 MENU_BEGIN tMainMenu, .6 | |
90 MENU_CALL tDiveBailout, do_divemode_gaslist_bail | |
91 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist | |
92 MENU_CALL tDivemenu_ResetAvg, do_reset_average | |
93 MENU_CALL tDivemenu_ToggleGF, do_toggle_gf | |
94 MENU_CALL tDivemenu_Marker, do_set_marker | |
95 MENU_CALL tExit, do_exit_divemode_menu | |
96 MENU_END | |
97 | |
98 | |
99 do_toggle_gf: | |
100 movff char_I_deco_model,WREG ; 0 = ZH-L16, 1 = ZH-L16-GF | |
101 decfsz WREG,W ; Toggle GF only in GF modes - in GF mode? | |
102 bra do_continue_main_divemenu ; No, do nothing and return | |
103 TSTOSS opt_enable_aGF ; =1: aGF can be selected underwater | |
104 bra do_continue_main_divemenu ; No, do nothing and return | |
105 movlw .4 ; Set customview to 5 (GF informations) | |
106 movwf menupos3 ; Customview to come-1 | |
107 bsf toggle_customview ; Set flag, the customview will be toggled very soon now... | |
108 movlw .1 | |
109 movwf menupos ; Set to first option in divemode menu | |
110 | |
111 MENU_BEGIN tDivemenu_ToggleGF, .2 | |
112 MENU_CALL tDivemenu_ToggleGF, do_togglegf | |
113 MENU_CALL tExit, do_continue_main_divemenu | |
114 MENU_END | |
115 | |
82 do_togglegf: | 116 do_togglegf: |
83 TSTOSS opt_enable_aGF ; =1: aGF can be selected underwater | 117 ;TSTOSS opt_enable_aGF ; =1: aGF can be selected underwater ## check is now done before entering menu |
84 bra do_exit_divemode_menu ; exit | 118 ;bra do_exit_divemode_menu ; continue with exiting menu code |
85 bsf toggle_gf ; Set flag... | 119 bsf toggle_gf ; Set flag... |
86 bra do_exit_divemode_menu ; ...and exit | 120 bra do_exit_divemode_menu ; continue with exiting menu code |
87 | 121 |
88 do_switch_to_sensor: | 122 |
89 movlw .1 ; Switch to Sensor | 123 do_set_marker: |
90 movff WREG,opt_ccr_mode ; =0: Fixed SP, =1: Sensor, =2: Auto SP | 124 movlw d'6' ; Type of Alarm (Manual Marker) |
91 bsf voting_logic_sensor1 | 125 movwf AlarmType ; Copy to Alarm Register |
92 bsf voting_logic_sensor2 | 126 bsf event_occured ; Set Event Flag |
93 bsf voting_logic_sensor3 | 127 bra do_exit_divemode_menu ; And exit |
94 extern divemode_setup_sensor_values | 128 |
95 call divemode_setup_sensor_values ; Setup sensor values | 129 |
96 call check_sensors ; Check O2 sensor thresholds for fallback | 130 do_reset_average: |
97 bra do_switch_sp2 | 131 bsf reset_average_depth ; Set Flag |
98 | 132 bra do_exit_divemode_menu ; continue with exiting menu code |
99 do_divemode_resetavg: | 133 |
100 bsf reset_average_depth ; Set Flag | 134 |
101 bra do_exit_divemode_menu ; And exit | 135 do_switch_sensor: ; entry point when coming from switch to sensor |
102 | 136 movlw .1 ; Switch to Sensor |
103 | 137 movff WREG,opt_ccr_mode ; =0: Fixed SP (CCR) / calculated (pSCR), =1: Sensor, =2: Auto SP |
104 do_switch_gas6: | 138 bra do_switch_sp_com ; continue with common part |
105 movlw .6 | 139 |
106 movwf active_gas ; Gas6 selected | 140 do_switch_sp: ; entry point when coming from manual setpoint selection (CCR) |
107 movff WREG,char_I_current_gas ; for p2_deco.c | 141 decf menupos,W ; 1-5 -> 0-4 |
108 bra do_switch_gasX | |
109 extern diveloop_loop4 | |
110 extern timeout_divemode_menu2 | |
111 do_switch_gas: | |
112 bsf divemode_gaschange ; Set flag | |
113 do_switch_gasX: | |
114 btfsc is_bailout_menu ; Bailout confirmed? | |
115 bsf is_bailout ; =1: Bailout | |
116 call customview_mask ; update customview mask to (eventually) rewrite ppO2(Dil): to ppO2: | |
117 do_exit_divemode_menu: | |
118 call timeout_divemode_menu2 | |
119 clrf STKPTR | |
120 goto diveloop_loop4 | |
121 | |
122 do_switch_sp: | |
123 decf menupos,W ; 1-5 -> 0-4 | |
124 lfsr FSR1,char_I_setpoint_cbar | 142 lfsr FSR1,char_I_setpoint_cbar |
125 movff PLUSW1,char_I_const_ppO2; Setup fixed Setpoint | 143 movff PLUSW1,char_I_const_ppO2 ; setup fixed setpoint |
126 movff char_I_const_ppO2,WREG | 144 movff char_I_const_ppO2,WREG |
127 call transmit_setpoint ; Transmit current setpoint from WREG (in cbar) to external electronics | 145 call transmit_setpoint ; tansmit current setpoint from WREG (in cbar) to external electronics |
128 bsf setpoint_changed ; Set flag (For profile) | 146 bcf setpoint_fallback ; clear fallback condition (stops fallback warning) |
129 bsf event_occured ; Set global event byte | 147 clrf WREG ; Switch to fixed SP |
130 | 148 movff WREG,opt_ccr_mode ; =0: Fixed SP (CCR) / calculated (pSCR), =1: Sensor, =2: Auto SP |
131 ; Reconfigure last diluent | 149 bra do_switch_sp_com |
132 extern setup_dil_registers | 150 |
133 bcf is_bailout ; =1: Bailout | 151 do_switch_sp_calc: ; entry point when coming from switch to calculated ppO2 (pSCR) |
134 movff active_diluent,WREG ; As a backup when switching back from Bailout to CCR | 152 bcf setpoint_fallback ; clear fallback condition (stops fallback warning) |
135 decf WREG ; 0-4 | 153 clrf WREG ; Switch to fixed SP |
136 call setup_dil_registers ; With WREG=Gas 0-4 | 154 movff WREG,opt_ccr_mode ; =0: Fixed SP (CCR) / calculated (pSCR), =1: Sensor, =2: Auto SP |
137 | 155 movff WREG,char_I_const_ppO2 ; set setpoint to 0, this forces deco engine to take the computed ppO2 |
138 clrf WREG ; Switch to fixed SP | 156 |
139 movff WREG,opt_ccr_mode ; =0: Fixed SP, =1: Sensor, =2: Auto SP | 157 do_switch_sp_com: ; merge point to common part |
140 clrf WREG | 158 bsf event_occured ; set global event byte |
141 movff WREG,char_O_deco_status ; Restart decoplan computation | 159 bsf setpoint_changed ; set flag (for profile) |
142 | 160 |
143 do_switch_sp2: | |
144 ; Clear some flags in case we were in bailout before... | 161 ; Clear some flags in case we were in bailout before... |
145 bcf is_bailout ; =1: Bailout | 162 bcf is_bailout ; end bailout mode |
146 bcf is_bailout_menu ; | 163 ;bcf is_bailout_menu ; not needed |
147 bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode | 164 bcf better_gas_available ; =1: A better gas is available and a gas change is advised in divemode |
148 bcf blinking_better_gas ; Clear blinking flag | 165 bcf blinking_better_gas ; clear blinking flag |
149 call customview_mask ; update customview mask to (eventually) rewrite ppO2(Dil): to ppO2: | 166 call customview_mask ; update customview mask to (eventually) rewrite ppO2(Dil): to ppO2: |
150 bra do_exit_divemode_menu ; And exit | 167 |
151 | 168 movff active_diluent,menupos ; reconfigure last diluent (menupos is transfer register for selected gas/diluent towards gas_switched_common:) |
152 do_divemode_gaslist_pscr: | 169 bsf divemode_gaschange ; initiate reconfiguration to loop mode on last diluent |
153 bsf ccr_diluent_setup ; For Diluents | 170 |
154 bcf is_bailout ; =1: Bailout | 171 bra do_exit_divemode_menu ; continue with exiting menu code |
155 bcf is_bailout_menu ; | 172 |
156 bra do_divemode_gaslist_pscr2 | 173 |
157 | 174 do_divemode_gaslist_bail: ; entry point from CCR/pSCR to bailout to OC gases |
158 do_divemode_gaslist_bail: | 175 bcf ccr_diluent_setup ; switch to OC gases |
159 bcf ccr_diluent_setup ; For OC gases | 176 bsf is_bailout_menu ; flag it is a bailout action |
160 bsf is_bailout_menu ; =1: Bailout | 177 do_divemode_gaslist: ; entry point for switching: OC -> gases, loop -> diluents |
161 do_divemode_gaslist: | 178 btfsc is_bailout ; in bailout mode? |
162 btfsc is_bailout ; In Bailout case? | 179 bcf ccr_diluent_setup ; yes - for safety reasons, redirect to OC (bailout) gases |
163 bcf ccr_diluent_setup ; Yes, use OC gases | 180 do_divemode_gaslist_com: |
164 do_divemode_gaslist_pscr2: | 181 bsf short_gas_decriptions |
165 bsf short_gas_decriptions | 182 movlw .1 |
166 movlw .1 | 183 movwf menupos ; Set to first option in divemode menu |
167 movwf menupos ; Set to first option in divemode menu | 184 MENU_BEGIN tGaslist, .6 |
168 MENU_BEGIN tGaslist, .6 | 185 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas |
169 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | 186 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas |
170 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | 187 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas |
171 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | 188 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas |
172 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | 189 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas |
173 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | 190 MENU_CALL tMore, do_divemode_gaslist_more |
174 MENU_CALL tMore, do_divemode_gaslist_more0 | 191 MENU_END |
175 MENU_END | 192 |
176 | |
177 do_divemode_gaslist_more0: | |
178 movlw .1 | |
179 movwf menupos ; Set to first option in divemode menu | |
180 do_divemode_gaslist_more: | 193 do_divemode_gaslist_more: |
194 movlw .1 | |
195 movwf menupos ; Set to first option in divemode menu | |
196 | |
197 movff char_I_O2_ratio,gas6_O2_ratio ; initialize gas6 with currently breathed gas - O2 ratio | |
198 movff char_I_He_ratio,gas6_He_ratio ; initialize gas6 with currently breathed gas - He ratio | |
199 | |
200 do_divemode_gaslist_more_loop: | |
181 MENU_BEGIN tGaslist, .6 | 201 MENU_BEGIN tGaslist, .6 |
182 MENU_CALL tO2Plus, do_dive_pO2 | 202 MENU_CALL tO2Plus, do_dive_pO2 |
183 MENU_CALL tO2Minus, do_dive_mO2 | 203 MENU_CALL tO2Minus, do_dive_mO2 |
184 MENU_CALL tHePlus, do_dive_pHe | 204 MENU_CALL tHePlus, do_dive_pHe |
185 MENU_CALL tHeMinus, do_dive_mHe | 205 MENU_CALL tHeMinus, do_dive_mHe |
186 MENU_DYNAMIC gaslist_strcat_gasx, do_switch_gas6 | 206 MENU_DYNAMIC gaslist_strcat_gas6, do_switch_gas6 |
187 MENU_CALL tDivemenu_LostGas, do_lost_gas | 207 MENU_CALL tDivemenu_LostGas, do_lost_gas |
188 MENU_END | 208 MENU_END |
189 | 209 |
190 do_lost_gas: | 210 do_lost_gas: |
191 movlw .1 | 211 movlw .1 |
192 movwf menupos ; Set to first option in divemode menu | 212 movwf menupos ; Set to first option in divemode menu |
193 do_lost_gas0: | 213 do_lost_gas_loop: |
194 bsf short_gas_decriptions | 214 bsf short_gas_decriptions |
195 MENU_BEGIN tDivemenu_LostGas, .6 | 215 MENU_BEGIN tDivemenu_LostGas, .6 |
196 MENU_DYNAMIC gaslist_strcat_gas_mod, do_toggle_active ; Toggle the gas (in)active | 216 MENU_DYNAMIC gaslist_strcat_gas_mod, do_toggle_active ; Toggle the gas (in)active |
197 MENU_DYNAMIC gaslist_strcat_gas_mod, do_toggle_active ; Toggle the gas (in)active | 217 MENU_DYNAMIC gaslist_strcat_gas_mod, do_toggle_active ; Toggle the gas (in)active |
198 MENU_DYNAMIC gaslist_strcat_gas_mod, do_toggle_active ; Toggle the gas (in)active | 218 MENU_DYNAMIC gaslist_strcat_gas_mod, do_toggle_active ; Toggle the gas (in)active |
199 MENU_DYNAMIC gaslist_strcat_gas_mod, do_toggle_active ; Toggle the gas (in)active | 219 MENU_DYNAMIC gaslist_strcat_gas_mod, do_toggle_active ; Toggle the gas (in)active |
200 MENU_DYNAMIC gaslist_strcat_gas_mod, do_toggle_active ; Toggle the gas (in)active | 220 MENU_DYNAMIC gaslist_strcat_gas_mod, do_toggle_active ; Toggle the gas (in)active |
201 MENU_CALL tExit, do_exit_divemode_menu | 221 MENU_CALL tExit, do_exit_divemode_menu |
202 MENU_END | 222 MENU_END |
223 | |
224 | |
225 do_switch_gas6: | |
226 movlw .6 ; gas 6 | |
227 movwf menupos ; transfer register for selected gas towards gas_switched_common: | |
228 bsf gas6_changed ; set flag for profile recording | |
229 ;bra do_switch_gas ; continue with common gas-switched code | |
230 | |
231 do_switch_gas: | |
232 bsf divemode_gaschange ; Set flag, will also trigger restart of deco_engine | |
233 btfsc is_bailout_menu ; Bailout confirmed? | |
234 bsf is_bailout ; begin bailout mode | |
235 call customview_mask ; update custom view mask to (eventually) rewrite ppO2(Dil): to ppO2: | |
236 ;bra do_exit_divemode_menu ; continue with exiting menu code | |
237 | |
238 do_exit_divemode_menu: | |
239 extern timeout_divemode_menu2 | |
240 call timeout_divemode_menu2 | |
241 clrf STKPTR | |
242 extern diveloop_loop4 | |
243 goto diveloop_loop4 | |
244 | |
203 | 245 |
204 do_toggle_active: | 246 do_toggle_active: |
247 extern restart_deco_engine_wo_ceiling | |
248 call restart_deco_engine_wo_ceiling | |
205 movlw .5 | 249 movlw .5 |
206 btfsc ccr_diluent_setup ; use OC gases | 250 btfsc ccr_diluent_setup ; diluents? |
207 addwf menupos,F ; -> 6-10 for Diluents | 251 addwf menupos,F ; yes 1-5 -> 6-10 |
208 | 252 decf menupos,W ; -> 0-4 for gases / 5-9 for diluents |
209 decf menupos,W ; 1-5 -> 0-4 | |
210 lfsr FSR1,opt_gas_type+0 | 253 lfsr FSR1,opt_gas_type+0 |
211 movff PLUSW1,lo | 254 movff PLUSW1,lo |
212 tstfsz lo ; Already disabled? | 255 tstfsz lo ; Already disabled? |
213 bra do_toggle_active2 ; No, disable now! | 256 bra do_toggle_active2 ; No, disable now! |
214 | 257 lfsr FSR1,opt_gas_type_backup+0 ; copy opt_gas_type_backup+W back to opt_gas_type+W |
215 ; Copy opt_gas_type_backup+W back to opt_gas_type+W | |
216 decf menupos,W ; 1-5 -> 0-4 | |
217 lfsr FSR1,opt_gas_type_backup+0 | |
218 movff PLUSW1,lo | 258 movff PLUSW1,lo |
219 decf menupos,W ; 1-5 -> 0-4 | |
220 lfsr FSR1,opt_gas_type+0 | 259 lfsr FSR1,opt_gas_type+0 |
221 movff lo,PLUSW1 | 260 movff lo,PLUSW1 |
222 | 261 lfsr FSR1,opt_OC_bail_gas_change_backup+0 ; copy opt_OC_bail_gas_change_backup+W back to opt_OC_bail_gas_change+W |
223 ; Copy opt_OC_bail_gas_change_backup+W back to opt_OC_bail_gas_change+W | |
224 decf menupos,W ; 1-5 -> 0-4 | |
225 lfsr FSR1,opt_OC_bail_gas_change_backup+0 | |
226 movff PLUSW1,lo | 262 movff PLUSW1,lo |
227 decf menupos,W ; 1-5 -> 0-4 | 263 lfsr FSR1,opt_OC_bail_gas_change+0 |
264 movff lo,PLUSW1 | |
265 bra do_toggle_active3 | |
266 do_toggle_active2: | |
267 clrf PLUSW1 ; 0=Disabled, 1=First, 2=Travel, 3=Deco | |
228 lfsr FSR1,opt_OC_bail_gas_change+0 | 268 lfsr FSR1,opt_OC_bail_gas_change+0 |
229 movff lo,PLUSW1 | 269 clrf PLUSW1 ; also delete change depth here to have the menu updated immediately |
230 | 270 do_toggle_active3: |
231 movlw .5 | 271 movlw .5 |
232 btfsc ccr_diluent_setup ; use OC gases? | 272 btfsc ccr_diluent_setup ; use OC gases? |
233 subwf menupos,F ; Back to 1-5 | 273 subwf menupos,F ; Back to 1-5 |
234 | 274 bra do_lost_gas_loop ; Return to list and show updated result |
235 bra do_lost_gas0 ; Return to list and show updated result | 275 |
236 | |
237 do_toggle_active2: | |
238 clrf PLUSW1 ; 0=Disabled, 1=First, 2=Travel, 3=Deco | |
239 | |
240 ; Also delete change depth here to have the menu updated immediately | |
241 lfsr FSR1,opt_OC_bail_gas_change+0 | |
242 clrf PLUSW1 | |
243 | |
244 movlw .5 | |
245 btfsc ccr_diluent_setup ; use OC gases? | |
246 subwf menupos,F ; Back to 1-5 | |
247 | |
248 bra do_lost_gas0 ; Return to list and show updated result | |
249 | 276 |
250 do_dive_pO2: | 277 do_dive_pO2: |
251 banksel char_I_O2_ratio | 278 banksel gas6_O2_ratio |
252 incf char_I_O2_ratio,F ; O2++ | 279 incf gas6_O2_ratio,F ; O2++ |
253 movf char_I_He_ratio,W | 280 movf gas6_He_ratio,W |
254 addwf char_I_O2_ratio,W | 281 addwf gas6_O2_ratio,W |
255 movwf temp_bankx400 | 282 movwf gas6_temp |
256 movlw .101 | 283 movlw .101 |
257 cpfslt temp_bankx400 ; O2+He<101? | 284 cpfslt gas6_temp ; O2+He<101? |
258 decf char_I_O2_ratio,F ; O2-- (Unchanged) | 285 decf gas6_O2_ratio,F ; O2-- (Unchanged) |
259 ; bra do_divemode_gaslist_more_common | 286 banksel common |
260 do_divemode_gaslist_more_common: | 287 bra do_divemode_gaslist_more_loop |
261 movf char_I_O2_ratio,W ; Add O2... | 288 |
262 addwf char_I_He_ratio,W ; ...and He... | |
263 sublw .100 ; ...subtract both from 100 | |
264 movwf char_I_N2_ratio ; -> N2! | |
265 banksel common | |
266 bsf gas6_changed ; Set flag | |
267 bra do_divemode_gaslist_more | |
268 | |
269 do_dive_mO2: | 289 do_dive_mO2: |
270 banksel char_I_O2_ratio | 290 banksel gas6_O2_ratio |
271 decf char_I_O2_ratio,F ; O2-- | 291 decf gas6_O2_ratio,F ; O2-- |
272 movlw gaslist_min_o2 | 292 movlw gaslist_min_o2 |
273 cpfslt char_I_O2_ratio | 293 cpfslt gas6_O2_ratio |
274 bra do_divemode_gaslist_more_common | 294 bra do_dive_mO2_done |
275 movlw gaslist_min_o2 | 295 movlw gaslist_min_o2 |
276 movwf char_I_O2_ratio | 296 movwf gas6_O2_ratio |
277 bra do_divemode_gaslist_more_common | 297 do_dive_mO2_done: |
278 | 298 banksel common |
299 bra do_divemode_gaslist_more_loop | |
279 | 300 |
280 do_dive_pHe: | 301 do_dive_pHe: |
281 banksel char_I_O2_ratio | 302 banksel gas6_O2_ratio |
282 incf char_I_He_ratio,F ; He++ | 303 incf gas6_He_ratio,F ; He++ |
283 movf char_I_He_ratio,W | 304 movf gas6_He_ratio,W |
284 addwf char_I_O2_ratio,W | 305 addwf gas6_O2_ratio,W |
285 movwf lo | 306 movwf lo |
286 movlw .101 | 307 movlw .101 |
287 cpfslt lo ; O2+He<101? | 308 cpfslt lo ; O2+He<101? |
288 decf char_I_He_ratio,F ; Yes, He-- (Unchanged) | 309 decf gas6_He_ratio,F ; Yes, He-- (Unchanged) |
289 bra do_divemode_gaslist_more_common | 310 banksel common |
311 bra do_divemode_gaslist_more_loop | |
290 | 312 |
291 do_dive_mHe: | 313 do_dive_mHe: |
292 banksel char_I_O2_ratio | 314 banksel gas6_O2_ratio |
293 decf char_I_He_ratio,F ; He-- | 315 decf gas6_He_ratio,F ; He-- |
294 bnn do_divemode_gaslist_more_common | 316 bnn do_dive_mHe_done |
295 clrf char_I_He_ratio | 317 clrf gas6_He_ratio |
296 bra do_divemode_gaslist_more_common | 318 do_dive_mHe_done: |
319 banksel common | |
320 bra do_divemode_gaslist_more_loop | |
297 | 321 |
298 do_divemode_splist: | 322 do_divemode_splist: |
299 bsf short_gas_decriptions | 323 bsf short_gas_decriptions |
324 movlw .1 | |
325 movwf menupos ; Set to first option in divemode menu | |
326 | |
327 movf hardware_flag,W | |
328 sublw 0x11 ; 2 with BLE | |
329 btfsc STATUS,Z | |
330 bra do_divemode_splist_no_sensor ; no sensor | |
331 movf hardware_flag,W | |
332 sublw 0x13 ; + | |
333 btfsc STATUS,Z | |
334 bra do_divemode_splist_no_sensor ; no sensor | |
335 | |
336 do_divemode_splist_with_sensor: | |
337 MENU_BEGIN tGaslist, .6 | |
338 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
339 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
340 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
341 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
342 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
343 MENU_CALL tCCRSensor, do_divemode_sensor | |
344 MENU_END | |
345 | |
346 do_divemode_splist_no_sensor: | |
347 MENU_BEGIN tGaslist, .5 | |
348 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
349 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
350 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
351 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
352 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
353 MENU_END | |
354 | |
355 | |
356 do_divemode_sensor: | |
357 clrf menupos3 ; show customview 1 (HUD Data) | |
358 bsf toggle_customview | |
300 movlw .1 | 359 movlw .1 |
301 movwf menupos ; Set to first option in divemode menu | 360 movwf menupos ; Set to 1st option: use sensors |
302 movf hardware_flag,W | 361 do_divemode_sensor_loop: |
303 sublw 0x11 ; 2 with BLE | 362 MENU_BEGIN tGaslist, .6 |
304 btfsc STATUS,Z | 363 MENU_CALL tDivemenu_UseSensor, do_switch_sensor |
305 bra do_divemode_splist2 | 364 MENU_CALL tBack, do_divemode_splist |
306 MENU_BEGIN tGaslist, .6 | 365 MENU_CALL tExit, do_continue_main_divemenu |
307 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | 366 MENU_CALL tDiveHudMask1, do_toggle_sensor |
308 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | 367 MENU_CALL tDiveHudMask2, do_toggle_sensor |
309 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | 368 MENU_CALL tDiveHudMask3, do_toggle_sensor |
310 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | 369 MENU_END |
311 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | 370 |
312 MENU_CALL tCCRSensor, do_divemode_sensor | 371 do_divemode_setpoint_pscr: |
313 MENU_END | |
314 | |
315 do_divemode_splist2: | |
316 MENU_BEGIN tGaslist, .5 | |
317 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
318 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
319 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
320 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
321 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
322 MENU_END | |
323 | |
324 | |
325 do_divemode_sensor: | |
326 ; Set customview to 1 (HUD Data) | |
327 clrf menupos3 ; customview to come-1 | |
328 bsf toggle_customview ; Set flag, the customview will be toggled very soon now... | |
329 movlw .1 | 372 movlw .1 |
330 movwf menupos ; Set to first option in divemode menu | 373 movwf menupos ; Set to 1st option: use calculated ppO2 |
331 MENU_BEGIN tGaslist, .2 | 374 MENU_BEGIN tGaslist, .6 |
332 MENU_CALL tDivemenu_UseSensor, do_switch_to_sensor | 375 MENU_CALL tCalculated, do_switch_sp_calc |
376 MENU_CALL tDivemenu_UseSensor, do_switch_sensor | |
333 MENU_CALL tExit, do_continue_main_divemenu | 377 MENU_CALL tExit, do_continue_main_divemenu |
334 MENU_END | 378 MENU_CALL tDiveHudMask1, do_toggle_sensor |
335 | 379 MENU_CALL tDiveHudMask2, do_toggle_sensor |
336 do_divemode_togglegf: | 380 MENU_CALL tDiveHudMask3, do_toggle_sensor |
337 movff char_I_deco_model,WREG ; 0 = ZH-L16, 1 = ZH-L16-GF | 381 MENU_END |
338 decfsz WREG,W ; Was 1? | 382 |
339 bra do_continue_main_divemenu ; No, do nothing and return | 383 do_toggle_sensor: |
340 | 384 decf menupos,f ; 4, 5, 6 -> 3, 4, 5 |
341 ; Toggle GF only in GF modes | 385 decf menupos,f ; 3, 4, 5 -> 2, 3, 4 |
342 ; Set customview to 5 (GF informations) | 386 decf menupos,f ; 2, 3, 4 -> 1, 2, 3 |
343 movlw .4 | 387 dcfsnz menupos ; 1, 2, 3 -> 0, 1, 2 |
344 movwf menupos3 ; Customview to come-1 | 388 btg use_O2_sensor1 ; = |
345 bsf toggle_customview ; Set flag, the customview will be toggled very soon now... | 389 dcfsnz menupos ; 0, 1, 2 -> -1, 0, 1 |
390 btg use_O2_sensor2 ; = | |
391 dcfsnz menupos ; -1,0, 1 -> -2,-1, 0 | |
392 btg use_O2_sensor3 ; = | |
346 movlw .1 | 393 movlw .1 |
347 movwf menupos ; Set to first option in divemode menu | 394 movwf menupos |
348 MENU_BEGIN tDivemenu_ToggleGF, .2 | 395 bra do_divemode_sensor_loop |
349 MENU_CALL tDivemenu_ToggleGF, do_togglegf | 396 |
350 MENU_CALL tExit, do_continue_main_divemenu | 397 |
351 MENU_END | |
352 | |
353 END | 398 END |