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