Mercurial > public > hwos_code
annotate src/divemenu_tree.asm @ 123:d076e9c02438
add ceiling display
author | heinrichsweikamp |
---|---|
date | Sun, 29 Jun 2014 13:40:59 +0200 |
parents | 87cc1adfe4da |
children | 32c17df38423 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
3 ; File divemenu_tree.asm | |
4 ; | |
5 ; OSTC3 dive mode menu | |
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 | |
12 #include "ostc3.inc" ; Mandatory header | |
13 #include "menu_processor.inc" | |
14 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c | |
15 #include "tft_outputs.inc" | |
16 #include "customview.inc" | |
17 #include "strings.inc" | |
18 | |
19 divegui CODE | |
20 ;============================================================================= | |
21 ; Main Menu | |
22 global do_main_divemenu | |
23 do_main_divemenu: | |
24 call menu_processor_reset ; restart from first icon. | |
25 | |
26 do_continue_main_divemenu: | |
27 call menu_processor_pop ; drop exit line. | |
28 call menu_processor_pop ; drop exit line. | |
29 | |
30 btfsc FLAG_ccr_mode | |
31 bra main_divemenu_ccr ; CCR Menu | |
32 | |
33 bcf ccr_diluent_setup ; For OC gases | |
34 bcf is_bailout_menu | |
35 movlw .1 | |
36 movwf menupos ; Set to first option in divemode menu | |
37 MENU_BEGIN tMainMenu, .4 | |
38 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist | |
39 MENU_CALL tDivemenu_ResetAvr, do_divemode_resetavr | |
40 MENU_CALL tDivemenu_ToggleGF, do_divemode_togglegf | |
41 MENU_CALL tExit, do_exit_divemode_menu | |
42 MENU_END | |
43 | |
44 main_divemenu_ccr: | |
45 bsf ccr_diluent_setup ; For diluents | |
46 movlw .1 | |
47 movwf menupos ; Set to first option in divemode menu | |
48 MENU_BEGIN tMainMenu, .6 | |
49 MENU_CALL tDiveBailout, do_divemode_gaslist_bail | |
50 MENU_CALL tDivemenu_Setpoint, do_divemode_splist | |
51 MENU_CALL tDivemenu_Gaslist, do_divemode_gaslist | |
52 MENU_CALL tDivemenu_ResetAvr, do_divemode_resetavr | |
53 MENU_CALL tDivemenu_ToggleGF, do_divemode_togglegf | |
54 MENU_CALL tExit, do_exit_divemode_menu | |
55 MENU_END | |
56 | |
57 | |
58 do_togglegf: | |
59 TSTOSS opt_enable_aGF ; =1: aGF can be selected underwater | |
60 bra do_exit_divemode_menu ; exit | |
61 bsf toggle_gf ; Set flag... | |
62 bra do_exit_divemode_menu ; ...and exit | |
63 | |
64 do_switch_to_sensor: | |
65 movlw .1 ; Switch to Sensor | |
66 movff WREG,opt_ccr_mode ; =0: Fixed SP, =1: Sensor | |
67 bra do_switch_sp2 | |
68 | |
69 do_divemode_resetavr: | |
70 bsf reset_average_depth ; Set Flag | |
71 bra do_exit_divemode_menu ; And exit | |
72 | |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
0
diff
changeset
|
73 |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
0
diff
changeset
|
74 do_switch_gas6: |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
0
diff
changeset
|
75 movlw .6 |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
0
diff
changeset
|
76 movwf active_gas ; Gas6 selected |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
0
diff
changeset
|
77 bra do_switch_gasX |
0 | 78 extern diveloop_loop4 |
79 extern timeout_divemode_menu2 | |
80 do_switch_gas: | |
81 bsf divemode_gaschange ; Set flag | |
82 do_switch_gasX: | |
83 btfsc is_bailout_menu ; Bailout confirmed? | |
84 bsf is_bailout ; =1: Bailout | |
85 do_exit_divemode_menu: | |
86 call timeout_divemode_menu2 | |
87 clrf STKPTR | |
88 goto diveloop_loop4 | |
89 | |
90 do_switch_sp: | |
91 decf menupos,W ; 1-5 -> 0-4 | |
92 lfsr FSR1,char_I_setpoint_cbar | |
93 movff PLUSW1,char_I_const_ppO2; Setup fixed Setpoint | |
94 bsf setpoint_changed ; Set flag (For profile) | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
97
diff
changeset
|
95 bsf event_occured ; Set global event byte |
0 | 96 |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
53
diff
changeset
|
97 ; Reconfigure last diluent |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
53
diff
changeset
|
98 extern setup_dil_registers |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
53
diff
changeset
|
99 bcf is_bailout ; =1: Bailout |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
53
diff
changeset
|
100 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
|
101 decf WREG ; 0-4 |
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
53
diff
changeset
|
102 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
|
103 |
0 | 104 clrf WREG ; Switch to fixed SP |
105 movff WREG,opt_ccr_mode ; =0: Fixed SP, =1: Sensor | |
106 clrf WREG | |
107 movff WREG,char_O_deco_status ; Restart decoplan computation | |
108 | |
109 do_switch_sp2: | |
110 ; Clear some flags in case we were in bailout before... | |
111 bcf is_bailout ; =1: Bailout | |
112 bcf is_bailout_menu ; | |
113 bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode | |
114 bcf blinking_better_gas ; Clear blinking flag | |
115 bra do_exit_divemode_menu ; And exit | |
116 | |
117 do_divemode_gaslist_bail: | |
118 bcf ccr_diluent_setup ; For OC gases | |
119 bsf is_bailout_menu ; =1: Bailout | |
120 do_divemode_gaslist: | |
121 btfsc is_bailout ; In Bailout case? | |
122 bcf ccr_diluent_setup ; Yes, use OC gases | |
123 bsf short_gas_decriptions | |
124 movlw .1 | |
125 movwf menupos ; Set to first option in divemode menu | |
126 MENU_BEGIN tGaslist, .6 | |
127 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | |
128 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | |
129 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | |
130 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | |
131 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | |
132 MENU_CALL tMore, do_divemode_gaslist_more0 | |
133 MENU_END | |
134 | |
135 do_divemode_gaslist_more0: | |
136 movlw .1 | |
137 movwf menupos ; Set to first option in divemode menu | |
138 do_divemode_gaslist_more: | |
139 MENU_BEGIN tGaslist, .6 | |
140 MENU_DYNAMIC gaslist_strcat_gasx, do_dive_nothing | |
141 MENU_CALL tO2Plus, do_dive_pO2 | |
142 MENU_CALL tO2Minus, do_dive_mO2 | |
143 MENU_CALL tHePlus, do_dive_pHe | |
144 MENU_CALL tHeMinus, do_dive_mHe | |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
0
diff
changeset
|
145 MENU_CALL tEnter, do_switch_gas6 |
0 | 146 MENU_END |
147 | |
148 do_dive_nothing: | |
149 bra do_divemode_gaslist_more | |
150 | |
151 do_dive_pO2: | |
152 banksel char_I_O2_ratio | |
153 incf char_I_O2_ratio,F ; O2++ | |
154 movf char_I_He_ratio,W | |
155 addwf char_I_O2_ratio,W | |
156 movwf temp_bankx400 | |
157 movlw .101 | |
158 cpfslt temp_bankx400 ; O2+He<101? | |
159 decf char_I_O2_ratio,F ; O2-- (Unchanged) | |
160 ; bra do_divemode_gaslist_more_common | |
161 do_divemode_gaslist_more_common: | |
162 banksel common | |
163 bsf gas6_changed ; Set flag | |
164 bra do_divemode_gaslist_more | |
165 | |
166 do_dive_mO2: | |
167 banksel char_I_O2_ratio | |
168 decf char_I_O2_ratio,F ; O2-- | |
169 movlw gaslist_min_o2 | |
170 cpfslt char_I_O2_ratio | |
171 bra do_divemode_gaslist_more_common | |
172 movlw gaslist_min_o2 | |
173 movwf char_I_O2_ratio | |
174 bra do_divemode_gaslist_more_common | |
175 | |
176 | |
177 do_dive_pHe: | |
178 banksel char_I_O2_ratio | |
179 incf char_I_He_ratio,F ; He++ | |
180 movf char_I_He_ratio,W | |
181 addwf char_I_O2_ratio,W | |
182 movwf lo | |
183 movlw .101 | |
184 cpfslt lo ; O2+He<101? | |
185 decf char_I_He_ratio,F ; Yes, He-- (Unchanged) | |
186 banksel common | |
187 bra do_divemode_gaslist_more_common | |
188 | |
189 do_dive_mHe: | |
190 banksel char_I_O2_ratio | |
191 decf char_I_He_ratio,F ; He-- | |
192 bnn do_divemode_gaslist_more_common | |
193 clrf char_I_He_ratio | |
194 bra do_divemode_gaslist_more_common | |
195 | |
196 do_divemode_splist: | |
197 bsf short_gas_decriptions | |
198 movlw .1 | |
199 movwf menupos ; Set to first option in divemode menu | |
200 MENU_BEGIN tGaslist, .6 | |
201 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
202 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
203 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
204 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
205 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
206 MENU_CALL tCCRSensor, do_divemode_sensor | |
207 MENU_END | |
208 | |
209 do_divemode_sensor: | |
210 ; Set customview to 1 (HUD Data) | |
211 clrf menupos3 ; customview to come-1 | |
212 bsf toggle_customview ; Set flag, the customview will be toggled very soon now... | |
213 movlw .1 | |
214 movwf menupos ; Set to first option in divemode menu | |
215 MENU_BEGIN tGaslist, .2 | |
216 MENU_CALL tDivemenu_UseSensor, do_switch_to_sensor | |
217 MENU_CALL tExit, do_continue_main_divemenu | |
218 MENU_END | |
219 | |
220 do_divemode_togglegf: | |
221 ; Set customview to 5 (GF informations) | |
222 movlw .4 | |
223 movwf menupos3 ; Customview to come-1 | |
224 bsf toggle_customview ; Set flag, the customview will be toggled very soon now... | |
225 movlw .1 | |
226 movwf menupos ; Set to first option in divemode menu | |
227 MENU_BEGIN tDivemenu_ToggleGF, .2 | |
228 MENU_CALL tDivemenu_ToggleGF, do_togglegf | |
229 MENU_CALL tExit, do_continue_main_divemenu | |
230 MENU_END | |
231 | |
232 END |