annotate src/divemenu_tree.asm @ 561:9c54849b8d3b

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