Mercurial > public > hwos_code
annotate src/divemenu_tree.asm @ 489:22092d14fd8c
docu (battery info byte)
| author | heinrichsweikamp |
|---|---|
| date | Mon, 27 Mar 2017 16:06:09 +0200 |
| parents | 18e047102e49 |
| children | 0910c227018f |
| rev | line source |
|---|---|
| 0 | 1 ;============================================================================= |
| 2 ; | |
| 3 ; File divemenu_tree.asm | |
| 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 |
| 20 divegui CODE | |
| 21 ;============================================================================= | |
| 22 ; Main Menu | |
| 23 global do_main_divemenu | |
| 24 do_main_divemenu: | |
| 25 call menu_processor_reset ; restart from first icon. | |
| 26 | |
| 27 do_continue_main_divemenu: | |
| 28 call menu_processor_pop ; drop exit line. | |
| 29 call menu_processor_pop ; drop exit line. | |
| 30 | |
| 31 btfsc FLAG_ccr_mode | |
| 32 bra main_divemenu_ccr ; CCR Menu | |
| 485 | 33 |
| 34 btfsc FLAG_pscr_mode | |
| 35 bra main_divemenu_ccr ; Proceeds to PSCR menu then... | |
| 36 | |
| 37 bcf ccr_diluent_setup ; For OC gases | |
| 0 | 38 bcf is_bailout_menu |
| 39 movlw .1 | |
| 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 | 42 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist |
| 437 | 43 MENU_CALL tDivemenu_ResetAvg, do_divemode_resetavg |
| 0 | 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 | 46 MENU_CALL tExit, do_exit_divemode_menu |
| 47 MENU_END | |
| 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 | 55 main_divemenu_ccr: |
| 56 bsf ccr_diluent_setup ; For diluents | |
| 57 movlw .1 | |
| 58 movwf menupos ; Set to first option in divemode menu | |
| 485 | 59 |
| 60 btfsc FLAG_pscr_mode | |
| 61 bra main_divemenu_pscr ; PSCR Menu | |
| 62 | |
| 0 | 63 MENU_BEGIN tMainMenu, .6 |
| 64 MENU_CALL tDiveBailout, do_divemode_gaslist_bail | |
| 65 MENU_CALL tDivemenu_Setpoint, do_divemode_splist | |
| 66 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist | |
| 437 | 67 MENU_CALL tDivemenu_ResetAvg, do_divemode_resetavg |
| 0 | 68 MENU_CALL tDivemenu_ToggleGF, do_divemode_togglegf |
| 69 MENU_CALL tExit, do_exit_divemode_menu | |
| 70 MENU_END | |
| 485 | 71 |
| 72 main_divemenu_pscr: | |
| 73 MENU_BEGIN tMainMenu, .6 | |
| 74 MENU_CALL tDiveBailout, do_divemode_gaslist_bail | |
| 75 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist_pscr ; quit bailout and always use diluents here | |
| 76 MENU_CALL tDivemenu_ResetAvg, do_divemode_resetavg | |
| 77 MENU_CALL tDivemenu_ToggleGF, do_divemode_togglegf | |
| 78 MENU_CALL tDivemenu_Marker, do_set_marker | |
| 79 MENU_CALL tExit, do_exit_divemode_menu | |
| 80 MENU_END | |
| 81 | |
| 0 | 82 do_togglegf: |
| 83 TSTOSS opt_enable_aGF ; =1: aGF can be selected underwater | |
| 84 bra do_exit_divemode_menu ; exit | |
| 85 bsf toggle_gf ; Set flag... | |
| 86 bra do_exit_divemode_menu ; ...and exit | |
| 87 | |
| 88 do_switch_to_sensor: | |
| 89 movlw .1 ; Switch to Sensor | |
| 426 | 90 movff WREG,opt_ccr_mode ; =0: Fixed SP, =1: Sensor, =2: Auto SP |
| 192 | 91 bsf voting_logic_sensor1 |
| 92 bsf voting_logic_sensor2 | |
| 93 bsf voting_logic_sensor3 | |
| 193 | 94 extern divemode_setup_sensor_values |
| 95 call divemode_setup_sensor_values ; Setup sensor values | |
| 195 | 96 call check_sensors ; Check O2 sensor thresholds for fallback |
| 0 | 97 bra do_switch_sp2 |
| 98 | |
| 437 | 99 do_divemode_resetavg: |
| 0 | 100 bsf reset_average_depth ; Set Flag |
| 101 bra do_exit_divemode_menu ; And exit | |
| 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 | 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 | 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 do_exit_divemode_menu: | |
| 117 call timeout_divemode_menu2 | |
| 118 clrf STKPTR | |
| 119 goto diveloop_loop4 | |
| 120 | |
| 121 do_switch_sp: | |
| 122 decf menupos,W ; 1-5 -> 0-4 | |
| 123 lfsr FSR1,char_I_setpoint_cbar | |
| 124 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
|
125 movff char_I_const_ppO2,WREG |
|
5c6da9fa5cb0
add setpoint change to first sample in CCR mode
heinrichsweikamp
parents:
275
diff
changeset
|
126 call transmit_setpoint ; Transmit current setpoint from WREG (in cbar) to external electronics |
| 0 | 127 bsf setpoint_changed ; Set flag (For profile) |
|
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
97
diff
changeset
|
128 bsf event_occured ; Set global event byte |
| 0 | 129 |
|
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
53
diff
changeset
|
130 ; Reconfigure last diluent |
|
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
53
diff
changeset
|
131 extern setup_dil_registers |
|
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
53
diff
changeset
|
132 bcf is_bailout ; =1: Bailout |
|
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
53
diff
changeset
|
133 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
|
134 decf WREG ; 0-4 |
|
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
53
diff
changeset
|
135 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
|
136 |
| 0 | 137 clrf WREG ; Switch to fixed SP |
| 426 | 138 movff WREG,opt_ccr_mode ; =0: Fixed SP, =1: Sensor, =2: Auto SP |
| 0 | 139 clrf WREG |
| 140 movff WREG,char_O_deco_status ; Restart decoplan computation | |
| 141 | |
| 142 do_switch_sp2: | |
| 143 ; Clear some flags in case we were in bailout before... | |
| 144 bcf is_bailout ; =1: Bailout | |
| 145 bcf is_bailout_menu ; | |
| 485 | 146 bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode |
| 0 | 147 bcf blinking_better_gas ; Clear blinking flag |
| 148 bra do_exit_divemode_menu ; And exit | |
| 149 | |
| 485 | 150 do_divemode_gaslist_pscr: |
| 151 bcf is_bailout ; =1: Bailout | |
| 152 bcf is_bailout_menu ; | |
| 153 bra do_divemode_gaslist_pscr2 | |
| 154 | |
| 0 | 155 do_divemode_gaslist_bail: |
| 156 bcf ccr_diluent_setup ; For OC gases | |
| 157 bsf is_bailout_menu ; =1: Bailout | |
| 158 do_divemode_gaslist: | |
| 159 btfsc is_bailout ; In Bailout case? | |
| 160 bcf ccr_diluent_setup ; Yes, use OC gases | |
| 485 | 161 do_divemode_gaslist_pscr2: |
| 0 | 162 bsf short_gas_decriptions |
| 163 movlw .1 | |
| 164 movwf menupos ; Set to first option in divemode menu | |
| 165 MENU_BEGIN tGaslist, .6 | |
| 166 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | |
| 167 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | |
| 168 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | |
| 169 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | |
| 170 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | |
| 171 MENU_CALL tMore, do_divemode_gaslist_more0 | |
| 172 MENU_END | |
| 173 | |
| 174 do_divemode_gaslist_more0: | |
| 175 movlw .1 | |
| 176 movwf menupos ; Set to first option in divemode menu | |
| 177 do_divemode_gaslist_more: | |
| 178 MENU_BEGIN tGaslist, .6 | |
| 179 MENU_CALL tO2Plus, do_dive_pO2 | |
| 180 MENU_CALL tO2Minus, do_dive_mO2 | |
| 181 MENU_CALL tHePlus, do_dive_pHe | |
| 182 MENU_CALL tHeMinus, do_dive_mHe | |
|
403
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
183 MENU_DYNAMIC gaslist_strcat_gasx, do_switch_gas6 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
184 MENU_CALL tDivemenu_LostGas, do_lost_gas |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
185 MENU_END |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
186 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
187 do_lost_gas: |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
188 movlw .1 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
189 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
|
190 do_lost_gas0: |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
191 bcf ccr_diluent_setup ; use OC gases |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
192 bsf is_bailout_menu ; =1: Bailout |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
193 bsf short_gas_decriptions |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
194 MENU_BEGIN tDivemenu_LostGas, .6 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
195 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
|
196 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
|
197 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
|
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_CALL tExit, do_exit_divemode_menu |
| 0 | 201 MENU_END |
| 202 | |
|
403
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
203 do_toggle_active: |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
204 decf menupos,W ; 1-5 -> 0-4 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
205 lfsr FSR1,opt_gas_type+0 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
206 movff PLUSW1,lo |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
207 tstfsz lo ; Already disabled? |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
208 bra do_toggle_active2 ; No, disable now! |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
209 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
210 ; 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
|
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_backup+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 decf menupos,W ; 1-5 -> 0-4 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
215 lfsr FSR1,opt_gas_type+0 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
216 movff lo,PLUSW1 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
217 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
218 ; 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
|
219 decf menupos,W ; 1-5 -> 0-4 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
220 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
|
221 movff PLUSW1,lo |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
222 decf menupos,W ; 1-5 -> 0-4 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
223 lfsr FSR1,opt_OC_bail_gas_change+0 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
224 movff lo,PLUSW1 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
225 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
226 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
|
227 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
228 do_toggle_active2: |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
229 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
|
230 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
231 ; 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
|
232 lfsr FSR1,opt_OC_bail_gas_change+0 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
233 clrf PLUSW1 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
234 |
|
6e60012bb3fc
NEW: "Lost Gas" feature allows disabling gases during the dive
heinrichsweikamp
parents:
401
diff
changeset
|
235 bra do_lost_gas0 ; Return to list and show updated result |
| 0 | 236 |
| 237 do_dive_pO2: | |
| 238 banksel char_I_O2_ratio | |
| 239 incf char_I_O2_ratio,F ; O2++ | |
| 240 movf char_I_He_ratio,W | |
| 241 addwf char_I_O2_ratio,W | |
| 242 movwf temp_bankx400 | |
| 243 movlw .101 | |
| 244 cpfslt temp_bankx400 ; O2+He<101? | |
| 245 decf char_I_O2_ratio,F ; O2-- (Unchanged) | |
| 246 ; bra do_divemode_gaslist_more_common | |
| 247 do_divemode_gaslist_more_common: | |
|
181
32c17df38423
BUGFIX: END/EAD updated when adjusting current gas during the dive
heinrichsweikamp
parents:
99
diff
changeset
|
248 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
|
249 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
|
250 sublw .100 ; ...subtract both from 100 |
|
32c17df38423
BUGFIX: END/EAD updated when adjusting current gas during the dive
heinrichsweikamp
parents:
99
diff
changeset
|
251 movwf char_I_N2_ratio ; -> N2! |
| 0 | 252 banksel common |
| 253 bsf gas6_changed ; Set flag | |
| 254 bra do_divemode_gaslist_more | |
| 255 | |
| 256 do_dive_mO2: | |
| 257 banksel char_I_O2_ratio | |
| 258 decf char_I_O2_ratio,F ; O2-- | |
| 259 movlw gaslist_min_o2 | |
| 260 cpfslt char_I_O2_ratio | |
| 261 bra do_divemode_gaslist_more_common | |
| 262 movlw gaslist_min_o2 | |
| 263 movwf char_I_O2_ratio | |
| 264 bra do_divemode_gaslist_more_common | |
| 265 | |
| 266 | |
| 267 do_dive_pHe: | |
| 268 banksel char_I_O2_ratio | |
| 269 incf char_I_He_ratio,F ; He++ | |
| 270 movf char_I_He_ratio,W | |
| 271 addwf char_I_O2_ratio,W | |
| 272 movwf lo | |
| 273 movlw .101 | |
| 274 cpfslt lo ; O2+He<101? | |
| 275 decf char_I_He_ratio,F ; Yes, He-- (Unchanged) | |
| 276 bra do_divemode_gaslist_more_common | |
| 277 | |
| 278 do_dive_mHe: | |
| 279 banksel char_I_O2_ratio | |
| 280 decf char_I_He_ratio,F ; He-- | |
| 281 bnn do_divemode_gaslist_more_common | |
| 282 clrf char_I_He_ratio | |
| 283 bra do_divemode_gaslist_more_common | |
| 284 | |
| 285 do_divemode_splist: | |
| 286 bsf short_gas_decriptions | |
| 287 movlw .1 | |
| 288 movwf menupos ; Set to first option in divemode menu | |
| 249 | 289 movf hardware_flag,W |
| 290 sublw 0x11 ; 2 with BLE | |
| 291 btfsc STATUS,Z | |
| 292 bra do_divemode_splist2 | |
| 0 | 293 MENU_BEGIN tGaslist, .6 |
| 294 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
| 295 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
| 296 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
| 297 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
| 298 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
| 299 MENU_CALL tCCRSensor, do_divemode_sensor | |
| 300 MENU_END | |
| 301 | |
| 249 | 302 do_divemode_splist2: |
| 303 MENU_BEGIN tGaslist, .5 | |
| 304 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
| 305 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
| 306 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
| 307 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
| 308 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
| 309 MENU_END | |
| 310 | |
| 311 | |
| 0 | 312 do_divemode_sensor: |
| 313 ; Set customview to 1 (HUD Data) | |
| 314 clrf menupos3 ; customview to come-1 | |
| 315 bsf toggle_customview ; Set flag, the customview will be toggled very soon now... | |
| 316 movlw .1 | |
| 317 movwf menupos ; Set to first option in divemode menu | |
| 318 MENU_BEGIN tGaslist, .2 | |
| 319 MENU_CALL tDivemenu_UseSensor, do_switch_to_sensor | |
| 320 MENU_CALL tExit, do_continue_main_divemenu | |
| 321 MENU_END | |
| 322 | |
| 323 do_divemode_togglegf: | |
| 324 ; Set customview to 5 (GF informations) | |
| 325 movlw .4 | |
| 326 movwf menupos3 ; Customview to come-1 | |
| 327 bsf toggle_customview ; Set flag, the customview will be toggled very soon now... | |
| 328 movlw .1 | |
| 329 movwf menupos ; Set to first option in divemode menu | |
| 330 MENU_BEGIN tDivemenu_ToggleGF, .2 | |
| 331 MENU_CALL tDivemenu_ToggleGF, do_togglegf | |
| 332 MENU_CALL tExit, do_continue_main_divemenu | |
| 333 MENU_END | |
| 334 | |
| 335 END |
