Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/divemode_menu.asm @ 173:4a7a778d9e49
CF09 limits
author | heinrichsweikamp |
---|---|
date | Wed, 02 Feb 2011 11:09:39 +0100 |
parents | e26f49674956 |
children | b6dd54b3567c |
rev | line source |
---|---|
0 | 1 ; OSTC - diving computer code |
2 ; Copyright (C) 2008 HeinrichsWeikamp GbR | |
3 | |
4 ; This program is free software: you can redistribute it and/or modify | |
5 ; it under the terms of the GNU General Public License as published by | |
6 ; the Free Software Foundation, either version 3 of the License, or | |
7 ; (at your option) any later version. | |
8 | |
9 ; This program is distributed in the hope that it will be useful, | |
10 ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 ; GNU General Public License for more details. | |
13 | |
14 ; You should have received a copy of the GNU General Public License | |
15 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
16 | |
17 | |
18 ; Underwater Menu (Set Gas, Decoplan, etc.) | |
19 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com | |
20 ; written: 11/11/05 | |
21 ; last updated: 090305 | |
22 ; known bugs: | |
23 ; ToDo: | |
24 | |
25 | |
112 | 26 test_switches_divemode: ; checks switches in divemode |
0 | 27 btfsc switch_left |
28 bra test_switches_divemode2 | |
29 | |
30 btfss switch_right | |
31 return | |
32 | |
33 bcf switch_left ; Left button pressed! | |
34 bcf switch_right | |
35 | |
36 bcf select_bailoutgas ; Clear Flag for Bailout list | |
37 bsf premenu ; Set Flag for premenu | |
38 bcf menubit | |
39 clrf timeout_counter3 ; timeout_divemenu | |
40 | |
41 btfsc FLAG_apnoe_mode ; In Apnoe mode? | |
42 bra test_switches_divemode1 ; Yes! | |
43 | |
44 test_switches_divemode0: | |
45 WIN_INVERT .1 | |
46 DISPLAYTEXT .4 ;Menu? | |
47 WIN_INVERT .0 | |
48 return | |
49 | |
50 test_switches_divemode1: | |
51 DISPLAYTEXT .141 ;Quit? | |
52 return | |
53 | |
54 test_switches_divemode2: | |
55 bcf switch_left ; Also reactivate left button if there was a right press without prior left press | |
56 bcf switch_right ; enable right button again | |
57 | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
58 btfsc premenu |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
59 bra test_switches_divemode2_2 |
109
6e635bf5b7a7
fixed double-effect of ENTER button in divemode
heinrichsweikamp
parents:
107
diff
changeset
|
60 btfsc menubit |
6e635bf5b7a7
fixed double-effect of ENTER button in divemode
heinrichsweikamp
parents:
107
diff
changeset
|
61 bra test_switches_divemode2_2 ; Not in Premenu or Menu... |
0 | 62 |
112 | 63 bsf toggle_customview ; Toggle customview (Cleared in customview.asm) |
64 | |
65 btfsc standalone_simulator ; Standalone Simualtor active? | |
66 bra divemode_menu_simulator ; Yes, Show simulator menu! | |
67 return | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
68 |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
69 test_switches_divemode2_2: |
0 | 70 btfss FLAG_apnoe_mode ; In Apnoe mode? |
71 bra test_switches_divemode2a; No! | |
72 | |
73 ; Yes, so quit Apnoe mode at once... | |
74 bcf divemode ; Clear Divemode flag... | |
75 bcf premenu ; clear premenu flag | |
76 return | |
77 | |
78 test_switches_divemode2a: | |
79 bsf menubit ; Enter Divemode-Menu! | |
80 bcf premenu ; clear premenu flag | |
81 call PLED_clear_divemode_menu ; Clear dive mode menu area | |
82 call PLED_divemode_menu_mask_first ; Write Divemode menu1 mask | |
83 bcf display_set_simulator ; Clear Simulator-Menu flag | |
84 movlw d'1' | |
85 movwf menupos ; reset cursor in divemode menu | |
86 call PLED_divemenu_cursor ; show cursor | |
87 bcf switch_right | |
88 bcf switch_left ; Left button pressed! | |
89 return | |
90 | |
91 test_switches_divemode_menu: | |
92 btfsc switch_left | |
93 bra test_switches_divemode_menu3 | |
94 btfss switch_right | |
95 return | |
96 | |
97 btfsc display_see_deco ; Is the Decoplan displayed? | |
98 bra divemenu_see_decoplan2 ; Yes, exit menu on left button press | |
99 | |
100 bcf switch_right ; Left button pressed | |
101 clrf timeout_counter3 ; timout_divemenu! | |
102 incf menupos,F | |
103 | |
104 ; Following routine configures the number of menu entries for the different modes | |
105 movlw d'6' ; number of available gases+1, ; number of menu options+1 | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
106 btfsc display_set_gas ; Are we in the "Gaslist" menu? |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
107 movlw d'7' ; Yes, Number of entries for this menu+1 = 7 |
0 | 108 btfsc display_set_setpoint ; In SetPoint Menu? |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
109 movlw d'5' ; Number of entries for this menu+1 = 5 |
0 | 110 cpfseq menupos ; =limit? |
111 bra test_switches_divemode_menu1; No! | |
112 movlw d'1' ; Yes, reset to position 1! | |
113 movwf menupos | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
114 |
0 | 115 test_switches_divemode_menu1: |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
116 ; Finally, check if menuposition 3 should be skipped (No customview with function displayed) |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
117 |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
118 btfsc display_set_gas ; Are we in the "Gaslist" or "SetPoint" menu? |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
119 bra test_switches_divemode_menu1a ; Skip test for sub menus |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
120 btfsc display_set_xgas ; Are we in the "Gaslist" or "SetPoint" menu? |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
121 bra test_switches_divemode_menu1a ; Skip test for sub menus |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
122 |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
123 movlw d'3' |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
124 cpfseq menupos ; At position 3? |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
125 bra test_switches_divemode_menu1a; No |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
126 btfss menu3_active ; Menu position 3 has functionality? |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
127 incf menupos,F ; No, +1, skip to menuos=4 |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
128 |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
129 test_switches_divemode_menu1a: |
0 | 130 call PLED_divemenu_cursor ; update cursor |
131 return | |
132 | |
133 test_switches_divemode_menu3: | |
134 bcf switch_left | |
135 bcf switch_right | |
136 bsf menubit ; Enter Divemode-Menu! | |
137 bcf premenu ; clear premenu flag | |
138 clrf timeout_counter3 | |
139 | |
140 btfsc display_set_gas ; Are we in the "Gaslist" or "SetPoint" menu? | |
141 bra divemenu_set_gas2 ; Yes, so set gas and exit menu | |
142 | |
143 btfsc display_see_deco ; Is the Decoplan displayed? | |
144 bra divemenu_see_decoplan2 ; Yes, exit menu on right button press | |
145 | |
146 btfsc display_set_xgas ; Are we in the "Set Gas" menu? | |
147 bra divemenu_set_xgas2 ; Yes, so configure gas or set menu and exit menu | |
148 | |
149 btfsc display_set_simulator ; Are we in the Divemode Simulator menu? | |
150 goto divemode_menu_simulator2 ; Yes, so adjust depth or set and exit | |
151 | |
152 ; Options for Menu 1 | |
153 dcfsnz menupos,F | |
73
2227459e8ef2
Exchanged Decoplan and Gaslist in dive mode menu
heinrichsweikamp
parents:
71
diff
changeset
|
154 bra divemenu_set_gas ; Set gas sub-menu |
2227459e8ef2
Exchanged Decoplan and Gaslist in dive mode menu
heinrichsweikamp
parents:
71
diff
changeset
|
155 dcfsnz menupos,F |
0 | 156 bra divemenu_see_decoplan ; display the full decoplan |
157 dcfsnz menupos,F | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
158 bra divemode_menu3 ; Customview-function |
0 | 159 dcfsnz menupos,F |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
160 bra divemode_toggle_brightness ; Toggle OLED-Brightness |
0 | 161 dcfsnz menupos,F |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
162 bra timeout_divemenu2 ; Quit divemode menu |
119 | 163 bra timeout_divemenu2 ; Quit divemode menu |
0 | 164 |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
165 divemode_menu3: |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
166 movff menupos3,temp1 ; copy |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
167 dcfsnz temp1,F |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
168 bra toggle_stopwatch ; Toggle Stopwatch/Average register |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
169 dcfsnz temp1,F |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
170 bra set_marker ; Set Marker |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
171 dcfsnz temp1,F |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
172 bra divemode_menu3_nothing ; clock... |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
173 dcfsnz temp1,F |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
174 bra divemode_menu3_nothing ; leading tissue... |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
175 |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
176 divemode_menu3_nothing: |
0 | 177 bra timeout_divemenu2 ; Quit divemode menu |
178 | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
179 set_marker: |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
180 movlw d'6' ; Type of Alarm (Manual Marker) |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
181 movwf AlarmType ; Copy to Alarm Register |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
182 bsf event_occured ; Set Event Flag |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
183 bra timeout_divemenu2 ; quit menu! |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
184 |
0 | 185 toggle_stopwatch: |
111 | 186 bsf reset_average_depth ; Average Depth will be resetted in divemode.asm |
0 | 187 bra timeout_divemenu2 ; quit menu! |
188 | |
189 divemode_toggle_brightness: | |
190 read_int_eeprom d'90' ; Brightness offset? (Dim>0, Normal = 0) | |
191 tstfsz EEDATA ; Was dimmed? | |
192 bra divemode_toggle_brightness1 ; Yes... | |
193 | |
194 call PLED_brightness_low | |
195 movlw d'1' | |
196 movwf EEDATA ; Copy to EEDATA | |
197 write_int_eeprom d'90' ; Brightness offset? (Dim=1, Normal = 0) | |
198 bra divemode_toggle_brightness3 | |
199 | |
200 divemode_toggle_brightness1: | |
201 call PLED_brightness_full | |
202 movlw d'0' | |
203 movwf EEDATA ; Copy to EEDATA | |
204 write_int_eeprom d'90' ; Brightness offset? (Dim=1, Normal = 0) | |
205 | |
206 divemode_toggle_brightness3: | |
207 ; Now, redraw all outputs (All modes) | |
208 call PLED_active_gas_divemode ; Display gas, if required | |
209 call PLED_temp_divemode ; Displays temperature | |
210 call PLED_depth ; Displays new depth... | |
211 call PLED_max_pressure ; ...and max. depth | |
212 | |
213 bra timeout_divemenu2 ; quit menu! | |
214 | |
215 divemode_set_xgas: ; Set the extra gas... | |
216 bsf display_set_xgas ; Set Flag | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
217 bcf display_set_gas ; Clear Flag |
0 | 218 call PLED_clear_divemode_menu ; Clear Menu |
219 | |
220 movff char_I_O2_ratio, EEDATA ; Reset Gas6 to current gas | |
221 write_int_eeprom d'24' | |
222 movff char_I_He_ratio, EEDATA | |
223 write_int_eeprom d'25' | |
224 | |
225 call PLED_divemode_set_xgas ; Show mask | |
226 | |
227 movlw d'1' | |
228 movwf menupos ; reset cursor | |
229 call PLED_divemenu_cursor ; update cursor | |
230 return | |
231 | |
232 divemode_menu_simulator: | |
233 bsf menubit ; Enter Divemode-Menu! | |
234 bcf premenu ; clear premenu flag | |
235 bcf switch_right | |
236 bcf switch_left ; Left button pressed! | |
104 | 237 bsf display_set_simulator ; Set Flag |
238 bsf menu3_active ; So "+1" is accessible at all times | |
0 | 239 call PLED_clear_divemode_menu ; Clear Menu |
240 call PLED_divemode_simulator_mask; Show mask | |
241 movlw d'1' | |
242 movwf menupos ; reset cursor | |
243 call PLED_divemenu_cursor ; update cursor | |
244 return | |
245 | |
246 divemode_menu_simulator2: | |
247 dcfsnz menupos,F | |
119 | 248 bra timeout_divemenu2 ; close underwater menu! |
0 | 249 dcfsnz menupos,F |
250 bra divemode_menu_simulator_p1 ; Adjust +1m | |
251 dcfsnz menupos,F | |
252 bra divemode_menu_simulator_m1 ; Adjust -1m | |
253 dcfsnz menupos,F | |
254 bra divemode_menu_simulator_p10 ; Adjust +10m | |
255 dcfsnz menupos,F | |
256 bra divemode_menu_simulator_m10 ; Adjust -10m | |
257 bra timeout_divemenu2 ; quit underwater menu! | |
258 | |
259 divemode_menu_simulator_common: | |
260 call PLED_divemode_simulator_mask ; Redraw Simualtor mask | |
261 | |
119 | 262 ; Check limits (130m and 0m) |
263 movlw LOW d'14000' | |
0 | 264 movwf sub_a+0 |
119 | 265 movlw HIGH d'14000' |
0 | 266 movwf sub_a+1 |
267 movff sim_pressure+0,sub_b+0 | |
268 movff sim_pressure+1,sub_b+1 | |
269 call sub16 ; sub_c = sub_a - sub_b | |
270 btfss neg_flag | |
271 bra divemode_menu_simulator_common2 | |
119 | 272 ; Too deep, limit to 130m |
273 movlw LOW d'14000' | |
0 | 274 movwf sim_pressure+0 |
119 | 275 movlw HIGH d'14000' |
0 | 276 movwf sim_pressure+1 |
277 return | |
278 | |
279 divemode_menu_simulator_common2: | |
280 movlw LOW d'1000' | |
281 movwf sub_a+0 | |
282 movlw HIGH d'1000' | |
283 movwf sub_a+1 | |
284 movff sim_pressure+0,sub_b+0 | |
285 movff sim_pressure+1,sub_b+1 | |
286 call sub16 ; sub_c = sub_a - sub_b | |
287 btfsc neg_flag | |
288 return | |
289 ; Too shallow, limit to 1m | |
290 movlw LOW d'1000' | |
291 movwf sim_pressure+0 | |
292 movlw HIGH d'1000' | |
293 movwf sim_pressure+1 | |
294 return | |
295 | |
296 divemode_menu_simulator_m10: | |
297 movlw LOW d'1000' | |
298 subwf sim_pressure+0,F | |
299 movlw HIGH d'1000' | |
300 subwfb sim_pressure+1,F | |
301 movlw d'5' | |
302 movwf menupos ; reset cursor | |
303 bra divemode_menu_simulator_common | |
304 | |
305 divemode_menu_simulator_p10: | |
306 movlw LOW d'1000' | |
307 addwf sim_pressure+0,F | |
308 movlw HIGH d'1000' | |
309 addwfc sim_pressure+1,F | |
310 movlw d'4' | |
311 movwf menupos ; reset cursor | |
312 bra divemode_menu_simulator_common | |
313 | |
314 divemode_menu_simulator_p1: | |
315 movlw d'100' | |
316 addwf sim_pressure+0,F | |
317 movlw d'0' | |
318 addwfc sim_pressure+1,F | |
319 movlw d'2' | |
320 movwf menupos ; reset cursor | |
321 bra divemode_menu_simulator_common | |
322 | |
323 divemode_menu_simulator_m1: | |
324 movlw d'100' | |
325 subwf sim_pressure+0,F | |
326 movlw d'0' | |
327 subwfb sim_pressure+1,F | |
328 movlw d'3' | |
329 movwf menupos ; reset cursor | |
330 bra divemode_menu_simulator_common | |
331 | |
332 divemenu_see_decoplan: | |
333 bsf display_see_deco ; set flag | |
64 | 334 call PLED_clear_divemode_menu ; Clear Menu |
0 | 335 |
64 | 336 bcf last_ceiling_gf_shown ; Clear flag |
124 | 337 clrf decoplan_page ; Starts on page 0 |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
338 bra divemenu_see_decoplan2_1 |
0 | 339 |
340 divemenu_see_decoplan2: | |
124 | 341 incf decoplan_page,F |
64 | 342 btfsc last_ceiling_gf_shown ; last ceiling shown? |
343 bra divemenu_see_decoplan2_0 ; All done, clear and return | |
344 | |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
345 divemenu_see_decoplan2_1: |
64 | 346 clrf timeout_counter3 ; Clear timeout Divemode menu |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
347 call PLED_decoplan ; Display the new screen |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
348 return |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
349 |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
350 divemenu_see_decoplan2_0: |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
351 bcf display_see_deco ; clear flag |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
352 bra timeout_divemenu2 ; quit menu! |
64 | 353 |
0 | 354 divemenu_set_xgas2: |
355 dcfsnz menupos,F | |
356 bra divemenu_set_xgas2_exit ; Use the gas6 configured and exit | |
357 dcfsnz menupos,F | |
358 bra divemenu_set_xgas2_o2plus ; Adjust O2+ | |
359 dcfsnz menupos,F | |
360 bra divemenu_set_xgas2_o2minus ; Adjust O2- | |
361 dcfsnz menupos,F | |
362 bra divemenu_set_xgas2_heplus ; Adjust He+ | |
363 dcfsnz menupos,F | |
364 bra divemenu_set_xgas2_heminus ; Adjust He- | |
365 return | |
366 | |
367 divemenu_set_xgas2_heminus: | |
368 read_int_eeprom d'25' ; He value | |
369 movff EEDATA,lo | |
370 decf lo,F ; decrease He | |
371 movlw d'255' | |
372 cpfseq lo | |
373 bra divemenu_set_xgas2_heminus2 | |
374 incf lo,F ; limit to min=0 | |
375 divemenu_set_xgas2_heminus2: | |
376 movff lo, EEDATA | |
377 write_int_eeprom d'25' ; He Value | |
378 | |
379 call PLED_divemode_set_xgas ; Redraw menu | |
380 movlw d'5' | |
381 movwf menupos ; reset cursor | |
382 return | |
383 | |
384 divemenu_set_xgas2_heplus: | |
385 read_int_eeprom d'25' ; He value | |
386 movff EEDATA,lo | |
387 incf lo,F ; increase He | |
388 movlw d'101' | |
389 cpfseq lo | |
390 bra divemenu_set_xgas2_heplus2 | |
391 movlw d'4' ; O2 Limit | |
392 movwf lo | |
393 divemenu_set_xgas2_heplus2: ; test if O2+He>100... | |
394 read_int_eeprom d'24' ; O2 value | |
395 movf EEDATA,W | |
396 addwf lo,W ; add He value | |
397 movwf hi ; store in temp | |
398 movlw d'101' | |
399 cpfseq hi ; O2 and He > 100? | |
400 bra divemenu_set_xgas2_heplus3 ; No! | |
401 decf lo,F ; reduce He again = unchanged after operation | |
402 divemenu_set_xgas2_heplus3: ; save current value | |
403 movff lo, EEDATA | |
404 write_int_eeprom d'25' ; He Value | |
405 | |
406 call PLED_divemode_set_xgas ; Redraw menu | |
407 movlw d'4' | |
408 movwf menupos ; reset cursor | |
409 return | |
410 | |
411 divemenu_set_xgas2_o2minus: | |
412 read_int_eeprom d'24' ; O2 value | |
413 movff EEDATA,lo | |
414 decf lo,F ; decrease O2 | |
415 movlw d'3' ; Limit-1 | |
416 cpfseq lo | |
417 bra divemenu_set_xgas2_o2minus2 | |
418 incf lo,F ; limit to min=9 | |
419 divemenu_set_xgas2_o2minus2: | |
420 movff lo, EEDATA | |
421 write_int_eeprom d'24' ; O2 Value | |
422 | |
423 call PLED_divemode_set_xgas ; Redraw menu | |
424 movlw d'3' | |
425 movwf menupos ; reset cursor | |
426 return | |
427 | |
428 divemenu_set_xgas2_o2plus: | |
429 read_int_eeprom d'24' ; O2 value | |
430 movff EEDATA,lo | |
431 incf lo,F ; increase O2 | |
432 movlw d'101' | |
433 cpfseq lo | |
434 bra divemenu_set_xgas2_o2plus2 | |
435 movlw d'5' ; O2 limit | |
436 movwf lo | |
437 divemenu_set_xgas2_o2plus2: ; test if O2+He>100... | |
438 read_int_eeprom d'25' ; He value | |
439 movf EEDATA,W | |
440 addwf lo,W ; add O2 value | |
441 movwf hi ; store in temp | |
442 movlw d'101' | |
443 cpfseq hi ; O2 and He > 100? | |
444 bra divemenu_set_xgas2_o2plus3 ; No! | |
445 decf lo,F ; reduce O2 again = unchanged after operation | |
446 divemenu_set_xgas2_o2plus3: ; save current value | |
447 movff lo, EEDATA | |
448 write_int_eeprom d'24' ; O2 Value | |
449 | |
450 call PLED_divemode_set_xgas ; Redraw menu | |
451 movlw d'2' | |
452 movwf menupos ; reset cursor | |
453 return | |
454 | |
455 divemenu_set_xgas2_exit: | |
456 read_int_eeprom d'25' ; Read He ratio | |
457 movff EEDATA,char_I_He_ratio ; And copy into hold register | |
458 | |
459 read_int_eeprom d'24' ; Read O2 ratio | |
460 movff EEDATA, char_I_O2_ratio ; O2 ratio | |
461 movff char_I_He_ratio, wait_temp ; copy into bank1 register | |
462 bsf STATUS,C ; | |
463 movlw d'100' ; 100% | |
464 subfwb wait_temp,W ; minus He | |
465 subfwb EEDATA,F ; minus O2 | |
466 movff EEDATA, char_I_N2_ratio ; = N2! | |
467 bsf manual_gas_changed ; set event flag | |
468 bsf event_occured ; set global event flag | |
99 | 469 bsf is_bailout ;=1: CC mode, but bailout active! |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
470 clrf lo ; clear Setpoint, PLED_const_ppO2_value now displayes "Bail" |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
471 movff lo,char_I_const_ppO2 |
0 | 472 bra timeout_divemenu2 ; quit underwater menu! |
473 | |
474 divemenu_set_gas: | |
475 btfsc FLAG_const_ppO2_mode ; in ppO2 mode? | |
17 | 476 bra divemenu_set_setpoint ; Yes, display SetPoint list |
0 | 477 |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
478 divemenu_set_gas_2: |
0 | 479 bsf display_set_gas ; set flag |
480 call PLED_clear_divemode_menu ; Clear Menu | |
481 call PLED_gas_list ; Display all 5 gases | |
482 movlw d'1' | |
483 movwf menupos ; reset cursor | |
484 call PLED_divemenu_cursor ; update cursor | |
485 return | |
486 | |
487 divemenu_set_setpoint: | |
488 bsf display_set_setpoint ; set flag | |
489 bsf display_set_gas ; set flag | |
490 | |
491 call PLED_clear_divemode_menu ; Clear Menu | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
492 call PLED_splist_start ; Display SetPoints |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
493 DISPLAYTEXT d'137' ; Bailout (as a sub-menu) |
0 | 494 movlw d'1' |
495 movwf menupos ; reset cursor | |
496 call PLED_divemenu_cursor ; update cursor | |
497 return | |
498 | |
499 | |
500 divemenu_set_gas2: | |
501 btfsc select_bailoutgas ; Are we in the Bailout list? | |
502 bra divemenu_set_gas2a ; Yes, choose gas | |
503 | |
504 btfss FLAG_const_ppO2_mode ; are we in ppO2 mode? | |
505 bra divemenu_set_gas2a ; no, choose gas | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
506 ; Yes, so select SP 1-3 |
3 | 507 bcf is_bailout ;=1: CC mode, but bailout active! |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
508 call PLED_show_ppO2_clear ; Clear ppO2 value |
3 | 509 |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
510 divemenu_set_gas1: |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
511 movlw d'4' |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
512 cpfseq menupos ; At the "Bailout" position? |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
513 bra divemenu_set_gas1b ; No, select SetPoint 1-3 |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
514 bsf select_bailoutgas ; Set Flag |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
515 bcf display_set_setpoint ; Clear Flag |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
516 bra divemenu_set_gas_2 ; Configure the extra gas / Select Bailout |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
517 |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
518 divemenu_set_gas1b: |
0 | 519 movlw d'35' ; offset in memory |
520 addwf menupos,W ; add SP number 0-2 | |
521 movwf EEADR | |
522 call read_eeprom ; Read SetPoint | |
523 movff EEDATA, char_I_const_ppO2 ; Use SetPoint | |
4 | 524 movff EEDATA, ppO2_setpoint_store ; Store also in this byte... |
0 | 525 |
526 divemenu_set_gas1a: | |
527 bcf display_set_setpoint ; Clear Display Flag | |
528 bsf stored_gas_changed ; set event flag | |
529 bsf event_occured ; set global event flag | |
530 bra timeout_divemenu2 ; quit menu! | |
531 | |
532 divemenu_set_gas2a: | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
533 movlw d'6' |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
534 cpfseq menupos ; At the "Gas 6.." position? |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
535 bra divemenu_set_gas2b ; No, select Gas1-5 (Stored in Menupos) |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
536 bra divemode_set_xgas ; Configure the extra gas |
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
537 divemenu_set_gas2b: |
3 | 538 bsf is_bailout ;=1: CC mode, but bailout active! |
0 | 539 clrf lo ; clear Setpoint, PLED_const_ppO2_value now displayes "Bail" |
540 movff lo,char_I_const_ppO2 | |
541 | |
542 bcf display_set_gas ; clear flag | |
543 movff menupos,active_gas ; copy into active gas register | |
544 decf menupos,W ; # of selected gas (0-4) | |
545 mullw d'4' ; times 4... | |
546 movf PRODL,W ; | |
547 addlw d'7' ; +7 = address for He ratio | |
548 movwf EEADR | |
549 call read_eeprom ; Read He ratio | |
550 movff EEDATA,char_I_He_ratio ; And copy into hold register | |
551 | |
552 decf menupos,W ; # of selected gas (0-4) | |
553 mullw d'4' ; times 4... | |
554 movf PRODL,W ; | |
555 addlw d'6' ; +6 = address for O2 ratio | |
556 movwf EEADR | |
557 call read_eeprom ; Read O2 ratio | |
558 movff EEDATA, char_I_O2_ratio ; O2 ratio | |
559 movff char_I_He_ratio, wait_temp ; copy into bank1 register | |
560 bsf STATUS,C ; | |
561 movlw d'100' ; 100% | |
562 subfwb wait_temp,W ; minus He | |
563 subfwb EEDATA,F ; minus O2 | |
564 movff EEDATA, char_I_N2_ratio ; = N2! | |
565 bsf stored_gas_changed ; set event flag | |
566 bsf event_occured ; set global event flag | |
567 bra timeout_divemenu2 ; quit menu! | |
568 | |
569 timeout_divemenu: | |
570 btfss menubit ; is the Dive mode menu displayed? | |
571 return ; No | |
572 | |
573 btfsc display_set_simulator ; Is the Simulator Mask active? | |
574 bra timeout_divemenu6 ; Yes, update Simulator mask | |
575 | |
576 btfss display_see_deco ; Is the decoplan active? | |
577 bra timeout_divemenu1 ; No, skip updating the decoplan | |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
578 bra timeout_divemenu3 ; Yes... |
0 | 579 |
580 timeout_divemenu1: | |
581 incf timeout_counter3,F ; increase timeout_counter3 | |
582 GETCUSTOM8 d'10' ; loads timeout_divemenu into WREG | |
583 cpfsgt timeout_counter3 ; ... longer then timeout_divemenu | |
584 return ; No! | |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
585 |
0 | 586 timeout_divemenu2: ; quit divemode menu |
587 ; Restore some outputs | |
124 | 588 clrf decoplan_page ; Page 0-1 of deco list |
119 | 589 call PLED_clear_divemode_menu; Clear dive mode menu |
115 | 590 |
591 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode | |
592 bra timeout_divemenu2a ; skip! | |
593 btfsc gauge_mode ; Ignore in Gauge mode | |
594 bra timeout_divemenu2a ; skip! | |
595 | |
0 | 596 btfsc dekostop_active |
66 | 597 call PLED_display_deko_mask ; clear nostop time, display decodata |
0 | 598 btfss dekostop_active |
66 | 599 call PLED_display_ndl_mask ; Clear deco data, display nostop time |
0 | 600 |
601 timeout_divemenu2a: | |
602 bcf menubit | |
603 bcf premenu ; Yes, clear flags and menu, display dive time and mask again | |
66 | 604 call PLED_active_gas_divemode; Display gas, if required |
0 | 605 call PLED_divemode_mask ; Display mask |
606 call PLED_divemins ; Display (new) divetime! | |
98
6f8e3a08011e
1.73beta rc1 (Added new customview for divemode)
heinrichsweikamp
parents:
87
diff
changeset
|
607 call customview_mask ; Redraw current customview mask |
0 | 608 clrf timeout_counter3 ; Also clear timeout |
609 bcf display_see_deco ; clear all display flags | |
610 bcf display_set_gas | |
611 bcf display_set_xgas | |
612 bcf display_set_setpoint | |
613 bcf display_set_simulator | |
614 bcf switch_left ; and debounce switches | |
615 bcf switch_right | |
616 return | |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
617 |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
618 ; Re-Draw current page of decoplan (may have more stops) |
0 | 619 timeout_divemenu3: |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
620 movff char_O_deco_status,WREG ; Get last computation state (BANK safe) |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
621 iorwf WREG ; Is it zero ? |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
622 btfsc STATUS,Z |
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
623 call PLED_decoplan ; Yes: new data available. |
0 | 624 bra timeout_divemenu1 ; Check timeout |
169
e26f49674956
Merge decoplan display for both GF and Buhlmann models.
JeanDo
parents:
124
diff
changeset
|
625 |
0 | 626 timeout_divemenu6: |
627 ; Update Simulator Mask | |
628 call PLED_divemode_simulator_mask; Show mask | |
629 call PLED_divemenu_cursor ; update cursor | |
630 bra timeout_divemenu1 ; Check timeout |