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