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