Mercurial > public > hwos_code
annotate src/tft_outputs.asm @ 300:5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
author | Janos Kovacs <kovjanos@gmail.com> |
---|---|
date | Sun, 31 May 2015 21:24:16 +0200 |
parents | 653a3ab08062 |
children | 9b1b0b32e7d5 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
3 ; File tft_outputs.asm | |
4 ; | |
5 ; Startup subroutines | |
6 ; | |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
10 ; 2011-08-07 : [mH] moving from OSTC code | |
11 | |
275 | 12 #include "hwos.inc" ; Mandatory header |
0 | 13 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c |
14 #include "tft.inc" | |
15 #include "wait.inc" | |
16 #include "strings.inc" | |
17 #include "convert.inc" | |
18 #include "varargs.inc" | |
19 #include "math.inc" | |
20 #include "isr.inc" | |
21 #include "eeprom_rs232.inc" | |
22 #include "adc_lightsensor.inc" | |
23 #include "surfmode.inc" | |
24 #include "divemode.inc" | |
25 #include "external_flash.inc" | |
26 #include "ghostwriter.inc" | |
27 #include "customview.inc" | |
28 #include "i2c.inc" | |
50 | 29 #include "colorschemes.inc" |
229 | 30 #include "calibrate.inc" |
0 | 31 |
32 extern aa_wordprocessor | |
33 | |
34 ;============================================================================= | |
35 | |
36 gui CODE | |
37 ;============================================================================= | |
38 | |
39 global TFT_divemask_color | |
40 TFT_divemask_color: | |
50 | 41 movlw color_green |
42 btfsc divemode ; in Divemode? | |
43 rcall TFT_divemask_color_dive | |
44 bra TFT_standard_color0 | |
45 | |
46 TFT_divemask_color_dive: | |
47 movff opt_dive_color_scheme,WREG ; 0-3 | |
48 incf WREG | |
49 dcfsnz WREG | |
50 bra TFT_divemask_colordive0 ;0 | |
51 dcfsnz WREG | |
52 bra TFT_divemask_colordive1 ;1 | |
53 dcfsnz WREG | |
54 bra TFT_divemask_colordive2 ;2 | |
55 dcfsnz WREG | |
56 bra TFT_divemask_colordive3 ;3 | |
57 TFT_divemask_colordive0: | |
58 movlw color_scheme_divemode_mask1 | |
59 return | |
60 TFT_divemask_colordive1: | |
61 movlw color_scheme_divemode_mask2 | |
62 return | |
63 TFT_divemask_colordive2: | |
64 movlw color_scheme_divemode_mask3 | |
65 return | |
66 TFT_divemask_colordive3: | |
67 movlw color_scheme_divemode_mask4 | |
68 return | |
69 | |
70 | |
71 global TFT_attention_color | |
72 TFT_attention_color: | |
73 movlw color_yellow | |
0 | 74 bra TFT_standard_color0 |
75 | |
76 global TFT_warnings_color | |
77 TFT_warnings_color: | |
78 movlw color_red ; TODO | |
79 bra TFT_standard_color0 | |
80 | |
81 global TFT_disabled_color | |
82 TFT_disabled_color: | |
83 movlw color_grey ; Default to OSTC grey (dark blue) | |
87 | 84 btfsc divemode ; in Divemode? |
85 rcall TFT_disabled_color_dive | |
0 | 86 bra TFT_standard_color0 |
87 | 87 TFT_disabled_color_dive: |
88 movff opt_dive_color_scheme,WREG ; 0-3 | |
89 incf WREG | |
90 dcfsnz WREG | |
91 bra TFT_disabled_colordive0 ;0 | |
92 dcfsnz WREG | |
93 bra TFT_disabled_colordive1 ;1 | |
94 dcfsnz WREG | |
95 bra TFT_disabled_colordive2 ;2 | |
96 dcfsnz WREG | |
97 bra TFT_disabled_colordive3 ;3 | |
98 TFT_disabled_colordive0: | |
99 movlw color_scheme_divemode_dis1 | |
100 return | |
101 TFT_disabled_colordive1: | |
102 movlw color_scheme_divemode_dis2 | |
103 return | |
104 TFT_disabled_colordive2: | |
105 movlw color_scheme_divemode_dis3 | |
106 return | |
107 TFT_disabled_colordive3: | |
108 movlw color_scheme_divemode_dis4 | |
109 return | |
0 | 110 |
111 global TFT_standard_color | |
112 TFT_standard_color: | |
87 | 113 setf WREG ; Default white |
50 | 114 btfsc divemode ; in Divemode? |
115 rcall TFT_standard_color_dive | |
0 | 116 TFT_standard_color0: |
117 call TFT_set_color | |
118 return | |
50 | 119 TFT_standard_color_dive: |
120 movff opt_dive_color_scheme,WREG ; 0-3 | |
121 incf WREG | |
122 dcfsnz WREG | |
123 bra TFT_standard_colordive0 ;0 | |
124 dcfsnz WREG | |
125 bra TFT_standard_colordive1 ;1 | |
126 dcfsnz WREG | |
127 bra TFT_standard_colordive2 ;2 | |
128 dcfsnz WREG | |
129 bra TFT_standard_colordive3 ;3 | |
130 TFT_standard_colordive0: | |
131 movlw color_scheme_divemode_std1 | |
132 return | |
133 TFT_standard_colordive1: | |
134 movlw color_scheme_divemode_std2 | |
135 return | |
136 TFT_standard_colordive2: | |
137 movlw color_scheme_divemode_std3 | |
138 return | |
139 TFT_standard_colordive3: | |
140 movlw color_scheme_divemode_std4 | |
141 return | |
0 | 142 |
143 TFT_color_code macro color_code_temp | |
144 movlw color_code_temp | |
145 call TFT_color_code1 | |
146 endm | |
147 | |
148 global TFT_color_code1 | |
149 TFT_color_code1: ; Color-codes the output, if required | |
150 dcfsnz WREG | |
151 bra TFT_color_code_depth ; depth_warn_mbar [mbar], 16Bit | |
152 dcfsnz WREG | |
153 bra TFT_color_code_cns ; color_code_cns_high [%] | |
154 dcfsnz WREG | |
155 bra TFT_color_code_gf ; color_code_gf_warn_high [%] | |
156 dcfsnz WREG | |
157 bra TFT_color_code_ppo2 ; Color-code the OC ppO2 results [cbar], opt_ppO2_max as threshold | |
158 dcfsnz WREG | |
159 bra TFT_color_code_velocity ; color_code_velocity_warn_high [m/min] | |
160 dcfsnz WREG | |
161 bra TFT_color_code_ceiling ; Show warning if current depth>shown ceiling | |
162 dcfsnz WREG | |
163 bra TFT_color_code_gaslist ; Color-code current row in Gaslist (%O2 in hi), opt_ppO2_max as threshold | |
164 dcfsnz WREG | |
165 bra TFT_color_code_ppo2_hud ; Color-code the hud ppO2 readings [cbar], opt_ppO2_max as threshold | |
166 dcfsnz WREG | |
167 bra TFT_color_code_battery ; Color-code the battery display | |
168 | |
169 TFT_color_code_gaslist: ; %O2 in hi | |
170 ; Check very high ppO2 manually | |
171 SAFE_2BYTE_COPY amb_pressure,xA | |
172 movlw d'10' | |
173 movwf xB+0 | |
174 clrf xB+1 | |
175 call div16x16 ; xC=p_amb/10 | |
176 movff xC+0,xA+0 | |
177 movff xC+1,xA+1 | |
178 movff hi,xB+0 | |
179 clrf xB+1 | |
180 call mult16x16 ; lo * p_amb/10 | |
181 ; Check if ppO2>6,55bar | |
182 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
183 bra TFT_warnings_color ; Yes, warn in warning color |
0 | 184 ; Check if ppO2>3,30bar |
185 btfsc xC+1,7 | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
186 bra TFT_warnings_color ; Yes, warn in warning color |
0 | 187 |
188 ; Check for low ppo2 | |
189 movff xC+0,sub_a+0 | |
190 movff xC+1,sub_a+1 | |
191 movff opt_ppO2_min,WREG | |
192 mullw d'100' ; opt_ppO2_min*100 | |
193 movff PRODL,sub_b+0 | |
194 movff PRODH,sub_b+1 | |
195 call subU16 | |
196 btfsc neg_flag | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
197 bra TFT_warnings_color ; too low -> Warning Color! |
0 | 198 |
199 ; Check for high ppo2 | |
200 movff opt_ppO2_max,WREG ; PPO2 Max for MOD calculation and color coding in divemode | |
201 mullw d'100' ; opt_ppO2_max*100 | |
202 movff PRODL,sub_b+0 | |
203 movff PRODH,sub_b+1 | |
204 call subU16 ; sub_c = sub_a - sub_b | |
205 btfss neg_flag | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
206 bra TFT_warnings_color ; too high -> Warning Color! |
0 | 207 return |
208 | |
209 TFT_color_code_ceiling: | |
210 SAFE_2BYTE_COPY rel_pressure, lo | |
211 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
212 movff hi,xA+1 | |
213 movff lo,xA+0 | |
214 movff char_O_first_deco_depth,lo ; Ceiling in m | |
215 decf lo,F ; -1 | |
216 movlw LOW d'100' | |
217 movwf xB+0 | |
218 clrf xB+1 ; Devide/100 -> xC+0 = Depth in m | |
219 call div16x16 ; xA/xB=xC with xA as remainder | |
220 movf xC+0,W ; Depth in m | |
221 subwf lo,W | |
222 btfsc STATUS,C | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
223 bra TFT_warnings_color ; Set to warning color |
0 | 224 call TFT_standard_color |
225 return | |
226 | |
227 TFT_color_code_depth: | |
228 movff hi,hi_temp | |
229 movff lo,lo_temp | |
230 SAFE_2BYTE_COPY rel_pressure, lo | |
231 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
232 movff lo,sub_a+0 | |
233 movff hi,sub_a+1 | |
234 movlw LOW depth_warn_mbar | |
235 movwf lo | |
236 movlw HIGH depth_warn_mbar | |
237 movwf hi | |
238 movff lo,sub_b+0 | |
239 movff hi,sub_b+1 | |
240 movff hi_temp,hi | |
241 movff lo_temp,lo ; Restore hi, lo | |
242 call subU16 ; sub_c = sub_a - sub_b | |
243 btfss neg_flag | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
244 bra TFT_color_code_depth_warn ; Set to warning color |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
245 call TFT_color_code_ppo2_depth ; check depth against MOD |
0 | 246 return |
247 | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
248 TFT_color_code_ppo2_depth: |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
249 SAFE_2BYTE_COPY amb_pressure, xA |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
250 movlw d'10' |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
251 movwf xB+0 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
252 clrf xB+1 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
253 call div16x16 ; xC=p_amb/10 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
254 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
255 movff xC+0,xA+0 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
256 movff xC+1,xA+1 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
257 movff char_I_O2_ratio,xB+0 ; =O2 ratio |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
258 clrf xB+1 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
259 call mult16x16 ; char_I_O2_ratio * p_amb/10 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
260 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
261 ; Check if ppO2>6,55bar |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
262 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
263 ;bra TFT_color_code_warn ; Yes, warn in warning color |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
264 bra TFT_color_code_depth_warn |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
265 ; Check if ppO2>3,30bar |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
266 btfsc xC+1,7 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
267 bra TFT_color_code_depth_warn |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
268 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
269 movff xC+0,sub_a+0 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
270 movff xC+1,sub_a+1 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
271 movff opt_ppO2_max,WREG ; PPO2 Max for MOD calculation and color coding in divemode |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
272 mullw d'100' |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
273 movff PRODL,sub_b+0 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
274 movff PRODH,sub_b+1 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
275 call subU16 ; sub_c = sub_a - sub_b |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
276 btfss neg_flag |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
277 bra TFT_color_code_depth_warn |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
278 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
279 movff xC+0,sub_a+0 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
280 movff xC+1,sub_a+1 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
281 movff opt_ppO2_min,WREG ; PPO2 min for Sensors and color coding in divemode |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
282 mullw d'100' |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
283 movff PRODL,sub_b+0 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
284 movff PRODH,sub_b+1 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
285 call subU16 ; sub_c = sub_a - sub_b |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
286 btfsc neg_flag |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
287 bra TFT_color_code_depth_warn |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
288 if dm_offset != 0 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
289 call TFT_standard_color |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
290 else |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
291 movlw color_green |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
292 call TFT_set_color |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
293 endif |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
294 bcf blinking_depth_warning ; reset warning |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
295 return |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
296 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
297 TFT_color_code_depth_warn: |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
298 bsf blinking_depth_warning ; Set warning |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
299 bra TFT_warnings_color ; Set to warning color |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
300 |
0 | 301 TFT_color_code_cns: |
302 movff int_O_CNS_fraction+1,lo ; copy into bank1 | |
303 tstfsz lo ; >255% ? | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
304 bra TFT_warnings_color ; Yes |
0 | 305 movff int_O_CNS_fraction+0,lo |
306 movlw color_code_cns_high ; CNS Warn [%] | |
307 subwf lo,W | |
308 btfsc STATUS,C | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
309 bra TFT_warnings_color ; Set to warning color |
0 | 310 call TFT_standard_color |
311 return | |
312 | |
313 TFT_color_code_gf: | |
314 movff char_O_gradient_factor,lo ; gradient factor | |
315 movlw color_code_gf_warn_high ; GF Warn [%] | |
316 subwf lo,W | |
317 btfsc STATUS,C | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
318 bra TFT_warnings_color ; Set to warning color |
0 | 319 call TFT_standard_color |
320 return | |
321 | |
322 TFT_color_code_ppo2: | |
323 ; Check if ppO2>6,55bar | |
324 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
325 bra TFT_warnings_color ; Yes, warn in warning color |
0 | 326 ; Check if ppO2>3,30bar |
327 btfsc xC+1,7 | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
328 bra TFT_warnings_color ; Yes, warn in warning color |
0 | 329 |
330 movff xC+0,sub_a+0 | |
331 movff xC+1,sub_a+1 | |
332 movff opt_ppO2_max,WREG ; PPO2 Max for MOD calculation and color coding in divemode | |
333 mullw d'100' | |
334 movff PRODL,sub_b+0 | |
335 movff PRODH,sub_b+1 | |
336 call subU16 ; sub_c = sub_a - sub_b | |
337 btfss neg_flag | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
338 bra TFT_warnings_color ; Set to warning color |
0 | 339 |
340 movff xC+0,sub_a+0 | |
341 movff xC+1,sub_a+1 | |
342 movff opt_ppO2_min,WREG ; PPO2 min for Sensors and color coding in divemode | |
343 mullw d'100' | |
344 movff PRODL,sub_b+0 | |
345 movff PRODH,sub_b+1 | |
346 call subU16 ; sub_c = sub_a - sub_b | |
347 btfsc neg_flag | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
348 bra TFT_warnings_color ; Set to warning color |
0 | 349 call TFT_standard_color |
350 return | |
351 | |
352 TFT_color_code_velocity: | |
52 | 353 btfss neg_flag ; Ignore for descent! |
0 | 354 bra TFT_color_code_velocity1 ; Skip check! |
355 movff divA+0,lo | |
356 movlw color_code_velocity_warn_high ; Velocity warn [m/min] | |
357 subwf lo,W | |
358 btfsc STATUS,C | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
359 bra TFT_warnings_color ; Set to warning color |
0 | 360 TFT_color_code_velocity1: |
361 call TFT_standard_color | |
362 return | |
363 | |
364 TFT_color_code_ppo2_hud: ; With ppO2 [cbar] in lo | |
365 movff opt_ppO2_max,WREG ; PPO2 Max for MOD calculation and color coding in divemode | |
366 cpfsgt lo ; lo > opt_ppO2_max? | |
367 bra TFT_color_code_ppo2_hud1; No | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
368 bra TFT_warnings_color ; Yes |
0 | 369 TFT_color_code_ppo2_hud1: |
370 movff opt_ppO2_min,WREG ; PPO2 min for Sensors and color coding in divemode | |
371 cpfslt lo ; lo < opt_ppO2_min? | |
372 bra TFT_color_code_ppo2_hud2; No | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
373 bra TFT_warnings_color ; Yes |
0 | 374 TFT_color_code_ppo2_hud2: |
375 call TFT_standard_color | |
376 return | |
377 | |
378 TFT_color_code_battery: ; With battery percent in lo | |
379 movlw color_code_battery_low | |
380 cpfsgt lo ; lo < color_code_battery_low ? | |
239
6c4ad243cb44
CNANGE: aGF pair has same range then normal GF pair
heinrichsweikamp
parents:
236
diff
changeset
|
381 bra TFT_warnings_color ; No |
0 | 382 call TFT_standard_color |
383 return | |
384 | |
385 ; **************************************************************************** | |
386 | |
234
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
387 global TFT_show_OC_startgas_surface |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
388 TFT_show_OC_startgas_surface: ; Show first gas and "OSTC2-like" active gases |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
389 ; Show first gas |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
390 WIN_SMALL surf_decotype_column+.1,surf_decotype_row+.30 |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
391 extern get_first_gas_to_WREG,gaslist_strcat_gas |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
392 call get_first_gas_to_WREG ; Gets first gas (0-4) into WREG |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
393 movwf PRODL |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
394 call gaslist_strcat_gas ; Input: PRODL : gas number (0..4), Output: Text appended into buffer pointed by FSR2. |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
395 STRCAT_PRINT "" |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
396 ; Show boxes |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
397 WIN_TOP surf_decotype_row+.30+.25 |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
398 WIN_LEFT surf_decotype_boxes_left1+.1 |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
399 rcall TFT_disabled_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
400 movff opt_gas_type+0,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
401 tstfsz hi |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
402 rcall TFT_standard_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
403 STRCPY_PRINT "1" |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
404 decfsz hi,F ; Type = 1 (First)? |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
405 bra DISP_active_gas_surfmode3 ; No, skip box |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
406 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left1, surf_decotype_boxes_left1+.8 ;top, bottom, left, right |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
407 DISP_active_gas_surfmode3: |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
408 rcall TFT_disabled_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
409 movff opt_gas_type+1,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
410 tstfsz hi |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
411 rcall TFT_standard_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
412 WIN_LEFT surf_decotype_boxes_left2+.1 |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
413 STRCPY_PRINT "2" |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
414 decfsz hi,F ; Type = 1 (First)? |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
415 bra DISP_active_gas_surfmode4 ; No, skip box |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
416 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left2, surf_decotype_boxes_left2+.8 ;top, bottom, left, right |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
417 DISP_active_gas_surfmode4: |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
418 rcall TFT_disabled_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
419 movff opt_gas_type+2,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
420 tstfsz hi |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
421 rcall TFT_standard_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
422 WIN_LEFT surf_decotype_boxes_left3+.1 |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
423 STRCPY_PRINT "3" |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
424 decfsz hi,F ; Type = 1 (First)? |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
425 bra DISP_active_gas_surfmode5 ; No, skip box |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
426 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left3, surf_decotype_boxes_left3+.8 ;top, bottom, left, right |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
427 DISP_active_gas_surfmode5: |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
428 rcall TFT_disabled_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
429 movff opt_gas_type+3,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
430 tstfsz hi |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
431 rcall TFT_standard_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
432 WIN_LEFT surf_decotype_boxes_left4+.1 |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
433 STRCPY_PRINT "4" |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
434 decfsz hi,F ; Type = 1 (First)? |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
435 bra DISP_active_gas_surfmode6 ; No, skip box |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
436 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left4, surf_decotype_boxes_left4+.8 ;top, bottom, left, right |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
437 DISP_active_gas_surfmode6: |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
438 call TFT_disabled_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
439 movff opt_gas_type+4,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
440 tstfsz hi |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
441 rcall TFT_standard_color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
442 WIN_LEFT surf_decotype_boxes_left5+.1 |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
443 STRCPY_PRINT "5" |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
444 rcall TFT_standard_color ; Reset color |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
445 decfsz hi,F ; Type = 1 (First)? |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
446 return ; no, Done. |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
447 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left5, surf_decotype_boxes_left5+.8 ;top, bottom, left, right |
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
231
diff
changeset
|
448 return ; Done. |
50 | 449 |
450 global TFT_show_color_schemes | |
451 TFT_show_color_schemes: ; update the color schemes | |
452 bsf divemode ; put in divemode | |
453 call TFT_divemask_color | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
454 WIN_TINY .12,.40 |
50 | 455 STRCAT_TEXT_PRINT tDepth |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
456 WIN_TINY .62,.40 |
50 | 457 STRCAT_TEXT_PRINT tMaxDepth |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
458 WIN_TINY .122,.40 |
50 | 459 STRCAT_TEXT_PRINT tDivetime |
460 | |
461 ; Show some demo screen | |
462 | |
463 ; Depth demo | |
464 call TFT_standard_color | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
465 WIN_MEDIUM .3,.54 |
50 | 466 movlw LOW .5172 |
467 movwf lo | |
468 movlw HIGH .5172 | |
469 movwf hi | |
470 bsf leftbind | |
471 bsf ignore_digit4 | |
472 output_16 ; Full meters in Big font | |
473 bcf leftbind | |
474 STRCAT_PRINT "" ; Display full meters | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
475 WIN_SMALL .25,.66 |
50 | 476 movlw LOW .5172 |
477 movwf lo | |
478 movlw HIGH .5172 | |
479 movwf hi | |
480 PUTC "." | |
481 movlw d'4' | |
482 movwf ignore_digits | |
483 bsf ignore_digit5 | |
484 output_16dp d'0' ; .1m in SMALL font | |
485 STRCAT_PRINT "" ; Display decimeters | |
486 WIN_FONT FT_SMALL | |
487 | |
488 ; Max. Depth demo | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
489 WIN_MEDIUM .64,.54 |
50 | 490 bsf ignore_digit4 ; no 0.1m |
491 bsf leftbind | |
492 movlw LOW .6349 | |
493 movwf lo | |
494 movlw HIGH .6349 | |
495 movwf hi | |
496 output_16 | |
497 STRCAT_PRINT "" ; Display full meters | |
498 bcf leftbind | |
499 ; .1m in SMALL font | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
500 WIN_SMALL .87,.66 |
50 | 501 PUTC "." |
502 movlw d'4' | |
503 movwf ignore_digits | |
504 bsf ignore_digit5 | |
505 bsf leftbind | |
506 movlw LOW .6349 | |
507 movwf lo | |
508 movlw HIGH .6349 | |
509 movwf hi | |
510 output_16dp d'0' | |
511 STRCAT_PRINT "" ; Display decimeters | |
512 bcf leftbind | |
513 | |
514 ; Divetime demo | |
515 movff mins,lo | |
516 clrf hi | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
517 WIN_MEDIUM .103, .54 |
225
31088352ee32
BUGFIX: Show dives with >999mins divetime correctly
heinrichsweikamp
parents:
220
diff
changeset
|
518 output_16_3 ; limit to 999 and display only (0-999) |
50 | 519 STRCAT_PRINT "" ; Show minutes in large font |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
520 WIN_SMALL .139, .66 ; left position for two sec figures |
50 | 521 PUTC ':' |
522 bsf leftbind | |
523 movff secs,lo | |
524 output_99x | |
525 bcf leftbind | |
526 STRCAT_PRINT "" ; Show seconds in small font | |
527 | |
528 bcf divemode ; don't stay in divemode | |
529 return | |
530 | |
0 | 531 global TFT_divemode_mask |
532 TFT_divemode_mask: ; Displays mask in Dive-Mode | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
533 if dm_offset != 0 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
534 call TFT_divemask_color |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
535 WIN_TINY dm_mask_depth_column,dm_mask_depth_row |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
536 STRCAT_TEXT_PRINT tDepth |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
537 WIN_TINY dm_mask_maxdepth_column,dm_mask_maxdepth_row |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
538 STRCAT_TEXT_PRINT tMaxDepth |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
539 WIN_TINY dm_mask_divetime_column,dm_mask_divetime_row |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
540 STRCAT_TEXT_PRINT tDivetime |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
541 endif |
0 | 542 call TFT_standard_color |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
543 return |
0 | 544 |
545 global TFT_clear_customview_divemode | |
546 TFT_clear_customview_divemode: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
547 WIN_BOX_BLACK dm_customview_row, dm_customview_bot, dm_customview_column, dm_customview_rgt ; top, bottom, left, right |
0 | 548 return |
549 | |
550 global TFT_display_velocity | |
551 TFT_display_velocity: ; With divA+0 = m/min | |
552 TFT_color_code warn_velocity ; Color-code Output (With divA+0 = m/min) | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
553 WIN_SMALL dm_velocity_text_column, dm_velocity_text_row |
0 | 554 |
555 TSTOSS opt_units ; 0=Meters, 1=Feets | |
556 bra TFT_display_velocity_metric | |
557 ;TFT_display_velocity_imperial: | |
558 movff divA+0,WREG ; divA+0 = m/min | |
559 mullw .100 ; PRODL:PRODH = mbar/min | |
560 movff PRODL,lo | |
561 movff PRODH,hi | |
562 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
563 movlw '-' | |
564 btfsc neg_flag | |
565 movlw '+' | |
566 movwf POSTINC2 | |
567 bsf leftbind | |
568 output_16 | |
569 bcf leftbind | |
570 STRCAT_TEXT_PRINT tVelImperial ; Unit switch | |
571 call TFT_standard_color | |
572 return | |
573 | |
574 TFT_display_velocity_metric: | |
575 movff divA+0,lo ; divA+0 = m/min | |
576 movlw '-' | |
577 btfsc neg_flag | |
578 movlw '+' | |
579 movwf POSTINC2 | |
580 output_99 | |
581 STRCAT_TEXT_PRINT tVelMetric ; Unit switch | |
582 call TFT_standard_color | |
583 return | |
584 | |
585 global TFT_display_velocity_clear | |
586 TFT_display_velocity_clear: | |
587 ; Clear Text | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
588 WIN_BOX_BLACK dm_velocity_text_row, dm_velocity_text_bot, dm_velocity_text_column, dm_velocity_text_rgt ; top, bottom, left, right |
0 | 589 return |
590 | |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
591 global TFT_clear_decoarea |
0 | 592 TFT_clear_decoarea: |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
593 WIN_BOX_BLACK dm_decostop_1st_stop_row, .239, dm_decostop_1st_stop_column, .159 ; top, bottom, left, right |
0 | 594 return |
595 | |
596 global TFT_clear_divemode_menu | |
597 TFT_clear_divemode_menu: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
598 if dm_offset != 0 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
599 WIN_BOX_BLACK dm_menu_row, dm_menu_lower, dm_menu_left, dm_menu_right ; top, bottom, left, right |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
600 else |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
601 WIN_BOX_BLACK dm_3rdrow_top, dm_3rdrow_bot, dm_3rdrow_lft, dm_3rdrow_rgt ; top, bottom, left, right |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
602 endif |
0 | 603 return |
604 | |
605 global TFT_display_ndl_mask | |
606 TFT_display_ndl_mask: | |
607 btfsc divemode_menu ; Is the dive mode menu shown? | |
608 return ; Yes, return | |
609 rcall TFT_clear_decoarea ; Clear Dekostop and Dekosum | |
610 call TFT_divemask_color | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
611 WIN_STD dm_ndl_text_column, dm_ndl_text_row |
0 | 612 STRCPY_TEXT_PRINT tNDL ; NDL |
613 call TFT_standard_color | |
614 return | |
615 | |
616 global TFT_show_TTS_divemode | |
617 TFT_show_TTS_divemode: | |
618 btfsc divemode_menu ; Is the dive mode menu shown? | |
619 return ; Yes, return | |
620 call TFT_standard_color | |
621 movff int_O_ascenttime+0,lo ; TTS | |
622 movff int_O_ascenttime+1,hi ; on 16bits | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
623 WIN_MEDIUM dm_tts_value_column, dm_tts_value_row |
0 | 624 output_16_3 ;Displays only 0...999 |
625 STRCAT_PRINT "'" | |
626 return | |
627 | |
628 global TFT_display_ndl | |
629 TFT_display_ndl: | |
630 btfsc divemode_menu ; Is the dive mode menu shown? | |
631 return ; Yes, return | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
632 WIN_MEDIUM dm_ndl_value_column, dm_ndl_value_row |
0 | 633 call TFT_standard_color |
634 movff char_O_nullzeit,lo ; Get NDL from C-code | |
635 output_8 | |
636 STRCAT_PRINT "'" | |
637 return | |
638 | |
639 global TFT_divemode_warning | |
640 TFT_divemode_warning: | |
641 bsf dive_warning_displayed ; =1: The warning sign is shown | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
642 WIN_TOP dm_warning_icon_row |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
643 WIN_LEFT dm_warning_icon_column |
252 | 644 TFT_WRITE_PROM_IMAGE dive_warning2_block ; Show Warning icon |
645 return | |
0 | 646 |
647 global TFT_divemode_warning_clear | |
648 TFT_divemode_warning_clear: | |
649 btfss dive_warning_displayed ; =1: The warning sign is shown | |
650 return | |
651 bcf dive_warning_displayed ; clear only once | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
652 WIN_BOX_BLACK dm_warning_icon_row, dm_warning_icon_bot, dm_warning_icon_column, dm_warning_icon_rgt ; top, bottom, left, right |
0 | 653 return |
654 | |
655 global TFT_display_deko_mask | |
656 TFT_display_deko_mask: | |
657 rcall TFT_clear_decoarea | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
658 WIN_STD dm_tts_text_column, dm_tts_text_row |
0 | 659 call TFT_divemask_color |
660 STRCPY_TEXT_PRINT tTTS ; TTS | |
661 call TFT_standard_color | |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
662 bcf show_safety_stop ; Clear safety stop flag |
0 | 663 return |
664 | |
665 TFT_display_deko_output_depth: ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | |
666 TSTOSS opt_units ; 0=m, 1=ft | |
667 bra TFT_display_deko_output_metric | |
668 ;TFT_display_deko_output_imperial: | |
669 movf lo,W ; lo = m | |
670 mullw .100 ; PRODL:PRODH = mbar | |
671 movff PRODL,lo | |
672 movff PRODH,hi | |
673 ; Convert with 334feet/100m to have 10ft, 20ft, 30ft stops... | |
674 movff lo,xA+0 | |
675 movff hi,xA+1 | |
676 movlw LOW d'334' ; 334feet/100m | |
677 movwf xB+0 | |
678 movlw HIGH d'334' | |
679 movwf xB+1 | |
680 call mult16x16 ; xA*xB=xC (lo:hi * 328) | |
681 movlw d'50' ; round up | |
682 addwf xC+0,F | |
683 movlw 0 | |
684 addwfc xC+1,F | |
685 addwfc xC+2,F | |
686 addwfc xC+3,F | |
687 movlw d'100' | |
688 movwf xB+0 | |
689 clrf xB+1 | |
690 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
691 movff xC+0,lo | |
692 movff xC+1,hi ; restore lo and hi with updated value | |
693 bcf leftbind | |
694 bsf ignore_digit4 ; Only full feet | |
695 output_16 | |
696 STRCAT_TEXT tFeets1 | |
697 return | |
698 | |
699 TFT_display_deko_output_metric: | |
700 output_99 | |
701 STRCAT_TEXT tMeters | |
702 PUTC ' ' | |
703 return | |
704 | |
705 global TFT_display_deko | |
706 TFT_display_deko: | |
707 btfsc divemode_menu ; Is the dive mode menu shown? | |
708 return ; Yes, return | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
709 WIN_MEDIUM dm_decostop_1st_stop_column, dm_decostop_1st_stop_row |
0 | 710 TFT_color_code warn_ceiling ; Color-code Output |
711 movff char_O_first_deco_depth,lo ; Ceiling in m | |
712 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | |
713 movff char_O_first_deco_time,lo ; length of first stop in min | |
714 output_99 | |
715 STRCAT_PRINT "'" | |
716 call TFT_standard_color | |
717 return | |
718 | |
719 global TFT_decoplan | |
720 TFT_decoplan: | |
721 call TFT_divemask_color | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
722 WIN_TINY dm_custom_decoplan_title_column, dm_custom_decoplan_title_row |
0 | 723 STRCPY_TEXT_PRINT tDiveDecoplan |
724 call TFT_standard_color | |
725 | |
726 movff char_O_deco_depth+1,lo | |
727 tstfsz lo ; Show another stop? | |
728 bra TFT_display_deko2 ; Yes | |
729 ; No, clear output and return | |
730 call TFT_standard_color | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
731 WIN_SMALL dm_cust_dstop_4th_stop_column,dm_cust_dstop_4th_stop_row |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
96
diff
changeset
|
732 STRCPY_PRINT " --- " |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
733 WIN_BOX_BLACK dm_cust_dstop_2nd_stop_row, dm_customview_bot, dm_cust_dstop_2nd_stop_column, dm_cust_dstop_4th_stop_column ; top, bottom, left, right |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
734 WIN_BOX_BLACK dm_cust_dstop_5th_stop_row, dm_customview_bot, dm_cust_dstop_5th_stop_column, dm_cust_dstop_6th_stop_column ; top, bottom, left, right |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
735 WIN_BOX_BLACK dm_cust_dstop_6th_stop_row, dm_customview_bot, dm_cust_dstop_6th_stop_column, .159 ; top, bottom, left, right |
0 | 736 return |
737 TFT_display_deko2: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
738 WIN_SMALL dm_cust_dstop_2nd_stop_column, dm_cust_dstop_2nd_stop_row |
0 | 739 movff char_O_deco_depth+1,lo ; stop in m |
740 bcf lo,7 ; Clear GAS_SWITCH bit | |
741 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | |
742 movff char_O_deco_time+1,lo ; length of stop in min | |
743 output_99 | |
744 STRCAT_PRINT "'" | |
745 movff char_O_deco_depth+2,lo | |
746 tstfsz lo ; Show another stop? | |
747 bra TFT_display_deko3 ; Yes | |
748 ; No, clear output and return | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
749 WIN_BOX_BLACK dm_cust_dstop_3rd_stop_row, dm_customview_bot, dm_cust_dstop_2nd_stop_column, dm_cust_dstop_4th_stop_column ; top, bottom, left, right |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
750 WIN_BOX_BLACK dm_cust_dstop_4th_stop_row, dm_customview_bot, dm_cust_dstop_4th_stop_column, .159 ; top, bottom, left, right |
0 | 751 return |
752 | |
753 TFT_display_deko3: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
754 WIN_SMALL dm_cust_dstop_3rd_stop_column, dm_cust_dstop_3rd_stop_row |
0 | 755 movff char_O_deco_depth+2,lo ; stop in m |
756 bcf lo,7 ; Clear GAS_SWITCH bit | |
757 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | |
758 movff char_O_deco_time+2,lo ; length of stop in min | |
759 output_99 | |
760 STRCAT_PRINT "'" | |
761 | |
762 movff char_O_deco_depth+3,lo | |
763 tstfsz lo ; Show another stop? | |
764 bra TFT_display_deko4 ; Yes | |
765 ; No, clear output and return | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
766 WIN_BOX_BLACK dm_cust_dstop_4th_stop_row, dm_customview_bot, dm_cust_dstop_4th_stop_column, .159 ; top, bottom, left, right |
0 | 767 return ; Done. |
768 | |
769 TFT_display_deko4: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
770 WIN_SMALL dm_cust_dstop_4th_stop_column, dm_cust_dstop_4th_stop_row |
0 | 771 movff char_O_deco_depth+3,lo ; stop in m |
772 bcf lo,7 ; Clear GAS_SWITCH bit | |
773 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | |
774 movff char_O_deco_time+3,lo ; length of stop in min | |
775 output_99 | |
776 STRCAT_PRINT "'" | |
777 | |
778 movff char_O_deco_depth+4,lo | |
779 tstfsz lo ; Show another stop? | |
780 bra TFT_display_deko5 ; Yes | |
781 ; No, clear output and return | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
782 WIN_BOX_BLACK dm_cust_dstop_5th_stop_row, dm_customview_bot, dm_cust_dstop_5th_stop_column, dm_cust_dstop_6th_stop_column ; top, bottom, left, right |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
783 WIN_BOX_BLACK dm_cust_dstop_6th_stop_row, dm_customview_bot, dm_cust_dstop_6th_stop_column, .159 ; top, bottom, left, right |
0 | 784 return ; Done. |
785 | |
786 TFT_display_deko5: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
787 WIN_SMALL dm_cust_dstop_5th_stop_column, dm_cust_dstop_5th_stop_row |
0 | 788 movff char_O_deco_depth+4,lo ; stop in m |
789 bcf lo,7 ; Clear GAS_SWITCH bit | |
790 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | |
791 movff char_O_deco_time+4,lo ; length of stop in min | |
792 output_99 | |
793 STRCAT_PRINT "'" | |
794 movff char_O_deco_depth+5,lo | |
795 tstfsz lo ; Show another stop? | |
796 bra TFT_display_deko6 ; Yes | |
797 ; No, clear output and return | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
798 WIN_BOX_BLACK dm_cust_dstop_6th_stop_row, dm_customview_bot, dm_cust_dstop_6th_stop_column, .159 ; top, bottom, left, right |
0 | 799 return ; Done. |
800 TFT_display_deko6: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
801 WIN_SMALL dm_cust_dstop_6th_stop_column, dm_cust_dstop_6th_stop_row |
0 | 802 movff char_O_deco_depth+5,lo ; stop in m |
803 bcf lo,7 ; Clear GAS_SWITCH bit | |
804 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | |
805 movff char_O_deco_time+5,lo ; length of stop in min | |
806 output_99 | |
807 STRCAT_PRINT "'" | |
808 movff char_O_deco_depth+6,lo | |
809 tstfsz lo ; Show another stop? | |
810 bra TFT_display_deko7 ; Yes | |
811 ; No, clear output and return | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
812 WIN_BOX_BLACK dm_cust_dstop_7th_stop_row, dm_customview_bot, dm_cust_dstop_7th_stop_column, .159 ; top, bottom, left, right |
0 | 813 return ; Done. |
814 TFT_display_deko7: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
815 WIN_SMALL dm_cust_dstop_7th_stop_column, dm_cust_dstop_7th_stop_row |
0 | 816 movff char_O_deco_depth+6,lo ; stop in m |
817 bcf lo,7 ; Clear GAS_SWITCH bit | |
818 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) | |
819 movff char_O_deco_time+6,lo ; length of stop in min | |
820 output_99 | |
821 STRCAT_PRINT "'" | |
822 return ; Done. | |
823 | |
824 ;TFT_display_deko1: | |
825 ; movff char_O_gradient_factor,lo ; gradient factor | |
826 ; movlw gf_display_threshold ; threshold for display | |
827 ; cpfslt lo ; show value? | |
828 ; bra TFT_display_deko2 ; Yes | |
829 ; ; No | |
830 ; bra TFT_display_ndl_mask2 ; Clear gradient factor | |
831 ; | |
832 | |
131 | 833 global TFT_clear_safety_stop |
834 TFT_clear_safety_stop: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
835 WIN_BOX_BLACK dm_safetystop_row, dm_safetystop_bot, dm_safetystop_text_column, .159 ; top, bottom, left, right |
131 | 836 return |
837 | |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
838 global TFT_show_safety_stop |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
839 TFT_show_safety_stop: |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
840 tstfsz safety_stop_countdown ; Countdown at zero? |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
841 bra TFT_show_safety_stop2 ; No, show stop |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
842 |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
843 bcf show_safety_stop ; Clear flag |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
844 |
131 | 845 btfss safety_stop_active ; Displayed? |
846 return ; No | |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
847 bcf safety_stop_active ; Clear flag |
131 | 848 btfsc divemode_menu ; Is the dive mode menu shown? |
849 return ; Yes, return | |
850 rcall TFT_clear_safety_stop ; Yes, Clear stop | |
851 return | |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
852 |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
853 TFT_show_safety_stop2: |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
854 bsf safety_stop_active ; Set flag |
131 | 855 decf safety_stop_countdown,F ; Reduce countdown |
856 | |
857 btfsc divemode_menu ; Is the dive mode menu shown? | |
858 return ; Yes, return | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
859 ;btfsc menuview |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
860 ;bra TFT_show_safety_stop3 ; No room when menuview=1... |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
861 if dm_offset != 0 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
862 call TFT_divemask_color |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
863 else |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
864 call TFT_standard_color |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
865 endif |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
866 WIN_STD dm_safetystop_text_column, dm_safetystop_text_row |
131 | 867 STRCPY_TEXT_PRINT tDiveSafetyStop |
868 TFT_show_safety_stop3: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
869 call TFT_attention_color ; show in yellow |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
870 WIN_MEDIUM dm_safetystop_column, dm_safetystop_row |
131 | 871 lfsr FSR2,buffer |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
872 movff safety_stop_countdown,lo |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
873 clrf hi |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
874 call convert_time ; converts hi:lo in seconds to mins (hi) and seconds (lo) |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
875 movf hi,W |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
876 movff lo,hi |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
877 movwf lo ; exchange lo and hi |
131 | 878 bsf leftbind |
879 output_8 | |
880 bcf leftbind | |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
881 PUTC ':' |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
882 movff hi,lo |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
883 output_99x |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
884 STRCAT_PRINT "" |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
885 WIN_FONT FT_SMALL |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
886 call TFT_standard_color |
104
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
887 return |
223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
heinrichsweikamp
parents:
102
diff
changeset
|
888 |
0 | 889 global TFT_mask_avr_stopwatch ; Show mask for average depth and stopwatch |
890 TFT_mask_avr_stopwatch: | |
891 ; The mask | |
892 call TFT_divemask_color | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
893 WIN_TINY dm_custom_avr_stop_title_column1,dm_custom_avr_stop_title_row |
0 | 894 STRCPY_TEXT_PRINT tDiveTotalAvr |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
895 WIN_TINY dm_custom_avr_stop_title_column2,dm_custom_avr_stop_title_row |
0 | 896 STRCPY_TEXT_PRINT tDiveStopwatch |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
897 WIN_TINY dm_custom_avr_stop_title_column3,dm_custom_avr_stop_title_row |
0 | 898 STRCPY_TEXT_PRINT tDiveStopAvr |
899 call TFT_standard_color | |
900 return | |
901 | |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
902 global TFT_dyn_gaslist |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
903 TFT_dyn_gaslist: ; Show the dynamic gaslist |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
904 ; The mask |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
905 call TFT_divemask_color |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
906 WIN_TINY dm_custom_dyn_gas_mask_column,dm_custom_dyn_gas_mask_row |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
907 STRCPY_TEXT_PRINT tGaslist |
262 | 908 ; call TFT_standard_color |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
909 |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
910 WIN_SMALL dm_custom_dyn_gas_column1,dm_custom_dyn_gas_row1 |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
911 movlw .1 |
262 | 912 movwf uart1_temp |
139 | 913 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint |
54 | 914 rcall TFT_dyn_gaslist_common |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
915 WIN_SMALL dm_custom_dyn_gas_column1,dm_custom_dyn_gas_row2 |
262 | 916 incf uart1_temp,F ; +1 |
917 movf uart1_temp,W ; into W | |
54 | 918 rcall TFT_dyn_gaslist_common |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
919 WIN_SMALL dm_custom_dyn_gas_column2,dm_custom_dyn_gas_row1 |
262 | 920 incf uart1_temp,F ; +1 |
921 movf uart1_temp,W ; into W | |
54 | 922 rcall TFT_dyn_gaslist_common |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
923 WIN_SMALL dm_custom_dyn_gas_column2,dm_custom_dyn_gas_row2 |
262 | 924 incf uart1_temp,F ; +1 |
925 movf uart1_temp,W ; into W | |
54 | 926 rcall TFT_dyn_gaslist_common |
927 call TFT_standard_color | |
928 return | |
929 | |
930 TFT_dyn_gaslist_common: | |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
931 cpfseq active_gas ;1-5 |
262 | 932 bra TFT_dyn_gaslist_common2 |
933 incf uart1_temp,F ; +1 | |
934 TFT_dyn_gaslist_common2: | |
935 movff uart1_temp,lo ; gas number 1-5 | |
936 movff uart1_temp,PRODL | |
53
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
937 decf PRODL,F ;-1 to have 0-4 |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
938 bsf leftbind |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
939 output_8 ; Gas number |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
940 bcf leftbind |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
941 PUTC ":" |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
942 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
943 PUTC " " ; Clearing space |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
944 movlw 0x00 |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
945 movff WREG,buffer+.11 ; limit to 11 chars |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
946 STRCAT_PRINT "" |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
947 return |
2825f1d2262f
NEW: Dynamic Gaslist in OC mode (Divemode, Customview 7)
heinrichsweikamp
parents:
52
diff
changeset
|
948 |
54 | 949 |
0 | 950 global TFT_update_avr_stopwatch ; Update average depth and stopwatch |
951 TFT_update_avr_stopwatch: | |
952 call TFT_standard_color | |
953 SAFE_2BYTE_COPY average_divesecs,lo | |
954 call convert_time ; lo=secs, hi=mins | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
955 WIN_MEDIUM dm_custom_avr_stop_column2,dm_custom_avr_stop_row |
0 | 956 bsf leftbind |
957 movf hi,W | |
958 movff lo,hi | |
959 movwf lo ; exchange lo and hi | |
960 output_8 | |
961 PUTC ':' | |
962 movff hi,lo | |
963 output_99x | |
964 movlw .5 | |
965 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
966 clrf WREG | |
967 movff WREG,buffer+.5 ; limit to 5 chars | |
968 STRCAT_PRINT "" | |
969 | |
970 TSTOSS opt_units ; 0=m, 1=ft | |
971 bra TFT_update_avr_stopwatch_metric | |
972 ;TFT_update_avr_stopwatch_imperial | |
973 movff avr_rel_pressure_total+0,lo | |
974 movff avr_rel_pressure_total+1,hi | |
975 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
976 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
977 WIN_MEDIUM dm_custom_avr_stop_column1,dm_custom_avr_stop_row |
0 | 978 bsf leftbind |
979 output_16 ; yxz | |
980 STRCAT_PRINT " " | |
981 ; Stopped average depth | |
982 movff avr_rel_pressure+0,lo | |
983 movff avr_rel_pressure+1,hi | |
984 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
985 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
986 WIN_MEDIUM dm_custom_avr_stop_column3,dm_custom_avr_stop_row |
0 | 987 output_16 ; yxz |
988 bcf leftbind | |
989 STRCAT_PRINT " " | |
990 return | |
991 | |
992 TFT_update_avr_stopwatch_metric: | |
993 ; Non-resettable average depth | |
994 movff avr_rel_pressure_total+0,lo | |
995 movff avr_rel_pressure_total+1,hi | |
996 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
997 WIN_MEDIUM dm_custom_avr_stop_column1,dm_custom_avr_stop_row |
0 | 998 bsf ignore_digit5 ; no cm |
999 output_16dp .3 ; yxz.a | |
231
834e1c35160c
BUGFIX: Show average depth with one decimal digit only
mh@mh-THINK
parents:
229
diff
changeset
|
1000 STRCAT_PRINT " " |
0 | 1001 ; Stopped average depth |
1002 movff avr_rel_pressure+0,lo | |
1003 movff avr_rel_pressure+1,hi | |
1004 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1005 WIN_MEDIUM dm_custom_avr_stop_column3,dm_custom_avr_stop_row |
0 | 1006 bsf ignore_digit5 ; no cm |
1007 output_16dp .3 ; yxz.a | |
1008 bcf leftbind | |
1009 bcf ignore_digit5 | |
231
834e1c35160c
BUGFIX: Show average depth with one decimal digit only
mh@mh-THINK
parents:
229
diff
changeset
|
1010 STRCAT_PRINT " " |
0 | 1011 return |
1012 | |
123 | 1013 global TFT_ceiling_mask ; The ceiling mask |
1014 TFT_ceiling_mask: | |
1015 call TFT_divemask_color | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1016 WIN_TINY dm_custom_ceiling_text_column,dm_custom_ceiling_text_row |
123 | 1017 STRCPY_TEXT_PRINT tCeiling |
1018 call TFT_standard_color | |
1019 return | |
1020 | |
1021 global TFT_ceiling ; Ceiling | |
1022 TFT_ceiling: | |
1023 call TFT_standard_color | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1024 WIN_MEDIUM dm_custom_ceiling_value_column,dm_custom_ceiling_value_row |
123 | 1025 movff int_O_ceiling+0,lo |
1026 movff int_O_ceiling+1,hi | |
1027 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
1028 bsf leftbind | |
1029 TSTOSS opt_units ; 0=m, 1=ft | |
1030 bra TFT_ceiling_metric | |
1031 ;TFT_ceiling_imperial | |
1032 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
1033 output_16 ; yxz | |
1034 bcf leftbind | |
1035 STRCAT_PRINT " " | |
1036 return | |
1037 | |
1038 TFT_ceiling_metric: | |
1039 bsf ignore_digit5 ; no cm | |
1040 output_16dp .3 ; yxz.a | |
1041 bcf leftbind | |
1042 bcf ignore_digit5 | |
1043 STRCAT_PRINT " " | |
1044 return | |
1045 | |
0 | 1046 global TFT_hud_mask ; The HUD mask |
1047 TFT_hud_mask: | |
1048 call TFT_divemask_color | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1049 WIN_TINY dm_custom_hud_column1,dm_custom_hud_row |
0 | 1050 STRCPY_TEXT_PRINT tDiveHudMask1 |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1051 WIN_TINY dm_custom_hud_column2,dm_custom_hud_row |
0 | 1052 STRCPY_TEXT_PRINT tDiveHudMask2 |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1053 WIN_TINY dm_custom_hud_column3,dm_custom_hud_row |
0 | 1054 STRCPY_TEXT_PRINT tDiveHudMask3 |
1055 call TFT_standard_color | |
1056 return | |
1057 | |
102
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1058 global TFT_hud_voltages |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1059 TFT_hud_voltages: ; Show HUD details |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1060 WIN_SMALL dm_custom_hud_sensor1_column,dm_custom_hud_data_row |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1061 call TFT_standard_color |
192 | 1062 btfss use_O2_sensor1 |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1063 call TFT_warnings_color |
102
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1064 movff o2_mv_sensor1+0,lo |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1065 movff o2_mv_sensor1+1,hi |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1066 bsf leftbind |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1067 output_16dp .4 ; x.xx |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1068 bcf leftbind |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1069 STRCAT_PRINT "mV " |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1070 WIN_SMALL dm_custom_hud_sensor2_column,dm_custom_hud_data_row |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1071 call TFT_standard_color |
192 | 1072 btfss use_O2_sensor2 |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1073 call TFT_warnings_color |
102
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1074 movff o2_mv_sensor2+0,lo |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1075 movff o2_mv_sensor2+1,hi |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1076 bsf leftbind |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1077 output_16dp .4 ; x.xx |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1078 bcf leftbind |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1079 STRCAT_PRINT "mV " |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1080 WIN_SMALL dm_custom_hud_sensor3_column,dm_custom_hud_data_row |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1081 call TFT_standard_color |
192 | 1082 btfss use_O2_sensor3 |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1083 call TFT_warnings_color |
102
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1084 movff o2_mv_sensor3+0,lo |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1085 movff o2_mv_sensor3+1,hi |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1086 bsf leftbind |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1087 output_16dp .4 ; x.xx |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1088 bcf leftbind |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1089 STRCAT_PRINT "mV " |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1090 call TFT_standard_color |
102
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1091 return |
37275e0fa7f5
NEW: Show End-of-Dive time together with clock during deco
heinrichsweikamp
parents:
99
diff
changeset
|
1092 |
192 | 1093 global TFT_update_ppo2_sensors ; Update Sensor data |
1094 TFT_update_ppo2_sensors: | |
0 | 1095 ; show three sensors |
1096 bsf leftbind | |
192 | 1097 btfsc use_O2_sensor1 ; Use Sensor 1? |
1098 bra TFT_update_hud1 ; Yes | |
0 | 1099 btfss dive_hud1_displayed ; Was the sensor shown? |
1100 bra TFT_update_hud2 ; Yes, skip clear | |
1101 bcf dive_hud1_displayed ; No, clear display flag | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1102 WIN_BOX_BLACK dm_custom_hud_data_row, dm_customview_bot, dm_custom_hud_sensor1_column, dm_custom_hud_sensor2_column ; top, bottom, left, right |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1103 WIN_STD dm_custom_hud_sensor1_column+.7, dm_custom_hud_data_row+.5 |
0 | 1104 call TFT_standard_color |
1105 STRCPY_PRINT "---" | |
1106 bra TFT_update_hud2 ; Skip Sensor 1 | |
1107 TFT_update_hud1: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1108 WIN_MEDIUM dm_custom_hud_sensor1_column,dm_custom_hud_data_row |
192 | 1109 movff o2_ppo2_sensor1,lo |
0 | 1110 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo |
192 | 1111 btfss voting_logic_sensor1 ; Sensor within voting logic? |
1112 bsf win_invert ; No, invert output... | |
1113 btfss voting_logic_sensor1 | |
1114 call TFT_warnings_color ; ... and draw in red | |
0 | 1115 clrf hi |
1116 output_16dp .3 ; x.xx bar | |
1117 STRCAT_PRINT "" | |
192 | 1118 bcf win_invert |
0 | 1119 bsf dive_hud1_displayed ; Set display flag |
1120 TFT_update_hud2: | |
192 | 1121 btfsc use_O2_sensor2 ; Use Sensor 2? |
1122 bra TFT_update_hud3 ; Yes | |
0 | 1123 btfss dive_hud2_displayed ; Was the sensor shown? |
1124 bra TFT_update_hud4 ; Yes, skip clear | |
1125 bcf dive_hud2_displayed ; No, clear display flag | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1126 WIN_BOX_BLACK dm_custom_hud_data_row, dm_customview_bot, dm_custom_hud_sensor2_column, dm_custom_hud_sensor3_column ; top, bottom, left, right |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1127 WIN_STD dm_custom_hud_sensor2_column+.7, dm_custom_hud_data_row+.5 |
0 | 1128 call TFT_standard_color |
1129 STRCPY_PRINT "---" | |
1130 bra TFT_update_hud4 ; Skip Sensor 2 | |
1131 TFT_update_hud3: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1132 WIN_MEDIUM dm_custom_hud_sensor2_column,dm_custom_hud_data_row |
192 | 1133 movff o2_ppo2_sensor2,lo |
0 | 1134 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo |
192 | 1135 btfss voting_logic_sensor2 ; Sensor within voting logic? |
1136 bsf win_invert ; No, invert output... | |
1137 btfss voting_logic_sensor2 | |
1138 call TFT_warnings_color ; ... and draw in red | |
0 | 1139 clrf hi |
1140 output_16dp .3 ; x.xx bar | |
1141 STRCAT_PRINT "" | |
192 | 1142 bcf win_invert |
0 | 1143 bsf dive_hud2_displayed ; Set display flag |
1144 TFT_update_hud4: | |
192 | 1145 btfsc use_O2_sensor3 ; Use Sensor 3? |
1146 bra TFT_update_hud5 ; Yes | |
0 | 1147 btfss dive_hud3_displayed ; Was the sensor shown? |
1148 bra TFT_update_hud6 ; Yes, skip clear | |
1149 bcf dive_hud3_displayed ; No, clear display flag | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1150 WIN_BOX_BLACK dm_custom_hud_data_row, dm_customview_bot, dm_custom_hud_sensor3_column, .159 ; top, bottom, left, right |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1151 WIN_STD dm_custom_hud_sensor3_column+.7, dm_custom_hud_data_row+.5 |
0 | 1152 call TFT_standard_color |
1153 STRCPY_PRINT "---" | |
1154 bra TFT_update_hud6 ; Skip Sensor 3 | |
1155 TFT_update_hud5: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1156 WIN_MEDIUM dm_custom_hud_sensor3_column,dm_custom_hud_data_row |
192 | 1157 movff o2_ppo2_sensor3,lo |
0 | 1158 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo |
192 | 1159 btfss voting_logic_sensor3 ; Sensor within voting logic? |
1160 bsf win_invert ; No, invert output... | |
1161 btfss voting_logic_sensor3 | |
1162 call TFT_warnings_color ; ... and draw in red | |
0 | 1163 clrf hi |
1164 output_16dp .3 ; x.xx bar | |
1165 STRCAT_PRINT "" | |
192 | 1166 bcf win_invert |
0 | 1167 bsf dive_hud3_displayed ; Set display flag |
1168 TFT_update_hud6: | |
1169 bcf leftbind | |
1170 call TFT_standard_color | |
1171 return | |
1172 | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1173 global TFT_surface_sensor ; Update Sensor data in surface mode |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1174 TFT_surface_sensor: |
249 | 1175 movf hardware_flag,W |
1176 sublw 0x11 ; 2 with BLE | |
1177 btfsc STATUS,Z | |
1178 return ; Ignore for 0x11 | |
1179 | |
0 | 1180 ; show three sensors |
1181 bsf leftbind | |
1182 WIN_SMALL surf_hud_sensor1_column,surf_hud_sensor1_row | |
192 | 1183 btfsc use_O2_sensor1 ; Use Sensor 1? |
1184 bra TFT_surface_sensor1 ; Yes | |
0 | 1185 call TFT_standard_color |
1186 STRCPY_PRINT "--- " | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1187 bra TFT_surface_sensor2 ; Skip Sensor 1 |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1188 TFT_surface_sensor1: |
192 | 1189 movff o2_ppo2_sensor1,lo |
0 | 1190 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo |
1191 clrf hi | |
1192 output_16dp .3 ; x.xx bar | |
1193 STRCAT_PRINT "" | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1194 TFT_surface_sensor2: |
0 | 1195 WIN_SMALL surf_hud_sensor2_column,surf_hud_sensor2_row |
192 | 1196 btfsc use_O2_sensor2 ; Use Sensor 2? |
1197 bra TFT_surface_sensor3 ; Yes | |
0 | 1198 call TFT_standard_color |
1199 STRCPY_PRINT "--- " | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1200 bra TFT_surface_sensor4 ; Skip Sensor 2 |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1201 TFT_surface_sensor3: |
192 | 1202 movff o2_ppo2_sensor2,lo |
0 | 1203 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo |
1204 clrf hi | |
1205 output_16dp .3 ; x.xx bar | |
1206 STRCAT_PRINT "" | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1207 TFT_surface_sensor4: |
0 | 1208 WIN_SMALL surf_hud_sensor3_column,surf_hud_sensor3_row |
192 | 1209 btfsc use_O2_sensor3 ; Use Sensor 3? |
1210 bra TFT_surface_sensor5 ; Yes | |
0 | 1211 call TFT_standard_color |
1212 STRCPY_PRINT "--- " | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1213 bra TFT_surface_sensor6 ; Skip Sensor 3 |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1214 TFT_surface_sensor5: |
192 | 1215 movff o2_ppo2_sensor3,lo |
0 | 1216 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo |
1217 clrf hi | |
1218 output_16dp .3 ; x.xx bar | |
1219 STRCAT_PRINT "" | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
1220 TFT_surface_sensor6: |
0 | 1221 bcf leftbind |
1222 call TFT_standard_color | |
1223 return | |
1224 | |
1225 global TFT_menu_hud | |
1226 TFT_menu_hud: ; Yes, update HUD data | |
247
5968af2839a4
BUGFIX: Always update CCR sensor data in Sensor-Menu
heinrichsweikamp
parents:
239
diff
changeset
|
1227 call compute_ppo2 ; compute mv_sensorX and ppo2_sensorX arrays |
50 | 1228 call TFT_attention_color ; show in yellow |
0 | 1229 bsf leftbind |
1230 WIN_SMALL surf_menu_sensor1_column,surf_menu_sensor1_row | |
1231 movff o2_ppo2_sensor1,lo | |
1232 clrf hi | |
1233 output_16dp .3 ; x.xx bar | |
1234 PUTC "," | |
1235 movff o2_mv_sensor1+0,lo ; in 0.1mV steps | |
1236 movff o2_mv_sensor1+1,hi ; in 0.1mV steps | |
1237 output_16dp .4 ; xxx.y mV | |
1238 STRCAT_PRINT "mV " | |
1239 WIN_SMALL surf_menu_sensor2_column,surf_menu_sensor2_row | |
1240 movff o2_ppo2_sensor2,lo | |
1241 clrf hi | |
1242 output_16dp .3 ; x.xx bar | |
1243 PUTC "," | |
1244 movff o2_mv_sensor2+0,lo ; in 0.1mV steps | |
1245 movff o2_mv_sensor2+1,hi ; in 0.1mV steps | |
1246 output_16dp .4 ; xxx.y mV | |
1247 STRCAT_PRINT "mV " | |
1248 WIN_SMALL surf_menu_sensor3_column,surf_menu_sensor3_row | |
1249 movff o2_ppo2_sensor3,lo | |
1250 clrf hi | |
1251 output_16dp .3 ; x.xx bar | |
1252 PUTC "," | |
1253 movff o2_mv_sensor3+0,lo ; in 0.1mV steps | |
1254 movff o2_mv_sensor3+1,hi ; in 0.1mV steps | |
1255 output_16dp .4 ; xxx.y mV | |
1256 STRCAT_PRINT "mV " | |
1257 WIN_SMALL surf_menu_sensor4_column,surf_menu_sensor4_row | |
113 | 1258 |
236 | 1259 btfss analog_o2_input |
113 | 1260 bra TFT_menu_hud_2 ; always for normal OSTC3 |
1261 btfss s8_digital | |
1262 return ; Not for analog | |
1263 TFT_menu_hud_2: | |
0 | 1264 STRCPY "Batt:" |
1265 movff hud_battery_mv+0,lo ; in mV | |
1266 movff hud_battery_mv+1,hi ; in mV | |
1267 output_16dp .2 ; x.yyy V | |
1268 STRCAT_PRINT "V" | |
1269 call TFT_standard_color | |
1270 bcf leftbind | |
1271 return | |
1272 | |
187
669b5d00706d
CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents:
180
diff
changeset
|
1273 global TFT_menu_calibrate |
669b5d00706d
CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents:
180
diff
changeset
|
1274 TFT_menu_calibrate: ; update mV data in calibration menu |
229 | 1275 call compute_ppo2 ; compute mv_sensorX and ppo2_sensorX arrays |
113 | 1276 call TFT_attention_color ; show in yellow |
1277 bsf leftbind | |
1278 WIN_SMALL surf_menu_sensor1_column,surf_menu2_sensor1_row | |
1279 movff o2_mv_sensor1+0,lo ; in 0.1mV steps | |
1280 movff o2_mv_sensor1+1,hi ; in 0.1mV steps | |
1281 output_16dp .4 ; xxx.y mV | |
1282 STRCAT_PRINT "mV " | |
1283 WIN_SMALL surf_menu_sensor2_column,surf_menu2_sensor2_row | |
1284 movff o2_mv_sensor2+0,lo ; in 0.1mV steps | |
1285 movff o2_mv_sensor2+1,hi ; in 0.1mV steps | |
1286 output_16dp .4 ; xxx.y mV | |
1287 STRCAT_PRINT "mV " | |
1288 WIN_SMALL surf_menu_sensor3_column,surf_menu2_sensor3_row | |
1289 movff o2_mv_sensor3+0,lo ; in 0.1mV steps | |
1290 movff o2_mv_sensor3+1,hi ; in 0.1mV steps | |
1291 output_16dp .4 ; xxx.y mV | |
1292 STRCAT_PRINT "mV " | |
187
669b5d00706d
CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents:
180
diff
changeset
|
1293 ; WIN_SMALL surf_menu2_ambient_column,surf_menu2_ambient_row |
669b5d00706d
CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents:
180
diff
changeset
|
1294 ; PUTC "@" |
669b5d00706d
CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents:
180
diff
changeset
|
1295 ; SAFE_2BYTE_COPY amb_pressure, lo |
669b5d00706d
CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents:
180
diff
changeset
|
1296 ; output_16 |
669b5d00706d
CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents:
180
diff
changeset
|
1297 ; STRCAT_TEXT tMBAR ; mbar |
669b5d00706d
CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents:
180
diff
changeset
|
1298 ; STRCAT_PRINT " " |
113 | 1299 call TFT_standard_color |
1300 bcf leftbind | |
1301 return | |
1302 | |
0 | 1303 global TFT_clock |
1304 TFT_clock: | |
48 | 1305 WIN_SMALL surf_clock_column,surf_clock_row |
0 | 1306 TFT_clock2: ; called from divemode clock |
1307 call TFT_standard_color | |
1308 movff hours,lo | |
1309 output_99 | |
1310 movlw ':' | |
1311 btfss secs,0 ; blinking every second | |
1312 movlw ' ' | |
1313 movwf POSTINC2 | |
1314 movff mins,lo | |
1315 output_99x | |
1316 STRCAT_PRINT "" | |
1317 return | |
1318 | |
1319 global TFT_show_time_date_menu | |
1320 TFT_show_time_date_menu: | |
1321 call speed_fastest | |
1322 WIN_SMALL .15,.30 | |
1323 call TFT_standard_color | |
1324 movff hours,lo | |
1325 output_99 | |
1326 PUTC ':' | |
1327 movff mins,lo | |
1328 output_99x | |
1329 PUTC ':' | |
1330 movff secs,lo | |
1331 output_99x | |
1332 STRCAT " - " | |
1333 movff month,convert_value_temp+0 | |
1334 movff day,convert_value_temp+1 | |
1335 movff year,convert_value_temp+2 | |
1336 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | |
1337 STRCAT_PRINT " " | |
1338 return | |
1339 ;============================================================================= | |
1340 | |
1341 global TFT_interval | |
1342 TFT_interval: | |
1343 call TFT_warning_set_window ; Sets the row and column for the current warning | |
1344 tstfsz WREG ; Is there room for the warning? | |
1345 return ; No | |
1346 STRCPY "Int:" | |
1347 movff surface_interval+0,lo | |
1348 movff surface_interval+1,hi | |
1349 call convert_time ; lo=mins, hi=hours | |
1350 movf hi,W | |
1351 movff lo,hi | |
1352 movwf lo ; exchange lo and hi | |
1353 output_99x | |
1354 PUTC ':' | |
1355 movff hi,lo | |
1356 output_99x | |
1357 movlw surf_warning_length ; No, use surface string length | |
1358 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
1359 STRCAT_PRINT "" | |
1360 return | |
1361 | |
41 | 1362 global TFT_surface_decosettings ; Show all deco settings |
1363 TFT_surface_decosettings: | |
1364 ; Deco Mode | |
1365 call TFT_standard_color | |
1366 movff char_I_deco_model,WREG | |
1367 iorwf WREG | |
1368 bnz TFT_surface_decosettings1 | |
1369 | |
1370 ; Display ZH-L16 sat/desat model. | |
1371 TEXT_SMALL surf_gaslist_column,surf_gaslist_row, tZHL16 | |
122
3e84e2a64188
Show %'s for non-GF deco model in surface mode
heinrichsweikamp
parents:
118
diff
changeset
|
1372 WIN_TOP surf_gaslist_row+(surf_gaslist_spacing*.1) |
41 | 1373 lfsr FSR2,buffer |
1374 movff char_I_desaturation_multiplier,lo | |
1375 bsf leftbind | |
1376 output_8 | |
1377 STRCAT "%/" | |
1378 movff char_I_saturation_multiplier,lo | |
1379 output_8 | |
1380 STRCAT_PRINT "%" | |
1381 bra TFT_surface_decosettings2 | |
1382 | |
1383 ; Display ZH-L16-GF low/high model. | |
1384 TFT_surface_decosettings1: | |
1385 TEXT_SMALL surf_gaslist_column,surf_gaslist_row, tZHL16GF | |
1386 WIN_TOP surf_gaslist_row+(surf_gaslist_spacing*.1) | |
42 | 1387 STRCPY_TEXT tGF ; GF: |
41 | 1388 movff char_I_GF_Low_percentage,lo |
1389 output_99x | |
42 | 1390 STRCAT "/" |
41 | 1391 movff char_I_GF_High_percentage,lo |
1392 output_99x | |
42 | 1393 STRCAT_PRINT "" |
41 | 1394 ;bra TFT_surface_decosettings2 |
1395 TFT_surface_decosettings2: | |
1396 ; FTTS | |
1397 WIN_TOP surf_gaslist_row+(surf_gaslist_spacing*.2) | |
1398 STRCPY_TEXT tFTTSMenu | |
1399 movff char_I_extra_time,lo | |
1400 bsf leftbind | |
1401 output_8 | |
1402 STRCAT_TEXT_PRINT tMinutes | |
1403 | |
1404 ; Last Stop | |
1405 WIN_TOP surf_gaslist_row+(surf_gaslist_spacing*.3) | |
1406 STRCPY_TEXT tLastDecostop | |
1407 movff char_I_depth_last_deco,lo | |
1408 output_8 | |
1409 STRCAT_TEXT_PRINT tMeters | |
1410 | |
1411 ; Salinity | |
1412 WIN_TOP surf_gaslist_row+(surf_gaslist_spacing*.4) | |
1413 STRCPY_TEXT tDvSalinity | |
1414 movff opt_salinity,lo | |
1415 output_8 | |
1416 bcf leftbind | |
1417 STRCAT_TEXT_PRINT tPercent | |
1418 return ; Done. | |
0 | 1419 |
1420 global TFT_debug_output | |
1421 TFT_debug_output: | |
117 | 1422 return |
113 | 1423 WIN_TINY .80,.0 |
1424 call TFT_standard_color | |
1425 lfsr FSR2,buffer | |
262 | 1426 movff active_gas,lo |
203 | 1427 output_8 |
0 | 1428 STRCAT_PRINT "" |
123 | 1429 return |
0 | 1430 |
55 | 1431 global TFT_divetimeout ; Show timeout counter |
1432 TFT_divetimeout: | |
1433 call TFT_warning_set_window ; Sets the row and column for the current warning | |
1434 tstfsz WREG ; Is there room for the warning? | |
1435 return ; No | |
1436 | |
1437 call TFT_standard_color | |
1438 STRCPY 0x94 ; "End of dive" icon | |
1439 movlw LOW divemode_timeout | |
1440 movwf sub_a+0 | |
1441 movlw HIGH divemode_timeout | |
1442 movwf sub_a+1 | |
1443 movff timeout_counter,sub_b+0 | |
1444 movff timeout_counter2,sub_b+1 | |
1445 call subU16 ; sub_c = sub_a - sub_b (with UNSIGNED values) | |
1446 movff sub_c+0, lo | |
1447 movff sub_c+1, hi | |
1448 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
1449 movf hi,W | |
1450 movff lo,hi | |
1451 movwf lo ; exchange lo and hi | |
1452 output_99x | |
1453 PUTC ':' | |
1454 movff hi,lo | |
1455 output_99x | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1456 movlw dm_warning_length ; Divemode string length |
55 | 1457 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) |
1458 STRCAT_PRINT "" | |
1459 return | |
1460 | |
0 | 1461 global TFT_ftts |
1462 TFT_ftts: | |
1463 movff char_I_extra_time,lo | |
1464 tstfsz lo | |
1465 bra $+4 | |
1466 return ; char_I_extra_time=0, return. | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1467 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1468 if dm_offset !=0 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1469 incf warning_counter,F ; increase counter |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1470 call TFT_warning_set_window ; Sets the row and column for the current warning |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1471 tstfsz WREG ; Is there room for the warning? |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1472 return ; No |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1473 else |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1474 call TFT_standard_color |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1475 WIN_SMALL dm_ftts_value_column, dm_ftts_value_row |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1476 endif |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1477 |
0 | 1478 movff char_I_extra_time,lo |
1479 STRCPY "@+" | |
1480 bsf leftbind | |
1481 output_8 | |
1482 PUTC ":" | |
1483 movff int_O_extra_ascenttime+0,lo | |
1484 movff int_O_extra_ascenttime+1,hi | |
1485 movf lo,W | |
1486 iorwf hi,W ; extra_ascenttime == 0 ? | |
1487 bz TFT_ftts2 ; No deco | |
1488 movf lo,W ; extra_ascenttime == 0xFFFF ? | |
1489 andwf hi,W | |
1490 incf WREG,w | |
1491 bz TFT_ftts2 ; Wait... | |
1492 output_16 | |
1493 bcf leftbind | |
1494 PUTC "'" | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1495 movlw dm_warning_length ; Divemode string length |
0 | 1496 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) |
1497 STRCAT_PRINT "" | |
1498 return | |
1499 | |
1500 TFT_ftts2: | |
1501 STRCAT "---" | |
1502 bcf leftbind | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1503 movlw dm_warning_length ; Divemode string length |
0 | 1504 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) |
1505 STRCAT_PRINT "" | |
1506 return | |
1507 | |
1508 | |
1509 ;============================================================================= | |
1510 | |
1511 global TFT_temp_surfmode | |
1512 TFT_temp_surfmode: | |
1513 WIN_SMALL surf_temp_column,surf_temp_row | |
1514 call TFT_standard_color | |
1515 | |
1516 SAFE_2BYTE_COPY temperature, lo | |
1517 | |
1518 TSTOSS opt_units ; 0=°C, 1=°F | |
1519 bra TFT_temp_surfmode_metric | |
1520 | |
1521 ;TFT_temp_surfmode_imperial: | |
214 | 1522 rcall TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required |
0 | 1523 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit |
1524 lfsr FSR2,buffer ; Overwrite "-" | |
1525 bsf ignore_digit5 ; Full degrees only | |
1526 output_16 | |
1527 STRCAT_PRINT "" | |
1528 call TFT_divemask_color | |
1529 WIN_SMALL surf_temp_column+4*8,surf_temp_row | |
1530 STRCPY_PRINT "°F" | |
1531 return | |
1532 | |
1533 TFT_temp_surfmode_metric: | |
214 | 1534 rcall TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required |
0 | 1535 movlw d'3' |
1536 movwf ignore_digits | |
1537 bsf ignore_digit5 ; Full degrees only | |
1538 output_16 | |
1539 | |
13
2af021c66b0d
fix negative temperature display in surfacemode
heinrichsweikamp
parents:
11
diff
changeset
|
1540 ; read-back the buffer+4 |
2af021c66b0d
fix negative temperature display in surfacemode
heinrichsweikamp
parents:
11
diff
changeset
|
1541 movff buffer+4,lo |
0 | 1542 movlw " " ; Space |
1543 cpfseq lo ; Was it a space (between +1°C and -1°C)? | |
1544 bra TFT_temp_surfmode1 ; No. | |
1545 movlw "0" ; Yes, print manual zero | |
1546 movff WREG,buffer+3 | |
1547 bra TFT_temp_surfmode2 | |
1548 TFT_temp_surfmode1: | |
1549 ; Test if output was negative (Flag set in TFT_convert_signed_16bit) | |
1550 btfss neg_flag ; Negative temperature? | |
1551 bra TFT_temp_surfmode3 ; No, continue | |
1552 ; Yes, negative temperature! | |
1553 movff buffer+3,buffer+2 ; remove two spaces manually | |
1554 movff buffer+4,buffer+3 | |
1555 TFT_temp_surfmode2: | |
1556 movlw 0x00 | |
1557 movff WREG,buffer+4 | |
1558 TFT_temp_surfmode3: | |
1559 STRCAT_PRINT "" | |
1560 call TFT_divemask_color | |
1561 WIN_SMALL surf_temp_column+4*8,surf_temp_row | |
1562 STRCPY_PRINT "°C" | |
1563 return | |
1564 | |
1565 ;============================================================================= | |
1566 global TFT_divemode_menu_cursor | |
1567 TFT_divemode_menu_cursor: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1568 WIN_BOX_BLACK dm_menu_row+.1, dm_menu_lower-.1, dm_menu_item1_column-.8, dm_menu_item1_column-.1 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1569 WIN_BOX_BLACK dm_menu_row+.1, dm_menu_lower-.1, dm_menu_item4_column-.8, dm_menu_item4_column-.1 |
0 | 1570 call TFT_standard_color |
1571 | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1572 movlw dm_menu_item1_column-.8 |
0 | 1573 btfsc menupos,2 ; >3? |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1574 movlw dm_menu_item4_column-.8 ; Yes |
0 | 1575 movff WREG,win_leftx2 |
1576 | |
1577 movff menupos,lo ; Copy menu pos | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1578 movlw dm_menu_item6_row |
0 | 1579 dcfsnz lo,F |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1580 movlw dm_menu_item1_row |
0 | 1581 dcfsnz lo,F |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1582 movlw dm_menu_item2_row |
0 | 1583 dcfsnz lo,F |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1584 movlw dm_menu_item3_row |
0 | 1585 dcfsnz lo,F |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1586 movlw dm_menu_item4_row |
0 | 1587 dcfsnz lo,F |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1588 movlw dm_menu_item5_row |
0 | 1589 movff WREG,win_top |
1590 movlw FT_SMALL | |
1591 movff WREG,win_font | |
1592 STRCPY_PRINT "\xb7" ; print cursor | |
1593 return | |
1594 | |
1595 global TFT_temp_divemode | |
1596 TFT_temp_divemode: | |
1597 btfsc divemode_menu ; Is the dive mode menu shown? | |
1598 return ; Yes, return | |
1599 btfsc blinking_better_gas ; blinking better Gas? | |
1600 return ; Yes, no update of temperature now | |
1601 ; temperature | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1602 WIN_SMALL dm_temp_column,dm_temp_row |
0 | 1603 call TFT_standard_color |
1604 bsf leftbind | |
1605 | |
1606 SAFE_2BYTE_COPY temperature, lo | |
1607 TSTOSS opt_units ; 0=°C, 1=°F | |
1608 bra TFT_temp_divemode_metric | |
1609 | |
1610 ;TFT_temp_divemode_imperial: | |
214 | 1611 rcall TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required |
0 | 1612 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit |
1613 lfsr FSR2,buffer ; Overwrite "-" (There won't be less then -18°C underwater...) | |
1614 bsf ignore_digit5 ; Full degrees only | |
1615 output_16 | |
1616 STRCAT_TEXT tLogTunitF | |
1617 TFT_temp_divemode_common: | |
1618 bcf leftbind | |
1619 movlw .4 ; limit to three chars | |
1620 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
1621 STRCAT_PRINT "" | |
1622 return ; Done. | |
1623 | |
1624 TFT_temp_divemode_metric: | |
214 | 1625 rcall TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required |
0 | 1626 movlw d'3' |
1627 movwf ignore_digits | |
1628 bsf ignore_digit5 ; Full degrees only | |
1629 output_16 | |
1630 STRCAT_TEXT tLogTunitC | |
1631 bra TFT_temp_divemode_common ; Done. | |
1632 | |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1633 TFT_active_setpoint2: |
0 | 1634 movff char_I_const_ppO2,lo |
1635 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo | |
1636 clrf hi | |
1637 bsf leftbind | |
1638 output_16dp d'3' | |
1639 bcf leftbind | |
1640 STRCAT_TEXT tbar | |
1641 TSTOSS opt_ccr_mode ; =0: Fixed SP, =1: Sensor | |
1642 bra $+4 | |
1643 PUTC "*" | |
1644 STRCAT_PRINT "" | |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1645 return |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1646 |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1647 TFT_active_setpoint: ; Show setpoint |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1648 WIN_STD dm_active_gas_column, dm_active_gas_row |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1649 call TFT_standard_color |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1650 btfsc is_bailout ; =1: Bailout |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1651 bra TFT_active_setpoint_bail ; Show "Bailout" instead of Setpoint |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1652 |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1653 rcall TFT_active_setpoint2 ; show setpoint (Non-Inverted in all cases) |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1654 |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1655 btfss setpoint_fallback ; =1: Fallback to SP1 due to external O2 sensor failure |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1656 bra TFT_active_setpoint_diluent ; Done. |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1657 btg blinking_setpoint ; Toggle blink bit... |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1658 btfss blinking_setpoint ; blink now? |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1659 bra TFT_active_setpoint_diluent ; Done. |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1660 |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1661 movlw color_yellow ; Blink in yellow |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1662 call TFT_set_color |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
1663 bsf win_invert ; Set invert flag |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1664 WIN_STD dm_active_gas_column, dm_active_gas_row |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1665 movff char_I_const_ppO2,lo |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1666 clrf hi |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1667 bsf leftbind |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1668 output_16dp d'3' |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1669 bcf leftbind |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1670 STRCAT_TEXT tbar |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1671 TSTOSS opt_ccr_mode ; =0: Fixed SP, =1: Sensor |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1672 bra $+4 |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1673 PUTC "*" |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
1674 STRCAT_PRINT "" |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
1675 bcf win_invert ; Reset invert flag |
0 | 1676 |
1677 TFT_active_setpoint_diluent: | |
1678 call TFT_standard_color | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1679 if dm_offset != 0 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1680 WIN_SMALL dm_active_dil_column, dm_active_dil_row |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1681 else |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1682 WIN_STD dm_active_dil_column, dm_active_dil_row |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1683 endif |
0 | 1684 movff char_I_O2_ratio,lo ; lo now stores O2 in % |
1685 movff char_I_He_ratio,hi ; hi now stores He in % | |
1686 rcall TFT_show_dil_divemode2 ; Show diluent (Non-Inverted in all cases) | |
1687 | |
1688 btfss better_gas_available ; =1: A better gas is available and a gas change is advised in divemode | |
1689 return ; Done. | |
1690 btg blinking_better_gas ; Toggle blink bit... | |
1691 btfss blinking_better_gas ; blink now? | |
1692 return ; No, Done. | |
1693 | |
1694 movlw color_yellow ; Blink in yellow | |
1695 call TFT_set_color | |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
1696 bsf win_invert ; Set invert flag |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1697 if dm_offset != 0 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1698 WIN_SMALL dm_active_dil_column, dm_active_dil_row |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1699 else |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1700 WIN_STD dm_active_dil_column, dm_active_dil_row |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1701 endif |
0 | 1702 movff char_I_O2_ratio,lo ; lo now stores O2 in % |
1703 movff char_I_He_ratio,hi ; hi now stores He in % | |
1704 rcall TFT_show_dil_divemode2 ; Show gas | |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
1705 bcf win_invert ; Reset invert flag |
0 | 1706 call TFT_standard_color |
1707 return ; Done. | |
1708 | |
1709 TFT_show_dil_divemode2: | |
1710 call customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 | |
1711 STRCAT_PRINT "" | |
1712 return | |
1713 | |
1714 TFT_active_setpoint_bail: | |
1715 STRCPY_TEXT_PRINT tDiveBailout ; Bailout | |
1716 bra TFT_active_setpoint_diluent | |
1717 | |
1718 global TFT_active_gas_divemode | |
1719 TFT_active_gas_divemode: ; Display gas/Setpoint | |
1720 btfsc divemode_menu ; Is the dive mode menu shown? | |
1721 return ; Yes, return | |
1722 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode | |
1723 return | |
1724 btfsc FLAG_ccr_mode ; in CCR mode | |
1725 bra TFT_active_setpoint ; Yes, show setpoint | |
1726 | |
1727 call TFT_standard_color | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1728 WIN_STD dm_active_gas_column, dm_active_gas_row |
0 | 1729 movff char_I_O2_ratio,lo ; lo now stores O2 in % |
1730 movff char_I_He_ratio,hi ; hi now stores He in % | |
1731 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases) | |
1732 btfss better_gas_available ; =1: A better gas is available and a gas change is advised in divemode | |
1733 return ; Done. | |
1734 | |
1735 btg blinking_better_gas ; Toggle blink bit... | |
1736 btfss blinking_better_gas ; blink now? | |
1737 return ; No, Done. | |
50 | 1738 call TFT_attention_color ; blink in yellow |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
1739 bsf win_invert ; Set invert flag |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1740 WIN_STD dm_active_gas_column, dm_active_gas_row |
0 | 1741 movff char_I_O2_ratio,lo ; lo now stores O2 in % |
1742 movff char_I_He_ratio,hi ; hi now stores He in % | |
1743 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases) | |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
1744 bcf win_invert ; Reset invert flag |
0 | 1745 call TFT_standard_color |
1746 return ; Done. | |
1747 | |
1748 TFT_active_gas_divemode2: | |
1749 call customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 | |
1750 STRCAT_PRINT "" | |
1751 return | |
1752 | |
1753 global TFT_display_decotype_surface | |
1754 TFT_display_decotype_surface: | |
1755 WIN_STD surf_decotype_column,surf_decotype_row | |
1756 WIN_COLOR color_lightblue | |
1757 movff opt_dive_mode,lo ; 0=OC, 1=CC, 2=Gauge, 3=Apnea | |
1758 tstfsz lo | |
1759 bra TFT_display_decotype_surface2 | |
116
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1760 TFT_display_decotype_surface0: |
0 | 1761 STRCAT_TEXT_PRINT tDvOC ; OC |
1762 bra TFT_display_decotype_exit | |
1763 TFT_display_decotype_surface2: | |
1764 decfsz lo,F | |
1765 bra TFT_display_decotype_surface3 | |
113 | 1766 STRCAT_TEXT_PRINT tDvCC ; CC |
1767 call TFT_standard_color | |
1768 WIN_TINY surf_decotype_column+.18,surf_decotype_row+.12 | |
1769 | |
1770 TSTOSS opt_ccr_mode ; =0: Fixed SP, =1: Sensor | |
1771 bra TFT_display_decotype_cc_fixed | |
1772 ; Sensor mode | |
1773 STRCPY_TEXT tCCRModeSensor ; Sensor | |
1774 bra TFT_display_decotype_cc_common | |
1775 TFT_display_decotype_cc_fixed: | |
1776 STRCPY_TEXT tCCRModeFixedSP ; Fixed | |
1777 TFT_display_decotype_cc_common: | |
1778 STRCAT_PRINT "" | |
0 | 1779 bra TFT_display_decotype_exit |
1780 TFT_display_decotype_surface3: | |
1781 decfsz lo,F | |
1782 bra TFT_display_decotype_surface4 | |
116
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1783 TFT_display_decotype_surface3_1: |
0 | 1784 STRCAT_TEXT_PRINT tDvGauge ; Gauge |
1785 bra TFT_display_decotype_exit | |
1786 TFT_display_decotype_surface4: | |
1787 STRCAT_TEXT_PRINT tDvApnea ; Apnea | |
1788 TFT_display_decotype_exit: | |
1789 call TFT_standard_color | |
1790 return | |
40 | 1791 |
116
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1792 global TFT_display_decotype_surface1 ; Used from logbook! |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1793 TFT_display_decotype_surface1: ; Used from logbook! |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1794 tstfsz lo |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1795 bra TFT_display_decotype_surface1_2 |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1796 bra TFT_display_decotype_surface0 ;OC |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1797 TFT_display_decotype_surface1_2: |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1798 decfsz lo,F |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1799 bra TFT_display_decotype_surface1_3 |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1800 STRCAT_TEXT_PRINT tDvCC ; CC (w/o Sensor/Fixed Display) |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1801 TFT_display_decotype_surface1_3: |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1802 decfsz lo,F |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1803 bra TFT_display_decotype_surface4 ; Apnea |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1804 bra TFT_display_decotype_surface3_1 ; Gauge |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
1805 |
0 | 1806 ;============================================================================= |
1807 | |
1808 global TFT_splist_surfmode ; Show Setpoint list | |
1809 extern gaslist_strcat_setpoint | |
1810 TFT_splist_surfmode: | |
1811 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
1812 ;SP 1 | |
1813 WIN_SMALL surf_gaslist_column,surf_gaslist_row | |
1814 clrf PRODL | |
1815 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL# | |
1816 STRCAT_PRINT "" | |
1817 ;SP 2 | |
1818 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1) | |
1819 movlw .1 | |
1820 movwf PRODL | |
1821 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL# | |
1822 STRCAT_PRINT "" | |
1823 ;SP 3 | |
1824 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2) | |
1825 movlw .2 | |
1826 movwf PRODL | |
1827 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL# | |
1828 STRCAT_PRINT "" | |
1829 ;SP 4 | |
1830 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3) | |
1831 movlw .3 | |
1832 movwf PRODL | |
1833 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL# | |
1834 STRCAT_PRINT "" | |
1835 ;SP 5 | |
1836 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4) | |
1837 movlw .4 | |
1838 movwf PRODL | |
1839 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL# | |
1840 STRCAT_PRINT "" | |
1841 bcf leftbind | |
1842 return | |
1843 | |
1844 global TFT_gaslist_surfmode | |
1845 TFT_gaslist_surfmode: ; Displays Gas List | |
1846 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
1847 extern gaslist_strcat_gas_mod | |
1848 ;Gas 1 | |
1849 WIN_SMALL surf_gaslist_column,surf_gaslist_row | |
1850 movlw .0 | |
1851 movwf PRODL | |
1852 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
1853 STRCAT_PRINT "" | |
1854 ;Gas 2 | |
1855 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1) | |
1856 movlw .1 | |
1857 movwf PRODL | |
1858 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
1859 STRCAT_PRINT "" | |
1860 ;Gas 3 | |
1861 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2) | |
1862 movlw .2 | |
1863 movwf PRODL | |
1864 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
1865 STRCAT_PRINT "" | |
1866 ;Gas 4 | |
1867 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3) | |
1868 movlw .3 | |
1869 movwf PRODL | |
1870 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
1871 STRCAT_PRINT "" | |
1872 ;Gas 5 | |
1873 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4) | |
1874 movlw .4 | |
1875 movwf PRODL | |
1876 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
1877 STRCAT_PRINT "" | |
1878 bcf leftbind | |
1879 return | |
1880 | |
1881 global TFT_dillist_surfmode | |
1882 TFT_dillist_surfmode: ; Displays Diluent List | |
1883 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
175
d097e10b383b
CHANGE: Draw a frame around the dive mode menu
heinrichsweikamp
parents:
170
diff
changeset
|
1884 bsf ccr_diluent_setup ; Use CCR Diluents... |
d097e10b383b
CHANGE: Draw a frame around the dive mode menu
heinrichsweikamp
parents:
170
diff
changeset
|
1885 rcall TFT_gaslist_surfmode ; Use OC/BAIL routine |
d097e10b383b
CHANGE: Draw a frame around the dive mode menu
heinrichsweikamp
parents:
170
diff
changeset
|
1886 bcf ccr_diluent_setup ; Clear flag |
0 | 1887 return |
1888 | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1889 ;================================================================== |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1890 |
0 | 1891 global TFT_depth |
1892 TFT_depth: | |
1893 SAFE_2BYTE_COPY rel_pressure, lo | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1894 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1895 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1896 TFT_color_code warn_depth ; Color-code the output |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1897 call TFT_depth_blink |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1898 WIN_LARGE dm_depth_column, dm_depth_row |
0 | 1899 |
1900 TSTOSS opt_units ; 0=m, 1=ft | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1901 bra TFT_depth_metric |
0 | 1902 ;TFT_depth_imperial |
1903 clrf sub_a+1 ; Display 0ft if lower then 30cm | |
1904 movlw d'30' | |
1905 movwf sub_a+0 | |
1906 movff hi,sub_b+1 | |
1907 movff lo,sub_b+0 | |
1908 call subU16 ; sub_c = sub_a - sub_b | |
1909 btfss neg_flag ; Depth lower then 0.4m? | |
1910 bra depth_less_0.3mtr_feet ; Yes, Show 0ft manually | |
1911 | |
1912 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
1913 bsf leftbind | |
1914 output_16 ; feet in Big font | |
1915 bcf leftbind | |
1916 movlw .3 ; limit to three chars | |
1917 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
1918 STRCAT_PRINT "" ; Display feet | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1919 bcf win_invert ; Reset invert flag |
0 | 1920 return |
126 | 1921 |
0 | 1922 depth_less_0.3mtr_feet: |
1923 STRCAT_PRINT "0 " ; manual zero | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1924 bcf win_invert ; Reset invert flag |
0 | 1925 return |
1926 | |
1927 TFT_depth_metric: | |
1928 movlw .039 | |
1929 cpfslt hi | |
1930 bra depth_greater_99_84mtr | |
1931 | |
1932 btfsc depth_greater_100m ; Was depth>100m during last call | |
11 | 1933 rcall TFT_clear_depth ; Yes, clear depth area |
0 | 1934 bcf depth_greater_100m ; Do this once only... |
1935 | |
11 | 1936 movlw .039 |
1937 cpfslt hi | |
1938 bra depth_greater_99_84mtr | |
1939 | |
0 | 1940 movlw HIGH d'1000' |
1941 movwf sub_a+1 | |
1942 movlw LOW d'1000' | |
1943 movwf sub_a+0 | |
1944 movff hi,sub_b+1 | |
1945 movff lo,sub_b+0 | |
1946 incf sub_b+0,F | |
1947 movlw d'0' | |
1948 addwfc sub_b+1,F ; Add 1mbar offset | |
1949 call sub16 ; sub_c = sub_a - sub_b | |
1950 movlw ' ' | |
1951 btfss neg_flag ; Depth lower then 10m? | |
1952 movwf POSTINC2 ; Yes, add extra space | |
1953 | |
1954 clrf sub_a+1 | |
1955 movlw d'99' | |
1956 movwf sub_a+0 | |
1957 movff hi,sub_b+1 | |
1958 movff lo,sub_b+0 | |
1959 call subU16 ; sub_c = sub_a - sub_b | |
1960 btfss neg_flag ; Depth lower then 1m? | |
1961 bra tft_depth2 ; Yes, display manual Zero | |
1962 | |
1963 bsf leftbind | |
1964 bsf ignore_digit4 | |
1965 output_16 ; Full meters in Big font | |
1966 bcf leftbind | |
1967 bra tft_depth3 | |
1968 | |
1969 tft_depth2: | |
153 | 1970 STRCAT "0" ; manual zero |
0 | 1971 |
1972 tft_depth3: | |
1973 STRCAT_PRINT "" ; Display full meters | |
1974 | |
1975 ; .1m in MEDIUM font | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1976 WIN_MEDIUM dm_depth_dm_column, dm_depth_dm_row |
0 | 1977 TFT_color_code warn_depth ; Color-code the output |
1978 | |
1979 SAFE_2BYTE_COPY rel_pressure, lo | |
1980 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
126 | 1981 |
0 | 1982 PUTC "." |
1983 movlw HIGH d'30' ; Display 0.0m if lower then 30cm | |
1984 movwf sub_a+1 | |
1985 movlw LOW d'30' | |
1986 movwf sub_a+0 | |
1987 movff hi,sub_b+1 | |
1988 movff lo,sub_b+0 | |
1989 call subU16 ; sub_c = sub_a - sub_b | |
1990 btfss neg_flag ; Depth lower then 0.3m? | |
1991 bra depth_less_0.3mtr ; Yes, Show ".0" manually | |
1992 | |
1993 movlw d'4' | |
1994 movwf ignore_digits | |
1995 bsf ignore_digit5 | |
1996 output_16dp d'0' | |
1997 STRCAT_PRINT "" ; Display decimeters | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
1998 bcf win_invert ; Reset invert flag |
0 | 1999 WIN_FONT FT_SMALL |
2000 return | |
2001 | |
2002 depth_less_0.3mtr: | |
2003 STRCAT_PRINT "0" ; Display 0.0m manually | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2004 bcf win_invert ; Reset invert flag |
0 | 2005 WIN_FONT FT_SMALL |
2006 return | |
2007 | |
2008 depth_greater_99_84mtr: ; Display only in full meters | |
2009 btfss depth_greater_100m ; Is depth>100m already? | |
2010 rcall TFT_clear_depth ; No, clear depth area and set flag | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2011 TFT_color_code warn_depth |
0 | 2012 ; Depth is already in hi:lo |
2013 ; Show depth in Full meters | |
2014 ; That means ignore figure 4 and 5 | |
2015 lfsr FSR2,buffer | |
2016 bsf ignore_digit4 | |
2017 bsf leftbind | |
2018 output_16 | |
2019 bcf leftbind | |
2020 STRCAT_PRINT "" ; Display full meters only | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2021 bcf win_invert ; Reset invert flag |
0 | 2022 WIN_FONT FT_SMALL |
2023 return | |
2024 | |
2025 TFT_clear_depth: ; No, clear depth area and set flag | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2026 WIN_BOX_BLACK dm_depth_row, dm_depth_bot, dm_depth_column, dm_depth_rgt ;top, bottom, left, right |
0 | 2027 bsf depth_greater_100m ; Set Flag |
2028 return | |
2029 | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2030 TFT_depth_blink: |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2031 ; check if previous cycle had the blinking warning or not |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2032 btfsc blinking_depth_prev ; did we have warning prev? |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2033 bra TFT_depth_blink_prevwarn ; Yes |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2034 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2035 ; No; check if it's set now |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2036 btfsc blinking_depth_warning ; do we have warning set now? |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2037 bra TFT_depth_blink_warn ; Yes - so we have warning now but not prev |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2038 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2039 ; no warning in previous cycle, no warning now, reset all flags |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2040 bcf blinking_depth_prev ; reset prev flag |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2041 bcf blinking_depth_toggle ; reset toggle |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2042 bcf win_invert |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2043 ; all done |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2044 return |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2045 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2046 TFT_depth_blink_prevwarn: |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2047 ; ...we had warning in previous cycle, check if we still have the warning set |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2048 btfss blinking_depth_warning ; do we still have the warning? |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2049 bra TFT_depth_blink_prevwarn_nowarn ; No, clear the depth area |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2050 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2051 ; we still have the warning, set previous flag for next cycle... |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2052 bsf blinking_depth_prev ; set prev flag |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2053 ; and set toggle and invert if required |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2054 btfss blinking_depth_toggle ; do we have the toggle set? |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2055 bra TFT_depth_blink_set ; No: set inverse, do color_box, set flag |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2056 bra TFT_depth_blink_reset ; Yes: clear inverse, do black box, reset flag |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2057 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2058 TFT_depth_blink_prevwarn_nowarn: |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2059 ; we had warning, but not now... (e.g. ascended or switched to better gas) |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2060 ; reset the previous cycle flag for the next cycle... |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2061 bcf blinking_depth_prev ; reset prev flag |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2062 ; clear it - just in case if we had a blinked before |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2063 bra TFT_depth_blink_reset ; Yes: clear inverse, do black box, reset flag |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2064 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2065 TFT_depth_blink_warn: |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2066 ; new blinking warning activated (had no warning in previous cycle) |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2067 bsf blinking_depth_prev ; set prev flag |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2068 ; set toggle and invert |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2069 bra TFT_depth_blink_set |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2070 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2071 TFT_depth_blink_set: |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2072 ; clear the area with color |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2073 movlw color_red ; that should not be hardcoded... |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2074 WIN_BOX_COLOR dm_depth_row, dm_depth_bot, dm_depth_column, dm_depth_rgt ;top, bottom, left, right |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2075 ;set the invert color |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2076 bsf win_invert |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2077 ; set the toggle |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2078 bsf blinking_depth_toggle |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2079 ; all done |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2080 return |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2081 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2082 TFT_depth_blink_reset: |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2083 ; clear the area with black |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2084 WIN_BOX_BLACK dm_depth_row, dm_depth_bot, dm_depth_column, dm_depth_rgt ;top, bottom, left, right |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2085 ;reset the invert color |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2086 bcf win_invert |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2087 ; reset the toggle |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2088 bcf blinking_depth_toggle |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2089 ; if it's still warning... |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2090 btfsc blinking_depth_warning |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2091 call TFT_warnings_color |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2092 ; all done |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2093 return |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2094 |
0 | 2095 ;============================================================================= |
2096 | |
2097 global TFT_custom_text | |
2098 TFT_custom_text: ; Show the custom text | |
2099 lfsr FSR0, opt_name ; Source | |
2100 WIN_SMALL surf_customtext_column,surf_customtext_row1 ; First row | |
2101 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
2102 incfsz lo,F ; Was lo=255? | |
2103 return ; No, all done. | |
2104 lfsr FSR0, opt_name+.12 ; Source | |
2105 WIN_SMALL surf_customtext_column,surf_customtext_row2 ; Second row | |
2106 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
2107 incfsz lo,F ; Was lo=255? | |
2108 return ; No, all done. | |
2109 lfsr FSR0, opt_name+.24 ; Source | |
2110 WIN_SMALL surf_customtext_column,surf_customtext_row3 ; Third row | |
2111 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
2112 incfsz lo,F ; Was lo=255? | |
2113 return ; No, all done. | |
2114 lfsr FSR0, opt_name+.36 ; Source | |
2115 WIN_SMALL surf_customtext_column,surf_customtext_row4 ; Forth row | |
2116 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
2117 incfsz lo,F ; Was lo=255? | |
2118 return ; No, all done. | |
2119 lfsr FSR0, opt_name+.48 ; Source | |
2120 WIN_SMALL surf_customtext_column,surf_customtext_row5 ; Fifth row | |
2121 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
2122 return ; Done. | |
2123 | |
2124 TFT_custom_text_2: | |
2125 lfsr FSR2, buffer ; destination | |
2126 movlw .12 | |
2127 movwf lo ; length/line | |
2128 TFT_custom_text_3: | |
2129 movf POSTINC0,W ; Get byte | |
2130 bz TFT_custom_text_4 ; End if NULL | |
2131 movwf POSTINC2 ; NO: copy | |
2132 decfsz lo,F ; Max len reached ? | |
2133 bra TFT_custom_text_3 ; NO: loop | |
2134 setf lo ; lo=255 -> more to come | |
2135 TFT_custom_text_4: | |
2136 clrf POSTINC2 ; Mark end of string | |
2137 goto aa_wordprocessor ; print and return | |
2138 | |
2139 | |
2140 ;============================================================================= | |
2141 global TFT_update_surf_press | |
2142 TFT_update_surf_press: | |
2143 WIN_SMALL surf_press_column,surf_press_row | |
2144 call TFT_standard_color | |
2145 SAFE_2BYTE_COPY amb_pressure, lo | |
2146 movff lo,sub_a+0 | |
2147 movff hi,sub_a+1 | |
2148 movff last_surfpressure_30min+0,sub_b+0 | |
2149 movff last_surfpressure_30min+1,sub_b+1 | |
2150 call subU16 ; sub_c = sub_a - sub_b | |
2151 btfsc neg_flag ; Pressure lower? | |
2152 rcall update_surf_press2 ; Yes, test threshold | |
2153 | |
2154 tstfsz sub_c+1 ; >255mbar difference? | |
2155 bra update_surf_press_common; Yes, display! | |
2156 movlw d'10' ; 10mbar noise suppression | |
2157 subwf sub_c+0,W | |
2158 btfsc STATUS,C | |
2159 bra update_surf_press_common; Yes, display! | |
2160 SAFE_2BYTE_COPY last_surfpressure_30min, lo ; Overwrite with stable value... | |
2161 | |
2162 update_surf_press_common: | |
2163 output_16 | |
2164 ; Show only 4 figures | |
2165 movff buffer+1,buffer+0 | |
2166 movff buffer+2,buffer+1 | |
2167 movff buffer+3,buffer+2 | |
2168 movff buffer+4,buffer+3 | |
2169 movlw 0x00 | |
2170 movff WREG,buffer+4 | |
2171 STRCAT_PRINT "" | |
2172 call TFT_divemask_color | |
2173 WIN_SMALL surf_press_column+4*8,surf_press_row | |
207 | 2174 STRCPY_TEXT_PRINT tMBAR ; mbar |
0 | 2175 return |
2176 | |
2177 update_surf_press2: | |
2178 movff lo,sub_b+0 | |
2179 movff hi,sub_b+1 | |
2180 movff last_surfpressure_30min+0,sub_a+0 | |
2181 movff last_surfpressure_30min+1,sub_a+1 | |
2182 call subU16 ; sub_c = sub_a - sub_b | |
2183 return | |
2184 | |
2185 ;============================================================================= | |
2186 | |
2187 global TFT_update_batt_voltage | |
2188 TFT_update_batt_voltage: | |
2189 movff batt_percent,lo ; Get battery percent | |
2190 TFT_color_code warn_battery; Color-code battery percent | |
207 | 2191 |
2192 ; Setup charge indicator | |
2193 btfsc cc_active | |
2194 bsf win_invert | |
2195 btfsc cc_active | |
2196 movlw color_yellow | |
2197 btfsc cv_active | |
2198 movlw color_green | |
2199 btfsc cc_active | |
2200 call TFT_set_color | |
2201 | |
0 | 2202 WIN_TINY batt_percent_column,batt_percent_row |
2203 bsf leftbind | |
2204 output_8 | |
2205 bcf leftbind | |
88 | 2206 STRCAT "% " |
2207 movlw 0x00 | |
2208 movff WREG,buffer+4 ; Only "xxx%" | |
2209 STRCAT_PRINT "" | |
207 | 2210 bcf win_invert |
0 | 2211 call TFT_standard_color |
2212 WIN_TINY batt_voltage_column,batt_voltage_row | |
2213 movff batt_voltage+0,lo | |
2214 movff batt_voltage+1,hi | |
2215 bsf leftbind | |
2216 output_16dp .2 | |
2217 bcf leftbind | |
2218 PUTC 'V' | |
2219 movff buffer+5,buffer+3 | |
2220 movlw 0x00 | |
2221 movff WREG,buffer+4 ; Only "x.yV" | |
24 | 2222 STRCAT_PRINT "" |
0 | 2223 return |
2224 | |
2225 ;update_battery_debug: | |
2226 ; call TFT_standard_color | |
2227 ; WIN_TINY .70,.0 | |
2228 ; movff battery_gauge+5,xC+3 | |
2229 ; movff battery_gauge+4,xC+2 | |
2230 ; movff battery_gauge+3,xC+1 | |
2231 ; movff battery_gauge+2,xC+0 | |
2232 ; ; battery_gauge:6 is nAs | |
2233 ; ; devide through 65536 | |
2234 ; ; devide through 152 | |
2235 ; ; Result is 0.01Ah in xC+1:xC+0 | |
2236 ; movlw LOW .152 | |
2237 ; movwf xB+0 | |
2238 ; movlw HIGH .152 | |
2239 ; movwf xB+1 | |
2240 ; call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
2241 ; bsf leftbind | |
2242 ; movff xC+0,lo | |
2243 ; movff xC+1,hi | |
2244 ; output_16 | |
2245 ; STRCAT_PRINT "x.01Ah" | |
2246 ; WIN_FONT FT_SMALL | |
2247 ; bcf leftbind | |
2248 ; return | |
2249 | |
2250 ;============================================================================= | |
2251 | |
2252 global TFT_convert_signed_16bit | |
2253 TFT_convert_signed_16bit: | |
2254 bcf neg_flag ; Positive temperature | |
2255 btfss hi,7 ; Negative temperature ? | |
2256 return ; No, return | |
2257 ; Yes, negative temperature! | |
2258 bsf neg_flag ; Negative temperature | |
2259 PUTC '-' ; Display "-" | |
2260 comf hi ; Then, 16bit sign changes. | |
2261 negf lo | |
2262 btfsc STATUS,C | |
2263 incf hi | |
2264 return ; and return | |
2265 | |
2266 ;============================================================================= | |
2267 | |
2268 global TFT_convert_date | |
2269 TFT_convert_date: ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | |
2270 movff opt_dateformat,WREG ; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD | |
2271 movwf EEDATA ; used as temp here | |
2272 tstfsz EEDATA | |
2273 bra TFT_convert_date1 | |
2274 ; EEDATA was 0 | |
2275 ; Use MMDDYY | |
2276 movff convert_value_temp+0,lo ;month | |
2277 bsf leftbind | |
2278 output_99x | |
2279 PUTC '.' | |
2280 movff convert_value_temp+1,lo ;day | |
2281 bra TFT_convert_date1_common ;year | |
2282 | |
2283 TFT_convert_date1: ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD) | |
2284 decfsz EEDATA,F | |
2285 bra TFT_convert_date2 ; EEDATA was 2 | |
2286 ; EEDATA was 1 | |
2287 ; Use DDMMYY | |
2288 movff convert_value_temp+1,lo ;day | |
2289 bsf leftbind | |
2290 output_99x | |
2291 PUTC '.' | |
2292 movff convert_value_temp+0,lo ;month | |
2293 | |
2294 TFT_convert_date1_common: | |
2295 bsf leftbind | |
2296 output_99x | |
2297 PUTC '.' | |
2298 movff convert_value_temp+2,lo ;year | |
2299 output_99x | |
2300 bcf leftbind | |
2301 return | |
2302 | |
2303 TFT_convert_date2: | |
2304 ; Use YYMMDD | |
2305 movff convert_value_temp+2,lo ;year | |
2306 bsf leftbind | |
2307 output_99x | |
2308 PUTC '.' | |
2309 movff convert_value_temp+0,lo ;month | |
2310 output_99x | |
2311 PUTC '.' | |
2312 movff convert_value_temp+1,lo ;day | |
2313 output_99x | |
2314 bcf leftbind | |
2315 return | |
2316 | |
2317 ;============================================================================= | |
2318 | |
2319 global TFT_convert_date_short | |
2320 TFT_convert_date_short: ; converts into "DD/MM" or "MM/DD" or "MM/DD" in postinc2 | |
2321 movff opt_dateformat,WREG ; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD | |
2322 movwf EEDATA ; used as temp here | |
2323 tstfsz EEDATA | |
2324 bra TFT_convert_date_short1 | |
2325 ; EEDATA was 0 | |
2326 ; Use MMDDYY | |
2327 TFT_convert_date_short_common: | |
2328 movff convert_value_temp+0,lo ;month | |
2329 bsf leftbind | |
2330 output_99x | |
2331 PUTC '.' | |
2332 movff convert_value_temp+1,lo ;day | |
2333 output_99x | |
2334 bcf leftbind | |
2335 return | |
2336 | |
2337 TFT_convert_date_short1: | |
2338 decfsz EEDATA,F | |
2339 bra TFT_convert_date_short_common ; EEDATA was 2 -> Use YYMMDD | |
2340 ; EEDATA was 1 | |
2341 ; Use DDMMYY | |
2342 movff convert_value_temp+1,lo ;day | |
2343 bsf leftbind | |
2344 output_99x | |
2345 PUTC '.' | |
2346 movff convert_value_temp+0,lo ;month | |
2347 output_99x | |
2348 bcf leftbind | |
2349 return | |
2350 | |
2351 ;============================================================================= | |
2352 | |
2353 global TFT_date | |
2354 TFT_date: | |
48 | 2355 WIN_SMALL surf_date_column,surf_date_row ; Init new Wordprocessor |
0 | 2356 call TFT_standard_color |
2357 movff month,convert_value_temp+0 | |
2358 movff day,convert_value_temp+1 | |
2359 movff year,convert_value_temp+2 | |
2360 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | |
2361 STRCAT_PRINT "" | |
2362 return | |
2363 | |
2364 ;============================================================================= | |
2365 | |
2366 global TFT_max_pressure | |
2367 TFT_max_pressure: | |
2368 btfsc FLAG_apnoe_mode ; different display in apnoe mode | |
2369 bra TFT_max_pressure_apnoe | |
2370 TFT_max_pressure2: | |
2371 SAFE_2BYTE_COPY max_pressure, lo | |
2372 TFT_max_pressure3: | |
2373 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
2374 TSTOSS opt_units ; 0=m, 1=ft | |
2375 bra TFT_max_pressure2_metric | |
2376 ;TFT_max_pressure2_imperial | |
2377 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2378 WIN_MEDIUM dm_max_depth_column, dm_max_depth_row |
0 | 2379 call TFT_standard_color |
2380 output_16_3 | |
2381 STRCAT_PRINT "" | |
2382 return | |
2383 | |
2384 TFT_max_pressure2_metric: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2385 WIN_MEDIUM dm_max_depth_column, dm_max_depth_row |
11 | 2386 |
2387 movlw .039 | |
2388 cpfslt hi | |
2389 bra max_depth_greater_99_84mtr | |
2390 | |
2391 btfsc max_depth_greater_100m ; Was depth>100m during last call | |
2392 rcall TFT_clear_max_depth ; Yes, clear depth area | |
2393 bcf max_depth_greater_100m ; Do this once only... | |
2394 | |
2395 movlw .039 | |
2396 cpfslt hi | |
2397 bra max_depth_greater_99_84mtr | |
2398 | |
2399 movlw HIGH d'1000' | |
2400 movwf sub_a+1 | |
2401 movlw LOW d'1000' | |
2402 movwf sub_a+0 | |
2403 movff hi,sub_b+1 | |
2404 movff lo,sub_b+0 | |
2405 incf sub_b+0,F | |
2406 movlw d'0' | |
2407 addwfc sub_b+1,F ; Add 1mbar offset | |
2408 call sub16 ; sub_c = sub_a - sub_b | |
2409 movlw ' ' | |
2410 btfss neg_flag ; Depth lower then 10m? | |
2411 movwf POSTINC2 ; Yes, add extra space | |
2412 | |
2413 clrf sub_a+1 | |
2414 movlw d'99' | |
2415 movwf sub_a+0 | |
2416 movff hi,sub_b+1 | |
2417 movff lo,sub_b+0 | |
2418 call subU16 ; sub_c = sub_a - sub_b | |
2419 btfss neg_flag ; Depth lower then 1m? | |
2420 bra tft_max_depth2 ; Yes, display manual Zero | |
2421 | |
2422 bsf ignore_digit4 ; no 0.1m | |
2423 bsf leftbind | |
2424 output_16 | |
2425 bra tft_max_depth3 | |
2426 | |
2427 tft_max_depth2: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2428 WIN_MEDIUM dm_max_depth_column, dm_max_depth_row |
11 | 2429 STRCAT "0" |
2430 | |
2431 tft_max_depth3: | |
0 | 2432 call TFT_standard_color |
11 | 2433 STRCAT_PRINT "" ; Display full meters |
2434 bcf leftbind | |
2435 | |
2436 ; .1m in SMALL font | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2437 WIN_SMALL dm_max_depth_dm_column, dm_max_depth_dm_row |
11 | 2438 |
2439 SAFE_2BYTE_COPY max_pressure, lo | |
2440 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
2441 | |
2442 PUTC "." | |
2443 | |
2444 movlw d'4' | |
2445 movwf ignore_digits | |
2446 bsf ignore_digit5 | |
2447 bsf leftbind | |
2448 output_16dp d'0' | |
2449 STRCAT_PRINT "" ; Display decimeters | |
2450 bcf leftbind | |
2451 return | |
2452 | |
2453 max_depth_greater_99_84mtr: ; Display only in full meters | |
2454 btfss max_depth_greater_100m ; Is max depth>100m already? | |
2455 rcall TFT_clear_max_depth ; No, clear max depth area and set flag | |
2456 ; Max. Depth is already in hi:lo | |
2457 ; Show max. depth in Full meters | |
2458 ; That means ignore figure 4 and 5 | |
2459 lfsr FSR2,buffer | |
2460 bsf ignore_digit4 | |
2461 bsf leftbind | |
0 | 2462 output_16 |
11 | 2463 bcf leftbind |
2464 STRCAT_PRINT "" ; Display full meters only | |
2465 WIN_FONT FT_SMALL | |
0 | 2466 return |
2467 | |
11 | 2468 TFT_clear_max_depth: ; No, clear max. depth area and set flag |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2469 WIN_BOX_BLACK dm_max_depth_row, dm_max_depth_bot, dm_max_depth_column, dm_max_depth_rgt ;top, bottom, left, right |
11 | 2470 bsf max_depth_greater_100m ; Set Flag |
2471 return | |
2472 | |
2473 | |
0 | 2474 TFT_max_pressure_apnoe: |
2475 btfss FLAG_active_descent ; Are we descending? | |
2476 bra TFT_max_pressure2 ; Yes, show normal max. | |
2477 SAFE_2BYTE_COPY apnoe_max_pressure, lo | |
2478 bra TFT_max_pressure3 ; Show apnoe_max_pressure as max. depth | |
2479 | |
2480 global TFT_display_apnoe_last_max | |
2481 TFT_display_apnoe_last_max: | |
2482 call TFT_divemask_color | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2483 WIN_TINY dm_apnoe_last_max_depth_text_col, dm_apnoe_last_max_depth_text_row |
0 | 2484 STRCPY_TEXT_PRINT tApnoeMax |
2485 | |
2486 call TFT_standard_color | |
2487 SAFE_2BYTE_COPY max_pressure, lo | |
2488 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
2489 TSTOSS opt_units ; 0=m, 1=ft | |
2490 bra TFT_display_apnoe_last_m_metric | |
2491 ;TFT_display_apnoe_last_max_imperial | |
2492 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2493 WIN_MEDIUM dm_apnoe_last_max_depth_column, dm_apnoe_last_max_depth_row |
0 | 2494 output_16 |
2495 STRCAT_PRINT "" | |
2496 return | |
2497 | |
2498 TFT_display_apnoe_last_m_metric: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2499 WIN_MEDIUM dm_apnoe_last_max_depth_column, dm_apnoe_last_max_depth_row |
0 | 2500 bsf ignore_digit5 ; do not display 1cm depth |
2501 output_16dp d'3' | |
2502 STRCAT_PRINT "" | |
2503 return | |
2504 | |
2505 ;============================================================================= | |
2506 global TFT_divemins | |
2507 TFT_divemins: | |
2508 movff divemins+0,lo | |
2509 movff divemins+1,hi | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2510 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2511 ; Already showing divemins > 99min |
0 | 2512 btfsc no_more_divesecs ; Ignore seconds? |
2513 bra TFT_divemins2 ; Show minutes only | |
2514 | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2515 ; check if divemins has hi, definitely > 99min |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2516 movlw .1 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2517 cpfslt hi ; HI less than 1? |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2518 bra TFT_divemins_clr ; No, show mins only |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2519 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2520 ; check if divemins (when HI is zero) > 99min |
0 | 2521 movlw .99 |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2522 cpfsgt lo ; bigger than 99? |
0 | 2523 bra TFT_divemins1 ; No show mins:secs |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2524 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2525 TFT_divemins_clr: |
0 | 2526 ; Yes, remove second display for the rest of the dive and clear seconds |
2527 bsf no_more_divesecs ; Set flag | |
2528 ; Clear rest of seconds | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2529 WIN_BOX_BLACK dm_divetime_row, dm_divetime_bot, dm_divetime_column, dm_divetime_rgt ;top, bottom, left, right |
0 | 2530 bra TFT_divemins2 ; Show minutes only |
2531 | |
2532 TFT_divemins1: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2533 ; Print out the minutes, up to 99min, only 2chars ! |
0 | 2534 call TFT_standard_color |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2535 WIN_MEDIUM dm_divetime_column, dm_divetime_row |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2536 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2537 movlw .9 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2538 cpfsgt lo ; bigger then 9? |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2539 bra TFT_divemins1_pad ; No, need padding |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2540 ; Yes, just print out the value |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2541 bsf leftbind |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2542 movff divemins+0,lo |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2543 output_99x ; displays only last two figures from a 8Bit value (00-99) |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2544 bcf leftbind |
0 | 2545 STRCAT_PRINT "" ; Show minutes in large font |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2546 bra TFT_divemins1_sec |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2547 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2548 TFT_divemins1_pad: |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2549 bcf leftbind |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2550 PUTC " " ; Add a padding space |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2551 bsf leftbind |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2552 movff divemins+0,lo |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2553 output_99 ; displays only last two figures from a 8Bit value (0-99) |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2554 bcf leftbind |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2555 STRCAT_PRINT "" ; Show minutes in large font |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2556 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2557 TFT_divemins1_sec: |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2558 ; Print out the seconds |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2559 WIN_SMALL dm_divetime_secs_column, dm_divetime_secs_row ; left position for two sec figures |
0 | 2560 PUTC ':' |
2561 bsf leftbind | |
2562 movff divesecs,lo | |
2563 output_99x | |
2564 bcf leftbind | |
2565 STRCAT_PRINT "" ; Show seconds in small font | |
2566 return | |
2567 | |
2568 TFT_divemins2: | |
2569 call TFT_standard_color | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2570 WIN_MEDIUM dm_divetime_minsonly_column, dm_divetime_row |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2571 bcf leftbind |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2572 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2573 ; if we are at or over the limit, do a WARNIGN color |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2574 ; 9999 = 27 0F = [39][15] |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2575 movlw .38 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2576 cpfsgt hi ; hi > 38 ? |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2577 bra TFT_divemins2_out ; No, hi <= 38, no need to warn |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2578 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2579 movlw .40 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2580 cpfslt hi ; hi < 40 ? |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2581 bra TFT_divemins2_warn ; No, hi >= 40, need to warn |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2582 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2583 ; hi = 39, check lo. check 14 as 9999 should be already WARN! |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2584 movlw .14 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2585 cpfsgt lo |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2586 bra TFT_divemins2_out ; No, lo <= 14, no need to warn |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2587 ; Yes, lo > 14, need to warn |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2588 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2589 TFT_divemins2_warn: |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2590 call TFT_warnings_color |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2591 bsf win_invert |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2592 |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2593 TFT_divemins2_out: |
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2594 output_16_4 |
0 | 2595 STRCAT_PRINT "" ; Show minutes in large font |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2596 bcf win_invert |
0 | 2597 return |
2598 | |
2599 ;============================================================================= | |
2600 global TFT_display_apnoe_surface | |
2601 TFT_display_apnoe_surface: | |
2602 call TFT_divemask_color | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2603 WIN_TINY dm_apnoe_surface_time_text_col, dm_apnoe_surface_time_text_row |
0 | 2604 STRCPY_TEXT_PRINT tApnoeSurface |
2605 | |
2606 call TFT_standard_color | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2607 WIN_MEDIUM dm_apnoe_surface_time_column, dm_apnoe_surface_time_row |
0 | 2608 movff apnoe_surface_mins,lo |
2609 output_8 | |
2610 PUTC ':' | |
2611 movff apnoe_surface_secs,lo | |
2612 output_99x | |
2613 STRCAT_PRINT "" | |
2614 return | |
2615 | |
2616 global TFT_apnoe_clear_surface | |
2617 TFT_apnoe_clear_surface: | |
2618 ; Clear Surface timer.... | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2619 WIN_BOX_BLACK dm_apnoe_surface_time_text_row, .239, dm_apnoe_surface_time_text_col, .159 ;top, bottom, left, right |
0 | 2620 return |
2621 | |
2622 global TFT_display_apnoe_descent | |
2623 TFT_display_apnoe_descent: ; Descent divetime | |
2624 movff apnoe_mins,lo | |
2625 clrf hi | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2626 WIN_MEDIUM dm_divetime_apnoe_column, dm_divetime_apnoe_row |
0 | 2627 output_16_3 ; displays only last three figures from a 16Bit value (0-999) |
2628 call TFT_standard_color | |
2629 STRCAT_PRINT "" ; Show minutes in large font | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2630 WIN_SMALL dm_divetime_apnoe_secs_column, dm_divetime_apnoe_secs_row ; left position for two sec figures |
0 | 2631 PUTC ':' |
2632 bsf leftbind | |
2633 movff apnoe_secs,lo | |
2634 output_99x | |
2635 bcf leftbind | |
2636 STRCAT_PRINT "" ; Show seconds in small font | |
38 | 2637 |
2638 call TFT_divemask_color | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2639 WIN_TINY dm_total_apnoe_text_column,dm_total_apnoe_text_row |
38 | 2640 STRCPY_TEXT_PRINT tApnoeTotal |
2641 call TFT_standard_color | |
2642 movff divemins,lo | |
2643 clrf hi | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2644 WIN_MEDIUM dm_apnoe_total_divetime_column, dm_apnoe_total_divetime_row |
38 | 2645 output_16_3 ; displays only last three figures from a 16Bit value (0-999) |
2646 call TFT_standard_color | |
2647 STRCAT_PRINT "" ; Show minutes in large font | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2648 WIN_SMALL dm_apnoe_total_divetime_secs_col, dm_apnoe_total_divetime_secs_row ; left position for two sec figures |
38 | 2649 PUTC ':' |
2650 bsf leftbind | |
2651 movff divesecs,lo | |
2652 output_99x | |
2653 bcf leftbind | |
2654 STRCAT_PRINT "" ; Show seconds in small font | |
0 | 2655 return |
2656 | |
2657 ;============================================================================= | |
275 | 2658 ; Writes ostc #Serial and Firmware version in splash screen |
0 | 2659 ; |
2660 global TFT_serial | |
2661 TFT_serial: | |
213 | 2662 WIN_TINY .5,.225 |
200 | 2663 STRCPY "OSTC" ; Won't translate that... |
260 | 2664 |
2665 movlw 0x0A | |
2666 cpfseq hardware_flag | |
200 | 2667 bra TFT_serial2 |
2668 STRCAT "3 #" | |
260 | 2669 bra TFT_serial_common |
2670 TFT_serial2: | |
2671 movlw 0x05 | |
2672 cpfseq hardware_flag | |
200 | 2673 bra TFT_serial3 |
2674 STRCAT " cR #" | |
260 | 2675 bra TFT_serial_common |
200 | 2676 TFT_serial3: |
260 | 2677 movlw 0x11 |
2678 cpfseq hardware_flag | |
2679 bra TFT_serial4 | |
2680 STRCAT "2 #" | |
2681 bra TFT_serial_common | |
2682 TFT_serial4: | |
2683 movlw 0x1A | |
2684 cpfseq hardware_flag | |
2685 bra TFT_serial5 | |
2686 STRCAT "3 #" | |
2687 ; bra TFT_serial_common | |
2688 TFT_serial5: | |
2689 TFT_serial_common: | |
0 | 2690 rcall TFT_cat_serial |
2691 STRCAT " v" | |
180 | 2692 WIN_COLOR color_greenish |
0 | 2693 rcall TFT_cat_firmware |
2694 | |
2695 ifdef __DEBUG | |
2696 movlw color_grey ; Write header in blue when | |
2697 call TFT_set_color ; compiled in DEBUG mode... | |
2698 STRCAT_PRINT "DEBUG" | |
2699 else | |
76 | 2700 STRCAT_PRINT "" |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
2701 bcf win_invert ; Reset invert flag |
0 | 2702 call TFT_standard_color |
76 | 2703 |
0 | 2704 movlw softwareversion_beta ; =1: Beta, =0: Release |
2705 decfsz WREG,F | |
2706 return ; Release version -> Return | |
2707 | |
2708 call TFT_warnings_color | |
2709 WIN_LEFT .160-4*9/2 ; Right pad. | |
2710 STRCPY_TEXT_PRINT tBeta | |
2711 endif | |
76 | 2712 call TFT_standard_color |
0 | 2713 return |
2714 | |
2715 | |
2716 | |
2717 ;============================================================================= | |
2718 ; For the Information menu: append firmware x.yy version. | |
2719 global info_menu_firmware | |
2720 extern tFirmware | |
2721 info_menu_firmware: | |
2722 lfsr FSR1,tFirmware | |
2723 call strcat_text | |
180 | 2724 rcall TFT_cat_firmware |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
2725 bcf win_invert ; Reset invert flag |
180 | 2726 return |
2727 | |
76 | 2728 global TFT_cat_firmware |
0 | 2729 TFT_cat_firmware: |
2730 movlw softwareversion_x | |
2731 movwf lo | |
2732 bsf leftbind | |
2733 output_8 | |
2734 PUTC '.' | |
2735 movlw softwareversion_y | |
2736 movwf lo | |
2737 output_99x | |
2738 bcf leftbind | |
180 | 2739 ; Check firmware date |
2740 movlw firmware_expire_year-.1 | |
2741 cpfsgt year ; > threshold? | |
2742 return | |
2743 movlw firmware_expire_month-.1 | |
2744 cpfsgt month ; > threshold? | |
2745 return | |
2746 movlw firmware_expire_day-.1 | |
2747 cpfsgt day ; > threshold? | |
2748 return | |
2749 | |
2750 ; Show in "change firmware" style | |
2751 movlw color_yellow | |
2752 call TFT_set_color | |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
2753 bsf win_invert ; Set invert flag |
0 | 2754 return |
2755 | |
2756 ;----------------------------------------------------------------------------- | |
275 | 2757 ; For the Information menu: append serial number |
0 | 2758 global info_menu_serial |
2759 extern tSerial | |
2760 info_menu_serial: | |
2761 lfsr FSR1,tSerial | |
2762 call strcat_text | |
76 | 2763 global TFT_cat_serial |
0 | 2764 TFT_cat_serial: |
2765 clrf EEADRH | |
2766 clrf EEADR ; Get Serial number LOW | |
2767 call read_eeprom ; read byte | |
2768 movff EEDATA,lo | |
2769 incf EEADR,F ; Get Serial number HIGH | |
2770 call read_eeprom ; read byte | |
2771 movff EEDATA,hi | |
2772 | |
2773 bsf leftbind | |
2774 output_16 | |
2775 bcf leftbind | |
2776 return | |
2777 | |
2778 ;----------------------------------------------------------------------------- | |
2779 ; For the Information menu: Append total dives | |
2780 global info_menu_total_dives | |
2781 extern tTotalDives | |
2782 info_menu_total_dives: | |
2783 lfsr FSR1,tTotalDives | |
2784 call strcat_text | |
2785 TFT_cat_total_dives: | |
2786 read_int_eeprom .2 | |
2787 movff EEDATA,lo | |
2788 read_int_eeprom .3 | |
2789 movff EEDATA,hi | |
2790 bsf leftbind | |
2791 output_16 | |
2792 bcf leftbind | |
2793 return | |
2794 | |
62 | 2795 ; For the Information menu: Append battery voltage |
2796 global info_menu_battery_volts | |
2797 extern tBatteryV | |
2798 info_menu_battery_volts: | |
2799 lfsr FSR1,tBatteryV | |
2800 call strcat_text | |
2801 movff batt_voltage+1,hi | |
2802 movff batt_voltage+0,lo | |
2803 bsf leftbind | |
2804 output_16dp .2 ; x.xxx | |
2805 bcf leftbind | |
2806 PUTC "V" | |
2807 return | |
2808 | |
0 | 2809 ;----------------------------------------------------------------------------- |
2810 ; ppO2 menu | |
2811 global divesets_ppo2_max | |
2812 extern tPPO2Max | |
2813 extern tbar | |
2814 divesets_ppo2_max: | |
2815 lfsr FSR1,tPPO2Max | |
2816 call strcat_text | |
2817 movff opt_ppO2_max,lo | |
2818 movlw ppo2_warning_high | |
2819 divesets_ppo2_common: | |
2820 movwf up ; Save default value | |
2821 clrf hi | |
2822 bsf leftbind | |
2823 output_16dp d'3' | |
2824 bcf leftbind | |
2825 lfsr FSR1,tbar | |
2826 call strcat_text | |
2827 | |
2828 movf up,W ; Default value | |
2829 cpfseq lo ; Current value | |
2830 bra divesets_ppo2_common2 ; Not default, add * | |
2831 return ; Default, Done. | |
2832 divesets_ppo2_common2: | |
2833 PUTC "*" | |
2834 return ; Done. | |
2835 | |
2836 global divesets_ppo2_min | |
2837 extern tPPO2Min | |
2838 divesets_ppo2_min: | |
2839 lfsr FSR1,tPPO2Min | |
2840 call strcat_text | |
2841 movff opt_ppO2_min,lo | |
2842 movlw ppo2_warning_low | |
2843 bra divesets_ppo2_common | |
2844 | |
2845 ;============================================================================= | |
2846 | |
2847 global TFT_clear_warning_text | |
2848 TFT_clear_warning_text: | |
2849 btfss divemode ; in divemode? | |
2850 bra TFT_clear_warning_text2 ; No, setup for surface mode | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2851 WIN_BOX_BLACK dm_warning_row, dm_warning_bot, dm_warning_column, dm_warning_rgt ;top, bottom, left, right |
0 | 2852 return |
2853 TFT_clear_warning_text2: | |
2854 WIN_BOX_BLACK surf_warning1_row, surf_warning2_row+.24, surf_warning1_column, surf_warning1_column+.76 ;top, bottom, left, right | |
2855 return | |
2856 | |
2857 global TFT_clear_warning_text_2nd_row | |
2858 TFT_clear_warning_text_2nd_row: | |
2859 btfss divemode ; in divemode? | |
2860 bra TFT_clear_warning_text_2nd_2 ; No, setup for surface mode | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2861 WIN_BOX_BLACK dm_warning2_row, dm_warning2_bot, dm_warning2_column, dm_warning2_rgt ;top, bottom, left, right |
0 | 2862 return |
2863 TFT_clear_warning_text_2nd_2: | |
2864 WIN_BOX_BLACK surf_warning2_row, surf_warning2_row+.24, surf_warning2_column, surf_warning2_column+.76 ;top, bottom, left, right | |
2865 return | |
2866 | |
2867 global TFT_fillup_with_spaces | |
2868 TFT_fillup_with_spaces: ; Fillup FSR2 with spaces (Total string length in #WREG) | |
2869 movwf lo ; save max. string length into lo | |
2870 movf FSR2L,W ; Get current string length | |
2871 subwf lo,F ; lo-WREG | |
2872 btfsc STATUS,N ; longer then #lo already? | |
2873 return ; Yes, done. | |
2874 tstfsz lo ; Zero? | |
2875 bra TFT_fillup_with_spaces2 ; No. | |
2876 return ; Yes, done. | |
2877 TFT_fillup_with_spaces2: | |
2878 PUTC " " ; Add one space | |
2879 decfsz lo,F ; All done? | |
2880 bra TFT_fillup_with_spaces2 ; No, loop | |
2881 return ; Done. | |
2882 | |
2883 global TFT_desaturation_time | |
2884 TFT_desaturation_time: | |
2885 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
2886 tstfsz WREG ; Is there room for the warning? | |
2887 return ; No | |
2888 STRCPY "Desat:" | |
2889 movff desaturation_time+0,lo ; divide by 60... | |
2890 movff desaturation_time+1,hi | |
2891 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
2892 bsf leftbind | |
2893 movf lo,W | |
2894 movff hi,lo | |
2895 movwf hi ; exchange lo and hi... | |
2896 output_8 ; Hours | |
2897 PUTC ':' | |
2898 movff hi,lo ; Minutes | |
2899 output_99x | |
2900 bcf leftbind | |
2901 movlw surf_warning_length ; Only use surface string length | |
2902 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
60 | 2903 movlw .0 |
2904 movff WREG,buffer+11 | |
0 | 2905 STRCAT_PRINT "" |
2906 return | |
2907 | |
2908 global TFT_nofly_time | |
2909 TFT_nofly_time: | |
2910 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
2911 tstfsz WREG ; Is there room for the warning? | |
2912 return ; No | |
2913 STRCPY "NoFly:" | |
2914 movff nofly_time+0,lo ; divide by 60... | |
2915 movff nofly_time+1,hi | |
2916 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
2917 bsf leftbind | |
2918 movf lo,W | |
2919 movff hi,lo | |
2920 movwf hi ; exchange lo and hi... | |
2921 output_8 ; Hours | |
2922 PUTC ':' | |
2923 movff hi,lo ; Minutes | |
2924 output_99x | |
2925 bcf leftbind | |
2926 movlw surf_warning_length ; Only use surface string length | |
2927 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
60 | 2928 movlw .0 |
2929 movff WREG,buffer+11 | |
0 | 2930 STRCAT_PRINT "" |
2931 return | |
2932 | |
2933 global TFT_warning_agf | |
2934 TFT_warning_agf: | |
2935 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
2936 tstfsz WREG ; Is there room for the warning? | |
2937 return ; No | |
2938 call TFT_warnings_color | |
2939 STRCPY_TEXT tDiveaGF_active ; "aGF!" | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2940 movlw dm_warning_length ; Divemode string length |
0 | 2941 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) |
2942 STRCAT_PRINT "" | |
2943 call TFT_standard_color | |
2944 return | |
2945 | |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2946 global TFT_warning_fallback |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2947 TFT_warning_fallback: ; Show fallback warning |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2948 rcall TFT_warning_set_window ; Sets the row and column for the current warning |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2949 tstfsz WREG ; Is there room for the warning? |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2950 return ; No |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2951 call TFT_warnings_color |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2952 STRCPY_TEXT tDiveFallback ; "Fallback!" |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2953 movlw dm_warning_length ; Divemode string length |
145
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2954 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2955 STRCAT_PRINT "" |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2956 call TFT_standard_color |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2957 return |
e3ac5b2021bc
NEW: Setpoint-Fallback option for external O2 sensor failure
heinrichsweikamp
parents:
139
diff
changeset
|
2958 |
0 | 2959 global TFT_warning_gf |
2960 TFT_warning_gf: ;GF | |
2961 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
2962 tstfsz WREG ; Is there room for the warning? | |
2963 return ; No | |
2964 TFT_color_code warn_gf ; Color-code Output | |
2965 STRCPY "GF:" | |
2966 movff char_O_gradient_factor,lo ; gradient factor | |
2967 bsf leftbind | |
2968 output_8 | |
2969 PUTC "%" | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2970 movlw dm_warning_length ; Divemode string length |
0 | 2971 btfss divemode ; In Divemode? |
2972 movlw surf_warning_length ; No, use surface string length | |
2973 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
2974 STRCAT_PRINT "" | |
2975 bcf leftbind | |
2976 call TFT_standard_color | |
2977 return | |
2978 | |
2979 TFT_warning_set_window: ; Sets the row and column for the current warning | |
2980 ; ignore warning (now)? | |
2981 decf warning_counter,W ; -1 | |
2982 bcf STATUS,C | |
2983 rrcf WREG,W ; (warning_counter-1)/2 | |
2984 cpfseq warning_page | |
2985 retlw .255 ; WREG <> 0 -> Warning window not defined | |
2986 | |
2987 call TFT_standard_color | |
2988 | |
2989 btfss divemode ; in divemode? | |
2990 bra TFT_warning_set_window3 ; No, setup for surface mode | |
2991 | |
2992 btfss warning_counter,0 ; Toggle with each warning | |
2993 bra TFT_warning_set_window2 | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2994 WIN_SMALL dm_warning1_column, dm_warning1_row |
0 | 2995 bcf second_row_warning ; =1: The second row contains a warning |
2996 retlw .0 ; WREG=0 -> Warning window defined | |
2997 TFT_warning_set_window2: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
2998 WIN_SMALL dm_warning2_column, dm_warning2_row |
0 | 2999 bsf second_row_warning ; =1: The second row contains a warning |
3000 retlw .0 ; WREG=0 -> Warning window defined | |
3001 | |
3002 TFT_warning_set_window3: | |
3003 btfss warning_counter,0 ; Toggle with each warning | |
3004 bra TFT_warning_set_window4 | |
3005 WIN_SMALL surf_warning1_column,surf_warning1_row | |
3006 bcf second_row_warning ; =1: The second row contains a warning | |
3007 retlw .0 ; WREG=0 -> Warning window defined | |
3008 TFT_warning_set_window4: | |
3009 WIN_SMALL surf_warning2_column,surf_warning2_row | |
3010 bsf second_row_warning ; =1: The second row contains a warning | |
3011 retlw .0 ; WREG=0 -> Warning window defined | |
3012 | |
3013 | |
3014 global TFT_update_batt_percent_divemode | |
3015 TFT_update_batt_percent_divemode: | |
3016 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3017 tstfsz WREG ; Is there room for the warning? | |
3018 return ; No | |
3019 movff batt_percent,lo ; Get battery percent | |
3020 TFT_color_code warn_battery; Color-code battery percent | |
3021 STRCPY "Batt:" | |
3022 bsf leftbind | |
3023 output_8 | |
3024 bcf leftbind | |
3025 PUTC "%" | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3026 movlw dm_warning_length ; Divemode string length |
0 | 3027 btfss divemode ; In Divemode? |
3028 movlw surf_warning_length ; No, use surface string length | |
3029 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3030 STRCAT_PRINT "" | |
3031 call TFT_standard_color | |
3032 return | |
3033 | |
3034 | |
3035 global TFT_gf_mask ; Setup Mask | |
3036 TFT_gf_mask: | |
3037 ; The mask | |
3038 call TFT_divemask_color | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3039 WIN_TINY dm_custom_gf_title_col1, dm_custom_gf_title_row |
0 | 3040 STRCPY_TEXT_PRINT tGFactors |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3041 WIN_TINY dm_custom_gf_title_col2, dm_custom_gf_title_row |
0 | 3042 STRCPY_TEXT_PRINT taGFactors |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3043 WIN_TINY dm_custom_gf_title_col3, dm_custom_gf_title_row |
0 | 3044 STRCPY_TEXT_PRINT tGFInfo |
3045 | |
3046 ; Show GF (Static) | |
3047 call TFT_disabled_color | |
3048 btfss use_agf | |
3049 call TFT_standard_color | |
3050 | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3051 WIN_STD dm_custom_gf_column, dm_custom_gf_row |
0 | 3052 bsf leftbind |
3053 movff opt_GF_low,lo | |
3054 output_8 | |
3055 PUTC "/" | |
3056 movff opt_GF_high,lo | |
3057 output_8 | |
3058 STRCAT_PRINT "" | |
3059 ; Show aGF (Static) | |
3060 call TFT_standard_color | |
3061 TSTOSS opt_enable_aGF ; =1: aGF can be selected underwater | |
3062 bra TFT_gf_mask2 ; Show "---" instead | |
3063 | |
3064 btfss use_agf | |
3065 call TFT_disabled_color | |
3066 | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3067 WIN_STD dm_custom_agf_column, dm_custom_agf_row |
0 | 3068 movff opt_aGF_low,lo |
3069 output_8 | |
3070 PUTC "/" | |
3071 movff opt_aGF_high,lo | |
3072 output_8 | |
3073 STRCAT_PRINT "" | |
3074 bcf leftbind | |
3075 call TFT_standard_color | |
3076 return | |
3077 | |
3078 TFT_gf_mask2: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3079 WIN_STD dm_custom_agf_column+.10, dm_custom_agf_row |
0 | 3080 STRCPY_PRINT "---" |
3081 bcf leftbind | |
3082 return | |
3083 | |
3084 global TFT_gf_info ; Show GF informations | |
3085 TFT_gf_info: | |
3086 ; Show current GF | |
3087 movff char_O_gradient_factor,lo ; gradient factor absolute (Non-GF model) | |
3088 movff char_I_deco_model,hi | |
3089 decfsz hi,F ; jump over next line if char_I_deco_model == 1 | |
3090 movff char_O_relative_gradient_GF,lo ; gradient factor relative (GF model) | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3091 WIN_STD dm_custom_currentgf_column, dm_custom_currentgf_row |
0 | 3092 output_8 |
3093 STRCAT_PRINT "%" | |
3094 return | |
3095 | |
3096 global TFT_ead_end_tissues_clock_mask ; Setup Mask | |
3097 TFT_ead_end_tissues_clock_mask: | |
3098 ; The mask | |
3099 call TFT_divemask_color | |
134
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
3100 btfsc FLAG_apnoe_mode ; In Apnoe mode? |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
3101 bra TFT_ead_end_tissues_clock_mask2 ; Yes |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
3102 btfsc FLAG_gauge_mode ; In Gauge mode? |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
3103 bra TFT_ead_end_tissues_clock_mask2 ; Yes |
0 | 3104 ; Put three columns at HUD positions |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3105 WIN_TINY dm_custom_ead_column, dm_custom_eadend_title_row |
0 | 3106 STRCPY_TEXT_PRINT tDiveEAD_END |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3107 WIN_TINY dm_custom_tissue_title_column, dm_custom_tissue_title_row |
0 | 3108 STRCPY_TEXT_PRINT tDiveTissues |
134
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
3109 TFT_ead_end_tissues_clock_mask2: ; Show only clock |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3110 WIN_TINY dm_custom_clock_column, dm_custom_clock_title_row |
134
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
3111 STRCPY_TEXT_PRINT tDiveClock |
0 | 3112 call TFT_standard_color |
3113 return | |
3114 | |
3115 global TFT_ead_end_tissues_clock ; Show EAD/END, Tissues and clock | |
3116 TFT_ead_end_tissues_clock: | |
3117 ; Update clock and date | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3118 WIN_SMALL dm_custom_clock_column, dm_custom_clock_row |
0 | 3119 call TFT_clock2 ; print clock |
134
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
3120 |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
3121 btfsc FLAG_apnoe_mode ; In Apnoe mode? |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
3122 return ; Yes, done. |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
3123 btfsc FLAG_gauge_mode ; In Gauge mode? |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
3124 return ; Yes, done. |
4574aed5cd4c
Show clock in Apnea mode, minor layout changes in Apnea mode
heinrichsweikamp
parents:
131
diff
changeset
|
3125 |
105 | 3126 ; WIN_SMALL dive_endtime_column,dive_endtime_row |
3127 ; | |
3128 ; btfss decostop_active ; Already in nodeco mode ? | |
3129 ; bra TFT_ead_end_tissues_clock2 ; No, overwrite with some spaces | |
3130 ; | |
3131 ; STRCPY 0x94 ; "End of dive" icon | |
3132 ; movff hours,WREG | |
3133 ; mullw .60 | |
3134 ; movf mins,W | |
3135 ; addwf PRODL | |
3136 ; movlw .0 | |
3137 ; addwfc PRODH | |
3138 ; movff PRODL, lo | |
3139 ; movff PRODH, hi | |
3140 ; | |
3141 ; ; Add TTS | |
3142 ; movff int_O_ascenttime+0,WREG ; TTS | |
3143 ; addwf lo,F | |
3144 ; movff int_O_ascenttime+1,WREG ; TTS is 16bits | |
3145 ; addwfc hi,F | |
3146 ; | |
3147 ; call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
3148 ; movf hi,W | |
3149 ; movff lo,hi | |
3150 ; movwf lo ; exchange lo and hi | |
3151 ; output_99x | |
3152 ; PUTC ':' | |
3153 ; movff hi,lo | |
3154 ; output_99x | |
3155 ; STRCAT_PRINT "" | |
3156 ; bra TFT_ead_end_tissues_clock3 | |
3157 ; | |
3158 ;TFT_ead_end_tissues_clock2: | |
3159 ; STRCPY_PRINT " " | |
3160 ;TFT_ead_end_tissues_clock3: | |
0 | 3161 |
3162 ; Show END/EAD | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3163 WIN_SMALL dm_custom_ead_column, dm_custom_ead_row |
0 | 3164 STRCPY_TEXT tEAD ; EAD: |
3165 movff char_O_EAD,lo | |
3166 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3167 WIN_SMALL dm_custom_end_column, dm_custom_end_row |
0 | 3168 STRCPY_TEXT tEND ; END: |
3169 movff char_O_END,lo | |
3170 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars | |
3171 | |
3172 ; Show tissue diagram | |
3173 call TFT_divemask_color | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3174 WIN_TINY dm_custom_tissue_N2_column, dm_custom_tissue_N2_row |
0 | 3175 STRCPY_TEXT_PRINT tN2 |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3176 WIN_TINY dm_custom_tissue_He_column, dm_custom_tissue_He_row |
0 | 3177 STRCPY_TEXT_PRINT tHe |
3178 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation) | |
3179 movlb b'00000001' ; select ram bank 1 | |
3180 rcall DISP_tissue_saturation_graph ; Show char_O_tissue_N2_saturation and char_O_tissue_He_saturation | |
3181 return | |
3182 | |
3183 TFT_end_ead_common: ; print "lo m" (or ft) and limit to 8 chars | |
3184 bsf leftbind | |
3185 TSTOSS opt_units ; 0=Meters, 1=Feets | |
3186 bra TFT_end_ead_common_metric | |
3187 ;TFT_end_ead_common_imperial: | |
3188 ; With lo in m | |
3189 movf lo,W | |
3190 mullw .100 ; PRODL:PRODH = mbar/min | |
3191 movff PRODL,lo | |
3192 movff PRODH,hi | |
3193 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
3194 output_16_3 | |
3195 STRCAT_TEXT tFeets | |
3196 clrf WREG | |
3197 movff WREG,buffer+.8 ; limit string length to 8 | |
3198 bra TFT_end_ead_common_exit | |
3199 TFT_end_ead_common_metric: | |
3200 output_8 | |
3201 STRCAT_TEXT tMeters | |
3202 TFT_end_ead_common_exit: | |
3203 bcf leftbind | |
3204 movlw .8 | |
3205 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3206 STRCAT_PRINT "" | |
3207 return | |
3208 | |
3209 global TFT_surface_tissues | |
3210 TFT_surface_tissues: ; Show Tissue diagram in surface mode | |
3211 WIN_SMALL surf_tissue_N2_column,surf_tissue_N2_row | |
3212 STRCPY_TEXT_PRINT tN2 | |
3213 WIN_SMALL surf_tissue_He_column,surf_tissue_He_row | |
3214 STRCPY_TEXT_PRINT tHe | |
3215 | |
3216 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation) | |
3217 movlb b'00000001' ; select ram bank 1 | |
3218 | |
3219 movlw color_deepblue | |
3220 call TFT_set_color ; Make this configurable? | |
3221 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.29,.29 | |
3222 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.37,.37 | |
3223 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.45,.45 | |
3224 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.53,.53 | |
3225 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.61,.61 | |
3226 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.69,.69 | |
3227 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.77,.77 | |
3228 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.85,.85 | |
3229 WIN_FRAME_STD surf_tissue_diagram_top, surf_tissue_diagram_bottom, surf_tissue_diagram_left, surf_tissue_diagram_right ; outer frame | |
3230 | |
3231 movlw .1 | |
3232 movff WREG,win_height ; row bottom (0-239) | |
3233 movlw surf_tissue_diagram_left+.4 ; Surface mode | |
3234 movff WREG,win_leftx2 ; column left (0-159) | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3235 movlw surf_tissue_diagram_right - surf_tissue_diagram_left - .4 ; Width |
0 | 3236 movff WREG,win_width |
3237 | |
3238 ;---- Draw N2 Tissues | |
3239 lfsr FSR2, char_O_tissue_N2_saturation | |
3240 movlw d'16' | |
3241 movwf wait_temp ; 16 tissues | |
3242 clrf waitms_temp ; Row offset | |
3243 surf_tissue_saturation_graph_N2: | |
3244 movlw surf_tissue_diagram_top+.23 ; surface mode | |
3245 addwf waitms_temp,W | |
3246 movff WREG,win_top ; row top (0-239) | |
3247 rcall surf_tissue_saturation_loop ; Show one tissue | |
3248 decfsz wait_temp,F | |
3249 bra surf_tissue_saturation_graph_N2 | |
3250 | |
3251 ;---- Draw He Tissues ---------------------------------------------------- | |
3252 lfsr FSR2, char_O_tissue_He_saturation | |
3253 movlw d'16' | |
3254 movwf wait_temp ; 16 tissues | |
3255 clrf waitms_temp ; Row offset | |
3256 surf_tissue_saturation_graph_He: | |
3257 movlw surf_tissue_diagram_top+.23+.56 ; surface mode | |
3258 addwf waitms_temp,W | |
3259 movff WREG,win_top ; row top (0-239) | |
3260 rcall surf_tissue_saturation_loop ; Show one tissue | |
3261 decfsz wait_temp,F | |
3262 bra surf_tissue_saturation_graph_He | |
3263 return | |
3264 | |
3265 surf_tissue_saturation_loop: | |
3266 call TFT_standard_color | |
3267 movlw .2 ; row spacing | |
3268 addwf waitms_temp,F | |
3269 movf POSTINC2,W ; Get tissue load | |
3270 bcf STATUS,C | |
3271 rrcf WREG ; And divide by 2 | |
3272 movwf temp1 | |
3273 movlw .20 | |
3274 subwf temp1,F ; Subtract some offset | |
3275 movff win_width,WREG ; Max width. | |
3276 cpfslt temp1 ; skip if WREG < win_width | |
3277 movwf temp1 | |
3278 movff temp1,win_bargraph | |
3279 call TFT_box | |
3280 return | |
3281 | |
3282 ;============================================================================= | |
3283 ; Draw saturation graph, is surface mode or in dive mode. | |
3284 DISP_tissue_saturation_graph: | |
3285 ;---- Draw Frame | |
50 | 3286 call TFT_standard_color |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3287 WIN_FRAME_COLOR16 dm_custom_tissue_diagram_top, dm_custom_tissue_diagram_bottom, dm_custom_tissue_diagram_left, .159 ; outer frame |
0 | 3288 |
3289 movlw .1 | |
3290 movff WREG,win_height ; row bottom (0-239) | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3291 movlw dm_custom_tissue_diagram_left+.3 ; divemode |
0 | 3292 movff WREG,win_leftx2 ; column left (0-159) |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3293 movlw .159-dm_custom_tissue_diagram_left-.4 ; Width |
0 | 3294 movff WREG,win_width |
3295 | |
3296 ;---- Draw N2 Tissues | |
3297 lfsr FSR2, char_O_tissue_N2_saturation | |
3298 movlw d'16' | |
3299 movwf wait_temp ; 16 tissues | |
3300 clrf waitms_temp ; Row offset | |
3301 tissue_saturation_graph_N2: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3302 movlw dm_custom_tissue_diagram_top+.3 ; divemode |
0 | 3303 addwf waitms_temp,W |
3304 movff WREG,win_top ; row top (0-239) | |
3305 rcall tissue_saturation_graph_loop ; Show one tissue | |
3306 decfsz wait_temp,F | |
3307 bra tissue_saturation_graph_N2 | |
3308 | |
3309 ;---- Draw He Tissues ---------------------------------------------------- | |
3310 lfsr FSR2, char_O_tissue_He_saturation | |
3311 movlw d'16' | |
3312 movwf wait_temp ; 16 tissues | |
3313 clrf waitms_temp ; Row offset | |
3314 tissue_saturation_graph_He: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3315 movlw dm_custom_tissue_diagram_top+.3+.22 ; divemode |
0 | 3316 addwf waitms_temp,W |
3317 movff WREG,win_top ; row top (0-239) | |
3318 | |
3319 rcall tissue_saturation_graph_loop ; Show one tissue | |
3320 | |
3321 decfsz wait_temp,F | |
3322 bra tissue_saturation_graph_He | |
3323 return | |
3324 | |
3325 tissue_saturation_graph_loop: | |
3326 call TFT_standard_color | |
3327 incf waitms_temp,F | |
3328 movf POSTINC2,W | |
3329 bcf STATUS,C | |
3330 rrcf WREG | |
3331 bcf STATUS,C | |
3332 rrcf WREG ; And divide by 4 | |
3333 movwf temp1 | |
3334 movlw .12 | |
3335 subwf temp1,F ; Subtract some offset | |
3336 movff win_width,WREG ; Max width. | |
3337 cpfslt temp1 ; skip if WREG < win_width | |
3338 movwf temp1 | |
3339 movff temp1,win_bargraph | |
3340 call TFT_box | |
3341 return | |
3342 | |
55 | 3343 |
0 | 3344 global TFT_display_cns |
3345 TFT_display_cns: | |
3346 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3347 tstfsz WREG ; Is there room for the warning? | |
3348 return ; No | |
3349 TFT_color_code warn_cns ; Color-code CNS output | |
3350 STRCPY_TEXT tCNS2 ; CNS: | |
3351 movff int_O_CNS_fraction+0,lo | |
3352 movff int_O_CNS_fraction+1,hi | |
3353 bsf leftbind | |
3354 output_16_3 ;Displays only 0...999 | |
3355 bcf leftbind | |
3356 PUTC "%" | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3357 movlw dm_warning_length ; Divemode string length |
0 | 3358 btfss divemode ; In Divemode? |
3359 movlw surf_warning_length ; No, use surface string length | |
3360 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3361 STRCAT_PRINT "" | |
3362 call TFT_standard_color | |
3363 return | |
3364 | |
3365 global TFT_display_ppo2 | |
3366 TFT_display_ppo2: ; Show ppO2 (ppO2 stored in xC, in mbar!) | |
3367 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3368 tstfsz WREG ; Is there room for the warning? | |
3369 return ; No | |
3370 TFT_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) | |
154
afa31c815f24
NEW: Show ppO2 for change depth during gas setup
heinrichsweikamp
parents:
153
diff
changeset
|
3371 STRCPY_TEXT tppO2 ; ppO2: |
0 | 3372 ; Check very high ppO2 manually |
3373 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? | |
3374 bra TFT_show_ppO2_3 ; Yes, display fixed Value! | |
3375 movff xC+0,lo | |
3376 movff xC+1,hi | |
3377 bsf ignore_digit4 | |
3378 output_16dp d'1' | |
3379 TFT_show_ppO2_2: | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
3380 movlw dm_warning_length ; Divemode string length |
0 | 3381 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) |
3382 STRCAT_PRINT "" | |
3383 call TFT_standard_color | |
3384 return | |
3385 | |
3386 TFT_show_ppO2_3: | |
3387 STRCAT ">6.6" | |
3388 bra TFT_show_ppO2_2 | |
3389 | |
3390 | |
3391 global TFT_LogOffset_Logtitle | |
3392 TFT_LogOffset_Logtitle: | |
3393 STRCPY_TEXT tLogOffset | |
3394 PUTC ":" | |
3395 call do_logoffset_common_read ; Offset into lo:hi | |
3396 bsf leftbind | |
3397 output_16 | |
3398 bcf leftbind | |
3399 PUTC " " | |
3400 return ; No "_PRINT" here... | |
3401 | |
3402 | |
3403 global adjust_depth_with_salinity | |
3404 adjust_depth_with_salinity: ; computes salinity setting into lo:hi [mbar] | |
3405 btfsc simulatormode_active ; Do apply salinity in Simulatormode | |
3406 return | |
3407 | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
3408 global adjust_depth_with_salinity_log |
0 | 3409 movff opt_salinity,WREG ; 0-5% |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
3410 adjust_depth_with_salinity_log: ; computes salinity setting (FROM WREG!) into lo:hi [mbar] |
0 | 3411 addlw d'100' ; 1.00kg/l |
3412 movwf wait_temp | |
3413 | |
3414 movlw d'105' ; 105% ? | |
3415 cpfslt wait_temp ; Salinity higher limit | |
3416 return ; Out of limit, do not adjust lo:hi | |
3417 movlw d'99' ; 99% ? | |
3418 cpfsgt wait_temp ; Salinity lower limit | |
3419 return ; Out of limit, do not adjust lo:hi | |
3420 | |
3421 movff lo,xA+0 | |
3422 movff hi,xA+1 | |
3423 | |
3424 movlw d'102' ; 0,98bar/10m | |
3425 movwf xB+0 | |
3426 clrf xB+1 | |
3427 call mult16x16 ;xA*xB=xC (lo:hi * 100) | |
3428 movff wait_temp,xB+0 ; Salinity | |
3429 clrf xB+1 | |
3430 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3431 movff xC+0,lo | |
3432 movff xC+1,hi ; restore lo and hi with updated value | |
3433 return | |
3434 | |
3435 global convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
3436 convert_mbar_to_feet: ; convert value in lo:hi from mbar to feet | |
3437 movff lo,xA+0 | |
3438 movff hi,xA+1 | |
3439 | |
3440 movlw LOW d'328' ; 328feet/100m | |
3441 movwf xB+0 | |
3442 movlw HIGH d'328' | |
3443 movwf xB+1 | |
3444 | |
3445 call mult16x16 ; xA*xB=xC (lo:hi * 328) | |
3446 | |
3447 movlw d'50' ; round up | |
3448 addwf xC+0,F | |
3449 movlw 0 | |
3450 addwfc xC+1,F | |
3451 addwfc xC+2,F | |
3452 addwfc xC+3,F | |
3453 | |
3454 movlw LOW .10000 | |
3455 movwf xB+0 | |
3456 movlw HIGH .10000 | |
3457 movwf xB+1 | |
3458 | |
3459 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3460 | |
3461 movff xC+0,lo | |
3462 movff xC+1,hi ; restore lo and hi with updated value | |
3463 return | |
3464 | |
3465 global convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit | |
3466 convert_celsius_to_fahrenheit: ; convert value in lo:hi from celsius to fahrenheit | |
3467 ; Does it work with signed temperature? mH | |
3468 movff lo,xA+0 | |
3469 movff hi,xA+1 | |
3470 | |
3471 movlw d'18' ; 1C = 1.8F | |
3472 movwf xB+0 | |
3473 clrf xB+1 | |
3474 | |
3475 call mult16x16 ;xA*xB=xC (lo:hi * 18) | |
3476 | |
3477 movlw d'10' | |
3478 movwf xB+0 | |
3479 clrf xB+1 | |
3480 | |
3481 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3482 | |
3483 movlw LOW d'320' ; 0C = 32F | |
3484 addwf xC+0,F | |
3485 movlw HIGH d'320' | |
3486 addwfc xC+1,F | |
3487 | |
3488 movff xC+0,lo | |
3489 movff xC+1,hi ; restore lo and hi with updated value | |
3490 return | |
3491 | |
3492 END |