Mercurial > public > hwos_code
annotate src/tft_outputs.asm @ 649:ef2ed7e3a895
Merge
author | heinrichs weikamp |
---|---|
date | Fri, 04 Mar 2022 08:30:23 +0100 |
parents | 357341239438 070528a88715 |
children | bc214815deb2 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
640 | 3 ; File tft_outputs.asm * combined next generation V3.12.3 |
0 | 4 ; |
623 | 5 ; high-level Display Outputs |
0 | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
10 ; 2011-08-07 : [mH] moving from OSTC code | |
11 | |
604 | 12 #include "hwos.inc" ; mandatory header |
13 #include "shared_definitions.h" ; mailbox from/to p2_deco.c | |
582 | 14 #include "tft.inc" |
15 #include "start.inc" | |
16 #include "strings.inc" | |
17 #include "convert.inc" | |
18 #include "varargs.inc" | |
19 #include "math.inc" | |
20 #include "eeprom_rs232.inc" | |
21 #include "adc_lightsensor.inc" | |
22 #include "surfmode.inc" | |
23 #include "divemode.inc" | |
24 #include "ghostwriter.inc" | |
25 #include "customview.inc" | |
26 #include "i2c.inc" | |
27 #include "calibrate.inc" | |
604 | 28 #include "gaslist.inc" |
29 #include "rx_ops.inc" | |
631 | 30 #include "logbook.inc" |
634 | 31 #include "external_flash.inc" |
32 #include "colorschemes.inc" | |
623 | 33 |
34 | |
35 ;---- external Functions ----------------------------------------------------- | |
560 | 36 |
604 | 37 extern get_first_gas_to_WREG |
623 | 38 |
39 ;---- external Texts --------------------------------------------------------- | |
604 | 40 |
41 extern tFirmware | |
631 | 42 extern tFirmwareDate |
628 | 43 extern tHardware |
604 | 44 extern tSerial |
45 extern tTotalDives | |
46 extern tBatteryV | |
631 | 47 extern tSensorC |
48 extern tSensorD | |
604 | 49 extern tUptime |
50 extern tPPO2MIN | |
51 extern tPPO2Max | |
52 extern tPPO2DECO | |
623 | 53 extern tbar |
54 | |
55 IFDEF _ccr_pscr | |
56 extern tPPO2MINCC | |
57 ENDIF | |
604 | 58 |
59 IFDEF _rx_functions | |
60 extern tFirmware_rx | |
61 ENDIF | |
0 | 62 |
623 | 63 IFDEF _compass |
64 extern tCalX,tCalY,tCalZ | |
65 ENDIF | |
66 | |
67 | |
634 | 68 ;============================================================================= |
69 pallet_table CODE_PACK 0x09800 ; must be at 0x***00 | |
70 ;============================================================================= | |
71 | |
72 | |
73 pallet_table: | |
640 | 74 ; mask disabled memo advice attention warning ; pallet |
75 ; --------------- ------------------- --------------- --------------- --------------- --------------- -------- | |
76 DB color_green, color_lightblue, color_white, color_green, color_yellow, color_red ; standard | |
77 DB color_red, color_dark_red, color_orange, color_greenish, color_pink, color_red ; reddish | |
78 DB color_cyan, color_dark_green, color_green, color_green, color_cyan, color_red ; greenish | |
79 DB color_blue, color_deepblue, color_lightblue,color_greenish, color_orange, color_red ; blueish | |
634 | 80 |
623 | 81 |
0 | 82 ;============================================================================= |
634 | 83 tft_out1 CODE |
84 ;============================================================================= | |
85 | |
86 | |
87 ;----------------------------------------------------------------------------- | |
88 ; load standard Color Pallet | |
89 ; | |
90 global TFT_load_std_color_pallet | |
91 TFT_load_std_color_pallet: | |
92 clrf WREG ; select standard pallet | |
93 bra TFT_load_color_pallet ; load color pallet | |
94 | |
95 | |
96 ;----------------------------------------------------------------------------- | |
97 ; load Dive Mode Color Pallet | |
98 ; | |
99 global TFT_load_dive_color_pallet | |
100 TFT_load_dive_color_pallet: | |
101 movff opt_dive_color_scheme,WREG ; get color scheme selection | |
102 ;bra TFT_load_color_pallet ; load color pallet | |
103 | |
104 | |
105 ; Helper Function - load color pallet | |
106 TFT_load_color_pallet: | |
107 mullw .6 ; 6 bytes per pallet, compute pallet offset | |
108 | |
109 movf PRODL,W ; get pallet offset, low | |
110 movwf TBLPTRL ; set table pointer, low | |
111 | |
112 movlw HIGH (pallet_table) ; get start of table, high | |
113 movwf TBLPTRH ; set table pointer, high | |
114 | |
115 movlw UPPER (pallet_table) ; get start of table, upper | |
116 movwf TBLPTRU ; set table pointer, upper | |
117 | |
118 lfsr FSR2,pallet_color_mask ; point to first color in pallet | |
119 movlw .6 ; initialize loop counter | |
120 TFT_load_color_pallet_loop: | |
121 TBLRD*+ ; read color | |
122 movff TABLAT,POSTINC2 ; copy color to pallet | |
123 decfsz WREG ; decrement loop counter, reached zero? | |
124 bra TFT_load_color_pallet_loop ; NO - loop | |
125 return ; YES - done | |
623 | 126 |
582 | 127 |
0 | 128 ;============================================================================= |
634 | 129 tft_out2 CODE |
130 ;============================================================================= | |
131 | |
132 | |
133 ;----------------------------------------------------------------------------- | |
134 ; Color-Code a Tank Pressure or SAC Rate | |
135 ; | |
136 ; Input hi:lo pressure / SAC rate | |
137 ; | |
138 TFT_color_code_pres_sac: | |
604 | 139 btfss hi,int_not_avail_flag ; is the not-available flag set? |
140 bra TFT_color_code_tank_pres_1 ; NO | |
141 bcf hi,int_not_avail_flag ; YES - clear not-available flag | |
634 | 142 TFT_color_code_tank_pres_0: ; - entry point for outdated flag |
143 bcf hi,int_outdated_flag ; - clear outdated flag (it may be set) | |
144 bcf hi,int_warning_flag ; - clear warning flag (it may be set) | |
145 bcf hi,int_attention_flag ; - clear attention flag (it may be set) | |
146 FONT_COLOR_DISABLED ; - set to disabled color and return | |
147 return ; - done | |
148 | |
604 | 149 TFT_color_code_tank_pres_1: |
150 btfsc hi,int_outdated_flag ; is the outdated flag set? | |
151 bra TFT_color_code_tank_pres_0 ; YES - handle alike with not-available flag | |
634 | 152 btfss hi,int_warning_flag ; NO - is the warning flag set? |
153 bra TFT_color_code_tank_pres_2 ; NO | |
154 bcf hi,int_attention_flag ; YES - clear attention flag (it may be set) | |
155 bcf hi,int_warning_flag ; - clear warning flag | |
156 FONT_COLOR_WARNING ; - select warning color | |
157 return ; - done | |
158 | |
604 | 159 TFT_color_code_tank_pres_2: |
634 | 160 btfss hi,int_attention_flag ; is the attention flag set? |
161 bra TFT_color_code_tank_pres_3 ; NO - set memo color and return | |
162 bcf hi,int_attention_flag ; YES - clear attention flag | |
163 FONT_COLOR_ATTENTION ; - set to attention color | |
164 return ; - done | |
165 | |
604 | 166 TFT_color_code_tank_pres_3: |
634 | 167 FONT_COLOR_MEMO ; set to memo color |
168 return ; done | |
169 | |
170 | |
171 ;----------------------------------------------------------------------------- | |
172 ; Color-Code a Gas by its ppO2 | |
173 ; | |
174 ; Input hi O2% of the gas | |
175 ; pressure_abs_10 current absolute pressure / 10 | |
176 ; | |
582 | 177 global TFT_color_code_gaslist |
634 | 178 TFT_color_code_gaslist: |
179 ; check for very high ppO2 | |
180 MOVII pressure_abs_10,xA ; get absolute pressure / 10 | |
181 movff hi,xB+0 ; get O2% | |
182 clrf xB+1 ; ... | |
623 | 183 call mult16x16 ; hi * absolute pressure / 10 |
634 | 184 ; check if ppO2 > 6.55 bar |
623 | 185 tstfsz xC+2 ; char_I_O2_ratio * absolute pressure / 10 > 65536, i.e. ppO2 > 6.55 bar ? |
634 | 186 bra TFT_color_code_gaslist_warn ; YES - set warning color and return |
187 | |
188 ; check if ppO2 > 3.30 bar | |
189 btfsc xC+1,7 ; ppO2 > 3.30 bar ? | |
190 bra TFT_color_code_gaslist_warn ; YES - set warning color and return | |
191 | |
192 ; check for low ppO2 | |
193 MOVII xC,sub_a ; get ppO2 of the gas | |
194 movff char_I_ppO2_min,WREG ; get minimum ppO2 | |
195 mullw d'100' ; compute (minimum ppO2) * 100 | |
196 MOVII PRODL,sub_b ; copy result to sub_b | |
623 | 197 call cmpU16 ; compare (sub_a - sub_b) |
604 | 198 btfsc neg_flag ; lower than ppO2 min? |
634 | 199 bra TFT_color_code_gaslist_warn ; YES - set warning color and return |
200 | |
201 ; check for high ppO2 | |
604 | 202 movff char_O_deco_info,WREG ; bank-safe copy of deco info vector |
628 | 203 btfsc WREG,deco_mode ; are we in deco? |
604 | 204 bra TFT_color_code_gaslist_deco ; YES - check against ppO2 max deco only |
634 | 205 |
206 ; check for ppO2 max travel/normal | |
623 | 207 movff char_I_ppO2_max_work,WREG ; ppo2 max during working phase |
208 mullw d'100' ; char_I_ppO2_max_work*100 | |
628 | 209 ADDLI ppO2_margin_on_max,PROD ; add ppO2 margin on max value to compensate for surface pressures > 1000 hPa |
210 MOVII PRODL,sub_b ; copy result to sub_b | |
623 | 211 call cmpU16 ; compare (sub_a - sub_b) |
604 | 212 btfss neg_flag ; higher than ppO2 max travel/deco? |
634 | 213 FONT_COLOR_ATTENTION ; YES - set attention color |
214 ;bra TFT_color_code_gaslist_deco ; continue checking against max deco | |
215 | |
216 ; check for ppO2 max deco | |
604 | 217 TFT_color_code_gaslist_deco: |
218 movff char_I_ppO2_max_deco,WREG ; ppo2 max for deco | |
623 | 219 mullw d'100' ; char_I_ppO2_max_deco * 100 |
628 | 220 ADDLI ppO2_margin_on_max,PROD ; add ppO2 margin on max value to compensate for surface pressures > 1000 hPa |
221 MOVII PRODL,sub_b ; copy result to sub_b | |
623 | 222 call cmpU16 ; compare (sub_a - sub_b) |
634 | 223 btfsc neg_flag ; higher than ppO2 max deco? |
224 return ; NO - done | |
225 ;bra TFT_color_code_gaslist_warn ; YES - set warning color and return | |
226 | |
227 | |
228 ; Helper Function - set waring color and return | |
229 TFT_color_code_gaslist_warn: | |
230 FONT_COLOR_WARNING ; select warning color | |
231 return ; done | |
232 | |
233 | |
234 ;----------------------------------------------------------------------------- | |
235 ; Color-Code the Ceiling Depth | |
236 ; | |
237 ; Input mpr ceiling depth [mbar] | |
238 ; pressure_rel_cur_cached current relative pressure [mbar] | |
239 ; | |
240 TFT_color_code_ceiling: | |
241 ; check for invalid | |
582 | 242 btfsc hi,char_invalid_flag ; is the invalid flag set? (bit 7 here) |
634 | 243 bra TFT_color_code_ceiling_dis ; YES - set to disabled color and return |
244 | |
245 ; check for ceiling | |
246 MOVII pressure_rel_cur_cached,sub_a;get current pressure to sub_a | |
247 MOVII mpr,sub_b ; get ceiling to sub_b | |
248 call cmpU16 ; sub_a - sub_b = relative pressure [mbar] - int_O_ceiling [mbar] | |
249 btfss neg_flag ; is current depth < ceiling (too shallow) ? | |
250 bra TFT_color_code_ceiling_memo ; NO - set to memo color and return | |
251 | |
252 ; check for outside | |
253 movff char_O_deco_warnings,WREG ; bank-safe copy of deco warnings | |
254 btfss WREG,outside_warning ; are we currently outside of the ZH-L16 model? | |
255 bra TFT_color_code_ceiling_attn ; NO - set to attention color and return | |
256 ;bra TFT_color_code_ceiling_warn ; YES - set to warnings color and return | |
257 | |
258 | |
259 ; Helper Functions - select color and return | |
260 TFT_color_code_ceiling_warn: | |
261 FONT_COLOR_WARNING ; select color | |
262 return ; done | |
263 | |
264 TFT_color_code_ceiling_attn: | |
265 FONT_COLOR_ATTENTION ; select color | |
266 return ; done | |
267 | |
268 TFT_color_code_ceiling_memo: | |
269 FONT_COLOR_MEMO ; select color | |
270 return ; done | |
271 | |
272 TFT_color_code_ceiling_dis: | |
560 | 273 bcf hi,char_invalid_flag ; clear the invalid flag (bit 7 here) |
634 | 274 FONT_COLOR_DISABLED ; select disabled color |
275 return ; done | |
276 | |
277 | |
278 ;----------------------------------------------------------------------------- | |
279 ; Color-Code the Stop Depth | |
280 ; | |
281 ; memo color if below stop depth, | |
282 ; attention color if above stop but below ceiling*, | |
283 ; warning color if above stop and ceiling* | |
284 ; | |
285 ; Input: depth_meter current depth | |
286 ; lo stop depth | |
287 ; char_O_deco_gas deco data valid flag | |
288 ; | |
289 ; * the ceiling depth is calculated using current (interpolated) GF | |
290 ; | |
291 TFT_color_code_stop: | |
292 ; check for invalid | |
560 | 293 movff char_O_deco_gas+0,WREG ; get flag for invalid deco data |
294 btfsc WREG,char_invalid_flag ; is the invalid flag set? | |
634 | 295 bra TFT_color_code_stop_dis ; YES - set to disabled color and return |
296 | |
297 ; check for shallower than stop depth | |
298 movf lo,W ; get depth of first stop in meters into WREG | |
299 subwf depth_meter,W ; compute current depth - stop depth | |
300 btfsc STATUS,C ; result negative? | |
301 bra TFT_color_code_stop_1 ; NO - not shallower than stop depth, check for ascent advice | |
302 MOVII int_O_ceiling,sub_b ; YES - get ceiling depth in mbar | |
303 btfsc sub_b+1,char_invalid_flag ; - is the invalid flag set? (bit 7 here) | |
304 bra TFT_color_code_stop_warn ; YES - select warning color and return | |
305 MOVII pressure_rel_cur_cached,sub_a; NO - get current pressure | |
306 call cmpU16 ; - sub_a - sub_b = relative pressure - int_O_ceiling | |
307 btfsc neg_flag ; - is ceiling > current depth? | |
308 bra TFT_color_code_stop_warn ; YES - set to warning color and return | |
309 bra TFT_color_code_stop_attn ; NO - set to attention color and return | |
310 | |
311 ; check for ascent advice | |
623 | 312 TFT_color_code_stop_1: |
634 | 313 movf lo,W ; get depth of first stop in meters into WREG |
628 | 314 incf WREG,W ; compute stop depth + 1 meter |
315 subwf depth_meter,W ; compute current depth - (first stop depth + 1 meter) | |
316 btfss STATUS,C ; result negative? | |
634 | 317 bra TFT_color_code_stop_memo ; YES - within 1 meter of stop depth, use memo color |
318 btfsc deco_region ; NO - within deco stops region? | |
319 bra TFT_color_code_stop_advc ; YES - use advice color and return | |
320 ;bra TFT_color_code_stop_memo ; NO - use memo color and return | |
321 | |
322 | |
323 ; Helper Functions - select color and return | |
324 TFT_color_code_stop_memo: | |
325 FONT_COLOR_MEMO ; select color | |
326 return ; done | |
327 | |
328 TFT_color_code_stop_advc: | |
329 FONT_COLOR_ADVICE ; select color | |
330 bsf win_invert ; print in inverse | |
331 return ; done | |
332 | |
333 TFT_color_code_stop_attn: | |
334 FONT_COLOR_ATTENTION ; select color | |
335 return ; done | |
336 | |
337 TFT_color_code_stop_warn: | |
338 FONT_COLOR_WARNING ; select color | |
339 return ; done | |
340 | |
341 TFT_color_code_stop_dis: | |
342 FONT_COLOR_DISABLED ; select color | |
343 return ; done | |
344 | |
345 | |
346 ;----------------------------------------------------------------------------- | |
347 ; Color-Code the current Depth | |
348 ; | |
623 | 349 TFT_color_code_depth: |
631 | 350 TSTOSS opt_depth_warn ; depth warning switched on? |
623 | 351 bra TFT_color_code_depth_no_mod ; NO |
634 | 352 btfsc warn_det_depth_limit ; YES - depth limit warning active? |
623 | 353 bra TFT_color_code_depth_warn ; YES - set to warning color |
634 | 354 bra TFT_color_code_depth_mod ; NO - check depth against MOD |
355 | |
623 | 356 TFT_color_code_depth_no_mod: |
634 | 357 btfsc warn_det_depth_limit ; depth limit warning active? |
358 bra TFT_color_code_depth_warn ; YES - set to warning color and return | |
359 bra TFT_color_code_depth_memo ; NO - set to memo color and return... | |
360 | |
623 | 361 TFT_color_code_depth_mod: |
362 IFDEF _ccr_pscr | |
363 movff opt_dive_mode,WREG ; get deco mode: 0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=PSCR | |
364 decfsz WREG,F ; in CCR mode? | |
560 | 365 bra TFT_color_code_depth_no_ccr ; NO - continue checking for ppO2 |
623 | 366 btfss bailout_mode ; YES - check if in bailout |
604 | 367 bra TFT_color_code_depth_outside; NO - continue checking for outside ZHL16 model |
634 | 368 ;bra TFT_color_code_depth_no_ccr ; YES - continue checking for ppO2 |
623 | 369 ENDIF |
634 | 370 |
560 | 371 TFT_color_code_depth_no_ccr: |
372 movff int_O_breathed_ppO2+1,WREG ; get upper byte of currently breathed ppO2 | |
373 btfsc WREG,int_warning_flag ; is the warning flag set? | |
374 bra TFT_color_code_depth_warn ; YES - animate in warning design | |
634 | 375 ;bra TFT_color_code_depth_outside; NO - continue checking for outside ZHL16 model |
376 | |
604 | 377 TFT_color_code_depth_outside: |
378 movff char_O_deco_warnings,WREG ; bank-safe copy of deco warnings | |
379 btfsc WREG,outside_warning ; are we currently outside of the ZH-L16 model? | |
623 | 380 bra TFT_color_code_depth_warn ; YES - activate depth warning |
634 | 381 btfsc WREG,outside_attention ; NO - are we near to outside of the ZH-L16 model? |
623 | 382 bra TFT_color_code_depth_att ; YES - activate depth attention |
634 | 383 ;bra TFT_color_code_depth_memo ; NO - select memo color and return |
384 | |
385 | |
386 ; Helper Functions - set colors and attention/warning flags | |
387 TFT_color_code_depth_memo: | |
388 bcf depth_color_warning ; terminate depth warning | |
389 bcf depth_color_attention ; terminate depth attention | |
390 FONT_COLOR_MEMO ; select color | |
391 return ; done | |
392 | |
300
5ad479f2a868
Merged Screen layout mod #1 into Screen layout work #3
Janos Kovacs <kovjanos@gmail.com>
parents:
275
diff
changeset
|
393 TFT_color_code_depth_warn: |
634 | 394 bsf depth_color_warning ; activate depth warning |
395 bcf depth_color_attention ; terminate depth attention | |
396 FONT_COLOR_WARNING ; select warning color | |
397 return ; done | |
398 | |
604 | 399 TFT_color_code_depth_att: |
634 | 400 bcf depth_color_warning ; terminate depth warning |
401 bsf depth_color_attention ; activate depth attention | |
402 FONT_COLOR_ATTENTION ; select attention | |
403 return ; done | |
404 | |
405 | |
406 ;----------------------------------------------------------------------------- | |
407 ; Color-Code a CNS Value | |
408 ; | |
409 ; Input hi:lo CNS value [%] | |
410 ; | |
582 | 411 global TFT_color_code_cns |
634 | 412 TFT_color_code_cns: |
560 | 413 btfss hi,int_invalid_flag ; is the invalid flag set? |
414 bra TFT_color_code_cns_1 ; NO | |
582 | 415 bcf hi,int_invalid_flag ; YES - clear invalid flag |
634 | 416 bcf hi,int_warning_flag ; - clear warning flag (it may be set) |
417 bcf hi,int_attention_flag ; - clear attention flag (it may be set) | |
418 FONT_COLOR_DISABLED ; - select disabled color | |
419 return ; - done | |
420 | |
628 | 421 TFT_color_code_cns_1: |
560 | 422 btfss hi,int_warning_flag ; is the warning flag set? |
423 bra TFT_color_code_cns_2 ; NO | |
604 | 424 bcf hi,int_warning_flag ; YES - clear warning flag |
425 bcf hi,int_attention_flag ; - clear attention flag (it may be set) | |
634 | 426 FONT_COLOR_WARNING ; - select warning color |
427 return ; - done | |
428 | |
560 | 429 TFT_color_code_cns_2: |
582 | 430 btfss hi,int_attention_flag ; is the attention flag set? |
634 | 431 bra TFT_color_code_cns_3 ; NO - select memo color |
582 | 432 bcf hi,int_attention_flag ; YES - clear attention flag |
634 | 433 FONT_COLOR_ATTENTION ; - select attention color |
434 return ; - done | |
435 | |
436 TFT_color_code_cns_3: | |
437 FONT_COLOR_MEMO ; select memo color | |
438 return ; done | |
439 | |
440 | |
441 ;----------------------------------------------------------------------------- | |
442 ; Color-Code a Supersaturation Value | |
443 ; | |
444 ; Input hi:lo CNS value [%] | |
445 ; | |
446 ; with int_O_lead_supersat, the upper byte is solely used for the flags | |
447 ; and not for the value, thus there is no need to clear the flags | |
448 ; | |
449 TFT_color_code_supersat: | |
450 movf pallet_color_memo,W ; load memo color by default | |
451 btfsc hi,int_attention_flag ; is the attention flag set? | |
452 movf pallet_color_attention,W ; YES - replace by attention color | |
453 btfsc hi,int_warning_flag ; is the warning flag set? | |
454 movf pallet_color_warning,W ; YES - replace by warning color | |
582 | 455 btfsc hi,int_invalid_flag ; is the invalid flag set? |
634 | 456 movf pallet_color_disabled,W ; YES - replace by disabled color |
457 movwf font_color ; set font color | |
458 return ; done | |
459 | |
460 | |
461 ;----------------------------------------------------------------------------- | |
462 ; Color-Code a ppO2 Value by its warning flags (16 bit) | |
463 ; | |
464 ; Input hi:lo ppO2 value [cbar] | |
465 ; | |
466 TFT_color_code_ppo2: | |
560 | 467 btfss hi,int_warning_flag ; is the warning flag set? |
468 bra TFT_color_code_ppo2_1 ; NO | |
582 | 469 bcf hi,int_warning_flag ; YES - clear warning flag |
634 | 470 bcf hi,int_attention_flag ; - clear attention flag (it may be set) |
471 bcf hi,int_high_flag ; - clear high warning flag (it may be set) | |
472 bcf hi,int_low_flag ; - clear low warning flag (it may be set) | |
473 FONT_COLOR_WARNING ; - select warning color | |
474 return ; - done | |
475 | |
560 | 476 TFT_color_code_ppo2_1: |
582 | 477 btfss hi,int_attention_flag ; is the attention flag set? |
478 bra TFT_color_code_ppo2_2 ; NO | |
479 bcf hi,int_attention_flag ; YES - clear attention flag (it may be set) | |
634 | 480 bcf hi,int_high_flag ; - clear high warning flag (it may be set) |
481 bcf hi,int_low_flag ; - clear low warning flag (it may be set) | |
482 FONT_COLOR_ATTENTION ; - select to attention color | |
483 return ; - done | |
484 | |
582 | 485 TFT_color_code_ppo2_2: |
486 bcf hi,int_high_flag ; clear high warning flag (it may be set) | |
487 bcf hi,int_low_flag ; clear low warning flag (it may be set) | |
634 | 488 FONT_COLOR_MEMO ; select memo color |
489 return ; done | |
490 | |
623 | 491 |
492 IFDEF _ccr_pscr | |
560 | 493 |
634 | 494 ;----------------------------------------------------------------------------- |
495 ; Color-Code a ppO2 Value by its warning flags (8 bit) | |
496 ; | |
497 ; Input lo ppO2 value [cbar] | |
498 ; | |
499 TFT_color_code_ppo2_hud: | |
604 | 500 movff char_O_deco_info,WREG ; get the deco info vector |
634 | 501 btfss WREG,deco_mode ; in deco? |
560 | 502 bra TFT_color_code_ppo2_hud_a ; NO - load normal max value as threshold |
634 | 503 movff char_I_ppO2_max_deco,WREG ; YES - load deco max value as threshold |
504 bra TFT_color_code_ppo2_hud_b ; continue | |
505 | |
582 | 506 TFT_color_code_ppo2_hud_a: |
623 | 507 movff char_I_ppO2_max_work,WREG ; ppO2 max while in working phase |
634 | 508 ;bra TFT_color_code_ppo2_hud_b ; continue |
509 | |
582 | 510 TFT_color_code_ppo2_hud_b: |
511 cpfsgt lo ; lo > threshold? | |
512 bra TFT_color_code_ppo2_hud1 ; NO - continue with checking for ppO2 low | |
634 | 513 FONT_COLOR_WARNING ; YES - set warning color |
514 return ; - done | |
515 | |
0 | 516 TFT_color_code_ppo2_hud1: |
560 | 517 movff opt_dive_mode,WREG ; 0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=PSCR |
634 | 518 decfsz WREG,F ; in CCR mode? |
519 bra TFT_color_code_ppo2_hud_nocc; NO - check with ppO2 min for OC mode | |
520 btfsc bailout_mode ; YES - in bailout mode? | |
521 bra TFT_color_code_ppo2_hud_nocc; YES - check with ppO2 min for OC mode | |
522 movff char_I_ppO2_min_loop,WREG ; NO - check with ppO2 min for loop mode | |
523 bra TFT_color_code_ppo2_hud_com ; - continue with common part | |
524 | |
560 | 525 TFT_color_code_ppo2_hud_nocc: |
634 | 526 movff char_I_ppO2_min,WREG ; get ppO2 min for all other modes |
527 ;bra TFT_color_code_ppo2_hud_com ; continue with common part | |
528 | |
529 TFT_color_code_ppo2_hud_com: | |
582 | 530 cpfslt lo ; lo < char_I_ppO2_min? |
634 | 531 bra TFT_color_code_ppo2_hud_com1; NO - set memo color |
532 FONT_COLOR_WARNING ; YES - set warning color | |
533 return ; - done | |
534 | |
535 TFT_color_code_ppo2_hud_com1: | |
536 FONT_COLOR_MEMO ; select memo color | |
537 return ; done | |
623 | 538 |
539 ENDIF ; _ccr_pscr | |
540 | |
634 | 541 |
542 ;----------------------------------------------------------------------------- | |
543 ; Color-Code the Battery Level | |
544 ; | |
545 ; Input battery_low_condition battery status flag | |
546 ; | |
547 TFT_color_code_battery: | |
548 movf pallet_color_memo,W ; get memo color by default | |
549 btfsc battery_low_condition ; battery low condition detected? | |
550 movf pallet_color_warning,W ; YES - switch to warning color | |
551 movwf font_color ; set font color | |
552 return ; done | |
553 | |
554 | |
555 ;----------------------------------------------------------------------------- | |
556 ; Color-Code according to Gas Number | |
557 ; | |
558 ; Input WREG gas number | |
559 ; | |
560 global TFT_color_code_gas | |
561 TFT_color_code_gas: | |
562 movwf up ; copy gas number (1-6) to up | |
563 movlw color_white ; default color | |
564 dcfsnz up,F ; gas 1 ? | |
565 movlw color_white ; YES - color for gas 1 | |
566 dcfsnz up,F ; gas 2 ? | |
567 movlw color_green ; YES - color for gas 2 | |
568 dcfsnz up,F ; gas 3 ? | |
569 movlw color_red ; YSE - color for gas 3 | |
570 dcfsnz up,F ; gas 4 ? | |
571 movlw color_yellow ; YES - color for gas 4 | |
572 dcfsnz up,F ; gas 5 ? | |
573 movlw color_cyan ; YES - color for gas 5 | |
574 dcfsnz up,F ; gas 6 ? | |
575 movlw color_pink ; YES - color for gas 6 | |
576 movwf font_color ; set color | |
577 return ; done | |
578 | |
579 | |
623 | 580 ;============================================================================= |
634 | 581 tft_out3 CODE |
582 ;============================================================================= | |
583 | |
584 | |
585 ;----------------------------------------------------------------------------- | |
586 ; Surface Mode Screen - current Time | |
587 ; | |
588 global TFT_surfmode_time | |
589 TFT_surfmode_time: | |
590 WIN_SMALL surf_clock_column+.7,surf_clock_row | |
591 FONT_COLOR_MEMO ; set color | |
592 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time | |
593 movff rtc_latched_hour,lo ; get hours | |
594 output_99 ; print hours (0-99) | |
595 movlw ':' ; load a ":" | |
596 movff rtc_latched_secs,lo ; get seconds | |
597 btfss lo,0 ; on even second? | |
598 movlw ' ' ; NO - load a space char | |
599 movwf POSTINC2 ; print ":" or space char | |
600 movff rtc_latched_mins,lo ; get minutes | |
601 output_99x ; print minutes (00-99) | |
602 PRINT ; dump to screen | |
603 return ; done | |
604 | |
605 | |
606 ;----------------------------------------------------------------------------- | |
607 ; Surface Mode Screen - current Date | |
608 ; | |
609 global TFT_surfmode_date | |
610 TFT_surfmode_date: | |
611 WIN_SMALL surf_date_column,surf_date_row | |
612 FONT_COLOR_MEMO ; set color | |
613 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time | |
614 movff rtc_latched_year, lo ; copy year to lo | |
615 movff rtc_latched_month,hi ; copy month to hi | |
616 movff rtc_latched_day, up ; copy day to up | |
617 call output_date ; print date | |
618 PRINT ; dump to screen | |
619 return ; done | |
620 | |
621 | |
622 ;----------------------------------------------------------------------------- | |
623 ; Surface Mode Screen - show Pressure, on condition deltaP > threshold | |
624 ; | |
625 global TFT_surfmode_pres_fast | |
626 TFT_surfmode_pres_fast: | |
627 SMOVII pressure_abs, sub_a ; ISR-safe 2 byte copy of current absolute pressure to sub_a | |
628 MOVII pressure_abs_ref,sub_b ; standard 2 byte copy 10 min ago absolute pressure to sub_b | |
629 call subU16 ; sub_c = | sub_a - sub_b | = deltaP | |
630 tstfsz sub_c+1 ; deltaP > 255 mbar ? | |
631 bra TFT_pres_surfmode_fast_1 ; YES - show current pressure | |
632 movlw pressure_noise_threshold+.1 ; NO - load noise suppression threshold | |
633 subwf sub_c+0,W ; - subtract threshold from deltaP | |
634 bc TFT_pres_surfmode_fast_1 ; - result negative -> show current pressure | |
635 tstfsz pressure_update_lag_counter ; - still in lag time? | |
636 bra TFT_pres_surfmode_fast_0 ; YES - continue updating the display | |
637 return ; NO - no display updates any more, done | |
638 | |
639 TFT_pres_surfmode_fast_0: | |
640 decf pressure_update_lag_counter,F ; clock down lag time counter | |
641 bra TFT_surfmode_pres ; update display | |
642 | |
643 TFT_pres_surfmode_fast_1: | |
644 movlw pressure_noise_lag_time ; get lag time | |
645 movwf pressure_update_lag_counter ; re-set lag time counter | |
646 ;bra TFT_surfmode_pres ; update display | |
647 | |
648 | |
649 ;----------------------------------------------------------------------------- | |
650 ; Surface Mode Screen - show Pressure (unconditional) | |
651 ; | |
652 global TFT_surfmode_pres | |
653 TFT_surfmode_pres: | |
654 ; value | |
655 WIN_SMALL surf_press_column+.8,surf_press_row | |
656 FONT_COLOR_MEMO ; set color | |
657 SMOVII pressure_abs,mpr ; get current pressure | |
658 FONT_COLOR_MEMO ; print in standard color | |
659 output_9999 ; print (0-9999) | |
660 PRINT ; dump buffer to screen | |
661 ; unit | |
662 WIN_SMALL surf_press_column+(4+1)*8,surf_press_row | |
663 FONT_COLOR_MASK ; switch to mask color | |
664 STRCPY_TEXT_PRINT tMBAR ; print unit (hPa) | |
665 return ; done | |
666 | |
667 | |
668 ;----------------------------------------------------------------------------- | |
669 ; Surface Mode Screen - Temperature | |
670 ; | |
671 global TFT_surfmode_temp | |
672 TFT_surfmode_temp: | |
673 ; unit | |
674 WIN_SMALL surf_temp_column+3*8,surf_temp_row | |
675 FONT_COLOR_MASK ; select mask color | |
676 TSTOSS opt_units ; 0=°C, 1=°F | |
677 bra TFT_temp_surfmode_metric ; 0: metric | |
678 ;bra TFT_temp_surfmode_imperial ; 1: imperial | |
679 | |
680 TFT_temp_surfmode_imperial: | |
681 STRCAT_TEXT tLogTunitF ; print "°F" | |
682 bra TFT_temp_surfmode_common ; continue with common part | |
683 | |
684 TFT_temp_surfmode_metric: | |
685 STRCAT_TEXT tLogTunitC ; print "°C" | |
686 ;bra TFT_temp_surfmode_common ; continue with common part | |
687 | |
688 TFT_temp_surfmode_common: | |
689 PRINT ; dump the unit to screen | |
690 | |
691 ; value | |
692 WIN_SMALL surf_temp_column,surf_temp_row | |
693 bra TFT_temp_common ; continue with common part | |
694 | |
695 | |
696 ; Helper Function - common output for surface and dive mode temperature | |
697 TFT_temp_common: | |
698 FONT_COLOR_MEMO ; set color | |
699 SMOVII temperature_cur,mpr ; ISR-safe 2 byte copy of current temperature to hi:lo | |
700 | |
701 ; DEBUG CODE - manual override temp | |
702 ; ----------------------------------- | |
703 ; MOVLI 0xFFF6,mpr ; - 1.0 °C | |
704 ; MOVLI 0xFF9C,mpr ; -10.0 °C | |
705 | |
706 TSTOSC opt_units ; 0=°C, 1=°F | |
707 call convert_celsius_to_fahrenheit;1 - convert value in lo:hi from Celsius to Fahrenheit | |
708 call convert_signed_16bit ; convert lo:hi into signed-short and print '-' if negative | |
709 btfsc neg_flag ; is the temperature negative? | |
710 bsf hide_digit4 ; YES - do not print digit 4 | |
711 bsf omit_digit_1 ; do not print digit 1 (0.1°) | |
712 output_9999 ; print temperature (0x-999x / 0x-99x if negative) | |
713 | |
714 btfss divemode ; in dive mode? | |
715 bra TFT_temp_common_no_unit ; NO - no unit to append | |
716 TSTOSS opt_units ; YES - check unit type: 0=°C, 1=°F | |
717 bra TFT_temp_common_metric ; 0 - metric | |
718 ;bra TFT_temp_common_imperial ; 1 - imperial | |
719 | |
720 TFT_temp_common_imperial: | |
721 STRCAT_TEXT_PRINT tLogTunitF ; append "°F" and dump to screen | |
722 return ; done | |
723 | |
724 TFT_temp_common_metric: | |
725 STRCAT_TEXT_PRINT tLogTunitC ; append "°C" and dump to screen | |
726 return ; done | |
727 | |
728 TFT_temp_common_no_unit: | |
729 PRINT ; dump to screen | |
730 return ; done | |
731 | |
732 | |
733 ;----------------------------------------------------------------------------- | |
734 ; Surface Mode Screen - Battery Status | |
735 ; | |
736 global TFT_surfmode_batt | |
737 TFT_surfmode_batt: | |
738 FONT_COLOR_MEMO ; set default color | |
739 | |
740 ; apply charging indicator and warnings | |
741 clrf WREG ; default to no indication/warning | |
742 btfsc cc_active ; charging in CC mode? | |
743 movlw color_yellow ; YES - set output color to yellow | |
744 btfsc cv_active ; charging in CV mode? | |
745 movlw color_green ; YES - set output color to green | |
631 | 746 btfsc battery_low_condition ; battery low condition detected? |
634 | 747 movf pallet_color_warning,W ; YES - set output to warning color |
748 btfsc battery_overtemp ; battery over-temperature detector tripped? | |
749 movf pallet_color_warning,W ; YES - set output to warning color | |
750 tstfsz WREG ; any indicator or warning active? | |
751 bsf win_invert ; YES - set output to inverse | |
752 tstfsz WREG ; any indicator or warning active (asked again)? | |
753 movwf font_color ; YES - change color | |
754 | |
755 WIN_SMALL batt_percent_column+.2,batt_percent_row | |
756 movff batt_percent,lo ; get battery % | |
757 output_256 ; print battery % (0-255) | |
758 STRCAT_PRINT "% " ; append unit with trailing space and dump to screen | |
759 | |
760 WIN_TINY batt_voltage_column+.15,batt_voltage_row | |
761 FONT_COLOR_MEMO ; set color | |
762 movff battery_type,lo ; get battery type | |
763 PUTC "T" ; print "T" | |
764 output_9 ; print battery type code (0-9) | |
765 PUTC ":" ; print ":" | |
766 MOVII batt_voltage,mpr ; get battery voltage | |
767 bsf omit_digit_2 ; do not print 2nd and 1st digit | |
768 bsf decimal_digit3 ; place a decimal point in front of digit 3 | |
769 output_9999 ; print x.x-- | |
770 PUTC_PRINT 'V' ; append unit and dump to screen | |
771 return ; done | |
772 | |
773 ;update_battery_debug: | |
774 ; FONT_COLOR_MEMO | |
775 ; WIN_TINY .70,.0 | |
776 ; movff battery_gauge+5,xC+3 | |
777 ; movff battery_gauge+4,xC+2 | |
778 ; movff battery_gauge+3,xC+1 | |
779 ; movff battery_gauge+2,xC+0 | |
780 ; ; battery_gauge:6 is nAs | |
781 ; ; devide through 65536 | |
782 ; ; devide through 152 | |
783 ; ; Result is 0.01Ah in xC+1:xC+0 | |
784 ; MOVLI .152,xB | |
785 ; call div32x16 ; xC:4 = xC:4 / xB:2 with xA as remainder | |
786 ; MOVII xC,mpr | |
787 ; bsf leftbind | |
788 ; output_65535 | |
789 ; STRCAT_PRINT "x.01Ah" | |
790 ; return | |
791 | |
792 | |
793 ;----------------------------------------------------------------------------- | |
794 ; Surface Mode Screen - Deco Mode (0=OC, 1=CCR, 2=Gauge, 3=Apnoe, 4=pSCR) | |
795 ; | |
796 global TFT_surfmode_decotype | |
797 TFT_surfmode_decotype: | |
798 WIN_STD surf_decotype_column,surf_decotype_row | |
799 FONT_COLOR color_lightblue ; set font color | |
800 movff opt_dive_mode,lo ; get deco mode | |
801 tstfsz lo ; in OC mode? | |
802 bra TFT_decotype_surface_2 ; NO | |
803 STRCAT_TEXT_PRINT tDvOC ; YES - print OC | |
804 return ; - done | |
805 | |
806 TFT_decotype_surface_2: | |
807 decfsz lo,F ; in CCR mode? | |
808 bra TFT_decotype_surface_3 ; NO | |
809 IFDEF _ccr_pscr | |
810 STRCAT_TEXT_PRINT tDvCC ; YES - print CCR | |
811 | |
812 WIN_TINY surf_decotype_column+.18,surf_decotype_row+.12 | |
813 FONT_COLOR_MEMO ; - set color | |
814 movff opt_ccr_mode,WREG ; - ccr mode | |
815 tstfsz WREG ; - ccr_mode = 0 (FixedSP) ? | |
816 bra TFT_surfmode_decotype_cc_var; NO - not fixed | |
817 ;bra TFT_surfmode_decotype_cc_fix; YES - fixed | |
818 | |
819 TFT_surfmode_decotype_cc_fix: | |
820 STRCPY_TEXT tCCRModeFixedSP ; print "fixed SP" | |
821 bra TFT_decotype_surface_cc_com ; continue | |
822 | |
823 TFT_surfmode_decotype_cc_var: | |
824 ; Sensor or Auto SP mode | |
825 sublw .2 ; ccr_mode = 2 (Auto SP) ? | |
826 bz TFT_decotype_surface_cc_auto; YES - AutoSP | |
827 IFDEF _external_sensor | |
828 STRCPY_TEXT tCCRModeSensor ; NO - print "Sensor" | |
829 bra TFT_decotype_surface_cc_com ; - continue | |
830 ENDIF ; _external_sensor | |
831 | |
832 TFT_decotype_surface_cc_auto: | |
833 STRCPY_TEXT tCCRModeAutoSP ; print "Auto SP" | |
834 ;bra TFT_decotype_surface_cc_com ; continue | |
835 | |
836 TFT_decotype_surface_cc_com: | |
837 clrf WREG ; load string terminator | |
838 movff WREG,buffer+.8 ; limit string length to 8 | |
839 PRINT ; dump to screen | |
840 return ; done | |
841 ENDIF ; _ccr_pscr | |
842 | |
843 TFT_decotype_surface_3: | |
844 decfsz lo,F ; in gauge mode? | |
845 bra TFT_decotype_surface_4 ; NO | |
846 STRCAT_TEXT_PRINT tDvGauge ; YES - print "Gauge" | |
847 return ; - done | |
848 | |
849 TFT_decotype_surface_4: | |
850 decfsz lo,F ; in apnea mode? | |
851 bra TFT_decotype_surface_5 ; NO | |
852 STRCAT_TEXT_PRINT tDvApnea ; YES - print "Apnoe" | |
853 return ; - done | |
854 | |
855 TFT_decotype_surface_5: | |
856 STRCAT_TEXT_PRINT tDvPSCR ; print "pSCR" | |
857 return ; done | |
858 | |
859 | |
860 ;----------------------------------------------------------------------------- | |
861 ; Surface Mode Screen - small Gas List | |
862 ; | |
863 global TFT_surfmode_startgas | |
864 TFT_surfmode_startgas: | |
865 ; FIRST gas | |
582 | 866 WIN_SMALL surf_decotype_column+.1,surf_decotype_row+.30 |
634 | 867 FONT_COLOR_MEMO ; set font color |
604 | 868 call get_first_gas_to_WREG ; get first gas (1-5) into WREG |
560 | 869 decf WREG,W ; 1-5 -> 0-4 |
634 | 870 movwf PRODL ; copy to PRODL |
871 call gaslist_strcat_mix_PRODL ; print gas description | |
872 PRINT ; dump to screen | |
873 | |
874 ; show gases | |
875 WIN_TOP surf_decotype_row+.30+.25 ; set row position | |
876 | |
877 ; 1st gas | |
582 | 878 WIN_LEFT surf_decotype_boxes_left1+.1 |
879 movff opt_gas_type+0,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco | |
634 | 880 rcall TFT_surfmode_startgas_helper; set font color |
881 STRCPY_PRINT "1" ; print "1" | |
582 | 882 decfsz hi,F ; Type = 1 (First)? |
634 | 883 bra TFT_surfmode_startgas_2 ; NO - skip box |
884 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left1, surf_decotype_boxes_left1+.8 | |
885 | |
886 ; 2nd gas | |
887 TFT_surfmode_startgas_2: | |
888 WIN_LEFT surf_decotype_boxes_left2+.1 | |
582 | 889 movff opt_gas_type+1,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
634 | 890 rcall TFT_surfmode_startgas_helper; set font color |
891 STRCPY_PRINT "2" ; print "2" | |
582 | 892 decfsz hi,F ; Type = 1 (First)? |
634 | 893 bra TFT_surfmode_startgas_3 ; NO - skip box |
894 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left2, surf_decotype_boxes_left2+.8 | |
895 | |
896 ; 3rd gas | |
897 TFT_surfmode_startgas_3: | |
898 WIN_LEFT surf_decotype_boxes_left3+.1 | |
582 | 899 movff opt_gas_type+2,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
634 | 900 rcall TFT_surfmode_startgas_helper; set font color |
901 STRCPY_PRINT "3" ; print "3" | |
582 | 902 decfsz hi,F ; Type = 1 (First)? |
634 | 903 bra TFT_surfmode_startgas_4 ; NO - skip box |
904 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left3, surf_decotype_boxes_left3+.8 | |
905 | |
906 ; 4th gas | |
907 TFT_surfmode_startgas_4: | |
908 WIN_LEFT surf_decotype_boxes_left4+.1 | |
582 | 909 movff opt_gas_type+3,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
634 | 910 rcall TFT_surfmode_startgas_helper; set font color |
911 STRCPY_PRINT "4" ; print "4" | |
582 | 912 decfsz hi,F ; Type = 1 (First)? |
634 | 913 bra TFT_surfmode_startgas_5 ; NO - skip box |
914 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left4, surf_decotype_boxes_left4+.8 | |
915 | |
916 ; 5th gas | |
917 TFT_surfmode_startgas_5: | |
918 WIN_LEFT surf_decotype_boxes_left5+.1 | |
582 | 919 movff opt_gas_type+4,hi ; 0=Disabled, 1=First, 2=Travel, 3=Deco |
634 | 920 rcall TFT_surfmode_startgas_helper; set font color |
921 STRCPY_PRINT "5" ; print "5" | |
604 | 922 decfsz hi,F ; type = 1 (First)? |
634 | 923 return ; NO - done |
924 WIN_FRAME_STD surf_decotype_boxes_top, surf_decotype_boxes_bottom, surf_decotype_boxes_left5, surf_decotype_boxes_left5+.8 | |
925 return ; done | |
926 | |
927 | |
928 ; Helper Function - set font color | |
929 TFT_surfmode_startgas_helper: | |
640 | 930 movf pallet_color_disabled,W ; set default color |
634 | 931 tstfsz hi ; gas not disabled? |
932 movf pallet_color_memo,W ; YES - change to memo color | |
933 movwf font_color ; set font color | |
934 return | |
935 | |
936 IFDEF _rx_functions | |
937 | |
938 ;----------------------------------------------------------------------------- | |
939 ; Surface Mode Screen - Tank Pressure Reading above Surface Pressure | |
940 ; | |
941 global TFT_surfmode_tankpres | |
942 TFT_surfmode_tankpres: | |
943 WIN_SMALL surf_decotype_column+.6,surf_decotype_row+.30+.47 | |
944 movff int_IO_pressure_value+0,lo ; copy pressure from 1st reading to hi:lo | |
945 movff int_IO_pressure_value+1,hi ; ... | |
946 btfss hi,int_not_avail_flag ; pressure reading 1 available? | |
947 bra TFT_surface_tank_pres_0 ; YES | |
948 movff int_IO_pressure_value+2,lo ; NO - copy pressure from 2nd reading to hi:lo | |
949 movff int_IO_pressure_value+3,hi ; - ... | |
950 btfsc hi,int_not_avail_flag ; - pressure reading 2 available? | |
951 bra TFT_surface_tank_pres_1 ; NO - show not avail message | |
952 | |
953 TFT_surface_tank_pres_0: | |
954 call TFT_color_code_pres_sac ; set output color according to flags | |
955 bsf omit_digit_1 ; do not print 1st digit (0.1 bar) | |
956 output_9999 ; print (0x-999x) | |
957 PRINT ; dump to screen | |
958 bra TFT_surface_tank_pres_2 ; print unit | |
959 | |
960 TFT_surface_tank_pres_1: | |
961 FONT_COLOR_DISABLED ; select disabled color | |
962 STRCAT_PRINT " ---" ; output for no pressure data available | |
963 | |
964 TFT_surface_tank_pres_2: | |
965 WIN_SMALL surf_decotype_column+.38,surf_decotype_row+.30+.47 | |
966 FONT_COLOR_MASK ; select mask color | |
967 STRCAT_PRINT "bar" ; can not use tbar because it has a leading space | |
968 return ; done | |
969 | |
970 ENDIF ; _rx_functions | |
971 | |
972 | |
973 ;============================================================================= | |
974 tft_out4 CODE | |
975 ;============================================================================= | |
976 | |
977 | |
978 ;----------------------------------------------------------------------------- | |
979 ; Imprint the Color Schemes | |
980 ; | |
981 global TFT_imprint_color_schemes | |
982 TFT_imprint_color_schemes: | |
983 call TFT_load_dive_color_pallet ; load dive mode color pallet | |
984 | |
985 FONT_COLOR_MASK ; select mask color | |
986 WIN_TINY .12,.40 ; print labels | |
987 STRCAT_TEXT_PRINT tDepth ; ... | |
988 WIN_TINY .62,.40 ; ... | |
989 STRCAT_TEXT_PRINT tMaxDepth ; ... | |
990 WIN_TINY .122,.40 ; ... | |
991 STRCAT_TEXT_PRINT tDivetime ; ... | |
992 | |
993 FONT_COLOR_DISABLED ; select disabled color | |
994 | |
995 ; max. depth demo | |
996 WIN_MEDIUM .64,.54 ; set font and position | |
997 movlw .63 ; load demo depth | |
998 movwf lo ; ... | |
999 output_99 ; print full meters (0-99) | |
1000 PRINT ; dump to screen | |
1001 | |
1002 WIN_SMALL .87,.66 ; set font and position | |
1003 PUTC "." ; print ":" | |
1004 movlw .4 ; load demo depth | |
1005 movwf lo ; ... | |
1006 output_9 ; print decimeters (0-9) | |
1007 PRINT ; dump to screen | |
1008 | |
1009 FONT_COLOR_MEMO ; select memo color | |
1010 | |
1011 ; depth demo | |
1012 WIN_MEDIUM .3,.54 ; set font and position | |
1013 movlw .17 ; load a demo depth | |
1014 movwf lo ; ... | |
1015 output_99 ; print full meters (0-99) | |
1016 PRINT ; dump to screen | |
1017 | |
1018 WIN_SMALL .25,.66 ; set font and position | |
1019 PUTC "." ; print ":" | |
1020 movlw .5 ; load demo depth | |
1021 movwf lo ; ... | |
1022 output_9 ; print decimeters (0-9) | |
1023 PRINT ; dump to screen | |
1024 | |
1025 ; dive time demo | |
1026 WIN_MEDIUM .103, .54 ; set font and position | |
1027 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time | |
1028 movff rtc_latched_mins,lo ; get minutes | |
1029 output_256 ; print minutes (in 3 digits, 1st digit used as spacer) | |
1030 PRINT ; dump to screen | |
1031 | |
1032 WIN_SMALL .139, .66 ; set font and position | |
1033 PUTC ':' ; print ":" | |
1034 movff rtc_latched_secs,lo ; get seconds | |
1035 output_99x ; print seconds (00-99) | |
1036 PRINT ; dump to screen | |
1037 | |
1038 ; messages demo | |
1039 WIN_SMALL dm_warning1_column-.78, dm_warning1_row+.39+.12 | |
1040 FONT_COLOR_ADVICE ; select advice color | |
1041 STRCPY_TEXT_PRINT tgaschange ; sample text "Change?" | |
1042 | |
1043 WIN_SMALL dm_warning1_column, dm_warning1_row+.39 | |
1044 FONT_COLOR_ATTENTION ; select attention color | |
1045 STRCPY_TEXT_PRINT tCNSeod ; sample text "CNS final" | |
1046 | |
1047 WIN_SMALL dm_warning2_column, dm_warning2_row+.38 | |
1048 FONT_COLOR_WARNING ; select warning color | |
1049 STRCPY_TEXT_PRINT tGasNeedsWarn ; sample text "Gas Needs" | |
1050 | |
1051 call TFT_load_std_color_pallet ; re-load standard color pallet | |
1052 | |
1053 return ; done | |
1054 | |
1055 | |
1056 ;----------------------------------------------------------------------------- | |
1057 ; Surface Menu - Imprint Time & Date | |
1058 ; | |
1059 global TFT_imprint_time_date | |
1060 TFT_imprint_time_date: | |
1061 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of current date & time | |
1062 ;bra TFT_imprint_time_date_fast ; continue | |
1063 | |
1064 | |
1065 ;----------------------------------------------------------------------------- | |
1066 ; Surface Menu - Imprint Time & Date - fast Updating | |
1067 ; | |
1068 global TFT_imprint_time_date_fast | |
1069 TFT_imprint_time_date_fast: | |
1070 WIN_SMALL .20,.40 ; column, row - keep clear of the cursor area on the left! | |
1071 FONT_COLOR_MEMO ; select color | |
1072 movff rtc_latched_hour,lo ; get hours | |
1073 output_99 ; print hours (0-99) | |
1074 PUTC ':' ; print ":" | |
1075 movff rtc_latched_mins,lo ; get minutes | |
1076 output_99x ; print minutes (00-99) | |
1077 PUTC ':' ; print ":" | |
1078 movff rtc_latched_secs,lo ; get seconds | |
1079 output_99x ; print seconds (00-99) | |
1080 STRCAT " " ; append two spaces | |
1081 movff rtc_latched_year, lo ; get date | |
1082 movff rtc_latched_month,hi ; ... | |
1083 movff rtc_latched_day, up ; ... | |
1084 call output_date ; print date | |
1085 PUTC_PRINT " " ; append a space and dump to screen | |
604 | 1086 return ; done |
582 | 1087 |
1088 | |
634 | 1089 IFDEF _external_sensor |
1090 | |
1091 ;----------------------------------------------------------------------------- | |
1092 ; Surface Mode - Imprint ppO2 from Sensors | |
1093 ; | |
1094 global TFT_imprint_surf_ppO2 | |
1095 TFT_imprint_surf_ppO2: | |
1096 | |
1097 TFT_imprint_surf_ppO2_1: | |
1098 WIN_SMALL surf_hud_sensor1_column,surf_hud_sensor1_row | |
1099 btfsc sensor1_calibrated_ok ; sensor calibrated? | |
1100 bra TFT_imprint_surf_ppO2_1a ; YES | |
1101 btfsc sensor1_active ; NO - valid HUD data for this sensor? | |
1102 bra TFT_imprint_surf_ppO2_1a ; YES | |
1103 rcall TFT_imprint_surf_ppO2_h2 ; NO - print dashes | |
1104 bra TFT_imprint_surf_ppO2_2 ; - continue with sensor 2 | |
1105 TFT_imprint_surf_ppO2_1a: | |
1106 movff sensor1_ppO2,lo ; get ppO2 | |
1107 rcall TFT_imprint_surf_ppO2_h1 ; print ppO2 | |
1108 | |
1109 TFT_imprint_surf_ppO2_2: | |
1110 WIN_SMALL surf_hud_sensor2_column,surf_hud_sensor2_row | |
1111 btfsc sensor2_calibrated_ok ; sensor calibrated? | |
1112 bra TFT_imprint_surf_ppO2_2a ; YES | |
1113 btfsc sensor2_active ; NO - valid HUD data for this sensor | |
1114 bra TFT_imprint_surf_ppO2_2a ; YES | |
1115 rcall TFT_imprint_surf_ppO2_h2 ; NO - print dashes | |
1116 bra TFT_imprint_surf_ppO2_3 ; - continue with sensor 3 | |
1117 TFT_imprint_surf_ppO2_2a: | |
1118 movff sensor2_ppO2,lo ; get ppO2 | |
1119 rcall TFT_imprint_surf_ppO2_h1 ; print ppO2 | |
1120 | |
1121 TFT_imprint_surf_ppO2_3: | |
1122 WIN_SMALL surf_hud_sensor3_column,surf_hud_sensor3_row | |
1123 btfsc sensor3_calibrated_ok ; sensor calibrated? | |
1124 bra TFT_imprint_surf_ppO2_3a ; YES | |
1125 btfsc sensor3_active ; NO - valid HUD data for this sensor | |
1126 bra TFT_imprint_surf_ppO2_3a ; YES | |
1127 bra TFT_imprint_surf_ppO2_h2 ; NO - print dashes and return | |
1128 return ; - done | |
1129 TFT_imprint_surf_ppO2_3a: | |
1130 movff sensor3_ppO2,lo ; get ppO2 | |
1131 ;bra TFT_imprint_surf_ppO2_h1 ; print ppO2 and return | |
1132 | |
1133 TFT_imprint_surf_ppO2_h1: | |
1134 call TFT_color_code_ppo2_hud ; color-code with ppO2 [cbar] in lo | |
1135 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
1136 output_256 ; print (0.00-2.55) | |
1137 PRINT ; dump to screen | |
1138 return ; done | |
1139 | |
1140 TFT_imprint_surf_ppO2_h2: | |
1141 FONT_COLOR_MEMO ; select standard color | |
1142 STRCPY_PRINT "--- " ; print dashes | |
1143 return ; done | |
1144 | |
1145 | |
1146 ;----------------------------------------------------------------------------- | |
1147 ; Surface Mode - Imprint mV from Sensors | |
1148 ; | |
1149 global TFT_imprint_surf_mV | |
1150 TFT_imprint_surf_mV: | |
1151 FONT_COLOR_MEMO ; set font color | |
1152 | |
1153 ; sensor 1 | |
1154 WIN_SMALL surf_mV_sensor_column,surf_mV_sensor1_row | |
1155 SMOVII sensor1_mv,mpr ; in 0.1mV steps | |
1156 STRCAT "1: " ; print number | |
1157 rcall TFT_sensor_mV_helper ; print mV | |
1158 | |
1159 ; sensor 2 | |
1160 WIN_SMALL surf_mV_sensor_column,surf_mV_sensor2_row | |
1161 SMOVII sensor2_mv,mpr ; in 0.1mV steps | |
1162 STRCAT "2: " ; print number | |
1163 rcall TFT_sensor_mV_helper | |
1164 | |
1165 ; sensor 3 | |
1166 WIN_SMALL surf_mV_sensor_column,surf_mV_sensor3_row | |
1167 SMOVII sensor3_mv,mpr ; in 0.1mV steps | |
1168 STRCAT "3: " ; print number | |
1169 rcall TFT_sensor_mV_helper ; print mV | |
1170 | |
1171 ; print sensor connection type | |
1172 WIN_SMALL surf_mV_sensor_column,surf_mV_sensor3_row+.24 | |
1173 btfsc ext_input_optical ; optical input? | |
1174 bra TFT_sensor_mV_optical ; YES | |
1175 TSTOSS opt_s8_mode ; NO - S8 input selected? | |
1176 bra TFT_sensor_mV_analog ; NO - analog input | |
1177 ;bra TFT_sensor_mV_s8 ; YES - S8 | |
1178 | |
1179 TFT_sensor_mV_s8: | |
1180 STRCAT_PRINT "Digital" ; print "Digital" | |
1181 return ; done | |
1182 | |
1183 TFT_sensor_mV_optical: | |
1184 STRCAT_PRINT "Optical" ; print "Optical" | |
1185 return ; done | |
1186 | |
1187 TFT_sensor_mV_analog: | |
1188 STRCAT_PRINT "Analog" ; print "analog" | |
1189 return ; done | |
1190 | |
1191 | |
1192 ; Helper Function - print mV value | |
1193 TFT_sensor_mV_helper: | |
1194 bsf decimal_digit1 ; place a decimal point in front of digit 1 | |
1195 output_9999 ; print (0.0-999.9) | |
1196 STRCAT_PRINT "mV " ; append unit and dump buffer to screen | |
1197 return ; done | |
1198 | |
1199 | |
1200 ;----------------------------------------------------------------------------- | |
1201 ; Surface Mode - Imprint End-of-Life from Sensors | |
1202 ; | |
1203 ; when opt_x_sx > 255 the sensor will just give 8 mV at a ppO2 of 0.21 | |
1204 ; | |
1205 global TFT_imprint_surf_sensor_eol | |
1206 TFT_imprint_surf_sensor_eol: | |
1207 FONT_COLOR_WARNING ; set color | |
1208 | |
1209 TFT_imprint_surf_eol_1: | |
1210 ; sensor 1 | |
1211 btfss sensor1_calibrated_ok ; valid calibration? | |
1212 bra TFT_imprint_surf_eol_2 ; NO - skip | |
1213 movff opt_x_s1+1,WREG ; YES - get high(opt_x_s1) | |
1214 movf WREG,W ; - excite flags | |
1215 bz TFT_imprint_surf_eol_2 ; - opt_x_s1 > 255 -> the sensor is not too bad yet for a warning | |
1216 WIN_SMALL surf_mV_sensor_status_column,surf_mV_sensor1_row-.5 | |
1217 STRCPY_PRINT "\xb8" ; mark sensor as being at end of lifetime | |
1218 | |
1219 TFT_imprint_surf_eol_2: | |
1220 ; sensor 2 | |
1221 btfss sensor2_calibrated_ok ; valid calibration? | |
1222 bra TFT_imprint_surf_eol_3 ; NO - skip | |
1223 movff opt_x_s2+1,WREG ; YES - get high(opt_x_s2) | |
1224 movf WREG,W ; - excite flags | |
1225 bz TFT_imprint_surf_eol_3 ; - opt_x_s2 > 255 -> the sensor is not too bad yet for a warning | |
1226 WIN_SMALL surf_mV_sensor_status_column,surf_mV_sensor2_row-.5 | |
1227 STRCPY_PRINT "\xb8" ; mark sensor as being at end of lifetime | |
1228 | |
1229 TFT_imprint_surf_eol_3: | |
1230 ; sensor 3 | |
1231 btfss sensor3_calibrated_ok ; valid calibration? | |
1232 bra TFT_imprint_surf_eol_4 ; NO - skip | |
1233 movff opt_x_s3+1,WREG ; YES - get high(opt_x_s3) | |
1234 movf WREG,W ; - excite flags | |
1235 bz TFT_imprint_surf_eol_4 ; - opt_x_s3 > 255 -> the sensor is not too bad yet for a warning | |
1236 WIN_SMALL surf_mV_sensor_status_column,surf_mV_sensor3_row-.5 | |
1237 STRCPY_PRINT "\xb8" ; mark sensor as being at end of lifetime | |
1238 | |
1239 TFT_imprint_surf_eol_4: | |
1240 return ; done | |
1241 | |
1242 | |
1243 ;----------------------------------------------------------------------------- | |
1244 ; Imprint Function for the Calibration Menu | |
1245 ; | |
1246 global TFT_imprint_menu_mV | |
1247 TFT_imprint_menu_mV: | |
1248 FONT_COLOR color_yellow ; show in yellow | |
1249 rcall TFT_sensor_mv_get ; get sensor mV values | |
1250 | |
1251 ; sensor 1 | |
1252 WIN_SMALL surf_menu_sensor1_column,surf_menu2_sensor1_row | |
1253 SMOVII sensor1_mv,mpr ; in 0.1mV steps | |
1254 rcall TFT_imprint_menu_mV_helper ; print mV value | |
1255 | |
1256 ; sensor 2 | |
1257 WIN_SMALL surf_menu_sensor2_column,surf_menu2_sensor2_row | |
1258 SMOVII sensor2_mv,mpr ; in 0.1mV steps | |
1259 rcall TFT_imprint_menu_mV_helper ; print mV value | |
1260 | |
1261 ; sensor 3 | |
1262 WIN_SMALL surf_menu_sensor3_column,surf_menu2_sensor3_row | |
1263 SMOVII sensor3_mv,mpr ; in 0.1mV steps | |
1264 rcall TFT_imprint_menu_mV_helper ; print mV value | |
1265 | |
1266 TSTOSS opt_s8_mode ; =0: analog, =1: digital | |
1267 return ; analog - done | |
1268 | |
1269 ; imprint HUD battery voltage | |
1270 WIN_TINY .20,.209 ; set position | |
1271 STRCPY "HUD Batt: " ; print label | |
1272 SMOVII hud_battery_mv,mpr ; get HUD battery voltage | |
1273 bsf decimal_digit3 ; place a decimal point in front of digit 3 | |
1274 output_9999 ; print (0.000-9.999) | |
1275 PUTC_PRINT "V" ; append unit and dump buffer to screen | |
1276 return ; done | |
1277 | |
1278 ; Helper Function - get sensor mV values | |
1279 TFT_sensor_mv_get: | |
1280 ; btfsc ext_input_optical ; do we have an optical interface? | |
1281 ; return ; YES - optical interface delivers ready-to-use mV data, done | |
1282 TSTOSS opt_s8_mode ; NO - S8 input selected? | |
1283 bra TFT_sensor_mv_get_ana ; NO - read analog inputs | |
1284 ;bra TFT_sensor_mv_get_dig ; YES - convert digitally received ppO2 into mV | |
1285 | |
1286 TFT_sensor_mv_get_dig: | |
1287 btfss trigger_S8_data_update ; new data frame received? | |
1288 return ; NO - use old values | |
1289 bcf trigger_S8_data_update ; YES - clear update flag | |
1290 call compute_mvolts_from_rawdata ; - compute mV values from received raw data | |
1291 return ; - done | |
1292 | |
1293 TFT_sensor_mv_get_ana: | |
1294 call get_analog_inputs ; read mV values from analog inputs | |
1295 return ; done | |
1296 | |
1297 | |
1298 ; Helper Function - print mV value | |
1299 TFT_imprint_menu_mV_helper: | |
1300 bsf decimal_digit1 ; place a decimal point in front of digit 1 (no 0.1 mV) | |
1301 output_9999 ; print (0.0-999.9) | |
1302 STRCAT_PRINT "mV" ; append unit and dump buffer to screen | |
1303 return ; done | |
1304 | |
1305 ENDIF ; _external_sensor | |
1306 | |
1307 | |
1308 IFDEF _rx_functions | |
1309 ;----------------------------------------------------------------------------- | |
1310 ; Imprint Function for the Tank Setup Menu | |
1311 ; | |
1312 global TFT_imprint_tank_pres | |
1313 TFT_imprint_tank_pres: | |
1314 FONT_COLOR_MEMO ; set color | |
1315 ; get ID | |
1316 lfsr FSR1,opt_transmitter_id_1 ; load base address of opt_transmitter_id | |
1317 movf gaslist_gas,W ; get current gas | |
1318 rlncf WREG,W ; multiply by 2 because IDs are 2 byte in size | |
1319 movff PLUSW1,lo ; copy opt_transmitter_id+0[gaslist_gas] to lo | |
1320 incf WREG,W ; increment index | |
1321 movff PLUSW1,hi ; copy opt_transmitter_id+1[gaslist_gas] to hi | |
1322 ; show pressure | |
1323 WIN_SMALL .90, .61 ; column, row (+/- 27 per row) | |
1324 call get_pres_by_transmitter_id ; get pressure into hi:lo | |
1325 tstfsz WREG ; do we have valid tank data (WREG=0) ? | |
1326 bra TFT_menu_tank_pres_1 ; NO - transmitter not found | |
1327 call TFT_color_code_pres_sac ; set output color according to flags | |
1328 bsf omit_digit_1 ; do not print 1st digit (0.1 bar) | |
1329 output_9999 ; print (0x-999x) | |
1330 bra TFT_menu_tank_pres_2 | |
1331 TFT_menu_tank_pres_1: | |
1332 FONT_COLOR_DISABLED ; select color | |
1333 STRCAT " ---" ; print dashes for no pressure data available | |
1334 TFT_menu_tank_pres_2: | |
1335 STRCAT_TEXT_PRINT tbar ; print " bar" | |
1336 return ; done | |
1337 | |
1338 ENDIF ; _rx_functions | |
1339 | |
1340 | |
1341 ;============================================================================= | |
1342 tft_out5 CODE | |
1343 ;============================================================================= | |
1344 | |
1345 | |
1346 ;----------------------------------------------------------------------------- | |
1347 ; Dive Mode - static Layout | |
1348 ; | |
623 | 1349 global TFT_show_divemode_mask |
1350 TFT_show_divemode_mask: ; display mask in dive mode | |
634 | 1351 FONT_COLOR_MASK ; select color |
1352 | |
1353 ; current depth | |
623 | 1354 WIN_TINY dm_mask_depth_column,dm_mask_depth_row ; position for "Depth" |
1355 btfss alt_layout_active ; alternative layout active? | |
1356 bra TFT_divemode_mask_depth_text ; NO | |
634 | 1357 btfsc cur_depth_greater_100m ; YES - current depth >= 100 m? |
1358 bra TFT_divemode_mask_max_avg ; YES - skip depth label as it collides with depth number | |
1359 WIN_TINY dm_mask_depth_column_alt,dm_mask_depth_row ; NO - set alternative position for "Depth" | |
623 | 1360 TFT_divemode_mask_depth_text: |
1361 STRCAT_TEXT_PRINT tDepth ; print "Depth" | |
1362 | |
634 | 1363 TFT_divemode_mask_max_avg: |
623 | 1364 ; avg or max depth |
1365 btfsc alt_layout_active ; alternative layout active? | |
1366 bra TFT_divemode_mask_avg_max_alt ; YES | |
1367 | |
1368 WIN_TINY dm_mask_maxdepth_col_nvsi,dm_mask_maxdepth_row ; default position for "max.Depth"/"avg.Depth" | |
1369 TSTOSS opt_vsigraph ; graphical VSI bar enabled? | |
1370 bra TFT_divemode_mask_max_avg_pos ; NO - keep position | |
1371 WIN_TINY dm_mask_maxdepth_col,dm_mask_maxdepth_row ; YES - adopt position | |
1372 TFT_divemode_mask_max_avg_pos: | |
1373 btfsc FLAG_apnoe_mode ; in apnea mode? | |
1374 bra TFT_divemode_mask_max_text ; YES - always draw max depth | |
1375 TSTOSS opt_2ndDepthDisp ; NO - shall draw avg depth instead of max depth? | |
1376 bra TFT_divemode_mask_max_text ; NO - print "max.Depth" | |
1377 STRCAT_TEXT_PRINT tAvgDepth ; YES - print "avg.Depth" | |
1378 bra TFT_divemode_mask_time_pos ; - continue with dive time | |
1379 TFT_divemode_mask_max_text: | |
1380 STRCAT_TEXT_PRINT tMaxDepth ; print "max.Depth" | |
1381 bra TFT_divemode_mask_time_pos ; continue with dive time | |
1382 TFT_divemode_mask_avg_max_alt: | |
1383 btfss FLAG_gauge_mode ; in gauge mode? | |
1384 bra TFT_divemode_mask_time_pos ; NO - continue with dive time | |
1385 WIN_TINY dm_gauge_max_depth_text_col,dm_gauge_max_depth_text_row ; YES - set position | |
1386 STRCAT_TEXT_PRINT tMaxDepth ; - print "max.Depth" | |
1387 WIN_TINY dm_gauge_avg_depth_text_col,dm_gauge_avg_depth_text_row ; - set position | |
1388 STRCAT_TEXT_PRINT tDiveTotalAvg ; - print "Total Avg" | |
1389 ;bra TFT_divemode_mask_time_pos ; - continue with dive time | |
1390 | |
1391 ; dive time | |
1392 TFT_divemode_mask_time_pos: | |
1393 WIN_TINY dm_mask_divetime_column,dm_mask_divetime_row ; position for "Divetime" | |
1394 TFT_divemode_mask_time_text: | |
1395 STRCAT_TEXT_PRINT tDivetime ; print "Divetime" | |
1396 btfss FLAG_apnoe_mode ; in apnea mode? | |
634 | 1397 return ; NO - done |
623 | 1398 WIN_TINY dm_total_apnoe_text_col,dm_total_apnoe_text_row; YES - set position |
1399 STRCPY_TEXT_PRINT tApnoeTotal ; - print "Total" | |
634 | 1400 return ; - done |
1401 | |
1402 | |
1403 ;----------------------------------------------------------------------------- | |
1404 ; Dive Mode - NDL Layout Add-on | |
1405 ; | |
623 | 1406 global TFT_show_ndl_mask |
1407 TFT_show_ndl_mask: | |
1408 btfsc dive_main_menu ; is the dive mode menu shown? | |
1409 return ; YES - abort | |
634 | 1410 FONT_COLOR_MASK ; NO - set color |
623 | 1411 ; - set position |
582 | 1412 WIN_STD dm_ndl_text_column, dm_ndl_text_row |
623 | 1413 STRCPY_TEXT_PRINT tNDL ; - print "NDL" |
628 | 1414 btfss deco_region ; - was the dive within deco stops region? |
634 | 1415 return ; NO - done |
628 | 1416 btfsc safety_stop_active ; YES - safety stop shown? |
634 | 1417 return ; YES - done |
1418 goto TFT_show_slow_reminder ; NO - show "slow" reminder | |
1419 | |
1420 | |
1421 ;----------------------------------------------------------------------------- | |
1422 ; Dive Mode - Deco Layout Add-on | |
1423 ; | |
623 | 1424 global TFT_show_deco_mask |
1425 TFT_show_deco_mask: | |
1426 bcf safety_stop_active ; flag safety stop is not shown any more TODO: needed? | |
1427 btfsc dive_main_menu ; is the dive mode menu shown? | |
1428 return ; YES - abort | |
1429 btfsc alt_layout_active ; NO - in alternative layout? | |
1430 bra TFT_show_deco_mask_alt ; YES | |
1431 ;bra TFT_show_deco_mask_norm ; NO | |
1432 | |
1433 TFT_show_deco_mask_norm: | |
634 | 1434 WIN_STD dm_tts_text_col_norm, dm_tts_text_row_norm |
1435 bra TFT_show_deco_mask_common ; continue with common part | |
623 | 1436 |
1437 TFT_show_deco_mask_alt: | |
634 | 1438 WIN_TINY dm_tts_text_col_alt, dm_tts_text_row_alt |
1439 STRCPY "Stop/" ; print "Stop/" | |
1440 ;bra TFT_show_deco_mask_common ; continue with common part | |
623 | 1441 |
1442 TFT_show_deco_mask_common: | |
634 | 1443 FONT_COLOR_MASK ; set color |
623 | 1444 STRCAT_TEXT_PRINT tTTS ; print "TTS" |
1445 return ; done | |
1446 | |
1447 | |
0 | 1448 ;============================================================================= |
634 | 1449 tft_out6 CODE |
623 | 1450 ;============================================================================= |
1451 | |
634 | 1452 |
1453 ;----------------------------------------------------------------------------- | |
1454 ; Dive Mode - show Dive Time | |
631 | 1455 ; |
623 | 1456 global TFT_show_divetime |
1457 TFT_show_divetime: | |
634 | 1458 FONT_COLOR_MEMO ; set color |
623 | 1459 SMOVTT counted_divetime_mins,mpr ; ISR-safe 3 byte copy of minutes:2 (mpr+1:mpr+0) and seconds (mpr+2) |
1460 btfsc show_only_divemins ; shall suppress display of seconds? | |
1461 bra TFT_show_divetime_min_only ; YES - show minutes only | |
1462 movlw .99 ; NO - load 99 | |
1463 cpfsgt mpr+0 ; - dive time > 99 minutes ? | |
1464 bra TFT_show_divetime_min_sec ; NO - show min:sec | |
1465 bsf show_only_divemins ; YES - set flag to suppress the display of seconds for the rest of the dive | |
1466 btfsc alt_layout_active ; - in alternative layout? | |
1467 bra TFT_show_divetime_clear_alt ; YES - clear min:sec area of alternative layout | |
1468 ;bra TFT_show_divetime_clear_norm ; NO - clear min:sec area of normal layout | |
1469 | |
1470 TFT_show_divetime_clear_norm: | |
1471 WIN_BOX_BLACK dm_divetime_row, dm_divetime_bot_medium, dm_divetime_col_medium, dm_divetime_rgt ;top, bottom, left, right | |
1472 bra TFT_show_divetime_min_only_norm ; show minutes only | |
1473 | |
1474 TFT_show_divetime_clear_alt: | |
1475 WIN_BOX_BLACK dm_divetime_row, dm_divetime_bot_large, dm_divetime_col_large, dm_divetime_rgt ;top, bottom, left, right | |
1476 bra TFT_show_divetime_min_only_alt ; show minutes only | |
1477 | |
1478 TFT_show_divetime_min_sec: | |
1479 ; show the minutes | |
1480 btfsc alt_layout_active ; in alternative layout? | |
1481 bra TFT_show_divetime_min_alt ; YES | |
1482 ;bra TFT_show_divetime_min_norm ; NO | |
1483 | |
1484 TFT_show_divetime_min_norm: | |
1485 WIN_MEDIUM dm_divetime_col_medium, dm_divetime_row | |
1486 bra TFT_show_divetime_min_com ; continue with common part | |
1487 | |
1488 TFT_show_divetime_min_alt: | |
1489 WIN_LARGE dm_divetime_col_large, dm_divetime_row | |
1490 ;bra TFT_show_divetime_min_com ; continue with common part | |
1491 | |
1492 TFT_show_divetime_min_com: | |
634 | 1493 output_99 ; print minutes (0-99) |
1494 PRINT ; dump buffer to screen | |
623 | 1495 |
1496 ; show the seconds | |
1497 btfsc alt_layout_active ; in alternative layout? | |
1498 bra TFT_show_divetime_sec_alt ; YES | |
1499 ;bra TFT_show_divetime_sec_norm ; NO | |
1500 | |
1501 TFT_show_divetime_sec_norm: | |
1502 WIN_SMALL dm_divetime_sec_col_small, dm_divetime_sec_row_small | |
1503 bra TFT_show_divetime_sec_com ; continue with common part | |
1504 | |
1505 TFT_show_divetime_sec_alt: | |
1506 WIN_MEDIUM dm_divetime_sec_col_medium, dm_divetime_sec_row_medium | |
1507 ;bra TFT_show_divetime_sec_com ; continue with common part | |
1508 | |
1509 TFT_show_divetime_sec_com: | |
1510 PUTC ':' ; print separator char | |
634 | 1511 movff mpr+2,lo ; copy seconds to lo |
1512 output_99x ; print seconds (00-99) | |
623 | 1513 bra TFT_divemins_exit ; continue with common part |
1514 | |
1515 TFT_show_divetime_min_only: | |
1516 btfsc alt_layout_active ; in alternative layout? | |
1517 bra TFT_show_divetime_min_only_alt ; YES | |
1518 ;bra TFT_show_divetime_min_only_norm ; NO | |
1519 | |
1520 TFT_show_divetime_min_only_norm: | |
1521 WIN_MEDIUM dm_divetime_minonly_col_medium, dm_divetime_row | |
634 | 1522 output_9999 ; print minutes (0-9999) |
623 | 1523 bra TFT_divemins_exit ; continue with common part |
1524 | |
1525 TFT_show_divetime_min_only_alt: | |
1526 WIN_LARGE dm_divetime_minonly_col_large, dm_divetime_row | |
634 | 1527 output_999 ; print minutes (0-999) |
623 | 1528 ;bra TFT_divemins_exit ; continue with common part |
1529 | |
604 | 1530 TFT_divemins_exit: |
634 | 1531 PRINT ; dump buffer to screen |
1532 return ; done | |
1533 | |
1534 | |
1535 ;----------------------------------------------------------------------------- | |
1536 ; Dive Mode - show current Depth | |
1537 ; | |
1538 global TFT_show_depth | |
1539 TFT_show_depth: | |
1540 MOVII pressure_rel_cur_cached,mpr ; copy relative pressure to MPR | |
1541 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] | |
1542 call TFT_color_code_depth ; set warning / attention flags and color-code the output | |
1543 rcall TFT_depth_blink ; control animation (blinking) | |
1544 | |
1545 rcall TFT_depth_position_m_ft ; set output position for full meters/feet | |
1546 TSTOSS opt_units ; 0=m, 1=ft ? | |
1547 bra TFT_depth_metric ; 0 - metric | |
1548 ;bra TFT_depth_imperial ; 1 - imperial | |
1549 | |
1550 TFT_depth_imperial: | |
1551 MOVLI .30,sub_a ; load depth threshold of 30 cm (for showing 0 if shallower) | |
1552 MOVII mpr,sub_b ; get current depth | |
1553 call cmpU16 ; compute sub_a - sub_b = threshold - current depth | |
1554 btfss neg_flag ; shallower than 30 cm ? | |
1555 bra depth_0_feet ; YES - print a zero directly | |
1556 call convert_cm_to_feet ; NO - convert value in hi:lo from [cm] to [feet] | |
1557 output_999 ; - feet in large or huge font | |
1558 PRINT ; - dump to screen | |
1559 bra TFT_depth_exit ; - do some cleanup and show target depth if in simulator mode | |
1560 | |
1561 depth_0_feet: | |
1562 STRCAT_PRINT " 0" ; print a zero directly | |
1563 bra TFT_depth_exit ; do some cleanup and show target depth if in simulator mode | |
1564 | |
1565 TFT_depth_metric: | |
1566 bsf omit_digit_2 ; print depth in full meters, i.e. do not print 2nd and 1st digit | |
1567 output_9999 ; test-print depth for range up to 99.9 meter (0xx-99xx) | |
1568 btfsc output_overflow ; did the printing clip, i.e. deeper than 99.9 meter? | |
1569 bra TFT_depth_metric_100m ; YES - print depth in full meters only | |
1570 | |
1571 ; depth in meters and decimeters | |
1572 btfsc cur_depth_greater_100m ; was the depth >= 100 meter during last call? | |
1573 rcall TFT_depth_box_black ; YES - clear depth area | |
643 | 1574 |
1575 btfsc cur_depth_greater_100m ; was the depth >= 100 meter during last call? | |
1576 rcall TFT_depth_position_m_ft ; re-set output position for full meters/feet | |
1577 | |
634 | 1578 bcf cur_depth_greater_100m ; current depth is now < 100 meter |
1579 PRINT ; dump full meters to screen | |
1580 | |
1581 btfsc depth_inverse_last ; in inverse printing cycle? | |
1582 bsf win_invert ; YES - print inverse | |
1583 rcall TFT_depth_position_dm ; set output position for decimeters | |
1584 MOVLI .30,sub_a ; 30 mbar = 0.3 meter | |
1585 MOVII mpr,sub_b ; current depth | |
1586 call cmpU16 ; compare (sub_a - sub_b) | |
1587 btfss neg_flag ; current depth < 0.3 meter ? | |
1588 bra depth_0_decimeter ; YES - print a zero | |
1589 output_65535 ; NO - print full depth to buffer | |
1590 REINIT_BUFFER ; - re-initialize the output buffer | |
1591 PUTC "." ; - print a decimal point | |
1592 movff buffer+3,POSTINC2 ; - get and print the decimeters | |
1593 PRINT ; - dump to screen | |
1594 bra TFT_depth_exit ; - do some cleanup and show target depth if in simulator mode | |
1595 depth_0_decimeter: | |
1596 STRCAT_PRINT ".0" ; print a zero directly and dump buffer to screen | |
1597 bra TFT_depth_exit ; do some cleanup and show target depth if in simulator mode | |
1598 | |
1599 TFT_depth_metric_100m: | |
1600 ; full meters only | |
1601 btfss cur_depth_greater_100m ; was the depth >= 100 meter during last call? | |
1602 rcall TFT_depth_box_black ; NO - clear depth area | |
643 | 1603 |
1604 btfss cur_depth_greater_100m ; was the depth >= 100 meter during last call? | |
1605 rcall TFT_depth_position_m_ft ; re-set output position for full meters/feet | |
1606 | |
634 | 1607 bsf cur_depth_greater_100m ; depth is >= 100 meter now |
1608 REINIT_BUFFER ; re-initialize the output buffer | |
1609 bsf omit_digit_2 ; print depth in full meters, i.e. do not print 1st and 2nd digit | |
1610 output_65535 ; print depth for range >= 100 meter (0xx-655xx) | |
1611 PRINT ; dump to screen | |
1612 ;bra TFT_depth_exit ; do some cleanup and show target depth if in simulator mode | |
1613 | |
1614 TFT_depth_exit: | |
1615 btfss alt_layout_active ; alternative layout active? | |
1616 bra TFT_depth_exit_2 ; NO | |
1617 btfsc depth_inverse_last ; YES - was last output in inverse mode? | |
1618 bra TFT_depth_exit_2 ; YES - do not restore "Depth" as it collides with depth number | |
1619 btfsc cur_depth_greater_100m ; NO - current depth >= 100 m? | |
1620 bra TFT_depth_exit_2 ; YES | |
1621 ;bra TFT_depth_exit_1 ; NO | |
1622 | |
1623 TFT_depth_exit_1 | |
1624 WIN_TINY dm_mask_depth_column_alt,dm_mask_depth_row | |
1625 FONT_COLOR_MASK ; set color | |
1626 STRCAT_TEXT_PRINT tDepth ; restore "Depth" title | |
1627 | |
1628 TFT_depth_exit_2: | |
1629 btfss sensor_override_active ; pressure sensor override active (simulator mode)? | |
1630 return ; NO - done | |
1631 bra TFT_depth_target ; YES - show simulator target depth | |
1632 | |
1633 | |
1634 ; Helper Function - control animation (blinking) | |
1635 TFT_depth_blink: | |
1636 TSTOSS opt_depth_warn ; 0=standard, 1=blink | |
1637 return ; standard, done | |
1638 btfsc depth_color_last ; was there a warning or attention on the depth in the previous cycle? | |
1639 bra TFT_depth_blink_prev ; YES | |
1640 btfsc depth_color_warning ; NO - do we have a depth warning now? | |
1641 bra TFT_depth_blink_new ; YES - so we have a warning now but not previously | |
1642 btfsc depth_color_attention ; NO - do we have a depth attention now? | |
1643 bra TFT_depth_blink_new ; YES - so we have attention now but not previously | |
1644 bra TFT_depth_blink_none ; NO - no warning in previous cycle, no warning now, reset all flags | |
1645 | |
1646 TFT_depth_blink_prev: | |
1647 ; we had a warning or attention in previous cycle, check if we still have a warning or attention | |
1648 btfsc depth_color_warning ; do we still have a warning? | |
1649 bra TFT_depth_blink_prev_1 ; YES | |
1650 btfsc depth_color_attention ; NO - do we still have an attention? | |
1651 bra TFT_depth_blink_prev_1 ; YES | |
1652 ; we had a warning or attention before, but not now any more - clear depth area from previous color | |
1653 rcall TFT_depth_box_black ; NO - clear depth area | |
1654 ;bra TFT_depth_blink_none ; - reset all flags | |
1655 | |
1656 TFT_depth_blink_none: | |
1657 bcf depth_inverse_last ; memorize depth was printed in normal | |
1658 bcf depth_color_last ; memorize there was no warning or attention | |
1659 FONT_COLOR_MEMO ; select memo color | |
1660 return ; done | |
1661 | |
1662 TFT_depth_blink_prev_1: | |
1663 ; we had a warning or attention in previous cycle, and we still have a warning or attention | |
1664 btfss depth_inverse_last ; was the depth printed in inverse last time? | |
1665 bra TFT_depth_blink_set ; NO - print in inverse now | |
1666 bra TFT_depth_blink_reset ; YES - print in normal now | |
1667 | |
1668 TFT_depth_blink_new: | |
1669 ; we had no warning or attention in previous cycle, but now | |
1670 bsf depth_color_last ; memorize that the depth had a warning or attention | |
1671 ;bra TFT_depth_blink_set ; start with inverse display | |
1672 | |
1673 TFT_depth_blink_set: | |
1674 ; fill the area with respective color | |
1675 movf pallet_color_attention,W ; select attention color as default | |
1676 btfsc depth_color_warning ; do we have a warning? | |
1677 movf pallet_color_warning,W ; YES - replace with warning color | |
1678 rcall TFT_depth_box_color ; color depth area with color in WREG | |
1679 bsf win_invert ; print in inverse | |
1680 bsf depth_inverse_last ; memorize depth was printed in inverse | |
1681 return ; done | |
1682 | |
1683 TFT_depth_blink_reset: | |
1684 ; fill the area with black color | |
1685 rcall TFT_depth_box_black ; clear depth area | |
1686 bcf depth_inverse_last ; memorize depth was printed in normal | |
1687 return ; done | |
1688 | |
1689 | |
1690 ; Helper Function - set output position for full meters/feet | |
1691 TFT_depth_position_m_ft: ; output position meters / feet | |
1692 btfsc alt_layout_active ; alternative layout active? | |
1693 bra TFT_depth_position_m_ft_alt ; YES | |
1694 ;bra TFT_depth_position_m_ft_norm; NO | |
1695 | |
1696 TFT_depth_position_m_ft_norm: | |
1697 WIN_LARGE dm_depth_col_large,dm_depth_row_large | |
1698 return ; done | |
1699 | |
1700 TFT_depth_position_m_ft_alt: | |
1701 WIN_HUGE dm_depth_col_huge, dm_depth_row_huge | |
1702 return ; done | |
1703 | |
1704 | |
1705 ; Helper Function - set output position for decimeters | |
1706 TFT_depth_position_dm: ; output position decimeters | |
1707 btfsc alt_layout_active ; alternative layout active? | |
1708 bra TFT_depth_position_dm_alt ; YES | |
1709 bra TFT_depth_position_dm_norm ; NO | |
1710 | |
1711 TFT_depth_position_dm_norm: | |
1712 WIN_MEDIUM dm_depth_dm_col_medium, dm_depth_dm_row_medium | |
1713 return ; done | |
1714 TFT_depth_position_dm_alt: | |
1715 WIN_LARGE dm_depth_dm_col_large, dm_depth_dm_row_large | |
1716 return ; done | |
1717 | |
1718 | |
1719 ; Helper Function - clear depth area | |
1720 TFT_depth_box_black: | |
1721 clrf WREG ; select black color | |
1722 ;bra TFT_depth_box_color ; continue with colored box | |
1723 | |
1724 | |
1725 ; Helper Function - color depth area with color in WREG | |
1726 TFT_depth_box_color: | |
1727 btfsc alt_layout_active ; alternative layout active? | |
1728 bra TFT_depth_box_alt ; YES | |
1729 ;bra TFT_depth_box_norm ; NO | |
1730 | |
1731 TFT_depth_box_norm: | |
1732 WIN_BOX_COLOR dm_depth_row_large,dm_depth_bot_large,dm_depth_col_large,dm_depth_rgt_large | |
1733 return ; done | |
1734 | |
1735 TFT_depth_box_alt: | |
1736 WIN_BOX_COLOR dm_mask_depth_row, dm_depth_bot_huge, dm_depth_col_huge, dm_depth_rgt_huge | |
1737 TFT_depth_box_exit: | |
1738 return ; done | |
1739 | |
1740 | |
1741 ; Helper Function - show simulated target depth | |
1742 TFT_depth_target: | |
1743 FONT_COLOR_ATTENTION ; select attention color | |
1744 movff simulatormode_depth,lo ; copy target depth to lo | |
1745 TSTOSS opt_units ; check unit selection (0=m or 1=ft) | |
1746 bra TFT_depth_target_metric ; 0 - metric | |
1747 ;bra TFT_depth_target_imperial ; 1 - imperial | |
1748 | |
1749 TFT_depth_target_imperial: | |
1750 btfsc alt_layout_active ; alternative layout active? | |
1751 bra TFT_depth_target_imperial_alt ; YES | |
1752 ;bra TFT_depth_target_imperial_norm ; NO | |
1753 | |
1754 TFT_depth_target_imperial_norm: | |
1755 WIN_TINY dm_mask_depth_column+.40,dm_mask_depth_row ; position right of depth label | |
1756 bra TFT_depth_target_imperial_com ; continue with common part | |
1757 | |
1758 TFT_depth_target_imperial_alt: | |
1759 WIN_TINY dm_mask_depth_column+.62,dm_mask_depth_row+.20 ; position within last digit | |
1760 ;bra TFT_depth_target_imperial_com ; continue with common part | |
1761 | |
1762 TFT_depth_target_imperial_com: | |
1763 call convert_meter_to_feet ; convert value in lo from meters to feet | |
1764 output_999 ; display only last three digits from a 16 bit value (0-999) | |
1765 STRCAT_PRINT "ft" ; append unit and dump buffer to screen | |
1766 return ; done | |
1767 | |
1768 TFT_depth_target_metric: | |
1769 btfsc alt_layout_active ; alternative layout active? | |
1770 bra TFT_depth_target_metric_alt ; YES | |
1771 ;bra TFT_depth_target_metric_norm ; NO | |
1772 | |
1773 TFT_depth_target_metric_norm: | |
1774 WIN_TINY dm_mask_depth_column+.38,dm_mask_depth_row+.22 ; position right of full meters, above decimal | |
1775 bra TFT_depth_target_metric_com ; continue with common part | |
1776 | |
1777 TFT_depth_target_metric_alt: | |
1778 WIN_TINY dm_mask_depth_column+.65,dm_mask_depth_row+.20 ; position right of full meters, above decimal | |
1779 ;bra TFT_depth_target_metric_com ; continue with common part | |
1780 | |
1781 TFT_depth_target_metric_com: | |
1782 output_256 ; display target depth (0-255) | |
1783 PUTC_PRINT "m" ; append unit and dump to screen | |
1784 return ; done | |
623 | 1785 |
1786 | |
1787 ;----------------------------------------------------------------------------- | |
634 | 1788 ; Dive Mode - show maximum Depth |
623 | 1789 ; |
634 | 1790 global TFT_show_max_depth |
1791 TFT_show_max_depth: | |
1792 FONT_COLOR_MEMO ; select color | |
1793 btfsc alt_layout_active ; alternative layout active? | |
1794 bra TFT_show_max_depth_alt ; YES | |
1795 ;bra TFT_show_max_depth_norm ; NO | |
1796 | |
1797 TFT_show_max_depth_norm: | |
1798 WIN_MEDIUM dm_max_depth_column_nvsi, dm_max_depth_row | |
1799 TSTOSS opt_vsigraph ; graphical VSI bar enabled? | |
1800 bra TFT_show_max_depth_norm_1 ; NO - keep position | |
1801 WIN_MEDIUM dm_max_depth_column, dm_max_depth_row ; YES - adopt output position | |
1802 | |
1803 TFT_show_max_depth_norm_1: | |
1804 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
1805 bra TFT_max_depth_apnoe ; YES - different handling in apnoe mode | |
1806 TSTOSS opt_2ndDepthDisp ; NO - show average depth instead of max depth? | |
1807 bra TFT_max_depth_current ; NO - show max depth | |
1808 bra TFT_avg_depth_current ; YES - show avg depth | |
1809 | |
1810 TFT_max_depth_apnoe: | |
1811 btfss apnoe_at_surface ; apnoe mode, at the surface? | |
1812 bra TFT_max_depth_current ; NO - show max depth of current dive | |
1813 MOVII apnoe_max_pressure,mpr ; YES - get max pressure of all dives so far | |
1814 bra TFT_max_depth_common ; - continue with common part | |
1815 | |
1816 TFT_max_depth_current: | |
1817 MOVII pressure_rel_max_cached,mpr ; get the "normal" max pressure | |
1818 bra TFT_max_depth_common ; continue with common part | |
1819 | |
1820 TFT_avg_depth_current: | |
1821 MOVII pressure_rel_avg_total,mpr ; get total dive average pressure | |
1822 ;bra TFT_max_depth_common ; continue with common part | |
1823 | |
1824 TFT_max_depth_common: | |
1825 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] | |
1826 TSTOSS opt_units ; 0=m or 1=ft ? | |
1827 bra TFT_max_depth_metric ; 0 - use metric version | |
1828 ;bra TFT_max_depth_imperial ; 1 - use imperial version | |
1829 | |
1830 TFT_max_depth_imperial: | |
1831 bra TFT_show_depth_helper_imperial | |
1832 | |
1833 TFT_max_depth_metric: | |
1834 bsf omit_digit_2 ; print depth in full meters, i.e. do not print 2nd and 1st digit | |
1835 output_9999 ; test-print depth for range up to 99.9 meter (0xx-99xx) | |
1836 btfsc output_overflow ; did the printing clip, i.e. deeper than 99.9 meter? | |
1837 bra TFT_max_depth_metric_100m ; YES - print depth in full meters only | |
1838 ;bra TFT_max_depth_metric_99m ; NO - print depth in meters and decimeters | |
1839 | |
1840 TFT_max_depth_metric_99m: | |
1841 ; full meters | |
1842 btfsc max_depth_greater_100m ; was the depth >= 100 meter during last call? | |
1843 rcall TFT_max_depth_box_black ; NO - clear max depth area | |
1844 bcf max_depth_greater_100m ; current depth is now < 100 meter | |
1845 PRINT ; dump full meters to screen | |
1846 ; decimeters | |
1847 rcall TFT_max_depth_metric_dm ; set output position for decimeters | |
1848 output_65535 ; print full depth to buffer | |
1849 REINIT_BUFFER ; re-initialize the output buffer | |
1850 PUTC "." ; print a decimal point | |
1851 movff buffer+3,POSTINC2 ; get and print the decimeters | |
1852 PRINT ; dump to screen | |
1853 return ; done | |
1854 | |
1855 TFT_max_depth_metric_100m: | |
1856 ; full meters only | |
1857 btfss max_depth_greater_100m ; was the depth >= 100 meter during last call? | |
1858 rcall TFT_max_depth_box_black ; NO - clear max depth area | |
1859 bsf max_depth_greater_100m ; depth is >= 100 meter now | |
1860 REINIT_BUFFER ; re-initialize the output buffer | |
1861 bsf omit_digit_2 ; print depth in full meters, i.e. do not print 1st and 2nd digit | |
1862 output_65535 ; print depth for range >= 100 meter (0xx-655xx) | |
1863 PRINT ; dump to screen | |
1864 return ; done | |
1865 | |
1866 TFT_show_max_depth_alt: | |
1867 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
1868 bra TFT_show_apnoe_max_depth ; YES - use apnoe surface output also in alternative dive mode screen | |
1869 btfss FLAG_gauge_mode ; NO - in gauge mode? | |
1870 return ; NO - done | |
1871 ;bra TFT_show_gauge_max_avg_depth; YES | |
1872 | |
1873 TFT_show_gauge_max_avg_depth: | |
1874 WIN_MEDIUM dm_gauge_max_depth_col, dm_gauge_max_depth_row ; set position for max depth | |
1875 MOVII pressure_rel_max_cached,mpr ; get max pressure into hi:lo | |
1876 rcall TFT_show_depth_helper ; print max depth | |
1877 WIN_MEDIUM dm_gauge_avg_depth_col, dm_gauge_avg_depth_row ; set position for avg depth | |
1878 MOVII pressure_rel_avg_total,mpr ; get average pressure into hi:lo | |
1879 bra TFT_show_depth_helper ; print avg depth and return | |
1880 | |
1881 | |
1882 ; Helper Function - clear max depth area | |
1883 TFT_max_depth_box_black: | |
1884 WIN_BOX_BLACK dm_max_depth_row, dm_max_depth_bot, dm_max_depth_column, dm_max_depth_rgt | |
631 | 1885 return ; done |
1886 | |
634 | 1887 |
1888 ; Helper Function - set output position for decimeters | |
1889 TFT_max_depth_metric_dm: | |
1890 WIN_SMALL dm_max_depth_dm_column_nvsi, dm_max_depth_dm_row ; default position | |
1891 TSTOSS opt_vsigraph ; graphical VSI bar enabled? | |
1892 return ; NO - keep position | |
1893 WIN_SMALL dm_max_depth_dm_column, dm_max_depth_dm_row ; YES - adopt position | |
1894 return ; done | |
1895 | |
1896 | |
1897 ; Helper Function - print depth in mpr | |
1898 TFT_show_depth_helper: | |
1899 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] | |
1900 TSTOSS opt_units ; 0=m, 1=ft | |
1901 bra TFT_show_depth_helper_metric ; 0 - metric | |
1902 ;bra TFT_show_depth_helper_imperial ; 1 - imperial | |
1903 | |
1904 TFT_show_depth_helper_imperial: | |
1905 call convert_cm_to_feet ; convert value in hi:lo from [cm] to [feet] | |
1906 output_999 ; print depth (0-999) | |
1907 PRINT ; dump to screen | |
631 | 1908 return ; done |
604 | 1909 |
634 | 1910 TFT_show_depth_helper_metric: |
1911 bsf omit_digit_1 ; do not print 1st digit | |
1912 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
1913 output_65535 ; print depth (0.0x-655.3x) | |
1914 PRINT ; dump to screen | |
1915 return ; done | |
0 | 1916 |
628 | 1917 |
623 | 1918 ;----------------------------------------------------------------------------- |
634 | 1919 ; Dive Mode - show maximum Depth - Apnoe Mode |
1920 ; | |
1921 global TFT_show_apnoe_max_depth | |
1922 TFT_show_apnoe_max_depth: | |
1923 ; title | |
1924 WIN_TINY dm_apnoe_last_max_depth_text_col, dm_apnoe_last_max_depth_text_row | |
1925 FONT_COLOR_MASK ; set color | |
1926 btfsc alt_layout_active ; alternative layout active? | |
1927 bra TFT_show_apnoe_max_depth_alt ; YES | |
1928 ;bra TFT_show_apnoe_max_depth_norm ; NO | |
1929 | |
1930 TFT_show_apnoe_max_depth_norm: | |
1931 STRCPY_TEXT_PRINT tApnoeMax ; print "Last Descent" | |
1932 bra TFT_show_apnoe_max_depth_com ; continue with common part | |
1933 | |
1934 TFT_show_apnoe_max_depth_alt: | |
1935 STRCPY_TEXT_PRINT tMaxDepth ; print "Max.Depth" | |
1936 ;bra TFT_show_apnoe_max_depth_com ; continue with common part | |
1937 | |
1938 TFT_show_apnoe_max_depth_com: | |
1939 ; value | |
1940 WIN_MEDIUM dm_apnoe_last_max_depth_column, dm_apnoe_last_max_depth_row | |
1941 FONT_COLOR_MEMO ; select color | |
1942 MOVII pressure_rel_max_cached,mpr ; get max pressure into hi:lo | |
1943 bra TFT_show_depth_helper ; print max depth and return | |
1944 | |
1945 | |
1946 ;----------------------------------------------------------------------------- | |
1947 ; Dive Mode - show Temperature | |
1948 ; | |
1949 global TFT_show_temp_divemode | |
1950 TFT_show_temp_divemode: | |
1951 btfsc dive_pre_menu ; is the pre-menu shown? | |
1952 return ; YES - abort | |
1953 btfsc dive_main_menu ; is the dive mode menu shown? | |
1954 return ; YES - abort, no update of temperature now | |
1955 btfsc better_gas_blinking ; blinking better gas? | |
1956 return ; YES - abort, no update of temperature now | |
1957 btfsc better_dil_blinking ; blinking better diluent? | |
1958 return ; YES - abort, no update of temperature now | |
1959 | |
1960 WIN_SMALL dm_temp_column,dm_temp_row; set position | |
1961 FONT_COLOR_MEMO ; set color | |
1962 movlw index_compass_dm ; index of compass custom view | |
1963 cpfseq active_customview ; compass shown in custom view? | |
1964 goto TFT_temp_common ; NO - continue with common part for temperature | |
1965 goto TFT_update_stopwatch ; YES - show resettable dive time instead of temperature | |
582 | 1966 |
631 | 1967 |
1968 ;----------------------------------------------------------------------------- | |
634 | 1969 ; Dive Mode - active Gas and Setpoint |
1970 ; | |
1971 global TFT_show_active_gas_divemode | |
1972 TFT_show_active_gas_divemode: | |
1973 btfsc dive_main_menu ; is the dive mode menu shown? | |
1974 return ; YES - abort | |
1975 btfsc FLAG_apnoe_mode ; in apnoe mode? | |
1976 return ; YES - done | |
1977 btfsc FLAG_gauge_mode ; in gauge mode? | |
1978 return ; YES - done | |
1979 | |
1980 IFDEF _ccr_pscr | |
1981 | |
1982 btfsc FLAG_oc_mode ; in OC mode? | |
1983 bra TFT_active_gas ; YES - show OC gas | |
1984 btfss bailout_mode ; NO - in bailout? | |
1985 bra TFT_active_sp_loop ; NO | |
1986 ;bra TFT_active_sp_bailout ; YES | |
1987 | |
1988 TFT_active_sp_bailout: | |
1989 WIN_SMALL dm_active_dil_column, dm_active_dil_row | |
1990 FONT_COLOR_ATTENTION ; set color | |
1991 STRCPY_TEXT_PRINT tDiveBailout ; print "Bailout" | |
1992 bra TFT_active_gas ; continue showing OC bailout gas | |
1993 | |
1994 TFT_active_sp_loop: | |
1995 MOVII int_O_breathed_ppO2,mpr ; copy ppO2 [cbar] to hi:lo | |
1996 call TFT_color_code_ppo2 ; color-code the output by the ppO2 of the loop gas mixture | |
1997 btfss timebase_1sec ; on even second? | |
1998 bra TFT_active_sp_print ; YES - print ppO2 with normal rendering | |
1999 btfsc warn_det_sensors_lost ; NO - all sensors lost? | |
2000 bra TFT_active_sp_fallback ; YES - process fallback case | |
2001 movff int_O_breathed_ppO2+1,WREG ; NO - get flags again (have been cleared in hi:lo by TFT_color_code_ppo2 meanwhile) | |
2002 btfss WREG,int_warning_flag ; warning flag set? | |
2003 bra TFT_active_sp_print ; NO - ppO2 is ok, print ppO2 with normal rendering | |
2004 bra TFT_active_sp_invers ; YES - print with inverse rendering | |
2005 TFT_active_sp_fallback: ; set up fallback case | |
2006 FONT_COLOR_ATTENTION ; set color to attention | |
2007 TFT_active_sp_invers: | |
2008 bsf win_invert ; print in inverse | |
2009 TFT_active_sp_print: | |
2010 WIN_MEDIUM dm_active_gas_sp_value_col, dm_active_gas_sp_value_row | |
2011 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
2012 output_999 ; print ppO2 (0.00-9.99) | |
2013 PRINT ; dump to screen | |
2014 | |
2015 btfsc sign_shown ; advice/attention/warning sign shown? | |
2016 bra TFT_active_diluent ; YES - do not overwrite in case of alternative layout | |
2017 | |
2018 btfsc velocity_active_vsi ; graphical vertical speed indicator shown? | |
2019 bra TFT_active_diluent ; YES - do not overwrite in case of alternative layout | |
2020 | |
2021 TFT_active_sp_label_1: | |
2022 WIN_STD dm_active_sp_label_col, dm_active_sp_label_row | |
2023 FONT_COLOR_MEMO ; select memo color | |
2024 STRCAT "bar" ; print "bar" | |
2025 | |
2026 IFDEF _external_sensor | |
2027 | |
640 | 2028 movf dive_ccr_mode,W ; get setpoint mode =0: Fixed SP, =1: Sensor, =2: Auto SP |
2029 sublw .1 ; dive_ccr_mode = 1 (Sensor) ? | |
634 | 2030 bnz TFT_active_sp_label_2 ; NO - skip |
2031 btfsc alt_layout_active ; YES - in alternative layout? | |
2032 bra TFT_active_sp_label_2 ; YES - no space available for the "*" | |
2033 PUTC "*" ; NO - append "*" | |
2034 | |
2035 ENDIF | |
2036 | |
2037 TFT_active_sp_label_2: | |
2038 PRINT ; dump buffer to screen | |
2039 | |
2040 TFT_active_loop_mode: | |
2041 WIN_TINY dm_active_sp_label_col, dm_active_dil_row+.3 | |
2042 FONT_COLOR_MEMO ; set memo color | |
2043 btfsc FLAG_ccr_mode ; in CCR mode? | |
2044 bra TFT_active_loop_mode_ccr ; YES - print CCR label | |
2045 btfsc FLAG_pscr_mode ; in pSCR mode? | |
2046 bra TFT_active_loop_mode_pscr ; YES - print pSCR label | |
2047 bra TFT_active_diluent ; NO to both - should not happen | |
2048 | |
2049 TFT_active_loop_mode_ccr: | |
2050 STRCPY_TEXT_PRINT tDvCCR ; print "CCR" | |
2051 bra TFT_active_diluent ; continue with diluent | |
2052 | |
2053 TFT_active_loop_mode_pscr: | |
2054 STRCPY_TEXT_PRINT tDvPSCR ; print "pSCR" | |
2055 ;bra TFT_active_diluent ; continue with diluent | |
2056 | |
2057 TFT_active_diluent: | |
2058 MOVII int_O_pure_ppO2,mpr ; get ppO2 [cbar] into hi:lo | |
2059 call TFT_color_code_ppo2 ; color-code the output | |
2060 btfss better_dil_available ; better diluent available? | |
2061 bra TFT_active_diluent_show ; NO - print in normal rendering | |
2062 btg better_dil_blinking ; YES - toggle blink bit... | |
2063 btfss better_dil_blinking ; - blink now? | |
2064 bra TFT_active_diluent_show ; NO - print in normal rendering | |
2065 FONT_COLOR_ATTENTION ; YES - print in attention color | |
2066 bsf win_invert ; - print in inverse | |
2067 | |
2068 TFT_active_diluent_show: | |
2069 WIN_SMALL dm_active_dil_column, dm_active_dil_row | |
2070 bra TFT_active_dil_gas_common ; continue with common part | |
2071 | |
2072 ENDIF ; _ccr_pscr | |
2073 | |
2074 TFT_active_gas: | |
2075 MOVII int_O_breathed_ppO2,mpr ; copy ppO2 [cbar] into hi:lo | |
2076 call TFT_color_code_ppo2 ; color-code the output | |
2077 btfss better_gas_available ; better gas available? | |
2078 bra TFT_active_gas_print ; NO - print in normal rendering | |
2079 btg better_gas_blinking ; YES - toggle blink bit | |
2080 btfss better_gas_blinking ; blink now? | |
2081 bra TFT_active_gas_print ; NO - print in normal rendering | |
2082 FONT_COLOR_ATTENTION ; YES - blink in attention color | |
2083 bsf win_invert ; print in inverse | |
2084 | |
2085 TFT_active_gas_print: | |
2086 WIN_STD dm_active_gas_sp_value_col, dm_active_sp_label_row | |
2087 | |
2088 TFT_active_dil_gas_common: | |
2089 movff char_I_O2_ratio,lo ; lo now stores O2 in % | |
2090 IFDEF _helium | |
2091 movff char_I_He_ratio,hi ; hi now stores He in % | |
2092 ELSE | |
2093 clrf hi ; set hi to zero (no He) | |
2094 ENDIF | |
2095 call gaslist_strcat_mix ; print "Nxlo", "Txlo/hi", "Air" or "O2" | |
2096 PRINT ; dump to screen | |
631 | 2097 return ; done |
2098 | |
2099 | |
2100 ;----------------------------------------------------------------------------- | |
634 | 2101 ; Dive Mode - NDL Time |
2102 ; | |
2103 global TFT_show_ndl | |
2104 TFT_show_ndl: | |
2105 btfsc dive_main_menu ; is the dive mode menu shown? | |
2106 return ; YES - abort | |
2107 MOVII int_O_NDL_norm,mpr ; NO - get NDL time in normal plan | |
2108 rcall TFT_show_ndl_tts_set_color ; - set color | |
2109 btfsc deco_locked ; - was the dive in deco? | |
2110 bra TFT_show_ndl_norm ; YES - use normal layout | |
2111 btfsc alt_layout_active ; NO - alternative layout active? | |
2112 bra TFT_show_ndl_alt ; YES - use alternative layout | |
2113 ;bra TFT_show_ndl_norm ; NO - use normal layout | |
2114 | |
2115 TFT_show_ndl_norm: | |
2116 WIN_MEDIUM dm_ndl_value_col_norm,dm_ndl_value_row_norm | |
2117 output_256 ; print NDL (0-255) | |
2118 PUTC_PRINT "'" ; append unit and dump buffer to screen | |
2119 return ; done | |
2120 | |
2121 TFT_show_ndl_alt: | |
2122 btfsc safety_stop_active ; is the safety stop active? | |
2123 bra TFT_show_ndl_alt_safety ; YES | |
2124 ;bra TFT_show_ndl_alt_no_safety ; NO | |
2125 | |
2126 TFT_show_ndl_alt_no_safety: ; clear potential remains from NDL normal | |
2127 WIN_BOX_BLACK dm_ndl_value_row_norm, dm_3rdrow_bot, dm_ndl_value_col_norm, dm_ndl_value_col_alt ; top, bottom, left, right | |
2128 WIN_LARGE dm_ndl_value_col_alt, dm_ndl_value_row_alt | |
2129 output_99 ; print NDL (0-99) | |
2130 PRINT ; dump buffer to screen | |
2131 return ; done | |
2132 | |
2133 TFT_show_ndl_alt_safety: | |
2134 WIN_MEDIUM dm_ndl_value_col_norm,dm_ndl_value_row_norm | |
2135 output_256 ; print NDL (0-255) | |
2136 PUTC_PRINT "'" ; append unit and dump buffer to screen | |
2137 return ; done | |
2138 | |
2139 | |
2140 ; Helper Function - set color | |
2141 TFT_show_ndl_tts_set_color: | |
2142 movf pallet_color_memo,W ; load memo color as default | |
2143 btfsc mpr+1,int_invalid_flag ; is the invalid flag set? | |
2144 movf pallet_color_disabled,W ; YES - replace by disabled color | |
2145 movwf font_color ; set font color | |
2146 return ; done | |
2147 | |
2148 | |
2149 ;----------------------------------------------------------------------------- | |
2150 ; Dive Mode - TTS Time | |
2151 ; | |
2152 global TFT_show_tts | |
2153 TFT_show_tts: | |
2154 btfsc dive_main_menu ; is the dive mode menu shown? | |
2155 return ; YES - abort | |
2156 MOVII int_O_TTS_norm,mpr ; NO - get the TTS | |
2157 rcall TFT_show_ndl_tts_set_color ; - color-code | |
2158 bcf hi,int_invalid_flag ; - clear the invalid flag if applicable | |
2159 btfsc alt_layout_active ; - in alternative layout? | |
2160 bra TFT_display_tts_alt ; YES | |
2161 ;bra TFT_display_tts_norm ; NO | |
2162 | |
2163 TFT_display_tts_norm: | |
2164 WIN_MEDIUM dm_tts_value_col_999x, dm_tts_value_row | |
2165 output_999 ; print (0...999) | |
2166 PUTC_PRINT "'" ; append unit and dump buffer to screen | |
2167 return ; done | |
2168 | |
2169 TFT_display_tts_alt: | |
2170 output_99 ; print TTS for range 0-99 | |
2171 btfsc output_overflow ; does TTS fit into 0-99 ? | |
2172 bra TFT_display_tts_alt_999 ; NO - print in 999 format | |
2173 ;bra TFT_display_tts_alt_99 ; YES - print in 99 format | |
2174 | |
2175 TFT_display_tts_alt_99: | |
2176 btfsc tts_over_99_last ; was TTS > 99 last time? | |
2177 rcall TFT_display_tts_clear ; YES - clear remains from TTS > 99 | |
2178 WIN_MEDIUM dm_tts_value_col_99, dm_tts_value_row | |
2179 output_99 ; print TTS (0...99) | |
2180 PUTC_PRINT "'" ; append unit and dump buffer to screen | |
2181 return ; done | |
2182 | |
2183 TFT_display_tts_alt_999: | |
2184 WIN_MEDIUM dm_tts_value_col_999, dm_tts_value_row | |
2185 REINIT_BUFFER ; clear the buffer | |
2186 output_999 ; print (0...999), no space for unit | |
2187 PRINT ; dump to screen | |
2188 bsf tts_over_99_last ; remember last TTS was > 99 mins | |
2189 return ; done | |
2190 | |
2191 | |
2192 ; Helper Function - clear remains from TTS > 99 | |
2193 TFT_display_tts_clear: ; clear remains from TTS > 99 | |
2194 WIN_BOX_BLACK dm_tts_value_row, dm_tts_value_row+.31, dm_tts_value_col_999, dm_tts_value_col_99 ; top, bottom, left, right | |
2195 bcf tts_over_99_last ; remember last TTS was NOT > 99 mins | |
2196 return ; done | |
2197 | |
2198 | |
2199 ;----------------------------------------------------------------------------- | |
2200 ; Dive Mode - Deco Stop Time & Depth | |
2201 ; | |
2202 global TFT_show_deco | |
2203 TFT_show_deco: | |
2204 btfsc dive_main_menu ; is the dive mode menu shown? | |
2205 return ; YES - abort | |
2206 | |
2207 movff char_O_deco_depth,lo ; get depth of first stop in meters | |
2208 call TFT_color_code_stop ; color-code output | |
2209 TSTOSC opt_units ; get unit (0=m, 1=ft) | |
2210 bra TFT_show_deco_norm ; 1 - ft can only be displayed in normal layout due to space required for 3 digit depth | |
2211 btfsc alt_layout_active ; 0 - in alternative layout? | |
2212 bra TFT_show_deco_alt ; YES | |
2213 ;bra TFT_show_deco_norm ; NO - combined depth and time | |
2214 | |
2215 TFT_show_deco_norm: | |
2216 WIN_MEDIUM dm_decostop_col_norm, dm_decostop_row_norm | |
2217 call TFT_display_stop_depth ; print stop (depth in lo) | |
2218 PUTC ' ' ; put a space char between depth and time | |
2219 bra TFT_display_deco_common ; continue with common part | |
2220 | |
2221 TFT_show_deco_alt: | |
2222 WIN_LARGE dm_decostop_col_alt_depth, dm_decostop_row_alt_depth | |
2223 output_99 ; print stop depth (0-99) | |
2224 PRINT ; dump buffer to screen | |
2225 WIN_MEDIUM dm_decostop_col_alt_time, dm_decostop_row_alt_time | |
2226 FONT_COLOR_MEMO ; select memo color | |
2227 ;bra TFT_display_deco_common ; continue with common part | |
2228 | |
2229 TFT_display_deco_common: | |
2230 movff char_O_deco_time,lo ; get stop time of the first stop in minutes | |
2231 output_99DD ; print minutes or double dots if null | |
2232 PUTC_PRINT "'" ; append unit and dump buffer to screen | |
2233 return ; done | |
2234 | |
2235 | |
2236 ;============================================================================= | |
2237 tft_out7 CODE | |
2238 ;============================================================================= | |
2239 | |
2240 ;----------------------------------------------------------------------------- | |
2241 ; Dive Mode - Apnoe current and overall Dive Time | |
2242 ; | |
2243 global TFT_show_apnoe_times | |
2244 TFT_show_apnoe_times: | |
2245 ; current dive time | |
2246 FONT_COLOR_MEMO ; select color | |
2247 WIN_MEDIUM dm_divetime_apnoe_col, dm_divetime_apnoe_row | |
2248 SMOVII apnoe_dive_mins,mpr ; ISR-safe copy of minutes to lo and seconds to hi | |
2249 output_99 ; print minutes (0-99) | |
2250 PRINT ; dump to screen | |
2251 WIN_SMALL dm_divetime_apnoe_secs_col, dm_divetime_apnoe_secs_row | |
2252 PUTC ':' ; print ":" | |
2253 movff hi,lo ; copy seconds to lo | |
2254 output_99x ; print seconds (00-99) | |
2255 PRINT ; dump to screen | |
2256 ; overall dive time | |
2257 WIN_MEDIUM dm_apnoe_total_divetime_col, dm_apnoe_total_divetime_row | |
2258 SMOVTT counted_divetime_mins,mpr ; ISR-safe 3 byte copy of minutes:2 and seconds | |
2259 output_256 ; minutes (0-256) | |
2260 PRINT ; show minutes in large font | |
2261 WIN_SMALL dm_apnoe_total_divetime_secs_col, dm_apnoe_total_divetime_secs_row ; left position for two sec figures | |
2262 PUTC ':' ; print ":" | |
2263 movff up,lo ; copy seconds from up to lo | |
2264 output_99x ; print seconds (00-99) | |
2265 PRINT ; dump to screen | |
2266 return ; done | |
2267 | |
2268 | |
2269 ;----------------------------------------------------------------------------- | |
2270 ; Dive Mode - show Apnoe Surface Time | |
2271 ; | |
2272 global TFT_show_apnoe_surface | |
2273 TFT_show_apnoe_surface: | |
2274 FONT_COLOR_MASK ; select mask color | |
2275 WIN_TINY dm_apnoe_surface_time_text_col, dm_apnoe_surface_time_text_row | |
2276 STRCPY_TEXT_PRINT tApnoeSurface ; print label | |
2277 FONT_COLOR_MEMO ; select memo color | |
2278 WIN_MEDIUM dm_apnoe_surface_time_column, dm_apnoe_surface_time_row | |
2279 SMOVII apnoe_surface_mins,mpr ; ISR-safe copy of minutes to lo and seconds to hi | |
2280 output_256 ; print minutes (0-255) | |
2281 PUTC ':' ; print ":" | |
2282 movff hi,lo ; copy seconds to lo | |
2283 output_99x ; print seconds (00-99) | |
2284 PRINT ; dump to screen | |
631 | 2285 return ; done |
2286 | |
2287 | |
623 | 2288 ;----------------------------------------------------------------------------- |
634 | 2289 ; Dive Mode - clear Apnoe Surface Time |
2290 ; | |
2291 global TFT_clear_apnoe_surface | |
2292 TFT_clear_apnoe_surface: | |
2293 WIN_BOX_BLACK dm_apnoe_last_max_depth_text_row, .239, dm_apnoe_last_max_depth_column, .159 | |
631 | 2294 return ; done |
604 | 2295 |
634 | 2296 |
2297 ;============================================================================= | |
2298 tft_out8 CODE | |
2299 ;============================================================================= | |
2300 | |
2301 | |
2302 ;----------------------------------------------------------------------------- | |
2303 ; Dive Mode - clear Deco Data (NDL / Stop & TTS ) | |
2304 ; | |
2305 global TFT_clear_deco_data | |
2306 TFT_clear_deco_data: | |
2307 btfsc dive_main_menu ; is the dive mode menu shown? | |
2308 return ; YES | |
2309 | |
2310 WIN_BOX_BLACK dm_decostop_row_alt_depth, dm_3rdrow_bot, dm_decostop_col_alt_depth, dm_3rdrow_rgt ; top, bottom, left, right | |
2311 return | |
2312 | |
2313 | |
628 | 2314 ;----------------------------------------------------------------------------- |
634 | 2315 ; Dive Mode - clear Dive Mode Menu |
2316 ; | |
2317 ; starts 2 pixel higher to completely wipe away the temperature display | |
2318 ; | |
2319 global TFT_clear_divemode_menu | |
2320 TFT_clear_divemode_menu: | |
2321 WIN_BOX_BLACK dm_menu_row-.2, dm_menu_lower, dm_menu_left, dm_menu_right | |
582 | 2322 return |
544
64a45f203144
NEW: Show Compass calibration results in Compass menu
heinrichsweikamp
parents:
535
diff
changeset
|
2323 |
634 | 2324 |
2325 ;============================================================================= | |
2326 VSI_table CODE_PACK | |
2327 ;============================================================================= | |
2328 | |
2329 VSI_table: | |
2330 | |
2331 ; use a depth-dependent ascent rate warning | |
2332 ; depth(ft): <20 >20 >40 >60 >75 >88 >101 >115 >128 >144 >164 | |
2333 ; speed(ft/min): 23 26 29 33 36 43 49 56 59 62 66 | |
2334 ; depth(m): <=6 >6 >12 >18 >23 >27 >31 >35 >39 >44 >50 | |
2335 ; speed(m/min): 7 8 9 10 11 13 15 17 18 19 20 (warning) | |
2336 ; speed(m/min): 5 6 7 8 8 10 12 13 14 15 15 (attention) | |
2337 | |
2338 ; < depth (m), warning speed, attention speed | |
2339 DB .6, .7, .5 | |
2340 DB .12, .8, .6 | |
2341 DB .18, .9, .7 | |
2342 DB .23,.10, .8 | |
2343 DB .27,.11, .8 | |
2344 DB .31,.13,.10 | |
2345 DB .35,.15,.12 | |
2346 DB .39,.17,.13 | |
2347 DB .44,.18,.14 | |
2348 DB .50,.19,.15 | |
2349 DB .255,.20,.15 | |
2350 | |
2351 | |
2352 ;============================================================================= | |
2353 tft_out9 CODE | |
2354 ;============================================================================= | |
623 | 2355 |
453
b4f28ab23b87
NEW: Show Uptime (Time since last firmware boot) in information menu
heinrichsweikamp
parents:
444
diff
changeset
|
2356 |
0 | 2357 ;----------------------------------------------------------------------------- |
634 | 2358 ; Dive Mode - show vertical Velocity |
2359 ; | |
2360 global TFT_velocity_show | |
2361 TFT_velocity_show: | |
2362 FONT_COLOR_MEMO ; set default color | |
2363 btfsc neg_flag_velocity ; descending? | |
2364 rcall TFT_velocity_set_color ; NO - set color for text dependent on speed and set threshold for VSI graph | |
2365 rcall TFT_velocity_num ; show the numerical VSI | |
2366 TSTOSS opt_vsigraph ; graphical VSI bar enabled? | |
2367 return ; NO - done | |
2368 btfss neg_flag_velocity ; YES - in ascent? | |
2369 bra TFT_velocity_clear_graph ; NO - clear the graph | |
2370 ;bra TFT_velocity_graph_show ; YES - show the graph | |
2371 | |
2372 TFT_velocity_graph_show: | |
2373 btfsc alt_layout_active ; in alternative layout? | |
2374 return ; YES - done (not implemented) | |
2375 | |
2376 btfsc velocity_active_vsi ; was the graphical VSI shown before? | |
2377 bra TFT_velocity_graph_1 ; YES - no need to redraw the framework box | |
2378 bsf velocity_active_vsi ; NO - remember it is shown as of now | |
2379 ; - draw the framework box | |
2380 movf pallet_color_mask,W ; - color -> WREG | |
2381 WIN_FRAME_COLOR dm_velocity_graph_top+.00, dm_velocity_graph_bot-.00, dm_velocity_graph_lft, dm_velocity_graph_rgt | |
2382 movf pallet_color_mask,W ; - color -> WREG | |
2383 WIN_FRAME_COLOR dm_velocity_graph_top+.10, dm_velocity_graph_bot-.10, dm_velocity_graph_lft, dm_velocity_graph_rgt | |
2384 movf pallet_color_mask,W ; - color -> WREG | |
2385 WIN_FRAME_COLOR dm_velocity_graph_top+.20, dm_velocity_graph_bot-.20, dm_velocity_graph_lft, dm_velocity_graph_rgt | |
2386 movf pallet_color_mask,W ; - color -> WREG | |
2387 WIN_FRAME_COLOR dm_velocity_graph_top+.30, dm_velocity_graph_bot-.30, dm_velocity_graph_lft, dm_velocity_graph_rgt | |
2388 | |
2389 TFT_velocity_graph_1: | |
2390 movff divA+0,hi ; copy ascend speed (in m/min) to hi | |
2391 movff divA+1,xA+0 ; m/min for warning level (upper two blocks) | |
2392 clrf xA+1 | |
2393 MOVLI .5,xB ; threshold for color warning (5 color normal + 2 color warning) | |
2394 call div16x16 ; xC = xA / xB with xA as remainder | |
2395 ; xC+0 holds step size in m/min (e.g. =3 for 15m/min warning threshold) | |
2396 movff hi,xA+0 ; velocity in m/min | |
2397 clrf xA+1 ; ... | |
2398 movff xC+0,xB+0 ; step size | |
2399 clrf xB+1 ; ... | |
2400 call div16x16 ; xC = xA / xB with xA as remainder | |
2401 movff xC+0,lo ; copy amount of segments to show to lo | |
2402 incf lo,F ; lo +=1 | |
2403 dcfsnz lo,F ; lo = 1 ? | |
2404 bra DISP_graph_vel_0_fill ; YES - fill lowest segment | |
2405 dcfsnz lo,F ; lo = 2 ? | |
2406 bra DISP_graph_vel_1_fill ; YES - fill lower 2 segments | |
2407 dcfsnz lo,F ; lo = 3 ? | |
2408 bra DISP_graph_vel_2_fill ; YES - fill lower 3 segments | |
2409 dcfsnz lo,F ; lo = 4 ? | |
2410 bra DISP_graph_vel_3_fill ; YES - fill lower 4 segments | |
2411 dcfsnz lo,F ; lo = 5 ? | |
2412 bra DISP_graph_vel_4_fill ; YES - fill lower 5 segments | |
2413 dcfsnz lo,F ; lo = 6 ? | |
2414 bra DISP_graph_vel_5_fill ; YES - fill lower 6 segments | |
2415 dcfsnz lo,F ; lo = 7 ? | |
2416 bra DISP_graph_vel_6_fill ; YES - fill lower 7 segments | |
2417 ;bra DISP_graph_vel_7_fill ; YES - fill all segments | |
2418 | |
2419 DISP_graph_vel_7_fill: | |
2420 movf pallet_color_warning,W | |
2421 WIN_BOX_COLOR dm_velocity_graph_top+.2, dm_velocity_graph_top+.8, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
2422 DISP_graph_vel_6_fill: | |
2423 movf pallet_color_warning,W | |
2424 WIN_BOX_COLOR dm_velocity_graph_top+.12, dm_velocity_graph_top+.18, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
2425 DISP_graph_vel_5_fill: | |
2426 movf pallet_color_attention,W | |
2427 WIN_BOX_COLOR dm_velocity_graph_top+.22, dm_velocity_graph_top+.28, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
2428 DISP_graph_vel_4_fill: | |
2429 movf pallet_color_memo,W | |
2430 WIN_BOX_COLOR dm_velocity_graph_top+.32, dm_velocity_graph_top+.38, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
2431 DISP_graph_vel_3_fill: | |
2432 movf pallet_color_memo,W | |
2433 WIN_BOX_COLOR dm_velocity_graph_top+.42, dm_velocity_graph_top+.48, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
2434 DISP_graph_vel_2_fill: | |
2435 movf pallet_color_memo,W | |
2436 WIN_BOX_COLOR dm_velocity_graph_top+.52, dm_velocity_graph_top+.58, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
2437 DISP_graph_vel_1_fill: | |
2438 movf pallet_color_memo,W | |
2439 WIN_BOX_COLOR dm_velocity_graph_top+.62, dm_velocity_graph_top+.68, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
2440 DISP_graph_vel_0_fill: | |
2441 | |
2442 movff xC+0,lo ; copy amount of segments to show to lo | |
2443 incf lo,F ; lo += 1 | |
2444 dcfsnz lo,F ; lo = 1 ? | |
2445 bra DISP_graph_vel_0_clear ; YES - clear upper 7 segments | |
2446 dcfsnz lo,F ; lo = 2 ? | |
2447 bra DISP_graph_vel_1_clear ; YES - clear upper 6 segments | |
2448 dcfsnz lo,F ; lo = 3 ? | |
2449 bra DISP_graph_vel_2_clear ; YES - clear upper 5 segments | |
2450 dcfsnz lo,F ; lo = 4 ? | |
2451 bra DISP_graph_vel_3_clear ; YES - clear upper 4 segments | |
2452 dcfsnz lo,F ; lo = 5 ? | |
2453 bra DISP_graph_vel_4_clear ; YES - clear upper 3 segments | |
2454 dcfsnz lo,F ; lo = 6 ? | |
2455 bra DISP_graph_vel_5_clear ; YES - clear upper 2 segments | |
2456 dcfsnz lo,F ; lo = 7 ? | |
2457 bra DISP_graph_vel_6_clear ; YES - clear upper 1 segments | |
2458 bra DISP_graph_vel_7_clear ; YES - clear no segments | |
2459 | |
2460 DISP_graph_vel_0_clear: | |
2461 WIN_BOX_BLACK dm_velocity_graph_top+.62, dm_velocity_graph_top+.68, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
2462 DISP_graph_vel_1_clear: | |
2463 WIN_BOX_BLACK dm_velocity_graph_top+.52, dm_velocity_graph_top+.58, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
2464 DISP_graph_vel_2_clear: | |
2465 WIN_BOX_BLACK dm_velocity_graph_top+.42, dm_velocity_graph_top+.48, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
2466 DISP_graph_vel_3_clear: | |
2467 WIN_BOX_BLACK dm_velocity_graph_top+.32, dm_velocity_graph_top+.38, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
2468 DISP_graph_vel_4_clear: | |
2469 WIN_BOX_BLACK dm_velocity_graph_top+.22, dm_velocity_graph_top+.28, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
2470 DISP_graph_vel_5_clear: | |
2471 WIN_BOX_BLACK dm_velocity_graph_top+.12, dm_velocity_graph_top+.18, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
2472 DISP_graph_vel_6_clear: | |
2473 WIN_BOX_BLACK dm_velocity_graph_top+.2, dm_velocity_graph_top+.8, dm_velocity_graph_lft+.2, dm_velocity_graph_rgt-.2 ;top, bottom, left, right | |
2474 DISP_graph_vel_7_clear: | |
2475 return ; done | |
2476 | |
2477 | |
2478 ; Helper Function - set color based on speed table or use static thresholds, with divA+0 = m/min | |
2479 TFT_velocity_set_color: | |
2480 bsf aux_flag ; for alternative layout: default is to show numerical VSI | |
2481 ; check if old/new ascend logic is used | |
2482 TSTOSS opt_vsitext ; 0=standard, 1=dynamic | |
2483 bra TFT_velocity_set_color_static ; 0 - static ascend rate limit | |
2484 ;bra TFT_velocity_set_color_dynamic ; 1 - dynamic ascend rate limit | |
2485 | |
2486 TFT_velocity_set_color_dynamic: | |
2487 movlw LOW (VSI_table-.2) ; point to 2 entries ahead of the speed table | |
2488 movwf TBLPTRL ; ... | |
2489 movlw HIGH (VSI_table-.2) ; ... | |
2490 movwf TBLPTRH ; ... | |
2491 movlw UPPER (VSI_table-.2) ; ... | |
2492 movwf TBLPTRU ; ... | |
2493 TFT_velocity_set_color_loop: | |
2494 TBLRD*+ ; consume waring speed form last round | |
2495 TBLRD*+ ; consume attention speed form last round | |
2496 TBLRD*+ ; get table depth | |
2497 movf depth_meter,W ; get current depth | |
2498 cpfsgt TABLAT ; table depth > current depth ? | |
2499 bra TFT_velocity_set_color_loop ; NO - try next | |
2500 TBLRD*+ ; YES - read warning speed threshold | |
2501 movf TABLAT,W ; - ... | |
2502 movwf divA+1 ; - copy to graph routine | |
2503 cpfslt divA+0 ; - actual vertical speed smaller than warning threshold? | |
2504 bra TFT_velocity_set_color_warn ; NO - set warning color and return | |
2505 TBLRD*+ ; YES - read attention speed threshold | |
2506 movf TABLAT,W ; - ... | |
2507 cpfslt divA+0 ; - actual vertical speed smaller than attention threshold? | |
2508 bra TFT_velocity_set_color_attn ; NO - set attention color and return | |
2509 bcf aux_flag ; YES - don't show in alternative layout | |
2510 bra TFT_velocity_set_color_memo ; - set memo color and return | |
2511 | |
2512 TFT_velocity_set_color_static: | |
2513 movlw color_code_velocity_warn_high ; get static threshold for warning in m/min | |
2514 movwf divA+1 ; copy for graph routine | |
2515 cpfslt divA+0 ; actual vertical speed smaller than warning threshold? | |
2516 bra TFT_velocity_set_color_warn ; NO - set warning color and return | |
2517 movlw color_code_velocity_attn_high ; YES - get static threshold for attention in m/min | |
2518 cpfslt divA+0 ; - actual vertical speed smaller than attention threshold? | |
2519 bra TFT_velocity_set_color_attn ; NO - set attention color and return | |
2520 bcf aux_flag ; YES - don't show in alternative layout | |
2521 ;bra TFT_velocity_set_color_memo ; - set memo color and return | |
2522 | |
2523 | |
2524 ; Helper Function - select color | |
2525 TFT_velocity_set_color_memo: | |
2526 FONT_COLOR_MEMO ; select memo color | |
2527 return ; done | |
2528 | |
2529 TFT_velocity_set_color_attn: | |
2530 FONT_COLOR_ATTENTION ; select attention color | |
2531 return ; done | |
2532 | |
2533 TFT_velocity_set_color_warn: | |
2534 FONT_COLOR_WARNING ; select warning color | |
2535 return ; done | |
2536 | |
2537 | |
2538 ; Helper Function - show the numerical VSI | |
2539 TFT_velocity_num: | |
2540 btfsc alt_layout_active ; in alternative layout? | |
2541 bra TFT_velocity_num_alt ; YES | |
2542 ;bra TFT_velocity_num_norm ; NO | |
2543 | |
2544 TFT_velocity_num_norm: | |
2545 WIN_SMALL dm_velocity_text_col_norm, dm_velocity_text_row_norm | |
2546 bra TFT_velocity_num_com ; continue with common part | |
2547 | |
2548 TFT_velocity_num_alt: | |
2549 btfsc dive_main_menu ; is the dive mode menu shown? | |
2550 return ; YES - abort | |
2551 btfss neg_flag_velocity ; NO - in ascent? | |
2552 bcf aux_flag ; NO - clear aux flag | |
2553 btfsc aux_flag ; - above attention or warning threshold? | |
2554 bsf win_invert ; YES - print inverse | |
2555 WIN_SMALL dm_velocity_text_col_alt, dm_velocity_text_row_alt | |
2556 ;bra TFT_velocity_num_com ; - continue with common part | |
2557 | |
2558 TFT_velocity_num_com: | |
2559 bsf velocity_active_num ; set numerical velocity as shown | |
2560 TSTOSS opt_units ; 0=meter, 1=feet | |
2561 bra TFT_velocity_num_metric ; 0 - meter | |
2562 ;bra TFT_velocity_num_imperial ; 1 - feet | |
2563 | |
2564 TFT_velocity_num_imperial: | |
2565 movff divA+0,WREG ; divA+0 = m/min | |
2566 mullw .100 ; PROD = mbar/min | |
2567 MOVII PRODL,mpr ; copy to hi:lo | |
2568 call convert_cm_to_feet ; convert value in hi:lo from [cm] to [feet] | |
2569 tstfsz hi ; > 255 ? | |
2570 setf lo ; YES - set lo to 255 | |
2571 rcall TFT_velocity_num_helper ; print vertical speed | |
2572 STRCAT_TEXT tVelImperial ; print unit | |
2573 bra TFT_velocity_num_finish ; do finishing tasks | |
2574 | |
2575 TFT_velocity_num_metric: | |
2576 movff divA+0,lo ; divA+0 = m/min | |
2577 rcall TFT_velocity_num_helper ; print vertical speed | |
2578 STRCAT_TEXT tVelMetric ; print unit | |
2579 ;bra TFT_velocity_num_finish ; do finishing tasks | |
2580 | |
2581 TFT_velocity_num_finish: | |
2582 btfss alt_layout_active ; in alternative layout? | |
2583 bra TFT_velocity_num_finish_1 ; NO | |
2584 movlw "'" ; load encoding of minute sign | |
2585 movff WREG,buffer+4 ; put it after m (meter) / f (feet) | |
2586 clrf WREG ; load string terminator | |
2587 movff WREG,buffer+5 ; terminate string after minute sign | |
2588 TFT_velocity_num_finish_1: | |
2589 PRINT ; dump to screen | |
2590 return ; done | |
2591 | |
2592 | |
2593 ; Helper Function - print vertical speed | |
2594 TFT_velocity_num_helper: | |
2595 movlw '-' ; load coding for minus sign | |
2596 btfsc neg_flag_velocity ; ascending? | |
2597 movlw '+' ; YES - replace with coding for plus sign | |
2598 movwf POSTINC2 ; put sign into output buffer | |
2599 output_99 ; print rate (0-99) | |
2600 return ; done | |
2601 | |
2602 | |
2603 ;----------------------------------------------------------------------------- | |
2604 ; Dive Mode - clear vertical Velocity | |
2605 ; | |
2606 global TFT_velocity_clear | |
2607 TFT_velocity_clear: | |
2608 btfss velocity_active_num ; was the numerical VSI shown in last cycle? | |
2609 bra TFT_velocity_check_graph ; NO - no need to clear it, continue with graphical VSI | |
2610 ;bra TFT_velocity_clear_num ; YES | |
2611 | |
2612 TFT_velocity_clear_num: | |
2613 bcf velocity_active_num ; clear flag | |
2614 btfsc alt_layout_active ; in alternative layout? | |
2615 bra TFT_velocity_clear_num_alt ; YES | |
2616 ;bra TFT_velocity_clear_num_norm ; NO | |
2617 | |
2618 TFT_velocity_clear_num_norm: ; clear normal numerical area | |
2619 WIN_BOX_BLACK dm_velocity_text_row_norm, dm_velocity_text_bot_norm, dm_velocity_text_col_norm, dm_velocity_text_rgt_norm | |
2620 bra TFT_velocity_check_graph ; continue with graphical VSI | |
2621 | |
2622 TFT_velocity_clear_num_alt: ; clear alternative numerical area | |
2623 btfsc dive_main_menu ; is the dive mode menu shown? | |
2624 bra TFT_velocity_check_graph ; YES - skip | |
2625 WIN_BOX_BLACK dm_velocity_text_row_alt, dm_velocity_text_bot_alt, dm_velocity_text_col_alt, dm_velocity_text_rgt_alt | |
2626 ;bra TFT_velocity_check_graph ; continue with graphical VSI | |
2627 | |
2628 TFT_velocity_check_graph: | |
2629 btfss velocity_active_vsi ; was the graphical VSI shown in last cycle? | |
2630 return ; NO - no need to clear it, done | |
2631 ;bra TFT_velocity_clear_graph ; YES - clear it | |
2632 | |
2633 TFT_velocity_clear_graph: | |
2634 bcf velocity_active_vsi ; clear flag | |
2635 btfsc alt_layout_active ; in alternative layout? | |
2636 return ; YES - done (not implemented) | |
2637 WIN_BOX_BLACK dm_velocity_graph_top, dm_velocity_graph_bot, dm_velocity_graph_lft, dm_velocity_graph_rgt | |
2638 return ; done | |
2639 | |
560 | 2640 |
2641 ;============================================================================= | |
634 | 2642 tft_out10 CODE |
2643 ;============================================================================= | |
2644 | |
2645 | |
2646 ;----------------------------------------------------------------------------- | |
2647 ; Dive Mode - show Sign | |
2648 ; | |
2649 global TFT_divemode_sign_show | |
2650 TFT_divemode_sign_show: | |
2651 btfsc alt_layout_active ; alternative layout active? | |
2652 bra TFT_divemode_sign_show_alt ; YES | |
2653 ;bra TFT_divemode_sign_show_norm ; NO | |
2654 | |
2655 TFT_divemode_sign_show_norm: | |
2656 WIN_TOP dm_sign_row_norm ; set row position | |
2657 WIN_LEFT dm_sign_col_norm ; set column position | |
2658 bra TFT_divemode_sign_show_com ; continue with common part | |
2659 | |
2660 TFT_divemode_sign_show_alt: | |
2661 btfsc dive_main_menu ; is the dive mode menu shown? | |
2662 return ; YES - abort | |
2663 btfsc sign_shown ; NO - sign already shown? | |
2664 bra TFT_divemode_sign_show_alt_1; YES - no need to clear area again | |
2665 btfsc bailout_mode ; NO - in bailout? | |
2666 bra TFT_divemode_sign_show_alt_1; YES - no need to clear the area | |
2667 ; NO - clear area from "bar" label and loop mode if applicable | |
2668 WIN_BOX_BLACK dm_active_dil_row, dm_3rdrow_bot, dm_active_sp_label_col, dm_sign_rgt_alt ; top, bottom, left, right | |
2669 | |
2670 TFT_divemode_sign_show_alt_1: | |
2671 WIN_TOP dm_sign_row_alt ; - set row position | |
2672 WIN_LEFT dm_sign_col_alt ; - set column position | |
2673 ;bra TFT_divemode_sign_show_com ; - continue with common part | |
2674 | |
2675 TFT_divemode_sign_show_com: | |
2676 bsf sign_shown ; flag sign is shown | |
2677 btfsc sign_warning ; shall show warning sign? | |
2678 bra TFT_divemode_sign_show_warn ; YES - show warning sign | |
2679 btfsc sign_attention ; NO - shall show attention sign? | |
2680 bra TFT_divemode_sign_show_att ; YES - show attention sign | |
2681 btfsc sign_advice ; NO - shall show advice sign? | |
2682 bra TFT_divemode_sign_show_adv ; YES - show advice sign | |
2683 return ; NO - false alarm | |
2684 | |
2685 TFT_divemode_sign_color_warn: ; custom colors table for dive_warning2 icon - warning | |
2686 db .4, 0 ; #colors, spare | |
2687 dw 0x0000 ; color 0x00: outside black | |
2688 dw 0xff80 ; color 0x01: triangle yellow | |
2689 dw 0xff80 ; color 0x02: exclamation mark yellow | |
2690 dw 0xf800 ; color 0x03: inside red | |
2691 | |
2692 TFT_divemode_sign_color_adv: ; custom colors table for dive_warning2 icon - advice | |
2693 db .4, 0 ; #colors, spare | |
2694 dw 0x0000 ; color 0x00: outside black | |
2695 dw 0xffff ; color 0x01: triangle white | |
2696 dw 0xffff ; color 0x02: exclamation mark white | |
2697 dw 0x0780 ; color 0x03: inside green | |
2698 | |
2699 TFT_divemode_sign_show_warn: | |
2700 TFT_WRITE_PROM_IMAGE_CUST_COLOR TFT_divemode_sign_color_warn; set custom colors for warning | |
2701 TFT_WRITE_PROM_IMAGE_BY_LABEL dive_warning2_block ; show sign | |
2702 return ; done | |
2703 | |
2704 TFT_divemode_sign_show_att: | |
2705 TFT_WRITE_PROM_IMAGE_BY_LABEL dive_warning2_block ; show sign (with default colors) | |
2706 return ; done | |
2707 | |
2708 TFT_divemode_sign_show_adv: | |
2709 TFT_WRITE_PROM_IMAGE_CUST_COLOR TFT_divemode_sign_color_adv ; set custom colors for advice | |
2710 TFT_WRITE_PROM_IMAGE_BY_LABEL dive_warning2_block ; show sign | |
2711 return ; done | |
2712 | |
2713 | |
2714 ;----------------------------------------------------------------------------- | |
2715 ; Dive Mode - show Sign | |
2716 ; | |
2717 global TFT_divemode_sign_clear | |
2718 TFT_divemode_sign_clear: | |
2719 btfss sign_shown ; is the advice/attention/warning sign shown? | |
2720 return ; NO - done | |
2721 bcf sign_shown ; YES - clear flag | |
2722 btfsc alt_layout_active ; - alternative layout active? | |
2723 bra TFT_divemode_sign_clear_alt ; - YES | |
2724 ;bra TFT_divemode_sign_clear_norm; - NO | |
2725 | |
2726 TFT_divemode_sign_clear_norm: | |
2727 WIN_BOX_BLACK dm_sign_row_norm, dm_sign_bot_norm, dm_sign_col_norm, dm_sign_rgt_norm | |
2728 return ; done | |
2729 | |
2730 TFT_divemode_sign_clear_alt: | |
2731 WIN_BOX_BLACK dm_sign_row_alt, dm_sign_bot_alt, dm_sign_col_alt, dm_sign_rgt_alt | |
2732 return ; done | |
2733 | |
2734 | |
2735 ;============================================================================= | |
2736 tft_out11 CODE | |
2737 ;============================================================================= | |
2738 | |
2739 | |
2740 ;----------------------------------------------------------------------------- | |
2741 ; Dive Mode - show Safety Stop | |
2742 ; | |
2743 global TFT_safety_stop_show | |
2744 TFT_safety_stop_show: | |
2745 btfsc dive_main_menu ; is the dive mode menu shown? | |
2746 return ; YES - abort | |
2747 btfsc safety_stop_active ; NO - is the safety stop shown already? | |
2748 bra TFT_safety_stop_show_time ; YES - just update the time | |
2749 ; NO - clear area that may be polluted by alternative NDL | |
2750 WIN_BOX_BLACK dm_safetystop_row, dm_tts_value_row, dm_ndl_value_col_alt, dm_safetystop_rgt ; top, bottom, left, right | |
2751 bsf safety_stop_active ; - flag safety stop is shown now | |
2752 WIN_STD dm_safetystop_text_column, dm_safetystop_text_row | |
2753 FONT_COLOR_MASK ; - set color | |
2754 STRCPY_PRINT "Stop " ; - print "Stop" with a trailing space to wipe away potential other remains | |
2755 | |
2756 TFT_safety_stop_show_time: | |
2757 WIN_MEDIUM dm_safetystop_column, dm_safetystop_row | |
2758 FONT_COLOR_ATTENTION ; set color | |
2759 movff safety_stop_countdown,lo ; get remaining time in seconds, low byte, from safety stop timer | |
2760 clrf hi ; set remaining time in seconds, high byte, to zero | |
2761 call convert_time ; convert hi:lo in seconds to minutes (up:hi) and seconds (lo) | |
2762 movff lo,up ; save seconds in up | |
2763 movff hi,lo ; move minutes to lo | |
2764 output_9 ; print minutes (0-9) | |
2765 PUTC ':' ; print ":" | |
2766 movff up,lo ; move seconds to lo | |
2767 output_99x ; print seconds (00-99) | |
2768 PRINT ; dump buffer to screen | |
2769 return ; done | |
2770 | |
2771 | |
2772 ;----------------------------------------------------------------------------- | |
2773 ; Dive Mode - clear Safety Stop | |
2774 ; | |
2775 global TFT_safety_stop_clear | |
2776 TFT_safety_stop_clear: | |
2777 btfsc dive_main_menu ; is the dive mode menu shown? | |
2778 return ; YES - abort | |
2779 btfss safety_stop_active ; NO - is the safety stop shown? | |
2780 return ; NO - done, nothing to do | |
2781 ; YES - clear safety stop area | |
2782 WIN_BOX_BLACK dm_safetystop_row, dm_safetystop_bot, dm_safetystop_text_column, dm_safetystop_rgt ; top, bottom, left, right | |
2783 bcf safety_stop_active ; - safety stop not shown any more | |
2784 btfss deco_region ; - was the dive within deco stops region? | |
2785 return ; NO - done | |
2786 ;bra TFT_show_slow_reminder ; YES - show "SLOW" reminder | |
2787 | |
2788 | |
2789 ;----------------------------------------------------------------------------- | |
2790 ; Dive Mode - show "slow" Reminder | |
2791 ; | |
2792 TFT_show_slow_reminder: | |
2793 WIN_STD dm_safetystop_text_column+.5,dm_safetystop_text_row+.5 | |
2794 FONT_COLOR_ATTENTION ; set color | |
2795 STRCPY_TEXT tSlow ; print "SLOW" reminder | |
2796 STRCAT_PRINT 0x94 ; append an up-arrow | |
2797 return ; done | |
2798 | |
2799 | |
2800 ;============================================================================= | |
2801 tft_out12 CODE | |
2802 ;============================================================================= | |
2803 | |
2804 | |
2805 ;----------------------------------------------------------------------------- | |
2806 ; clear complete Message Window | |
2807 ; | |
623 | 2808 global TFT_clear_message_window |
2809 TFT_clear_message_window: | |
634 | 2810 btfss divemode ; in dive mode? |
2811 bra TFT_clear_message_window_surf ; NO - clear surface mode area | |
2812 ;bra TFT_clear_message_window_dive ; YES - clear dive mode area | |
623 | 2813 |
2814 TFT_clear_message_window_dive: | |
634 | 2815 btfsc alt_layout_active ; in alternative layout? |
2816 bra TFT_clear_message_window_dive_2 ; YES - clear dive mode area, 2nd row only | |
2817 | |
2818 WIN_BOX_BLACK dm_warning_row, dm_warning_bot, dm_warning_column, dm_warning_rgt | |
2819 return ; done | |
623 | 2820 |
2821 TFT_clear_message_window_surf: | |
582 | 2822 WIN_BOX_BLACK surf_warning1_row, surf_warning2_row+.24, surf_warning1_column, surf_warning1_column+.76 ; top, bottom, left, right |
634 | 2823 return ; done |
2824 | |
2825 | |
2826 ;----------------------------------------------------------------------------- | |
2827 ; clear 2nd Line of Message Window | |
2828 ; | |
623 | 2829 global TFT_clear_message_window_row2 |
2830 TFT_clear_message_window_row2: | |
634 | 2831 bcf message_2nd_row_used ; 2nd row is cleared |
2832 btfss divemode ; in dive mode? | |
2833 bra TFT_clear_message_window_surf_2 ; NO - clear surface mode area, 2nd row only | |
2834 ;bra TFT_clear_message_window_dive_2 ; YES - clear dive mode area, 2nd row only | |
623 | 2835 |
2836 TFT_clear_message_window_dive_2: | |
634 | 2837 WIN_BOX_BLACK dm_warning2_row, dm_warning2_bot, dm_warning2_column, dm_warning2_rgt |
2838 return ; done | |
623 | 2839 |
2840 TFT_clear_message_window_surf_2: | |
582 | 2841 WIN_BOX_BLACK surf_warning2_row, surf_warning2_row+.24, surf_warning2_column, surf_warning2_column+.76 ; top, bottom, left, right |
634 | 2842 return ; done |
2843 | |
643 | 2844 ;----------------------------------------------------------------------------- |
2845 ; Surface Mode - Message - when "I2CFail" was triggered | |
2846 ; | |
2847 global TFT_message_i2c_error | |
2848 TFT_message_i2c_error: | |
2849 rcall TFT_message_open ; set row and column for the message | |
2850 tstfsz WREG ; is there room for the message? | |
2851 return ; NO - skip message in this cycle | |
2852 STRCPY "I2C " ; print "I2C Error:" | |
2853 movff i2c_error_vault+0,WREG ; last device adress | |
2854 output_hex | |
2855 PUTC " " | |
2856 movff i2c_error_vault+1,WREG ; last data byte | |
2857 output_hex | |
2858 bra TFT_message_close ; finalize message output | |
634 | 2859 |
2860 ;----------------------------------------------------------------------------- | |
2861 ; Surface Mode - Message - Desaturation | |
2862 ; | |
2863 global TFT_surf_mesg_desat | |
2864 TFT_surf_mesg_desat: | |
2865 rcall TFT_message_open ; set row and column for the message | |
604 | 2866 tstfsz WREG ; is there room for the message? |
631 | 2867 return ; NO - skip message in this cycle |
634 | 2868 |
2869 FONT_COLOR_MEMO ; select color | |
2870 STRCPY "Desat:" ; print label | |
2871 MOVII int_O_desaturation_time,mpr ; get desaturation time in minutes | |
2872 bra TFT_dsat_nofly_common ; continue with common part | |
2873 | |
2874 | |
2875 ;----------------------------------------------------------------------------- | |
2876 ; Surface Mode - Message - No-Fly / NO-Altitude | |
2877 ; | |
2878 global TFT_surf_mesg_nofly | |
2879 TFT_surf_mesg_nofly: | |
2880 rcall TFT_message_open ; set row and column for the message | |
604 | 2881 tstfsz WREG ; is there room for the message? |
631 | 2882 return ; NO - skip message in this cycle |
634 | 2883 |
2884 FONT_COLOR_MEMO ; select color | |
2885 movff char_I_altitude_wait,WREG ; get mode | |
2886 tstfsz WREG ; mode = altitude? | |
2887 bra TFT_nofly_time_alt ; YES | |
2888 ;bra TFT_nofly_time_fly ; NO | |
2889 | |
2890 TFT_nofly_time_fly: | |
2891 STRCPY "NoFly:" ; print no-fly label | |
2892 bra TFT_nofly_time_com ; continue | |
2893 | |
2894 TFT_nofly_time_alt: | |
2895 STRCPY "NoAlt:" ; print no-altitude label | |
2896 ;bra TFT_nofly_time_com ; continue | |
2897 | |
2898 TFT_nofly_time_com: | |
2899 MOVII int_O_nofly_time,mpr ; get no-fly time in minutes | |
2900 ;bra TFT_dsat_nofly_common ; continue with common part | |
2901 | |
2902 | |
2903 ; Helper Function - common part for TFT_surf_mesg_desat and TFT_surf_mesg_nofly | |
2904 TFT_dsat_nofly_common: | |
2905 call convert_time ; convert hi:lo in minutes to hours (up:hi) and minutes (lo) | |
2906 movff lo,up ; backup lo | |
2907 movff hi,lo ; get hours into lo | |
2908 output_99 ; print hours (0-99) | |
2909 PUTC ':' ; print ":" | |
2910 movff up,lo ; get minutes into lo | |
2911 output_99x ; print minutes (00-99) | |
2912 bra TFT_message_close ; finalize message output | |
2913 | |
2914 | |
2915 ;----------------------------------------------------------------------------- | |
2916 ; Dive Mode - Message - fTTS | |
2917 ; | |
2918 global TFT_message_ftts | |
2919 TFT_message_ftts: | |
2920 call TFT_message_open ; set row and column for the message | |
604 | 2921 tstfsz WREG ; is there room for the message? |
631 | 2922 return ; NO - skip message in this cycle |
634 | 2923 |
2924 IFDEF _cave_mode | |
2925 btfss cave_mode ; cave mode switched on? | |
2926 bra TFT_display_ftts_2 ; NO - classic open water TTS | |
2927 btfss dive_turned ; YES - dive turned? | |
2928 bra TFT_display_ftts_1 ; NO - cTTS from current position | |
2929 STRCPY "WP" ; YES - print waypoint mark | |
2930 movf backtrack_waypoint_num,W ; - copy current waypoint number to WREG | |
2931 cpfseq backtrack_waypoint_turn ; - current waypoint = turn point ? | |
2932 bra TFT_display_ftts_0 ; NO - print waypoint number | |
2933 STRCAT "-| " ; YES - print turn point symbol | |
2934 bra TFT_display_ftts_5 ; - continue with TTS | |
2935 TFT_display_ftts_0: | |
2936 movwf lo ; copy current waypoint number to lo | |
2937 bsf leftbind ; print left-aligned | |
2938 output_99 ; print waypoint number (0-99) | |
2939 PUTC " " ; append a space char | |
2940 bra TFT_display_ftts_5 ; continue with TTS | |
2941 TFT_display_ftts_1: | |
2942 STRCPY "cTTS " ; print cave TTS label followed by a space | |
2943 bra TFT_display_ftts_5 ; continue with TTS | |
623 | 2944 ENDIF ; _cave_mode |
634 | 2945 TFT_display_ftts_2: |
2946 btfsc FLAG_oc_mode ; in OC mode? | |
2947 bra TFT_display_ftts_3 ; YES - print fTTS label | |
2948 TSTOSS opt_calc_gasvolume ; NO - bailout volume calculation requested? | |
2949 bra TFT_display_ftts_3 ; NO - print fTTS label | |
2950 STRCPY "B/O" ; YES - print bailout label | |
2951 bra TFT_display_ftts_4 ; - continue | |
2952 TFT_display_ftts_3: ; OC or CCR/pSCR but no bailout volume calculation | |
2953 STRCPY "@+" ; print fTTS label | |
2954 TFT_display_ftts_4: | |
2955 movff char_I_extra_time,lo ; get fTTS delay time | |
2956 output_9 ; print fTTS delay time (0-9) | |
2957 PUTC ":" ; print ":" | |
2958 TFT_display_ftts_5: | |
2959 MOVII int_O_TTS_alt,mpr ; get alternative TTS | |
2960 FONT_COLOR_MEMO ; set memo color | |
2961 btfss hi,int_invalid_flag ; is the invalid flag set? | |
2962 bra TFT_display_ftts_6 ; NO - keep memo color | |
2963 bcf hi,int_invalid_flag ; YES - clear flag | |
2964 FONT_COLOR_DISABLED ; - switch to disabled color | |
2965 TFT_display_ftts_6: | |
2966 btfsc hi,int_not_yet_computed ; is the not-yet-computed flag set? | |
2967 bra TFT_display_ftts_8 ; YES - show dashes | |
2968 IFDEF _cave_mode | |
2969 btfsc cave_mode ; cave mode switched on? | |
2970 bra TFT_display_ftts_7 ; YES - take shortcut | |
2971 ENDIF | |
2972 movff int_O_TST_alt+1,WREG ; get high byte of the alternative total stops time | |
2973 btfsc WREG,int_is_zero ; total stops time = zero ? | |
2974 bra TFT_display_ftts_9 ; YES - show "NDL" | |
640 | 2975 movff char_O_deco_info,WREG ; NO - get deco info vector |
2976 btfsc WREG,deco_zone ; - fTTS <= TTS ? | |
2977 FONT_COLOR_ADVICE ; YES - set to advice color (green) | |
634 | 2978 TFT_display_ftts_7: |
2979 bsf leftbind ; print left-aligned | |
2980 output_999 ; print ascent time (0-999) | |
2981 PUTC "'" ; print minutes symbol | |
2982 bra TFT_message_close ; finalize message output | |
2983 TFT_display_ftts_8: | |
2984 STRCAT "---" ; print "---" for not computed | |
2985 bra TFT_message_close ; finalize message output | |
2986 TFT_display_ftts_9: | |
2987 STRCAT_TEXT tNDL ; print "NDL" | |
2988 bra TFT_message_close ; finalize message output | |
2989 | |
2990 | |
2991 ;----------------------------------------------------------------------------- | |
2992 ; Dive Mode - Message - ppO2 | |
2993 ; | |
2994 global TFT_message_ppo2 | |
2995 TFT_message_ppo2: | |
2996 call TFT_message_open ; set row and column for the message | |
604 | 2997 tstfsz WREG ; is there room for the message? |
631 | 2998 return ; NO - skip message in this cycle |
634 | 2999 |
3000 call TFT_color_code_ppo2 ; color-code output | |
3001 | |
3002 btfsc bailout_mode ; in bailout? | |
3003 bra TFT_display_diluent_oc ; YES - bailout (OC) | |
3004 btfsc FLAG_ccr_mode ; NO - in CCR mode? | |
3005 bra TFT_display_diluent_ccr ; YES - CCR | |
3006 btfsc FLAG_pscr_mode ; NO - in pSCR mode? | |
3007 bra TFT_display_diluent_pscr ; YES - pSCR | |
3008 ;bra TFT_display_diluent_oc ; NO - OC | |
3009 | |
3010 TFT_display_diluent_oc: | |
3011 STRCPY_TEXT tppO2 ; bailout or OC mode, print "ppO2:" | |
3012 bra TFT_display_diluent_comm ; continue with ppO2 value | |
3013 | |
3014 TFT_display_diluent_ccr: | |
3015 STRCPY_TEXT tdil ; print "Dil:" | |
3016 bra TFT_display_diluent_comm ; continue with ppO2 value | |
3017 | |
3018 TFT_display_diluent_pscr: | |
3019 STRCPY_TEXT tmix ; YES - print "Mix:" | |
3020 ;bra TFT_display_diluent_comm ; - continue with ppO2 value | |
3021 | |
3022 TFT_display_diluent_comm: | |
3023 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
3024 output_999 ; print ppO2 (0.00-9.99) | |
3025 bra TFT_message_close ; finalize message output | |
3026 | |
3027 | |
3028 ;----------------------------------------------------------------------------- | |
3029 ; Dive Mode - Message - Battery | |
3030 ; | |
3031 global TFT_message_battery_percent | |
3032 TFT_message_battery_percent: | |
3033 rcall TFT_message_open ; set row and column for the message | |
604 | 3034 tstfsz WREG ; is there room for the message? |
631 | 3035 return ; NO - skip message in this cycle |
634 | 3036 |
3037 call TFT_color_code_battery ; color-code according to battery_low_condition flag | |
3038 STRCPY "Batt:" ; print "Batt:" | |
3039 bsf leftbind ; print left-aligned | |
3040 movff batt_percent,lo ; get battery % | |
3041 output_256 ; print battery % (0-255) | |
3042 PUTC "%" ; print "%" | |
3043 bra TFT_message_close ; finalize message output | |
3044 | |
3045 | |
3046 ;----------------------------------------------------------------------------- | |
3047 ; Dive Mode - Message - current CNS | |
3048 ; | |
3049 global TFT_message_cns | |
3050 TFT_message_cns: | |
3051 call TFT_message_open ; set row and column for the message | |
604 | 3052 tstfsz WREG ; is there room for the message? |
631 | 3053 return ; NO - skip message in this cycle |
634 | 3054 |
3055 MOVII int_O_CNS_current,mpr ; get current CNS | |
3056 call TFT_color_code_cns ; color-code CNS output | |
3057 STRCPY_TEXT tCNS ; CNS: | |
3058 bsf leftbind ; print left-aligned | |
3059 output_999 ; print (0-999) | |
3060 PUTC "%" ; append unit | |
3061 bra TFT_message_close ; finalize message output | |
3062 | |
3063 | |
3064 ;----------------------------------------------------------------------------- | |
3065 ; Dive Mode - Message - End-of-Dive CNS | |
3066 ; | |
3067 global TFT_message_cns_eod | |
3068 TFT_message_cns_eod: | |
3069 call TFT_message_open ; set row and column for the message | |
623 | 3070 tstfsz WREG ; is there room for the message? |
631 | 3071 return ; NO - skip message in this cycle |
634 | 3072 |
3073 FONT_COLOR_WARNING ; switch to warnings (red) text color | |
3074 STRCPY_TEXT tCNSeod ; end-of-dive CNS warning text | |
3075 bra TFT_message_close ; finalize message output | |
3076 | |
3077 | |
3078 ;----------------------------------------------------------------------------- | |
3079 ; Dive Mode - Message - Saturation | |
3080 ; | |
3081 global TFT_message_saturation | |
3082 TFT_message_saturation | |
3083 rcall TFT_message_open ; set row and column for the message | |
604 | 3084 tstfsz WREG ; is there room for the message? |
631 | 3085 return ; NO - skip message in this cycle |
634 | 3086 |
3087 MOVII int_O_lead_supersat,mpr ; get leading tissue's supersaturation | |
3088 call TFT_color_code_supersat ; color-code output | |
3089 STRCPY_TEXT tSAT ; print "Sat:" | |
3090 PUTC " " ; add a space to align the output with other warnings' outputs | |
3091 bsf leftbind ; print left-aligned | |
3092 output_256 ; print value of lo only, int_O_lead_supersat is limited to 255 | |
3093 PUTC "%" ; print "%" | |
3094 bra TFT_message_close ; finalize message output | |
3095 | |
3096 | |
3097 ;----------------------------------------------------------------------------- | |
3098 ; Dive Mode - Message - alternative GF | |
3099 ; | |
3100 global TFT_message_agf | |
3101 TFT_message_agf: | |
3102 rcall TFT_message_open ; set row and column for the message | |
604 | 3103 tstfsz WREG ; is there room for the message? |
631 | 3104 return ; NO - skip message in this cycle |
634 | 3105 |
3106 FONT_COLOR_ATTENTION ; set attention color | |
3107 STRCPY_TEXT tDiveaGF_active ; print "aGF!" | |
3108 bra TFT_message_close ; finalize message output | |
3109 | |
3110 | |
3111 ;----------------------------------------------------------------------------- | |
3112 ; Dive Mode - Message - Dive Timeout | |
3113 ; | |
3114 global TFT_message_divetimeout | |
3115 TFT_message_divetimeout: | |
3116 call TFT_message_open ; set row and column for the message | |
604 | 3117 tstfsz WREG ; is there room for the message? |
631 | 3118 return ; NO - skip message in this cycle |
634 | 3119 |
3120 FONT_COLOR_MEMO ; select color | |
3121 STRCPY 0x94 ; "End of dive" symbol (up-arrow) | |
3122 movff opt_diveTimeout,WREG ; get timeout in minutes | |
3123 mullw .60 ; get timeout in seconds | |
3124 MOVII PRODL, sub_a ; calculate timeout - elapsed time = countdown | |
3125 MOVII dive_timeout_timer,sub_b ; ... | |
3126 call subU16 ; ... | |
3127 MOVII sub_c,mpr ; transfer to mpr | |
3128 call convert_time ; convert hi:lo in seconds to minutes (up:hi) and seconds (lo) | |
3129 movff lo,up ; back-up lo | |
3130 movff hi,lo ; get minutes | |
3131 output_99 ; print minutes (0-99) | |
3132 PUTC ':' ; print ":" | |
3133 movff up,lo ; get seconds | |
3134 output_99x ; print seconds (00-99) | |
3135 movlw dm_warning_length ; get dive mode string length | |
3136 rcall TFT_buffer_trim_length ; fill / cut buffer to target length | |
3137 PRINT ; dump to screen | |
3138 return ; done | |
3139 | |
3140 | |
3141 ;----------------------------------------------------------------------------- | |
3142 ; Dive Mode - Message - Gas Needs | |
3143 ; | |
3144 global TFT_message_gas_needs | |
3145 TFT_message_gas_needs: | |
3146 rcall TFT_message_open ; set row and column for the message | |
604 | 3147 tstfsz WREG ; is there room for the message? |
634 | 3148 return ; NO - skip message in this cycle |
3149 | |
3150 btfsc attn_det_gas_needs ; attention? | |
3151 FONT_COLOR_ATTENTION ; YES - set attention color | |
3152 btfsc warn_det_gas_needs ; warning? | |
3153 FONT_COLOR_WARNING ; YES - set warning color | |
3154 STRCPY_TEXT tGasNeedsWarn ; print "Gas Needs" | |
3155 bra TFT_message_close ; finalize message output | |
3156 | |
3157 | |
3158 ;----------------------------------------------------------------------------- | |
3159 ; Dive Mode - Message - Gas Change | |
3160 ; | |
3161 global TFT_message_gas_change | |
3162 TFT_message_gas_change: | |
3163 rcall TFT_message_open ; set row and column for the message | |
604 | 3164 tstfsz WREG ; is there room for the message? |
634 | 3165 return ; NO - skip message in this cycle |
3166 | |
3167 FONT_COLOR_ADVICE ; set advice color | |
3168 STRCPY_TEXT tgaschange ; print "Change?" | |
3169 bra TFT_message_close ; finalize message output | |
3170 | |
3171 | |
3172 ;----------------------------------------------------------------------------- | |
3173 ; Dive Mode - Message - no Bailout Gas | |
3174 ; | |
3175 global TFT_message_no_BO_gas | |
3176 TFT_message_no_BO_gas: | |
3177 rcall TFT_message_open ; set row and column for the message | |
3178 tstfsz WREG ; is there room for the message? | |
3179 return ; NO - skip message in this cycle | |
3180 | |
3181 FONT_COLOR_WARNING ; set warning color | |
3182 STRCPY_TEXT tnoBOgas ; print "-B/O-Gas-" | |
3183 bra TFT_message_close ; finalize message output | |
3184 | |
3185 | |
3186 ;----------------------------------------------------------------------------- | |
3187 ; Message - open Message | |
3188 ; | |
3189 ; sets the row and column for the current message | |
3190 ; | |
3191 TFT_message_open: | |
582 | 3192 ; ignore warning (now)? |
623 | 3193 decf message_counter,W ; load (message counter - 1) into WREG |
3194 bcf STATUS,C ; clear carry bit | |
3195 btfss alt_layout_active ; in alternative layout? | |
3196 rrcf WREG,W ; NO - divide (message_counter-1) by 2 to get the page of the message | |
3197 cpfseq message_page ; page of the message = current page ? | |
3198 retlw .255 ; NO - do not show in this cycle (message window is not defined) | |
3199 btfss divemode ; YES - in dive mode? | |
3200 bra TFT_set_message_window_sf ; NO - setup for surface mode | |
3201 ;bra TFT_set_message_window_dm ; YES - setup for dive mode | |
3202 | |
3203 ; Dive Mode | |
3204 TFT_set_message_window_dm: | |
634 | 3205 btfsc alt_layout_active ; in alternative layout? |
3206 bra TFT_set_message_window_dm_row2 ; YES - alternative layout only uses 2nd row | |
3207 btfss message_counter,0 ; NO - is the message number uneven? | |
3208 bra TFT_set_message_window_dm_row2 ; NO - use 2nd row | |
3209 ;bra TFT_set_message_window_dm_row1 ; YES - use 1st row | |
623 | 3210 |
3211 TFT_set_message_window_dm_row1: | |
634 | 3212 WIN_SMALL dm_warning1_column, dm_warning1_row |
3213 bcf message_2nd_row_used ; flag that the 2nd does not contain a message yet | |
3214 retlw .0 ; show in this cycle (message window is defined) | |
623 | 3215 |
3216 TFT_set_message_window_dm_row2: | |
634 | 3217 WIN_SMALL dm_warning2_column, dm_warning2_row |
3218 bsf message_2nd_row_used ; flag that the 2nd row contains a message now | |
3219 retlw .0 ; show in this cycle (message window is defined) | |
623 | 3220 |
3221 ; Surface Mode | |
3222 TFT_set_message_window_sf: | |
634 | 3223 btfss message_counter,0 ; is the message counter uneven? |
3224 bra TFT_set_message_window_sf_row2 ; NO - use 2nd row | |
3225 ;bra TFT_set_message_window_sf_row1 ; YES - use 1st row | |
623 | 3226 |
3227 TFT_set_message_window_sf_row1: | |
634 | 3228 WIN_SMALL surf_warning1_column,surf_warning1_row |
3229 bcf message_2nd_row_used ; flag that the 2nd row does not contain a message yet | |
3230 retlw .0 ; show in this cycle (message window is defined) | |
623 | 3231 |
3232 TFT_set_message_window_sf_row2: | |
634 | 3233 WIN_SMALL surf_warning2_column,surf_warning2_row |
3234 bsf message_2nd_row_used ; flag that the 2nd row contains a message now | |
3235 retlw .0 ; show in this cycle (message window is defined) | |
3236 | |
3237 | |
3238 ;----------------------------------------------------------------------------- | |
3239 ; Message - fill to a given Length, or cut if too long | |
3240 ; | |
3241 ; Input: buffer message | |
3242 ; WREG max length | |
3243 ; | |
3244 global TFT_buffer_trim_length | |
3245 TFT_buffer_trim_length: | |
3246 movwf lo ; copy max. string length to lo | |
3247 movf FSR2L,W ; get current string length to WREG | |
3248 subwf lo,F ; lo = max length - current length | |
3249 bn TFT_fillup_with_spaces_cut ; string too long -> cut string at max length | |
3250 bnz TFT_fillup_with_spaces_apnd ; string too short -> append spaces and string terminator | |
3251 bra TFT_fillup_with_spaces_term ; string at exact length -> append string terminator | |
3252 | |
3253 TFT_fillup_with_spaces_apnd: | |
3254 PUTC " " ; add one space | |
3255 decfsz lo,F ; all spaces done? | |
3256 bra TFT_fillup_with_spaces_apnd ; NO - loop | |
3257 bra TFT_fillup_with_spaces_term ; YES - append string terminator | |
3258 | |
3259 TFT_fillup_with_spaces_cut: | |
3260 movf lo,W ; get over-length (as negative number) into WREG | |
3261 addwf FSR2L,F ; set back buffer pointer to end of max length | |
3262 ;bra TFT_fillup_with_spaces_term ; append string terminator | |
3263 | |
3264 TFT_fillup_with_spaces_term: | |
3265 clrf INDF2 ; append string terminator | |
3266 return ; done | |
3267 | |
3268 | |
3269 ;----------------------------------------------------------------------------- | |
3270 ; Message - close Message | |
3271 ; | |
3272 TFT_message_close: | |
3273 movlw surf_warning_length ; get surface string length | |
3274 btfsc divemode ; in dive mode? | |
3275 movlw dm_warning_length ; YES - replace by dive mode string length | |
3276 rcall TFT_buffer_trim_length ; fill / cut buffer to target length | |
3277 PRINT ; dump to screen | |
3278 return ; done | |
3279 | |
3280 | |
3281 ;----------------------------------------------------------------------------- | |
3282 ; Dive Mode - Message - Micro-Bubbles | |
3283 ; | |
3284 global TFT_message_mbubbles | |
3285 TFT_message_mbubbles: | |
3286 rcall TFT_message_open ; set row and column for the message | |
604 | 3287 tstfsz WREG ; is there room for the message? |
634 | 3288 return ; NO - skip message in this cycle |
3289 | |
3290 FONT_COLOR_ATTENTION ; set attention color as default | |
3291 movff char_O_deco_warnings,WREG ; bank-safe copy for deco warnings | |
3292 btfsc WREG,mbubble_warning ; currently in the micro bubbles zone? | |
3293 FONT_COLOR_WARNING ; YES - reconfigure to warning color | |
3294 STRCPY_TEXT tMicroBubbles ; print message text | |
3295 bra TFT_message_close ; finalize message output | |
3296 | |
3297 | |
3298 ;----------------------------------------------------------------------------- | |
3299 ; Dive Mode - Message - Outside Buhlmann Model | |
3300 ; | |
3301 global TFT_message_outside | |
3302 TFT_message_outside: | |
3303 rcall TFT_message_open ; set row and column for the message | |
3304 tstfsz WREG ; is there room for the message? | |
3305 return ; NO - skip message in this cycle | |
3306 | |
3307 FONT_COLOR_ATTENTION ; set attention color | |
3308 movff char_O_deco_warnings,WREG ; bank-safe copy for deco warnings | |
3309 btfsc WREG,outside_warning ; currently outside the ZH-L16 model? | |
3310 FONT_COLOR_WARNING ; YES - reconfigure to warning color | |
3311 STRCPY "X-ZHL16-X" ; print message text | |
3312 bra TFT_message_close ; finalize message output | |
3313 | |
3314 | |
3315 ;----------------------------------------------------------------------------- | |
3316 ; Dive Mode - Message - Depth Limit | |
3317 ; | |
3318 global TFT_message_depth_limit | |
3319 TFT_message_depth_limit: | |
3320 rcall TFT_message_open ; set row and column for the message | |
3321 tstfsz WREG ; is there room for the message? | |
3322 return ; NO - skip message in this cycle | |
3323 | |
3324 FONT_COLOR_WARNING ; set warning color | |
3325 STRCPY_TEXT tMaxDepth ; print "max.Depth" | |
3326 bra TFT_message_close ; finalize message output | |
3327 | |
3328 | |
3329 ;----------------------------------------------------------------------------- | |
3330 ; Dive Mode - Message - Deco Info | |
3331 ; | |
3332 global TFT_message_deco_info | |
3333 TFT_message_deco_info | |
3334 rcall TFT_message_open ; set row and column for the message | |
3335 tstfsz WREG ; is there room for the message? | |
3336 return ; NO - skip message in this cycle | |
3337 | |
3338 FONT_COLOR_ADVICE ; actually it is a memo, but we break the rules here and display in advice color (green) | |
3339 STRCPY_TEXT tDecoInfo ; write "Deco Zone" | |
3340 bra TFT_message_close ; finalize message output | |
3341 | |
3342 | |
3343 IFDEF _helium | |
3344 | |
3345 ;----------------------------------------------------------------------------- | |
3346 ; Dive Mode - Message - IBCD | |
3347 ; | |
3348 global TFT_message_IBCD | |
3349 TFT_message_IBCD: | |
3350 rcall TFT_message_open ; set row and column for the message | |
3351 tstfsz WREG ; is there room for the message? | |
3352 return ; NO - skip message in this cycle | |
3353 | |
3354 FONT_COLOR_ATTENTION ; set attention color | |
3355 STRCPY_TEXT tIBCD ; Print "IBCD N2He" | |
3356 bra TFT_message_close ; finalize message output | |
3357 | |
3358 ENDIF ; _helium | |
623 | 3359 |
3360 IFDEF _ccr_pscr | |
604 | 3361 |
634 | 3362 ;----------------------------------------------------------------------------- |
3363 ; Dive Mode - Message - Gas Density | |
3364 ; | |
3365 global TFT_message_gas_density | |
3366 TFT_message_gas_density: | |
3367 rcall TFT_message_open ; set row and column for the message | |
3368 tstfsz WREG ; is there room for the message? | |
3369 return ; NO - skip message in this cycle | |
3370 | |
3371 btfsc attn_det_gas_density ; on attention level? | |
3372 FONT_COLOR_ATTENTION ; YES - set attention color | |
3373 btfsc warn_det_gas_density ; on warning level? | |
3374 FONT_COLOR_WARNING ; YES set warning color | |
3375 STRCPY_TEXT tGasDensity ; print "G.Density" | |
3376 bra TFT_message_close ; finalize message output | |
3377 | |
3378 ENDIF ; _ccr_pscr | |
3379 | |
3380 IFDEF _external_sensor | |
3381 | |
3382 ;----------------------------------------------------------------------------- | |
3383 ; Dive Mode - Message - Sensor ppO2 Divergence | |
3384 ; | |
3385 global TFT_message_divergence | |
3386 TFT_message_divergence: | |
3387 rcall TFT_message_open ; set row and column for the message | |
3388 tstfsz WREG ; is there room for the message? | |
3389 return ; NO - skip message in this cycle | |
3390 | |
3391 FONT_COLOR_WARNING ; set warning color | |
3392 STRCPY_TEXT tSensorDisagree ; print "Sensors<>" | |
3393 bra TFT_message_close ; finalize message output | |
3394 | |
3395 | |
3396 ;----------------------------------------------------------------------------- | |
3397 ; Dive Mode - Message - Fallback | |
3398 ; | |
3399 global TFT_message_fallback | |
3400 TFT_message_fallback: | |
3401 rcall TFT_message_open ; set row and column for the message | |
3402 tstfsz WREG ; is there room for the message? | |
3403 return ; NO - skip message in this cycle | |
3404 | |
3405 FONT_COLOR_WARNING ; set warning color | |
3406 STRCPY_TEXT tDiveFallback ; print "Fallback!" | |
3407 bra TFT_message_close ; finalize message output | |
3408 | |
3409 ENDIF ; _external_sensor | |
3410 | |
3411 IFDEF _rx_functions | |
3412 | |
3413 ;----------------------------------------------------------------------------- | |
3414 ; Dive Mode - Message - TR - Transmitter | |
3415 ; | |
3416 global TFT_message_transmitter | |
3417 TFT_message_transmitter: | |
3418 rcall TFT_message_open ; set row and column for the message | |
3419 tstfsz WREG ; is there room for the message? | |
3420 return ; NO - skip message in this cycle | |
3421 | |
3422 FONT_COLOR_ATTENTION ; set attention color | |
3423 STRCPY_TEXT tTransmitter ; print "P.Transm." | |
3424 bra TFT_message_close ; finalize message output | |
3425 | |
3426 | |
3427 ;----------------------------------------------------------------------------- | |
3428 ; Dive Mode - Message - TR - Pressure | |
3429 ; | |
3430 global TFT_message_pressure | |
3431 TFT_message_pressure: | |
3432 rcall TFT_message_open ; set row and column for the message | |
3433 tstfsz WREG ; is there room for the message? | |
3434 return ; NO - skip message in this cycle | |
3435 | |
3436 btfsc attn_det_pressure1 ; on attention level - pressure 1 ? | |
3437 FONT_COLOR_ATTENTION ; YES - set attention color | |
3438 btfsc attn_det_pressure2 ; on attention level - pressure 2 ? | |
3439 FONT_COLOR_ATTENTION ; YES - set attention color | |
3440 btfsc warn_det_pressure1 ; on warning level - pressure 1 ? | |
3441 FONT_COLOR_WARNING ; YES - set warning color | |
3442 btfsc warn_det_pressure2 ; on warning level - pressure 2 ? | |
3443 FONT_COLOR_WARNING ; YES - set warning color | |
3444 STRCPY_TEXT tPressure ; print "Tank Pres" | |
3445 bra TFT_message_close ; finalize message output | |
3446 | |
3447 | |
3448 ;----------------------------------------------------------------------------- | |
3449 ; Dive Mode - Message - TR - SAC | |
3450 ; | |
3451 global TFT_message_sac | |
3452 TFT_message_sac: | |
3453 rcall TFT_message_open ; set row and column for the message | |
3454 tstfsz WREG ; is there room for the message? | |
3455 return ; NO - skip message in this cycle | |
3456 | |
3457 MOVII int_O_SAC_measured,mpr ; copy measured SAC rate to hi:lo | |
3458 call TFT_color_code_pres_sac ; color-code the output | |
3459 STRCPY_TEXT tSAC ; print "SAC" (needs to be exactly 3 chars long) | |
3460 STRCAT ": " ; print ": " | |
3461 bsf decimal_digit1 ; place a decimal point in front of digit 1 | |
3462 output_999 ; print (0.0-99.9) | |
3463 bra TFT_message_close ; finalize message output | |
3464 | |
3465 | |
3466 ;----------------------------------------------------------------------------- | |
3467 ; Dive Mode - Message - TR - switch Tank Advice | |
3468 ; | |
3469 global TFT_message_switch_tanks | |
3470 TFT_message_switch_tanks: | |
3471 rcall TFT_message_open ; set row and column for the message | |
3472 tstfsz WREG ; is there room for the message? | |
3473 return ; NO - skip message in this cycle | |
3474 | |
3475 FONT_COLOR_ADVICE ; set advice color | |
3476 STRCPY_TEXT tswap ; print "Swap Tank" | |
3477 bra TFT_message_close ; finalize message output | |
3478 | |
3479 ENDIF ; _rx_functions | |
3480 | |
3481 IFDEF _cave_mode | |
3482 | |
3483 ;----------------------------------------------------------------------------- | |
3484 ; Dive Mode - Message - Cave Mode | |
3485 ; | |
3486 global TFT_message_cave_mode | |
3487 TFT_message_cave_mode: | |
3488 rcall TFT_message_open ; set row and column for the message | |
3489 tstfsz WREG ; is there room for the message? | |
3490 return ; NO - skip message in this cycle | |
3491 | |
3492 btfss attn_det_cave_shut_down ; on attention level? | |
3493 bra TFT_message_cave_mode_1 ; NO | |
3494 FONT_COLOR_ATTENTION ; YES - select attention color | |
3495 bra TFT_message_cave_mode_sd ; - print shutdown message | |
3496 | |
3497 TFT_message_cave_mode_1: | |
3498 btfss warn_det_cave_shut_down ; on warning level? | |
3499 bra TFT_message_cave_mode_info ; NO | |
3500 FONT_COLOR_WARNING ; YES - select warning color | |
3501 ;bra TFT_message_cave_mode_sd ; - print shutdown message | |
3502 | |
3503 TFT_message_cave_mode_sd: | |
3504 STRCPY_TEXT tCaveModeShutdown ; print "X-Cave-X" | |
3505 bra TFT_message_close ; finalize message output | |
3506 | |
3507 TFT_message_cave_mode_info: | |
3508 FONT_COLOR_MEMO ; set memo color | |
3509 bsf win_invert ; print in inverse | |
3510 STRCPY_TEXT tCaveMode ; write "Cave Mode" | |
3511 bra TFT_message_close ; finalize message output | |
3512 | |
3513 ENDIF ; _cave_mode | |
3514 | |
623 | 3515 |
3516 ;============================================================================= | |
634 | 3517 tft_out13 CODE |
623 | 3518 ;============================================================================= |
3519 | |
634 | 3520 |
3521 ;----------------------------------------------------------------------------- | |
3522 ; Surface Custom View - Last Dive Summery | |
3523 ; | |
3524 global TFT_surf_cv_lastdive | |
3525 TFT_surf_cv_lastdive: | |
3526 FONT_COLOR_MEMO ; set color | |
3527 | |
582 | 3528 WIN_TINY surf_gaslist_column,surf_gaslist_row+.5 |
634 | 3529 STRCAT_TEXT_PRINT tLastDive ; "Last Dive:" |
3530 | |
582 | 3531 WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1)+.5 |
634 | 3532 STRCAT_TEXT_PRINT tDivetime ; "Divetime:" |
3533 | |
582 | 3534 WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2)+.5 |
634 | 3535 STRCAT_TEXT_PRINT tMaxDepth ; "Max.Depth" |
3536 | |
623 | 3537 WIN_TINY surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3)+.5 |
634 | 3538 STRCAT_TEXT_PRINT tAvgDepth ; "Average" |
623 | 3539 |
582 | 3540 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row |
634 | 3541 SMOVII int_O_desaturation_time,mpr ; ISR-safe copy of the desaturation time |
3542 movf mpr+0,W ; get low byte into WREG | |
3543 iorwf mpr+1,W ; inclusive-or with high byte, check if desaturation time is zero | |
3544 bz TFT_surface_lastdive_2 ; YES - show last dive time | |
3545 ;bra TFT_surface_lastdive_1 ; NO - show surface interval | |
3546 | |
560 | 3547 TFT_surface_lastdive_1: |
634 | 3548 ; surface interval |
3549 SMOVII surface_interval_mins,mpr ; ISR-safe copy of surface interval in minutes | |
3550 call convert_time ; convert hi:lo in minutes to hours (up:hi) and minutes (lo) | |
3551 movff lo,up ; back-up low | |
3552 movff hi,lo ; get hours | |
3553 output_99 ; print hours (0-99) | |
3554 PUTC 'h' ; append hours unit | |
3555 movff up,lo ; get minutes | |
3556 output_99x ; print minutes (00-99) | |
3557 PUTC_PRINT "m" ; append minutes unit and dump to screen | |
3558 bra TFT_surface_lastdive_com ; continue | |
3559 | |
560 | 3560 TFT_surface_lastdive_2: |
634 | 3561 ; last dive time |
3562 SMOVQQ surface_interval_secs,xC ; ISR-safe copy of surface_interval_secs:4 to xC:4 | |
3563 call output_secs_as_days_hours ; print seconds as days and hours | |
3564 PRINT ; dump to screen | |
3565 ;bra TFT_surface_lastdive_com ; continue | |
3566 | |
3567 TFT_surface_lastdive_com: | |
3568 ; last dive duration | |
582 | 3569 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row+(surf_gaslist_spacing*.1) |
634 | 3570 MOVII lastdive_duration,mpr ; get duration of last dive, minutes |
3571 output_999 ; print minutes | |
3572 PUTC ":" ; print ":" | |
3573 movff lastdive_duration+2,lo ; get duration of last dive, seconds | |
3574 output_99x ; print seconds | |
3575 PRINT ; dump to screen | |
3576 | |
3577 ; last dive max depth | |
582 | 3578 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row+(surf_gaslist_spacing*.2) |
634 | 3579 MOVII lastdive_maxdepth,mpr ; get max depth of last dive |
3580 rcall TFT_surface_lastdive_depth ; print depth | |
3581 | |
3582 ; average depth | |
623 | 3583 WIN_SMALL surf_gaslist_column+.48,surf_gaslist_row+(surf_gaslist_spacing*.3) |
634 | 3584 MOVII lastdive_avgdepth,mpr ; get avg depth of last dive |
3585 ;bra TFT_surface_lastdive_depth ; print depth and return | |
3586 | |
3587 ; Helper Function - print depth | |
3588 TFT_surface_lastdive_depth: | |
3589 TSTOSS opt_units ; 0=Meter, 1=Feet | |
3590 bra TFT_surface_lastdive_m ; 0 - metric | |
3591 ;bra TFT_surface_lastdive_ft ; 1 - imperial | |
3592 | |
3593 TFT_surface_lastdive_ft: | |
3594 call convert_cm_to_feet ; convert value in hi:lo from [cm] to [feet] | |
3595 output_999 ; print (0-999) | |
3596 STRCAT_TEXT tFeets1 ; "ft" | |
3597 PRINT ; dump to screen | |
3598 return ; done | |
3599 | |
3600 TFT_surface_lastdive_m: | |
3601 bsf omit_digit_1 ; do not print 1st digit | |
3602 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
3603 output_65535 ; print (0.0x-655.3x) | |
3604 STRCAT_TEXT tMeters ; "m" | |
3605 PRINT ; dump to screen | |
3606 return ; done | |
3607 | |
3608 | |
3609 ;----------------------------------------------------------------------------- | |
3610 ; Surface Custom View - OC Gas List | |
3611 ; | |
3612 global TFT_surf_cv_list_gas | |
3613 TFT_surf_cv_list_gas: | |
3614 clrf WREG ; do OC gases (0-4) | |
3615 ;bra TFT_surf_cv_list_gas_common ; continue with common part | |
3616 | |
3617 ; common list for OC gases and diluents | |
3618 TFT_surf_cv_list_gas_common: | |
3619 movwf gaslist_gas ; set first gas/dil to show | |
3620 FONT_COLOR_MEMO ; set color | |
3621 | |
3622 bsf short_gas_descriptions ; use short versions of gaslist_strcat_gas and gaslist_strcat_setpoint | |
3623 bcf better_gas_hint ; do not mark the best gas/diluent (to be used in dive mode only) | |
3624 | |
3625 ; Gas 1 | |
3626 WIN_SMALL surf_gaslist_column,surf_gaslist_row | |
3627 call gaslist_strcat_gas ; print gas description | |
3628 PRINT ; dump to screen | |
3629 | |
3630 ; Gas 2 | |
3631 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1) | |
3632 incf gaslist_gas,F ; select next gas/dil | |
3633 call gaslist_strcat_gas ; print gas description | |
3634 PRINT ; dump to screen | |
3635 | |
3636 ; Gas 3 | |
3637 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2) | |
3638 incf gaslist_gas,F ; select next gas/dil | |
3639 call gaslist_strcat_gas ; print gas description | |
3640 PRINT ; dump to screen | |
3641 | |
3642 ; Gas 4 | |
3643 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3) | |
3644 incf gaslist_gas,F ; select next gas/dil | |
3645 call gaslist_strcat_gas ; print gas description | |
3646 PRINT ; dump to screen | |
3647 | |
3648 ; Gas 5 | |
3649 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4) | |
3650 incf gaslist_gas,F ; select next gas/dil | |
3651 call gaslist_strcat_gas ; print gas description | |
3652 PRINT ; dump to screen | |
3653 | |
3654 return ; done | |
3655 | |
3656 | |
3657 ;----------------------------------------------------------------------------- | |
3658 ; Surface Custom View - Custom Text | |
3659 ; | |
3660 global TFT_surf_cv_text | |
3661 TFT_surf_cv_text: | |
3662 FONT_COLOR_MEMO ; set color | |
3663 | |
3664 ; 1st row | |
3665 WIN_SMALL surf_customtext_column,surf_customtext_row1 | |
3666 MOVRR opt_name+ .0,buffer,.12 ; copy 1st 12 chars to output buffer | |
3667 PRINT ; dump to screen | |
3668 | |
3669 ; 2nd row | |
3670 WIN_SMALL surf_customtext_column,surf_customtext_row2 | |
3671 MOVRR opt_name+.12,buffer,.12 ; copy 2nd 12 chars to output buffer | |
3672 PRINT ; dump to screen | |
3673 | |
3674 ; 3rd row | |
3675 WIN_SMALL surf_customtext_column,surf_customtext_row3 | |
3676 MOVRR opt_name+.24,buffer,.12 ; copy 3rd 12 chars to output buffer | |
3677 PRINT ; dump to screen | |
3678 | |
3679 ; 4th row | |
3680 WIN_SMALL surf_customtext_column,surf_customtext_row4 | |
3681 MOVRR opt_name+.36,buffer,.12 ; copy 4th 12 chars to output buffer | |
3682 PRINT ; dump to screen | |
3683 | |
3684 ; 5th row | |
3685 WIN_SMALL surf_customtext_column,surf_customtext_row5 | |
3686 MOVRR opt_name+.48,buffer,.12 ; copy 5th 12 chars to output buffer | |
3687 PRINT ; dump to screen | |
3688 | |
3689 return ; done | |
3690 | |
3691 | |
3692 ;----------------------------------------------------------------------------- | |
3693 ; Surface Custom View - Tissue Graphics | |
3694 ; | |
3695 global TFT_surf_cv_tissues | |
3696 TFT_surf_cv_tissues: | |
623 | 3697 |
3698 ; draw outer frame | |
3699 WIN_FRAME_STD surf_tissue_diagram_top, surf_tissue_diagram_bottom, surf_tissue_diagram_left, surf_tissue_diagram_right | |
3700 | |
634 | 3701 ; draw labels |
3702 FONT_COLOR_MEMO ; set color | |
582 | 3703 WIN_SMALL surf_tissue_N2_column,surf_tissue_N2_row |
623 | 3704 IFDEF _helium |
634 | 3705 btfss tissue_graphic_layout ; shall N2 and He? |
3706 bra TFT_surface_tissues_1 ; NO - print "Tissues" | |
3707 STRCPY_TEXT_PRINT tN2 ; YES - print "N2" | |
582 | 3708 WIN_SMALL surf_tissue_He_column,surf_tissue_He_row |
634 | 3709 STRCPY_TEXT_PRINT tHe ; - print "He" |
3710 bra TFT_surface_tissues_2 ; - continue with common part | |
623 | 3711 ENDIF |
631 | 3712 |
623 | 3713 TFT_surface_tissues_1: |
634 | 3714 STRCPY_TEXT_PRINT tDiveTissues ; print "Tissues" |
631 | 3715 |
623 | 3716 TFT_surface_tissues_2: |
634 | 3717 ; draw scale |
623 | 3718 |
3719 SCALELINE macro x | |
634 | 3720 movlw color_deepblue |
3721 WIN_FRAME_COLOR surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,surf_tissue_diagram_left+.4+x,surf_tissue_diagram_left+.4+x | |
623 | 3722 endm |
3723 | |
3724 SCALELINE .0 | |
3725 SCALELINE .8 | |
3726 SCALELINE .16 | |
3727 SCALELINE .24 | |
3728 SCALELINE .32 | |
3729 SCALELINE .40 | |
3730 SCALELINE .48 | |
3731 SCALELINE .56 | |
3732 SCALELINE .64 | |
3733 SCALELINE .72 | |
3734 SCALELINE .80 | |
3735 | |
634 | 3736 ; common initialization for tissue pressures and saturation |
0 | 3737 movlw .1 |
634 | 3738 movwf win_height ; hight of the bargraph (0-239) |
3739 movlw surf_tissue_diagram_left+.4 ; left start position for N2 bars | |
3740 movwf win_leftx2 ; column left (0-159) | |
3741 movlw surf_tissue_diagram_right-surf_tissue_diagram_left-.4 ; get max width for N2 bars (78 pixel) | |
3742 movwf win_width+0 ; set width of the bar box | |
3743 clrf win_width+1 ; ... | |
3744 movlw color_white ; color for tissues not exceeding surface max pressure | |
3745 movwf ex ; store in ex | |
3746 movlw color_red ; color for tissues exceeding surface max pressure | |
3747 movwf ul ; store in ul | |
3748 bcf aux_flag ; draw tissue pressures by default | |
3749 | |
3750 ; draw combined or N2 tissue pressures | |
3751 lfsr FSR2,char_O_tissue_pressure ; load base address of combined pressures by default | |
623 | 3752 IFDEF _helium |
634 | 3753 btfsc tissue_graphic_layout ; shall show N2+He ? |
3754 lfsr FSR2,char_O_tissue_pres_N2 ; YES - replace with base address of N2 pressures | |
623 | 3755 ENDIF |
631 | 3756 btfsc tissue_graphic_mode ; in logbook mode? |
3757 lfsr FSR2,header_buffer+index_tissue_pres_total ; YES - replace with base address from logbook | |
623 | 3758 movlw d'16' |
634 | 3759 movwf lo ; tissue counter, 16 tissues |
3760 clrf hi ; row counter | |
623 | 3761 TFT_surf_tissues_N2_loop: |
634 | 3762 movlw surf_tissue_diagram_top+.23 ; surface mode top start position N2 |
3763 rcall TFT_surf_tissues_bargraph ; show one tissue | |
3764 movlw .2 ; bargraph spacing | |
3765 addwf hi,F ; increment row counter | |
3766 decfsz lo,F ; decrement tissue counter, done? | |
3767 bra TFT_surf_tissues_N2_loop ; NO - loop | |
623 | 3768 IFDEF _helium |
634 | 3769 btfsc tissue_graphic_layout ; shall show N2+He ? |
3770 bra TFT_surface_tissues_3 ; YES - show He tissue pressures | |
623 | 3771 ENDIF |
3772 | |
634 | 3773 ; draw tissue saturations |
623 | 3774 lfsr FSR2,char_O_tissue_saturation ; load base address of tissue supersaturation |
631 | 3775 btfsc tissue_graphic_mode ; in logbook mode? |
3776 lfsr FSR2,header_buffer+index_tissue_supersat ; YES - replace with base address from logbook | |
0 | 3777 movlw d'16' |
634 | 3778 movwf lo ; tissue counter, 16 tissues |
3779 clrf hi ; row counter | |
3780 movlw color_grey ; color for tissue saturation | |
3781 movwf ex ; store in ex | |
3782 ; movlw color_yellow ; 2nd color is not used by tissue saturation | |
3783 ; movwf ul ; ... | |
3784 bsf aux_flag ; draw tissue saturation | |
623 | 3785 TFT_surf_tissues_sat_loop: |
634 | 3786 movlw surf_tissue_diagram_top+.23+.57 ; surface mode top start position saturations |
3787 rcall TFT_surf_tissues_bargraph ; draw tissue bargraph | |
3788 movlw .2 ; bargraph spacing | |
3789 addwf hi,F ; increment row counter | |
3790 decfsz lo,F ; decrement tissue counter, done? | |
3791 bra TFT_surf_tissues_sat_loop ; NO - loop | |
3792 | |
3793 ; common part for vertical lines | |
3794 movlw surf_tissue_diagram_top+.23+.57 ; get top position | |
3795 movwf win_top ; set top position (0-239) | |
3796 movlw .30 ; get hight | |
3797 movwf win_height ; set height | |
3798 movlw .1 ; get width | |
3799 movwf win_width+0 ; set width, low byte | |
3800 clrf win_width+1 ; set width, high byte | |
3801 | |
3802 ; print 100% line | |
3803 movlw surf_tissue_diagram_left+.4+.64 ; get left position | |
3804 movwf win_leftx2 ; set left position (0-159) | |
3805 movlw color_red ; color for 100% line | |
3806 BOX_COLOR ; draw the line | |
623 | 3807 |
3808 ; GF factors enabled? | |
634 | 3809 btfss tissue_graphic_gf ; GF factors enabled? |
3810 bra TFT_surface_tissues_4 ; NO - continue with CNS | |
3811 | |
3812 ; print GF low line | |
3813 movlw surf_tissue_diagram_left+.4 ; get left base position | |
3814 movwf win_leftx2 ; set left base position (0-159) | |
3815 movff opt_GF_low,WREG ; get GF low in 0.01 % | |
3816 btfsc tissue_graphic_mode ; in logbook mode? | |
3817 movff header_buffer+index_gf_lo_hi+0,WREG ; YES - replace by GF low from logbook | |
3818 mullw .164 ; multiply with 164 | |
3819 movf PRODH,W ; divide by 256 -> resulting scale factor is 164/256 = 0.640625 | |
3820 addwf win_leftx2,F ; add to base position | |
3821 movlw color_green ; color for GF low line | |
3822 BOX_COLOR ; draw the line | |
3823 | |
3824 ; print GF high line | |
3825 movlw surf_tissue_diagram_left+.4 ; get left base position | |
3826 movwf win_leftx2 ; set left base position (0-159) | |
3827 movff opt_GF_high,WREG ; get GF high in 0.01 % | |
3828 btfsc tissue_graphic_mode ; in logbook mode? | |
3829 movff header_buffer+index_gf_lo_hi+1,WREG ; YES - replace by GF high from logbook | |
3830 mullw .164 ; multiply with 164 | |
3831 movf PRODH,W ; divide by 256 -> resulting scale factor is 164/256 = 0.640625 | |
3832 addwf win_leftx2,F ; add to base position | |
3833 movlw color_yellow ; color for GF high line | |
3834 BOX_COLOR ; draw the line | |
3835 bra TFT_surface_tissues_4 ; continue with CNS | |
623 | 3836 |
3837 IFDEF _helium | |
3838 TFT_surface_tissues_3: | |
634 | 3839 ; draw He tissue pressures |
3840 movlw surf_tissue_diagram_left+.4+.16 ; start position for He bars | |
3841 movwf win_leftx2 ; column left (0-159) | |
3842 movlw surf_tissue_diagram_right-surf_tissue_diagram_left-.4-.16 ; max width for He bars | |
3843 movwf win_width+0 ; set total width of the bar box | |
3844 clrf win_width+1 ; ... | |
3845 lfsr FSR2,char_O_tissue_pres_He ; load base address of He pressures | |
0 | 3846 movlw d'16' |
634 | 3847 movwf lo ; tissue counter, 16 tissues |
3848 clrf hi ; row counter | |
623 | 3849 TFT_surf_tissues_He_loop: |
634 | 3850 movlw surf_tissue_diagram_top+.23+.57 ; surface mode top start position He |
3851 rcall TFT_surf_tissues_bargraph ; show one tissue | |
3852 movlw .2 ; bargraph spacing | |
3853 addwf hi,F ; increment row counter | |
3854 decfsz lo,F ; decrement tissue counter, done? | |
3855 bra TFT_surf_tissues_He_loop ; NO - loop | |
623 | 3856 ENDIF |
3857 | |
3858 TFT_surface_tissues_4: | |
634 | 3859 btfss tissue_graphic_cns ; shall show CNS value? |
3860 return ; NO - done | |
3861 | |
3862 ; draw CNS% in-between tissue bars | |
3863 WIN_SMALL surf_tissue_He_column+.22,surf_tissue_He_row | |
3864 MOVII int_O_CNS_current,mpr ; get current CNS | |
3865 call TFT_color_code_cns ; color-code CNS value | |
3866 STRCPY_TEXT tCNS2 ; "CNS: " | |
3867 bsf leftbind ; print left-aligned | |
3868 output_999 ; print (0-999) | |
3869 PUTC_PRINT "%" ; append unit and dump to screen | |
3870 return ; done | |
3871 | |
3872 | |
3873 ; Helper Function - draw a bargraph | |
623 | 3874 TFT_surf_tissues_bargraph: |
634 | 3875 addwf hi,W ; add row number to start position |
3876 movwf win_top ; set as row top (0-239) | |
3877 movff POSTINC2,up ; get tissue value | |
3878 movf ex,W ; default color | |
3879 btfsc up,7 ; check if flag in bit 7 is set | |
3880 movf ul,W ; YES - switch to 2nd color | |
3881 bcf up,7 ; clear flag bit | |
3882 btfss aux_flag ; drawing saturations? | |
3883 rlncf up,F ; NO - multiply with 2 (previously cleared bit 7 will be rotated to bit 0) | |
3884 movff up,win_bargraph ; set length of the bargraph | |
3885 incf win_bargraph,F ; add 1 for a minimum visible bar (He-bars could be invisible else-wise) | |
3886 BOX_COLOR ; draw bargraph with color in WREG | |
3887 return ; done | |
3888 | |
3889 | |
3890 ;----------------------------------------------------------------------------- | |
3891 ; Surface Custom View - Tissue Graphics | |
631 | 3892 ; |
634 | 3893 global TFT_surf_cv_settings |
3894 TFT_surf_cv_settings: | |
3895 ; Deco Mode | |
3896 FONT_COLOR_MEMO ; select color | |
3897 WIN_SMALL surf_gaslist_column,surf_gaslist_row | |
3898 STRCAT_PRINT "ZH-L16" ; print fix part of model | |
3899 movff char_I_model,WREG ; get model | |
3900 iorwf WREG ; GF enabled? | |
3901 bnz TFT_surface_decosettings1 ; YES | |
3902 ;bra TFT_surface_decosettings0 ; NO | |
3903 | |
3904 TFT_surface_decosettings0: | |
3905 ; Display ZH-L16 sat/desat model | |
3906 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1) | |
3907 STRCPY_TEXT tSD ; print label (S/D) | |
3908 movff char_I_saturation_multiplier, lo ; get sat mult. | |
3909 movff char_I_desaturation_multiplier,hi ; get desat mult. | |
3910 bra TFT_surface_decosettings_com ; continue with common part | |
3911 | |
3912 TFT_surface_decosettings1: | |
3913 ; Display ZH-L16-GF low/high model | |
3914 WIN_SMALL surf_gaslist_column+.43,surf_gaslist_row | |
3915 STRCPY_TEXT_PRINT tZHL16GF ; print GF label behind deco model label | |
3916 | |
3917 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1) | |
3918 STRCPY_TEXT tGF ; print label (GF:) | |
3919 PUTC ' ' ; print a space | |
3920 movff opt_GF_low, lo ; get GF low | |
3921 movff opt_GF_high,hi ; get GF high | |
3922 ;bra TFT_surface_decosettings_com ; continue with common part | |
3923 | |
3924 TFT_surface_decosettings_com: | |
3925 ; percentage pair | |
3926 output_256 ; print (0-255) | |
3927 STRCAT "%/" ; print "%/" | |
3928 movff hi,lo ; get 2nd value | |
3929 output_256 ; print (0-255) | |
3930 PUTC_PRINT "%" ; append unit and dump to screen | |
3931 | |
3932 ; fTTS | |
3933 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2) | |
3934 STRCPY_TEXT tFTTSSurf ; print label | |
3935 movff char_I_extra_time,lo ; get time | |
3936 output_9 ; print time (0-9) | |
3937 STRCAT_TEXT_PRINT tMinutes ; append unit and dump to screen | |
3938 | |
3939 ; Last Stop | |
3940 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3) | |
3941 STRCPY_TEXT tLastDecostopSurf ; print label | |
3942 movff opt_last_stop,lo ; get depth | |
3943 output_9 ; print depth (0-9) | |
3944 STRCAT_TEXT_PRINT tMeters ; append unit and dump to screen | |
3945 | |
3946 ; Salinity | |
3947 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4) | |
3948 STRCPY_TEXT tDvSalinitySurf ; print label | |
3949 movff opt_salinity,lo ; get salinity | |
3950 output_9 ; print salinity (0-9) | |
3951 STRCAT_TEXT_PRINT tPercent ; append unit and dump to screen | |
3952 | |
3953 return ; done | |
3954 | |
604 | 3955 |
3956 IFDEF _rx_functions | |
3957 | |
634 | 3958 ;----------------------------------------------------------------------------- |
3959 ; Surface Custom View - TR - Tank Data | |
3960 ; | |
3961 global TFT_surf_cv_tankdata | |
3962 TFT_surf_cv_tankdata: | |
3963 lfsr FSR1,rx_buffer ; load base address of RX buffer | |
3964 | |
3965 IFNDEF _rx_functions_debug | |
3966 | |
604 | 3967 WIN_SMALL surf_customtext_column,surf_customtext_row1 |
3968 rcall TFT_surface_tankdata_print | |
3969 WIN_SMALL surf_customtext_column,surf_customtext_row2 | |
3970 rcall TFT_surface_tankdata_print | |
3971 WIN_SMALL surf_customtext_column,surf_customtext_row3 | |
3972 rcall TFT_surface_tankdata_print | |
3973 WIN_SMALL surf_customtext_column,surf_customtext_row4 | |
3974 rcall TFT_surface_tankdata_print | |
3975 WIN_SMALL surf_customtext_column,surf_customtext_row5 | |
3976 rcall TFT_surface_tankdata_print | |
634 | 3977 |
3978 return ; done | |
3979 | |
3980 | |
3981 ; Helper Function - print transmitter data (max 12 char) | |
3982 TFT_surface_tankdata_print: | |
3983 FONT_COLOR_MEMO ; set color | |
3984 movff POSTINC1,hi ; get ID high (+0) | |
3985 movff POSTINC1,lo ; get ID low (+1) | |
3986 tstfsz hi ; ID high = 0 ? | |
3987 bra TFT_surface_tankdata_print_1; NO - slot in use | |
3988 tstfsz lo ; ID low = 0? | |
3989 bra TFT_surface_tankdata_print_1; NO - slot in use | |
3990 STRCAT_PRINT "---- " ; YES - mark as unused and clear rest of line from previous remains | |
3991 movf POSTINC1,W ; - dummy read (+2) to advance index | |
3992 movf POSTINC1,W ; - dummy read (+3) to advance index | |
3993 movf POSTINC1,W ; - dummy read (+4) to advance index | |
3994 bra TFT_surface_tankdata_print_3; - one more dummy read and return | |
3995 | |
604 | 3996 TFT_surface_tankdata_print_1: |
634 | 3997 movf hi,W ; copy ID high to WREG |
3998 output_hex ; print as hex 2 chars | |
3999 movf lo,W ; copy ID low to WREG | |
4000 output_hex ; print as hex 2 chars (4 in total) | |
4001 movff POSTINC1,hi ; get pressure high (+2) | |
4002 movff POSTINC1,lo ; get pressure low (+3) | |
4003 call TFT_color_code_pres_sac ; needed to clear the status flags before output | |
4004 bsf omit_digit_1 ; do not print 1st digit (0.1 bar) | |
4005 output_65535 ; print (0x-6553x) 4 chars (8 in total) | |
4006 PUTC " " ; 1 char (9 in total) | |
4007 movf POSTINC1,W ; get status (+4) | |
4008 andlw .7 ; mask out battery voltage | |
4009 bnz TFT_surface_tankdata_2 ; branch if battery is not completely drained | |
4010 FONT_COLOR_WARNING ; output in red | |
4011 STRCAT_PRINT "XXX" ; "XXX" for low | |
4012 bra TFT_surface_tankdata_print_3; one more dummy read and return | |
4013 | |
604 | 4014 TFT_surface_tankdata_2: |
634 | 4015 addlw .28 ; add offset of 2.8 Volt |
4016 movff WREG,lo ; copy to lo | |
4017 bsf decimal_digit1 ; put a decimal point in front of digit 1 | |
4018 output_99 ; print voltage 2 chars (11 in total) | |
4019 PUTC_PRINT " " ; dummy char 1 char (12 in total) | |
4020 | |
604 | 4021 TFT_surface_tankdata_print_3: |
634 | 4022 movf POSTINC1,W ; dummy read (+5) to advance index |
4023 return ; done | |
4024 | |
4025 ELSE ; _rx_functions_debug | |
4026 | |
4027 TFT_surface_tankdata_debug: ; surface custom view debug output | |
4028 FONT_COLOR_MEMO ; set color | |
4029 WIN_TINY surf_customtext_column,surf_customtext_row1+.14*0 | |
4030 rcall TFT_surface_tankdata_debug_print | |
4031 WIN_TINY surf_customtext_column,surf_customtext_row1+.14*1 | |
4032 rcall TFT_surface_tankdata_debug_print | |
4033 WIN_TINY surf_customtext_column,surf_customtext_row1+.14*2 | |
4034 rcall TFT_surface_tankdata_debug_print | |
4035 WIN_TINY surf_customtext_column,surf_customtext_row1+.14*3 | |
4036 rcall TFT_surface_tankdata_debug_print | |
4037 WIN_TINY surf_customtext_column,surf_customtext_row1+.14*4 | |
4038 rcall TFT_surface_tankdata_debug_print | |
4039 WIN_TINY surf_customtext_column,surf_customtext_row1+.14*5 | |
4040 rcall TFT_surface_tankdata_debug_print | |
4041 WIN_TINY surf_customtext_column,surf_customtext_row1+.14*6 | |
4042 rcall TFT_surface_tankdata_debug_print | |
4043 WIN_TINY surf_customtext_column,surf_customtext_row1+.14*7 | |
4044 rcall TFT_surface_tankdata_debug_print | |
4045 return ; done | |
4046 | |
4047 TFT_surface_tankdata_debug_print: | |
4048 movff POSTINC1,hi ; read ID high (+0) | |
4049 output_hex ; print as hex | |
4050 movff POSTINC1,lo ; read ID low (+1) | |
4051 output_hex ; print as hex | |
4052 PUTC "," ; print "," | |
4053 movff POSTINC1,hi ; read pressure high (+2) | |
4054 movff POSTINC1,lo ; read pressure low (+3) | |
4055 call TFT_color_code_pres_sac ; needed to clear the status flags before output | |
4056 bsf decimal_digit1 ; place a decimal point in front of digit 1 | |
4057 output_9999 ; print pressure (0.0-999.9) | |
4058 PUTC "," ; print "," | |
4059 movff POSTINC1,lo ; read status (+4) | |
4060 output_hex ; print as hex | |
4061 PUTC "," ; print "," | |
4062 movff POSTINC1,lo ; read date (+5) | |
4063 output_256 ; print (0-255) | |
4064 PRINT ; dump to screen | |
4065 return ; done | |
4066 | |
4067 ENDIF ; _rx_functions_debug | |
623 | 4068 ENDIF ; _rx_functions |
604 | 4069 |
634 | 4070 IFDEF _compass |
4071 | |
4072 ;----------------------------------------------------------------------------- | |
4073 ; Surface Custom View - Compass - "set Bearing Dialog" | |
4074 ; | |
4075 global TFT_surf_cv_compass_bearing | |
4076 TFT_surf_cv_compass_bearing: | |
4077 btfsc compass_menu ; is the "set bearing" selection shown? | |
4078 return ; YES - done | |
4079 bsf compass_menu ; NO - set "set bearing" selection as shown | |
4080 WIN_BOX_BLACK surf_compass_bear_row,surf_warning1_row-1, surf_compass_bear_column, surf_decotype_column-.1 ; top, bottom, left, right | |
4081 WIN_SMALL surf_compass_bear_column,surf_compass_bear_row | |
4082 FONT_COLOR color_yellow ; set color | |
4083 bsf win_invert ; print inverse | |
4084 STRCPY_TEXT_PRINT tSetHeading ; 7 chars | |
4085 return ; done | |
4086 | |
4087 ENDIF ; _compass | |
4088 | |
4089 IFDEF _ccr_pscr | |
4090 | |
4091 ;----------------------------------------------------------------------------- | |
4092 ; Surface Custom View - Diluent List | |
4093 ; | |
4094 global TFT_surf_cv_list_dil | |
4095 TFT_surf_cv_list_dil: | |
4096 movlw .5 ; do diluents (5-9) | |
4097 bra TFT_surf_cv_list_gas_common ; continue with common part | |
4098 | |
4099 | |
4100 ;----------------------------------------------------------------------------- | |
4101 ; Surface Custom View - Setpoint List | |
4102 ; | |
4103 global TFT_surf_cv_list_sp ; show setpoint list | |
4104 TFT_surf_cv_list_sp: | |
4105 FONT_COLOR_MEMO ; set color | |
4106 bsf short_gas_descriptions ; use short versions of gaslist_strcat_gas_PRODL and gaslist_strcat_setpoint | |
4107 bcf better_gas_hint ; do not mark the best gas/diluent (to be used in dive mode only) | |
4108 | |
4109 ;SP 1 | |
4110 WIN_SMALL surf_gaslist_column,surf_gaslist_row | |
4111 clrf gaslist_gas ; select SP 1 | |
4112 call gaslist_strcat_setpoint ; show setpoint data | |
4113 PRINT ; dump to screen | |
4114 | |
4115 ;SP 2 | |
4116 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1) | |
4117 incf gaslist_gas,F ; select next SP | |
4118 call gaslist_strcat_setpoint ; show SP#+1 of PRODL# | |
4119 PRINT ; dump to screen | |
4120 | |
4121 ;SP 3 | |
4122 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2) | |
4123 incf gaslist_gas,F ; select next SP | |
4124 call gaslist_strcat_setpoint ; show SP#+1 of PRODL# | |
4125 PRINT ; dump to screen | |
4126 | |
4127 ;SP 4 | |
4128 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3) | |
4129 incf gaslist_gas,F ; select next SP | |
4130 call gaslist_strcat_setpoint ; show SP#+1 of PRODL# | |
4131 PRINT ; dump to screen | |
4132 | |
4133 ;SP 5 | |
4134 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4) | |
4135 incf gaslist_gas,F ; select next SP | |
4136 call gaslist_strcat_setpoint ; show SP#+1 of PRODL# | |
4137 PRINT ; dump to screen | |
4138 | |
4139 return ; done | |
4140 | |
4141 ENDIF ; _ccr_pscr | |
4142 | |
4143 | |
631 | 4144 ;============================================================================= |
634 | 4145 tft_out14 CODE |
4146 ;============================================================================= | |
4147 | |
4148 | |
4149 ;----------------------------------------------------------------------------- | |
4150 ; Dive Custom View - AVR / Stopwatch - Mask | |
4151 ; | |
4152 global TFT_avr_stopwatch_mask | |
4153 TFT_avr_stopwatch_mask: | |
4154 FONT_COLOR_MASK ; select color | |
4155 | |
4156 IFNDEF _min_depth_option | |
4157 | |
4158 WIN_TINY dm_custom_avr_stop_column1+.2,dm_custom_avr_stop_title_row | |
4159 TSTOSS opt_2ndDepthDisp ; show avg depth instead of max depth in main screen? | |
4160 bra TFT_avr_stopwatch_mask_1 ; NO - draw avg depth in custom view then | |
4161 btfss alt_layout_active ; YES - in alternative layout? | |
4162 bra TFT_avr_stopwatch_mask_max ; NO - show max depth | |
4163 ;bra TFT_avr_stopwatch_mask_avg ; YES - show avg depth | |
4164 | |
4165 TFT_avr_stopwatch_mask_avg: | |
4166 STRCPY_TEXT_PRINT tDiveTotalAvg ; mask for average depth | |
4167 bra TFT_avr_stopwatch_mask_2 ; continue | |
4168 | |
4169 TFT_avr_stopwatch_mask_1: | |
4170 btfss alt_layout_active ; YES - in alternative layout? | |
4171 bra TFT_avr_stopwatch_mask_avg ; NO - show avg depth | |
4172 ;bra TFT_avr_stopwatch_mask_max ; YES - show max depth | |
4173 | |
4174 TFT_avr_stopwatch_mask_max: | |
4175 STRCPY_TEXT_PRINT tMaxDepth ; mask for maximum depth | |
4176 ;bra TFT_avr_stopwatch_mask_2 ; continue | |
4177 | |
4178 TFT_avr_stopwatch_mask_2: | |
4179 WIN_TINY dm_custom_avr_stop_column2+.3,dm_custom_avr_stop_title_row | |
4180 STRCPY_TEXT_PRINT tDiveStopwatch ; print label | |
4181 | |
4182 WIN_TINY dm_custom_avr_stop_column3-.8,dm_custom_avr_stop_title_row | |
4183 STRCPY_TEXT_PRINT tDiveStopAvg ; print label | |
4184 | |
4185 return ; done | |
4186 | |
4187 ELSE | |
4188 | |
4189 WIN_TINY dm_custom_avr_stop_column1+.2,dm_custom_avr_stop_title_row | |
4190 STRCPY_PRINT "Max.Depth" ; print label | |
4191 | |
4192 WIN_TINY dm_custom_avr_stop_column2+.3,dm_custom_avr_stop_title_row | |
4193 STRCPY_PRINT "Avg.Depth" ; print label | |
4194 | |
4195 WIN_TINY dm_custom_avr_stop_column3-.8,dm_custom_avr_stop_title_row | |
4196 STRCPY_PRINT "Min.Depth" ; print label | |
4197 | |
4198 return ; done | |
4199 | |
4200 ENDIF | |
4201 | |
4202 | |
4203 ;----------------------------------------------------------------------------- | |
4204 ; Dive Custom View - AVR / Stopwatch - Data | |
4205 ; | |
4206 global TFT_avr_stopwatch | |
4207 TFT_avr_stopwatch: | |
4208 FONT_COLOR_MEMO ; select color | |
4209 | |
4210 IFNDEF _min_depth_option | |
4211 | |
4212 ; total average depth or max depth | |
4213 WIN_MEDIUM dm_custom_avr_stop_column1,dm_custom_avr_stop_row | |
4214 TSTOSS opt_2ndDepthDisp ; show average depth instead of maximum depth in main screen? | |
4215 bra TFT_avr_stopwatch_1 ; NO - draw avg depth in custom view then | |
4216 btfsc alt_layout_active ; YES - in alternative layout? | |
4217 bra TFT_avr_stopwatch_avg ; YES - show avg depth | |
4218 bra TFT_avr_stopwatch_max ; NO - show max depth | |
4219 | |
4220 TFT_avr_stopwatch_1: | |
4221 btfsc alt_layout_active ; YES - in alternative layout? | |
4222 bra TFT_avr_stopwatch_max ; YES - show max depth | |
4223 ;bra TFT_avr_stopwatch_avg ; NO - show avg depth | |
4224 | |
4225 TFT_avr_stopwatch_avg: | |
4226 MOVII pressure_rel_avg_total,mpr ; get total dive average pressure into hi:lo | |
4227 bra TFT_avr_stopwatch_2 ; continue | |
4228 | |
4229 TFT_avr_stopwatch_max: | |
4230 MOVII pressure_rel_max_cached,mpr ; get maximum pressure into hi:lo | |
4231 ;bra TFT_avr_stopwatch_2 ; continue | |
4232 | |
4233 TFT_avr_stopwatch_2: | |
4234 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] | |
4235 TSTOSS opt_units ; 0=m, 1=ft | |
4236 bra TFT_update_avr_stopwatch1_metric; 0 - metric | |
4237 ;bra TFT_update_avr_stopwatch1_imp ; 1 - imperial | |
4238 | |
4239 TFT_update_avr_stopwatch1_imp: | |
4240 call convert_cm_to_feet ; convert value in hi:lo from [cm] to [feet] | |
4241 output_999 ; print (0-999) | |
4242 PRINT ; dump to screen | |
4243 bra TFT_update_avr_stopwatch2 ; continue | |
4244 | |
4245 TFT_update_avr_stopwatch1_metric: | |
4246 rcall TFT_update_avr_stopwatch_metric ; print metric depth | |
4247 ;bra TFT_update_avr_stopwatch2 ; continue | |
4248 | |
4249 TFT_update_avr_stopwatch2: | |
4250 ; stopped average depth | |
4251 WIN_MEDIUM dm_custom_avr_stop_column3,dm_custom_avr_stop_row | |
4252 MOVII pressure_rel_avg_trip,mpr ; get the resettable average pressure | |
4253 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] | |
4254 TSTOSS opt_units ; 0=m, 1=ft | |
4255 bra TFT_update_avr_stopwatch2_metric; 0 - metric | |
4256 ;bra TFT_update_avr_stopwatch2_imp ; 1 - imperial | |
4257 | |
4258 TFT_update_avr_stopwatch2_imp: | |
4259 call convert_cm_to_feet ; convert value in hi:lo from [cm] to [feet] | |
4260 output_999 ; print (0-999) | |
4261 PRINT ; dump to screen | |
4262 bra TFT_update_avr_stopwatch3 ; continue | |
4263 | |
4264 TFT_update_avr_stopwatch2_metric: | |
4265 rcall TFT_update_avr_stopwatch_metric ; print metric depth | |
4266 bra TFT_update_avr_stopwatch3 ; continue | |
4267 | |
4268 | |
4269 ; Helper Function - print metric depth | |
4270 TFT_update_avr_stopwatch_metric: | |
4271 bsf leftbind ; print left-aligned | |
4272 bsf omit_digit_1 ; do not print 1st digit (no cm) | |
4273 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
4274 output_65535 ; print (0.0x-655.3x) | |
4275 PUTC " " ; wipe out remains from last output | |
4276 clrf WREG | |
4277 movff WREG,buffer+.4 ; limit string length to 4 = 3 digits + 1 half-size decimal dot | |
4278 PRINT ; dump to screen | |
4279 return ; done | |
4280 | |
4281 ELSE | |
4282 | |
4283 ; resettable maximum depth - needs ISR-safe copy! | |
4284 WIN_MEDIUM dm_custom_avr_stop_column1,dm_custom_avr_stop_row | |
4285 FONT_COLOR_MEMO ; select color | |
4286 SMOVII pressure_rel_max_trip,mpr ; get resettable maximum pressure | |
4287 rcall TFT_avr_stopwatch_helper ; print depth | |
4288 | |
4289 ; resettable average depth | |
4290 WIN_MEDIUM dm_custom_avr_stop_column2-.1,dm_custom_avr_stop_row | |
4291 FONT_COLOR_ATTENTION ; select color | |
4292 MOVII pressure_rel_avg_trip,mpr ; get resettable average pressure | |
4293 rcall TFT_avr_stopwatch_helper ; print depth | |
4294 | |
4295 ; resettable minimum depth - needs ISR safe copy! | |
4296 WIN_MEDIUM dm_custom_avr_stop_column3-.12,dm_custom_avr_stop_row | |
4297 FONT_COLOR_MEMO ; select color | |
4298 SMOVII pressure_rel_min_trip,mpr ; get resettable minimum pressure | |
4299 rcall TFT_avr_stopwatch_helper ; print depth | |
4300 | |
4301 return ; done | |
4302 | |
4303 TFT_avr_stopwatch_helper: | |
4304 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] | |
4305 bsf leftbind ; print left-aligned | |
4306 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
4307 output_65535 ; print (0.00-655.35) | |
4308 PUTC " " ; wipe out remains from last output | |
4309 clrf WREG ; load string terminator | |
4310 movff WREG,buffer+.5 ; limit string length to 5 = 4 digits + 1 half-size decimal dot | |
4311 PRINT ; dump to screen | |
4312 return ; done | |
4313 | |
4314 ENDIF | |
4315 | |
4316 TFT_update_avr_stopwatch3: | |
4317 WIN_MEDIUM dm_custom_avr_stop_column2,dm_custom_avr_stop_row | |
4318 ;bra TFT_update_stopwatch ; continue | |
4319 | |
4320 TFT_update_stopwatch: | |
4321 ; jump-in point for stopped dive time in compass custom view | |
4322 MOVII divesecs_avg_trip,mpr ; get the resettable dive time (stopwatch) | |
4323 call convert_time ; convert hi:lo in seconds to minutes (up:hi) and seconds (lo) | |
4324 movlw .100 ; display layout will change if minutes become >= 100 | |
4325 cpfslt hi ; minutes < 100 ? | |
4326 bra TFT_update_stopwatch_1 ; NO - display hours:minutes | |
4327 bcf aux_flag ; YES - will print minutes : seconds | |
4328 bra TFT_update_stopwatch_2 ; - continue | |
4329 | |
4330 TFT_update_stopwatch_1: | |
4331 movff hi,lo ; transfer minutes (low byte) to lo | |
4332 movff up,hi ; transfer minutes (high byte) to hi | |
4333 call convert_time ; convert hi:lo in minutes to hours (up:hi) and minutes (lo) | |
4334 bsf aux_flag ; will print hours : minutes | |
4335 | |
4336 TFT_update_stopwatch_2: | |
4337 movf hi,W ; exchange lo and hi | |
4338 movff lo,hi ; ... | |
4339 movwf lo ; ... | |
4340 output_99 ; print minutes or hours (0 - 99) | |
4341 movlw ":" ; load standard separator | |
4342 btfsc aux_flag ; will print hours : minutes ? | |
4343 movlw "'" ; YES - swap to alternative separator | |
4344 movwf POSTINC2 ; print separator | |
4345 movff hi,lo ; restore lo | |
4346 output_99x ; print seconds or minutes (00-99) | |
4347 movlw .5 ; set target length | |
4348 call TFT_buffer_trim_length ; fill / cut buffer to target length | |
4349 PRINT ; dump to screen | |
4350 return ; done | |
4351 | |
4352 | |
4353 ;----------------------------------------------------------------------------- | |
4354 ; Dive Custom View - Gas Needs - Mask | |
4355 ; | |
4356 global TFT_gas_needs_mask | |
4357 TFT_gas_needs_mask: | |
4358 WIN_TINY dm_custom_gas_column_title, dm_custom_gas_mask_row | |
4359 FONT_COLOR_MASK ; select color | |
4360 | |
4361 IFDEF _cave_mode | |
4362 | |
4363 movff char_O_deco_info,WREG ; get the deco info vector | |
4364 btfss WREG,gas_needs_cave ; are the gas needs calculated for cave mode? | |
4365 bra TFT_gas_needs_mask_ascent_1 ; NO - show as direct ascent needs | |
4366 ;bra TFT_gas_needs_mask_ascent_0 ; YES - show as cave return needs | |
4367 | |
4368 TFT_gas_needs_mask_ascent_0: | |
4369 bsf gas_needs_mode_last ; remember last results were for cave mode | |
4370 STRCPY_TEXT tGasNeedsCaveMode ; print "Gas Needs Cave Mode" | |
4371 bra TFT_gas_needs_mask_ascent_2 ; continue | |
4372 | |
4373 TFT_gas_needs_mask_ascent_1: | |
4374 bcf gas_needs_mode_last ; remember last results were for direct ascent | |
4375 STRCPY_TEXT tGasNeedsAscent ; "Gas Needs Ascent" | |
4376 ;bra TFT_gas_needs_mask_ascent_2 ; continue | |
4377 | |
4378 ELSE | |
4379 | |
4380 STRCPY_TEXT tGasNeedsAscent ; "Gas Needs Ascent" | |
4381 | |
4382 ENDIF | |
4383 | |
4384 TFT_gas_needs_mask_ascent_2: | |
4385 TSTOSS char_I_extra_time ; fTTS enabled? | |
4386 bra TFT_gas_needs_mask_ascent_3 ; NO - continue | |
4387 STRCAT " fTTS" ; YES - append fTTS marking | |
4388 TFT_gas_needs_mask_ascent_3: | |
4389 STRCAT_PRINT " (bar)" ; append " (bar)" and dump buffer to screen | |
4390 return ; done | |
4391 | |
4392 | |
4393 ;----------------------------------------------------------------------------- | |
4394 ; Dive Custom View - Gas Needs - Data | |
4395 ; | |
4396 ; LIMITATION: there is only space for 4 gases on the screen - if 5 gases | |
4397 ; have a pres_need > 0, then only the first 4 will be shown! | |
4398 ; | |
4399 global TFT_gas_needs | |
4400 TFT_gas_needs: | |
4401 | |
4402 IFDEF _cave_mode | |
4403 | |
4404 movff char_O_deco_info,WREG ; get deco info vector | |
4405 btfss WREG,gas_needs_cave ; are the gas needs calculated for cave mode? | |
4406 bra TFT_gas_needs_ascent_1 ; NO - continue below... | |
4407 btfsc gas_needs_mode_last ; YES - were the last results calculated for cave mode? | |
4408 bra TFT_gas_needs_ascent_3 ; YES - mask still valid | |
4409 bra TFT_gas_needs_ascent_2 ; NO - redraw mask | |
4410 | |
4411 TFT_gas_needs_ascent_1: | |
4412 btfss gas_needs_mode_last ; NO - were the last results calculated for direct ascent? | |
4413 bra TFT_gas_needs_ascent_3 ; YES - mask still valid | |
4414 ;bra TFT_gas_needs_ascent_2 ; NO - redraw mask | |
4415 | |
4416 TFT_gas_needs_ascent_2: | |
4417 rcall TFT_gas_needs_mask ; redraw mask | |
4418 ;bra TFT_gas_needs_ascent_3 ; continue | |
4419 | |
4420 ENDIF | |
4421 | |
4422 TFT_gas_needs_ascent_3: | |
4423 clrf up ; initialize gas index (0-4) | |
4424 WIN_SMALL dm_custom_gas_column1+.5,dm_custom_gas_row1 ; set position | |
4425 rcall TFT_gas_needs_helper ; print need | |
4426 WIN_SMALL dm_custom_gas_column1+.5,dm_custom_gas_row2 ; set position | |
4427 rcall TFT_gas_needs_helper ; print need | |
4428 WIN_SMALL dm_custom_gas_column2+.5,dm_custom_gas_row1 ; set position | |
4429 rcall TFT_gas_needs_helper ; print need | |
4430 WIN_SMALL dm_custom_gas_column2+.5,dm_custom_gas_row2 ; set position | |
4431 rcall TFT_gas_needs_helper ; print need | |
4432 return ; done | |
4433 | |
4434 | |
4435 ; Helper Function - print need for next gas | |
4436 TFT_gas_needs_helper: | |
4437 FONT_COLOR_MEMO ; select default color | |
4438 movlw .5 ; total number of gases | |
4439 cpfslt up ; check if all gases have been processed | |
4440 bra TFT_gas_needs_helper_1 ; YES - clear display area | |
4441 movf up,W ; NO - get gas number and check if need of that gas is > 0 | |
4442 rlncf WREG,W ; - multiply by 2 | |
4443 incf WREG,W ; - add 1 to address high byte | |
4444 lfsr FSR1,int_O_gas_need_pres ; - load base of gas needs in pressure | |
4445 movff PLUSW1,hi ; - read HIGH(int_O_gas_need_pres[up]) | |
4446 btfss hi,int_is_zero ; - check flag for pres_need == 0 | |
4447 bra TFT_gas_needs_helper_2 ; NO - print gas type and pressure needed | |
4448 incf up,F ; YES - increment to next gas | |
4449 bra TFT_gas_needs_helper ; - loop and try the next gas | |
4450 | |
4451 TFT_gas_needs_helper_1: | |
4452 ; no gases to show anymore, clear display area from potential remains of last invocation | |
4453 STRCAT_PRINT " ---- " ; overwrite outdated stuff if screen position is not needed | |
4454 return ; done | |
4455 | |
4456 TFT_gas_needs_helper_2: | |
4457 ; output gas type and pressure needed | |
4458 movf up,W ; get gas number (0-4) to WREG | |
4459 lfsr FSR1,opt_gas_O2_ratio ; read opt_gas_O2_ratio[WREG] | |
4460 movff PLUSW1,lo ; copy result to lo | |
4461 lfsr FSR1,opt_gas_He_ratio ; read opt_gas_He_ratio[WREG] | |
4462 movff PLUSW1,hi ; copy result to hi | |
4463 call gaslist_strcat_mix ; print "Air", "O2", "21/35", etc. | |
4464 PUTC ':' ; print ":" | |
4465 movf up,W ; get gas number (0-4) to WREG | |
4466 rlncf WREG,W ; multiply by 2 | |
4467 lfsr FSR1,int_O_gas_need_pres ; load base of gas needs in pressure | |
4468 movff PLUSW1,lo ; read LOW(int_O_gas_need_pres[up]) | |
4469 incf WREG,W ; add 1 to address high byte | |
4470 movff PLUSW1,hi ; read HIGH(int_O_gas_need_pres[up]) | |
4471 btfsc hi,int_attention_flag ; check if attention flag is set (pres_need > pres_fill * threshold) | |
4472 FONT_COLOR_ATTENTION ; YES - print gas need in attention color | |
4473 btfsc hi,int_warning_flag ; check if warning flag is set (pres_need > pres_fill) | |
4474 FONT_COLOR_WARNING ; YES - print gas need in warning color | |
4475 movff int_O_gas_need_pres+1,WREG ; get HIGH(int_O_gas_need_pres[0]) which holds flag for invalid data | |
4476 btfsc WREG,int_invalid_flag ; check if invalid data flag is set | |
4477 FONT_COLOR_DISABLED ; YES - print gas need in disabled color | |
4478 bcf hi,int_attention_flag ; clear flag for attention | |
4479 bcf hi,int_warning_flag ; clear flag for warning | |
4480 bcf hi,int_high_flag ; clear flag for > 999 bar | |
4481 bcf hi,int_invalid_flag ; clear flag for invalid data (will actually only be set with 1st gas) | |
4482 output_999 ; print (0-999) | |
4483 PUTC_PRINT " " ; add a space to overwrite any potential remains of earlier outputs and dump buffer to screen | |
4484 incf up,F ; increment to next gas | |
4485 return ; done | |
4486 | |
4487 | |
4488 ;----------------------------------------------------------------------------- | |
4489 ; Dive Custom View - Deco Plan - Mask | |
4490 ; | |
4491 global TFT_decoplan_mask ; mask for deco plan | |
4492 TFT_decoplan_mask: | |
4493 WIN_TINY dm_custom_decoplan_title_column, dm_custom_decoplan_title_row | |
4494 FONT_COLOR_MASK ; select color | |
4495 STRCPY_TEXT_PRINT tDiveDecoplan ; print label | |
4496 | |
4497 return ; done | |
4498 | |
4499 | |
4500 ;----------------------------------------------------------------------------- | |
4501 ; Dive Custom View - Deco Plan - Data | |
4502 ; | |
4503 global TFT_decoplan | |
4504 TFT_decoplan: | |
4505 lfsr FSR0,char_O_deco_depth ; load base address of stops table | |
4506 clrf ex ; will be used for auxiliary flags | |
4507 FONT_COLOR_MEMO ; set default output color | |
4508 movff char_O_deco_gas+0,lo ; get flag for invalid deco data | |
4509 btfsc lo,char_invalid_flag ; is the invalid flag set? | |
4510 FONT_COLOR_DISABLED ; YES - set to disabled color | |
4511 ; 2nd stop | |
4512 WIN_SMALL dm_cust_dstop_2nd_stop_column, dm_cust_dstop_2nd_stop_row | |
4513 rcall TFT_decoplan_helper ; show stop data | |
4514 ; 3rd stop | |
4515 WIN_SMALL dm_cust_dstop_3rd_stop_column, dm_cust_dstop_3rd_stop_row | |
4516 rcall TFT_decoplan_helper ; show stop data | |
4517 ; 4th stop | |
4518 bsf ex,4 ; flag we are on 4th screen position | |
4519 WIN_SMALL dm_cust_dstop_4th_stop_column, dm_cust_dstop_4th_stop_row | |
4520 rcall TFT_decoplan_helper ; show stop data | |
4521 bcf ex,4 ; clear 4th position flag again | |
4522 ; 5th stop | |
4523 WIN_SMALL dm_cust_dstop_5th_stop_column, dm_cust_dstop_5th_stop_row | |
4524 rcall TFT_decoplan_helper ; show stop data | |
4525 ; 6th stop | |
4526 WIN_SMALL dm_cust_dstop_6th_stop_column, dm_cust_dstop_6th_stop_row | |
4527 rcall TFT_decoplan_helper ; show stop data | |
4528 ; 7th stop | |
4529 WIN_SMALL dm_cust_dstop_7th_stop_column, dm_cust_dstop_7th_stop_row | |
4530 rcall TFT_decoplan_helper ; show stop data | |
4531 return ; done | |
4532 | |
4533 | |
4534 ; Helper Function - show stop data | |
4535 TFT_decoplan_helper: | |
4536 btfsc ex,0 ; no more stops to show? | |
4537 bra TFT_decoplan_helper_1 ; YES - skip checking next entry - it will be empty, too | |
4538 movff PREINC0,lo ; NO - advance pointer to get the depth of the 2nd, 3rd, 4th, ... stop | |
4539 tstfsz lo ; is the stop depth = 0, i.e. no stop entry? | |
4540 bra TFT_decoplan_helper_3 ; NO - show stop data | |
4541 | |
4542 TFT_decoplan_helper_1: ; no more stop table entries | |
4543 bsf ex,0 ; flag that there are no more stop table entries | |
4544 btfss ex,4 ; are we on the 4th screen position? | |
4545 bra TFT_decoplan_helper_2 ; NO - normal handling on this position | |
4546 btfsc ex,1 ; YES - special handling, has any stop been shown? | |
4547 bra TFT_decoplan_helper_2 ; YES - print normal blanking | |
4548 STRCPY_PRINT " ---- " ; NO - print a "no stops" indication (blanking potential previous content, too) | |
4549 return ; done | |
4550 | |
4551 TFT_decoplan_helper_2: ; no more stop table entries, blank potential previous content | |
4552 STRCPY_PRINT " " ; wipe screen position by printing 7 spaces | |
4553 return ; done | |
4554 | |
4555 TFT_decoplan_helper_3: | |
4556 rcall TFT_display_stop_depth ; print stop depth (depth in lo) | |
4557 PUTC " " ; put a space char between depth and time | |
4558 movlw NUM_STOPS ; offset between arrays holding depths and durations | |
4559 movff PLUSW0,lo ; get duration of the current stop | |
4560 output_99dd ; print duration, prints double dots if duration is zero | |
4561 PUTC_PRINT "'" ; append unit and dump buffer to screen | |
4562 bsf ex,1 ; flag that a stop was shown | |
4563 return ; done | |
4564 | |
4565 | |
4566 ; Helper Function - print stop depth | |
4567 TFT_display_stop_depth: ; print depth (stored in lo) | |
4568 TSTOSS opt_units ; get unit (0=m, 1=ft) | |
4569 bra TFT_display_stop_depth_m ; 0 - meter | |
4570 ;bra TFT_display_stop_depth_ft ; 1 - feet | |
4571 | |
4572 TFT_display_stop_depth_ft: | |
4573 call convert_meter_to_feet ; convert value in lo from meters to feet | |
4574 output_999 ; output stop depth (0-999) | |
4575 return ; done | |
4576 | |
4577 TFT_display_stop_depth_m: | |
4578 output_99 ; output stop depth (0-99) | |
4579 STRCAT_TEXT tMeters ; append unit | |
4580 return ; done | |
4581 | |
4582 | |
4583 ;----------------------------------------------------------------------------- | |
4584 ; Dive Custom View - Ceiling, Supersaturation & Tissues - Mask | |
4585 ; | |
4586 global TFT_ceiling_GF_tissue_mask | |
4587 TFT_ceiling_GF_tissue_mask: | |
4588 FONT_COLOR_MASK ; select color | |
4589 | |
4590 WIN_TINY dm_custom_ceiling_column+.2,dm_custom_ceiling_title_row | |
4591 STRCPY_TEXT_PRINT tCeiling ; print label | |
4592 | |
4593 WIN_TINY dm_custom_tissue_title_column, dm_custom_tissue_title_row | |
4594 STRCPY_TEXT_PRINT tDiveTissues ; print label | |
4595 | |
4596 WIN_TINY dm_custom_gf_column1+.5, dm_custom_gf_title_row | |
4597 STRCPY_TEXT_PRINT tGFInfo ; print label | |
4598 | |
4599 return ; done | |
4600 | |
4601 | |
4602 ;----------------------------------------------------------------------------- | |
4603 ; Dive Custom View - Ceiling, Supersaturation & Tissues - Data | |
4604 ; | |
4605 global TFT_ceiling_GF_tissue | |
4606 TFT_ceiling_GF_tissue: | |
4607 WIN_MEDIUM dm_custom_ceiling_column,dm_custom_ceiling_row | |
4608 MOVII int_O_ceiling,mpr ; get ceiling in [mbar] relative pressure | |
4609 call TFT_color_code_ceiling ; color-code the output (also strips off flags) | |
4610 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] | |
4611 | |
4612 TSTOSS opt_units ; 0=m, 1=ft | |
4613 bra TFT_ceiling_GF_tissue_metric ; 0 - meter | |
4614 ;bra TFT_ceiling_GF_tissue_imperial ; 1 - feet | |
4615 | |
4616 TFT_ceiling_GF_tissue_imperial: | |
4617 call convert_cm_to_feet ; convert value in hi:lo from [cm] to [feet] | |
4618 output_999 ; print (0-999) | |
4619 bra TFT_ceiling_GF_tissue0 ; continue | |
4620 | |
4621 TFT_ceiling_GF_tissue_metric: | |
4622 bsf omit_digit_1 ; do not print 1st digit | |
4623 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
4624 bsf leftbind ; print left-aligned | |
4625 output_65535 ; print (xxx.x-) | |
4626 bra TFT_ceiling_GF_tissue0 ; continue | |
4627 | |
4628 TFT_ceiling_GF_tissue0: | |
4629 PUTC_PRINT " " ; append a space and dump to screen | |
4630 ; show tissue diagram | |
4631 rcall TFT_dive_tissues ; show tissue pressure diagram | |
4632 ; show current supersaturation | |
4633 WIN_MEDIUM dm_custom_clock_column+.3, dm_custom_gf_row | |
4634 MOVII int_O_lead_supersat,mpr ; bank-safe copy of leading tissue's supersaturation | |
4635 call TFT_color_code_supersat ; color-code output | |
4636 output_256 ; need to print lo only, int_O_lead_supersat value is limited to 255 | |
4637 PRINT ; dump to screen | |
4638 WIN_STD dm_custom_clock_column+.40, dm_custom_gf_row+.5 | |
4639 PUTC_PRINT "%" ; print "%" and dump to screen | |
4640 return ; done | |
4641 | |
4642 | |
4643 ;------------------------------------------------------------------------- | |
4644 ; Draw saturation graph in dive mode custom view | |
4645 ; | |
4646 TFT_dive_tissues: | |
4647 ; draw outer frame | |
4648 movf pallet_color_memo,W ; get color into WREG | |
4649 WIN_FRAME_COLOR dm_custom_tissue_diagram_top, dm_custom_tissue_diagram_bottom, dm_custom_tissue_diagram_left, .159 ; outer frame | |
4650 | |
4651 ; clear area showing leading tissue number as it may not be printed over | |
4652 WIN_BOX_BLACK dm_custom_tissue_diagram_top+.16, dm_custom_tissue_diagram_top+.16+.10, dm_custom_tissue_diagram_left+.32, dm_custom_tissue_diagram_left+.32+.8 ; top, bottom, left, right | |
4653 | |
4654 TFT_dive_tissues_1: | |
4655 ; common initialization for tissue pressures and saturation | |
4656 movlw .1 | |
4657 movwf win_height ; hight of the bargraph (0-239) | |
4658 movlw dm_custom_tissue_diagram_left+.3 ; get dive mode left start position | |
4659 movwf win_leftx2 ; set column left (0-159) | |
4660 movlw .159-dm_custom_tissue_diagram_left-.4 ; get max width | |
4661 movwf win_width+0 ; set width (low byte) | |
4662 clrf win_width+1 ; high byte of with is always zero | |
4663 movlw color_cyan ; color for tissues with decreasing pressure | |
4664 movwf ex ; store in ex | |
4665 movlw color_orange ; color for tissues with increasing pressure | |
4666 movwf ul ; store in ul | |
4667 | |
4668 ; draw combined or N2 tissue pressures | |
4669 lfsr FSR2,char_O_tissue_pressure ; load base address of combined pressures by default | |
4670 IFDEF _helium | |
4671 btfsc tissue_graphic_layout ; shall show N2+He ? | |
4672 lfsr FSR2,char_O_tissue_pres_N2 ; YES - load base address of N2 pressures | |
4673 ENDIF | |
4674 movlw d'16' | |
4675 movwf lo ; tissue counter, 16 tissues | |
4676 clrf hi ; row counter | |
4677 TFT_dive_tissues_N2_loop: | |
4678 movlw dm_custom_tissue_diagram_top+.3 ; dive mode top start position N2 | |
4679 rcall TFT_dive_tissues_bargraph ; draw tissue bargraph | |
4680 incf hi,F ; increment row counter | |
4681 decfsz lo,F ; decrement tissue counter, done? | |
4682 bra TFT_dive_tissues_N2_loop ; NO - loop | |
4683 IFDEF _helium | |
4684 btfsc tissue_graphic_layout ; shall show N2+He ? | |
4685 bra TFT_dive_tissues_3 ; YES - show He tissue pressures | |
4686 ENDIF | |
4687 | |
4688 ; draw tissue saturations | |
4689 lfsr FSR2,char_O_tissue_saturation ; load base address of tissue supersaturation | |
4690 movlw d'16' | |
4691 movwf lo ; tissue counter, 16 tissues | |
4692 clrf hi ; row counter | |
4693 movlw color_grey ; color for tissue saturation, alternative: color_lightblue | |
4694 movwf ex ; store in ex | |
4695 ; movlw color_yellow ; 2nd color is not used by tissue saturation | |
4696 ; movwf ul ; ... | |
4697 TFT_dive_tissues_sat_loop: | |
4698 movlw dm_custom_tissue_diagram_top+.25 ; dive mode top start position saturations | |
4699 rcall TFT_dive_tissues_bargraph ; draw tissue bargraph | |
4700 incf hi,F ; increment row counter | |
4701 decfsz lo,F ; decrement tissue counter, done? | |
4702 bra TFT_dive_tissues_sat_loop ; NO - loop | |
4703 | |
4704 ; common part for vertical lines | |
4705 movlw dm_custom_tissue_diagram_top+.25 ; get top position | |
4706 movwf win_top ; set top position (0-239) | |
4707 movlw .15 ; get hight | |
4708 movwf win_height ; set height | |
4709 movlw .1 ; get width | |
4710 movwf win_width+0 ; set width, low byte | |
4711 clrf win_width+1 ; set width, high byte | |
4712 | |
4713 ; print 100% line | |
4714 movlw dm_custom_tissue_diagram_left+.36 ; get left position | |
4715 movwf win_leftx2 ; set left position (0-159) | |
4716 movlw color_red ; color for 100% line | |
4717 BOX_COLOR ; draw line | |
4718 | |
4719 ; GF factors enabled? | |
4720 btfss tissue_graphic_gf ; shall show GF lines? | |
4721 bra TFT_dive_tissues_4 ; NO - continue with number of leading tissue | |
4722 | |
4723 ; print GF low line | |
4724 movlw dm_custom_tissue_diagram_left+.3 ; get left base position | |
4725 movwf win_leftx2 ; set left base position (0-159) | |
4726 movff char_I_GF_Low_percentage,WREG ; get GF low in 0.01 % | |
4727 mullw .82 ; multiply with 82 | |
4728 movf PRODH,W ; divide by 256 -> resulting scale factor is 82/256 = 0.3203125 | |
4729 addwf win_leftx2,F ; add to base position | |
4730 movlw color_green ; color for GF low line | |
4731 BOX_COLOR ; draw line | |
4732 | |
4733 ; print GF high line | |
4734 movlw dm_custom_tissue_diagram_left+.3 ; get left base position | |
4735 movwf win_leftx2 ; set left base position (0-159) | |
4736 movff char_I_GF_High_percentage,WREG ; get GF high in 0.01 % | |
4737 mullw .82 ; multiply with 82 | |
4738 movf PRODH,W ; divide by 256 -> resulting scale factor is 82/256 = 0.3203125 | |
4739 addwf win_leftx2,F ; add to base position | |
4740 movlw color_yellow ; color for GF high line | |
4741 BOX_COLOR ; draw line | |
640 | 4742 bra TFT_dive_tissues_4 ; continue with number of leading tissue |
634 | 4743 |
4744 IFDEF _helium | |
4745 TFT_dive_tissues_3: | |
4746 ; draw He tissues pressures | |
4747 lfsr FSR2,char_O_tissue_pres_He ; load base address of He pressures | |
4748 movlw dm_custom_tissue_diagram_left+.7 ; get dive mode left start position for He bars | |
4749 movwf win_leftx2 ; set column left (0-159) | |
4750 movlw .159-dm_custom_tissue_diagram_left-.8 ; get max width for He bars | |
4751 movwf win_width+0 ; set width (low byte) | |
4752 clrf win_width+1 ; ... | |
4753 movlw d'16' | |
4754 movwf lo ; tissue counter, 16 tissues | |
4755 clrf hi ; row counter | |
4756 TFT_dive_tissues_He_loop: | |
4757 movlw dm_custom_tissue_diagram_top+.25 ; dive mode top start position H2 | |
4758 rcall TFT_dive_tissues_bargraph ; draw tissue bargraph | |
4759 incf hi,F ; increment row counter | |
4760 decfsz lo,F ; decrement tissue counter, done? | |
4761 bra TFT_dive_tissues_He_loop ; NO - loop | |
4762 ENDIF | |
4763 | |
4764 TFT_dive_tissues_4: | |
4765 ; print number of leading tissue ; TODO: some flicker due to overwriting by tissue bars | |
4766 movff int_O_lead_supersat+0,WREG ; get current leading tissue's supersaturation (only low byte used for value) | |
4767 tstfsz WREG ; current supersaturation = 0 ? | |
4768 bra TFT_dive_tissues_5 ; NO - print number of leading tissue | |
4769 movff char_O_deco_info,WREG ; YES - get deco info vector | |
4770 btfss WREG,deco_ceiling ; - do we have a ceiling obligation? | |
4771 return ; NO - can ascent directly, don't print number, set standard color and return | |
4772 ; YES - print number of leading tissue | |
4773 TFT_dive_tissues_5: | |
4774 movff char_O_lead_tissue,lo ; get number of leading tissue as 0-15 | |
4775 incf lo,F ; adjust to 1-16 | |
4776 movlw .10 | |
4777 cpfsgt lo ; is it > 10 ? | |
4778 bra TFT_dive_tissues_6 ; NO - will output a single digit number | |
4779 ; start position for a 2 digit number | |
4780 WIN_TINY dm_custom_tissue_diagram_left+.32,dm_custom_tissue_diagram_top+.10 | |
4781 bra TFT_dive_tissues_7 | |
4782 TFT_dive_tissues_6: | |
4783 ; start position for a 1 digit number | |
4784 WIN_TINY dm_custom_tissue_diagram_left+.32+.4,dm_custom_tissue_diagram_top+.10 | |
4785 TFT_dive_tissues_7: | |
4786 FONT_COLOR_MEMO ; set output color | |
4787 bsf leftbind ; print left-aligned | |
4788 output_99 ; print tissue number (0-99) | |
4789 PRINT ; dump buffer to screen | |
4790 return ; done | |
4791 | |
4792 | |
4793 ; Helper Function - draw a bargraph | |
4794 TFT_dive_tissues_bargraph: | |
4795 addwf hi,W ; add row number to start position | |
4796 movwf win_top ; set as row top (0-239) | |
4797 movff POSTINC2,up ; get tissue value | |
4798 movf ex,W ; default color | |
4799 btfsc up,7 ; check if flag in bit 7 is set | |
4800 movf ul,W ; YES - switch to 2nd color | |
4801 bcf up,7 ; clear flag bit | |
4802 bcf STATUS,C ; clear carry bit | |
4803 rrcf up,F ; divide by 2 | |
4804 movff up,win_bargraph ; set bargraph length | |
4805 incf win_bargraph,F ; add a bit for a minimum visible bar | |
4806 BOX_COLOR ; draw bargraph | |
4807 return ; done | |
4808 | |
4809 | |
4810 ;----------------------------------------------------------------------------- | |
4811 ; Dive Custom View - CNS - Mask | |
4812 ; | |
4813 global TFT_CNS_mask | |
4814 TFT_CNS_mask: | |
4815 FONT_COLOR_MASK ; select color | |
4816 | |
4817 WIN_TINY dm_custom_cns3_column1, dm_custom_cns3_title_row | |
4818 STRCPY_TEXT_PRINT tCNSsurf ; print label | |
4819 | |
4820 WIN_TINY dm_custom_cns3_column2, dm_custom_cns3_title_row | |
4821 | |
4822 IFDEF _cave_mode | |
4823 btfss cave_mode ; cave mode switched on? | |
4824 bra TFT_CNS_mask_col2 ; NO | |
4825 STRCPY_TEXT_PRINT tCNScave ; YES - print cave TTS label | |
4826 bra TFT_CNS_mask_col3 ; - continue with 3rd column | |
4827 ENDIF | |
4828 | |
4829 TFT_CNS_mask_col2: | |
4830 btfsc FLAG_oc_mode ; in OC mode? | |
4831 bra TFT_CNS_mask_ftts ; YES - print fTTS label | |
4832 btfsc bailout_mode ; NO - in bailout? | |
4833 bra TFT_CNS_mask_ftts ; YES - print fTTS label (label will be printed, but a fTTS will actually not be calculated) | |
4834 TSTOSS opt_calc_gasvolume ; NO - bailout volume calculation requested? | |
4835 bra TFT_CNS_mask_ftts ; NO - print fTTS label | |
4836 ;bra TFT_CNS_mask_bo ; YES - print bailout label | |
4837 | |
4838 TFT_CNS_mask_bo: | |
4839 STRCPY_TEXT_PRINT tCNSBO ; print bailout label | |
4840 bra TFT_CNS_mask_col3 ; continue with 3rd column | |
4841 | |
4842 TFT_CNS_mask_ftts: | |
4843 STRCPY_TEXT_PRINT tCNSfTTS ; print fTTS label | |
4844 ;bra TFT_CNS_mask_col3 ; continue with 3rd column | |
4845 | |
4846 TFT_CNS_mask_col3: | |
4847 WIN_TINY dm_custom_cns3_column3, dm_custom_cns3_title_row | |
4848 STRCPY_TEXT_PRINT tCNSnow ; print CNS now label | |
4849 return ; done | |
4850 | |
4851 | |
4852 ;----------------------------------------------------------------------------- | |
4853 ; Dive Custom View - CNS - Data | |
4854 ; | |
4855 global TFT_CNS | |
4856 TFT_CNS: | |
4857 ; CNS at end of normal dive | |
4858 WIN_STD dm_custom_cns3_column1+.3,dm_custom_cns3_row | |
4859 MOVII int_O_CNS_norm,mpr ; get CNS at end of dive in normal plan | |
4860 call TFT_color_code_cns ; color-code the CNS value | |
4861 bsf leftbind ; print left-aligned | |
4862 output_999 ; print (0-999) | |
4863 STRCAT_PRINT "% " ; append unit and trailing space and dump to screen | |
4864 ; fTTS / Bailout CNS, if enabled | |
4865 WIN_STD dm_custom_cns3_column2+.2,dm_custom_cns3_row | |
4866 btfsc bailout_mode ; in bailout? | |
4867 bra TFT_CNS_3 ; YES - show "---" | |
4868 TSTOSS opt_calc_gasvolume ; NO - bailout volume calculation requested? | |
4869 bra TFT_CNS_1 ; NO - continue checking fTTS extra time | |
4870 btfss FLAG_oc_mode ; YES - in OC mode? | |
4871 bra TFT_CNS_2 ; NO - show CNS% | |
4872 ;bra TFT_CNS_1 ; YES - continue checking fTTS extra time | |
4873 | |
4874 TFT_CNS_1: | |
4875 ; not in bailout, no volume calculation, and/or in OC mode | |
4876 TSTOSS char_I_extra_time ; fTTS extra time configured? | |
4877 bra TFT_CNS_3 ; NO - show "---" | |
4878 ;bra TFT_CNS_2 ; YES - show CNS% | |
4879 | |
4880 TFT_CNS_2: | |
4881 MOVII int_O_CNS_alt,mpr ; get CNS at end of dive in alternative plan | |
4882 call TFT_color_code_cns ; color-code the CNS value | |
4883 bsf leftbind ; print left-aligned | |
4884 output_999 ; print (0-999) | |
4885 STRCAT_PRINT "% " ; append unit and trailing space and dump to screen | |
4886 bra TFT_CNS_4 ; continue | |
4887 | |
4888 TFT_CNS_3: | |
4889 IFDEF _cave_mode | |
4890 btfss cave_mode ; cave mode switched on? | |
4891 bra TFT_CNS_3a ; NO - show dashes | |
4892 btfsc backtrack_entire_full ; YES - cave mode shut down due to storage fully used up? | |
4893 bra TFT_CNS_3a ; YES - show dashes | |
4894 btfss dive_turned ; NO - dive turned? | |
4895 bra TFT_CNS_2 ; NO - show cave CNS | |
4896 ;bra TFT_CNS_3a ; YES - show dashes | |
4897 ENDIF | |
4898 | |
4899 TFT_CNS_3a: | |
4900 FONT_COLOR_MEMO ; select color | |
4901 STRCPY_PRINT "--- " ; print non-avail symbol | |
4902 ;bra TFT_CNS_4 ; continue | |
4903 | |
4904 TFT_CNS_4: | |
4905 ; current CNS | |
4906 WIN_STD dm_custom_cns3_column3+.3,dm_custom_cns3_row | |
4907 MOVII int_O_CNS_current,mpr ; get current CNS | |
4908 call TFT_color_code_cns ; color-code the CNS value | |
4909 bsf leftbind ; print left-aligned | |
4910 output_999 ; print (0-999) | |
4911 PUTC_PRINT "%" ; append unit and dump to screen | |
4912 return ; done | |
4913 | |
4914 | |
4915 ;----------------------------------------------------------------------------- | |
4916 ; Dive Custom View - ppO2, EAD/END & Gas Density - Mask | |
4917 ; | |
4918 global TFT_ppo2_ead_end_cns_mask | |
4919 TFT_ppo2_ead_end_cns_mask: | |
4920 FONT_COLOR_MASK ; select color | |
4921 | |
4922 WIN_TINY dm_custom_ppo2_column-.2,dm_custom_ppo2_title_row | |
4923 STRCPY_TEXT_PRINT tppO2 ; print label | |
4924 | |
4925 WIN_TINY dm_custom_ead_column,dm_custom_eadend_title_row | |
4926 STRCPY_TEXT_PRINT tDiveEAD_END ; print label | |
4927 | |
4928 IFDEF _ccr_pscr | |
4929 WIN_TINY dm_custom_cns_column-.5,dm_custom_eadend_title_row | |
4930 STRCPY_TEXT_PRINT tGasDensity ; print label | |
4931 ELSE | |
4932 WIN_TINY dm_custom_cns_column,dm_custom_cns_title_row | |
4933 STRCPY_TEXT_PRINT tCNS2 ; print label | |
4934 ENDIF | |
4935 | |
4936 return ; done | |
4937 | |
4938 | |
4939 | |
4940 ;----------------------------------------------------------------------------- | |
4941 ; Dive Custom View - ppO2, EAD/END & Gas Density - Data | |
4942 ; | |
4943 global TFT_ppo2_ead_end_cns | |
4944 TFT_ppo2_ead_end_cns: | |
4945 ; show ppO2 | |
4946 WIN_MEDIUM dm_custom_ppo2_column, dm_custom_ppo2_row | |
4947 MOVII int_O_breathed_ppO2,mpr ; copy ppO2 of the currently breathed gas to hi:lo | |
4948 call TFT_color_code_ppo2 ; color-code output | |
4949 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
4950 output_999 ; print ppO2 (0.00-9.99) | |
4951 PRINT ; dump to screen | |
4952 ; show END/EAD | |
4953 FONT_COLOR_MEMO ; select color | |
4954 WIN_SMALL dm_custom_ead_column, dm_custom_ead_row | |
4955 STRCPY_TEXT tEAD ; print "EAD:" | |
4956 MOVII int_O_EAD_pres,mpr ; copy EAD in [mbar] to MPR | |
4957 rcall TFT_end_ead_common ; convert to depth, print and limit to 8 chars | |
4958 WIN_SMALL dm_custom_end_column, dm_custom_end_row | |
4959 STRCPY_TEXT tEND ; print "END:" | |
4960 MOVII int_O_END_pres,mpr ; copy END in [mbar] to MPR | |
4961 rcall TFT_end_ead_common ; convert to depth, print and limit to 8 chars | |
4962 IFDEF _helium | |
4963 ; show gas density | |
4964 WIN_MEDIUM dm_custom_cns_column-.5, dm_custom_cns_row | |
4965 MOVII int_O_gas_density,mpr ; get current gas density | |
4966 call TFT_color_code_cns ; color-code output | |
4967 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
4968 output_999 ; print (0.00-9.99) | |
4969 PRINT ; dump to screen | |
4970 ELSE | |
4971 ; show CNS | |
4972 WIN_STD dm_custom_cns_column+.3, dm_custom_cns_row | |
4973 MOVII int_O_CNS_current,mpr ; get current CNS | |
4974 call TFT_color_code_cns ; color-code CNS output | |
4975 bsf leftbind ; print left-aligned | |
4976 output_999 ; print (0-999) | |
4977 PUTC_PRINT "%" ; append unit and dump buffer to screen | |
4978 ENDIF | |
4979 return ; done | |
4980 | |
4981 | |
4982 ; Helper Function - convert to depth, print and limit to 8 chars | |
4983 TFT_end_ead_common: | |
4984 call convert_pres_to_depth ; convert pressure in [mbar] to depth in [cm] | |
4985 TSTOSS opt_units ; 0=Meter, 1=Feet | |
4986 bra TFT_end_ead_common_metric ; 0: meter | |
4987 ;bra TFT_end_ead_common_imperial ; 1: feet | |
4988 | |
4989 TFT_end_ead_common_imperial: | |
4990 call convert_cm_to_feet ; convert depth in [cm] to depth in [feet] | |
4991 output_999 ; print (0-999) | |
4992 PRINT ; dump buffer to screen | |
4993 return ; done | |
4994 | |
4995 TFT_end_ead_common_metric: | |
4996 bsf omit_digit_2 ; do not print 2nd and 1st digit | |
4997 output_65535 ; print (0xx-655xx) | |
4998 PUTC_PRINT 'm' ; append unit and dump to screen | |
4999 return ; done | |
5000 | |
5001 | |
5002 ;----------------------------------------------------------------------------- | |
5003 ; Dive Custom View - GF Factors (Mask only) | |
5004 ; | |
5005 global TFT_gf_factors_mask | |
5006 TFT_gf_factors_mask: | |
5007 FONT_COLOR_MASK ; select color | |
5008 | |
5009 ; show labels | |
5010 WIN_TINY dm_custom_gf_column1,dm_custom_gf_title_row | |
5011 STRCPY_TEXT_PRINT tGFactors | |
5012 WIN_TINY dm_custom_gf_column3,dm_custom_gf_title_row | |
5013 STRCPY_TEXT_PRINT taGFactors | |
5014 | |
5015 ; show GF (static) | |
5016 WIN_STD dm_custom_gf_column1, dm_custom_gf_row | |
5017 FONT_COLOR_DISABLED ; default to disabled color | |
5018 btfss use_aGF ; shall use alternative GF factors? | |
5019 FONT_COLOR_MEMO ; NO - switch to memo color | |
5020 movff opt_GF_low, lo ; get normal GF low | |
5021 movff opt_GF_high,hi ; get normal GF high | |
5022 rcall TFT_gf_factors_mask_helper ; print GFs | |
5023 | |
5024 ; show aGF (static) | |
5025 FONT_COLOR_MEMO ; select memo color | |
5026 TSTOSS opt_enable_aGF ; are alternative GF factors enabled? | |
5027 bra TFT_gf_factors_mask_3 ; NO - show "---" and return | |
5028 ; bra TFT_gf_factors_mask_0 ; YES - show arrow | |
5029 | |
5030 TFT_gf_factors_mask_0: | |
5031 WIN_STD dm_custom_gf_column2, dm_custom_gf_row | |
5032 btfss use_aGF ; shall use aGF? | |
5033 bra TFT_gf_factors_mask_1L ; NO - print "<- " | |
5034 ;bra TFT_gf_factors_mask_1R ; YES - print " ->" | |
5035 | |
5036 TFT_gf_factors_mask_1R: | |
5037 STRCPY_PRINT " ->" ; print " ->" | |
5038 bra TFT_gf_factors_mask_2 ; continue | |
5039 | |
5040 TFT_gf_factors_mask_1L: | |
5041 STRCPY_PRINT "<- " ; print "<- " | |
5042 ;bra TFT_gf_factors_mask_2 ; continue | |
5043 | |
5044 TFT_gf_factors_mask_2: | |
5045 WIN_STD dm_custom_gf_column3, dm_custom_gf_row | |
5046 ;FONT_COLOR_MEMO ; select memo color (still selected) | |
5047 btfss use_aGF ; shall use aGF? | |
5048 FONT_COLOR_DISABLED ; NO - switch to disabled color | |
5049 movff opt_aGF_low, lo ; get aGF low | |
5050 movff opt_aGF_high,hi ; get aGF high | |
5051 rcall TFT_gf_factors_mask_helper ; print GFs | |
5052 return ; done | |
5053 | |
5054 TFT_gf_factors_mask_3: | |
5055 WIN_STD dm_custom_gf_column3+.10, dm_custom_gf_row | |
5056 STRCPY_PRINT "---" ; print not-avail symbol | |
5057 return ; done | |
5058 | |
5059 ; Helper Function - print GF pair | |
5060 TFT_gf_factors_mask_helper: | |
5061 output_256 ; print GF low (0-255) | |
5062 PUTC "/" ; print "/" | |
5063 movff hi,lo ; get GF high | |
5064 output_256 ; print GF high (0-255) | |
5065 PRINT ; dump to screen | |
5066 return ; done | |
5067 | |
5068 | |
5069 ;----------------------------------------------------------------------------- | |
5070 ; Dive Custom View - Clock, Battery & Surface Pressure - Mask | |
5071 ; | |
5072 global TFT_clock_batt_surfpress_mask | |
5073 TFT_clock_batt_surfpress_mask: | |
5074 FONT_COLOR_MASK ; select color | |
5075 | |
5076 WIN_TINY dm_custom_clock_column, dm_custom_clock_title_row | |
5077 STRCPY_TEXT_PRINT tTime ; "Time" | |
5078 | |
5079 WIN_TINY dm_custom_battery_column, dm_custom_battery_title_row | |
5080 STRCPY_TEXT_PRINT tBattery ; "Battery" | |
5081 | |
5082 WIN_TINY dm_custom_surfpres_column+.8, dm_custom_surfpres_title_row | |
5083 STRCPY_TEXT_PRINT tSurface ; "Surface" | |
5084 | |
5085 ; show configured surface pressure (done in mask, because it's static during the dive) | |
5086 WIN_SMALL dm_custom_surfpres_column, dm_custom_surfpres_row | |
5087 FONT_COLOR_MEMO ; select color | |
5088 MOVII pressure_surf,mpr ; get surface pressure | |
5089 output_65535 ; print (5 digits, first one used as spacer) | |
5090 PUTC ' ' ; print a space | |
5091 STRCAT_TEXT_PRINT tMBAR ; append unit and dump to screen | |
5092 return ; done | |
5093 | |
5094 | |
5095 ;----------------------------------------------------------------------------- | |
5096 ; Dive Custom View - Clock, Battery & Surface Pressure - Data | |
5097 ; | |
5098 global TFT_clock_batt_surfpress | |
5099 TFT_clock_batt_surfpress: | |
5100 ; update clock | |
5101 WIN_SMALL dm_custom_clock_column, dm_custom_clock_row | |
5102 FONT_COLOR_MEMO ; select color | |
5103 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time | |
5104 movff rtc_latched_hour,lo ; get hours | |
5105 output_99 ; print hours (0-99) | |
5106 PUTC ':' ; print ":" | |
5107 movff rtc_latched_mins,lo ; get minutes | |
5108 output_99x ; print minutes (00-99) | |
5109 PUTC ":" ; print ":" | |
5110 movff rtc_latched_secs,lo ; get seconds | |
5111 output_99x ; print seconds (00-99) | |
5112 PRINT ; dump to screen | |
5113 | |
5114 ; show battery voltage | |
5115 WIN_SMALL dm_custom_battery_column, dm_custom_battery_volt_row | |
5116 ;FONT_COLOR_MEMO ; select color | |
5117 MOVII batt_voltage,mpr ; get voltage | |
5118 bsf decimal_digit3 ; place a decimal point in front of digit 3 | |
5119 bsf omit_digit_1 ; do not print 1st digit | |
5120 output_9999 ; print voltage (0.00x-9.99x) | |
5121 PUTC_PRINT 'V' ; append unit and dump to screen | |
5122 | |
5123 ; show battery percent | |
5124 WIN_SMALL dm_custom_battery_column+.7, dm_custom_battery_percent_row | |
5125 call TFT_color_code_battery ; color-code according to battery_low_condition flag | |
5126 movff batt_percent,lo ; get battery % | |
5127 output_256 ; print battery % (0-999) | |
5128 PUTC_PRINT "%" ; append unit and dump to screen | |
5129 | |
5130 ; surface pressure is shown via the mask because it is static | |
5131 return ; done | |
5132 | |
5133 | |
5134 IFDEF _ccr_pscr | |
5135 | |
5136 ;----------------------------------------------------------------------------- | |
5137 ; Dive Custom View - Sensor Check - Mask | |
5138 ; | |
5139 global TFT_sensor_check_mask | |
5140 TFT_sensor_check_mask: | |
5141 FONT_COLOR_MASK ; select color | |
5142 | |
5143 WIN_TINY dm_custom_s_check_title_column, dm_custom_s_check_title_row | |
5144 STRCPY_TEXT_PRINT tSensorCheck ; print label | |
5145 | |
5146 WIN_TINY dm_custom_ppO2_column, dm_custom_s_check_title_row | |
5147 STRCPY_TEXT_PRINT tppO2O2 ; print label | |
5148 | |
5149 WIN_TINY dm_custom_ppDil_column, dm_custom_s_check_title_row | |
5150 STRCPY_TEXT_PRINT tppO2Dil ; print label | |
5151 | |
5152 return ; done | |
5153 | |
5154 | |
5155 ;----------------------------------------------------------------------------- | |
5156 ; Dive Custom View - Sensor Check - Data | |
5157 ; | |
5158 global TFT_sensor_check | |
5159 TFT_sensor_check: | |
5160 ; show ppO2 of O2 in this depth | |
5161 WIN_MEDIUM dm_custom_ppO2_column, dm_custom_s_check_row | |
5162 MOVII int_O_O2_ppO2,mpr ; copy ppO2 of pure O2 to hi:lo | |
5163 rcall TFT_sensor_check_helper ; print ppO2 | |
5164 ; show ppO2 of the diluent in this depth | |
5165 WIN_MEDIUM dm_custom_ppDil_column, dm_custom_s_check_row | |
5166 MOVII int_O_pure_ppO2,mpr ; copy ppO2 of pure gas to hi:lo | |
5167 rcall TFT_sensor_check_helper ; print ppO2 | |
5168 return ; done | |
5169 | |
5170 TFT_sensor_check_helper: | |
5171 call TFT_color_code_ppo2 ; color-code output | |
5172 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
5173 output_999 ; print ppO2 (0.00-9.99) | |
5174 PRINT ; dump to screen | |
5175 return ; done | |
5176 | |
5177 | |
5178 ;----------------------------------------------------------------------------- | |
5179 ; Dive Custom View - pSCR Info - Mask | |
5180 ; | |
5181 global TFT_pscr_info_mask | |
5182 TFT_pscr_info_mask: | |
5183 FONT_COLOR_MASK ; select color | |
5184 | |
5185 WIN_TINY dm_custom_pscr_drop_column, dm_custom_pscr_title_row | |
5186 STRCPY_TEXT_PRINT tPSCR_O2_drop ; print label | |
5187 | |
5188 WIN_TINY dm_custom_pscr_ratio_column, dm_custom_pscr_title_row | |
5189 STRCPY_TEXT_PRINT tPSCR_lungratio ; print label | |
5190 | |
5191 WIN_TINY dm_custom_ppo2_column-.2,dm_custom_ppo2_title_row | |
5192 btfsc bailout_mode ; in bailout? | |
5193 bra TFT_pscr_info_mask_2 ; YES | |
5194 ;bra TFT_pscr_info_mask_1 ; NO | |
5195 | |
5196 TFT_pscr_info_mask_1: | |
5197 STRCPY_TEXT_PRINT tppO2Mix ; print "ppO2(Mix)" | |
5198 return ; done | |
5199 | |
5200 TFT_pscr_info_mask_2: | |
5201 STRCPY_TEXT_PRINT tppO2 ; print "ppO2" | |
5202 return ; done | |
5203 | |
5204 | |
5205 ;----------------------------------------------------------------------------- | |
5206 ; Dive Custom View - pSCR Info - Data | |
5207 ; | |
5208 global TFT_pscr_info | |
5209 TFT_pscr_info: | |
5210 ;show ppO2 | |
5211 WIN_MEDIUM dm_custom_ppo2_column,dm_custom_ppo2_row | |
5212 MOVII int_O_pSCR_ppO2,mpr ; copy pSCR ppO2 to hi:lo | |
5213 call TFT_color_code_ppo2 ; color-code output | |
5214 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
5215 output_999 ; print ppO2 (0.00-9-99) | |
5216 PRINT ; dump to screen | |
5217 ; show drop | |
5218 WIN_STD dm_custom_pscr_drop_column+.11,dm_custom_pscr_row | |
5219 FONT_COLOR_MEMO ; select color | |
5220 movff char_I_PSCR_drop,lo ; get drop | |
5221 output_99 ; print drop (0-99) | |
5222 PUTC_PRINT "%" ; append unit and dump to screen | |
5223 ; show lung ratio | |
5224 WIN_STD dm_custom_pscr_ratio_column+.5,dm_custom_pscr_row | |
5225 ;FONT_COLOR_MEMO ; select color | |
5226 movff char_I_PSCR_lungratio,lo ; get ratio | |
5227 STRCPY "1/" ; print "1/" | |
5228 bsf leftbind ; print left-aligned | |
5229 output_256 ; print ratio number (0-256) | |
5230 PRINT ; dump to screen | |
5231 return ; done | |
5232 | |
5233 ENDIF ; _ccr_psrc | |
5234 | |
5235 IFDEF _external_sensor | |
5236 | |
5237 ;----------------------------------------------------------------------------- | |
5238 ; Dive Custom View - Sensor ppO2 - Mask | |
5239 ; | |
5240 global TFT_ppo2_sensors_mask | |
5241 TFT_ppo2_sensors_mask: | |
5242 FONT_COLOR_MASK ; select color | |
5243 | |
5244 WIN_TINY dm_custom_hud_sensor1_column+.4,dm_custom_hud_title_row | |
5245 STRCPY_TEXT_PRINT tDiveHudMask1 ; print label | |
5246 | |
5247 WIN_TINY dm_custom_hud_sensor2_column+.3,dm_custom_hud_title_row | |
5248 STRCPY_TEXT_PRINT tDiveHudMask2 ; print label | |
5249 | |
5250 WIN_TINY dm_custom_hud_sensor3_column+.2,dm_custom_hud_title_row | |
5251 STRCPY_TEXT_PRINT tDiveHudMask3 ; print label | |
5252 | |
5253 return ; done | |
5254 | |
5255 | |
5256 ;----------------------------------------------------------------------------- | |
5257 ; Dive Custom View - Sensor ppO2 - Data | |
5258 ; | |
5259 ; Definition of the output: | |
5260 ; | |
5261 ; sensorX use voting o2 | |
5262 ; _calibrated _O2 _logic _ppo2 Output Color | |
5263 ; _ok _sensorX _sensorX _sensorX | |
5264 ;----------------------------------------------------------------------------------------------- | |
5265 ; 0 -/- -/- -/- "----" memo | |
5266 ; 1 0 -/- = 0 o2_ppo2_sensorX attention | |
5267 ; 1 0 -/- > 0 o2_ppo2_sensorX disabled | |
5268 ; 1 1 0 -/- o2_ppo2_sensorX TFT_color_code_ppo2_hud + win_invert | |
5269 ; 1 1 1 -/- o2_ppo2_sensorX TFT_color_code_ppo2_hud | |
5270 ; | |
5271 global TFT_ppo2_sensors | |
5272 TFT_ppo2_sensors: | |
5273 | |
5274 ; sensor 1 | |
5275 TFT_ppo2_sensors_1: | |
5276 btfsc sensor1_calibrated_ok ; valid calibration? | |
5277 bra TFT_ppo2_sensors_1b ; YES | |
5278 btfsc sensor1_active ; NO - valid HUD data for this sensor? | |
5279 bra TFT_ppo2_sensors_1b ; YES | |
5280 ;bra TFT_ppo2_sensors_1a ; NO | |
5281 | |
5282 TFT_ppo2_sensors_1a: | |
5283 ; no valid calibration | |
5284 WIN_STD dm_custom_hud_sensor1_column+.7, dm_custom_hud_row+.5 | |
5285 FONT_COLOR_MEMO ; set color | |
5286 STRCPY_PRINT "---" ; print dashes | |
5287 bra TFT_ppo2_sensors_2 ; continue with sensor 2 | |
5288 | |
5289 TFT_ppo2_sensors_1b: | |
5290 ; sensor has a valid calibration | |
5291 WIN_MEDIUM dm_custom_hud_sensor1_column,dm_custom_hud_row | |
5292 movff sensor1_ppO2,lo ; load ppO2 value into transfer storage for output | |
5293 btfsc use_O2_sensor1 ; in use? | |
5294 bra TFT_ppo2_sensors_1d ; YES | |
5295 tstfsz lo ; NO - sensor value = 0 ? | |
5296 bra TFT_ppo2_sensors_1c ; NO | |
5297 FONT_COLOR_ATTENTION ; YES - set attention color | |
5298 bra TFT_ppo2_sensors_1e ; - print ppO2 value | |
5299 | |
5300 TFT_ppo2_sensors_1c: | |
5301 ; sensor has valid calibration, is not in use and has a value > 0 | |
5302 FONT_COLOR_DISABLED ; set disabled color | |
5303 bra TFT_ppo2_sensors_1e ; print ppO2 value | |
5304 | |
5305 TFT_ppo2_sensors_1d: | |
5306 ; sensor has valid calibration and is in use | |
5307 call TFT_color_code_ppo2_hud ; color-code with ppO2 [cbar] in lo | |
5308 btfsc voting_logic_sensor1 ; sensor value agrees with values of other sensors? | |
5309 bra TFT_ppo2_sensors_1e ; YES | |
5310 bsf win_invert ; NO - invert output | |
5311 ;bra TFT_ppo2_sensors_1e ; print ppO2 value | |
5312 | |
5313 TFT_ppo2_sensors_1e: | |
5314 ; all coloring is set up now, let's write the value to the display! | |
5315 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
5316 output_256 ; print (0.00-2.55) | |
5317 PRINT ; dump to screen | |
5318 | |
5319 ; sensor 2 | |
5320 TFT_ppo2_sensors_2: | |
5321 btfsc sensor2_calibrated_ok ; valid calibration? | |
5322 bra TFT_ppo2_sensors_2b ; YES | |
5323 btfsc sensor2_active ; NO - valid HUD data for this sensor? | |
5324 bra TFT_ppo2_sensors_2b ; YES | |
5325 ;bra TFT_ppo2_sensors_2a ; NO | |
5326 | |
5327 TFT_ppo2_sensors_2a: | |
5328 ; no valid calibration | |
5329 WIN_STD dm_custom_hud_sensor2_column+.7, dm_custom_hud_row+.5 | |
5330 FONT_COLOR_MEMO ; set color | |
5331 STRCPY_PRINT "---" ; print dashes | |
5332 bra TFT_ppo2_sensors_3 ; continue with sensor 3 | |
5333 | |
5334 TFT_ppo2_sensors_2b: | |
5335 ; sensor has a valid calibration | |
5336 WIN_MEDIUM dm_custom_hud_sensor2_column,dm_custom_hud_row | |
5337 movff sensor2_ppO2,lo ; load ppO2 value into transfer storage for output | |
5338 btfsc use_O2_sensor2 ; in use? | |
5339 bra TFT_ppo2_sensors_2d ; YES | |
5340 tstfsz lo ; NO - sensor value = 0? | |
5341 bra TFT_ppo2_sensors_2c ; NO | |
5342 FONT_COLOR_ATTENTION ; YES - print in attention color | |
5343 bra TFT_ppo2_sensors_2e ; - print ppO2 value | |
5344 | |
5345 TFT_ppo2_sensors_2c: | |
5346 ; sensor has valid calibration, is not in use and has a value > 0 | |
5347 FONT_COLOR_DISABLED ; output in light blue | |
5348 bra TFT_ppo2_sensors_2e ; print ppO2 value | |
5349 | |
5350 TFT_ppo2_sensors_2d: | |
5351 ; sensor has valid calibration and is in use | |
5352 call TFT_color_code_ppo2_hud ; color-code with ppO2 [cbar] in lo | |
5353 btfsc voting_logic_sensor2 ; sensor value agrees with values of other sensors? | |
5354 bra TFT_ppo2_sensors_2e ; YES | |
5355 bsf win_invert ; NO - invert output | |
5356 ;bra TFT_ppo2_sensors_2e ; - print ppO2 value | |
5357 | |
5358 TFT_ppo2_sensors_2e: | |
5359 ; all coloring is set up now, let's write the value to the display! | |
5360 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
5361 output_256 ; print (0.00-2.55) | |
5362 PRINT ; dump to screen | |
5363 | |
5364 ; sensor 3 | |
5365 TFT_ppo2_sensors_3: | |
5366 btfsc sensor3_calibrated_ok ; valid calibration? | |
5367 bra TFT_ppo2_sensors_3b ; YES | |
5368 btfsc sensor3_active ; NO - valid HUD data for this sensor? | |
5369 bra TFT_ppo2_sensors_3b ; YES | |
5370 ;bra TFT_ppo2_sensors_3a ; NO | |
5371 | |
5372 TFT_ppo2_sensors_3a: | |
5373 WIN_STD dm_custom_hud_sensor3_column+.7, dm_custom_hud_row+.5 | |
5374 FONT_COLOR_MEMO ; set color | |
5375 STRCPY_PRINT "---" ; print dashes | |
5376 bra TFT_ppo2_sensors_4 ; done | |
5377 | |
5378 TFT_ppo2_sensors_3b: | |
5379 ; sensor has a valid calibration | |
5380 WIN_MEDIUM dm_custom_hud_sensor3_column,dm_custom_hud_row | |
5381 movff sensor3_ppO2,lo ; load ppO2 value into transfer storage for output | |
5382 btfsc use_O2_sensor3 ; in use? | |
5383 bra TFT_ppo2_sensors_3d ; YES | |
5384 tstfsz lo ; NO - sensor value = 0? | |
5385 bra TFT_ppo2_sensors_3c ; NO | |
5386 FONT_COLOR_ATTENTION ; YES - print in attention color | |
5387 bra TFT_ppo2_sensors_3e ; - print ppO2 value | |
5388 | |
5389 TFT_ppo2_sensors_3c: | |
5390 ; sensor has valid calibration, is not in use and has a value > 0 | |
5391 FONT_COLOR_DISABLED ; print in disabled color | |
5392 bra TFT_ppo2_sensors_3e ; print ppO2 value | |
5393 | |
5394 TFT_ppo2_sensors_3d: | |
5395 ; sensor has valid calibration and is in use | |
5396 call TFT_color_code_ppo2_hud ; color-code with ppO2 [cbar] in lo | |
5397 btfsc voting_logic_sensor3 ; sensor value agrees with values other sensors? | |
5398 bra TFT_ppo2_sensors_3e ; YES | |
5399 bsf win_invert ; NO - invert output | |
5400 ;bra TFT_ppo2_sensors_3e ; - print ppO2 value | |
5401 | |
5402 TFT_ppo2_sensors_3e: | |
5403 ; all coloring is set up now, let's write the value to the display! | |
5404 bsf decimal_digit2 ; place a decimal point in front of digit 2 | |
5405 output_256 ; print (0.00-2.55) | |
5406 PRINT ; dump to screen | |
5407 | |
5408 TFT_ppo2_sensors_4: | |
5409 return ; done | |
5410 | |
5411 ENDIF ; _external_sensor | |
5412 | |
5413 IFDEF _rx_functions | |
5414 | |
5415 ;----------------------------------------------------------------------------- | |
5416 ; Dive Custom View - Pressures & SAC - Mask | |
5417 ; | |
5418 global TFT_pressures_SAC_mask | |
5419 TFT_pressures_SAC_mask: | |
5420 FONT_COLOR_MASK ; select color | |
5421 | |
5422 ; pressure reading 1 | |
5423 WIN_TINY dm_custom_tankdata_pres1_col, dm_custom_tankdata_mask_row | |
5424 movff char_I_pressure_gas+0,WREG ; =0: disabled, =1..10: gases/dils | |
5425 bcf aux_flag ; selector for disabled / need set to disabled | |
5426 rcall TFT_pressures_SAC_mask_h1 ; print gas composition or " ---" if disabled | |
5427 | |
5428 ; pressure reading 2 | |
5429 WIN_TINY dm_custom_tankdata_pres2_col, dm_custom_tankdata_mask_row | |
5430 movff char_I_pressure_gas+1,WREG ; =0: need to reading 1, =1..10: gases/dils | |
5431 bsf aux_flag ; selector for disabled / need set to need | |
5432 rcall TFT_pressures_SAC_mask_h1 ; print gas composition or "Need " if 0 | |
5433 | |
5434 ; SAC rate | |
5435 WIN_TINY dm_custom_tankdata_SAC_col, dm_custom_tankdata_mask_row | |
5436 STRCPY_TEXT tSAC ; "SAC | |
5437 STRCAT " (" ; ( | |
5438 STRCAT_TEXT tLitersMinute ; l/min | |
5439 PUTC_PRINT ")" ; )" | |
5440 return ; done | |
5441 | |
5442 | |
5443 ; Helper Function - print gas composition or " ---" if disabled | |
5444 TFT_pressures_SAC_mask_h1: | |
5445 tstfsz WREG ; pressure reading assigned? | |
5446 bra TFT_pressures_SAC_mask_h2 ; YES - print gas composition | |
5447 btfsc aux_flag ; NO - check auxiliary flag | |
5448 bra TFT_pressures_SAC_mask_h3 ; 1 - print "Need " | |
5449 STRCAT_PRINT " ---" ; 0 - print " ---" | |
5450 return ; - done | |
5451 | |
5452 TFT_pressures_SAC_mask_h2: | |
5453 decf WREG,W ; (1..10) -> (0..9) | |
5454 bsf short_gas_descriptions ; just "Air", "O2" or "xx/yy" | |
5455 call gaslist_strcat_mix_WREG ; print composition of gas/dil in WREG (0..9) | |
5456 bra TFT_pressures_SAC_mask_h4 ; finish with adding "(bar)" | |
5457 | |
5458 TFT_pressures_SAC_mask_h3: | |
5459 STRCPY_TEXT tNeed ; "Need" | |
5460 ;bra TFT_pressures_SAC_mask_h4 ; finish with adding "(bar)" | |
5461 | |
5462 TFT_pressures_SAC_mask_h4: | |
5463 STRCAT_PRINT "(bar)" ; print "(bar)" | |
5464 return ; done | |
5465 | |
5466 | |
5467 ;----------------------------------------------------------------------------- | |
5468 ; Dive Custom View - Pressures & SAC - Data | |
5469 ; | |
5470 global TFT_pressures_SAC | |
5471 TFT_pressures_SAC: | |
5472 ; check mode for second reading | |
5473 bcf aux_flag ; clear auxiliary flag by default (reading 2 is pressure) | |
5474 movff char_I_pressure_gas+1,WREG ; =0: need to reading 1, =1..10: gases/dils | |
5475 addlw .0 ; dummy operation to set status register flags | |
5476 btfsc STATUS,Z ; gas selected = 0 (i.e. no 2nd pressure reading) ? | |
5477 bsf aux_flag ; YES - set auxiliary flag (display position of reading 2 shall show need to reading 1) | |
5478 ; get data of reading 1 | |
5479 movff int_IO_pressure_value+0,lo ; copy pressure 1 to hi:lo | |
5480 movff int_IO_pressure_value+1,hi ; ... | |
5481 movff char_I_pressure_stat+0,ex ; copy status data | |
5482 ; pressure of reading 1 | |
5483 WIN_STD dm_custom_tankdata_pres1_col+.4,dm_custom_tankdata_row | |
5484 rcall TFT_pressures_SAC_helper_1 ; print pressure if available, else " ---" | |
5485 ; battery status of reading 1 | |
5486 WIN_SMALL dm_custom_hud_sensor1_column+.4+.36,dm_custom_tankdata_row | |
5487 rcall TFT_pressures_SAC_helper_2 ; print or clear down arrow as low bat indicator | |
5488 ; get data for reading 2 | |
5489 btfsc aux_flag ; shall reading 2 show need to reading 1 ? | |
5490 bra TFT_pressures_SAC_1 ; YES | |
5491 movff int_IO_pressure_value+2,lo ; NO - copy pressure 2 to hi:lo | |
5492 movff int_IO_pressure_value+3,hi ; - ... | |
5493 movff char_I_pressure_stat+1,ex ; - copy status data | |
5494 bra TFT_pressures_SAC_2 ; - continue | |
5495 | |
5496 TFT_pressures_SAC_1: | |
5497 MOVII int_O_pressure_need,mpr ; copy need to pressure 1 to hi:lo | |
5498 clrf ex ; set status data to 0 | |
5499 bra TFT_pressures_SAC_2 ; continue | |
5500 | |
5501 TFT_pressures_SAC_2: | |
5502 ; pressure of reading 2 | |
5503 WIN_STD dm_custom_tankdata_pres2_col+.2,dm_custom_tankdata_row | |
5504 rcall TFT_pressures_SAC_helper_1 ; print pressure if available, else " ---" | |
5505 ; battery status of reading 2 | |
5506 WIN_SMALL dm_custom_tankdata_pres2_col+.2+.36,dm_custom_tankdata_row | |
5507 rcall TFT_pressures_SAC_helper_2 ; print or clear down arrow as low bat indicator | |
5508 | |
5509 TFT_pressures_SAC_3: | |
5510 ; SAC | |
5511 WIN_STD dm_custom_tankdata_SAC_col+.6,dm_custom_tankdata_row | |
5512 MOVII int_O_SAC_measured,mpr ; copy measured SAC rate to hi:lo | |
5513 btfsc hi,int_not_avail_flag ; SAC rate available? | |
5514 bra TFT_pressures_SAC_4 ; NO - print " --.-" | |
5515 call TFT_color_code_pres_sac ; color-code the output | |
5516 bsf decimal_digit1 ; place a decimal point in front of digit 1 | |
5517 output_999 ; print (0.0-99.9) | |
5518 PRINT ; dump to screen | |
5519 return ; done | |
5520 | |
5521 TFT_pressures_SAC_4: | |
5522 FONT_COLOR_DISABLED ; set color | |
5523 STRCAT_PRINT "--.-" ; output for no SAC data available | |
5524 return ; done | |
5525 | |
5526 | |
5527 ; Helper Function - print pressure if available, else " ---" | |
5528 TFT_pressures_SAC_helper_1: | |
5529 btfss hi,int_not_avail_flag ; pressure available? | |
5530 bra TFT_pressures_SAC_helper_1a ; YES - print pressure | |
5531 FONT_COLOR_DISABLED ; NO - use disabled color as default | |
5532 ; btfsc ex,char_transmitter_lost ; - transmitter lost? | |
5533 ; FONT_COLOR_ATTENTION ; YES - use attention color | |
5534 STRCAT_PRINT " ---" ; - print " ---" | |
0 | 5535 return |
5536 | |
634 | 5537 TFT_pressures_SAC_helper_1a: |
5538 btfsc hi,int_warning_flag ; out of range (signaled by warning flag)? | |
5539 bra TFT_pressures_SAC_helper_1c ; YES - special treatment | |
5540 call TFT_color_code_pres_sac ; NO - color-code the output | |
5541 PUTC ' ' ; - add a space | |
5542 bsf omit_digit_1 ; - do not print 1st digit (0.1 bar) | |
5543 output_999 ; - print pressure (0x-999x) | |
5544 PRINT ; - dump buffer to screen | |
5545 return ; - done | |
5546 | |
5547 TFT_pressures_SAC_helper_1c: | |
5548 call TFT_color_code_pres_sac ; color-code the output | |
5549 STRCPY_PRINT ">400" ; print ">400" | |
5550 return ; done | |
5551 | |
5552 | |
5553 ; Helper Function - print or clear down arrow as low bat indicator | |
5554 TFT_pressures_SAC_helper_2: | |
5555 btfss ex,char_transmitter_low_bat ; low battery flag set? | |
5556 bra TFT_pressures_SAC_helper_2b ; NO - clear down arrow (low bat indicator) | |
5557 ;bra TFT_pressures_SAC_helper_2a ; YES - show down arrow (low bat indicator) | |
5558 | |
5559 TFT_pressures_SAC_helper_2a: | |
5560 FONT_COLOR_ATTENTION ; use attention color | |
5561 STRCPY_PRINT "\xb8" ; print down arrow as bat low indication | |
5562 return ; done | |
5563 | |
5564 TFT_pressures_SAC_helper_2b: | |
5565 STRCPY_PRINT " " ; wipe out down arrow (low bat indicator) | |
5566 return ; done | |
5567 | |
5568 ENDIF _rx_functions | |
5569 | |
5570 IFDEF _cave_mode | |
5571 | |
5572 ;----------------------------------------------------------------------------- | |
5573 ; Dive Custom View - Cave Mode TTS, total Stops and Run Time - Mask | |
5574 ; | |
5575 | |
5576 global TFT_cave_tts_mask | |
5577 TFT_cave_tts_mask: | |
5578 FONT_COLOR_MASK ; select color | |
5579 | |
5580 WIN_TINY dm_custom_cave_title_column1,dm_custom_cave_title_row | |
5581 STRCPY_TEXT_PRINT tCaveStops ; print label | |
5582 | |
5583 WIN_TINY dm_custom_cave_title_column2,dm_custom_cave_title_row | |
5584 STRCPY_TEXT_PRINT tCaveTTS ; print label | |
5585 | |
5586 WIN_TINY dm_custom_cave_title_column3,dm_custom_cave_title_row | |
5587 STRCPY_TEXT_PRINT tCaveRuntime ; print label | |
5588 | |
5589 return ; done | |
5590 | |
5591 | |
5592 ;----------------------------------------------------------------------------- | |
5593 ; Dive Custom View - Cave Mode TTS, total Stops and Run Time - Data | |
5594 ; | |
5595 global TFT_cave_tts | |
5596 TFT_cave_tts: | |
5597 ; total time of all stops | |
5598 WIN_MEDIUM dm_custom_cave_data_column1,dm_custom_cave_data_row | |
5599 FONT_COLOR_MEMO ; set default color | |
5600 btfss cave_mode ; cave mode switched on? | |
5601 bra TFT_cave_1b ; NO - print dashes | |
5602 MOVII int_O_TST_norm,mpr ; YES - get normal plan total stops time | |
5603 btfss mpr+1,int_not_yet_computed ; - not yet computed? | |
5604 bra TFT_cave_1a ; NO - continue | |
5605 FONT_COLOR_DISABLED ; YES - switch to disabled color | |
5606 bra TFT_cave_1b ; - print dashes | |
5607 | |
5608 TFT_cave_1a: | |
5609 btfsc mpr+1,int_invalid_flag ; stops time invalid? | |
5610 FONT_COLOR_DISABLED ; YES - switch to disabled color | |
5611 bcf mpr+1,int_invalid_flag ; clear invalid flag if applicable | |
5612 movf mpr+0,W ; copy low byte of stops time to WREG | |
5613 iorwf mpr+1,W ; ior with high byte of stops time | |
5614 bz TFT_cave_1b ; print dashes if stops time is zero | |
5615 output_999 ; print (0-999) | |
5616 PUTC_PRINT "'" ; append unit and dump to screen | |
5617 bra TFT_cave_2 ; continue | |
5618 | |
5619 TFT_cave_1b: | |
5620 STRCAT_PRINT ",-,-,-," ; print 3 dashes (',' produces a half-width space) | |
5621 ;bra TFT_cave_2 ; continue | |
5622 | |
5623 TFT_cave_2: | |
5624 ; cave TTS | |
5625 WIN_MEDIUM dm_custom_cave_data_column2,dm_custom_cave_data_row ; column 60 | |
5626 FONT_COLOR_MEMO ; set default color | |
5627 btfsS cave_mode ; cave mode switched on? | |
5628 bra TFT_cave_2b ; NO - print dashes | |
5629 MOVII int_O_TTS_norm,mpr ; YES - get normal plan total time to surface | |
5630 btfss mpr+1,int_not_yet_computed ; - not yet computed? | |
5631 bra TFT_cave_2a ; NO - continue | |
5632 FONT_COLOR_DISABLED ; YES - switch to disabled color | |
5633 bra TFT_cave_2b ; - print dashes | |
5634 | |
5635 TFT_cave_2a: | |
5636 btfsc mpr+1,int_invalid_flag ; TTS invalid? | |
5637 FONT_COLOR_DISABLED ; YES - switch to disabled color | |
5638 bcf mpr+1,int_invalid_flag ; clear invalid flag if applicable | |
5639 output_999 ; print (0-999) | |
5640 PUTC_PRINT "'" ; append unit and dump to screen | |
5641 bra TFT_cave_3 ; continue | |
5642 | |
5643 TFT_cave_2b: | |
5644 STRCAT_PRINT ",-,-,-," ; print 3 dashes (',' produces a half-width space) | |
5645 ;bra TFT_cave_3 ; continue | |
5646 | |
5647 TFT_cave_3: | |
5648 ; estimated total runtime | |
5649 WIN_MEDIUM dm_custom_cave_data_column3,dm_custom_cave_data_row | |
5650 ; ; keep color from cave TTS | |
5651 btfss cave_mode ; cave mode switched on? | |
5652 bra TFT_cave_3b ; NO - print dashes | |
5653 SMOVII counted_divetime_mins,mpr ; YES - ISR safe copy of counted dive time to MPR | |
5654 movff int_O_TTS_norm+0,WREG ; - get TTS, low byte, into WREG | |
5655 addwf mpr+0,F ; - add TTS, low byte, to dive time in MPR | |
5656 movff int_O_TTS_norm+1,WREG ; - get TTS, high byte, into WREG | |
5657 btfsc WREG,int_not_yet_computed ; - not yet computed? | |
5658 bra TFT_cave_3b ; YES - print dashes | |
5659 bcf WREG,int_invalid_flag ; NO - clear invalid flag if applicable | |
5660 addwfc mpr+1,F ; - add TTS, high byte, to dive time in MPR | |
5661 output_999 ; - print (0-999) | |
5662 PUTC_PRINT "'" ; - append unit and dump to screen | |
5663 return ; - done | |
5664 | |
5665 TFT_cave_3b: | |
5666 STRCAT_PRINT ",-,-,-," ; print 3 dashes (',' produces a half-width space) | |
5667 return ; done | |
5668 | |
5669 | |
5670 ;----------------------------------------------------------------------------- | |
5671 ; Dive Custom View - Cave Mode Waypoints | |
5672 ; | |
5673 global TFT_cave_waypoints | |
5674 TFT_cave_waypoints: | |
5675 ; arrow | |
5676 WIN_TINY .70,dm_custom_cave_title_row | |
5677 FONT_COLOR_ATTENTION ; select color | |
5678 btfss cave_mode ; cave mode switched on? | |
5679 bra TFT_cave_waypoints_3 ; NO - do not show any marker (any more) | |
5680 btfsc dive_turned ; YES - dive turned? | |
5681 bra TFT_cave_waypoints_2 ; YES - print marker in the middle | |
5682 ;bra TFT_cave_waypoints_1 ; NO - print marker on right side | |
5683 | |
5684 TFT_cave_waypoints_1: | |
5685 movlw .12 ; start with 12 space chars | |
5686 call TFT_buffer_trim_length ; fill / cut buffer to target length | |
5687 ;bra TFT_cave_waypoints_2 ; continue | |
5688 | |
5689 TFT_cave_waypoints_2: | |
5690 STRCAT "<=====" ; print marker symbol | |
5691 ;bra TFT_cave_waypoints_3 ; continue | |
5692 | |
5693 TFT_cave_waypoints_3: | |
5694 movlw .18 ; set overall number of chars | |
5695 call TFT_buffer_trim_length ; fill / cut buffer to target length | |
5696 PRINT ; dump buffer to screen | |
5697 ; waypoint band | |
5698 btfsc cave_mode ; cave mode switched on? | |
5699 bra TFT_cave_waypoints_4 ; YES - show graphics | |
5700 WIN_STD .0,dm_custom_cave_data_row ; NO - show "Cave Mode off" text | |
5701 FONT_COLOR_ATTENTION ; - select attention color | |
5702 PUTC " " ; - print 2 space chars | |
5703 PUTC " " ; - ... | |
5704 STRCAT_TEXT tCaveMode ; - print "Cave Mode" | |
5705 PUTC " " ; - print 1 space char | |
5706 STRCAT_TEXT tOff ; - print "off" | |
5707 movlw .17 ; - set max number of chars | |
5708 call TFT_buffer_trim_length ; - fill / cut buffer to target length | |
5709 PRINT ; - dump buffer to screen | |
5710 return ; - done | |
5711 | |
5712 TFT_cave_waypoints_4: | |
5713 WIN_MEDIUM .0,dm_custom_cave_data_row; start in column 0 | |
5714 FONT_COLOR_MEMO ; select default color | |
5715 tstfsz DM_flags_cavereq ; any pending cave mode requests? | |
5716 FONT_COLOR_DISABLED ; YES - switch to disabled color | |
5717 ; 1st section: previous waypoint number or beginning line | |
5718 movlw .1 ; load a one into WREG | |
5719 cpfsgt backtrack_waypoint_num ; current waypoint number > 1 ? | |
5720 bra TFT_cave_waypoints_5 ; NO - print line segment only | |
5721 STRCAT ",-," ; YES - print one dash | |
5722 movff backtrack_waypoint_num,lo ; - copy current waypoint number to lo | |
5723 decf lo,F ; - create previous waypoint number | |
5724 output_99 ; - print previous waypoint number in two digit format | |
5725 STRCAT "," ; - print a half-space | |
5726 bra TFT_cave_waypoints_6 ; - continue with next section | |
5727 | |
5728 TFT_cave_waypoints_5: | |
5729 STRCAT ",-,-----" ; print line segment | |
5730 ;bra TFT_cave_waypoints_6 ; continue with next section | |
5731 | |
5732 TFT_cave_waypoints_6: | |
5733 ; 2nd section: solid line | |
5734 STRCAT "---" ; print a solid line | |
5735 ; 3rd section: current waypoint number, turn point symbol or line segment | |
5736 tstfsz backtrack_waypoint_num ; does a current waypoint exist? | |
5737 bra TFT_cave_waypoints_8 ; YES - print its number or the turn point symbol | |
5738 btfss dive_turned ; NO - dive turned? | |
5739 bra TFT_cave_waypoints_7 ; NO - print a separated line segment | |
5740 STRCAT "------" ; YES - print a continuous line | |
5741 bra TFT_cave_waypoints_10 ; - continue with next section | |
5742 | |
5743 TFT_cave_waypoints_7: | |
5744 STRCAT ",----," ; print a separated line segment | |
5745 bra TFT_cave_waypoints_10 ; continue with next section | |
5746 | |
5747 TFT_cave_waypoints_8: | |
5748 STRCAT "," ; print a half-width space | |
5749 movff backtrack_waypoint_num,lo ; copy current waypoint number to lo | |
5750 movf backtrack_waypoint_turn,W ; copy turn point number to WREG | |
5751 cpfseq lo ; current waypoint = turn point ? | |
5752 bra TFT_cave_waypoints_9 ; NO - show waypoint number | |
5753 STRCAT_PRINT "--|, " ; YES - print end-of-line symbol, clear remaining output and dump buffer to screen | |
5754 return ; - done | |
5755 | |
5756 TFT_cave_waypoints_9: | |
5757 movff backtrack_waypoint_num,lo ; copy current waypoint number to lo | |
5758 output_99 ; print current waypoint number in two digit format | |
5759 STRCAT "," ; print a half-space | |
5760 ;bra TFT_cave_waypoints_10 ; continue with next section | |
5761 | |
5762 TFT_cave_waypoints_10: | |
5763 ; 4th section: solid line | |
5764 STRCAT "---" ; print a solid line | |
5765 ; 5th section: next waypoint number or end of line symbol | |
5766 incf backtrack_waypoint_num,W ; load WREG with next waypoint number | |
5767 cpfseq backtrack_waypoint_turn ; next waypoint number = turn point number ? | |
5768 btfsc waypoint_reached_last ; NO - is the current waypoint the last waypoint? | |
5769 bra TFT_cave_waypoints_11 ; YES / YES - print end-of-line symbol | |
5770 STRCAT "," ; NO - print a half-space | |
5771 incf backtrack_waypoint_num,W ; - (re)load WREG with next waypoint number | |
5772 movwf lo ; NO - copy next waypoint number to lo | |
5773 output_99 ; - print next waypoint number in two digit format | |
5774 PRINT ; - dump buffer to screen | |
5775 return ; - done | |
5776 | |
5777 TFT_cave_waypoints_11: | |
5778 STRCAT_PRINT "---|," ; print end-of-line symbol and dump buffer to screen | |
5779 return ; done | |
5780 | |
5781 ENDIF ; _cave_mode | |
5782 | |
631 | 5783 |
560 | 5784 ;============================================================================= |
634 | 5785 tft_out15 CODE |
5786 ;============================================================================= | |
5787 | |
5788 | |
5789 ;----------------------------------------------------------------------------- | |
5790 ; Helper Function - check if firmware is within expiry period | |
5791 ; | |
5792 ; Output: aux_flag set if not | |
5793 ; | |
5794 check_expiry: | |
5795 SMOVSS rtc_year,rtc_latched_year ; ISR-safe 6 byte copy of date and time | |
5796 movff rtc_latched_day,lo ; get current day | |
5797 movff rtc_latched_month,hi ; get current month | |
5798 movff rtc_latched_year,up ; get current year | |
5799 bsf aux_flag ; set firmware as expired by default | |
5800 movlw firmware_expire_year ; start with checking year | |
5801 cpfsgt up ; current year > expiry year ? | |
5802 bra check_expiry_Y ; NO - continue checks | |
5803 return ; YES - expired | |
5804 | |
5805 check_expiry_Y: | |
5806 cpfseq up ; current year = expiry year ? | |
5807 bra check_expiry_ok ; NO - must be < then, OK whatever month & day | |
5808 movlw firmware_expire_month ; YES - continue checking month | |
5809 cpfsgt hi ; current month > expiry month ? | |
5810 bra check_expiry_M ; NO - continue checks | |
5811 return ; YES - expired | |
5812 | |
5813 check_expiry_M: | |
5814 cpfseq hi ; current month = expiry month ? | |
5815 bra check_expiry_ok ; NO - must be < then, OK whatever day | |
5816 movlw firmware_expire_day ; YES - continue checking day | |
5817 cpfsgt lo ; current day > expiry day ? | |
5818 bra check_expiry_ok ; NO - must be <= then, OK | |
5819 return ; YES - expired | |
5820 | |
5821 check_expiry_ok: | |
5822 bcf aux_flag ; not expired | |
5823 return ; done | |
5824 | |
5825 | |
5826 ;----------------------------------------------------------------------------- | |
5827 ; show Firmware updated Message | |
5828 ; | |
5829 ; Attention: | |
5830 ; Pallet colors and language switching are not | |
5831 ; available yet, all text outputs are hard-coded! | |
5832 ; | |
5833 global TFT_message_fw_update | |
5834 TFT_message_fw_update: | |
5835 FONT_COLOR_STANDARD ; set color | |
5836 | |
5837 ; show update message | |
5838 WIN_SMALL .20,.100 ; set position | |
5839 STRCPY_PRINT "Update successful!" ; print message | |
5840 | |
5841 ; show firmware version | |
5842 WIN_SMALL .20,.140 ; set position | |
5843 STRCPY "New Firmware: " ; print message | |
5844 | |
5845 bra TFT_message_fw_common ; show firmware version | |
5846 | |
5847 | |
5848 ;----------------------------------------------------------------------------- | |
5849 ; show Firmware kept Message | |
5850 ; | |
5851 ; Attention: | |
5852 ; Pallet colors and language switching are not | |
5853 ; available yet, all text outputs are hard-coded! | |
5854 ; | |
5855 global TFT_message_fw_kept | |
5856 TFT_message_fw_kept: | |
5857 FONT_COLOR_STANDARD ; set color | |
5858 | |
5859 ; show reboot message | |
5860 WIN_SMALL .60,.100 ; set position | |
5861 STRCPY_PRINT "Reboot" ; print message | |
5862 | |
5863 ; show firmware version | |
5864 WIN_SMALL .30,.140 ; set position | |
5865 STRCPY "Firmware: " ; print message | |
5866 | |
5867 ;bra TFT_message_fw_common ; show firmware version | |
5868 | |
5869 | |
5870 ; Helper Function - show firmware version x.y and color-code + invert if outdated | |
5871 TFT_message_fw_common: | |
5872 rcall TFT_cat_firmware ; append major/minor and color-code on expiry | |
5873 PRINT ; dump to screen | |
5874 ; show firmware beta status | |
5875 WIN_SMALL .60,.180 | |
5876 FONT_COLOR_STANDARD ; set default color for a release version | |
5877 rcall TFT_cat_beta_long ; show "Release" or "BETA" + issue | |
5878 PRINT ; dump to screen | |
5879 return ; done | |
5880 | |
5881 | |
5882 ;----------------------------------------------------------------------------- | |
5883 ; append Firmware Version to current String, including color-coding on expiry | |
5884 ; | |
5885 global TFT_cat_firmware | |
5886 TFT_cat_firmware: | |
5887 movlw fw_version_major ; get major | |
5888 movwf lo ; ... | |
5889 bsf leftbind ; print left-aligned | |
5890 output_99 ; print major (0-99) | |
5891 PUTC '.' ; print a dot | |
5892 movlw fw_version_minor ; get minor | |
5893 movwf lo ; ... | |
5894 output_99x ; print minor in two digit format | |
5895 rcall check_expiry ; check if firmware is expired | |
5896 btfss aux_flag ; expired? | |
5897 return ; NO | |
5898 bsf win_invert ; YES - print in inverse | |
5899 FONT_COLOR color_yellow ; - print in yellow | |
5900 return ; - done | |
5901 | |
5902 | |
5903 ;----------------------------------------------------------------------------- | |
5904 ; append Firmware BETA Status to current String, including color-coding on BETA | |
5905 ; | |
5906 global TFT_cat_beta_long | |
5907 TFT_cat_beta_long: | |
5908 bsf aux_flag ; do long version | |
5909 bra TFT_cat_beta_common ; continue with common part | |
5910 | |
5911 global TFT_cat_beta_short | |
5912 TFT_cat_beta_short: | |
5913 bcf aux_flag ; do short version | |
5914 ;bra TFT_cat_beta_common ; continue with common part | |
5915 | |
5916 TFT_cat_beta_common: | |
5917 | |
5918 IFDEF _DEBUG | |
5919 | |
5920 FONT_COLOR color_red ; set color | |
5921 btfss aux_flag ; shall show long version? | |
5922 bra TFT_cat_debug_short ; NO - show short version | |
5923 ;bra TFT_cat_debug_long ; YES - show long version | |
5924 | |
5925 TFT_cat_debug_long: | |
5926 STRCAT "DEBUG" ; print long debug | |
5927 return ; done | |
5928 | |
5929 TFT_cat_debug_short: | |
5930 STRCAT "DBG." ; print short debug | |
5931 return ; done | |
5932 | |
5933 ELSE | |
5934 | |
5935 movlw fw_version_beta ; =0: release, =1: beta 1, =2: beta 2, ... | |
5936 movwf lo ; copy to lo | |
5937 tstfsz lo ; release version? | |
5938 bra TFT_cat_beta_com ; NO - must be beta version then | |
5939 btfss aux_flag ; YES - shall show long version? | |
5940 bra TFT_cat_beta_rel_short ; NO - show short version | |
5941 rcall check_expiry ; YES - check expiry date | |
5942 btfsc aux_flag ; - within expiry date? | |
5943 bra TFT_cat_beta_update ; NO - give update cue | |
5944 ;bra TFT_cat_beta_rel_long ; YES - "Release" | |
5945 | |
5946 TFT_cat_beta_rel_long: | |
5947 STRCAT "Release" ; print long "Release" | |
5948 return ; done | |
5949 | |
5950 TFT_cat_beta_rel_short: | |
5951 STRCAT "Rel." ; print short "Release" | |
5952 return ; done | |
5953 | |
5954 TFT_cat_beta_com: | |
5955 FONT_COLOR color_yellow ; set color | |
5956 btfss aux_flag ; shall show long version? | |
5957 bra TFT_cat_beta_short_exec ; NO - show short version | |
5958 ;bra TFT_cat_beta_long_exec ; YES - show long version | |
5959 | |
5960 TFT_cat_beta_long_exec: | |
5961 STRCAT "Beta " ; print long "Beta" | |
5962 bra TFT_cat_beta_version ; print version | |
5963 | |
5964 TFT_cat_beta_short_exec: | |
5965 STRCAT "B." ; print short "Beta" | |
5966 ;bra TFT_cat_beta_version ; append beta version number | |
5967 | |
5968 TFT_cat_beta_version: | |
5969 bsf leftbind ; print left-aligned | |
5970 output_256 ; print beta version number (0-255) | |
5971 return ; done | |
5972 | |
5973 TFT_cat_beta_update: | |
5974 FONT_COLOR color_yellow | |
5975 STRCAT "update!" ; print update cue | |
5976 return ; done | |
5977 | |
5978 ENDIF | |
5979 | |
5980 | |
5981 ;----------------------------------------------------------------------------- | |
5982 ; append Serial Number to to current String | |
5983 ; | |
5984 global TFT_cat_serial | |
5985 TFT_cat_serial: | |
5986 call eeprom_serial_number_read ; read OSTC serial number | |
5987 bsf leftbind ; print left-aligned | |
5988 output_65535 ; print serial number | |
5989 return ; done | |
5990 | |
5991 | |
5992 ;----------------------------------------------------------------------------- | |
5993 ; print Serial Number and Firmware Version (used by comm mode) | |
5994 ; | |
5995 global TFT_print_serial_and_firmware | |
5996 TFT_print_serial_and_firmware: | |
5997 STRCPY "#" ; print "#" | |
5998 rcall TFT_cat_serial ; print serial number | |
5999 STRCAT " " ; print a space | |
6000 STRCAT "v" ; print a "v" (version) | |
6001 ;bra TFT_print_firmware ; print firmware version | |
6002 | |
6003 | |
6004 ;----------------------------------------------------------------------------- | |
6005 ; print Firmware Version | |
6006 ; | |
6007 global TFT_print_firmware | |
6008 TFT_print_firmware: | |
6009 rcall TFT_cat_firmware ; print firmware major/minor, will set win_invert if outdated | |
6010 STRCAT " " ; print a space | |
6011 rcall TFT_cat_beta_long ; print release/beta and update notification if expired | |
6012 PRINT ; dump to screen | |
6013 return ; done | |
6014 | |
6015 | |
6016 ;----------------------------------------------------------------------------- | |
6017 ; print Deco Type (OC, CCR, ...) | |
6018 ; | |
6019 ; Input: lo deco type number: 0=OC, 1=CCR, 2=Gauge, 3=Apnea, 4=pSCR | |
6020 ; | |
6021 global TFT_print_decotype | |
6022 TFT_print_decotype: | |
6023 bsf aux_flag ; default to dive with deco calculation (used by logbook) | |
6024 incf lo,W ; WREG = lo + 1 | |
6025 TFT_print_decotype_1 | |
6026 decfsz WREG,W ; in OC mode? | |
6027 bra TFT_print_decotype_2 ; NO - try next | |
6028 STRCAT_TEXT_PRINT tDvOC ; YES - print "OC" | |
6029 return ; - done | |
6030 TFT_print_decotype_2: | |
6031 decfsz WREG,W ; in CCR mode? | |
6032 bra TFT_print_decotype_3 ; NO - try next | |
6033 STRCAT_TEXT_PRINT tDvCC ; YES - print "CCR" | |
6034 return ; - done | |
6035 TFT_print_decotype_3: | |
6036 decfsz WREG,W ; in gauge mode? | |
6037 bra TFT_print_decotype_4 ; NO - try next | |
6038 bcf aux_flag ; YES - dive without deco data | |
6039 STRCAT_TEXT_PRINT tDvGauge ; - Print "Gauge" | |
6040 return ; - done | |
6041 TFT_print_decotype_4: | |
6042 decfsz WREG,W ; in apnea mode? | |
6043 bra TFT_print_decotype_5 ; NO - try next | |
6044 bcf aux_flag ; YES - dive without deco data | |
6045 STRCAT_TEXT_PRINT tDvApnea ; - print "Apnoe" | |
6046 return ; - done | |
6047 TFT_print_decotype_5: | |
6048 STRCAT_TEXT_PRINT tDvPSCR ; print "pSCR" | |
6049 return ; done | |
6050 | |
560 | 6051 |
480
ad8acade5567
NEW: PSCR mode (Passive semi-closed rebreather)
heinrichsweikamp
parents:
477
diff
changeset
|
6052 ;============================================================================= |
634 | 6053 tft_out16 CODE |
6054 ;============================================================================= | |
6055 | |
6056 global TFT_debug_output | |
6057 TFT_debug_output: | |
6058 | |
6059 IFNDEF _debug_output | |
6060 | |
6061 return ; do nothing | |
6062 | |
6063 ELSE | |
6064 | |
640 | 6065 ; btfsc alt_layout_active ; alternative layout active? |
6066 ; return ; YES - abort | |
634 | 6067 |
636 | 6068 WIN_TINY .100,.30 ; surface mode: fits under the textual logo in the upper right corner |
634 | 6069 ; WIN_TINY .35, .0 ; dive mode: fits to the right side of the depth label |
636 | 6070 ; WIN_TINY .0, . 0 ; dive mode: overwrites depth label |
634 | 6071 FONT_COLOR_MEMO ; set color |
640 | 6072 |
645 | 6073 movff ambient_light+0,lo |
643 | 6074 output_256 |
6075 PUTC "," | |
645 | 6076 movff ambient_light+0,lo |
6077 movff ambient_light+1,hi | |
643 | 6078 output_65535 |
6079 | |
6080 | |
640 | 6081 |
6082 ; ; deco engine scheduling performance | |
6083 ; MOVII int_O_profiling_overrun,mpr ; runtime +/- versus target | |
6084 ; btfss mpr+1,7 ; overrun? | |
6085 ; bra TFT_debug_output_1 ; YES | |
6086 ; bcf mpr+1,7 ; NO - clear flag | |
6087 ; PUTC "-" ; - print a minus | |
6088 ; bra TFT_debug_output_2 ; - continue | |
6089 ;TFT_debug_output_1: | |
6090 ; PUTC " " ; print a space instead of the minus | |
6091 ;TFT_debug_output_2: | |
6092 ; output_999 ; print time (0-999) | |
6093 ; PUTC "." ; print a dot as separator | |
6094 ; MOVII int_O_profiling_overrun_max,mpr ; get max runtime so far | |
6095 ; output_999 ; print (0-999) | |
6096 ; PUTC "." ; print a dot as separator | |
6097 ; movff char_O_profiling_overrun_phase,WREG ; get calculation phase causing the max runtime | |
6098 ; output_hex ; print a hex | |
6099 ; PUTC "." ; print a dot as separator | |
6100 ; movff char_O_profiling_runs_norm,mpr ; get runs/cycle normal plan | |
6101 ; output_99 ; print (0-99) | |
6102 ; PUTC "." ; print a dot as separator | |
6103 ; movff char_O_profiling_runs_alt,mpr ; get runs/cycle alternative plan | |
6104 ; output_99 ; print (0-99) | |
634 | 6105 PRINT ; dump to screen |
6106 return ; done | |
6107 | |
6108 ENDIF ; _debug_output | |
6109 | |
6110 ;----------------------------------------------------------------------------- | |
6111 | |
6112 END |