Mercurial > public > hwos_code
comparison src/divemenu_tree.asm @ 0:11d4fc797f74
init
author | heinrichsweikamp |
---|---|
date | Wed, 24 Apr 2013 19:22:45 +0200 |
parents | |
children | 2825f1d2262f |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:11d4fc797f74 |
---|---|
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 | |
73 extern diveloop_loop4 | |
74 extern timeout_divemode_menu2 | |
75 do_switch_gas: | |
76 bsf divemode_gaschange ; Set flag | |
77 do_switch_gasX: | |
78 btfsc is_bailout_menu ; Bailout confirmed? | |
79 bsf is_bailout ; =1: Bailout | |
80 do_exit_divemode_menu: | |
81 call timeout_divemode_menu2 | |
82 clrf STKPTR | |
83 goto diveloop_loop4 | |
84 | |
85 do_switch_sp: | |
86 decf menupos,W ; 1-5 -> 0-4 | |
87 lfsr FSR1,char_I_setpoint_cbar | |
88 movff PLUSW1,char_I_const_ppO2; Setup fixed Setpoint | |
89 bsf setpoint_changed ; Set flag (For profile) | |
90 | |
91 clrf WREG ; Switch to fixed SP | |
92 movff WREG,opt_ccr_mode ; =0: Fixed SP, =1: Sensor | |
93 clrf WREG | |
94 movff WREG,char_O_deco_status ; Restart decoplan computation | |
95 | |
96 do_switch_sp2: | |
97 ; Clear some flags in case we were in bailout before... | |
98 bcf is_bailout ; =1: Bailout | |
99 bcf is_bailout_menu ; | |
100 bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode | |
101 bcf blinking_better_gas ; Clear blinking flag | |
102 bra do_exit_divemode_menu ; And exit | |
103 | |
104 do_divemode_gaslist_bail: | |
105 bcf ccr_diluent_setup ; For OC gases | |
106 bsf is_bailout_menu ; =1: Bailout | |
107 do_divemode_gaslist: | |
108 btfsc is_bailout ; In Bailout case? | |
109 bcf ccr_diluent_setup ; Yes, use OC gases | |
110 bsf short_gas_decriptions | |
111 movlw .1 | |
112 movwf menupos ; Set to first option in divemode menu | |
113 MENU_BEGIN tGaslist, .6 | |
114 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | |
115 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | |
116 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | |
117 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | |
118 MENU_DYNAMIC gaslist_strcat_gas_mod, do_switch_gas | |
119 MENU_CALL tMore, do_divemode_gaslist_more0 | |
120 MENU_END | |
121 | |
122 do_divemode_gaslist_more0: | |
123 movlw .1 | |
124 movwf menupos ; Set to first option in divemode menu | |
125 do_divemode_gaslist_more: | |
126 MENU_BEGIN tGaslist, .6 | |
127 MENU_DYNAMIC gaslist_strcat_gasx, do_dive_nothing | |
128 MENU_CALL tO2Plus, do_dive_pO2 | |
129 MENU_CALL tO2Minus, do_dive_mO2 | |
130 MENU_CALL tHePlus, do_dive_pHe | |
131 MENU_CALL tHeMinus, do_dive_mHe | |
132 MENU_CALL tEnter, do_switch_gasX | |
133 MENU_END | |
134 | |
135 do_dive_nothing: | |
136 bra do_divemode_gaslist_more | |
137 | |
138 do_dive_pO2: | |
139 banksel char_I_O2_ratio | |
140 incf char_I_O2_ratio,F ; O2++ | |
141 movf char_I_He_ratio,W | |
142 addwf char_I_O2_ratio,W | |
143 movwf temp_bankx400 | |
144 movlw .101 | |
145 cpfslt temp_bankx400 ; O2+He<101? | |
146 decf char_I_O2_ratio,F ; O2-- (Unchanged) | |
147 ; bra do_divemode_gaslist_more_common | |
148 do_divemode_gaslist_more_common: | |
149 banksel common | |
150 bsf gas6_changed ; Set flag | |
151 bra do_divemode_gaslist_more | |
152 | |
153 do_dive_mO2: | |
154 banksel char_I_O2_ratio | |
155 decf char_I_O2_ratio,F ; O2-- | |
156 movlw gaslist_min_o2 | |
157 cpfslt char_I_O2_ratio | |
158 bra do_divemode_gaslist_more_common | |
159 movlw gaslist_min_o2 | |
160 movwf char_I_O2_ratio | |
161 bra do_divemode_gaslist_more_common | |
162 | |
163 | |
164 do_dive_pHe: | |
165 banksel char_I_O2_ratio | |
166 incf char_I_He_ratio,F ; He++ | |
167 movf char_I_He_ratio,W | |
168 addwf char_I_O2_ratio,W | |
169 movwf lo | |
170 movlw .101 | |
171 cpfslt lo ; O2+He<101? | |
172 decf char_I_He_ratio,F ; Yes, He-- (Unchanged) | |
173 banksel common | |
174 bra do_divemode_gaslist_more_common | |
175 | |
176 do_dive_mHe: | |
177 banksel char_I_O2_ratio | |
178 decf char_I_He_ratio,F ; He-- | |
179 bnn do_divemode_gaslist_more_common | |
180 clrf char_I_He_ratio | |
181 bra do_divemode_gaslist_more_common | |
182 | |
183 do_divemode_splist: | |
184 bsf short_gas_decriptions | |
185 movlw .1 | |
186 movwf menupos ; Set to first option in divemode menu | |
187 MENU_BEGIN tGaslist, .6 | |
188 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
189 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
190 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
191 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
192 MENU_DYNAMIC gaslist_strcat_setpoint, do_switch_sp | |
193 MENU_CALL tCCRSensor, do_divemode_sensor | |
194 MENU_END | |
195 | |
196 do_divemode_sensor: | |
197 ; Set customview to 1 (HUD Data) | |
198 clrf menupos3 ; customview to come-1 | |
199 bsf toggle_customview ; Set flag, the customview will be toggled very soon now... | |
200 movlw .1 | |
201 movwf menupos ; Set to first option in divemode menu | |
202 MENU_BEGIN tGaslist, .2 | |
203 MENU_CALL tDivemenu_UseSensor, do_switch_to_sensor | |
204 MENU_CALL tExit, do_continue_main_divemenu | |
205 MENU_END | |
206 | |
207 do_divemode_togglegf: | |
208 ; Set customview to 5 (GF informations) | |
209 movlw .4 | |
210 movwf menupos3 ; Customview to come-1 | |
211 bsf toggle_customview ; Set flag, the customview will be toggled very soon now... | |
212 movlw .1 | |
213 movwf menupos ; Set to first option in divemode menu | |
214 MENU_BEGIN tDivemenu_ToggleGF, .2 | |
215 MENU_CALL tDivemenu_ToggleGF, do_togglegf | |
216 MENU_CALL tExit, do_continue_main_divemenu | |
217 MENU_END | |
218 | |
219 END |