annotate src/divemenu_tree.asm @ 538:eb0ad3ccf85b

2.22 internal release
author heinrichsweikamp
date Fri, 25 Aug 2017 11:07:52 +0200
parents f6a3e820a798
children ad7dc231c180
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
heinrichsweikamp
parents:
diff changeset
1 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
2 ;
heinrichsweikamp
parents:
diff changeset
3 ; File divemenu_tree.asm
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 ;
heinrichsweikamp
parents:
diff changeset
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
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
275
653a3ab08062 rename into hwOS
heinrichsweikamp
parents: 249
diff changeset
12 #include "hwos.inc" ; Mandatory header
0
heinrichsweikamp
parents:
diff changeset
13 #include "menu_processor.inc"
heinrichsweikamp
parents:
diff changeset
14 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c
heinrichsweikamp
parents:
diff changeset
15 #include "tft_outputs.inc"
heinrichsweikamp
parents:
diff changeset
16 #include "customview.inc"
heinrichsweikamp
parents:
diff changeset
17 #include "strings.inc"
195
bca0f054f023 allow auto-return from setpoint fallback
heinrichsweikamp
parents: 193
diff changeset
18 #include "calibrate.inc"
0
heinrichsweikamp
parents:
diff changeset
19
heinrichsweikamp
parents:
diff changeset
20 divegui CODE
heinrichsweikamp
parents:
diff changeset
21 ;=============================================================================
heinrichsweikamp
parents:
diff changeset
22 ; Main Menu
heinrichsweikamp
parents:
diff changeset
23 global do_main_divemenu
heinrichsweikamp
parents:
diff changeset
24 do_main_divemenu:
heinrichsweikamp
parents:
diff changeset
25 call menu_processor_reset ; restart from first icon.
heinrichsweikamp
parents:
diff changeset
26
heinrichsweikamp
parents:
diff changeset
27 do_continue_main_divemenu:
heinrichsweikamp
parents:
diff changeset
28 call menu_processor_pop ; drop exit line.
heinrichsweikamp
parents:
diff changeset
29 call menu_processor_pop ; drop exit line.
heinrichsweikamp
parents:
diff changeset
30
heinrichsweikamp
parents:
diff changeset
31 btfsc FLAG_ccr_mode
heinrichsweikamp
parents:
diff changeset
32 bra main_divemenu_ccr ; CCR Menu
485
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
33
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
34 btfsc FLAG_pscr_mode
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
35 bra main_divemenu_ccr ; Proceeds to PSCR menu then...
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
36
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
37 bcf ccr_diluent_setup ; For OC gases
0
heinrichsweikamp
parents:
diff changeset
38 bcf is_bailout_menu
heinrichsweikamp
parents:
diff changeset
39 movlw .1
heinrichsweikamp
parents:
diff changeset
40 movwf menupos ; Set to first option in divemode menu
401
7be43d886bb1 Logbook marker can be set in dive mode menu (OC only)
heinrichsweikamp
parents: 377
diff changeset
41 MENU_BEGIN tMainMenu, .5
0
heinrichsweikamp
parents:
diff changeset
42 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist
437
23b58c4bc6aa CHANGE: Language fixes, 2.08 release
heinrichsweikamp
parents: 426
diff changeset
43 MENU_CALL tDivemenu_ResetAvg, do_divemode_resetavg
0
heinrichsweikamp
parents:
diff changeset
44 MENU_CALL tDivemenu_ToggleGF, do_divemode_togglegf
401
7be43d886bb1 Logbook marker can be set in dive mode menu (OC only)
heinrichsweikamp
parents: 377
diff changeset
45 MENU_CALL tDivemenu_Marker, do_set_marker
0
heinrichsweikamp
parents:
diff changeset
46 MENU_CALL tExit, do_exit_divemode_menu
heinrichsweikamp
parents:
diff changeset
47 MENU_END
heinrichsweikamp
parents:
diff changeset
48
401
7be43d886bb1 Logbook marker can be set in dive mode menu (OC only)
heinrichsweikamp
parents: 377
diff changeset
49 do_set_marker:
7be43d886bb1 Logbook marker can be set in dive mode menu (OC only)
heinrichsweikamp
parents: 377
diff changeset
50 movlw d'6' ; Type of Alarm (Manual Marker)
7be43d886bb1 Logbook marker can be set in dive mode menu (OC only)
heinrichsweikamp
parents: 377
diff changeset
51 movwf AlarmType ; Copy to Alarm Register
7be43d886bb1 Logbook marker can be set in dive mode menu (OC only)
heinrichsweikamp
parents: 377
diff changeset
52 bsf event_occured ; Set Event Flag
7be43d886bb1 Logbook marker can be set in dive mode menu (OC only)
heinrichsweikamp
parents: 377
diff changeset
53 bra do_exit_divemode_menu ; And exit
7be43d886bb1 Logbook marker can be set in dive mode menu (OC only)
heinrichsweikamp
parents: 377
diff changeset
54
0
heinrichsweikamp
parents:
diff changeset
55 main_divemenu_ccr:
heinrichsweikamp
parents:
diff changeset
56 bsf ccr_diluent_setup ; For diluents
heinrichsweikamp
parents:
diff changeset
57 movlw .1
heinrichsweikamp
parents:
diff changeset
58 movwf menupos ; Set to first option in divemode menu
485
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
59
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
60 btfsc FLAG_pscr_mode
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
61 bra main_divemenu_pscr ; PSCR Menu
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
62
0
heinrichsweikamp
parents:
diff changeset
63 MENU_BEGIN tMainMenu, .6
heinrichsweikamp
parents:
diff changeset
64 MENU_CALL tDiveBailout, do_divemode_gaslist_bail
heinrichsweikamp
parents:
diff changeset
65 MENU_CALL tDivemenu_Setpoint, do_divemode_splist
heinrichsweikamp
parents:
diff changeset
66 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist
437
23b58c4bc6aa CHANGE: Language fixes, 2.08 release
heinrichsweikamp
parents: 426
diff changeset
67 MENU_CALL tDivemenu_ResetAvg, do_divemode_resetavg
0
heinrichsweikamp
parents:
diff changeset
68 MENU_CALL tDivemenu_ToggleGF, do_divemode_togglegf
heinrichsweikamp
parents:
diff changeset
69 MENU_CALL tExit, do_exit_divemode_menu
heinrichsweikamp
parents:
diff changeset
70 MENU_END
485
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
71
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
72 main_divemenu_pscr:
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
73 MENU_BEGIN tMainMenu, .6
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
74 MENU_CALL tDiveBailout, do_divemode_gaslist_bail
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
75 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist_pscr ; quit bailout and always use diluents here
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
76 MENU_CALL tDivemenu_ResetAvg, do_divemode_resetavg
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
77 MENU_CALL tDivemenu_ToggleGF, do_divemode_togglegf
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
78 MENU_CALL tDivemenu_Marker, do_set_marker
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
79 MENU_CALL tExit, do_exit_divemode_menu
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
80 MENU_END
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
81
0
heinrichsweikamp
parents:
diff changeset
82 do_togglegf:
heinrichsweikamp
parents:
diff changeset
83 TSTOSS opt_enable_aGF ; =1: aGF can be selected underwater
heinrichsweikamp
parents:
diff changeset
84 bra do_exit_divemode_menu ; exit
heinrichsweikamp
parents:
diff changeset
85 bsf toggle_gf ; Set flag...
heinrichsweikamp
parents:
diff changeset
86 bra do_exit_divemode_menu ; ...and exit
heinrichsweikamp
parents:
diff changeset
87
heinrichsweikamp
parents:
diff changeset
88 do_switch_to_sensor:
heinrichsweikamp
parents:
diff changeset
89 movlw .1 ; Switch to Sensor
426
8f8151bb53bb docu update
heinrichsweikamp
parents: 403
diff changeset
90 movff WREG,opt_ccr_mode ; =0: Fixed SP, =1: Sensor, =2: Auto SP
192
efe70488a04b voting logic for external monitoring
heinrichsweikamp
parents: 182
diff changeset
91 bsf voting_logic_sensor1
efe70488a04b voting logic for external monitoring
heinrichsweikamp
parents: 182
diff changeset
92 bsf voting_logic_sensor2
efe70488a04b voting logic for external monitoring
heinrichsweikamp
parents: 182
diff changeset
93 bsf voting_logic_sensor3
193
901c10831e4e reset voting logic on sensor switch
heinrichsweikamp
parents: 192
diff changeset
94 extern divemode_setup_sensor_values
901c10831e4e reset voting logic on sensor switch
heinrichsweikamp
parents: 192
diff changeset
95 call divemode_setup_sensor_values ; Setup sensor values
195
bca0f054f023 allow auto-return from setpoint fallback
heinrichsweikamp
parents: 193
diff changeset
96 call check_sensors ; Check O2 sensor thresholds for fallback
0
heinrichsweikamp
parents:
diff changeset
97 bra do_switch_sp2
heinrichsweikamp
parents:
diff changeset
98
437
23b58c4bc6aa CHANGE: Language fixes, 2.08 release
heinrichsweikamp
parents: 426
diff changeset
99 do_divemode_resetavg:
0
heinrichsweikamp
parents:
diff changeset
100 bsf reset_average_depth ; Set Flag
heinrichsweikamp
parents:
diff changeset
101 bra do_exit_divemode_menu ; And exit
heinrichsweikamp
parents:
diff changeset
102
53
2825f1d2262f NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents: 0
diff changeset
103
2825f1d2262f NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents: 0
diff changeset
104 do_switch_gas6:
2825f1d2262f NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents: 0
diff changeset
105 movlw .6
2825f1d2262f NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents: 0
diff changeset
106 movwf active_gas ; Gas6 selected
377
f0828110d864 set char_I_current_gas for gas6 use
heinrichsweikamp
parents: 352
diff changeset
107 movff WREG,char_I_current_gas ; for p2_deco.c
53
2825f1d2262f NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents: 0
diff changeset
108 bra do_switch_gasX
0
heinrichsweikamp
parents:
diff changeset
109 extern diveloop_loop4
heinrichsweikamp
parents:
diff changeset
110 extern timeout_divemode_menu2
heinrichsweikamp
parents:
diff changeset
111 do_switch_gas:
heinrichsweikamp
parents:
diff changeset
112 bsf divemode_gaschange ; Set flag
heinrichsweikamp
parents:
diff changeset
113 do_switch_gasX:
heinrichsweikamp
parents:
diff changeset
114 btfsc is_bailout_menu ; Bailout confirmed?
heinrichsweikamp
parents:
diff changeset
115 bsf is_bailout ; =1: Bailout
536
f6a3e820a798 update customview mask to (eventually) rewrite ppO2(Dil): to ppO2:
heinrichsweikamp
parents: 528
diff changeset
116 call customview_mask ; update customview mask to (eventually) rewrite ppO2(Dil): to ppO2:
0
heinrichsweikamp
parents:
diff changeset
117 do_exit_divemode_menu:
heinrichsweikamp
parents:
diff changeset
118 call timeout_divemode_menu2
heinrichsweikamp
parents:
diff changeset
119 clrf STKPTR
heinrichsweikamp
parents:
diff changeset
120 goto diveloop_loop4
heinrichsweikamp
parents:
diff changeset
121
heinrichsweikamp
parents:
diff changeset
122 do_switch_sp:
heinrichsweikamp
parents:
diff changeset
123 decf menupos,W ; 1-5 -> 0-4
heinrichsweikamp
parents:
diff changeset
124 lfsr FSR1,char_I_setpoint_cbar
heinrichsweikamp
parents:
diff changeset
125 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
126 movff char_I_const_ppO2,WREG
5c6da9fa5cb0 add setpoint change to first sample in CCR mode
heinrichsweikamp
parents: 275
diff changeset
127 call transmit_setpoint ; Transmit current setpoint from WREG (in cbar) to external electronics
0
heinrichsweikamp
parents:
diff changeset
128 bsf setpoint_changed ; Set flag (For profile)
99
87cc1adfe4da show event "bailout" in the internal logbook
heinrichsweikamp
parents: 97
diff changeset
129 bsf event_occured ; Set global event byte
0
heinrichsweikamp
parents:
diff changeset
130
97
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 53
diff changeset
131 ; Reconfigure last diluent
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 53
diff changeset
132 extern setup_dil_registers
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 53
diff changeset
133 bcf is_bailout ; =1: Bailout
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 53
diff changeset
134 movff active_diluent,WREG ; As a backup when switching back from Bailout to CCR
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 53
diff changeset
135 decf WREG ; 0-4
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 53
diff changeset
136 call setup_dil_registers ; With WREG=Gas 0-4
53a99a2dc6a1 CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents: 53
diff changeset
137
0
heinrichsweikamp
parents:
diff changeset
138 clrf WREG ; Switch to fixed SP
426
8f8151bb53bb docu update
heinrichsweikamp
parents: 403
diff changeset
139 movff WREG,opt_ccr_mode ; =0: Fixed SP, =1: Sensor, =2: Auto SP
0
heinrichsweikamp
parents:
diff changeset
140 clrf WREG
heinrichsweikamp
parents:
diff changeset
141 movff WREG,char_O_deco_status ; Restart decoplan computation
heinrichsweikamp
parents:
diff changeset
142
heinrichsweikamp
parents:
diff changeset
143 do_switch_sp2:
heinrichsweikamp
parents:
diff changeset
144 ; Clear some flags in case we were in bailout before...
heinrichsweikamp
parents:
diff changeset
145 bcf is_bailout ; =1: Bailout
heinrichsweikamp
parents:
diff changeset
146 bcf is_bailout_menu ;
485
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
147 bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode
0
heinrichsweikamp
parents:
diff changeset
148 bcf blinking_better_gas ; Clear blinking flag
536
f6a3e820a798 update customview mask to (eventually) rewrite ppO2(Dil): to ppO2:
heinrichsweikamp
parents: 528
diff changeset
149 call customview_mask ; update customview mask to (eventually) rewrite ppO2(Dil): to ppO2:
0
heinrichsweikamp
parents:
diff changeset
150 bra do_exit_divemode_menu ; And exit
heinrichsweikamp
parents:
diff changeset
151
485
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
152 do_divemode_gaslist_pscr:
502
0910c227018f BUGFIX: PSCR mode showed bailout gaslist instead of diluent gaslist
heinrichsweikamp
parents: 485
diff changeset
153 bsf ccr_diluent_setup ; For Diluents
485
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
154 bcf is_bailout ; =1: Bailout
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
155 bcf is_bailout_menu ;
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
156 bra do_divemode_gaslist_pscr2
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
157
0
heinrichsweikamp
parents:
diff changeset
158 do_divemode_gaslist_bail:
heinrichsweikamp
parents:
diff changeset
159 bcf ccr_diluent_setup ; For OC gases
heinrichsweikamp
parents:
diff changeset
160 bsf is_bailout_menu ; =1: Bailout
heinrichsweikamp
parents:
diff changeset
161 do_divemode_gaslist:
heinrichsweikamp
parents:
diff changeset
162 btfsc is_bailout ; In Bailout case?
heinrichsweikamp
parents:
diff changeset
163 bcf ccr_diluent_setup ; Yes, use OC gases
485
18e047102e49 3.14 BETA release
heinrichsweikamp
parents: 437
diff changeset
164 do_divemode_gaslist_pscr2:
0
heinrichsweikamp
parents:
diff changeset
165 bsf short_gas_decriptions
heinrichsweikamp
parents:
diff changeset
166 movlw .1
heinrichsweikamp
parents:
diff changeset
167 movwf menupos ; Set to first option in divemode menu
heinrichsweikamp
parents:
diff changeset
168 MENU_BEGIN tGaslist, .6
heinrichsweikamp
parents:
diff changeset
169 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas
heinrichsweikamp
parents:
diff changeset
170 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas
heinrichsweikamp
parents:
diff changeset
171 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas
heinrichsweikamp
parents:
diff changeset
172 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas
heinrichsweikamp
parents:
diff changeset
173 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas
heinrichsweikamp
parents:
diff changeset
174 MENU_CALL tMore, do_divemode_gaslist_more0
heinrichsweikamp
parents:
diff changeset
175 MENU_END
heinrichsweikamp
parents:
diff changeset
176
heinrichsweikamp
parents:
diff changeset
177 do_divemode_gaslist_more0:
heinrichsweikamp
parents:
diff changeset
178 movlw .1
heinrichsweikamp
parents:
diff changeset
179 movwf menupos ; Set to first option in divemode menu
heinrichsweikamp
parents:
diff changeset
180 do_divemode_gaslist_more:
heinrichsweikamp
parents:
diff changeset
181 MENU_BEGIN tGaslist, .6
heinrichsweikamp
parents:
diff changeset
182 MENU_CALL tO2Plus, do_dive_pO2
heinrichsweikamp
parents:
diff changeset
183 MENU_CALL tO2Minus, do_dive_mO2
heinrichsweikamp
parents:
diff changeset
184 MENU_CALL tHePlus, do_dive_pHe
heinrichsweikamp
parents:
diff changeset
185 MENU_CALL tHeMinus, do_dive_mHe
403
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
186 MENU_DYNAMIC gaslist_strcat_gasx, do_switch_gas6
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
187 MENU_CALL tDivemenu_LostGas, do_lost_gas
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
188 MENU_END
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
189
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
190 do_lost_gas:
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
191 movlw .1
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
192 movwf menupos ; Set to first option in divemode menu
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
193 do_lost_gas0:
511
7db10ebae205 BUGFIX: Lost Diluent now possible in CCR and PSCR mode
heinrichsweikamp
parents: 502
diff changeset
194 ; bcf ccr_diluent_setup ; use OC gases
7db10ebae205 BUGFIX: Lost Diluent now possible in CCR and PSCR mode
heinrichsweikamp
parents: 502
diff changeset
195 ; bsf is_bailout_menu ; =1: Bailout
403
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
196 bsf short_gas_decriptions
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
197 MENU_BEGIN tDivemenu_LostGas, .6
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
198 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
199 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
200 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
201 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
202 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
203 MENU_CALL tExit, do_exit_divemode_menu
0
heinrichsweikamp
parents:
diff changeset
204 MENU_END
heinrichsweikamp
parents:
diff changeset
205
403
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
206 do_toggle_active:
511
7db10ebae205 BUGFIX: Lost Diluent now possible in CCR and PSCR mode
heinrichsweikamp
parents: 502
diff changeset
207 movlw .5
7db10ebae205 BUGFIX: Lost Diluent now possible in CCR and PSCR mode
heinrichsweikamp
parents: 502
diff changeset
208 btfsc ccr_diluent_setup ; use OC gases
7db10ebae205 BUGFIX: Lost Diluent now possible in CCR and PSCR mode
heinrichsweikamp
parents: 502
diff changeset
209 addwf menupos,F ; -> 6-10 for Diluents
7db10ebae205 BUGFIX: Lost Diluent now possible in CCR and PSCR mode
heinrichsweikamp
parents: 502
diff changeset
210
403
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
211 decf menupos,W ; 1-5 -> 0-4
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
212 lfsr FSR1,opt_gas_type+0
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
213 movff PLUSW1,lo
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
214 tstfsz lo ; Already disabled?
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
215 bra do_toggle_active2 ; No, disable now!
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
216
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
217 ; Copy opt_gas_type_backup+W back to opt_gas_type+W
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
218 decf menupos,W ; 1-5 -> 0-4
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
219 lfsr FSR1,opt_gas_type_backup+0
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
220 movff PLUSW1,lo
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
221 decf menupos,W ; 1-5 -> 0-4
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
222 lfsr FSR1,opt_gas_type+0
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
223 movff lo,PLUSW1
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
224
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
225 ; Copy opt_OC_bail_gas_change_backup+W back to opt_OC_bail_gas_change+W
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
226 decf menupos,W ; 1-5 -> 0-4
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
227 lfsr FSR1,opt_OC_bail_gas_change_backup+0
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
228 movff PLUSW1,lo
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
229 decf menupos,W ; 1-5 -> 0-4
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
230 lfsr FSR1,opt_OC_bail_gas_change+0
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
231 movff lo,PLUSW1
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
232
511
7db10ebae205 BUGFIX: Lost Diluent now possible in CCR and PSCR mode
heinrichsweikamp
parents: 502
diff changeset
233 movlw .5
7db10ebae205 BUGFIX: Lost Diluent now possible in CCR and PSCR mode
heinrichsweikamp
parents: 502
diff changeset
234 btfsc ccr_diluent_setup ; use OC gases?
7db10ebae205 BUGFIX: Lost Diluent now possible in CCR and PSCR mode
heinrichsweikamp
parents: 502
diff changeset
235 subwf menupos,F ; Back to 1-5
7db10ebae205 BUGFIX: Lost Diluent now possible in CCR and PSCR mode
heinrichsweikamp
parents: 502
diff changeset
236
403
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
237 bra do_lost_gas0 ; Return to list and show updated result
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
238
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
239 do_toggle_active2:
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
240 clrf PLUSW1 ; 0=Disabled, 1=First, 2=Travel, 3=Deco
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
241
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
242 ; Also delete change depth here to have the menu updated immediately
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
243 lfsr FSR1,opt_OC_bail_gas_change+0
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
244 clrf PLUSW1
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
245
511
7db10ebae205 BUGFIX: Lost Diluent now possible in CCR and PSCR mode
heinrichsweikamp
parents: 502
diff changeset
246 movlw .5
7db10ebae205 BUGFIX: Lost Diluent now possible in CCR and PSCR mode
heinrichsweikamp
parents: 502
diff changeset
247 btfsc ccr_diluent_setup ; use OC gases?
7db10ebae205 BUGFIX: Lost Diluent now possible in CCR and PSCR mode
heinrichsweikamp
parents: 502
diff changeset
248 subwf menupos,F ; Back to 1-5
7db10ebae205 BUGFIX: Lost Diluent now possible in CCR and PSCR mode
heinrichsweikamp
parents: 502
diff changeset
249
403
6e60012bb3fc NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents: 401
diff changeset
250 bra do_lost_gas0 ; Return to list and show updated result
0
heinrichsweikamp
parents:
diff changeset
251
heinrichsweikamp
parents:
diff changeset
252 do_dive_pO2:
heinrichsweikamp
parents:
diff changeset
253 banksel char_I_O2_ratio
heinrichsweikamp
parents:
diff changeset
254 incf char_I_O2_ratio,F ; O2++
heinrichsweikamp
parents:
diff changeset
255 movf char_I_He_ratio,W
heinrichsweikamp
parents:
diff changeset
256 addwf char_I_O2_ratio,W
heinrichsweikamp
parents:
diff changeset
257 movwf temp_bankx400
heinrichsweikamp
parents:
diff changeset
258 movlw .101
heinrichsweikamp
parents:
diff changeset
259 cpfslt temp_bankx400 ; O2+He<101?
heinrichsweikamp
parents:
diff changeset
260 decf char_I_O2_ratio,F ; O2-- (Unchanged)
heinrichsweikamp
parents:
diff changeset
261 ; bra do_divemode_gaslist_more_common
heinrichsweikamp
parents:
diff changeset
262 do_divemode_gaslist_more_common:
181
32c17df38423 BUGFIX: END/EAD updated when adjusting current gas during the dive
heinrichsweikamp
parents: 99
diff changeset
263 movf char_I_O2_ratio,W ; Add O2...
32c17df38423 BUGFIX: END/EAD updated when adjusting current gas during the dive
heinrichsweikamp
parents: 99
diff changeset
264 addwf char_I_He_ratio,W ; ...and He...
32c17df38423 BUGFIX: END/EAD updated when adjusting current gas during the dive
heinrichsweikamp
parents: 99
diff changeset
265 sublw .100 ; ...subtract both from 100
32c17df38423 BUGFIX: END/EAD updated when adjusting current gas during the dive
heinrichsweikamp
parents: 99
diff changeset
266 movwf char_I_N2_ratio ; -> N2!
0
heinrichsweikamp
parents:
diff changeset
267 banksel common
heinrichsweikamp
parents:
diff changeset
268 bsf gas6_changed ; Set flag
heinrichsweikamp
parents:
diff changeset
269 bra do_divemode_gaslist_more
heinrichsweikamp
parents:
diff changeset
270
heinrichsweikamp
parents:
diff changeset
271 do_dive_mO2:
heinrichsweikamp
parents:
diff changeset
272 banksel char_I_O2_ratio
heinrichsweikamp
parents:
diff changeset
273 decf char_I_O2_ratio,F ; O2--
heinrichsweikamp
parents:
diff changeset
274 movlw gaslist_min_o2
heinrichsweikamp
parents:
diff changeset
275 cpfslt char_I_O2_ratio
heinrichsweikamp
parents:
diff changeset
276 bra do_divemode_gaslist_more_common
heinrichsweikamp
parents:
diff changeset
277 movlw gaslist_min_o2
heinrichsweikamp
parents:
diff changeset
278 movwf char_I_O2_ratio
heinrichsweikamp
parents:
diff changeset
279 bra do_divemode_gaslist_more_common
heinrichsweikamp
parents:
diff changeset
280
heinrichsweikamp
parents:
diff changeset
281
heinrichsweikamp
parents:
diff changeset
282 do_dive_pHe:
heinrichsweikamp
parents:
diff changeset
283 banksel char_I_O2_ratio
heinrichsweikamp
parents:
diff changeset
284 incf char_I_He_ratio,F ; He++
heinrichsweikamp
parents:
diff changeset
285 movf char_I_He_ratio,W
heinrichsweikamp
parents:
diff changeset
286 addwf char_I_O2_ratio,W
heinrichsweikamp
parents:
diff changeset
287 movwf lo
heinrichsweikamp
parents:
diff changeset
288 movlw .101
heinrichsweikamp
parents:
diff changeset
289 cpfslt lo ; O2+He<101?
heinrichsweikamp
parents:
diff changeset
290 decf char_I_He_ratio,F ; Yes, He-- (Unchanged)
heinrichsweikamp
parents:
diff changeset
291 bra do_divemode_gaslist_more_common
heinrichsweikamp
parents:
diff changeset
292
heinrichsweikamp
parents:
diff changeset
293 do_dive_mHe:
heinrichsweikamp
parents:
diff changeset
294 banksel char_I_O2_ratio
heinrichsweikamp
parents:
diff changeset
295 decf char_I_He_ratio,F ; He--
heinrichsweikamp
parents:
diff changeset
296 bnn do_divemode_gaslist_more_common
heinrichsweikamp
parents:
diff changeset
297 clrf char_I_He_ratio
heinrichsweikamp
parents:
diff changeset
298 bra do_divemode_gaslist_more_common
heinrichsweikamp
parents:
diff changeset
299
heinrichsweikamp
parents:
diff changeset
300 do_divemode_splist:
heinrichsweikamp
parents:
diff changeset
301 bsf short_gas_decriptions
heinrichsweikamp
parents:
diff changeset
302 movlw .1
heinrichsweikamp
parents:
diff changeset
303 movwf menupos ; Set to first option in divemode menu
249
94bf757690cf ignore sensor for non-sensor hardware
heinrichsweikamp
parents: 195
diff changeset
304 movf hardware_flag,W
94bf757690cf ignore sensor for non-sensor hardware
heinrichsweikamp
parents: 195
diff changeset
305 sublw 0x11 ; 2 with BLE
94bf757690cf ignore sensor for non-sensor hardware
heinrichsweikamp
parents: 195
diff changeset
306 btfsc STATUS,Z
94bf757690cf ignore sensor for non-sensor hardware
heinrichsweikamp
parents: 195
diff changeset
307 bra do_divemode_splist2
0
heinrichsweikamp
parents:
diff changeset
308 MENU_BEGIN tGaslist, .6
heinrichsweikamp
parents:
diff changeset
309 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
heinrichsweikamp
parents:
diff changeset
310 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
heinrichsweikamp
parents:
diff changeset
311 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
heinrichsweikamp
parents:
diff changeset
312 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
heinrichsweikamp
parents:
diff changeset
313 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
heinrichsweikamp
parents:
diff changeset
314 MENU_CALL tCCRSensor, do_divemode_sensor
heinrichsweikamp
parents:
diff changeset
315 MENU_END
heinrichsweikamp
parents:
diff changeset
316
249
94bf757690cf ignore sensor for non-sensor hardware
heinrichsweikamp
parents: 195
diff changeset
317 do_divemode_splist2:
94bf757690cf ignore sensor for non-sensor hardware
heinrichsweikamp
parents: 195
diff changeset
318 MENU_BEGIN tGaslist, .5
94bf757690cf ignore sensor for non-sensor hardware
heinrichsweikamp
parents: 195
diff changeset
319 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
94bf757690cf ignore sensor for non-sensor hardware
heinrichsweikamp
parents: 195
diff changeset
320 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
94bf757690cf ignore sensor for non-sensor hardware
heinrichsweikamp
parents: 195
diff changeset
321 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
94bf757690cf ignore sensor for non-sensor hardware
heinrichsweikamp
parents: 195
diff changeset
322 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
94bf757690cf ignore sensor for non-sensor hardware
heinrichsweikamp
parents: 195
diff changeset
323 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp
94bf757690cf ignore sensor for non-sensor hardware
heinrichsweikamp
parents: 195
diff changeset
324 MENU_END
94bf757690cf ignore sensor for non-sensor hardware
heinrichsweikamp
parents: 195
diff changeset
325
94bf757690cf ignore sensor for non-sensor hardware
heinrichsweikamp
parents: 195
diff changeset
326
0
heinrichsweikamp
parents:
diff changeset
327 do_divemode_sensor:
heinrichsweikamp
parents:
diff changeset
328 ; Set customview to 1 (HUD Data)
heinrichsweikamp
parents:
diff changeset
329 clrf menupos3 ; customview to come-1
heinrichsweikamp
parents:
diff changeset
330 bsf toggle_customview ; Set flag, the customview will be toggled very soon now...
heinrichsweikamp
parents:
diff changeset
331 movlw .1
heinrichsweikamp
parents:
diff changeset
332 movwf menupos ; Set to first option in divemode menu
heinrichsweikamp
parents:
diff changeset
333 MENU_BEGIN tGaslist, .2
heinrichsweikamp
parents:
diff changeset
334 MENU_CALL tDivemenu_UseSensor, do_switch_to_sensor
heinrichsweikamp
parents:
diff changeset
335 MENU_CALL tExit, do_continue_main_divemenu
heinrichsweikamp
parents:
diff changeset
336 MENU_END
heinrichsweikamp
parents:
diff changeset
337
heinrichsweikamp
parents:
diff changeset
338 do_divemode_togglegf:
528
4921aa796691 BUGFIX: Ignore "Toggle GF" Menu entry (in divemode) when using the non-GF deco mode
heinrichsweikamp
parents: 511
diff changeset
339 movff char_I_deco_model,WREG ; 0 = ZH-L16, 1 = ZH-L16-GF
4921aa796691 BUGFIX: Ignore "Toggle GF" Menu entry (in divemode) when using the non-GF deco mode
heinrichsweikamp
parents: 511
diff changeset
340 decfsz WREG,W ; Was 1?
4921aa796691 BUGFIX: Ignore "Toggle GF" Menu entry (in divemode) when using the non-GF deco mode
heinrichsweikamp
parents: 511
diff changeset
341 bra do_continue_main_divemenu ; No, do nothing and return
4921aa796691 BUGFIX: Ignore "Toggle GF" Menu entry (in divemode) when using the non-GF deco mode
heinrichsweikamp
parents: 511
diff changeset
342
4921aa796691 BUGFIX: Ignore "Toggle GF" Menu entry (in divemode) when using the non-GF deco mode
heinrichsweikamp
parents: 511
diff changeset
343 ; Toggle GF only in GF modes
0
heinrichsweikamp
parents:
diff changeset
344 ; Set customview to 5 (GF informations)
heinrichsweikamp
parents:
diff changeset
345 movlw .4
heinrichsweikamp
parents:
diff changeset
346 movwf menupos3 ; Customview to come-1
heinrichsweikamp
parents:
diff changeset
347 bsf toggle_customview ; Set flag, the customview will be toggled very soon now...
heinrichsweikamp
parents:
diff changeset
348 movlw .1
heinrichsweikamp
parents:
diff changeset
349 movwf menupos ; Set to first option in divemode menu
heinrichsweikamp
parents:
diff changeset
350 MENU_BEGIN tDivemenu_ToggleGF, .2
heinrichsweikamp
parents:
diff changeset
351 MENU_CALL tDivemenu_ToggleGF, do_togglegf
heinrichsweikamp
parents:
diff changeset
352 MENU_CALL tExit, do_continue_main_divemenu
heinrichsweikamp
parents:
diff changeset
353 MENU_END
heinrichsweikamp
parents:
diff changeset
354
heinrichsweikamp
parents:
diff changeset
355 END