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