comparison code_part1/OSTC_code_asm_part1/pled_outputs.asm @ 0:96a35aeda5f2

Initial setup
author heinrichsweikamp
date Tue, 12 Jan 2010 15:05:59 +0100
parents
children 3cf8af30b36e
comparison
equal deleted inserted replaced
-1:000000000000 0:96a35aeda5f2
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 ; routines for display outputs
20 ; written by: Matthias Heinrichs, info@heinrichsweikamp.com
21 ; written: 15/01/05
22 ; last updated: 06/06/08
23 ; known bugs:
24 ; ToDo: More comments
25
26 ostc_debug macro debug_temp
27 movlw debug_temp
28 call ostc_debug1
29 endm
30
31 ostc_debug1:
32 movwf debug_temp
33
34 movff debug_char+4,debug_char+5 ; Save for background debugger
35 movff debug_char+3,debug_char+4
36 movff debug_char+2,debug_char+3
37 movff debug_char+1,debug_char+2
38 movff debug_char+0,debug_char+1
39 movff debug_temp,debug_char+0
40
41 btfss debug_mode ; Are we in debugmode?
42 return ; No, return!
43
44 WIN_TOP .200
45 WIN_LEFT .100
46 WIN_FONT FT_SMALL
47 WIN_INVERT .0 ; Init new Wordprocessor
48 WIN_COLOR color_white
49 lfsr FSR2,letter
50 movf debug_char+0,W
51 movwf POSTINC2
52 movf debug_char+1,W
53 movwf POSTINC2
54 movf debug_char+2,W
55 movwf POSTINC2
56 movf debug_char+3,W
57 movwf POSTINC2
58 movf debug_char+4,W
59 movwf POSTINC2
60 movf debug_char+5,W
61 movwf POSTINC2
62 movlw ' '
63 movwf POSTINC2
64 call word_processor
65 return
66
67
68 PLED_resetdebugger:
69 call set_LEDr
70 call clear_LEDnofly
71 call PLED_boot ; PLED boot
72 call PLED_ClearScreen ; clean up OLED
73
74 WIN_COLOR color_white
75
76 DISPLAYTEXT .133
77 DISPLAYTEXT .134
78 DISPLAYTEXT .135
79 DISPLAYTEXT .136 ; Display Debug intro
80
81 WIN_TOP .100
82 WIN_LEFT .10
83 WIN_FONT FT_SMALL
84 WIN_INVERT .0 ; Init new Wordprocessor
85 WIN_COLOR color_white
86 lfsr FSR2,letter
87 movf debug_char+0,W
88 movwf POSTINC2
89 movf debug_char+1,W
90 movwf POSTINC2
91 movf debug_char+2,W
92 movwf POSTINC2
93 movf debug_char+3,W
94 movwf POSTINC2
95 movf debug_char+4,W
96 movwf POSTINC2
97 movf debug_char+5,W
98 movwf POSTINC2
99 movlw '.'
100 movwf POSTINC2
101 movlw ' '
102 movwf POSTINC2
103 movff flag1,lo
104 output_8
105 movlw ' '
106 movwf POSTINC2
107 movff flag2,lo
108 output_8
109 call word_processor
110
111 WIN_TOP .125
112 WIN_LEFT .10
113 WIN_FONT FT_SMALL
114 WIN_INVERT .0 ; Init new Wordprocessor
115 WIN_COLOR color_white
116
117 lfsr FSR2,letter
118 movff flag3,lo
119 output_8
120 movlw ' '
121 movwf POSTINC2
122 movff flag4,lo
123 output_8
124 movlw ' '
125 movwf POSTINC2
126 movff flag5,lo
127 output_8
128 movlw ' '
129 movwf POSTINC2
130 movff flag6,lo
131 output_8
132 movlw ' '
133 movwf POSTINC2
134 movff flag7,lo
135 output_8
136 call word_processor
137
138 WIN_TOP .150
139 WIN_LEFT .10
140 WIN_FONT FT_SMALL
141 WIN_INVERT .0 ; Init new Wordprocessor
142 WIN_COLOR color_white
143
144 lfsr FSR2,letter
145 movff flag8,lo
146 output_8
147 movlw ' '
148 movwf POSTINC2
149 movff flag9,lo
150 output_8
151 movlw ' '
152 movwf POSTINC2
153 movff flag10,lo
154 output_8
155 movlw ' '
156 movwf POSTINC2
157 movff flag11,lo
158 output_8
159 movlw ' '
160 movwf POSTINC2
161 movff flag12,lo
162 output_8
163 call word_processor
164
165 PLED_resetdebugger_loop:
166 btfss switch_left
167 bra PLED_resetdebugger_loop ; Loop
168 call clear_LEDy
169 return
170
171 PLED_divemode_mask: ; Displays mask in Dive-Mode
172 WIN_COLOR color_red
173 DISPLAYTEXTH .267 ; Max Depth
174 DISPLAYTEXT .86 ; Divetime
175 DISPLAYTEXT .87 ; Depth
176 WIN_COLOR color_white
177 return
178
179 PLED_clear_decoarea:
180 movlw .0
181 movff WREG,box_temp+0 ; Data
182 movlw .60
183 movff WREG,box_temp+1 ; row top (0-239)
184 movlw .239
185 movff WREG,box_temp+2 ; row bottom (0-239)
186 movlw .090
187 movff WREG,box_temp+3 ; column left (0-159)
188 movlw .159
189 movff WREG,box_temp+4 ; column right (0-159)
190 call PLED_box
191 call PLED_temp_divemode ; redraw temperature
192 call PLED_active_gas_divemode ; redraw active Gas
193 return
194
195 PLED_display_ndl_mask:
196 ; Clear Dekostop and Dekosum
197 rcall PLED_clear_decoarea
198
199 WIN_COLOR color_red
200 DISPLAYTEXT d'84' ; NoStop
201 WIN_COLOR color_white
202
203 PLED_display_ndl_mask2:
204 ; Clears Gradient Factor
205 movlw d'8'
206 movwf temp1
207 WIN_TOP .145
208 WIN_LEFT .0
209 call PLED_display_clear_common_y1
210 return
211
212 PLED_display_ndl:
213 btfsc multi_gf_display ; Is the Multi-GF Table displayed?
214 return ; Yes, No update and return!
215
216 ostc_debug 'z' ; Sends debug-information to screen if debugmode active
217
218 WIN_TOP .185
219 WIN_LEFT .119
220 WIN_FONT FT_MEDIUM
221 WIN_INVERT .0 ; Init new Wordprocessor
222 WIN_COLOR color_white
223 lfsr FSR2,letter
224 movff char_O_nullzeit,lo ; NDL in minutes
225 output_8
226 movlw 0x27 ; "'"
227 movwf POSTINC2
228 call word_processor
229 WIN_FONT FT_SMALL
230 return
231
232 PLED_display_deko_mask:
233 rcall PLED_clear_decoarea
234 ; total deco time word
235 WIN_COLOR color_red
236 DISPLAYTEXT d'85' ; DECOSUM
237 WIN_COLOR color_white
238 return
239
240 PLED_display_deko:
241 btfsc multi_gf_display ; Is the Multi-GF Table displayed?
242 return ; Yes, No update and return!
243
244 btfsc menubit ; Divemode menu active?
245 bra PLED_display_deko1 ; Yes, do not display dekostop
246
247 ostc_debug 'y' ; Sends debug-information to screen if debugmode active
248 ; deco stop word
249 WIN_COLOR color_red
250 DISPLAYTEXT d'82' ; DEKOSTOP
251 WIN_COLOR color_white
252
253 WIN_TOP .118
254 WIN_LEFT .94
255 WIN_FONT FT_MEDIUM
256 WIN_INVERT .0 ; Init new Wordprocessor
257 WIN_COLOR color_white
258 lfsr FSR2,letter
259 movff char_O_array_decodepth+0,lo ; Ceiling in m
260 output_99
261 movlw 'm' ; "m"
262 movwf POSTINC2
263 movff char_O_array_decotime,lo ; length of first stop in m
264 output_99
265 movlw 0x27 ; "'"
266 movwf POSTINC2
267 call word_processor
268 WIN_FONT FT_SMALL
269
270 PLED_display_deko1:
271 btfsc multi_gf_display ; Is the Multi-GF Table displayed?
272 return ; Yes, No update and return!
273
274 ostc_debug 'x' ; Sends debug-information to screen if debugmode active
275
276 WIN_TOP .185
277 WIN_LEFT .119
278 WIN_FONT FT_MEDIUM
279 WIN_INVERT .0 ; Init new Wordprocessor
280 WIN_COLOR color_white
281 lfsr FSR2,letter
282 movff char_O_ascenttime,lo ; complete ascend time
283 movlw d'199' ; limit display of total ascend time to 99mins....
284 cpfslt lo ; skip if 199 (WREG) > lo
285 movwf lo
286 bcf leftbind
287 output_8
288 movlw 0x27 ; "'"
289 movwf POSTINC2
290 call word_processor
291
292 movff char_O_gradient_factor,lo ; gradient factor
293 GETCUSTOM8 d'8' ; threshold for display
294 cpfslt lo ; show value?
295 bra PLED_display_deko2 ; Yes
296 ; No
297 bra PLED_display_ndl_mask2 ; Clear gradient factor
298
299 PLED_display_deko2:
300 ostc_debug 'w' ; Sends debug-information to screen if debugmode active
301 ;GF
302 WIN_TOP .145
303 WIN_LEFT .0
304 WIN_FONT FT_SMALL
305 WIN_COLOR color_white
306 lfsr FSR2,letter
307 movlw 'G'
308 movwf POSTINC2
309 movlw 'F'
310 movwf POSTINC2
311 movlw ':'
312 movwf POSTINC2
313 movff char_O_gradient_factor,lo ; gradient factor
314 output_8
315 movlw '%'
316 movwf POSTINC2
317 movlw ' '
318 movwf POSTINC2
319 call word_processor
320 return
321
322 PLED_simulator_data:
323 WIN_TOP .65
324 WIN_LEFT .105
325 WIN_FONT FT_SMALL
326 WIN_COLOR color_white
327 lfsr FSR2,letter
328 movff logbook_temp1,lo
329 bsf leftbind
330 output_8
331 bcf leftbind
332 movlw 'm'
333 movwf POSTINC2
334 movlw 'i'
335 movwf POSTINC2
336 movlw 'n'
337 movwf POSTINC2
338 movlw ' '
339 movwf POSTINC2
340 call word_processor
341
342 WIN_TOP .95
343 WIN_LEFT .100
344 WIN_FONT FT_SMALL
345 WIN_COLOR color_white
346 lfsr FSR2,letter
347 movff logbook_temp2,lo
348 bsf leftbind
349 output_8
350 bcf leftbind
351 movlw 'm'
352 movwf POSTINC2
353 movlw ' '
354 movwf POSTINC2
355 call word_processor
356 return
357
358 PLED_display_velocity:
359 btfsc multi_gf_display ; Is the Multi-GF Table displayed?
360 return ; Yes, No update and return!
361
362 ostc_debug 'v' ; Sends debug-information to screen if debugmode active
363 WIN_TOP .90
364 WIN_LEFT .0
365 WIN_FONT FT_SMALL
366 WIN_COLOR color_white
367 lfsr FSR2,letter
368 movlw '-'
369 btfsc neg_flag
370 movlw '+'
371 movwf POSTINC2
372 movff divA+0,lo
373 output_99
374 OUTPUTTEXT d'83' ; m/min
375 call word_processor
376 bsf pled_velocity_display
377 return
378
379 PLED_display_velocity_clear:
380 movlw d'8'
381 movwf temp1
382 WIN_TOP .90
383 WIN_LEFT .0
384 bcf pled_velocity_display
385 bra PLED_display_clear_common_y1
386
387 PLED_display_wait_clear
388 movlw d'6'
389 movwf temp1
390 WIN_TOP .2
391 WIN_LEFT .115
392 bra PLED_display_clear_common_y1
393
394 PLED_display_clear_common_y2: ; Clears with y-scale=2
395 WIN_FONT FT_MEDIUM
396 bra PLED_display_clear_common1
397
398 PLED_display_clear_common_y1: ; Clears with y-scale=1
399 WIN_FONT FT_SMALL
400 PLED_display_clear_common1:
401 lfsr FSR2,letter
402 PLED_display_clear_common2:
403 movlw ' '
404 movwf POSTINC2
405 decfsz temp1,F
406 bra PLED_display_clear_common2
407 call word_processor
408 WIN_FONT FT_SMALL
409 return
410
411 PLED_clock:
412 ostc_debug 'c'
413
414 ;If > 0 display surface_interval:2 and clock changing every 5 seconds
415 ;use timeout_counter for this
416 WIN_TOP .50
417 WIN_LEFT .0
418 WIN_FONT FT_SMALL
419 WIN_INVERT .0 ; Init new Wordprocessor
420 WIN_COLOR color_white
421 lfsr FSR2,letter
422
423 movff surface_interval+0,lo
424 tstfsz lo
425 bra PLED_clock0 ; Not Zero, switch between Interval and clock
426 movff surface_interval+1,lo
427 tstfsz lo
428 bra PLED_clock0 ; Not Zero, switch between Interval and clock
429 bra PLED_clock3 ; surface_interval=0, always display clock!
430
431 PLED_clock0:
432 btfss show_interval ; Show Interval?
433 bra PLED_clock2 ; No, display clock and reset counter
434
435 PLED_clock1:
436 decfsz timeout_counter,F ; =0?
437 bra PLED_clock1a ; No...
438 bra PLED_clock3 ; Yes, display clock and reset counter
439
440 PLED_clock1a:
441 bsf show_interval
442 movlw d'6'
443 cpfslt timeout_counter ; f < w? -> timeout_counter>5?
444 rcall PLED_clock_reload_timer ; No, reload counter
445
446 movff surface_interval+0,lo
447 movff surface_interval+1,hi
448 call convert_time ; lo=mins, hi=hours
449
450 movf hi,W
451 movff lo,hi
452 movwf lo ; exchange lo and hi
453
454 movlw 'I'
455 movwf POSTINC2
456 movlw 'n'
457 movwf POSTINC2
458 movlw 't'
459 movwf POSTINC2
460 movlw ':'
461 movwf POSTINC2
462 output_99x
463 movlw ':'
464 movwf POSTINC2
465 movff hi,lo
466 output_99x
467 movlw ' '
468 movwf POSTINC2
469 call word_processor
470 return
471
472 PLED_clock_reload_timer:
473 bcf show_interval
474 movlw d'5'
475 movwf timeout_counter
476 return
477
478 PLED_interval_reload_timer:
479 bsf show_interval
480 movlw d'5'
481 movwf timeout_counter
482 return
483
484 PLED_clock2:
485 decfsz timeout_counter,F ; =0?
486 bra PLED_clock3 ; No...
487 bra PLED_clock1a ; Yes, display interval and reset counter
488
489 PLED_clock3:
490 bcf show_interval
491 movlw d'6'
492 cpfslt timeout_counter ; f < w? -> timeout_counter>5?
493 rcall PLED_interval_reload_timer; No, reload counter
494
495 movff hours,lo
496 output_99x
497 movlw ':'
498 movwf POSTINC2
499 movff mins,lo
500 output_99x
501 movlw ':'
502 movwf POSTINC2
503 movff secs,lo
504 output_99x
505 movlw ' '
506 movwf POSTINC2
507 call word_processor
508 return
509
510 PLED_logbook_cursor:
511
512 PLED_menu_cursor:
513 WIN_TOP .35
514 WIN_LEFT .0
515 WIN_FONT FT_SMALL
516 WIN_INVERT .0 ; Init new Wordprocessor
517 WIN_COLOR color_white
518 lfsr FSR2,letter
519 movlw 0xB8
520 movwf POSTINC2
521 call word_processor
522
523 WIN_TOP .65
524 WIN_LEFT .0
525 WIN_FONT FT_SMALL
526 WIN_INVERT .0 ; Init new Wordprocessor
527 WIN_COLOR color_white
528 lfsr FSR2,letter
529 movlw 0xB8
530 movwf POSTINC2
531 call word_processor
532
533 WIN_TOP .95
534 WIN_LEFT .0
535 WIN_FONT FT_SMALL
536 WIN_INVERT .0 ; Init new Wordprocessor
537 WIN_COLOR color_white
538 lfsr FSR2,letter
539 movlw 0xB8
540 movwf POSTINC2
541 call word_processor
542
543 WIN_TOP .125
544 WIN_LEFT .0
545 WIN_FONT FT_SMALL
546 WIN_INVERT .0 ; Init new Wordprocessor
547 WIN_COLOR color_white
548 lfsr FSR2,letter
549 movlw 0xB8
550 movwf POSTINC2
551 call word_processor
552
553 WIN_TOP .155
554 WIN_LEFT .0
555 WIN_FONT FT_SMALL
556 WIN_INVERT .0 ; Init new Wordprocessor
557 WIN_COLOR color_white
558 lfsr FSR2,letter
559 movlw 0xB8
560 movwf POSTINC2
561 call word_processor
562
563 WIN_TOP .185
564 WIN_LEFT .0
565 WIN_FONT FT_SMALL
566 WIN_INVERT .0 ; Init new Wordprocessor
567 WIN_COLOR color_white
568 lfsr FSR2,letter
569 movlw 0xB8
570 movwf POSTINC2
571 call word_processor
572
573 movff menupos,temp1
574 dcfsnz temp1,F
575 movlw d'35'
576 dcfsnz temp1,F
577 movlw d'65'
578 dcfsnz temp1,F
579 movlw d'95'
580 dcfsnz temp1,F
581 movlw d'125'
582 dcfsnz temp1,F
583 movlw d'155'
584 dcfsnz temp1,F
585 movlw d'185'
586
587 movff WREG,win_top
588 WIN_LEFT .0
589 WIN_FONT FT_SMALL
590 WIN_INVERT .0 ; Init new Wordprocessor
591 WIN_COLOR color_white
592 lfsr FSR2,letter
593 movlw 0xB7
594 movwf POSTINC2
595 call word_processor
596 return
597
598 PLED_menu_mask:
599 call PLED_topline_box
600 WIN_INVERT .1 ; Init new Wordprocessor
601 DISPLAYTEXT .5 ; Menu:
602 WIN_INVERT .0 ; Init new Wordprocessor
603 DISPLAYTEXT .6 ; Logbook
604 DISPLAYTEXT .7 ; Gas Setup
605 DISPLAYTEXT .9 ; Reset all
606 DISPLAYTEXT .10 ; Setup...
607 DISPLAYTEXT .142 ; More...
608 DISPLAYTEXT .11 ; Exit
609 return
610
611 PLED_setup_menu_mask:
612 call PLED_topline_box
613 WIN_INVERT .1 ; Init new Wordprocessor
614 DISPLAYTEXT .98 ; Setup Menu:
615 WIN_INVERT .0 ; Init new Wordprocessor
616 DISPLAYTEXT .99 ; Custom FunctionsI
617 DISPLAYTEXT .153 ; Custom FunctionsII
618 DISPLAYTEXTH .276 ; Salinity:
619 DISPLAYTEXT .100 ; Decotype:
620 DISPLAYTEXT .142 ; More...
621 DISPLAYTEXT .11 ; Exit
622 return
623
624 PLED_more_setup_menu_mask:
625 call PLED_topline_box
626 WIN_INVERT .1 ; Init new Wordprocessor
627 DISPLAYTEXTH .258 ; Setup Menu 2:
628 WIN_INVERT .0 ; Init new Wordprocessor
629 DISPLAYTEXTH .257 ; Date format:
630 DISPLAYTEXT .129 ; Debug:
631
632
633 DISPLAYTEXT .11 ; Exit
634 return
635
636 PLED_more_menu_mask:
637 call PLED_topline_box
638 WIN_INVERT .1 ; Init new Wordprocessor
639 DISPLAYTEXT .144 ; Menu 2:
640 WIN_INVERT .0 ; Init new Wordprocessor
641 DISPLAYTEXT .8 ; Set Time
642 DISPLAYTEXT .110 ; Const. ppO2 Setup
643 DISPLAYTEXT .113 ; Battery Info
644 DISPLAYTEXT .247 ; Simulator
645
646 DISPLAYTEXT .11 ; Exit
647 return
648
649 PLED_reset_menu_mask:
650 call PLED_topline_box
651 WIN_INVERT .1 ; Init new Wordprocessor
652 DISPLAYTEXT .28 ; Reset Menu
653 WIN_INVERT .0 ; Init new Wordprocessor
654 DISPLAYTEXT .21 ; Cancel Reset
655 DISPLAYTEXT .245 ; Reset CF,Gases & Deco
656 DISPLAYTEXTH .284 ; Reset Logbook
657 DISPLAYTEXTH .285 ; Reboot OSTC
658 DISPLAYTEXTH .286 ; Reset Decodata
659 DISPLAYTEXT .11 ; Exit
660 return
661
662 PLED_simulator_mask:
663 call PLED_topline_box
664 WIN_INVERT .1 ; Init new Wordprocessor
665 DISPLAYTEXT .248 ; OSTC Simulator
666 WIN_INVERT .0 ; Init new Wordprocessor
667 DISPLAYTEXT .249 ; Start Dive
668 DISPLAYTEXTH .277 ; Bottom Time:
669 DISPLAYTEXTH .278 ; Max. Depth:
670 DISPLAYTEXTH .279 ; Calculate Deco
671 DISPLAYTEXTH .280 ; Show Decoplan
672 DISPLAYTEXT .11 ; Exit
673 return
674
675
676
677
678 PLED_temp_surfmode:
679 ostc_debug 'e'
680 movff temperature+0,last_temperature+0
681 movff temperature+1,last_temperature+1
682 WIN_TOP .100
683 WIN_LEFT .0
684 WIN_FONT FT_SMALL
685 WIN_INVERT .0 ; Init new Wordprocessor
686 WIN_COLOR color_white
687 lfsr FSR2,letter
688 movlw '-'
689 btfsc neg_temp ; Show "-"?
690 movwf POSTINC2 ; Yes
691 movff temperature+0,lo
692 movff temperature+1,hi
693 movlw d'3'
694 movwf ignore_digits
695 bsf leftbind ; left orientated output
696 output_16dp d'2'
697 bcf leftbind
698 movlw '°'
699 movwf POSTINC2
700 movlw 'C'
701 movwf POSTINC2
702 movlw ' '
703 movwf POSTINC2
704 call word_processor
705 return
706
707 PLED_temp_divemode:
708 btfsc multi_gf_display ; Is the Multi-GF Table displayed?
709 return ; Yes, No update and return!
710
711 ostc_debug 'u' ; Sends debug-information to screen if debugmode active
712
713 ; temperature
714 movff temperature+0,last_temperature+0
715 movff temperature+1,last_temperature+1
716
717 WIN_TOP .216
718 WIN_LEFT .65
719 WIN_FONT FT_SMALL
720 WIN_INVERT .0 ; Init new Wordprocessor
721 WIN_COLOR color_white
722 lfsr FSR2,letter
723 movlw '-'
724 btfsc neg_temp ; Show "-"?
725 movwf POSTINC2 ; Yes
726 movff temperature+0,lo
727 movff temperature+1,hi
728 movlw d'3'
729 movwf ignore_digits
730 bsf leftbind ; left orientated output
731 output_16dp d'2'
732 bcf leftbind
733 movlw '°'
734 movwf POSTINC2
735 movlw ' '
736 movwf POSTINC2
737 call word_processor
738 return
739
740 PLED_show_ppO2: ; Show ppO2
741 ostc_debug 't' ; Sends debug-information to screen if debugmode active
742 WIN_TOP .120
743 WIN_LEFT .0
744 WIN_FONT FT_SMALL
745 WIN_COLOR color_white
746 lfsr FSR2,letter
747 movlw 'p'
748 movwf POSTINC2
749 movlw 'p'
750 movwf POSTINC2
751 movlw 'O'
752 movwf POSTINC2
753 movlw '2'
754 movwf POSTINC2
755 movlw ':'
756 movwf POSTINC2
757 movff xC+0,lo
758 movff xC+1,hi
759 bsf ignore_digit4
760 output_16dp d'1'
761 bcf ignore_digit4
762 movlw ' '
763 movwf POSTINC2
764 call word_processor
765 return
766
767 PLED_show_ppO2_clear: ; Clear ppO2
768 movlw d'10'
769 movwf temp1
770 WIN_TOP .120
771 WIN_LEFT .0
772 call PLED_display_clear_common_y1
773 return
774
775 PLED_active_gas_clear: ; clears active gas!
776 WIN_TOP .192
777 WIN_LEFT .65
778 movlw d'5'
779 movwf temp1
780 bra PLED_display_clear_common_y1; also returns!
781
782 PLED_active_gas_divemode: ; Displays current gas (e.g. 40/20) if a) He>0 or b) O2>Custom9
783 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode
784 return
785
786 btfsc multi_gf_display ; Is the Multi-GF Table displayed?
787 return ; Yes, No update and return!
788
789 ostc_debug 's' ; Sends debug-information to screen if debugmode active
790 ; gas
791 WIN_TOP .192
792 WIN_LEFT .65
793 WIN_FONT FT_SMALL
794 WIN_INVERT .0 ; Init new Wordprocessor
795 WIN_COLOR color_white
796
797 movlw d'100' ; 100% in the tank
798 movff char_I_N2_ratio,lo ; minus N2
799 bsf STATUS,C ; set borrow bit
800 subfwb lo,W
801 movff char_I_He_ratio,lo ; minus He
802 bsf STATUS,C ; set borrow bit
803 subfwb lo,F ; =% O2
804 GETCUSTOM8 d'9' ; get oxygen treshold
805 movff char_I_He_ratio,hi ; He ratio
806 cpfsgt lo
807 bra PLED_active_gas_divemode2 ; Check He
808 bra PLED_active_gas_divemode3 ; Skip He check, display gas
809
810 PLED_active_gas_divemode2:
811 tstfsz hi ; He = 0 %
812 bra PLED_active_gas_divemode3 ; display gas
813 ; O2 below treshold, He=0 -> Skip display!
814 movlw d'5'
815 movwf temp1
816 bra PLED_display_clear_common_y1 ; also returns!
817
818 PLED_active_gas_divemode3:
819 movlw d'21'
820 cpfseq lo ; Air? (O2=21%)
821 bra PLED_active_gas_divemode4 ; No!
822 tstfsz hi ; Air? (He=0%)
823 bra PLED_active_gas_divemode4 ; No!
824
825 ; Yes, display "Air" instead of 21/0
826 lfsr FSR2,letter
827 OUTPUTTEXTH d'264' ;"Air "
828 call word_processor
829 return
830
831 PLED_active_gas_divemode4:
832 lfsr FSR2,letter
833 bsf leftbind ; left orientated output
834 output_8 ; O2 ratio is still in "lo"
835 movlw '/'
836 movwf POSTINC2
837 movff char_I_He_ratio,lo ; copy He ratio into lo
838 output_8
839 movlw ' '
840 movwf POSTINC2
841 bcf leftbind
842 call word_processor
843 return
844
845 PLED_display_decotype_surface:
846 WIN_LEFT .85
847 WIN_FONT FT_SMALL
848 WIN_INVERT .0 ; Init new Wordprocessor
849 clrf EEADRH
850 read_int_eeprom d'34' ; Read deco data
851 tstfsz EEDATA
852 bra show_decotype_surface2
853
854 ;ZH-L16
855 WIN_TOP .125
856 WIN_COLOR color_white
857 lfsr FSR2,letter
858 movlw 'O'
859 movwf POSTINC2
860 call word_processor
861 WIN_LEFT .85
862 WIN_FONT FT_SMALL
863 WIN_INVERT .0 ; Init new Wordprocessor
864 WIN_TOP .150
865 WIN_COLOR color_white
866 lfsr FSR2,letter
867 movlw 'C'
868 movwf POSTINC2
869 call word_processor
870 return
871 show_decotype_surface2:
872 decf EEDATA,F
873 tstfsz EEDATA
874 bra show_decotype_surface3
875 ; Gauge
876 return
877
878 show_decotype_surface3:
879 decf EEDATA,F
880 tstfsz EEDATA
881 bra show_decotype_surface4
882 ; const. ppO2
883 WIN_TOP .125
884 WIN_COLOR color_white
885 lfsr FSR2,letter
886 movlw 'C'
887 movwf POSTINC2
888 WIN_LEFT .85
889 WIN_FONT FT_SMALL
890 WIN_INVERT .0 ; Init new Wordprocessor
891 call word_processor
892 WIN_TOP .150
893 WIN_COLOR color_white
894 lfsr FSR2,letter
895 movlw 'C'
896 movwf POSTINC2
897 WIN_LEFT .85
898 WIN_FONT FT_SMALL
899 WIN_INVERT .0 ; Init new Wordprocessor
900 call word_processor
901 return
902 show_decotype_surface4:
903 decf EEDATA,F
904 tstfsz EEDATA
905 bra show_decotype_surface5
906 ; Apnoe
907 return
908 show_decotype_surface5:
909 decf EEDATA,F
910 tstfsz EEDATA
911 bra show_decotype_surface6
912 ; Multi-GF OC
913 WIN_TOP .125
914 lfsr FSR2,letter
915 movlw 'G'
916 movwf POSTINC2
917 WIN_LEFT .85
918 WIN_FONT FT_SMALL
919 WIN_INVERT .0 ; Init new Wordprocessor
920 WIN_COLOR color_white
921 call word_processor
922 WIN_TOP .150
923 lfsr FSR2,letter
924 movlw 'F'
925 movwf POSTINC2
926 WIN_LEFT .85
927 WIN_FONT FT_SMALL
928 WIN_INVERT .0 ; Init new Wordprocessor
929 WIN_COLOR color_white
930 call word_processor
931 return
932
933 show_decotype_surface6:
934 ; Multi-GF CC
935 WIN_TOP .125
936 lfsr FSR2,letter
937 movlw 'G'
938 movwf POSTINC2
939 WIN_LEFT .85
940 WIN_FONT FT_SMALL
941 WIN_INVERT .0 ; Init new Wordprocessor
942 WIN_COLOR color_white
943 call word_processor
944 WIN_TOP .150
945 lfsr FSR2,letter
946 movlw 'F'
947 movwf POSTINC2
948 WIN_LEFT .85
949 WIN_FONT FT_SMALL
950 WIN_INVERT .0 ; Init new Wordprocessor
951 WIN_COLOR color_white
952 call word_processor
953 return
954
955
956 PLED_active_gas_surfmode: ; Displays start gas/SP 1
957 ostc_debug 'q' ; Sends debug-information to screen if debugmode active
958
959 btfsc FLAG_apnoe_mode ; In Apnoe mode?
960 return ; Yes, return
961
962 btfsc gauge_mode ; In Gauge mode?
963 return ; Yes, return
964
965 btfss FLAG_const_ppO2_mode ; are we in const. ppO2 mode?
966 bra PLED_active_gas_surfmode2 ; No, display gases
967
968 ; In CC Mode
969 WIN_TOP .135
970 WIN_LEFT .90
971 WIN_FONT FT_SMALL
972 WIN_INVERT .0 ; Init new Wordprocessor
973 WIN_COLOR color_white
974 lfsr FSR2,letter
975 read_int_eeprom d'36'
976 movff EEDATA,lo ; copy to lo
977 clrf hi
978 output_16dp d'3' ; outputs into Postinc2!
979 movlw 'B'
980 movwf POSTINC2
981 movlw 'a'
982 movwf POSTINC2
983 movlw 'r'
984 movwf POSTINC2
985 bcf leftbind
986 call word_processor
987 bra PLED_active_gas_surfmode_exit
988
989 PLED_active_gas_surfmode2:
990 WIN_TOP .130
991 WIN_LEFT .100
992 WIN_FONT FT_MEDIUM
993 WIN_INVERT .0 ; Init new Wordprocessor
994 WIN_COLOR color_white
995
996 read_int_eeprom d'33' ; Read byte (stored in EEDATA)
997 movff EEDATA,active_gas ; Read start gas (1-5)
998
999 decf active_gas,W ; Gas 0-4
1000 mullw d'4'
1001 movf PRODL,W
1002 addlw d'7' ; = address for He ratio
1003 movwf EEADR
1004 call read_eeprom ; Read He ratio
1005 movff EEDATA,char_I_He_ratio ; And copy into hold register
1006
1007 decf active_gas,W ; Gas 0-4
1008 mullw d'4'
1009 movf PRODL,W
1010 addlw d'6' ; = address for O2 ratio
1011 movwf EEADR
1012 call read_eeprom ; Read O2 ratio
1013 movff EEDATA, char_I_O2_ratio ; O2 ratio
1014 movff char_I_He_ratio, wait_temp ; copy into bank1 register
1015 bsf STATUS,C ; Borrow bit
1016 movlw d'100' ; 100%
1017 subfwb wait_temp,W ; minus He
1018 bsf STATUS,C ; Borrow bit
1019 subfwb EEDATA,F ; minus O2
1020 movff EEDATA, char_I_N2_ratio ; = N2!
1021
1022 movlw d'100' ; 100% in the tank
1023 movff char_I_N2_ratio,lo ; minus N2
1024 bsf STATUS,C ; set borrow bit
1025 subfwb lo,W
1026 movff char_I_He_ratio,lo ; minus He
1027 bsf STATUS,C ; set borrow bit
1028 subfwb lo,F ; =% O2
1029
1030 movff char_I_He_ratio,hi ; Copy into Bank1 register
1031
1032 movlw d'21'
1033 cpfseq lo ; Air? (O2=21%)
1034 bra PLED_active_gas_surfmode4 ; No!
1035 tstfsz hi ; Air? (He=0%)
1036 bra PLED_active_gas_surfmode4 ; No!
1037
1038 ; Yes, display "Air" instead of 21/0
1039 DISPLAYTEXTH d'265' ;"Air ", y-scale=2
1040 bra PLED_active_gas_surfmode_exit
1041
1042 PLED_active_gas_surfmode4:
1043 lfsr FSR2,letter
1044 bsf leftbind ; left orientated output
1045 output_8 ; O2 ratio is still in "lo"
1046 movlw '/'
1047 movwf POSTINC2
1048 movff char_I_He_ratio,lo ; copy He ratio into lo
1049 output_8
1050 bcf leftbind
1051 call word_processor
1052 bra PLED_active_gas_surfmode_exit
1053
1054 PLED_active_gas_surfmode_exit:
1055 movlw .0
1056 movff WREG,box_temp+0 ; Data
1057 movlw .122
1058 movff WREG,box_temp+1 ; row top (0-239)
1059 movlw .175
1060 movff WREG,box_temp+2 ; row bottom (0-239)
1061 movlw .82
1062 movff WREG,box_temp+3 ; column left (0-159)
1063 movlw .159
1064 movff WREG,box_temp+4 ; column right (0-159)
1065 call PLED_frame
1066 return
1067
1068 PLED_confirmbox:
1069 movlw .0
1070 movff WREG,box_temp+0 ; Data
1071 movlw .68
1072 movff WREG,box_temp+1 ; row top (0-239)
1073 movlw .146
1074 movff WREG,box_temp+2 ; row bottom (0-239)
1075 movlw .34
1076 movff WREG,box_temp+3 ; column left (0-159)
1077 movlw .101
1078 movff WREG,box_temp+4 ; column right (0-159)
1079 call PLED_box
1080
1081 movlw .255
1082 movff WREG,box_temp+0 ; Data
1083 movlw .70
1084 movff WREG,box_temp+1 ; row top (0-239)
1085 movlw .144
1086 movff WREG,box_temp+2 ; row bottom (0-239)
1087 movlw .35
1088 movff WREG,box_temp+3 ; column left (0-159)
1089 movlw .100
1090 movff WREG,box_temp+4 ; column right (0-159)
1091 call PLED_frame
1092 DISPLAYTEXT .143 ; Confirm:
1093 DISPLAYTEXT .145 ; Cancel
1094 DISPLAYTEXT .146 ; OK!
1095
1096 movlw d'1'
1097 movwf menupos
1098
1099 PLED_confirmbox2:
1100 movlw .0
1101 movff WREG,box_temp+0 ; Data
1102 movlw .96
1103 movff WREG,box_temp+1 ; row top (0-239)
1104 movlw .143
1105 movff WREG,box_temp+2 ; row bottom (0-239)
1106 movlw .39
1107 movff WREG,box_temp+3 ; column left (0-159)
1108 movlw .51
1109 movff WREG,box_temp+4 ; column right (0-159)
1110 call PLED_box
1111
1112 movff menupos,temp1
1113 movlw d'96'
1114 dcfsnz temp1,F
1115 movlw d'96'
1116 dcfsnz temp1,F
1117 movlw d'120'
1118 movff WREG,win_top
1119 WIN_LEFT .39
1120 WIN_FONT FT_SMALL
1121 WIN_INVERT .0 ; Init new Wordprocessor
1122 WIN_COLOR color_white
1123 lfsr FSR2,letter
1124 movlw 0xB7 ; Arrow for menu
1125 movwf POSTINC2
1126 call word_processor
1127
1128 bcf sleepmode ; clear some flags
1129 bcf menubit2
1130 bcf menubit3
1131 bcf switch_right
1132 bcf switch_left
1133 clrf timeout_counter2
1134 WAITMS d'100'
1135
1136 PLED_confirmbox_loop:
1137 call check_switches_logbook
1138
1139 btfsc menubit3 ; SET/MENU?
1140 bra PLED_confirmbox_move_cursor; Move Cursor
1141 btfsc menubit2 ; ENTER?
1142 bra PLED_confirmbox_menu_do ; Do task
1143
1144 btfsc onesecupdate
1145 call timeout_surfmode ; timeout
1146
1147 btfsc onesecupdate
1148 call set_dive_modes ; check, if divemode must be entered
1149 bcf onesecupdate ; one second update
1150
1151 btfsc sleepmode ; Timeout?
1152 bra PLED_confirmbox_cancel ; back with cancel
1153 btfsc divemode
1154 bra PLED_confirmbox_cancel ; back with cancel
1155
1156 bra PLED_confirmbox_loop ; wait for something to do
1157
1158 PLED_confirmbox_cancel:
1159 retlw .0
1160 PLED_confirmbox_ok:
1161 retlw .1
1162
1163 PLED_confirmbox_menu_do:
1164 dcfsnz menupos,F
1165 bra PLED_confirmbox_cancel
1166 dcfsnz menupos,F
1167 bra PLED_confirmbox_ok
1168 bra PLED_confirmbox_cancel
1169
1170 PLED_confirmbox_move_cursor:
1171 incf menupos,F
1172 movlw d'3' ; number of menu options+1
1173 cpfseq menupos ; =limit?
1174 bra PLED_confirmbox_move_cursor2 ; No!
1175 movlw d'1' ; Yes, reset to position 1!
1176 movwf menupos
1177 PLED_confirmbox_move_cursor2:
1178 bra PLED_confirmbox2 ; Return to Profile Menu, also updates cursor
1179
1180
1181 PLED_depth:
1182 ostc_debug 'r' ; Sends debug-information to screen if debugmode active
1183 movff rel_pressure+1,hi
1184 movff rel_pressure+0,lo
1185 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar]
1186
1187 movlw .039
1188 cpfslt hi
1189 bra depth_greater_99_84mtr
1190
1191 btfsc depth_greater_100m ; Was depth>100m during last call
1192 call PLED_clear_depth ; Yes, clear depth area
1193 bcf depth_greater_100m ; Do this once only...
1194
1195 lfsr FSR2,letter
1196
1197 movlw HIGH d'1000'
1198 movwf sub_a+1
1199 movlw LOW d'1000'
1200 movwf sub_a+0
1201 movff hi,sub_b+1
1202 movff lo,sub_b+0
1203 incf sub_b+0,F
1204 movlw d'0'
1205 addwfc sub_b+1,F ; Add 1mBar offset
1206 call sub16 ; sub_c = sub_a - sub_b
1207 btfss neg_flag ; Depth lower then 10m?
1208 rcall depth_less_10mtr ; Yes, add extra space
1209
1210 WIN_TOP .24
1211 WIN_LEFT .0
1212 WIN_FONT FT_LARGE
1213 WIN_INVERT .0 ; Init new Wordprocessor
1214 WIN_COLOR color_white
1215
1216 movlw HIGH d'99'
1217 movwf sub_a+1
1218 movlw LOW d'99'
1219 movwf sub_a+0
1220 movff hi,sub_b+1
1221 movff lo,sub_b+0
1222 call sub16 ; sub_c = sub_a - sub_b
1223 btfss neg_flag ; Depth lower then 1m?
1224 bra pled_depth2 ; Yes, display manual Zero
1225
1226 bsf leftbind
1227 bsf ignore_digit4
1228 output_16 ; Full meters in Big font
1229 bcf leftbind
1230 bra pled_depth3
1231
1232 pled_depth2:
1233 movlw '0'
1234 movwf POSTINC2
1235 pled_depth3:
1236 call word_processor
1237 bcf ignore_digit4
1238
1239 WIN_FONT FT_MEDIUM
1240 WIN_TOP .50
1241 WIN_LEFT .40
1242 WIN_COLOR color_white
1243
1244 movff rel_pressure+1,hi
1245 movff rel_pressure+0,lo
1246 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar]
1247 lfsr FSR2,letter
1248 movlw '.'
1249 movwf POSTINC2
1250
1251 movlw HIGH d'9'
1252 movwf sub_a+1
1253 movlw LOW d'9'
1254 movwf sub_a+0
1255 movff hi,sub_b+1
1256 movff lo,sub_b+0
1257 call sub16 ; sub_c = sub_a - sub_b
1258 btfss neg_flag ; Depth lower then 0.1m?
1259 bra pled_depth4 ; Yes, display manual Zero
1260
1261 movlw d'4'
1262 movwf ignore_digits
1263 bsf ignore_digit5
1264 output_16dp d'0'
1265 bra pled_depth5
1266
1267 pled_depth4:
1268 movlw '0'
1269 movwf POSTINC2
1270
1271 pled_depth5:
1272 call word_processor ; decimeters in medium font
1273 bcf ignore_digit5
1274 WIN_FONT FT_SMALL
1275 return
1276
1277 depth_greater_99_84mtr: ; Display only in full meters
1278 btfss depth_greater_100m ; Is depth>100m already?
1279 call PLED_clear_depth ; No, clear depth area and set flag
1280 ; Depth is already in hi:lo
1281 ; Show depth in Full meters
1282 ; That means ignore figure 4 and 5
1283 lfsr FSR2,letter
1284 WIN_TOP .24
1285 WIN_LEFT .0
1286 WIN_FONT FT_LARGE
1287 WIN_INVERT .0 ; Init new Wordprocessor
1288 WIN_COLOR color_white
1289 bsf ignore_digit4
1290 bsf leftbind
1291 output_16
1292 bcf leftbind
1293 call word_processor
1294 bcf ignore_digit4
1295 WIN_FONT FT_SMALL
1296 return
1297
1298 depth_less_10mtr:
1299 movlw ' '
1300 movwf POSTINC2
1301 return
1302
1303 PLED_clear_depth ; No, clear depth area and set flag
1304 movlw .0
1305 movff WREG,box_temp+0 ; Data
1306 movlw .24
1307 movff WREG,box_temp+1 ; row top (0-239)
1308 movlw .90
1309 movff WREG,box_temp+2 ; row bottom (0-239)
1310 movlw .0
1311 movff WREG,box_temp+3 ; column left (0-159)
1312 movlw .90
1313 movff WREG,box_temp+4 ; column right (0-159)
1314 call PLED_box
1315 bsf depth_greater_100m ; Set Flag
1316 return
1317
1318
1319 PLED_desaturation_time:
1320 ostc_debug 'h'
1321 WIN_TOP .150
1322 WIN_LEFT .0
1323 WIN_FONT FT_SMALL
1324 WIN_INVERT .0 ; Init new Wordprocessor
1325 WIN_COLOR color_white
1326 lfsr FSR2,letter
1327 OUTPUTTEXT d'14' ; Desat
1328 movlw ' '
1329 movwf POSTINC2
1330 movff int_O_desaturation_time+0,lo ; divide by 60...
1331 movff int_O_desaturation_time+1,hi
1332 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo)
1333 bsf leftbind
1334 movf lo,W
1335 movff hi,lo
1336 movwf hi ; exchange lo and hi...
1337 output_8 ; Hours
1338 movlw ':'
1339 movwf POSTINC2
1340 movff hi,lo ; Minutes
1341 output_99x
1342 bcf leftbind
1343 call word_processor
1344 return
1345
1346 PLED_nofly_time:
1347 ostc_debug 'g'
1348 WIN_TOP .125
1349 WIN_LEFT .0
1350 WIN_FONT FT_SMALL
1351 WIN_INVERT .0 ; Init new Wordprocessor
1352 WIN_COLOR color_white
1353 lfsr FSR2,letter
1354 OUTPUTTEXT d'35' ; NoFly
1355 movlw ' '
1356 movwf POSTINC2
1357 movff nofly_time+0,lo ; divide by 60...
1358 movff nofly_time+1,hi
1359 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo)
1360 bsf leftbind
1361 movf lo,W
1362 movff hi,lo
1363 movwf hi ; exchange lo and hi...
1364 output_8 ; Hours
1365 movlw ':'
1366 movwf POSTINC2
1367 movff hi,lo ; Minutes
1368 decf lo,F
1369 btfsc lo,7 ; keep Nofly time
1370 clrf lo
1371 output_99x
1372 bcf leftbind
1373 call word_processor
1374 return
1375
1376
1377 update_surf_press:
1378 btfsc premenu ; Do not update when "Menu?" is displayed!
1379 return
1380
1381 ostc_debug 'b' ; Sends debug-information to screen if debugmode active
1382 WIN_TOP .25
1383 WIN_LEFT .0
1384 WIN_FONT FT_SMALL
1385 WIN_INVERT .0 ; Init new Wordprocessor
1386 WIN_COLOR color_white
1387 lfsr FSR2,letter
1388 movff amb_pressure+0,lo
1389 movff amb_pressure+1,hi
1390 bsf leftbind
1391 output_16
1392 bcf leftbind
1393 movlw 'm'
1394 movwf POSTINC2
1395 movlw 'b'
1396 movwf POSTINC2
1397 movlw 'a'
1398 movwf POSTINC2
1399 movlw 'r'
1400 movwf POSTINC2
1401 movlw ' '
1402 movwf POSTINC2
1403 call word_processor
1404 return
1405
1406 update_batt_voltage_divemode:
1407
1408 update_batt_voltage:
1409 ostc_debug 'f'
1410
1411 GETCUSTOM8 d'31' ; =1 if battery voltage should be visible
1412 movwf lo
1413 movlw d'1'
1414 cpfseq lo ; =1?
1415 bra update_batt_voltage2 ; No, show symbol
1416
1417 WIN_TOP .175
1418 WIN_LEFT .0
1419 WIN_FONT FT_SMALL
1420 WIN_INVERT .0 ; Init new Wordprocessor
1421 WIN_COLOR color_white
1422 lfsr FSR2,letter
1423 movff batt_voltage+0,lo
1424 movff batt_voltage+1,hi
1425 movlw d'1'
1426 movwf ignore_digits
1427 bsf ignore_digit5 ; do not display mV
1428 bsf leftbind
1429 output_16dp d'2' ; e.g. 3.45V
1430 bcf leftbind
1431 movlw 'V'
1432 movwf POSTINC2
1433 movlw ' '
1434 movwf POSTINC2
1435 call word_processor
1436 return
1437
1438 update_batt_voltage2:
1439 movlw .255
1440 movff WREG,box_temp+0 ; Data
1441 movlw .174
1442 movff WREG,box_temp+1 ; row top (0-239)
1443 movlw .194
1444 movff WREG,box_temp+2 ; row bottom (0-239)
1445 movlw .0
1446 movff WREG,box_temp+3 ; column left (0-159)
1447 movlw .31
1448 movff WREG,box_temp+4 ; column right (0-159)
1449 call PLED_frame
1450
1451 ; 3600-Vbatt
1452 movlw LOW d'3600'
1453 movwf sub_a+0
1454 movlw HIGH d'3600'
1455 movwf sub_a+1
1456 movff batt_voltage+0,sub_b+0
1457 movff batt_voltage+1,sub_b+1
1458 call sub16 ; sub_c = sub_a - sub_b
1459 ; Battery full (>3600mV?
1460 btfsc neg_flag
1461 bra update_batt_voltage2_full
1462
1463 ; Vbatt-3000
1464 movlw LOW d'3000'
1465 movwf sub_b+0
1466 movlw HIGH d'3000'
1467 movwf sub_b+1
1468 movff batt_voltage+0,sub_a+0
1469 movff batt_voltage+1,sub_a+1
1470 call sub16 ; sub_c = sub_a - sub_b
1471 ; Battery lower then 3000mV?
1472 btfsc neg_flag
1473 bra update_batt_voltage2_empty
1474
1475 ; Battery is between 3000 and 3600mV
1476 ; sub_c:2 is between 0 and 600
1477 movff sub_c+0,xA+0
1478 movff sub_c+1,xA+1
1479 movlw d'20'
1480 movwf xB+0
1481 clrf xB+1
1482 call div16x16 ;xA/xB=xC with xA as remainder
1483 ; xC is between 0 and 30
1484 movff xC+0,wait_temp ;save value
1485
1486 movlw d'2'
1487 cpfsgt wait_temp
1488 movwf wait_temp ; Minimum = 2
1489
1490
1491 update_batt_voltage2a:
1492 movlw .255
1493 movff WREG,box_temp+0 ; Data
1494 movlw .181
1495 movff WREG,box_temp+1 ; row top (0-239)
1496 movlw .187
1497 movff WREG,box_temp+2 ; row bottom (0-239)
1498 movlw .31
1499 movff WREG,box_temp+3 ; column left (0-159)
1500 movlw .33
1501 movff WREG,box_temp+4 ; column right (0-159)
1502 call PLED_frame ; Empty cap
1503
1504 update_batt_voltage3:
1505 GETCUSTOM8 d'34' ; Color battery
1506 movff WREG,box_temp+0 ; Color Data
1507 movlw .175
1508 movff WREG,box_temp+1 ; row top (0-239)
1509 movlw .193
1510 movff WREG,box_temp+2 ; row bottom (0-239)
1511 movlw .1
1512 movff WREG,box_temp+3 ; column left (0-159)
1513 movff wait_temp,box_temp+4 ; column right (0-159)
1514 call PLED_box
1515
1516 WIN_COLOR color_white ; Reset Color
1517 return
1518
1519 update_batt_voltage2_empty:
1520 movlw d'1'
1521 movwf wait_temp
1522 bra update_batt_voltage2a
1523
1524 update_batt_voltage2_full:
1525 movlw d'30'
1526 movwf wait_temp
1527
1528 movlw .255
1529 movff WREG,box_temp+0 ; Data
1530 movlw .181
1531 movff WREG,box_temp+1 ; row top (0-239)
1532 movlw .187
1533 movff WREG,box_temp+2 ; row bottom (0-239)
1534 movlw .31
1535 movff WREG,box_temp+3 ; column left (0-159)
1536 movlw .33
1537 movff WREG,box_temp+4 ; column right (0-159)
1538 call PLED_box ; Full Cap
1539 bra update_batt_voltage3
1540
1541 PLED_convert_date: ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
1542 read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD)
1543 tstfsz EEDATA
1544 bra PLED_convert_date1
1545
1546 ; Use MMDDYY
1547 movff convert_value_temp+0,lo ;month
1548 bsf leftbind
1549 output_99x
1550 bcf leftbind
1551 movlw '/'
1552 movwf POSTINC2
1553 movff convert_value_temp+1,lo ;day
1554 bra PLED_convert_date1_common ;year
1555
1556 PLED_convert_date1:
1557 read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD)
1558 decfsz EEDATA,F
1559 bra PLED_convert_date2
1560
1561 ; Use DDMMYY
1562 movff convert_value_temp+1,lo ;day
1563 bsf leftbind
1564 output_99x
1565 bcf leftbind
1566 movlw '/'
1567 movwf POSTINC2
1568 movff convert_value_temp+0,lo ;month
1569
1570 PLED_convert_date1_common:
1571 bsf leftbind
1572 output_99x
1573 bcf leftbind
1574 movlw '/'
1575 movwf POSTINC2
1576 movff convert_value_temp+2,lo ;year
1577 bsf leftbind
1578 output_99x
1579 return
1580
1581 PLED_convert_date2:
1582 ; Use YYMMDD
1583 movff convert_value_temp+2,lo ;year
1584 bsf leftbind
1585 output_99x
1586 bcf leftbind
1587 movlw '/'
1588 movwf POSTINC2
1589 movff convert_value_temp+0,lo ;month
1590 bsf leftbind
1591 output_99x
1592 bcf leftbind
1593 movlw '/'
1594 movwf POSTINC2
1595 movff convert_value_temp+1,lo ;day
1596 bsf leftbind
1597 output_99x
1598 return
1599
1600 PLED_convert_date_short: ; converts into "DD/MM" or "MM/DD" or "MM/DD" in postinc2
1601 read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD)
1602 tstfsz EEDATA
1603 bra PLED_convert_date_short1
1604
1605 ; Use MMDDYY
1606 PLED_convert_date_short_common:
1607 movff convert_value_temp+0,lo ;month
1608 bsf leftbind
1609 output_99x
1610 bcf leftbind
1611 movlw '/'
1612 movwf POSTINC2
1613 movff convert_value_temp+1,lo ;day
1614 bsf leftbind
1615 output_99x
1616 bcf leftbind
1617 return
1618
1619 PLED_convert_date_short1:
1620 read_int_eeprom d'91' ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD)
1621 decfsz EEDATA,F
1622 bra PLED_convert_date_short_common ; Use YYMMDD
1623
1624 ; Use DDMMYY
1625 movff convert_value_temp+1,lo ;day
1626 bsf leftbind
1627 output_99x
1628 bcf leftbind
1629 movlw '/'
1630 movwf POSTINC2
1631 movff convert_value_temp+0,lo ;month
1632 bsf leftbind
1633 output_99x
1634 bcf leftbind
1635 return
1636
1637 update_date:
1638 ostc_debug 'd'
1639 WIN_TOP .75
1640 WIN_LEFT .0
1641 WIN_FONT FT_SMALL
1642 WIN_INVERT .0 ; Init new Wordprocessor
1643 WIN_COLOR color_white
1644 lfsr FSR2,letter
1645
1646 movff month,convert_value_temp+0
1647 movff day,convert_value_temp+1
1648 movff year,convert_value_temp+2
1649 call PLED_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
1650 call word_processor
1651 return
1652
1653 PLED_menu_clear:
1654 movlw .0
1655 movff WREG,box_temp+0 ; Data
1656 movlw .0
1657 movff WREG,box_temp+1 ; row top (0-239)
1658 movlw .26
1659 movff WREG,box_temp+2 ; row bottom (0-239)
1660 movlw .65
1661 movff WREG,box_temp+3 ; column left (0-159)
1662 movlw .100
1663 movff WREG,box_temp+4 ; column right (0-159)
1664 call PLED_box
1665 return
1666
1667 PLED_max_pressure:
1668 btfsc multi_gf_display ; Is the Multi-GF Table displayed?
1669 return ; Yes, No update and return!
1670
1671 ostc_debug 'p' ; Sends debug-information to screen if debugmode active
1672
1673 WIN_TOP .184
1674 WIN_LEFT .0
1675 WIN_FONT FT_MEDIUM
1676 WIN_INVERT .0 ; Init new Wordprocessor
1677 WIN_COLOR color_white
1678 lfsr FSR2,letter
1679 movff max_pressure+0,lo
1680 movff max_pressure+1,hi
1681 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar]
1682 bsf leftbind
1683 bsf ignore_digit5 ; do not display 1cm depth
1684 output_16dp d'3'
1685 bcf leftbind
1686 bcf show_last3
1687 call word_processor
1688 WIN_FONT FT_SMALL
1689 return
1690
1691 PLED_divemins:
1692 btfsc menubit ; Divemode menu active?
1693 return ; Yes, do not update divetime
1694
1695 ostc_debug 'A' ; Sends debug-information to screen if debugmode active
1696
1697 btfsc gauge_mode ; different display in gauge mode
1698 bra PLED_divemins_gauge
1699
1700 btfsc FLAG_apnoe_mode ; different display in apnoe mode
1701 bra PLED_divemins_apnoe
1702
1703 GETCUSTOM8 d'38' ; Show seconds (=1?)
1704 movwf lo
1705 movlw d'1'
1706 cpfseq lo ; =1?
1707 bra PLED_divemins2 ; No, minutes only
1708 bra PLED_divemins_gauge ; Yes, use Gauge routine
1709
1710 PLED_divemins2:
1711 movff divemins+0,lo
1712 movff divemins+1,hi
1713 bcf leftbind
1714 lfsr FSR2,letter
1715 output_16_3 ; displays only last three figures from a 16Bit value (0-999)
1716 WIN_TOP .20
1717 WIN_LEFT .120
1718 WIN_FONT FT_MEDIUM
1719 WIN_COLOR color_white
1720 call word_processor
1721 WIN_FONT FT_SMALL
1722 return
1723
1724 PLED_display_apnoe_surface:
1725 btfsc menubit ; Divemode menu active?
1726 return ; Yes, do not display surface mode timeout
1727
1728 WIN_COLOR color_red
1729 DISPLAYTEXT d'140' ; "SURFACE"
1730 WIN_COLOR color_white
1731
1732 WIN_TOP .85
1733 WIN_LEFT .90
1734 WIN_FONT FT_MEDIUM
1735 WIN_COLOR color_white
1736
1737 movff apnoe_surface_mins,lo
1738 bcf leftbind
1739 lfsr FSR2,letter
1740 output_8
1741 movlw ':'
1742 movwf POSTINC2
1743 movff apnoe_surface_secs,lo
1744 output_99x
1745 call word_processor
1746 WIN_FONT FT_SMALL
1747 return
1748
1749 PLED_apnoe_clear_surface:
1750 ; Clear Surface timer....
1751 movlw .0
1752 movff WREG,box_temp+0 ; Data
1753 movlw .60
1754 movff WREG,box_temp+1 ; row top (0-239)
1755 movlw .119
1756 movff WREG,box_temp+2 ; row bottom (0-239)
1757 movlw .90
1758 movff WREG,box_temp+3 ; column left (0-159)
1759 movlw .159
1760 movff WREG,box_temp+4 ; column right (0-159)
1761 call PLED_box
1762 return
1763
1764
1765 PLED_display_apnoe_descent:
1766 WIN_COLOR color_red
1767 DISPLAYTEXT d'139' ; "Descent"
1768 WIN_COLOR color_white
1769
1770 WIN_TOP .145
1771 WIN_LEFT .90
1772 WIN_FONT FT_MEDIUM
1773 WIN_COLOR color_white
1774
1775 movff apnoe_mins,lo
1776 lfsr FSR2,letter
1777 output_8
1778 movlw ':'
1779 movwf POSTINC2
1780 movff apnoe_secs,lo
1781 output_99x
1782 call word_processor
1783 WIN_FONT FT_SMALL
1784 return
1785
1786 PLED_divemins_apnoe:
1787
1788 PLED_divemins_gauge:
1789 movff divemins+0,lo
1790 movff divemins+1,hi
1791 bcf leftbind
1792 bsf show_last3
1793 lfsr FSR2,letter
1794 output_16_3 ;Displays only 0...999
1795 movlw ':'
1796 movwf POSTINC2
1797 movff divesecs,lo
1798 output_99x
1799 WIN_TOP .20
1800 WIN_LEFT .90
1801 WIN_FONT FT_MEDIUM
1802 WIN_COLOR color_white
1803 call word_processor
1804 bcf show_last3
1805 WIN_FONT FT_SMALL
1806 return
1807
1808 PLED_stopwatch_remove:
1809 movlw .0
1810 movff WREG,box_temp+0 ; Data
1811 movlw .54
1812 movff WREG,box_temp+1 ; row top (0-239)
1813 movlw .102
1814 movff WREG,box_temp+2 ; row bottom (0-239)
1815 movlw .062
1816 movff WREG,box_temp+3 ; column left (0-159)
1817 movlw .159
1818 movff WREG,box_temp+4 ; column right (0-159)
1819 call PLED_box
1820 return
1821
1822
1823 PLED_stopwatch_show:
1824 btfsc menubit ; Divemode menu active?
1825 return ; Yes, No update and return!
1826
1827 ostc_debug 'V' ; Sends debug-information to screen if debugmode active
1828 ; Stopwatch
1829
1830 WIN_COLOR color_red
1831 DISPLAYTEXTH d'283' ; Counter
1832 WIN_COLOR color_white
1833
1834 WIN_TOP .80
1835 WIN_LEFT .110
1836 WIN_FONT FT_SMALL
1837 WIN_COLOR color_white
1838
1839
1840
1841 lfsr FSR2,letter
1842 movff average_divesecs+0,lo ; Stopwatch
1843 movff average_divesecs+1,hi ; Stopwatch
1844 movlw d'2'
1845 subwf lo,F
1846 movlw d'0'
1847 subwfb hi,F ; Subtract 2 seconds
1848
1849 call convert_time ; converts hi:lo in seconds to mins (hi) and secs (lo)
1850
1851 movff lo,wait_temp
1852 movff hi,lo
1853 clrf hi
1854
1855 movlw d'0'
1856 bcf leftbind
1857 bsf show_last3
1858 output_16_3 ;Displays only 0...999
1859 movlw ':'
1860 movwf POSTINC2
1861 movff wait_temp,lo
1862 output_99x
1863 bcf leftbind
1864 call word_processor
1865
1866 ostc_debug 'U' ; Sends debug-information to screen if debugmode active
1867
1868 WIN_TOP .80
1869 WIN_LEFT .62
1870 WIN_FONT FT_SMALL
1871 WIN_COLOR color_white
1872
1873 lfsr FSR2,letter
1874 movff avr_rel_pressure+0,lo
1875 movff avr_rel_pressure+1,hi
1876 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar]
1877 bsf leftbind
1878 bsf ignore_digit5 ; do not display 1cm depth
1879 output_16dp d'3'
1880 bcf leftbind
1881 movlw 'm'
1882 movwf POSTINC2
1883 movlw ' '
1884 movwf POSTINC2
1885 call word_processor
1886 return
1887
1888
1889 PLED_serial: ; Writes OSTC #Serial and Firmware version in surfacemode
1890 ostc_debug 'a' ; Sends debug-information to screen if debugmode active
1891 WIN_TOP .0
1892 WIN_LEFT .0
1893 WIN_FONT FT_SMALL
1894 WIN_INVERT .0 ; Init new Wordprocessor
1895 WIN_COLOR color_white
1896
1897 lfsr FSR2,letter
1898 OUTPUTTEXTH d'262' ; "OSTC "
1899 clrf EEADRH
1900 clrf EEADR ; Get Serial number LOW
1901 call read_eeprom ; read byte
1902 movff EEDATA,lo
1903 incf EEADR,F ; Get Serial number HIGH
1904 call read_eeprom ; read byte
1905 movff EEDATA,hi
1906
1907 bsf leftbind
1908 output_16
1909 movlw ' '
1910 movwf POSTINC2
1911 movlw 'V'
1912 movwf POSTINC2
1913 movlw softwareversion_x
1914 movwf lo
1915 bsf leftbind
1916 output_8
1917 movlw '.'
1918 movwf POSTINC2
1919 movlw softwareversion_y
1920 movwf lo
1921 bsf leftbind
1922 output_99x
1923 bcf leftbind
1924 call word_processor
1925 return
1926
1927 PLED_divemode_menu_mask_first: ; Write Divemode menu1 mask
1928 ostc_debug 'o' ; Sends debug-information to screen if debugmode active
1929 call PLED_menu_clear ; clear "Menu?"
1930 DISPLAYTEXT .31 ;"Show Deco"
1931
1932 btfsc FLAG_const_ppO2_mode ; are we in ppO2 mode?
1933 bra PLED_divemode_menu_mask_first2
1934 ; in OC Mode
1935 DISPLAYTEXT .32 ;"Gaslist"
1936 DISPLAYTEXT .122 ; "Set Gas"
1937 bra PLED_divemode_menu_mask_first3
1938
1939 PLED_divemode_menu_mask_first2:
1940 ; in CC Mode
1941 DISPLAYTEXT .238 ; "SetPoint"
1942 DISPLAYTEXT .137 ; "Bailout"
1943
1944 PLED_divemode_menu_mask_first3:
1945 ; In all modes
1946 DISPLAYTEXT .33 ;"More"
1947 DISPLAYTEXT .34 ;"Exit"
1948 return
1949
1950 PLED_divemode_menu_mask_second: ; Write Divemode menu1 mask
1951 ostc_debug 'o' ; Sends debug-information to screen if debugmode active
1952 DISPLAYTEXT .240 ;"Graphs"
1953 DISPLAYTEXT .241 ;"Display"
1954 DISPLAYTEXTH .281 ;"L. Tissue"
1955 DISPLAYTEXT .147 ;"Stopwat."
1956 DISPLAYTEXT .244 ;"Exit"
1957 return
1958
1959 PLED_divemode_set_xgas: ; Displayes the "Set Gas" menu
1960 WIN_LEFT .100
1961 WIN_TOP .0
1962 WIN_FONT FT_SMALL
1963 WIN_COLOR color_white
1964 lfsr FSR2,letter
1965 movlw 'S'
1966 movwf POSTINC2
1967 movlw 'e'
1968 movwf POSTINC2
1969 movlw 'l'
1970 movwf POSTINC2
1971 read_int_eeprom d'24' ; Get Gas6 %O2
1972 movff EEDATA,lo
1973 bcf leftbind
1974 output_99 ; outputs into Postinc2!
1975 movlw '/'
1976 movwf POSTINC2
1977 read_int_eeprom d'25' ; Get Gas6 %He
1978 movff EEDATA,lo
1979 output_99 ; outputs into Postinc2!
1980 call word_processor
1981 DISPLAYTEXT .123 ; O2 +
1982 DISPLAYTEXT .124 ; O2 -
1983 DISPLAYTEXT .125 ; He +
1984 DISPLAYTEXT .126 ; He -
1985 return
1986
1987 PLED_divemode_simulator_mask:
1988 DISPLAYTEXT .254 ; EXIT
1989 DISPLAYTEXT .250 ; + 1m
1990 DISPLAYTEXT .251 ; - 1m
1991 DISPLAYTEXT .252 ; +10m
1992 DISPLAYTEXT .253 ; -10m
1993 return
1994
1995 PLED_decoplan_bargraph:
1996 movlw .255
1997 movff WREG,box_temp+0 ; Data
1998 movff win_top,box_temp+1 ; row top (0-239)
1999 movff win_top,box_temp+2 ;
2000 movlw d'20'
2001 addwf box_temp+2,F ; row bottom (0-239)
2002 movlw .122
2003 movff WREG,box_temp+3 ; column left (0-159)
2004 addwf lo,F ; Add time offset
2005 decf lo,F ; minus one
2006 movlw d'138' ; Limit length (16min)
2007 cpfslt lo
2008 movwf lo
2009 movff lo,box_temp+4 ; column right (0-159)
2010 call PLED_box
2011
2012 movlw .0
2013 movff WREG,box_temp+0 ; Data
2014 movff win_top,box_temp+1 ; row top (0-239)
2015 movff win_top,box_temp+2 ;
2016 movlw d'20'
2017 addwf box_temp+2,F ; row bottom (0-239)
2018 movff lo,box_temp+3 ;
2019 incf box_temp+3,F ; column left (0-159)
2020 movlw .139
2021 movff WREG,box_temp+4 ; column right (0-159)
2022 call PLED_box
2023 return
2024
2025 PLED_decoplan_delete: ; Delete unused rows
2026 movlw .0
2027 movff WREG,box_temp+0 ; data 00, x0, 0y, xy clear, links, rechts, beide
2028
2029 movff hi,box_temp+1 ; row top (0-63)
2030 movlw .125
2031 movff WREG,box_temp+2 ; row bottom (0-63)
2032 movlw .100
2033 movff WREG,box_temp+3 ; column left (0-159)
2034 movlw .159
2035 movff WREG,box_temp+4 ; column right (0-159)
2036 call PLED_box
2037 return
2038
2039 PLED_decoplan: ; display the Decoplan
2040 ostc_debug 'n' ; Sends debug-information to screen if debugmode active
2041
2042 movff char_O_array_decodepth+0,lo ; Get Depth
2043 tstfsz lo
2044 bra PLED_decoplan1
2045 ; No Deco, show "no Deco"
2046 call PLED_clear_divemode_menu ; Clear Deco area
2047 DISPLAYTEXT d'239' ;"No Deco"
2048 return
2049
2050 PLED_decoplan1:
2051 bsf leftbind
2052 WIN_LEFT .100
2053 movlw .000
2054 movff WREG,win_top
2055 movwf hi ; copy for PLED_decoplan_bargraph
2056 call PLED_SetRow ; Set Row
2057 lfsr FSR2,letter
2058 movff char_O_array_decodepth+0,lo ; Get Depth
2059 movf lo,w
2060 btfsc STATUS,Z ; =0
2061 goto PLED_decoplan_delete ; Yes, quit display
2062 output_8 ; outputs into Postinc2!
2063 movlw 'm'
2064 movwf POSTINC2
2065 call word_processor
2066 WIN_LEFT .140
2067 movlw .000
2068 movff WREG,win_top
2069 lfsr FSR2,letter
2070 movff char_O_array_decotime+0,lo ; Get length for this stop
2071 output_99x ; outputs into Postinc2!
2072 movlw d'39' ;"'"
2073 movwf POSTINC2
2074 call word_processor
2075 call PLED_decoplan_bargraph ; draws a box representing the decotime (stored in lo...) for this depth
2076
2077 WIN_LEFT .100
2078 movlw .025
2079 movff WREG,win_top
2080 movwf hi ; copy for PLED_decoplan_bargraph
2081 call PLED_SetRow ; Set Row
2082 lfsr FSR2,letter
2083 movff char_O_array_decodepth+1,lo ; Get Depth
2084 movf lo,w
2085 btfsc STATUS,Z ; =0
2086 goto PLED_decoplan_delete ; Yes, quit display
2087 output_8 ; outputs into Postinc2!
2088 movlw 'm'
2089 movwf POSTINC2
2090 call word_processor
2091 WIN_LEFT .140
2092 movlw .025
2093 movff WREG,win_top
2094 lfsr FSR2,letter
2095 movff char_O_array_decotime+1,lo ; Get length for this stop
2096 output_99x ; outputs into Postinc2!
2097 movlw d'39' ;"'"
2098 movwf POSTINC2
2099 call word_processor
2100 call PLED_decoplan_bargraph ; draws a box representing the decotime (stored in lo...) for this depth
2101
2102 WIN_LEFT .100
2103 movlw .050
2104 movff WREG,win_top
2105 movwf hi ; copy for PLED_decoplan_bargraph
2106 call PLED_SetRow ; Set Row
2107 lfsr FSR2,letter
2108 movff char_O_array_decodepth+2,lo ; Get Depth
2109 movf lo,w
2110 btfsc STATUS,Z ; =0
2111 goto PLED_decoplan_delete ; Yes, quit display
2112 output_8 ; outputs into Postinc2!
2113 movlw 'm'
2114 movwf POSTINC2
2115 call word_processor
2116 WIN_LEFT .140
2117 movlw .050
2118 movff WREG,win_top
2119 lfsr FSR2,letter
2120 movff char_O_array_decotime+2,lo ; Get length for this stop
2121 output_99x ; outputs into Postinc2!
2122 movlw d'39' ;"'"
2123 movwf POSTINC2
2124 call word_processor
2125 call PLED_decoplan_bargraph ; draws a box representing the decotime (stored in lo...) for this depth
2126
2127 WIN_LEFT .100
2128 movlw .075
2129 movff WREG,win_top
2130 movwf hi ; copy for PLED_decoplan_bargraph
2131 call PLED_SetRow ; Set Row
2132 lfsr FSR2,letter
2133 movff char_O_array_decodepth+3,lo ; Get Depth
2134 movf lo,w
2135 btfsc STATUS,Z ; =0
2136 goto PLED_decoplan_delete ; Yes, quit display
2137 output_8 ; outputs into Postinc2!
2138 movlw 'm'
2139 movwf POSTINC2
2140 call word_processor
2141 WIN_LEFT .140
2142 movlw .075
2143 movff WREG,win_top
2144 lfsr FSR2,letter
2145 movff char_O_array_decotime+3,lo ; Get length for this stop
2146 output_99x ; outputs into Postinc2!
2147 movlw d'39' ;"'"
2148 movwf POSTINC2
2149 call word_processor
2150 call PLED_decoplan_bargraph ; draws a box representing the decotime (stored in lo...) for this depth
2151
2152 WIN_LEFT .100
2153 movlw .100
2154 movff WREG,win_top
2155 movwf hi ; copy for PLED_decoplan_bargraph
2156 call PLED_SetRow ; Set Row
2157 lfsr FSR2,letter
2158 movff char_O_array_decodepth+4,lo ; Get Depth
2159 movf lo,w
2160 btfsc STATUS,Z ; =0
2161 goto PLED_decoplan_delete ; Yes, quit display
2162 output_8 ; outputs into Postinc2!
2163 movlw 'm'
2164 movwf POSTINC2
2165 call word_processor
2166 WIN_LEFT .140
2167 movlw .100
2168 movff WREG,win_top
2169 lfsr FSR2,letter
2170 movff char_O_array_decotime+4,lo ; Get length for this stop
2171 output_99x ; outputs into Postinc2!
2172 movlw d'39' ;"'"
2173 movwf POSTINC2
2174 call word_processor
2175 call PLED_decoplan_bargraph ; draws a box representing the decotime (stored in lo...) for this depth
2176 return
2177
2178 PLED_gas_list:
2179 ostc_debug 'm' ; Sends debug-information to screen if debugmode active
2180
2181 WIN_LEFT .100
2182 WIN_FONT FT_SMALL
2183 bsf leftbind
2184
2185 movlw d'2'
2186 movwf wait_temp ; here: stores eeprom address for gas list
2187 movlw d'231'
2188 movwf waitms_temp ; here: stores row for gas list
2189 clrf hi ; here: Gas counter
2190
2191 PLED_gas_list_loop:
2192 incf hi,F ; Increase Gas
2193 movlw d'4'
2194 addwf wait_temp,F ; Increase eeprom address for gas list
2195 movlw d'25'
2196 addwf waitms_temp,F ; Increase row
2197 WIN_LEFT .100
2198 movff waitms_temp,win_top ; Set Row
2199
2200 lfsr FSR2,letter
2201 movlw 'G'
2202 movwf POSTINC2
2203 movff hi,lo ; copy gas number
2204 output_8 ; display gas number
2205 movlw ':'
2206 movwf POSTINC2
2207 movff wait_temp, EEADR; Gas #hi: %O2 - Set address in internal EEPROM
2208 call read_eeprom ; get byte (stored in EEDATA)
2209 movff EEDATA,lo ; copy to lo
2210 output_8 ; outputs into Postinc2!
2211 movlw '/'
2212 movwf POSTINC2
2213 incf EEADR,F ; Gas #hi: %He - Set address in internal EEPROM
2214 call read_eeprom ; get byte (stored in EEDATA)
2215 movff EEDATA,lo ; copy to lo
2216 output_8 ; outputs into Postinc2!
2217
2218
2219 read_int_eeprom d'27' ; read flag register
2220 movff hi,lo ; copy gas number
2221 PLED_gas_list_loop1:
2222 rrcf EEDATA ; roll flags into carry
2223 decfsz lo,F ; max. 5 times...
2224 bra PLED_gas_list_loop1
2225
2226 movlw .015
2227 btfss STATUS,C ; test carry
2228 movlw .010
2229 movwf grayvalue ; grey out inactive gases!
2230
2231 call word_processor
2232 movlw .015
2233 movwf grayvalue ; reset grey value for compatibility
2234
2235 movlw d'5' ; list all five gases
2236 cpfseq hi ; All gases shown?
2237 bra PLED_gas_list_loop ; No
2238
2239 return ; No, return (OC mode)
2240
2241 PLED_splist_start:
2242 WIN_LEFT .100
2243 WIN_FONT FT_SMALL
2244 bsf leftbind
2245
2246 ; list three SP in Gaslist
2247 movlw d'35' ; 36 = current SP position in EEPROM
2248 movwf wait_temp ; here: stores eeprom address for gas list
2249 movlw d'231'
2250 movwf waitms_temp ; here: stores row for gas list
2251 clrf temp5 ; here: SP counter
2252
2253 PLED_splist_loop:
2254 incf wait_temp,F ; EEPROM address
2255 incf temp5,F ; Increase SP
2256
2257 movlw d'25'
2258 addwf waitms_temp,F ; Increase row
2259 movff waitms_temp,win_top ; Set Row
2260 WIN_LEFT .100
2261
2262 lfsr FSR2,letter
2263 movlw 'S'
2264 movwf POSTINC2
2265 movlw 'P'
2266 movwf POSTINC2
2267 movff temp5,lo ; copy gas number
2268 output_8 ; display gas number
2269 movlw ':'
2270 movwf POSTINC2
2271 movff wait_temp, EEADR; SP #hi position
2272 call read_eeprom ; get byte (stored in EEDATA)
2273 movff EEDATA,lo ; copy to lo
2274 clrf hi
2275 output_16dp d'3' ; outputs into Postinc2!
2276 call word_processor
2277
2278 movlw d'3' ; list all three SP
2279 cpfseq temp5 ; All gases shown?
2280 bra PLED_splist_loop ; No
2281
2282 bcf leftbind
2283 return ; no, return
2284
2285 PLED_clear_divemode_menu:
2286 movlw .0
2287 movff WREG,box_temp+0 ; Data
2288 movlw .0
2289 movff WREG,box_temp+1 ; row top (0-239)
2290 movlw .125
2291 movff WREG,box_temp+2 ; row bottom (0-239)
2292 movlw .082
2293 movff WREG,box_temp+3 ; column left (0-159)
2294 movlw .159
2295 movff WREG,box_temp+4 ; column right (0-159)
2296 call PLED_box
2297 return
2298
2299 PLED_divemenu_cursor:
2300 ostc_debug 'l' ; Sends debug-information to screen if debugmode active
2301 WIN_TOP .0
2302 WIN_LEFT .85
2303 WIN_FONT FT_SMALL
2304 WIN_INVERT .0 ; Init new Wordprocessor
2305 WIN_COLOR color_white
2306 lfsr FSR2,letter
2307 movlw 0xB8
2308 movwf POSTINC2
2309 call word_processor
2310 WIN_TOP .25
2311 WIN_LEFT .85
2312 WIN_FONT FT_SMALL
2313 WIN_INVERT .0 ; Init new Wordprocessor
2314 WIN_COLOR color_white
2315 lfsr FSR2,letter
2316 movlw 0xB8
2317 movwf POSTINC2
2318 call word_processor
2319 WIN_TOP .50
2320 WIN_LEFT .85
2321 WIN_FONT FT_SMALL
2322 WIN_INVERT .0 ; Init new Wordprocessor
2323 WIN_COLOR color_white
2324 lfsr FSR2,letter
2325 movlw 0xB8
2326 movwf POSTINC2
2327 call word_processor
2328 WIN_TOP .75
2329 WIN_LEFT .85
2330 WIN_FONT FT_SMALL
2331 WIN_INVERT .0 ; Init new Wordprocessor
2332 WIN_COLOR color_white
2333 lfsr FSR2,letter
2334 movlw 0xB8
2335 movwf POSTINC2
2336 call word_processor
2337 WIN_TOP .100
2338 WIN_LEFT .85
2339 WIN_FONT FT_SMALL
2340 WIN_INVERT .0 ; Init new Wordprocessor
2341 WIN_COLOR color_white
2342 lfsr FSR2,letter
2343 movlw 0xB8
2344 movwf POSTINC2
2345 call word_processor
2346
2347 movff menupos,temp1
2348 movlw d'0'
2349 dcfsnz temp1,F
2350 movlw d'0'
2351 dcfsnz temp1,F
2352 movlw d'25'
2353 dcfsnz temp1,F
2354 movlw d'50'
2355 dcfsnz temp1,F
2356 movlw d'75'
2357 dcfsnz temp1,F
2358 movlw d'100'
2359 movff WREG,win_top
2360 WIN_LEFT .85
2361 WIN_FONT FT_SMALL
2362 WIN_INVERT .0 ; Init new Wordprocessor
2363 WIN_COLOR color_white
2364 lfsr FSR2,letter
2365 movlw 0xB7 ; Arrow for menu
2366 movwf POSTINC2
2367 call word_processor
2368 return
2369
2370 PLED_profileview_menu:
2371 DISPLAYTEXT .127 ;"Exit"
2372 DISPLAYTEXT .128 ;"Delete"
2373 DISPLAYTEXT .132 ;"Format"
2374 return
2375
2376 custom_warn_surfmode:
2377 movlw .0
2378 movff WREG,box_temp+0 ; Data
2379 movlw .56
2380 movff WREG,box_temp+1 ; row top (0-239)
2381 movlw .88
2382 movff WREG,box_temp+2 ; row bottom (0-239)
2383 movlw .69
2384 movff WREG,box_temp+3 ; column left (0-159)
2385 movlw .115
2386 movff WREG,box_temp+4 ; column right (0-159)
2387 call PLED_box
2388
2389 movlw .255
2390 movff WREG,box_temp+0 ; Data
2391 movlw .58
2392 movff WREG,box_temp+1 ; row top (0-239)
2393 movlw .86
2394 movff WREG,box_temp+2 ; row bottom (0-239)
2395 movlw .70
2396 movff WREG,box_temp+3 ; column left (0-159)
2397 movlw .114
2398 movff WREG,box_temp+4 ; column right (0-159)
2399 call PLED_frame
2400 ; warning text
2401
2402 WIN_TOP .60
2403 WIN_LEFT .71
2404 WIN_FONT FT_SMALL
2405 WIN_INVERT .1 ; Init new Wordprocessor
2406 WIN_COLOR color_red
2407 lfsr FSR2,letter
2408 movlw 'C'
2409 movwf POSTINC2
2410 movlw 'F'
2411 movwf POSTINC2
2412 movff temp1,lo
2413 output_8
2414 movlw '!'
2415 movwf POSTINC2
2416 call word_processor
2417
2418 WIN_INVERT .0 ; Init new Wordprocessor
2419 WIN_COLOR color_white
2420 return
2421
2422 PLED_saturation_graph_divemode:
2423 ostc_debug 'h' ; Sends debug-information to screen if debugmode active
2424 PLED_tissue_saturation_graph:
2425 ostc_debug 'i' ; Sends debug-information to screen if debugmode active
2426 ; with dd_font2display
2427
2428 movlw .255
2429 movff WREG,box_temp+0 ; Data
2430 movlw .25
2431 movff WREG,box_temp+1 ; row top (0-239)
2432 movlw .120
2433 movff WREG,box_temp+2 ; row bottom (0-239)
2434 movlw .82
2435 movff WREG,box_temp+3 ; column left (0-159)
2436 movlw .159
2437 movff WREG,box_temp+4 ; column right (0-159)
2438 call PLED_frame
2439
2440 lfsr FSR2, char_O_tissue_saturation+.000 ; N2
2441 movlw d'16'
2442 movwf wait_temp ; 16 tissues
2443 clrf waitms_temp ; Row offset
2444 PLED_tissue_saturation_graph3:
2445 movlw .255
2446 movff WREG,box_temp+0 ; Data
2447 movlw .28
2448 addwf waitms_temp,W
2449 movff WREG,box_temp+1 ; row top (0-239)
2450 movlw .28
2451 addwf waitms_temp,W
2452 movff WREG,box_temp+2 ; row bottom (0-239)
2453
2454 incf waitms_temp,F
2455 incf waitms_temp,F
2456
2457 movlw .100
2458 movff WREG,box_temp+3 ; column left (0-159)
2459
2460 movff POSTINC2,box_temp+4
2461 bcf STATUS,C
2462 rrcf box_temp+4,F
2463 bcf STATUS,C
2464 rrcf box_temp+4,F
2465 movlw .100
2466 addwf box_temp+4,F ; column right (0-159)
2467
2468 movlw d'157' ; limit display
2469 cpfslt box_temp+4 ; skip if 157 (WREG) < box_temp+4
2470 movwf box_temp+4
2471
2472 call PLED_box
2473
2474 decfsz wait_temp,F
2475 bra PLED_tissue_saturation_graph3
2476
2477 lfsr FSR2, char_O_tissue_saturation+.016 ; He
2478 movlw d'16'
2479 movwf wait_temp ; 16 tissues
2480 clrf waitms_temp ; Row offset
2481 PLED_tissue_saturation_graph2:
2482 movlw .255
2483 movff WREG,box_temp+0 ; Data
2484 movlw .86
2485 addwf waitms_temp,W
2486 movff WREG,box_temp+1 ; row top (0-239)
2487 movlw .86
2488 addwf waitms_temp,W
2489 movff WREG,box_temp+2 ; row bottom (0-239)
2490
2491 incf waitms_temp,F
2492 incf waitms_temp,F
2493
2494 movlw .100
2495 movff WREG,box_temp+3 ; column left (0-159)
2496
2497 movff POSTINC2,box_temp+4
2498 bcf STATUS,C
2499 rrcf box_temp+4,F
2500 bcf STATUS,C
2501 rrcf box_temp+4,F
2502 movlw .100
2503 addwf box_temp+4,F ; column right (0-159)
2504
2505 movlw d'157' ; limit display
2506 cpfslt box_temp+4 ; skip if 157 (WREG) < box_temp+4
2507 movwf box_temp+4
2508
2509 call PLED_box
2510
2511 decfsz wait_temp,F
2512 bra PLED_tissue_saturation_graph2
2513
2514 WIN_LEFT .84
2515 WIN_TOP .32
2516 WIN_COLOR color_white
2517 lfsr FSR2,letter
2518 movlw 'N'
2519 movwf POSTINC2
2520 movlw '2'
2521 movwf POSTINC2
2522 call word_processor
2523
2524 WIN_LEFT .84
2525 WIN_TOP .90
2526 WIN_COLOR color_white
2527 lfsr FSR2,letter
2528 movlw 'H'
2529 movwf POSTINC2
2530 movlw 'e'
2531 movwf POSTINC2
2532 call word_processor
2533 return
2534
2535
2536 PLED_startupscreen1:
2537 call PLED_topline_box
2538 WIN_INVERT .1 ; Init new Wordprocessor
2539 DISPLAYTEXT d'3' ; "HeinrichsWeikamp"
2540 WIN_INVERT .0 ; Init new Wordprocessor
2541 DISPLAYTEXT .68 ; Licence 1/2
2542 DISPLAYTEXT .69
2543 DISPLAYTEXT .70
2544 DISPLAYTEXT .71
2545 DISPLAYTEXT .72
2546 DISPLAYTEXT .73
2547 DISPLAYTEXT .74
2548 return
2549
2550 PLED_startupscreen2:
2551 call PLED_topline_box
2552 WIN_INVERT .1 ; Init new Wordprocessor
2553 DISPLAYTEXT d'3' ; "HeinrichsWeikamp"
2554 WIN_INVERT .0 ; Init new Wordprocessor
2555 DISPLAYTEXT .75 ; Licence 2/2
2556 DISPLAYTEXT .76
2557 DISPLAYTEXT .77
2558 DISPLAYTEXT .78
2559 DISPLAYTEXT .79
2560 DISPLAYTEXT .80
2561 DISPLAYTEXT .81
2562 return
2563
2564 PLED_new_cf_warning:
2565 call PLED_topline_box
2566 WIN_INVERT .1 ; Init new Wordprocessor
2567 DISPLAYTEXTH .271 ; New CF added!
2568 WIN_INVERT .0 ; Init new Wordprocessor
2569 DISPLAYTEXTH .272 ; New CustomFunctions
2570 DISPLAYTEXTH .273 ; were added! Check
2571 DISPLAYTEXTH .274 ; CF I and CF II Menu
2572 DISPLAYTEXTH .275 ; for Details!
2573 return
2574
2575 PLED_const_ppO2_value:
2576 btfsc multi_gf_display ; Is the Multi-GF Table displayed?
2577 return ; Yes, No update and return!
2578 btfsc menubit ; Divemode menu active?
2579 return ; Yes, No update and return!
2580 btfsc premenu ; Showing "Menu?"?
2581 return ; Yes, do not display ppO2/"Bail"
2582
2583 ostc_debug 'j' ; Sends debug-information to screen if debugmode active
2584
2585 WIN_TOP .168
2586 WIN_LEFT .65
2587 WIN_FONT FT_SMALL
2588 WIN_INVERT .0 ; Init new Wordprocessor
2589 WIN_COLOR color_white
2590 lfsr FSR2,letter
2591 movff char_I_const_ppO2,lo
2592
2593 tstfsz lo ; In Bailout mode (char_I_const_ppO2=0)?
2594 bra PLED_const_ppO2_value2 ; No, display Setpoint
2595
2596 ; Yes, Display "Bail"
2597 OUTPUTTEXTH d'263' ;"Bail"
2598 call word_processor
2599 return
2600
2601 PLED_const_ppO2_value2: ; Display SetPoint
2602 ;Show fixed SP value
2603 clrf hi
2604 bsf leftbind
2605 output_16dp d'3'
2606 bcf leftbind
2607 call word_processor
2608 return
2609
2610 PLED_show_leading_tissue:
2611 call deco_main_calc_desaturation_time ; calculate desaturation time
2612 movlb b'00000001' ; select ram bank 1
2613
2614 DISPLAYTEXTH .282 ; L. Tissue:
2615 lfsr FSR2,letter
2616 movlw '#'
2617 movwf POSTINC2
2618 movff char_O_gtissue_no,lo
2619 movff char_O_gtissue_no,wait_temp ; used as temp
2620 bsf leftbind
2621 output_8
2622 movlw ' '
2623 movwf POSTINC2
2624 movlw '('
2625 movwf POSTINC2
2626
2627 movlw d'16'
2628 cpfslt wait_temp
2629 bra PLED_show_leading_tissue_he
2630 movlw 'N'
2631 movwf POSTINC2
2632 movlw '2'
2633 movwf POSTINC2
2634 bra PLED_show_leading_tissue2
2635 PLED_show_leading_tissue_he:
2636 movlw 'H'
2637 movwf POSTINC2
2638 movlw 'e'
2639 movwf POSTINC2
2640 PLED_show_leading_tissue2:
2641 movlw ')'
2642 movwf POSTINC2
2643 movlw ' '
2644 movwf POSTINC2
2645 WIN_LEFT .100
2646 WIN_TOP .25
2647 WIN_FONT FT_SMALL
2648 WIN_COLOR color_white
2649 call word_processor
2650
2651 lfsr FSR2,letter
2652 lfsr FSR1,char_O_tissue_saturation+0
2653 incf wait_temp,F ; make 1-16 of 0-15
2654 PLED_show_leading_tissue3: ; point to leading tissue...
2655 movff POSTINC1,lo ; copy/overwrite to lo register
2656 decfsz wait_temp,F ; count until zero
2657 bra PLED_show_leading_tissue3 ;loop
2658 output_8
2659 movlw '%'
2660 movwf POSTINC2
2661 movlw ' '
2662 movwf POSTINC2
2663 WIN_LEFT .100
2664 WIN_TOP .50
2665 WIN_FONT FT_SMALL
2666 WIN_COLOR color_white
2667 call word_processor
2668 bcf leftbind
2669 return
2670
2671 PLED_topline_box_clear: ; Writes an empty box
2672 movlw .0
2673 bra PLED_topline_box2
2674 PLED_topline_box: ; Writes a filled box
2675 movlw .255
2676 PLED_topline_box2:
2677 movff WREG,box_temp+0 ; Data
2678 movlw .000
2679 movff WREG,box_temp+1 ; row top (0-239)
2680 movlw .026
2681 movff WREG,box_temp+2 ; row bottom (0-239)
2682 movlw .000
2683 movff WREG,box_temp+3 ; column left (0-159)
2684 movlw .159
2685 movff WREG,box_temp+4 ; column right (0-159)
2686 call PLED_box
2687 return
2688
2689 PLED_display_cns:
2690 btfsc multi_gf_display ; Is the Multi-GF Table displayed?
2691 return ; Yes, No update and return!
2692
2693 btfsc gauge_mode ; Do not display in gauge mode
2694 return
2695
2696 btfsc FLAG_apnoe_mode ; Do not display in apnoe mode
2697 return
2698
2699 btfsc pled_velocity_display ; Is velocity displayed?`
2700 return ; Yes, do not overwrite until pled_velocity_clear was called
2701
2702 ostc_debug 'k' ; Sends debug-information to screen if debugmode active
2703
2704 WIN_TOP .090
2705 WIN_LEFT .0
2706 WIN_FONT FT_SMALL
2707 WIN_COLOR color_white
2708
2709 lfsr FSR2,letter
2710 movlw 'C'
2711 movwf POSTINC2
2712 movlw 'N'
2713 movwf POSTINC2
2714 movlw 'S'
2715 movwf POSTINC2
2716 movlw ':'
2717 movwf POSTINC2
2718 movff char_O_CNS_fraction,lo
2719 bsf leftbind
2720 output_8
2721 bcf leftbind
2722 movlw '%'
2723 movwf POSTINC2
2724 call word_processor
2725 return
2726
2727 PLED_custom_text:
2728 read_int_eeprom d'64'
2729 movlw d'1'
2730 cpfseq EEDATA ; Custom text active?
2731 bra PLED_clear_custom_text ; No, Delete row
2732 WIN_TOP .200
2733 WIN_LEFT .0
2734 WIN_FONT FT_SMALL
2735 WIN_INVERT .0 ; Init new Wordprocessor
2736 WIN_COLOR color_red
2737
2738 lfsr FSR2,letter
2739 movlw d'64'
2740 movwf lo
2741 movlw d'24'
2742 movwf hi ; counter
2743
2744 PLED_custom_text1:
2745 incf lo,F
2746 call PLED_get_custom_letter ; Get one letter for the custom text
2747 movlw '}' ; End marker found?
2748 cpfseq EEDATA
2749 bra PLED_custom_text2 ; No
2750 bra PLED_custom_text3
2751 PLED_custom_text2:
2752 movff EEDATA,POSTINC2 ; Copy into Postinc
2753
2754 decfsz hi,F ; Max. numbers?
2755 bra PLED_custom_text1 ; No, get next letters
2756
2757 PLED_custom_text3:
2758 call word_processor
2759 WIN_COLOR color_white
2760 return
2761
2762 PLED_get_custom_letter:
2763 movff lo,EEADR ; Address for next custom text letter
2764 call read_eeprom ; Read letter
2765 return
2766
2767 PLED_clear_custom_text:
2768 movlw d'24'
2769 movwf temp1
2770 WIN_TOP .200
2771 WIN_LEFT .0
2772 call PLED_display_clear_common_y1
2773 return
2774
2775
2776 ;PLED_const_ppO2_DEBUG:
2777 ; movlw .007
2778 ; call PLED_SetColumn
2779 ; movlw .032
2780 ; call PLED_SetRow
2781 ; lfsr FSR2,letter
2782 ; movff char_O_diluent,lo
2783 ; output_8
2784 ; movlw .001
2785 ; movwf scaleY
2786 ; call word_processor
2787 ; movlw .007
2788 ; call PLED_SetColumn
2789 ; movlw .024
2790 ; call PLED_SetRow
2791 ; lfsr FSR2,letter
2792 ; movff last_diluent,lo
2793 ; output_8
2794 ; movlw .001
2795 ; movwf scaleY
2796 ; call word_processor
2797 ; movlw .007
2798 ; call PLED_SetColumn
2799 ; movlw .016
2800 ; call PLED_SetRow
2801 ; lfsr FSR2,letter
2802 ; movff char_O_deco_status,lo
2803 ; output_8
2804 ; movlw .001
2805 ; movwf scaleY
2806 ; call word_processor
2807 ; return
2808 ;
2809
2810 ;PLED_gaschange_DEBUG:
2811 ; movlw .008
2812 ; call PLED_SetColumn
2813 ; movlw .016
2814 ; call PLED_SetRow
2815 ; lfsr FSR2,letter
2816 ; movff char_I_deco_He_ratio,lo
2817 ; output_8
2818 ; call word_processor
2819 ;
2820 ; movlw .024
2821 ; call PLED_SetRow
2822 ; lfsr FSR2,letter
2823 ; movff char_I_deco_N2_ratio,lo
2824 ; output_8
2825 ; call word_processor
2826 ;
2827 ; movlw .032
2828 ; call PLED_SetRow
2829 ; lfsr FSR2,letter
2830 ; movff char_I_deco_gas_change,lo
2831 ; output_8
2832 ; call word_processor
2833 ;
2834 ; movlw .040
2835 ; call PLED_SetRow
2836 ; lfsr FSR2,letter
2837 ; movff hi,lo
2838 ; output_8
2839 ; call word_processor
2840 ; return
2841
2842
2843 PLED_MultiGF_deco_mask:
2844 ; movlw 0x30
2845 ; movwf wait_temp
2846 ; movff wait_temp,box_temp+1 ; row
2847 ; movlw 0xAA
2848 ; movwf wait_temp
2849 ; movff wait_temp,box_temp+0 ; color
2850 ; goto DD_hline ; returns
2851 return
2852
2853 PLED_MultiGF_deco_all:
2854 return
2855 ; movff char_O_actual_pointer,wait_temp
2856 ; movff char_O_GF_low_pointer,waitms_temp
2857 ; movf waitms_temp,F
2858 ; bz PLED_MultiGF_no_deco
2859 ; movf waitms_temp,W
2860 ; cpfsgt wait_temp
2861 ; bra PLED_MultiGF_actual_in_deco
2862 ; call PLED_MultiGF_clear_behind_depth
2863 ; movff char_O_GF_low_pointer,wait_temp
2864 ; incf wait_temp,F
2865 ; bra PLED_MultiGF_complete_list_only ; input wait_temp
2866 ;PLED_MultiGF_actual_in_deco:
2867 ; call PLED_MultiGF_gradient
2868 ; call PLED_MultiGF_time_at_deco
2869 ; call PLED_MultiGF_deco_depth_actual
2870 ; movff char_O_actual_pointer,wait_temp
2871 ;PLED_MultiGF_complete_list_only:
2872 ; call PLED_MultiGF_table ; input wait_temp
2873 ; return
2874
2875 ;PLED_MultiGF_table:
2876 ; movlw .043
2877 ; movwf temp5
2878 ; movlw .48 + .8
2879 ; movwf temp6
2880 ; movff char_O_GF_low_pointer,wait_temp
2881 ;PLED_MultiGF_loop:
2882 ; decfsz wait_temp,F
2883 ; bra PLED_MulitGF_nextentry
2884 ;
2885 ;; bra PLED_MultiGF_calc_tissue_counter
2886 ;;PLED_MGF_lp_calc_tis_counter:
2887 ;
2888 ;PLED_MGF_lp_clear_rem_space:
2889 ; lfsr FSR2,letter
2890 ; movlw ' '
2891 ; movwf POSTINC2
2892 ; movlw ' '
2893 ; movwf POSTINC2
2894 ; movlw ' '
2895 ; movwf POSTINC2
2896 ; movlw ' '
2897 ; movwf POSTINC2
2898 ; movlw ' '
2899 ; movwf POSTINC2
2900 ; movlw ' '
2901 ; movwf POSTINC2
2902 ; movlw .8
2903 ; subwf temp6,F
2904 ; bnz PLED_MultiGF_column_ok_space
2905 ; movlw .21
2906 ; subwf temp5,F
2907 ; bc PLED_MultiGF_new_row_space
2908 ; return
2909 ;PLED_MultiGF_new_row_space:
2910 ; movlw .48
2911 ; movwf temp6
2912 ;PLED_MultiGF_column_ok_space:
2913 ; movf temp5,W
2914 ; call PLED_SetColumn
2915 ; movlw .8
2916 ; subwf temp6,W
2917 ; call PLED_SetRow
2918 ; call word_processor
2919 ; bra PLED_MGF_lp_clear_rem_space
2920 ;
2921 ;PLED_MulitGF_nextentry:
2922 ; lfsr FSR2,letter
2923 ; movff wait_temp,lo ; pointer to meter
2924 ; movf lo,W
2925 ; rlncf lo,F
2926 ; addwf lo,F
2927 ; decfsz wait_temp,W
2928 ; bra PLED_MGF_skip_last_deco2
2929 ; movff char_I_depth_last_deco,lo
2930 ;PLED_MGF_skip_last_deco2:
2931 ; output_99
2932 ; movlw 0x02
2933 ; movwf POSTINC2
2934 ; movlw ':'
2935 ; movwf POSTINC2
2936 ; movlw 0x02
2937 ; movwf POSTINC2
2938 ; lfsr FSR0,0x250
2939 ; movf wait_temp,W
2940 ; movff PLUSW0,lo
2941 ; movlw d'10' ; gray code
2942 ; tstfsz lo
2943 ; movlw b'00001111' ; gray code
2944 ; movwf grayvalue
2945 ; bsf leftbind
2946 ; output_99
2947 ; bcf leftbind
2948 ; movlw ' '
2949 ; movwf POSTINC2
2950 ; movlw .8
2951 ; subwf temp6,F
2952 ; bnz PLED_MultiGF_column_ok
2953 ; movlw .21
2954 ; subwf temp5,F
2955 ; bc PLED_MultiGF_new_row
2956 ; return
2957 ;PLED_MultiGF_new_row:
2958 ; movlw .48
2959 ; movwf temp6
2960 ;PLED_MultiGF_column_ok:
2961 ; movf temp5,W
2962 ; call PLED_SetColumn
2963 ; movlw .8
2964 ; subwf temp6,W
2965 ; call PLED_SetRow
2966 ; call word_processor
2967 ; movlw b'00001111' ; gray code
2968 ; movwf grayvalue
2969 ; bra PLED_MultiGF_loop
2970 ;
2971 ;PLED_MultiGF_no_deco:
2972 ; DISPLAYTEXT d'242' ;"no deco"
2973 ; return
2974 ;
2975 ;PLED_MultiGF_depth:
2976 ; lfsr FSR2,letter
2977 ; movff rel_pressure+0,lo
2978 ; movff rel_pressure+1,hi
2979 ; call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mBar]
2980 ; bsf leftbind
2981 ; bsf ignore_digit5 ; do not display 1cm depth
2982 ; output_16dp d'3'
2983 ; bcf leftbind
2984 ; movlw .004
2985 ; movwf wait_temp
2986 ; movff wait_temp,0x086 ; left
2987 ; movlw .049
2988 ; movwf wait_temp
2989 ; movff wait_temp,0x087 ; top
2990 ; movlw .015
2991 ; movwf wait_temp
2992 ; movff wait_temp,0x088 ; heightmax
2993 ; movff dd_oled_brightness_offset,wait_temp
2994 ; movff wait_temp,0x089 ; oled_brightness_offset_const
2995 ; call main_DD2_write_incon24
2996 ; movlb b'00000001' ; Back to Bank1
2997 ; return
2998 ;
2999 ;PLED_MultiGF_deco_depth_actual:
3000 ; lfsr FSR2,letter
3001 ; movff char_O_actual_pointer,lo ; pointer to meter
3002 ; movf lo,W
3003 ; rlncf lo,F
3004 ; addwf lo,F
3005 ; movff char_O_actual_pointer,wait_temp ; test last_deco
3006 ; decfsz wait_temp,F
3007 ; bra PLED_MGF_skip_last_deco_depth
3008 ; movff char_I_depth_last_deco,lo
3009 ;PLED_MGF_skip_last_deco_depth:
3010 ; output_99
3011 ; movlw 'm'
3012 ; movwf POSTINC2
3013 ; movlw ' '
3014 ; movwf POSTINC2
3015 ; movlw .23
3016 ; call PLED_SetColumn
3017 ; movlw .57
3018 ; call PLED_SetRow
3019 ; goto word_processor
3020 ;
3021 ;PLED_MultiGF_gradient:
3022 ; lfsr FSR2,letter
3023 ; movff char_O_gradient_factor,lo
3024 ; bsf leftbind
3025 ; output_99
3026 ; bcf leftbind
3027 ; movlw '%'
3028 ; movwf POSTINC2
3029 ; movlw ' '
3030 ; movwf POSTINC2
3031 ; movlw .23
3032 ; call PLED_SetColumn
3033 ; movlw .49
3034 ; call PLED_SetRow
3035 ; goto word_processor
3036 ;
3037 ;PLED_MultiGF_time_at_deco:
3038 ; movlw .045
3039 ; movwf wait_temp
3040 ; movff wait_temp,0x086 ; left
3041 ; movlw .050
3042 ; movwf wait_temp
3043 ; movff wait_temp,0x087 ; top
3044 ; movlw .015
3045 ; movwf wait_temp
3046 ; movff wait_temp,0x088 ; heightmax
3047 ; movff dd_oled_brightness_offset,wait_temp
3048 ; movff wait_temp,0x089 ; oled_brightness_offset_const
3049 ; lfsr FSR2,letter
3050 ; lfsr FSR0,0x250
3051 ; movff char_O_actual_pointer,lo
3052 ; movf lo,W
3053 ; movff PLUSW0,lo
3054 ; bsf leftbind
3055 ; output_99
3056 ; movlw '<' ; Textmapping to "'"!
3057 ; movwf POSTINC2
3058 ; call main_DD2_write_incon24
3059 ; movlb b'00000001' ; Back to Bank1
3060 ; return
3061 ;
3062 ;PLED_MultiGF_clear_behind_depth:
3063 ; movlw 0x01
3064 ; movwf wait_temp
3065 ; movff wait_temp,width ; font select left side before decpoint
3066 ; movff wait_temp,box_temp+5 ; font select right side decpoint and after
3067 ; movlw .063
3068 ; movwf wait_temp
3069 ; movff wait_temp,box_temp+1 ; bottom row
3070 ; movlw .020
3071 ; movwf wait_temp
3072 ; movff wait_temp,box_temp+2 ; start column
3073 ; movlw .063
3074 ; movwf wait_temp
3075 ; movff wait_temp,box_temp+3 ; end column
3076 ; movlw .051
3077 ; movwf wait_temp
3078 ; movff wait_temp,box_temp+4 ; start column dec point
3079 ; lfsr FSR2,letter
3080 ;; call DD_Main
3081 ; return
3082 ;; movlw 0x31
3083 ; movwf wait_temp
3084 ; movff wait_temp,box_temp+1 ; row
3085 ; movlw 0x00
3086 ; movwf wait_temp
3087 ; movff wait_temp,box_temp+0 ; color
3088 ; call DD_hline
3089 ; return
3090 ;
3091
3092 ;PLED_MulitGF_nextentry_tissues:
3093 ; lfsr FSR2,letter
3094 ; lfsr FSR0,0x200
3095 ; rlncf wait_temp,W
3096 ; movff PLUSW0,lo
3097 ; addlw .001
3098 ; movff PLUSW0,hi
3099 ; output_16
3100 ; movlw ' '
3101 ; movwf POSTINC2
3102 ; movlw .8
3103 ; subwf temp6,F
3104 ; bnz PLED_MultiGF_column_ok_tissues
3105 ; movlw b'00001111' ; gray code
3106 ; movwf grayvalue
3107 ; movlw .21
3108 ; subwf temp5,F
3109 ; bc PLED_MultiGF_new_row_tissues
3110 ; return
3111 ;PLED_MultiGF_new_row_tissues:
3112 ; movlw .48
3113 ; movwf temp6
3114 ;PLED_MultiGF_column_ok_tissues:
3115 ; movf temp5,W
3116 ; call PLED_SetColumn
3117 ; movlw .8
3118 ; subwf temp6,W
3119 ; call PLED_SetRow
3120 ; call word_processor
3121 ; bra PLED_MultiGF_loop_tissues
3122 ;
3123
3124 ;PLED_MultiGF_uart_out:
3125 ; call rs232_wait_tx
3126 ;; header ff ff
3127 ; movlw 0xff
3128 ; movwf wait_temp
3129 ; movff wait_temp,TXREG
3130 ; call rs232_wait_tx
3131 ; movff wait_temp,TXREG
3132 ; call rs232_wait_tx
3133 ;; 2sec counter
3134 ; movff 0x290,TXREG
3135 ; call rs232_wait_tx
3136 ; movff 0x291,TXREG
3137 ; call rs232_wait_tx
3138 ;; movff ,TXREG
3139 ;; pres_respiration
3140 ; movff amb_pressure,TXREG
3141 ; call rs232_wait_tx
3142 ; movff amb_pressure+1,TXREG
3143 ; call rs232_wait_tx
3144 ;; pres_surface
3145 ; movff last_surfpressure,TXREG
3146 ; call rs232_wait_tx
3147 ; movff last_surfpressure+1,TXREG
3148 ; call rs232_wait_tx
3149 ;; tissue pres
3150 ; lfsr FSR0,0x200
3151 ; movlw .64
3152 ; movwf wait_temp
3153 ;pled_multigraf_tissue_uart_loop:
3154 ; movff POSTINC0,TXREG
3155 ; call rs232_wait_tx
3156 ; decfsz wait_temp
3157 ; bra pled_multigraf_tissue_uart_loop
3158 ;; movff ,TXREG
3159 ;; call rs232_wait_tx
3160 ; return
3161
3162 ;PLED_MulitGF_nextentry_debug:
3163 ; lfsr FSR2,letter
3164 ; movff wait_temp,lo
3165 ; output_99
3166 ; movlw 0x02
3167 ; movwf POSTINC2
3168 ; movlw ':'
3169 ; movwf POSTINC2
3170 ; movlw 0x02
3171 ; movwf POSTINC2
3172 ; lfsr FSR0,0x300
3173 ; movf wait_temp,W
3174 ; movff PLUSW0,lo
3175 ; output_99
3176 ; movlw ' '
3177 ; movwf POSTINC2
3178 ; movlw .8
3179 ; subwf temp6,F
3180 ; bnz PLED_MultiGF_column_ok_debug
3181 ; movlw b'00001111' ; gray code
3182 ; movwf grayvalue
3183 ; movlw .21
3184 ; subwf temp5,F
3185 ; bc PLED_MultiGF_new_row_debug
3186 ; return
3187 ;PLED_MultiGF_new_row_debug:
3188 ; movlw .48
3189 ; movwf temp6
3190 ;PLED_MultiGF_column_ok_debug:
3191 ; movf temp5,W
3192 ; call PLED_SetColumn
3193 ; movlw .8
3194 ; subwf temp6,W
3195 ; call PLED_SetRow
3196 ; call word_processor
3197 ; bra PLED_MultiGF_loop_debug
3198
3199 ;PLED_MultiGF_calc_tissue_counter:
3200 ; movlw d'8' ; gray code
3201 ; movwf grayvalue
3202 ; movff 0x290,lo
3203 ; movff 0x291,hi
3204 ; movlw '('
3205 ; movwf POSTINC2
3206 ; output_16
3207 ; movlw ')'
3208 ; movwf POSTINC2
3209 ; movlw .8
3210 ; subwf temp6,F
3211 ; bnz PLED_MGF_ok_col_calc_tis_cter
3212 ; movlw b'00001111' ; gray code
3213 ; movwf grayvalue
3214 ; movlw .21
3215 ; subwf temp5,F
3216 ; bc PLED_MGF_n_row_calc_tis_cter
3217 ; return
3218 ;PLED_MGF_n_row_calc_tis_cter:
3219 ; movlw .48
3220 ; movwf temp6
3221 ;PLED_MGF_ok_col_calc_tis_cter:
3222 ; movf temp5,W
3223 ; call PLED_SetColumn
3224 ; movlw .8
3225 ; subwf temp6,W
3226 ; call PLED_SetRow
3227 ; call word_processor
3228 ; bra PLED_MGF_lp_calc_tis_counter
3229 ;
3230
3231 ;PLED_debug_deko:
3232 ; movlw .009
3233 ; call PLED_SetColumn
3234 ; movlw .008
3235 ; call PLED_SetRow
3236 ; lfsr FSR2,letter
3237 ; movff char_O_deco_status,lo
3238 ; output_8
3239 ; call word_processor
3240 ;
3241 ; movlw .009
3242 ; call PLED_SetColumn
3243 ; movlw .016
3244 ; call PLED_SetRow
3245 ; lfsr FSR2,letter
3246 ; movff char_O_array_decodepth+0,lo
3247 ; output_8
3248 ; call word_processor
3249 ; return
3250 ;
3251
3252
3253
3254 adjust_depth_with_salinity: ; computes salinity setting into lo:hi [mBar]
3255
3256 btfsc simulatormode_active ; Do apply salinity in Simulatormode
3257 return
3258
3259 read_int_eeprom d'26' ; Read Salinity from EEPROM
3260 movff EEDATA, wait_temp ; salinity
3261
3262 movlw d'105' ; 105% ?
3263 cpfslt wait_temp ; Salinity higher limit
3264 return ; Out of limit, do not adjust lo:hi
3265
3266 movlw d'99' ; 99% ?
3267 cpfsgt wait_temp ; Salinity lower limit
3268 return ; Out of limit, do not adjust lo:hi
3269
3270 movff lo,xA+0
3271 movff hi,xA+1
3272
3273 movlw d'100'
3274 movwf xB+0
3275 clrf xB+1
3276
3277 call mult16x16 ;xA*xB=xC (lo:hi * 100)
3278
3279 movff wait_temp,xB+0 ; Salinity
3280 clrf xB+1
3281
3282 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
3283
3284 movff xC+0,lo
3285 movff xC+1,hi ; restore lo and hi with updated value
3286
3287 return