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