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