Mercurial > public > mk2
annotate code_part1/OSTC_code_asm_part1/divemode_menu.asm @ 85:8b813f67220f
renaming "Max Depth" to "max."
author | heinrichsweikamp |
---|---|
date | Wed, 08 Dec 2010 08:37:03 +0100 |
parents | 2227459e8ef2 |
children | 8d3c1bef6551 |
rev | line source |
---|---|
0 | 1 |
2 ; OSTC - diving computer code | |
3 ; Copyright (C) 2008 HeinrichsWeikamp GbR | |
4 | |
5 ; This program is free software: you can redistribute it and/or modify | |
6 ; it under the terms of the GNU General Public License as published by | |
7 ; the Free Software Foundation, either version 3 of the License, or | |
8 ; (at your option) any later version. | |
9 | |
10 ; This program is distributed in the hope that it will be useful, | |
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 ; GNU General Public License for more details. | |
14 | |
15 ; You should have received a copy of the GNU General Public License | |
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | |
18 | |
19 ; Underwater Menu (Set Gas, Decoplan, etc.) | |
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com | |
21 ; written: 11/11/05 | |
22 ; last updated: 090305 | |
23 ; known bugs: | |
24 ; ToDo: | |
25 | |
26 | |
27 test_switches_divemode: | |
28 ; checks switches in divemode | |
29 btfsc switch_left | |
30 bra test_switches_divemode2 | |
31 | |
32 btfss switch_right | |
33 return | |
34 | |
35 bcf switch_left ; Left button pressed! | |
36 bcf switch_right | |
37 | |
38 bcf select_bailoutgas ; Clear Flag for Bailout list | |
39 bsf premenu ; Set Flag for premenu | |
40 bcf menubit | |
41 clrf timeout_counter3 ; timeout_divemenu | |
42 | |
43 btfsc FLAG_apnoe_mode ; In Apnoe mode? | |
44 bra test_switches_divemode1 ; Yes! | |
45 | |
46 test_switches_divemode0: | |
47 WIN_INVERT .1 | |
48 DISPLAYTEXT .4 ;Menu? | |
49 WIN_INVERT .0 | |
50 return | |
51 | |
52 test_switches_divemode1: | |
53 DISPLAYTEXT .141 ;Quit? | |
54 return | |
55 | |
56 test_switches_divemode2: | |
57 bcf switch_left ; Also reactivate left button if there was a right press without prior left press | |
58 bcf switch_right ; enable right button again | |
59 | |
60 btfss premenu | |
61 bra set_marker ; No Pre-Menu displayed -> Set Markerflag! | |
62 | |
63 btfss FLAG_apnoe_mode ; In Apnoe mode? | |
64 bra test_switches_divemode2a; No! | |
65 | |
66 ; Yes, so quit Apnoe mode at once... | |
67 bcf divemode ; Clear Divemode flag... | |
68 bcf premenu ; clear premenu flag | |
69 return | |
70 | |
71 test_switches_divemode2a: | |
72 bsf menubit ; Enter Divemode-Menu! | |
73 bcf premenu ; clear premenu flag | |
74 call PLED_clear_divemode_menu ; Clear dive mode menu area | |
75 call PLED_divemode_menu_mask_first ; Write Divemode menu1 mask | |
76 bcf display_set_simulator ; Clear Simulator-Menu flag | |
77 bcf divemode_menu_page ; Start in Menu Page one | |
78 movlw d'1' | |
79 movwf menupos ; reset cursor in divemode menu | |
80 call PLED_divemenu_cursor ; show cursor | |
81 bcf switch_right | |
82 bcf switch_left ; Left button pressed! | |
83 return | |
84 | |
85 set_marker: | |
86 btfsc standalone_simulator ; Standalone Simualtor active? | |
87 bra divemode_menu_simulator ; Yes, Show simulator menu! | |
88 | |
71
6beb680a6130
1.72beta - color-coded gaslist, small fix with stopwatch
heinrichsweikamp
parents:
68
diff
changeset
|
89 bsf LED_red ; LEDr on |
0 | 90 movlw d'6' ; Type of Alarm (Manual Marker) |
91 movwf AlarmType ; Copy to Alarm Register | |
92 bsf event_occured ; Set Event Flag | |
93 | |
71
6beb680a6130
1.72beta - color-coded gaslist, small fix with stopwatch
heinrichsweikamp
parents:
68
diff
changeset
|
94 btfss stopwatch_active ; =1: Reset Average registers |
0 | 95 return |
71
6beb680a6130
1.72beta - color-coded gaslist, small fix with stopwatch
heinrichsweikamp
parents:
68
diff
changeset
|
96 btfsc lock_stopwatch_reset ; Reset locked? |
6beb680a6130
1.72beta - color-coded gaslist, small fix with stopwatch
heinrichsweikamp
parents:
68
diff
changeset
|
97 return ; Yes, do not reset (now)... |
6beb680a6130
1.72beta - color-coded gaslist, small fix with stopwatch
heinrichsweikamp
parents:
68
diff
changeset
|
98 |
0 | 99 ; Maker Set, also reset average Depth.... |
100 clrf average_depth_hold+0 | |
101 clrf average_depth_hold+1 | |
102 clrf average_depth_hold+2 | |
103 clrf average_depth_hold+3 ; Clear average depth register | |
104 movlw d'2' | |
105 movwf average_divesecs+0 | |
106 clrf average_divesecs+1 | |
107 call calc_average_depth | |
108 return | |
109 | |
110 test_switches_divemode_menu: | |
111 btfsc switch_left | |
112 bra test_switches_divemode_menu3 | |
113 btfss switch_right | |
114 return | |
115 | |
116 btfsc display_see_l_tissue ; Is the leading tissue info screen active | |
117 bra divemenu_see_leading_tissue2; Yes, quit menu | |
118 | |
119 btfsc display_see_deco ; Is the Decoplan displayed? | |
120 bra divemenu_see_decoplan2 ; Yes, exit menu on left button press | |
121 | |
122 btfsc display_set_graphs ; Is the Graph displayed? | |
123 bra divemode_set_graphs2 ; Yes, exit menu on right button press | |
124 | |
125 bcf switch_right ; Left button pressed | |
126 clrf timeout_counter3 ; timout_divemenu! | |
127 incf menupos,F | |
128 | |
129 ; Following routine configures the number of menu entries for the different modes | |
130 movlw d'6' ; number of available gases+1, ; number of menu options+1 | |
131 btfsc display_set_setpoint ; In SetPoint Menu? | |
132 movlw d'4' ; Number of entries for this menu+1 | |
133 | |
134 cpfseq menupos ; =limit? | |
135 bra test_switches_divemode_menu1; No! | |
136 movlw d'1' ; Yes, reset to position 1! | |
137 movwf menupos | |
138 test_switches_divemode_menu1: | |
139 call PLED_divemenu_cursor ; update cursor | |
140 return | |
141 | |
142 test_switches_divemode_menu3: | |
143 bcf switch_left | |
144 bcf switch_right | |
145 bsf menubit ; Enter Divemode-Menu! | |
146 bcf premenu ; clear premenu flag | |
147 clrf timeout_counter3 | |
148 | |
149 btfsc display_see_l_tissue ; Is the leading tissue info screen active | |
150 bra divemenu_see_leading_tissue2; Yes, quit menu | |
151 | |
152 btfsc display_set_gas ; Are we in the "Gaslist" or "SetPoint" menu? | |
153 bra divemenu_set_gas2 ; Yes, so set gas and exit menu | |
154 | |
155 btfsc display_see_deco ; Is the Decoplan displayed? | |
156 bra divemenu_see_decoplan2 ; Yes, exit menu on right button press | |
157 | |
158 btfsc display_set_graphs ; Is the Graph displayed? | |
159 bra divemode_set_graphs2 ; Yes, exit menu on right button press | |
160 | |
161 btfsc display_set_xgas ; Are we in the "Set Gas" menu? | |
162 bra divemenu_set_xgas2 ; Yes, so configure gas or set menu and exit menu | |
163 | |
164 btfsc display_set_simulator ; Are we in the Divemode Simulator menu? | |
165 goto divemode_menu_simulator2 ; Yes, so adjust depth or set and exit | |
166 | |
167 btfsc divemode_menu_page ; Are we in the second menu page? | |
168 bra test_switches_divemode_menu4; Yes, use second page items | |
73
2227459e8ef2
Exchanged Decoplan and Gaslist in dive mode menu
heinrichsweikamp
parents:
71
diff
changeset
|
169 |
0 | 170 ; Options for Menu 1 |
171 dcfsnz menupos,F | |
73
2227459e8ef2
Exchanged Decoplan and Gaslist in dive mode menu
heinrichsweikamp
parents:
71
diff
changeset
|
172 bra divemenu_set_gas ; Set gas sub-menu |
2227459e8ef2
Exchanged Decoplan and Gaslist in dive mode menu
heinrichsweikamp
parents:
71
diff
changeset
|
173 dcfsnz menupos,F |
0 | 174 bra divemenu_see_decoplan ; display the full decoplan |
175 dcfsnz menupos,F | |
176 bra divemode_set_xgas ; Configure the extra gas / Select Bailout | |
177 dcfsnz menupos,F | |
178 bra divemenu_enter_second ; Enter second Menu page | |
179 dcfsnz menupos,F | |
180 bra timeout_divemenu2 ; Quit divemode menu | |
181 return | |
182 | |
183 test_switches_divemode_menu4: | |
184 ; Options for Menu 2 | |
185 dcfsnz menupos,F | |
186 bra divemode_set_graphs ; Show saturation graphs | |
187 dcfsnz menupos,F | |
188 bra divemode_toggle_brightness ; Toggle OLED-Brightness | |
189 dcfsnz menupos,F | |
190 bra divemenu_see_leading_tissue ; Display details about leading tissue | |
191 dcfsnz menupos,F | |
192 bra toggle_stopwatch ; Toggle Stopwatch | |
193 dcfsnz menupos,F | |
194 bra timeout_divemenu2 ; Quit divemode menu | |
195 return | |
196 | |
197 toggle_stopwatch: | |
198 btg stopwatch_active ; Toggle Flag | |
199 | |
200 btfss stopwatch_active ; Show Stopwatch? | |
201 bra toggle_stopwatch2 ; No, remove outputs | |
202 | |
203 clrf average_depth_hold+0 | |
204 clrf average_depth_hold+1 | |
205 clrf average_depth_hold+2 | |
206 clrf average_depth_hold+3 ; Clear average depth register | |
207 movlw d'2' | |
208 movwf average_divesecs+0 | |
209 clrf average_divesecs+1 | |
210 call calc_average_depth | |
211 | |
212 bra timeout_divemenu2 ; quit menu! | |
213 | |
214 toggle_stopwatch2: | |
215 call PLED_stopwatch_remove ; Remove Stopwatch Outputs | |
216 bra timeout_divemenu2 ; quit menu! | |
217 | |
218 divemode_toggle_brightness: | |
219 read_int_eeprom d'90' ; Brightness offset? (Dim>0, Normal = 0) | |
220 tstfsz EEDATA ; Was dimmed? | |
221 bra divemode_toggle_brightness1 ; Yes... | |
222 | |
223 call PLED_brightness_low | |
224 movlw d'1' | |
225 movwf EEDATA ; Copy to EEDATA | |
226 write_int_eeprom d'90' ; Brightness offset? (Dim=1, Normal = 0) | |
227 bra divemode_toggle_brightness3 | |
228 | |
229 divemode_toggle_brightness1: | |
230 call PLED_brightness_full | |
231 movlw d'0' | |
232 movwf EEDATA ; Copy to EEDATA | |
233 write_int_eeprom d'90' ; Brightness offset? (Dim=1, Normal = 0) | |
234 | |
235 divemode_toggle_brightness3: | |
236 ; Now, redraw all outputs (All modes) | |
237 call PLED_active_gas_divemode ; Display gas, if required | |
238 call PLED_temp_divemode ; Displays temperature | |
239 call PLED_depth ; Displays new depth... | |
240 call PLED_max_pressure ; ...and max. depth | |
241 | |
242 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode | |
243 bra timeout_divemenu2 ; quit menu! | |
244 btfsc gauge_mode ; Ignore in Gauge mode | |
245 bra timeout_divemenu2 ; quit menu! | |
246 | |
247 ; Redraw Outputs in Deco modes | |
248 btfsc dekostop_active | |
249 call PLED_display_deko_mask ; clear nostop time, display decodata | |
250 btfss dekostop_active | |
251 call PLED_display_ndl_mask ; Clear deco data, display nostop time | |
252 bra timeout_divemenu2 ; quit menu! | |
253 | |
254 divemenu_enter_second: | |
255 call PLED_clear_divemode_menu ; Clear dive mode menu area | |
256 call PLED_divemode_menu_mask_second ; Write Divemode menu1 mask | |
257 movlw d'1' | |
258 movwf menupos ; reset cursor to first item in divemode menu page two | |
259 bsf divemode_menu_page ; Enter Menu Page two | |
260 call PLED_divemenu_cursor ; show cursor | |
261 bcf switch_right | |
262 bcf switch_left ; Left button pressed! | |
263 return | |
264 | |
265 divemode_set_xgas: ; Set the extra gas... | |
266 btfsc FLAG_const_ppO2_mode ; are we in ppO2 mode? | |
267 bra divemenu_set_bailout ; Yes, so display Bailot list... | |
268 | |
269 bsf display_set_xgas ; Set Flag | |
270 call PLED_clear_divemode_menu ; Clear Menu | |
271 | |
272 movff char_I_O2_ratio, EEDATA ; Reset Gas6 to current gas | |
273 write_int_eeprom d'24' | |
274 movff char_I_He_ratio, EEDATA | |
275 write_int_eeprom d'25' | |
276 | |
277 call PLED_divemode_set_xgas ; Show mask | |
278 | |
279 movlw d'1' | |
280 movwf menupos ; reset cursor | |
281 call PLED_divemenu_cursor ; update cursor | |
282 | |
283 return | |
284 | |
285 divemode_menu_simulator: | |
286 bsf menubit ; Enter Divemode-Menu! | |
287 bcf premenu ; clear premenu flag | |
288 bcf switch_right | |
289 bcf switch_left ; Left button pressed! | |
290 bsf display_set_simulator ; Set Flag | |
291 call PLED_clear_divemode_menu ; Clear Menu | |
292 call PLED_divemode_simulator_mask; Show mask | |
293 bcf divemode_menu_page ; Start in Menu Page one | |
294 movlw d'1' | |
295 movwf menupos ; reset cursor | |
296 call PLED_divemenu_cursor ; update cursor | |
297 return | |
298 | |
299 divemode_menu_simulator2: | |
300 dcfsnz menupos,F | |
301 bra timeout_divemenu2 ; quit underwater menu! | |
302 dcfsnz menupos,F | |
303 bra divemode_menu_simulator_p1 ; Adjust +1m | |
304 dcfsnz menupos,F | |
305 bra divemode_menu_simulator_m1 ; Adjust -1m | |
306 dcfsnz menupos,F | |
307 bra divemode_menu_simulator_p10 ; Adjust +10m | |
308 dcfsnz menupos,F | |
309 bra divemode_menu_simulator_m10 ; Adjust -10m | |
310 bra timeout_divemenu2 ; quit underwater menu! | |
311 | |
312 divemode_menu_simulator_common: | |
313 call PLED_divemode_simulator_mask ; Redraw Simualtor mask | |
314 | |
315 ; Check limits (140m and 0m) | |
316 movlw LOW d'15000' | |
317 movwf sub_a+0 | |
318 movlw HIGH d'15000' | |
319 movwf sub_a+1 | |
320 movff sim_pressure+0,sub_b+0 | |
321 movff sim_pressure+1,sub_b+1 | |
322 call sub16 ; sub_c = sub_a - sub_b | |
323 btfss neg_flag | |
324 bra divemode_menu_simulator_common2 | |
325 ; Too deep, limit to 140m | |
326 movlw LOW d'15000' | |
327 movwf sim_pressure+0 | |
328 movlw HIGH d'15000' | |
329 movwf sim_pressure+1 | |
330 return | |
331 | |
332 divemode_menu_simulator_common2: | |
333 movlw LOW d'1000' | |
334 movwf sub_a+0 | |
335 movlw HIGH d'1000' | |
336 movwf sub_a+1 | |
337 movff sim_pressure+0,sub_b+0 | |
338 movff sim_pressure+1,sub_b+1 | |
339 call sub16 ; sub_c = sub_a - sub_b | |
340 btfsc neg_flag | |
341 return | |
342 ; Too shallow, limit to 1m | |
343 movlw LOW d'1000' | |
344 movwf sim_pressure+0 | |
345 movlw HIGH d'1000' | |
346 movwf sim_pressure+1 | |
347 return | |
348 | |
349 divemode_menu_simulator_m10: | |
350 movlw LOW d'1000' | |
351 subwf sim_pressure+0,F | |
352 movlw HIGH d'1000' | |
353 subwfb sim_pressure+1,F | |
354 movlw d'5' | |
355 movwf menupos ; reset cursor | |
356 bra divemode_menu_simulator_common | |
357 | |
358 divemode_menu_simulator_p10: | |
359 movlw LOW d'1000' | |
360 addwf sim_pressure+0,F | |
361 movlw HIGH d'1000' | |
362 addwfc sim_pressure+1,F | |
363 movlw d'4' | |
364 movwf menupos ; reset cursor | |
365 bra divemode_menu_simulator_common | |
366 | |
367 divemode_menu_simulator_p1: | |
368 movlw d'100' | |
369 addwf sim_pressure+0,F | |
370 movlw d'0' | |
371 addwfc sim_pressure+1,F | |
372 movlw d'2' | |
373 movwf menupos ; reset cursor | |
374 bra divemode_menu_simulator_common | |
375 | |
376 divemode_menu_simulator_m1: | |
377 movlw d'100' | |
378 subwf sim_pressure+0,F | |
379 movlw d'0' | |
380 subwfb sim_pressure+1,F | |
381 movlw d'3' | |
382 movwf menupos ; reset cursor | |
383 bra divemode_menu_simulator_common | |
384 | |
385 divemode_set_graphs: | |
386 bsf display_set_graphs ; set flag | |
387 call PLED_clear_divemode_menu ; Clear Menu | |
388 call deco_main_calc_desaturation_time ; calculate desaturation time | |
389 movlb b'00000001' ; select ram bank 1 | |
390 call PLED_saturation_graph_divemode ; Display saturation graph | |
391 return | |
392 | |
393 divemode_set_graphs2: | |
394 bcf display_set_graphs ; clear flag | |
395 bra timeout_divemenu2 ; quit menu! | |
396 | |
397 divemenu_see_leading_tissue: | |
398 bsf display_see_l_tissue ; Set Flag | |
399 call PLED_clear_divemode_menu ; Clear Menu | |
400 call PLED_show_leading_tissue ; Show infos about leading tissue | |
401 return | |
402 | |
403 divemenu_see_leading_tissue2: | |
404 bcf display_see_l_tissue ; Clear Flag | |
405 bra timeout_divemenu2 ; quit menu! | |
406 | |
407 divemenu_see_decoplan: | |
408 bsf display_see_deco ; set flag | |
64 | 409 call PLED_clear_divemode_menu ; Clear Menu |
0 | 410 |
411 read_int_eeprom d'34' | |
412 movlw d'3' | |
413 cpfsgt EEDATA ; in multi-gf mode? Z16 GF OC=4 and Z16 GF CC=5 | |
68 | 414 bra divemenu_see_decoplan1 ; No, standard ZH-L16 |
0 | 415 |
416 bsf multi_gf_display ; Yes, display the multi-gf table screen | |
64 | 417 bcf last_ceiling_gf_shown ; Clear flag |
0 | 418 |
68 | 419 ; movff char_O_deco_status,deco_status ; |
420 ; tstfsz deco_status ; deco_status=0 if decompression calculation done | |
421 ; return ; calculation not yet finished! | |
0 | 422 |
64 | 423 call PLED_decoplan_gf_page1 ; Display the new screen |
0 | 424 return |
425 | |
426 divemenu_see_decoplan1: | |
427 | |
428 movff char_O_deco_status,deco_status ; | |
429 tstfsz deco_status ; deco_status=0 if decompression calculation done | |
430 return ; calculation not yet finished! | |
431 | |
432 call PLED_decoplan ; display the Decoplan | |
433 return | |
434 | |
435 divemenu_see_decoplan2: | |
64 | 436 btfsc multi_gf_display ; Next Page in Multi-GF Screen? |
437 bra divemenu_see_decoplan2_nextgf ; Yes! | |
438 ; No, remove outputs! | |
439 divemenu_see_decoplan2_0: | |
0 | 440 bcf display_see_deco ; clear flag |
441 bra timeout_divemenu2 ; quit menu! | |
442 | |
64 | 443 divemenu_see_decoplan2_nextgf: |
444 incf temp8,F | |
445 btfsc last_ceiling_gf_shown ; last ceiling shown? | |
446 bra divemenu_see_decoplan2_0 ; All done, clear and return | |
447 | |
448 clrf timeout_counter3 ; Clear timeout Divemode menu | |
68 | 449 bra timeout_divemenu3x ; Display next page |
64 | 450 |
451 | |
452 | |
0 | 453 divemenu_set_xgas2: |
454 dcfsnz menupos,F | |
455 bra divemenu_set_xgas2_exit ; Use the gas6 configured and exit | |
456 dcfsnz menupos,F | |
457 bra divemenu_set_xgas2_o2plus ; Adjust O2+ | |
458 dcfsnz menupos,F | |
459 bra divemenu_set_xgas2_o2minus ; Adjust O2- | |
460 dcfsnz menupos,F | |
461 bra divemenu_set_xgas2_heplus ; Adjust He+ | |
462 dcfsnz menupos,F | |
463 bra divemenu_set_xgas2_heminus ; Adjust He- | |
464 return | |
465 | |
466 divemenu_set_xgas2_heminus: | |
467 read_int_eeprom d'25' ; He value | |
468 movff EEDATA,lo | |
469 decf lo,F ; decrease He | |
470 movlw d'255' | |
471 cpfseq lo | |
472 bra divemenu_set_xgas2_heminus2 | |
473 incf lo,F ; limit to min=0 | |
474 divemenu_set_xgas2_heminus2: | |
475 movff lo, EEDATA | |
476 write_int_eeprom d'25' ; He Value | |
477 | |
478 call PLED_divemode_set_xgas ; Redraw menu | |
479 movlw d'5' | |
480 movwf menupos ; reset cursor | |
481 return | |
482 | |
483 divemenu_set_xgas2_heplus: | |
484 read_int_eeprom d'25' ; He value | |
485 movff EEDATA,lo | |
486 incf lo,F ; increase He | |
487 movlw d'101' | |
488 cpfseq lo | |
489 bra divemenu_set_xgas2_heplus2 | |
490 movlw d'4' ; O2 Limit | |
491 movwf lo | |
492 divemenu_set_xgas2_heplus2: ; test if O2+He>100... | |
493 read_int_eeprom d'24' ; O2 value | |
494 movf EEDATA,W | |
495 addwf lo,W ; add He value | |
496 movwf hi ; store in temp | |
497 movlw d'101' | |
498 cpfseq hi ; O2 and He > 100? | |
499 bra divemenu_set_xgas2_heplus3 ; No! | |
500 decf lo,F ; reduce He again = unchanged after operation | |
501 divemenu_set_xgas2_heplus3: ; save current value | |
502 movff lo, EEDATA | |
503 write_int_eeprom d'25' ; He Value | |
504 | |
505 call PLED_divemode_set_xgas ; Redraw menu | |
506 movlw d'4' | |
507 movwf menupos ; reset cursor | |
508 return | |
509 | |
510 divemenu_set_xgas2_o2minus: | |
511 read_int_eeprom d'24' ; O2 value | |
512 movff EEDATA,lo | |
513 decf lo,F ; decrease O2 | |
514 movlw d'3' ; Limit-1 | |
515 cpfseq lo | |
516 bra divemenu_set_xgas2_o2minus2 | |
517 incf lo,F ; limit to min=9 | |
518 divemenu_set_xgas2_o2minus2: | |
519 movff lo, EEDATA | |
520 write_int_eeprom d'24' ; O2 Value | |
521 | |
522 call PLED_divemode_set_xgas ; Redraw menu | |
523 movlw d'3' | |
524 movwf menupos ; reset cursor | |
525 return | |
526 | |
527 divemenu_set_xgas2_o2plus: | |
528 read_int_eeprom d'24' ; O2 value | |
529 movff EEDATA,lo | |
530 incf lo,F ; increase O2 | |
531 movlw d'101' | |
532 cpfseq lo | |
533 bra divemenu_set_xgas2_o2plus2 | |
534 movlw d'5' ; O2 limit | |
535 movwf lo | |
536 divemenu_set_xgas2_o2plus2: ; test if O2+He>100... | |
537 read_int_eeprom d'25' ; He value | |
538 movf EEDATA,W | |
539 addwf lo,W ; add O2 value | |
540 movwf hi ; store in temp | |
541 movlw d'101' | |
542 cpfseq hi ; O2 and He > 100? | |
543 bra divemenu_set_xgas2_o2plus3 ; No! | |
544 decf lo,F ; reduce O2 again = unchanged after operation | |
545 divemenu_set_xgas2_o2plus3: ; save current value | |
546 movff lo, EEDATA | |
547 write_int_eeprom d'24' ; O2 Value | |
548 | |
549 call PLED_divemode_set_xgas ; Redraw menu | |
550 movlw d'2' | |
551 movwf menupos ; reset cursor | |
552 return | |
553 | |
554 divemenu_set_xgas2_exit: | |
555 read_int_eeprom d'25' ; Read He ratio | |
556 movff EEDATA,char_I_He_ratio ; And copy into hold register | |
557 | |
558 read_int_eeprom d'24' ; Read O2 ratio | |
559 movff EEDATA, char_I_O2_ratio ; O2 ratio | |
560 movff char_I_He_ratio, wait_temp ; copy into bank1 register | |
561 bsf STATUS,C ; | |
562 movlw d'100' ; 100% | |
563 subfwb wait_temp,W ; minus He | |
564 subfwb EEDATA,F ; minus O2 | |
565 movff EEDATA, char_I_N2_ratio ; = N2! | |
566 bsf manual_gas_changed ; set event flag | |
567 bsf event_occured ; set global event flag | |
568 bra timeout_divemenu2 ; quit underwater menu! | |
569 | |
570 divemenu_set_bailout: | |
571 bsf display_set_gas ; set flag | |
572 call PLED_clear_divemode_menu ; Clear Menu | |
573 | |
574 bcf FLAG_const_ppO2_mode ; Delete Flag to show all bailouts | |
575 bsf select_bailoutgas ; Set Flag for Bailout list | |
576 call PLED_gas_list ; Display all 5 gases | |
577 bsf FLAG_const_ppO2_mode ; Reset Flag | |
578 | |
579 movlw d'1' | |
580 movwf menupos ; reset cursor | |
581 call PLED_divemenu_cursor ; update cursor | |
582 return | |
583 | |
584 divemenu_set_gas: | |
585 btfsc FLAG_const_ppO2_mode ; in ppO2 mode? | |
17 | 586 bra divemenu_set_setpoint ; Yes, display SetPoint list |
0 | 587 |
588 bsf display_set_gas ; set flag | |
589 call PLED_clear_divemode_menu ; Clear Menu | |
590 call PLED_gas_list ; Display all 5 gases | |
591 movlw d'1' | |
592 movwf menupos ; reset cursor | |
593 call PLED_divemenu_cursor ; update cursor | |
594 return | |
595 | |
596 divemenu_set_setpoint: | |
597 bsf display_set_setpoint ; set flag | |
598 bsf display_set_gas ; set flag | |
599 | |
600 call PLED_clear_divemode_menu ; Clear Menu | |
601 call PLED_splist_start ; Display SetPoints and Sensor results | |
602 movlw d'1' | |
603 movwf menupos ; reset cursor | |
604 call PLED_divemenu_cursor ; update cursor | |
605 | |
606 return | |
607 | |
608 | |
609 divemenu_set_gas2: | |
610 btfsc select_bailoutgas ; Are we in the Bailout list? | |
611 bra divemenu_set_gas2a ; Yes, choose gas | |
612 | |
613 btfss FLAG_const_ppO2_mode ; are we in ppO2 mode? | |
614 bra divemenu_set_gas2a ; no, choose gas | |
615 ; Yes, so select SP 1-3 or Sensor mode | |
616 | |
3 | 617 bcf is_bailout ;=1: CC mode, but bailout active! |
618 call PLED_show_ppO2_clear; Clear ppO2 value | |
619 | |
0 | 620 divemenu_set_gas1: |
621 movlw d'35' ; offset in memory | |
622 addwf menupos,W ; add SP number 0-2 | |
623 movwf EEADR | |
624 call read_eeprom ; Read SetPoint | |
625 movff EEDATA, char_I_const_ppO2 ; Use SetPoint | |
4 | 626 movff EEDATA, ppO2_setpoint_store ; Store also in this byte... |
0 | 627 |
628 divemenu_set_gas1a: | |
629 bcf display_set_setpoint ; Clear Display Flag | |
630 ; Now, Set correct Diluent (again) | |
17 | 631 ; read_int_eeprom d'33' ; Read byte (stored in EEDATA) |
632 ; movff EEDATA,active_gas ; Read start gas (1-5) | |
633 ; | |
634 ; decf active_gas,W ; Gas 0-4 | |
635 ; mullw d'4' | |
636 ; movf PRODL,W | |
637 ; addlw d'7' ; = address for He ratio | |
638 ; movwf EEADR | |
639 ; call read_eeprom ; Read He ratio | |
640 ; movff EEDATA,char_I_He_ratio ; And copy into hold register | |
641 ; decf active_gas,W ; Gas 0-4 | |
642 ; mullw d'4' | |
643 ; movf PRODL,W | |
644 ; addlw d'6' ; = address for O2 ratio | |
645 ; movwf EEADR | |
646 ; call read_eeprom ; Read O2 ratio | |
647 ; movff EEDATA, char_I_O2_ratio ; O2 ratio | |
648 ; movff char_I_He_ratio, wait_temp ; copy into bank1 register | |
649 ; bsf STATUS,C ; Borrow bit | |
650 ; movlw d'100' ; 100% | |
651 ; subfwb wait_temp,W ; minus He | |
652 ; bsf STATUS,C ; Borrow bit | |
653 ; subfwb EEDATA,F ; minus O2 | |
654 ; movff EEDATA, char_I_N2_ratio ; = N2! | |
655 ; call PLED_active_gas_clear ; Clear gas in case of AIR (Will be redrawn) | |
0 | 656 |
657 bsf stored_gas_changed ; set event flag | |
658 bsf event_occured ; set global event flag | |
659 bra timeout_divemenu2 ; quit menu! | |
660 | |
661 divemenu_set_gas2a: | |
3 | 662 bsf is_bailout ;=1: CC mode, but bailout active! |
0 | 663 clrf lo ; clear Setpoint, PLED_const_ppO2_value now displayes "Bail" |
664 movff lo,char_I_const_ppO2 | |
665 | |
666 bcf display_set_gas ; clear flag | |
667 movff menupos,active_gas ; copy into active gas register | |
668 decf menupos,W ; # of selected gas (0-4) | |
669 mullw d'4' ; times 4... | |
670 movf PRODL,W ; | |
671 addlw d'7' ; +7 = address for He ratio | |
672 movwf EEADR | |
673 call read_eeprom ; Read He ratio | |
674 movff EEDATA,char_I_He_ratio ; And copy into hold register | |
675 | |
676 decf menupos,W ; # of selected gas (0-4) | |
677 mullw d'4' ; times 4... | |
678 movf PRODL,W ; | |
679 addlw d'6' ; +6 = address for O2 ratio | |
680 movwf EEADR | |
681 call read_eeprom ; Read O2 ratio | |
682 movff EEDATA, char_I_O2_ratio ; O2 ratio | |
683 movff char_I_He_ratio, wait_temp ; copy into bank1 register | |
684 bsf STATUS,C ; | |
685 movlw d'100' ; 100% | |
686 subfwb wait_temp,W ; minus He | |
687 subfwb EEDATA,F ; minus O2 | |
688 movff EEDATA, char_I_N2_ratio ; = N2! | |
689 bsf stored_gas_changed ; set event flag | |
690 bsf event_occured ; set global event flag | |
691 bra timeout_divemenu2 ; quit menu! | |
692 | |
693 timeout_divemenu: | |
694 btfss menubit ; is the Dive mode menu displayed? | |
695 return ; No | |
696 | |
697 btfsc display_see_l_tissue ; Are the leading tissue details displayed? | |
698 bra timeout_divemenu7 ; Yes, update them | |
699 | |
700 btfsc display_set_simulator ; Is the Simulator Mask active? | |
701 bra timeout_divemenu6 ; Yes, update Simulator mask | |
702 | |
703 | |
704 btfss display_see_deco ; Is the decoplan active? | |
705 bra timeout_divemenu1 ; No, skip updating the decoplan | |
706 | |
707 btfsc multi_gf_display ; display the multi-gf table screen? | |
708 bra timeout_divemenu3 ; Yes... | |
709 | |
710 movff char_O_deco_status,deco_status ; | |
66 | 711 tstfsz deco_status ; deco_status=0 if decompression calculation done |
712 bra timeout_divemenu1 ; No, skip updating the decoplan | |
0 | 713 |
66 | 714 call PLED_decoplan ; update the Decoplan |
0 | 715 |
716 timeout_divemenu1: | |
717 incf timeout_counter3,F ; increase timeout_counter3 | |
718 GETCUSTOM8 d'10' ; loads timeout_divemenu into WREG | |
719 cpfsgt timeout_counter3 ; ... longer then timeout_divemenu | |
720 return ; No! | |
721 timeout_divemenu2: ; quit divemode menu | |
66 | 722 btfss multi_gf_display ; Was the Multi-GF Table displayed? |
723 bra timeout_divemenu2a ; No, normal OLED rebuild | |
0 | 724 |
725 ; Restore some outputs | |
66 | 726 clrf temp8 ; Page 0-1 of deco list |
0 | 727 btfsc dekostop_active |
66 | 728 call PLED_display_deko_mask ; clear nostop time, display decodata |
0 | 729 btfss dekostop_active |
66 | 730 call PLED_display_ndl_mask ; Clear deco data, display nostop time |
0 | 731 |
732 timeout_divemenu2a: | |
66 | 733 bcf multi_gf_display ; Do not display the multi-gf table screen |
0 | 734 bcf menubit |
735 bcf premenu ; Yes, clear flags and menu, display dive time and mask again | |
66 | 736 call PLED_active_gas_divemode; Display gas, if required |
0 | 737 call PLED_clear_divemode_menu; Clear dive mode menu |
738 call PLED_divemode_mask ; Display mask | |
739 call PLED_divemins ; Display (new) divetime! | |
68 | 740 call PLED_temp_divemode ; redraw temperature |
0 | 741 clrf timeout_counter3 ; Also clear timeout |
742 bcf display_see_deco ; clear all display flags | |
743 bcf display_see_l_tissue | |
744 bcf display_set_gas | |
745 bcf display_set_graphs | |
746 bcf display_set_xgas | |
747 bcf display_set_setpoint | |
748 bcf display_set_simulator | |
749 bcf switch_left ; and debounce switches | |
750 bcf switch_right | |
71
6beb680a6130
1.72beta - color-coded gaslist, small fix with stopwatch
heinrichsweikamp
parents:
68
diff
changeset
|
751 bsf lock_stopwatch_reset ; Lock the stopwatch reset for at least one second (Cleared in "calc_average_depth:") |
0 | 752 return |
753 | |
754 timeout_divemenu3: | |
64 | 755 movff char_O_deco_status,deco_status ; |
756 tstfsz deco_status ; deco_status=0 if decompression calculation done | |
0 | 757 bra timeout_divemenu1 ; No, skip updating the decoplan |
68 | 758 timeout_divemenu3x: |
64 | 759 call PLED_decoplan_gf_page_current ; Re-Draw Current page of GF Decoplan |
0 | 760 bra timeout_divemenu1 ; Check timeout |
761 | |
762 timeout_divemenu6: | |
763 ; Update Simulator Mask | |
764 call PLED_divemode_simulator_mask; Show mask | |
765 call PLED_divemenu_cursor ; update cursor | |
766 bra timeout_divemenu1 ; Check timeout | |
767 | |
768 timeout_divemenu7: | |
769 ; Update Leading tissue infos | |
770 call PLED_show_leading_tissue ; Update infos about leading tissue | |
771 bra timeout_divemenu1 ; Check timeout |