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