Mercurial > public > hwos_code
annotate src/divemenu_tree.asm @ 610:2ce43f09586e
Mod for new pcb designs
author | heinrichsweikamp |
---|---|
date | Wed, 09 Jan 2019 18:35:20 +0100 |
parents | ca4556fb60b9 |
children | c40025d8e750 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
604 | 3 ; File divemenu_tree.asm REFACTORED VERSION V2.99e |
0 | 4 ; |
275 | 5 ; OSTC dive mode menu |
0 | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
10 ; 2013-02-02 : [mH] Made out of menu_tree.asm | |
11 | |
582 | 12 #include "hwos.inc" ; Mandatory header |
13 #include "menu_processor.inc" | |
14 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c | |
15 #include "tft_outputs.inc" | |
16 #include "customview.inc" | |
17 #include "strings.inc" | |
18 #include "calibrate.inc" | |
19 | |
20 extern timeout_divemode_menu2 | |
604 | 21 extern restart_deco_engine_wo_ceiling |
582 | 22 extern diveloop_loop4 |
0 | 23 |
560 | 24 |
604 | 25 dmenu_tree CODE |
582 | 26 |
0 | 27 ;============================================================================= |
28 ; Main Menu | |
604 | 29 |
30 do_return_main_divemenu: | |
31 call menu_processor_double_pop ; drop exit line and back to last line | |
32 incf selected_item,W ; item numbers start with 0, menu positions with 1 | |
33 movwf menupos1 ; position cursor where we came from | |
34 bra do_main_divemenu_common | |
35 | |
582 | 36 global do_main_divemenu |
0 | 37 do_main_divemenu: |
582 | 38 call menu_processor_reset ; restart from first icon |
39 movlw .1 | |
40 movwf menupos1 ; set to first option in divemode menu | |
604 | 41 |
42 do_main_divemenu_common: | |
560 | 43 btfsc FLAG_ccr_mode |
44 bra main_divemenu_loop ; goto CCR / pSCR Menu menu | |
45 btfsc FLAG_pscr_mode | |
46 bra main_divemenu_loop ; goto CCR / pSCR Menu menu | |
47 | |
582 | 48 main_divemenu_OC: |
604 | 49 bcf FLAG_diluent_setup ; set to operations on OC gases |
560 | 50 bcf is_bailout_menu |
582 | 51 |
604 | 52 IFDEF _cave_mode |
53 btfss FLAG_cave_mode ; in cave mode? | |
54 bra main_divemenu_OC_no_cave ; NO - do OC menu without turn option | |
55 | |
56 MENU_BEGIN tMainMenu, .6 | |
57 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist | |
58 MENU_CALL tDivemenu_ResetAvg, do_reset_average | |
59 MENU_DYNAMIC do_toggle_gf_label, do_toggle_gf | |
60 MENU_CALL tDivemenu_Marker, do_set_marker | |
61 MENU_DYNAMIC do_turn_dive_label, do_turn_dive | |
62 MENU_CALL tExit, do_exit_divemode_menu | |
63 MENU_END | |
64 ENDIF | |
65 | |
66 main_divemenu_OC_no_cave: | |
582 | 67 MENU_BEGIN tMainMenu, .5 |
604 | 68 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist |
69 MENU_CALL tDivemenu_ResetAvg, do_reset_average | |
70 MENU_DYNAMIC do_toggle_gf_label, do_toggle_gf | |
71 MENU_CALL tDivemenu_Marker, do_set_marker | |
72 MENU_CALL tExit, do_exit_divemode_menu | |
560 | 73 MENU_END |
0 | 74 |
604 | 75 |
560 | 76 main_divemenu_loop: |
604 | 77 bsf FLAG_diluent_setup ; set to operations on diluents |
78 bcf is_bailout_menu ; flag as none-bailout menu | |
582 | 79 btfsc FLAG_pscr_mode |
604 | 80 bra main_divemenu_pscr ; pSCR menu |
582 | 81 |
82 MENU_BEGIN tMainMenu, .6 | |
604 | 83 MENU_CALL tDiveBailout, do_divemode_gaslist_bail |
84 MENU_CALL tDivemenu_Setpoint, do_divemode_splist | |
85 MENU_CALL tDivemenu_Diluent, do_divemode_gaslist | |
86 MENU_CALL tDivemenu_Avg_Mkr, do_reset_avg_set_mkr | |
87 MENU_DYNAMIC do_toggle_gf_label, do_toggle_gf | |
88 MENU_CALL tExit, do_exit_divemode_menu | |
582 | 89 MENU_END |
90 | |
485 | 91 main_divemenu_pscr: |
604 | 92 btfsc analog_o2_input ; do we have an analog input (OSTC cR)? |
93 bra main_divemenu_pscr_sensors ; YES | |
94 btfsc optical_input ; do we have an optical input (OSTC 3)? | |
95 bra main_divemenu_pscr_sensors ; YES | |
560 | 96 |
97 main_divemenu_pscr_no_sensors: | |
582 | 98 MENU_BEGIN tMainMenu, .6 |
604 | 99 MENU_CALL tDiveBailout, do_divemode_gaslist_bail |
100 MENU_CALL tDivemenu_Premix, do_divemode_gaslist | |
101 MENU_CALL tBackToLoop, do_switch_sp_calc | |
102 MENU_CALL tDivemenu_Avg_Mkr, do_reset_avg_set_mkr | |
103 MENU_DYNAMIC do_toggle_gf_label, do_toggle_gf | |
104 MENU_CALL tExit, do_exit_divemode_menu | |
582 | 105 MENU_END |
106 | |
107 main_divemenu_pscr_sensors: | |
108 MENU_BEGIN tMainMenu, .6 | |
604 | 109 MENU_CALL tDiveBailout, do_divemode_gaslist_bail |
110 MENU_CALL tCCRSensor, do_divemode_setpoint_pscr | |
111 MENU_CALL tDivemenu_Premix, do_divemode_gaslist | |
112 MENU_CALL tDivemenu_Avg_Mkr, do_reset_avg_set_mkr | |
113 MENU_DYNAMIC do_toggle_gf_label, do_toggle_gf | |
114 MENU_CALL tExit, do_exit_divemode_menu | |
582 | 115 MENU_END |
116 | |
0 | 117 |
560 | 118 do_toggle_gf: |
604 | 119 TSTOSS char_I_deco_model ; toggle GF only in GF modes - in GF mode? (0 = ZH-L16, 1 = ZH-L16-GF) |
120 bra do_main_divemenu_common ; NO - do nothing and return | |
582 | 121 TSTOSS opt_enable_aGF ; =1: aGF can be selected underwater |
604 | 122 bra do_main_divemenu_common ; NO - do nothing and return |
123 movlw index_gf_factors-1 ; custom view number one below GF factors | |
124 movwf menupos3 ; set custom view number | |
125 bsf toggle_customview ; initiate toggle to desired custom view -> GF factors | |
560 | 126 movlw .1 |
604 | 127 movwf menupos1 ; set to first option in dive mode menu |
582 | 128 |
129 MENU_BEGIN tDivemenu_ToggleGF, .2 | |
604 | 130 MENU_CALL tDivemenu_ToggleGF, do_togglegf |
131 MENU_CALL tBack, do_return_main_divemenu | |
582 | 132 MENU_END |
0 | 133 |
560 | 134 do_togglegf: |
604 | 135 bsf toggle_gf ; set command flag... |
560 | 136 bra do_exit_divemode_menu ; continue with exiting menu code |
582 | 137 |
138 | |
604 | 139 do_reset_avg_set_mkr: |
140 movlw .1 | |
141 movwf menupos1 ; set to first option in dive mode menu | |
142 | |
143 IFDEF _cave_mode | |
144 btfss FLAG_cave_mode ; in cave mode? | |
145 bra do_reset_average_no_cave ; NO - do menu without turn option | |
146 | |
147 MENU_BEGIN tDivemenu_Avg_Mkr, .4 | |
148 MENU_CALL tDivemenu_ResetAvg, do_reset_average | |
149 MENU_CALL tDivemenu_Marker, do_set_marker | |
150 MENU_DYNAMIC do_turn_dive_label, do_turn_dive | |
151 MENU_CALL tBack, do_return_main_divemenu | |
152 MENU_END | |
153 ENDIF | |
154 | |
155 do_reset_average_no_cave: | |
156 MENU_BEGIN tDivemenu_Avg_Mkr, .3 | |
157 MENU_CALL tDivemenu_ResetAvg, do_reset_average | |
158 MENU_CALL tDivemenu_Marker, do_set_marker | |
159 MENU_CALL tBack, do_return_main_divemenu | |
160 MENU_END | |
161 | |
162 | |
163 do_reset_average: | |
164 bsf reset_average_depth ; set flag... | |
165 bra do_exit_divemode_menu ; ... and exit | |
166 | |
560 | 167 do_set_marker: |
582 | 168 bsf FLAG_set_marker ; set flag... |
169 bra do_exit_divemode_menu ; ... and exit | |
170 | |
604 | 171 IFDEF _cave_mode |
172 do_turn_dive: | |
173 bsf toggle_turn_dive ; set flag... | |
174 bra do_exit_divemode_menu ; ... and exit | |
175 ENDIF | |
0 | 176 |
582 | 177 |
560 | 178 do_switch_sensor: ; entry point when coming from switch to sensor |
604 | 179 movlw .1 ; switch to sensor |
582 | 180 movff WREG,opt_ccr_mode ; =0: Fixed SP (CCR) / calculated (pSCR), =1: Sensor, =2: Auto SP |
181 ; enable all sensors | |
182 bsf use_O2_sensor1 | |
183 bsf use_O2_sensor2 | |
184 bsf use_O2_sensor3 | |
185 bra do_switch_sp_com ; continue with common part | |
186 | |
560 | 187 do_switch_sp: ; entry point when coming from manual setpoint selection (CCR) |
582 | 188 decf menupos1,W ; 1-5 -> 0-4 |
189 lfsr FSR1,char_I_setpoint_cbar | |
190 movff PLUSW1,char_I_const_ppO2 ; setup fixed setpoint | |
191 movff char_I_const_ppO2,WREG | |
192 call transmit_setpoint ; transmit current setpoint from WREG (in cbar) to external electronics | |
560 | 193 bcf setpoint_fallback ; clear fallback condition (stops fallback warning) |
604 | 194 clrf WREG ; switch to fixed SP |
560 | 195 movff WREG,opt_ccr_mode ; =0: Fixed SP (CCR) / calculated (pSCR), =1: Sensor, =2: Auto SP |
196 bra do_switch_sp_com | |
0 | 197 |
560 | 198 do_switch_sp_calc: ; entry point when coming from switch to calculated ppO2 (pSCR) |
199 bcf setpoint_fallback ; clear fallback condition (stops fallback warning) | |
582 | 200 clrf WREG ; Switch to fixed SP |
201 movff WREG,opt_ccr_mode ; =0: Fixed SP (CCR) / calculated (pSCR), =1: Sensor, =2: Auto SP | |
560 | 202 movff WREG,char_I_const_ppO2 ; set setpoint to 0, this forces deco engine to take the computed ppO2 |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
53
diff
changeset
|
203 |
560 | 204 do_switch_sp_com: ; merge point to common part |
582 | 205 bsf event_occured ; set global event byte |
206 bsf setpoint_changed ; set flag (for profile) | |
207 | |
208 ; Clear some flags in case we were in bailout before... | |
604 | 209 bcf FLAG_bailout_mode ; end bailout mode |
582 | 210 ;bcf is_bailout_menu ; not needed |
604 | 211 bcf better_gas_available ; =1: a better gas is available and a gas change is advised in dive mode |
212 bcf better_dil_available ; =1: a better diluent is available and a gas change is advised in dive mode | |
582 | 213 bcf blinking_better_gas ; clear blinking flag |
604 | 214 bcf blinking_better_dil ; clear blinking flag |
215 bsf redraw_custview_mask ; request update of custom view mask to (eventually) rewrite "ppO2(Dil)" to "ppO2" or SAC label | |
0 | 216 |
582 | 217 bsf FLAG_back_to_loop ; indicate that it is a switchback from OC bailout to CCR/pSCR loop |
218 bsf divemode_gaschange ; initiate reconfiguration to loop mode on last diluent | |
219 | |
220 bra do_exit_divemode_menu ; continue with exiting menu code | |
221 | |
0 | 222 |
560 | 223 do_divemode_gaslist_bail: ; entry point from CCR/pSCR to bailout to OC gases |
604 | 224 bcf FLAG_diluent_setup ; switch to OC gases |
582 | 225 bsf is_bailout_menu ; flag it is a bailout action |
560 | 226 do_divemode_gaslist: ; entry point for switching: OC -> gases, loop -> diluents |
604 | 227 btfsc FLAG_bailout_mode ; in bailout mode? |
228 bcf FLAG_diluent_setup ; yes - for safety reasons, redirect to OC (bailout) gases | |
229 bsf short_gas_decriptions ; do not show "Gas x" etc. | |
230 bsf better_gas_hint ; mark the gas which is the best gas/diluent | |
231 movf best_gas_number,W ; load number of best gas (1-5)into WREG | |
232 btfsc FLAG_diluent_setup ; in diluent selection? | |
233 movf best_dil_number,W ; YES - overwrite with best diluent (1-5) | |
234 bnz do_divemode_gaslist_1 ; best gas/dil number = 0 (none available) ? | |
235 movlw .1 ; YES - default to first gas/dil | |
236 btfsc WREG,7 ; best gas/dil number >= 128 (not computed yet) ? | |
237 movlw .1 ; YES - default to first gas/dil | |
238 do_divemode_gaslist_1: | |
239 movwf menupos1 ; position cursor to best gas/dil (or first option if none avail) | |
582 | 240 MENU_BEGIN tGaslist, .6 |
604 | 241 MENU_DYNAMIC gaslist_strcat_gas_cd, do_switch_gas |
242 MENU_DYNAMIC gaslist_strcat_gas_cd, do_switch_gas | |
243 MENU_DYNAMIC gaslist_strcat_gas_cd, do_switch_gas | |
244 MENU_DYNAMIC gaslist_strcat_gas_cd, do_switch_gas | |
245 MENU_DYNAMIC gaslist_strcat_gas_cd, do_switch_gas | |
582 | 246 MENU_CALL tMore, do_divemode_gaslist_more |
247 MENU_END | |
248 | |
0 | 249 |
250 do_divemode_gaslist_more: | |
560 | 251 movlw .1 |
604 | 252 movwf menupos1 ; set to first option in dive mode menu |
582 | 253 |
560 | 254 movff char_I_O2_ratio,gas6_O2_ratio ; initialize gas6 with currently breathed gas - O2 ratio |
255 movff char_I_He_ratio,gas6_He_ratio ; initialize gas6 with currently breathed gas - He ratio | |
582 | 256 |
257 do_divemode_gaslist_more_common: | |
258 MENU_BEGIN tGaslist, .6 | |
259 MENU_CALL tO2Plus, do_dive_pO2 | |
260 MENU_CALL tO2Minus, do_dive_mO2 | |
261 MENU_CALL tHePlus, do_dive_pHe | |
262 MENU_CALL tHeMinus, do_dive_mHe | |
263 MENU_DYNAMIC gaslist_strcat_gas6, do_switch_gas6 | |
264 MENU_CALL tDivemenu_LostGas, do_lost_gas | |
265 MENU_END | |
266 | |
403
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
267 |
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
268 do_lost_gas: |
560 | 269 movlw .1 |
604 | 270 movwf menupos1 ; set to first option in dive mode menu |
582 | 271 do_lost_gas_common: |
604 | 272 bsf short_gas_decriptions ; do not show "Gas x" etc. |
273 bcf better_gas_hint ; do not mark the best gas/diluent | |
582 | 274 MENU_BEGIN tDivemenu_LostGas, .6 |
604 | 275 MENU_DYNAMIC gaslist_strcat_gas_cd, do_toggle_active ; toggle the gas (in)active |
276 MENU_DYNAMIC gaslist_strcat_gas_cd, do_toggle_active ; toggle the gas (in)active | |
277 MENU_DYNAMIC gaslist_strcat_gas_cd, do_toggle_active ; toggle the gas (in)active | |
278 MENU_DYNAMIC gaslist_strcat_gas_cd, do_toggle_active ; toggle the gas (in)active | |
279 MENU_DYNAMIC gaslist_strcat_gas_cd, do_toggle_active ; toggle the gas (in)active | |
582 | 280 MENU_CALL tExit, do_exit_divemode_menu |
281 MENU_END | |
0 | 282 |
560 | 283 |
284 do_switch_gas6: | |
582 | 285 movlw .6 ; gas 6 |
604 | 286 movwf menupos1 ; transfer register for selected gas towards gas_switched_common |
582 | 287 bsf gas6_changed ; set flag for profile recording |
560 | 288 ;bra do_switch_gas ; continue with common gas-switched code |
289 | |
290 do_switch_gas: | |
604 | 291 bsf divemode_gaschange ; set flag, will also trigger restart of deco_engine |
292 btfss is_bailout_menu ; doing a bailout? | |
293 bra do_switch_gas_1 ; NO | |
294 bsf FLAG_bailout_mode ; YES - begin bailout mode | |
295 IFDEF _cave_mode | |
296 btfsc FLAG_cave_mode ; - in cave mode? | |
297 bsf FLAG_dive_turned ; YES - set dive as turned | |
298 ENDIF | |
299 do_switch_gas_1: | |
300 bcf setpoint_fallback ; eventually terminate fallback mode and get rid of its warning | |
301 bsf redraw_custview_mask ; request update of custom view mask to (eventually) rewrite "ppO2(Dil)" to "ppO2" or SAC label | |
560 | 302 ;bra do_exit_divemode_menu ; continue with exiting menu code |
582 | 303 |
560 | 304 do_exit_divemode_menu: |
305 call timeout_divemode_menu2 | |
306 clrf STKPTR | |
307 goto diveloop_loop4 | |
308 | |
309 | |
403
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
310 do_toggle_active: |
582 | 311 movlw .5 |
604 | 312 btfsc FLAG_diluent_setup ; operating on diluents? |
313 addwf menupos1,F ; YES - add offset of 5 to shift 1-5 -> 6-10 | |
314 decf menupos1,W ; 1-10 -> 0-4 for gases / 5-9 for diluents | |
315 lfsr FSR1,opt_gas_type ; load base address of gas types | |
316 movff PLUSW1,lo ; get gas/dil type | |
317 tstfsz lo ; already disabled? | |
318 bra do_toggle_active_disable ; NO - disable now | |
319 do_toggle_active_enable ; YES - re-enable now | |
320 lfsr FSR1,opt_gas_type_backup ; load base address of backed-up gas types | |
321 movff PLUSW1,lo ; get backed-up gas/dil type | |
322 lfsr FSR1,opt_gas_type ; load base address of gas types | |
323 movff lo,PLUSW1 ; restore gas type | |
324 bra do_toggle_active_common | |
325 do_toggle_active_disable: ; disable gas / diluent | |
326 ;lfsr FSR1,opt_gas_type ; (still set) | |
327 clrf PLUSW1 ; set type to disabled (0=disabled, 1=first, 2=travel/normal, 3=deco/-) | |
328 do_toggle_active_common: | |
582 | 329 movlw .5 |
604 | 330 btfsc FLAG_diluent_setup ; operating on diluents? |
331 subwf menupos1,F ; NO - back to 0-4 for gases 1-5 | |
332 bcf blinking_better_gas ; clear blinking flag for gases to avoid "leftovers" | |
333 bcf blinking_better_dil ; clear blinking flag for diluents to avoid "leftovers" | |
334 call restart_deco_engine_wo_ceiling ; invalidate deco data (but not the ceiling) and restart deco engine | |
335 bra do_lost_gas_common | |
0 | 336 |
337 do_dive_pO2: | |
560 | 338 banksel gas6_O2_ratio |
339 incf gas6_O2_ratio,F ; O2++ | |
340 movf gas6_He_ratio,W | |
341 addwf gas6_O2_ratio,W | |
342 movwf gas6_temp | |
343 movlw .101 | |
582 | 344 cpfslt gas6_temp ; O2 + He < 101 ? |
345 decf gas6_O2_ratio,F ; O2-- (unchanged) | |
346 banksel common | |
347 bra do_divemode_gaslist_more_common | |
348 | |
0 | 349 do_dive_mO2: |
582 | 350 banksel gas6_O2_ratio |
351 decf gas6_O2_ratio,F ; O2-- | |
352 movlw gaslist_min_o2 | |
353 cpfslt gas6_O2_ratio ; O2 < minimum allowed %O2? | |
354 bra do_dive_mO2_done ; NO | |
355 movlw gaslist_min_o2 ; YES - restore minimum | |
356 movwf gas6_O2_ratio | |
560 | 357 do_dive_mO2_done: |
582 | 358 banksel common |
359 bra do_divemode_gaslist_more_common | |
0 | 360 |
361 do_dive_pHe: | |
582 | 362 banksel gas6_O2_ratio |
363 incf gas6_He_ratio,F ; He++ | |
364 movf gas6_He_ratio,W | |
365 addwf gas6_O2_ratio,W | |
366 movwf lo | |
367 movlw .101 | |
368 cpfslt lo ; O2 + He < 101 ? | |
604 | 369 decf gas6_He_ratio,F ; Yes, He-- (unchanged) |
582 | 370 banksel common |
371 bra do_divemode_gaslist_more_common | |
0 | 372 |
373 do_dive_mHe: | |
560 | 374 banksel gas6_O2_ratio |
582 | 375 decf gas6_He_ratio,F ; He-- |
376 bnn do_dive_mHe_done ; H2 < 0? | |
377 clrf gas6_He_ratio ; YES - reset to 0 | |
560 | 378 do_dive_mHe_done: |
582 | 379 banksel common |
380 bra do_divemode_gaslist_more_common | |
381 | |
0 | 382 |
383 do_divemode_splist: | |
560 | 384 bsf short_gas_decriptions |
385 movlw .1 | |
604 | 386 movwf menupos1 ; set to first option in dive mode menu |
560 | 387 |
582 | 388 do_divemode_splist_common: |
604 | 389 btfsc analog_o2_input ; do we have an analog input (OSTC cR)? |
582 | 390 bra do_divemode_splist_sensor ; YES |
604 | 391 ; btfsc s8_digital ; do we have a digital input? |
392 ; bra do_divemode_splist_sensor ; YES | |
393 btfsc optical_input ; do we have an optical input (OSTC 3)? | |
582 | 394 bra do_divemode_splist_sensor ; YES |
0 | 395 |
560 | 396 do_divemode_splist_no_sensor: |
582 | 397 MENU_BEGIN tGaslist, .5 |
398 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
399 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
400 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
401 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
402 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
403 MENU_END | |
404 | |
405 do_divemode_splist_sensor: | |
406 MENU_BEGIN tGaslist, .6 | |
407 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
408 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
409 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
410 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
411 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
412 MENU_CALL tCCRSensor, do_divemode_sensor | |
413 MENU_END | |
249 | 414 |
415 | |
0 | 416 do_divemode_sensor: |
604 | 417 movlw index_ppo2_sensors-1 ; custom view number one below ppO2 sensors |
418 movwf menupos3 ; set custom view number | |
419 bsf toggle_customview ; initiate toggle to desired custom view -> ppO2 sensors | |
582 | 420 movlw .1 |
604 | 421 movwf menupos1 ; set to 1st option: use sensors |
582 | 422 |
423 do_return_divemode_sensor: | |
424 MENU_BEGIN tGaslist, .6 | |
425 MENU_CALL tDivemenu_UseSensor, do_switch_sensor | |
560 | 426 MENU_CALL tBack, do_divemode_splist |
582 | 427 MENU_CALL tExit, do_exit_divemode_menu |
560 | 428 MENU_CALL tDiveHudMask1, do_toggle_sensor |
429 MENU_CALL tDiveHudMask2, do_toggle_sensor | |
430 MENU_CALL tDiveHudMask3, do_toggle_sensor | |
582 | 431 MENU_END |
0 | 432 |
560 | 433 do_divemode_setpoint_pscr: |
582 | 434 movlw .1 |
604 | 435 movwf menupos1 ; set to 1st option: use calculated ppO2 |
582 | 436 MENU_BEGIN tGaslist, .6 |
560 | 437 MENU_CALL tCalculated, do_switch_sp_calc |
582 | 438 MENU_CALL tDivemenu_UseSensor, do_switch_sensor |
439 MENU_CALL tExit, do_exit_divemode_menu | |
560 | 440 MENU_CALL tDiveHudMask1, do_toggle_sensor |
441 MENU_CALL tDiveHudMask2, do_toggle_sensor | |
442 MENU_CALL tDiveHudMask3, do_toggle_sensor | |
582 | 443 MENU_END |
444 | |
0 | 445 |
560 | 446 do_toggle_sensor: |
582 | 447 movff menupos1,lo ; backup position |
448 decf menupos1,f ; 4, 5, 6 -> 3, 4, 5 | |
449 decf menupos1,f ; 3, 4, 5 -> 2, 3, 4 | |
450 decf menupos1,f ; 2, 3, 4 -> 1, 2, 3 | |
451 dcfsnz menupos1 ; 1, 2, 3 -> 0, 1, 2 | |
452 btg use_O2_sensor1 ; = | |
453 dcfsnz menupos1 ; 0, 1, 2 -> -1, 0, 1 | |
454 btg use_O2_sensor2 ; = | |
455 dcfsnz menupos1 ; -1,0, 1 -> -2,-1, 0 | |
456 btg use_O2_sensor3 ; = | |
457 movff lo,menupos1 ; restore position | |
458 bra do_return_divemode_sensor | |
560 | 459 |
582 | 460 END |