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