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