0
|
1 ;=============================================================================
|
|
2 ;
|
|
3 ; File tft_outputs.asm
|
|
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
|
|
12 #include "ostc3.inc" ; Mandatory header
|
|
13 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c
|
|
14 #include "tft.inc"
|
|
15 #include "wait.inc"
|
|
16 #include "strings.inc"
|
|
17 #include "convert.inc"
|
|
18 #include "varargs.inc"
|
|
19 #include "math.inc"
|
|
20 #include "isr.inc"
|
|
21 #include "eeprom_rs232.inc"
|
|
22 #include "adc_lightsensor.inc"
|
|
23 #include "surfmode.inc"
|
|
24 #include "divemode.inc"
|
|
25 #include "external_flash.inc"
|
|
26 #include "ghostwriter.inc"
|
|
27 #include "customview.inc"
|
|
28 #include "i2c.inc"
|
|
29
|
|
30 extern aa_wordprocessor
|
|
31
|
|
32 ;=============================================================================
|
|
33
|
|
34 gui CODE
|
|
35 ;=============================================================================
|
|
36
|
|
37 global TFT_divemask_color
|
|
38 TFT_divemask_color:
|
|
39 movlw color_green ; TODO
|
|
40 bra TFT_standard_color0
|
|
41
|
|
42 global TFT_warnings_color
|
|
43 TFT_warnings_color:
|
|
44 movlw color_red ; TODO
|
|
45 bra TFT_standard_color0
|
|
46
|
|
47 global TFT_disabled_color
|
|
48 TFT_disabled_color:
|
|
49 movlw color_grey ; Default to OSTC grey (dark blue)
|
|
50 bra TFT_standard_color0
|
|
51
|
|
52 global TFT_standard_color
|
|
53 TFT_standard_color:
|
|
54 setf WREG ; TODO...
|
|
55 TFT_standard_color0:
|
|
56 call TFT_set_color
|
|
57 return
|
|
58
|
|
59 TFT_color_code macro color_code_temp
|
|
60 movlw color_code_temp
|
|
61 call TFT_color_code1
|
|
62 endm
|
|
63
|
|
64 global TFT_color_code1
|
|
65 TFT_color_code1: ; Color-codes the output, if required
|
|
66 dcfsnz WREG
|
|
67 bra TFT_color_code_depth ; depth_warn_mbar [mbar], 16Bit
|
|
68 dcfsnz WREG
|
|
69 bra TFT_color_code_cns ; color_code_cns_high [%]
|
|
70 dcfsnz WREG
|
|
71 bra TFT_color_code_gf ; color_code_gf_warn_high [%]
|
|
72 dcfsnz WREG
|
|
73 bra TFT_color_code_ppo2 ; Color-code the OC ppO2 results [cbar], opt_ppO2_max as threshold
|
|
74 dcfsnz WREG
|
|
75 bra TFT_color_code_velocity ; color_code_velocity_warn_high [m/min]
|
|
76 dcfsnz WREG
|
|
77 bra TFT_color_code_ceiling ; Show warning if current depth>shown ceiling
|
|
78 dcfsnz WREG
|
|
79 bra TFT_color_code_gaslist ; Color-code current row in Gaslist (%O2 in hi), opt_ppO2_max as threshold
|
|
80 dcfsnz WREG
|
|
81 bra TFT_color_code_ppo2_hud ; Color-code the hud ppO2 readings [cbar], opt_ppO2_max as threshold
|
|
82 dcfsnz WREG
|
|
83 bra TFT_color_code_battery ; Color-code the battery display
|
|
84
|
|
85 TFT_color_code_gaslist: ; %O2 in hi
|
|
86 ; Check very high ppO2 manually
|
|
87 SAFE_2BYTE_COPY amb_pressure,xA
|
|
88 movlw d'10'
|
|
89 movwf xB+0
|
|
90 clrf xB+1
|
|
91 call div16x16 ; xC=p_amb/10
|
|
92 movff xC+0,xA+0
|
|
93 movff xC+1,xA+1
|
|
94 movff hi,xB+0
|
|
95 clrf xB+1
|
|
96 call mult16x16 ; lo * p_amb/10
|
|
97 ; Check if ppO2>6,55bar
|
|
98 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar?
|
|
99 bra TFT_color_code_warn ; Yes, warn in warning color
|
|
100 ; Check if ppO2>3,30bar
|
|
101 btfsc xC+1,7
|
|
102 bra TFT_color_code_warn ; Yes, warn in warning color
|
|
103
|
|
104 ; Check for low ppo2
|
|
105 movff xC+0,sub_a+0
|
|
106 movff xC+1,sub_a+1
|
|
107 movff opt_ppO2_min,WREG
|
|
108 mullw d'100' ; opt_ppO2_min*100
|
|
109 movff PRODL,sub_b+0
|
|
110 movff PRODH,sub_b+1
|
|
111 call subU16
|
|
112 btfsc neg_flag
|
|
113 bra TFT_color_code_warn ; too low -> Warning Color!
|
|
114
|
|
115 ; Check for high ppo2
|
|
116 movff opt_ppO2_max,WREG ; PPO2 Max for MOD calculation and color coding in divemode
|
|
117 mullw d'100' ; opt_ppO2_max*100
|
|
118 movff PRODL,sub_b+0
|
|
119 movff PRODH,sub_b+1
|
|
120 call subU16 ; sub_c = sub_a - sub_b
|
|
121 btfss neg_flag
|
|
122 bra TFT_color_code_warn ; too high -> Warning Color!
|
|
123 return
|
|
124
|
|
125 TFT_color_code_warn:
|
|
126 call TFT_warnings_color
|
|
127 return
|
|
128
|
|
129 TFT_color_code_ceiling:
|
|
130 SAFE_2BYTE_COPY rel_pressure, lo
|
|
131 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
|
|
132 movff hi,xA+1
|
|
133 movff lo,xA+0
|
|
134 movff char_O_first_deco_depth,lo ; Ceiling in m
|
|
135 decf lo,F ; -1
|
|
136 movlw LOW d'100'
|
|
137 movwf xB+0
|
|
138 clrf xB+1 ; Devide/100 -> xC+0 = Depth in m
|
|
139 call div16x16 ; xA/xB=xC with xA as remainder
|
|
140 movf xC+0,W ; Depth in m
|
|
141 subwf lo,W
|
|
142 btfsc STATUS,C
|
|
143 bra TFT_color_code_warn ; Set to warning color
|
|
144 call TFT_standard_color
|
|
145 return
|
|
146
|
|
147 TFT_color_code_depth:
|
|
148 movff hi,hi_temp
|
|
149 movff lo,lo_temp
|
|
150 SAFE_2BYTE_COPY rel_pressure, lo
|
|
151 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
|
|
152 movff lo,sub_a+0
|
|
153 movff hi,sub_a+1
|
|
154 movlw LOW depth_warn_mbar
|
|
155 movwf lo
|
|
156 movlw HIGH depth_warn_mbar
|
|
157 movwf hi
|
|
158 movff lo,sub_b+0
|
|
159 movff hi,sub_b+1
|
|
160 movff hi_temp,hi
|
|
161 movff lo_temp,lo ; Restore hi, lo
|
|
162 call subU16 ; sub_c = sub_a - sub_b
|
|
163 btfss neg_flag
|
|
164 bra TFT_color_code_warn ; Set to warning color
|
|
165 call TFT_standard_color
|
|
166 return
|
|
167
|
|
168 TFT_color_code_cns:
|
|
169 movff int_O_CNS_fraction+1,lo ; copy into bank1
|
|
170 tstfsz lo ; >255% ?
|
|
171 bra TFT_color_code_warn ; Yes
|
|
172 movff int_O_CNS_fraction+0,lo
|
|
173 movlw color_code_cns_high ; CNS Warn [%]
|
|
174 subwf lo,W
|
|
175 btfsc STATUS,C
|
|
176 bra TFT_color_code_warn ; Set to warning color
|
|
177 call TFT_standard_color
|
|
178 return
|
|
179
|
|
180 TFT_color_code_gf:
|
|
181 movff char_O_gradient_factor,lo ; gradient factor
|
|
182 movlw color_code_gf_warn_high ; GF Warn [%]
|
|
183 subwf lo,W
|
|
184 btfsc STATUS,C
|
|
185 bra TFT_color_code_warn ; Set to warning color
|
|
186 call TFT_standard_color
|
|
187 return
|
|
188
|
|
189 TFT_color_code_ppo2:
|
|
190 ; Check if ppO2>6,55bar
|
|
191 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar?
|
|
192 bra TFT_color_code_warn ; Yes, warn in warning color
|
|
193 ; Check if ppO2>3,30bar
|
|
194 btfsc xC+1,7
|
|
195 bra TFT_color_code_warn ; Yes, warn in warning color
|
|
196
|
|
197 movff xC+0,sub_a+0
|
|
198 movff xC+1,sub_a+1
|
|
199 movff opt_ppO2_max,WREG ; PPO2 Max for MOD calculation and color coding in divemode
|
|
200 mullw d'100'
|
|
201 movff PRODL,sub_b+0
|
|
202 movff PRODH,sub_b+1
|
|
203 call subU16 ; sub_c = sub_a - sub_b
|
|
204 btfss neg_flag
|
|
205 bra TFT_color_code_warn ; Set to warning color
|
|
206
|
|
207 movff xC+0,sub_a+0
|
|
208 movff xC+1,sub_a+1
|
|
209 movff opt_ppO2_min,WREG ; PPO2 min for Sensors and color coding in divemode
|
|
210 mullw d'100'
|
|
211 movff PRODL,sub_b+0
|
|
212 movff PRODH,sub_b+1
|
|
213 call subU16 ; sub_c = sub_a - sub_b
|
|
214 btfsc neg_flag
|
|
215 bra TFT_color_code_warn ; Set to warning color
|
|
216 call TFT_standard_color
|
|
217 return
|
|
218
|
|
219 TFT_color_code_velocity:
|
|
220 btfss neg_flag ; Ignore for descend!
|
|
221 bra TFT_color_code_velocity1 ; Skip check!
|
|
222 movff divA+0,lo
|
|
223 movlw color_code_velocity_warn_high ; Velocity warn [m/min]
|
|
224 subwf lo,W
|
|
225 btfsc STATUS,C
|
|
226 bra TFT_color_code_warn ; Set to warning color
|
|
227 TFT_color_code_velocity1:
|
|
228 call TFT_standard_color
|
|
229 return
|
|
230
|
|
231 TFT_color_code_ppo2_hud: ; With ppO2 [cbar] in lo
|
|
232 movff opt_ppO2_max,WREG ; PPO2 Max for MOD calculation and color coding in divemode
|
|
233 cpfsgt lo ; lo > opt_ppO2_max?
|
|
234 bra TFT_color_code_ppo2_hud1; No
|
|
235 bra TFT_color_code_warn ; Yes
|
|
236 TFT_color_code_ppo2_hud1:
|
|
237 movff opt_ppO2_min,WREG ; PPO2 min for Sensors and color coding in divemode
|
|
238 cpfslt lo ; lo < opt_ppO2_min?
|
|
239 bra TFT_color_code_ppo2_hud2; No
|
|
240 bra TFT_color_code_warn ; Yes
|
|
241 TFT_color_code_ppo2_hud2:
|
|
242 call TFT_standard_color
|
|
243 return
|
|
244
|
|
245 TFT_color_code_battery: ; With battery percent in lo
|
|
246 movlw color_code_battery_low
|
|
247 cpfsgt lo ; lo < color_code_battery_low ?
|
|
248 bra TFT_color_code_warn ; No
|
|
249 call TFT_standard_color
|
|
250 return
|
|
251
|
|
252 ; ****************************************************************************
|
|
253
|
|
254 global TFT_divemode_mask
|
|
255 TFT_divemode_mask: ; Displays mask in Dive-Mode
|
|
256 call TFT_divemask_color
|
|
257 WIN_TINY divemode_mask_depth_column,divemode_mask_depth_row
|
|
258 lfsr FSR2,buffer
|
|
259 STRCAT_TEXT_PRINT tDepth
|
|
260 WIN_TINY divemode_mask_maxdepth_column,divemode_mask_maxdepth_row
|
|
261 lfsr FSR2,buffer
|
|
262 STRCAT_TEXT_PRINT tMaxDepth
|
|
263 WIN_TINY divemode_mask_divetime_column,divemode_mask_divetime_row
|
|
264 lfsr FSR2,buffer
|
|
265 STRCAT_TEXT_PRINT tDivetime
|
|
266
|
|
267 call TFT_standard_color
|
|
268 return
|
|
269
|
|
270 global TFT_clear_customview_divemode
|
|
271 TFT_clear_customview_divemode:
|
|
272 WIN_BOX_BLACK divemode_customview_row, .163, .0, .159 ; top, bottom, left, right
|
|
273 return
|
|
274
|
|
275 global TFT_display_velocity
|
|
276 TFT_display_velocity: ; With divA+0 = m/min
|
|
277 TFT_color_code warn_velocity ; Color-code Output (With divA+0 = m/min)
|
|
278 WIN_SMALL velocity_text_column,velocity_text_row
|
|
279
|
|
280 TSTOSS opt_units ; 0=Meters, 1=Feets
|
|
281 bra TFT_display_velocity_metric
|
|
282 ;TFT_display_velocity_imperial:
|
|
283 lfsr FSR2,buffer
|
|
284 movff divA+0,WREG ; divA+0 = m/min
|
|
285 mullw .100 ; PRODL:PRODH = mbar/min
|
|
286 movff PRODL,lo
|
|
287 movff PRODH,hi
|
|
288 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
|
|
289 movlw '-'
|
|
290 btfsc neg_flag
|
|
291 movlw '+'
|
|
292 movwf POSTINC2
|
|
293 bsf leftbind
|
|
294 output_16
|
|
295 bcf leftbind
|
|
296 STRCAT_TEXT_PRINT tVelImperial ; Unit switch
|
|
297 call TFT_standard_color
|
|
298 return
|
|
299
|
|
300 TFT_display_velocity_metric:
|
|
301 lfsr FSR2,buffer
|
|
302 movff divA+0,lo ; divA+0 = m/min
|
|
303 movlw '-'
|
|
304 btfsc neg_flag
|
|
305 movlw '+'
|
|
306 movwf POSTINC2
|
|
307 output_99
|
|
308 STRCAT_TEXT_PRINT tVelMetric ; Unit switch
|
|
309 call TFT_standard_color
|
|
310 return
|
|
311
|
|
312 global TFT_display_velocity_clear
|
|
313 TFT_display_velocity_clear:
|
|
314 ; Clear Text
|
|
315 WIN_BOX_BLACK velocity_text_row, velocity_text_row+.22, velocity_text_column, (velocity_text_column+.7*.8)-1 ; top, bottom, left, right
|
|
316 return
|
|
317
|
|
318 TFT_clear_decoarea:
|
|
319 WIN_BOX_BLACK decostop_1st_stop_row, .239, decostop_1st_stop_column ,.159 ; top, bottom, left, right
|
|
320 return
|
|
321
|
|
322 global TFT_clear_divemode_menu
|
|
323 TFT_clear_divemode_menu:
|
|
324 WIN_BOX_BLACK divemode_menu_row, divemode_menu_lower, divemode_menu_left ,divemode_menu_right ; top, bottom, left, right
|
|
325 return
|
|
326
|
|
327 global TFT_display_ndl_mask
|
|
328 TFT_display_ndl_mask:
|
|
329 btfsc divemode_menu ; Is the dive mode menu shown?
|
|
330 return ; Yes, return
|
|
331 rcall TFT_clear_decoarea ; Clear Dekostop and Dekosum
|
|
332 call TFT_divemask_color
|
|
333 WIN_STD ndl_text_column,ndl_text_row
|
|
334 STRCPY_TEXT_PRINT tNDL ; NDL
|
|
335 call TFT_standard_color
|
|
336 return
|
|
337
|
|
338 global TFT_show_TTS_divemode
|
|
339 TFT_show_TTS_divemode:
|
|
340 btfsc divemode_menu ; Is the dive mode menu shown?
|
|
341 return ; Yes, return
|
|
342 call TFT_standard_color
|
|
343 movff int_O_ascenttime+0,lo ; TTS
|
|
344 movff int_O_ascenttime+1,hi ; on 16bits
|
|
345 WIN_MEDIUM tts_value_column,tts_value_row
|
|
346 lfsr FSR2,buffer
|
|
347 output_16_3 ;Displays only 0...999
|
|
348 STRCAT_PRINT "'"
|
|
349 return
|
|
350
|
|
351 global TFT_display_ndl
|
|
352 TFT_display_ndl:
|
|
353 btfsc divemode_menu ; Is the dive mode menu shown?
|
|
354 return ; Yes, return
|
|
355 WIN_MEDIUM ndl_value_column,ndl_value_row
|
|
356 lfsr FSR2,buffer
|
|
357 call TFT_standard_color
|
|
358 movff char_O_nullzeit,lo ; Get NDL from C-code
|
|
359 output_8
|
|
360 STRCAT_PRINT "'"
|
|
361 return
|
|
362
|
|
363 global TFT_divemode_warning
|
|
364 TFT_divemode_warning:
|
|
365 bsf dive_warning_displayed ; =1: The warning sign is shown
|
|
366 WIN_TOP warning_icon_row
|
|
367 WIN_LEFT warning_icon_column
|
|
368 TFT_WRITE_PROM_IMAGE dive_warning_block ; Show Warning icon
|
|
369 ; movlw .3
|
|
370 ; cpfslt warning_counter ; More then two warnings?
|
|
371 ; rcall TFT_divemode_warning_counter ; Yes, show the number
|
|
372 return
|
|
373
|
|
374 ;TFT_divemode_warning_counter:
|
|
375 ; WIN_SMALL warning_icon_column+.8,warning_icon_row+.13
|
|
376 ; lfsr FSR2,buffer
|
|
377 ; call TFT_warnings_color
|
|
378 ; movff warning_counter,lo
|
|
379 ; bsf leftbind
|
|
380 ; output_8
|
|
381 ; bcf leftbind
|
|
382 ; STRCAT_PRINT ""
|
|
383 ; call TFT_standard_color
|
|
384 ; return
|
|
385
|
|
386 global TFT_divemode_warning_clear
|
|
387 TFT_divemode_warning_clear:
|
|
388 btfss dive_warning_displayed ; =1: The warning sign is shown
|
|
389 return
|
|
390 bcf dive_warning_displayed ; clear only once
|
|
391 WIN_BOX_BLACK warning_icon_row, warning_icon_row+.38, warning_icon_column, warning_icon_column+.21; top, bottom, left, right
|
|
392 return
|
|
393
|
|
394 global TFT_display_deko_mask
|
|
395 TFT_display_deko_mask:
|
|
396 rcall TFT_clear_decoarea
|
|
397 WIN_STD tts_text_column,tts_text_row
|
|
398 call TFT_divemask_color
|
|
399 STRCPY_TEXT_PRINT tTTS ; TTS
|
|
400 call TFT_standard_color
|
|
401 return
|
|
402
|
|
403 TFT_display_deko_output_depth: ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
|
|
404 TSTOSS opt_units ; 0=m, 1=ft
|
|
405 bra TFT_display_deko_output_metric
|
|
406 ;TFT_display_deko_output_imperial:
|
|
407 movf lo,W ; lo = m
|
|
408 mullw .100 ; PRODL:PRODH = mbar
|
|
409 movff PRODL,lo
|
|
410 movff PRODH,hi
|
|
411 ; Convert with 334feet/100m to have 10ft, 20ft, 30ft stops...
|
|
412 movff lo,xA+0
|
|
413 movff hi,xA+1
|
|
414 movlw LOW d'334' ; 334feet/100m
|
|
415 movwf xB+0
|
|
416 movlw HIGH d'334'
|
|
417 movwf xB+1
|
|
418 call mult16x16 ; xA*xB=xC (lo:hi * 328)
|
|
419 movlw d'50' ; round up
|
|
420 addwf xC+0,F
|
|
421 movlw 0
|
|
422 addwfc xC+1,F
|
|
423 addwfc xC+2,F
|
|
424 addwfc xC+3,F
|
|
425 movlw d'100'
|
|
426 movwf xB+0
|
|
427 clrf xB+1
|
|
428 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
|
|
429 movff xC+0,lo
|
|
430 movff xC+1,hi ; restore lo and hi with updated value
|
|
431 bcf leftbind
|
|
432 bsf ignore_digit4 ; Only full feet
|
|
433 output_16
|
|
434 STRCAT_TEXT tFeets1
|
|
435 return
|
|
436
|
|
437 TFT_display_deko_output_metric:
|
|
438 output_99
|
|
439 STRCAT_TEXT tMeters
|
|
440 PUTC ' '
|
|
441 return
|
|
442
|
|
443 global TFT_display_deko
|
|
444 TFT_display_deko:
|
|
445 btfsc divemode_menu ; Is the dive mode menu shown?
|
|
446 return ; Yes, return
|
|
447 WIN_MEDIUM decostop_1st_stop_column,decostop_1st_stop_row
|
|
448 TFT_color_code warn_ceiling ; Color-code Output
|
|
449 lfsr FSR2,buffer
|
|
450 movff char_O_first_deco_depth,lo ; Ceiling in m
|
|
451 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
|
|
452 movff char_O_first_deco_time,lo ; length of first stop in min
|
|
453 output_99
|
|
454 STRCAT_PRINT "'"
|
|
455 call TFT_standard_color
|
|
456 return
|
|
457
|
|
458 global TFT_decoplan
|
|
459 TFT_decoplan:
|
|
460 call TFT_divemask_color
|
|
461 WIN_TINY decoplan_title_column,decoplan_title_row
|
|
462 STRCPY_TEXT_PRINT tDiveDecoplan
|
|
463 call TFT_standard_color
|
|
464
|
|
465 movff char_O_deco_depth+1,lo
|
|
466 tstfsz lo ; Show another stop?
|
|
467 bra TFT_display_deko2 ; Yes
|
|
468 ; No, clear output and return
|
|
469 call TFT_standard_color
|
|
470 WIN_SMALL decostop_4th_stop_column+.16,decostop_4th_stop_row
|
|
471 STRCPY_PRINT "---"
|
|
472 WIN_BOX_BLACK decostop_2nd_stop_row, divemode_simtext_row-1, decostop_2nd_stop_column, decostop_4th_stop_column ; top, bottom, left, right
|
|
473 WIN_BOX_BLACK decostop_5th_stop_row, divemode_simtext_row-1, decostop_5th_stop_column, decostop_6th_stop_column ; top, bottom, left, right
|
|
474 WIN_BOX_BLACK decostop_6th_stop_row, divemode_simtext_row-1, decostop_6th_stop_column, .159 ; top, bottom, left, right
|
|
475 return
|
|
476 TFT_display_deko2:
|
|
477 WIN_SMALL decostop_2nd_stop_column,decostop_2nd_stop_row
|
|
478 lfsr FSR2,buffer
|
|
479 movff char_O_deco_depth+1,lo ; stop in m
|
|
480 bcf lo,7 ; Clear GAS_SWITCH bit
|
|
481 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
|
|
482 movff char_O_deco_time+1,lo ; length of stop in min
|
|
483 output_99
|
|
484 STRCAT_PRINT "'"
|
|
485 movff char_O_deco_depth+2,lo
|
|
486 tstfsz lo ; Show another stop?
|
|
487 bra TFT_display_deko3 ; Yes
|
|
488 ; No, clear output and return
|
|
489 WIN_BOX_BLACK decostop_3rd_stop_row, divemode_simtext_row-1, decostop_2nd_stop_column, decostop_4th_stop_column ; top, bottom, left, right
|
|
490 WIN_BOX_BLACK decostop_4th_stop_row, divemode_simtext_row-1, decostop_4th_stop_column, .159 ; top, bottom, left, right
|
|
491 return
|
|
492
|
|
493 TFT_display_deko3:
|
|
494 WIN_SMALL decostop_3rd_stop_column,decostop_3rd_stop_row
|
|
495 lfsr FSR2,buffer
|
|
496 movff char_O_deco_depth+2,lo ; stop in m
|
|
497 bcf lo,7 ; Clear GAS_SWITCH bit
|
|
498 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
|
|
499 movff char_O_deco_time+2,lo ; length of stop in min
|
|
500 output_99
|
|
501 STRCAT_PRINT "'"
|
|
502
|
|
503 movff char_O_deco_depth+3,lo
|
|
504 tstfsz lo ; Show another stop?
|
|
505 bra TFT_display_deko4 ; Yes
|
|
506 ; No, clear output and return
|
|
507 WIN_BOX_BLACK decostop_4th_stop_row, divemode_simtext_row-1, decostop_4th_stop_column, .159 ; top, bottom, left, right
|
|
508 return ; Done.
|
|
509
|
|
510 TFT_display_deko4:
|
|
511 WIN_SMALL decostop_4th_stop_column,decostop_4th_stop_row
|
|
512 lfsr FSR2,buffer
|
|
513 movff char_O_deco_depth+3,lo ; stop in m
|
|
514 bcf lo,7 ; Clear GAS_SWITCH bit
|
|
515 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
|
|
516 movff char_O_deco_time+3,lo ; length of stop in min
|
|
517 output_99
|
|
518 STRCAT_PRINT "'"
|
|
519
|
|
520 movff char_O_deco_depth+4,lo
|
|
521 tstfsz lo ; Show another stop?
|
|
522 bra TFT_display_deko5 ; Yes
|
|
523 ; No, clear output and return
|
|
524 WIN_BOX_BLACK decostop_5th_stop_row, divemode_simtext_row-1, decostop_5th_stop_column, decostop_6th_stop_column ; top, bottom, left, right
|
|
525 WIN_BOX_BLACK decostop_6th_stop_row, divemode_simtext_row-1, decostop_6th_stop_column, .159 ; top, bottom, left, right
|
|
526 return ; Done.
|
|
527
|
|
528 TFT_display_deko5:
|
|
529 WIN_SMALL decostop_5th_stop_column,decostop_5th_stop_row
|
|
530 lfsr FSR2,buffer
|
|
531 movff char_O_deco_depth+4,lo ; stop in m
|
|
532 bcf lo,7 ; Clear GAS_SWITCH bit
|
|
533 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
|
|
534 movff char_O_deco_time+4,lo ; length of stop in min
|
|
535 output_99
|
|
536 STRCAT_PRINT "'"
|
|
537 movff char_O_deco_depth+5,lo
|
|
538 tstfsz lo ; Show another stop?
|
|
539 bra TFT_display_deko6 ; Yes
|
|
540 ; No, clear output and return
|
|
541 WIN_BOX_BLACK decostop_6th_stop_row, divemode_simtext_row-1, decostop_6th_stop_column, .159 ; top, bottom, left, right
|
|
542 return ; Done.
|
|
543 TFT_display_deko6:
|
|
544 WIN_SMALL decostop_6th_stop_column,decostop_6th_stop_row
|
|
545 lfsr FSR2,buffer
|
|
546 movff char_O_deco_depth+5,lo ; stop in m
|
|
547 bcf lo,7 ; Clear GAS_SWITCH bit
|
|
548 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
|
|
549 movff char_O_deco_time+5,lo ; length of stop in min
|
|
550 output_99
|
|
551 STRCAT_PRINT "'"
|
|
552 movff char_O_deco_depth+6,lo
|
|
553 tstfsz lo ; Show another stop?
|
|
554 bra TFT_display_deko7 ; Yes
|
|
555 ; No, clear output and return
|
|
556 WIN_BOX_BLACK decostop_7th_stop_row, divemode_simtext_row-1, decostop_7th_stop_column, .159 ; top, bottom, left, right
|
|
557 return ; Done.
|
|
558 TFT_display_deko7:
|
|
559 WIN_SMALL decostop_7th_stop_column,decostop_7th_stop_row
|
|
560 lfsr FSR2,buffer
|
|
561 movff char_O_deco_depth+6,lo ; stop in m
|
|
562 bcf lo,7 ; Clear GAS_SWITCH bit
|
|
563 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
|
|
564 movff char_O_deco_time+6,lo ; length of stop in min
|
|
565 output_99
|
|
566 STRCAT_PRINT "'"
|
|
567 return ; Done.
|
|
568
|
|
569 ;TFT_display_deko1:
|
|
570 ; movff char_O_gradient_factor,lo ; gradient factor
|
|
571 ; movlw gf_display_threshold ; threshold for display
|
|
572 ; cpfslt lo ; show value?
|
|
573 ; bra TFT_display_deko2 ; Yes
|
|
574 ; ; No
|
|
575 ; bra TFT_display_ndl_mask2 ; Clear gradient factor
|
|
576 ;
|
|
577
|
|
578 global TFT_mask_avr_stopwatch ; Show mask for average depth and stopwatch
|
|
579 TFT_mask_avr_stopwatch:
|
|
580 ; The mask
|
|
581 call TFT_divemask_color
|
|
582 WIN_TINY dive_custom_avr_stop_column1,dive_custom_avr_stop_row
|
|
583 STRCPY_TEXT_PRINT tDiveTotalAvr
|
|
584 WIN_TINY dive_custom_avr_stop_column2,dive_custom_avr_stop_row
|
|
585 STRCPY_TEXT_PRINT tDiveStopwatch
|
|
586 WIN_TINY dive_custom_avr_stop_column3,dive_custom_avr_stop_row
|
|
587 STRCPY_TEXT_PRINT tDiveStopAvr
|
|
588 call TFT_standard_color
|
|
589 return
|
|
590
|
|
591 global TFT_update_avr_stopwatch ; Update average depth and stopwatch
|
|
592 TFT_update_avr_stopwatch:
|
|
593 call TFT_standard_color
|
|
594 SAFE_2BYTE_COPY average_divesecs,lo
|
|
595 call convert_time ; lo=secs, hi=mins
|
|
596 WIN_MEDIUM dive_avr_stop_column2,dive_avr_stop_row
|
|
597 lfsr FSR2,buffer
|
|
598 bsf leftbind
|
|
599 movf hi,W
|
|
600 movff lo,hi
|
|
601 movwf lo ; exchange lo and hi
|
|
602 output_8
|
|
603 PUTC ':'
|
|
604 movff hi,lo
|
|
605 output_99x
|
|
606 movlw .5
|
|
607 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
|
|
608 clrf WREG
|
|
609 movff WREG,buffer+.5 ; limit to 5 chars
|
|
610 STRCAT_PRINT ""
|
|
611
|
|
612 TSTOSS opt_units ; 0=m, 1=ft
|
|
613 bra TFT_update_avr_stopwatch_metric
|
|
614 ;TFT_update_avr_stopwatch_imperial
|
|
615 movff avr_rel_pressure_total+0,lo
|
|
616 movff avr_rel_pressure_total+1,hi
|
|
617 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
|
|
618 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
|
|
619 WIN_MEDIUM dive_avr_stop_column1,dive_avr_stop_row
|
|
620 lfsr FSR2,buffer
|
|
621 bsf leftbind
|
|
622 output_16 ; yxz
|
|
623 STRCAT_PRINT " "
|
|
624 ; Stopped average depth
|
|
625 movff avr_rel_pressure+0,lo
|
|
626 movff avr_rel_pressure+1,hi
|
|
627 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
|
|
628 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
|
|
629 WIN_MEDIUM dive_avr_stop_column3,dive_avr_stop_row
|
|
630 lfsr FSR2,buffer
|
|
631 output_16 ; yxz
|
|
632 bcf leftbind
|
|
633 STRCAT_PRINT " "
|
|
634 return
|
|
635
|
|
636 TFT_update_avr_stopwatch_metric:
|
|
637 ; Non-resettable average depth
|
|
638 movff avr_rel_pressure_total+0,lo
|
|
639 movff avr_rel_pressure_total+1,hi
|
|
640 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
|
|
641 WIN_MEDIUM dive_avr_stop_column1,dive_avr_stop_row
|
|
642 lfsr FSR2,buffer
|
|
643 bsf ignore_digit5 ; no cm
|
|
644 output_16dp .3 ; yxz.a
|
|
645 STRCAT_PRINT ""
|
|
646 ; Stopped average depth
|
|
647 movff avr_rel_pressure+0,lo
|
|
648 movff avr_rel_pressure+1,hi
|
|
649 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
|
|
650 WIN_MEDIUM dive_avr_stop_column3,dive_avr_stop_row
|
|
651 lfsr FSR2,buffer
|
|
652 bsf ignore_digit5 ; no cm
|
|
653 output_16dp .3 ; yxz.a
|
|
654 bcf leftbind
|
|
655 bcf ignore_digit5
|
|
656 STRCAT_PRINT ""
|
|
657 return
|
|
658
|
|
659 global TFT_hud_mask ; The HUD mask
|
|
660 TFT_hud_mask:
|
|
661 ; The mask
|
|
662 call TFT_divemask_color
|
|
663 WIN_TINY dive_custom_hud_column1,dive_custom_hud_row
|
|
664 STRCPY_TEXT_PRINT tDiveHudMask1
|
|
665 WIN_TINY dive_custom_hud_column2,dive_custom_hud_row
|
|
666 STRCPY_TEXT_PRINT tDiveHudMask2
|
|
667 WIN_TINY dive_custom_hud_column3,dive_custom_hud_row
|
|
668 STRCPY_TEXT_PRINT tDiveHudMask3
|
|
669 call TFT_standard_color
|
|
670 return
|
|
671
|
|
672 global TFT_update_hud ; Update HUD data
|
|
673 TFT_update_hud:
|
|
674 ; show three sensors
|
|
675 bsf leftbind
|
|
676 movff o2_ppo2_sensor1,lo
|
|
677 tstfsz lo ; ppO2=0 (No data/failure)?
|
|
678 bra TFT_update_hud1 ; No
|
|
679 btfss dive_hud1_displayed ; Was the sensor shown?
|
|
680 bra TFT_update_hud2 ; Yes, skip clear
|
|
681 bcf dive_hud1_displayed ; No, clear display flag
|
|
682 WIN_BOX_BLACK dive_hud_data_row, dive_hud_data_row+.30, dive_hud_sensor1_column, dive_hud_sensor2_column ; top, bottom, left, right
|
|
683 WIN_STD dive_hud_sensor1_column+.7,dive_hud_data_row+.5
|
|
684 call TFT_standard_color
|
|
685 STRCPY_PRINT "---"
|
|
686 bra TFT_update_hud2 ; Skip Sensor 1
|
|
687 TFT_update_hud1:
|
|
688 WIN_MEDIUM dive_hud_sensor1_column,dive_hud_data_row
|
|
689 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo
|
|
690 lfsr FSR2,buffer
|
|
691 clrf hi
|
|
692 output_16dp .3 ; x.xx bar
|
|
693 STRCAT_PRINT ""
|
|
694 bsf dive_hud1_displayed ; Set display flag
|
|
695 TFT_update_hud2:
|
|
696 movff o2_ppo2_sensor2,lo
|
|
697 tstfsz lo ; ppO2=0 (No data/failure)?
|
|
698 bra TFT_update_hud3 ; No
|
|
699 btfss dive_hud2_displayed ; Was the sensor shown?
|
|
700 bra TFT_update_hud4 ; Yes, skip clear
|
|
701 bcf dive_hud2_displayed ; No, clear display flag
|
|
702 WIN_BOX_BLACK dive_hud_data_row, dive_hud_data_row+.30, dive_hud_sensor2_column, dive_hud_sensor3_column ; top, bottom, left, right
|
|
703 WIN_STD dive_hud_sensor2_column+.7,dive_hud_data_row+.5
|
|
704 call TFT_standard_color
|
|
705 STRCPY_PRINT "---"
|
|
706 bra TFT_update_hud4 ; Skip Sensor 2
|
|
707 TFT_update_hud3:
|
|
708 WIN_MEDIUM dive_hud_sensor2_column,dive_hud_data_row
|
|
709 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo
|
|
710 lfsr FSR2,buffer
|
|
711 clrf hi
|
|
712 output_16dp .3 ; x.xx bar
|
|
713 STRCAT_PRINT ""
|
|
714 bsf dive_hud2_displayed ; Set display flag
|
|
715 TFT_update_hud4:
|
|
716 movff o2_ppo2_sensor3,lo
|
|
717 tstfsz lo ; ppO2=0 (No data/failure)?
|
|
718 bra TFT_update_hud5 ; No
|
|
719 btfss dive_hud3_displayed ; Was the sensor shown?
|
|
720 bra TFT_update_hud6 ; Yes, skip clear
|
|
721 bcf dive_hud3_displayed ; No, clear display flag
|
|
722 WIN_BOX_BLACK dive_hud_data_row, dive_hud_data_row+.30, dive_hud_sensor3_column, .159 ; top, bottom, left, right
|
|
723 WIN_STD dive_hud_sensor3_column+.7,dive_hud_data_row+.5
|
|
724 call TFT_standard_color
|
|
725 STRCPY_PRINT "---"
|
|
726 bra TFT_update_hud6 ; Skip Sensor 3
|
|
727 TFT_update_hud5:
|
|
728 WIN_MEDIUM dive_hud_sensor3_column,dive_hud_data_row
|
|
729 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo
|
|
730 lfsr FSR2,buffer
|
|
731 clrf hi
|
|
732 output_16dp .3 ; x.xx bar
|
|
733 STRCAT_PRINT ""
|
|
734 bsf dive_hud3_displayed ; Set display flag
|
|
735 TFT_update_hud6:
|
|
736 bcf leftbind
|
|
737 call TFT_standard_color
|
|
738 return
|
|
739
|
|
740 global TFT_surface_hud ; Update HUD data in surface mode
|
|
741 TFT_surface_hud:
|
|
742 ; show three sensors
|
|
743 bsf leftbind
|
|
744 WIN_SMALL surf_hud_sensor1_column,surf_hud_sensor1_row
|
|
745 movff o2_ppo2_sensor1,lo
|
|
746 tstfsz lo ; ppO2=0 (No data/failure)?
|
|
747 bra TFT_surface_hud1 ; No
|
|
748 call TFT_standard_color
|
|
749 STRCPY_PRINT "--- "
|
|
750 bra TFT_surface_hud2 ; Skip Sensor 1
|
|
751 TFT_surface_hud1:
|
|
752 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo
|
|
753 lfsr FSR2,buffer
|
|
754 clrf hi
|
|
755 output_16dp .3 ; x.xx bar
|
|
756 STRCAT_PRINT ""
|
|
757 TFT_surface_hud2:
|
|
758 WIN_SMALL surf_hud_sensor2_column,surf_hud_sensor2_row
|
|
759 movff o2_ppo2_sensor2,lo
|
|
760 tstfsz lo ; ppO2=0 (No data/failure)?
|
|
761 bra TFT_surface_hud3 ; No
|
|
762 call TFT_standard_color
|
|
763 STRCPY_PRINT "--- "
|
|
764 bra TFT_surface_hud4 ; Skip Sensor 2
|
|
765 TFT_surface_hud3:
|
|
766 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo
|
|
767 lfsr FSR2,buffer
|
|
768 clrf hi
|
|
769 output_16dp .3 ; x.xx bar
|
|
770 STRCAT_PRINT ""
|
|
771 TFT_surface_hud4:
|
|
772 WIN_SMALL surf_hud_sensor3_column,surf_hud_sensor3_row
|
|
773 movff o2_ppo2_sensor3,lo
|
|
774 tstfsz lo ; ppO2=0 (No data/failure)?
|
|
775 bra TFT_surface_hud5 ; No
|
|
776 call TFT_standard_color
|
|
777 STRCPY_PRINT "--- "
|
|
778 bra TFT_surface_hud6 ; Skip Sensor 3
|
|
779 TFT_surface_hud5:
|
|
780 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo
|
|
781 lfsr FSR2,buffer
|
|
782 clrf hi
|
|
783 output_16dp .3 ; x.xx bar
|
|
784 STRCAT_PRINT ""
|
|
785 TFT_surface_hud6:
|
|
786 bcf leftbind
|
|
787 call TFT_standard_color
|
|
788 return
|
|
789
|
|
790 global TFT_menu_hud
|
|
791 TFT_menu_hud: ; Yes, update HUD data
|
|
792 movlw color_yellow
|
|
793 call TFT_set_color
|
|
794 bsf leftbind
|
|
795 WIN_SMALL surf_menu_sensor1_column,surf_menu_sensor1_row
|
|
796 lfsr FSR2,buffer
|
|
797 movff o2_ppo2_sensor1,lo
|
|
798 clrf hi
|
|
799 output_16dp .3 ; x.xx bar
|
|
800 PUTC ","
|
|
801 movff o2_mv_sensor1+0,lo ; in 0.1mV steps
|
|
802 movff o2_mv_sensor1+1,hi ; in 0.1mV steps
|
|
803 output_16dp .4 ; xxx.y mV
|
|
804 STRCAT_PRINT "mV "
|
|
805 WIN_SMALL surf_menu_sensor2_column,surf_menu_sensor2_row
|
|
806 lfsr FSR2,buffer
|
|
807 movff o2_ppo2_sensor2,lo
|
|
808 clrf hi
|
|
809 output_16dp .3 ; x.xx bar
|
|
810 PUTC ","
|
|
811 movff o2_mv_sensor2+0,lo ; in 0.1mV steps
|
|
812 movff o2_mv_sensor2+1,hi ; in 0.1mV steps
|
|
813 output_16dp .4 ; xxx.y mV
|
|
814 STRCAT_PRINT "mV "
|
|
815 WIN_SMALL surf_menu_sensor3_column,surf_menu_sensor3_row
|
|
816 lfsr FSR2,buffer
|
|
817 movff o2_ppo2_sensor3,lo
|
|
818 clrf hi
|
|
819 output_16dp .3 ; x.xx bar
|
|
820 PUTC ","
|
|
821 movff o2_mv_sensor3+0,lo ; in 0.1mV steps
|
|
822 movff o2_mv_sensor3+1,hi ; in 0.1mV steps
|
|
823 output_16dp .4 ; xxx.y mV
|
|
824 STRCAT_PRINT "mV "
|
|
825 WIN_SMALL surf_menu_sensor4_column,surf_menu_sensor4_row
|
|
826 lfsr FSR2,buffer
|
|
827 STRCPY "Batt:"
|
|
828 movff hud_battery_mv+0,lo ; in mV
|
|
829 movff hud_battery_mv+1,hi ; in mV
|
|
830 output_16dp .2 ; x.yyy V
|
|
831 STRCAT_PRINT "V"
|
|
832 call TFT_standard_color
|
|
833 bcf leftbind
|
|
834 return
|
|
835
|
|
836 global TFT_clock
|
|
837 TFT_clock:
|
|
838 WIN_TINY surf_clock_column,surf_clock_row
|
|
839 TFT_clock2: ; called from divemode clock
|
|
840 call TFT_standard_color
|
|
841 lfsr FSR2,buffer
|
|
842 movff hours,lo
|
|
843 output_99
|
|
844 movlw ':'
|
|
845 btfss secs,0 ; blinking every second
|
|
846 movlw ' '
|
|
847 movwf POSTINC2
|
|
848 movff mins,lo
|
|
849 output_99x
|
|
850 STRCAT_PRINT ""
|
|
851 return
|
|
852
|
|
853 global TFT_show_time_date_menu
|
|
854 TFT_show_time_date_menu:
|
|
855 call speed_fastest
|
|
856 WIN_SMALL .15,.30
|
|
857 call TFT_standard_color
|
|
858 lfsr FSR2,buffer
|
|
859 movff hours,lo
|
|
860 output_99
|
|
861 PUTC ':'
|
|
862 movff mins,lo
|
|
863 output_99x
|
|
864 PUTC ':'
|
|
865 movff secs,lo
|
|
866 output_99x
|
|
867 STRCAT " - "
|
|
868 movff month,convert_value_temp+0
|
|
869 movff day,convert_value_temp+1
|
|
870 movff year,convert_value_temp+2
|
|
871 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
|
|
872 STRCAT_PRINT " "
|
|
873 return
|
|
874 ;=============================================================================
|
|
875
|
|
876 global TFT_interval
|
|
877 TFT_interval:
|
|
878 call TFT_warning_set_window ; Sets the row and column for the current warning
|
|
879 tstfsz WREG ; Is there room for the warning?
|
|
880 return ; No
|
|
881 STRCPY "Int:"
|
|
882 movff surface_interval+0,lo
|
|
883 movff surface_interval+1,hi
|
|
884 call convert_time ; lo=mins, hi=hours
|
|
885 movf hi,W
|
|
886 movff lo,hi
|
|
887 movwf lo ; exchange lo and hi
|
|
888 output_99x
|
|
889 PUTC ':'
|
|
890 movff hi,lo
|
|
891 output_99x
|
|
892 movlw surf_warning_length ; No, use surface string length
|
|
893 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
|
|
894 STRCAT_PRINT ""
|
|
895 return
|
|
896
|
|
897 global TFT_compass_fast
|
|
898 TFT_compass_fast:
|
|
899 WIN_TINY .20,.50
|
|
900 STRCPY "X:"
|
|
901 movff compass_DX+0,lo
|
|
902 movff compass_DX+1,hi
|
|
903 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
904 output_16
|
|
905 STRCAT " Y:"
|
|
906 movff compass_DY+0,lo
|
|
907 movff compass_DY+1,hi
|
|
908 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
909 output_16
|
|
910 STRCAT " Z:"
|
|
911 movff compass_DZ+0,lo
|
|
912 movff compass_DZ+1,hi
|
|
913 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
914 output_16
|
|
915 STRCAT_PRINT " "
|
|
916 return
|
|
917
|
|
918 global TFT_update_raw_data
|
|
919 TFT_update_raw_data:
|
|
920 WIN_TINY .0,.0
|
|
921 STRCPY "pres:"
|
|
922 SAFE_2BYTE_COPY amb_pressure, lo
|
|
923 bsf leftbind
|
|
924 output_16
|
|
925 STRCAT_PRINT "mbar "
|
|
926 WIN_TINY .80,.0
|
|
927 STRCPY "temp:"
|
|
928 SAFE_2BYTE_COPY temperature, lo
|
|
929 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
930 movlw d'3'
|
|
931 movwf ignore_digits
|
|
932 output_16dp d'2' ; temperature
|
|
933 STRCAT_PRINT "°C "
|
|
934
|
|
935 call get_battery_voltage ; get battery voltage
|
|
936 WIN_TINY .0,.18
|
|
937 STRCPY "AN06:"
|
|
938 movff ADRESL,lo
|
|
939 movff ADRESH,hi
|
|
940 output_16
|
|
941 STRCAT_PRINT ""
|
|
942 WIN_TINY .80,.18
|
|
943 STRCPY "BATT:"
|
|
944 movff batt_voltage+0,lo
|
|
945 movff batt_voltage+1,hi
|
|
946 output_16
|
|
947 STRCAT_PRINT "mV "
|
|
948
|
|
949 call get_ambient_level ; get ambient light level
|
|
950 WIN_TINY .0,.36
|
|
951 STRCPY "AN07:"
|
|
952 movff ADRESL,lo
|
|
953 movff ADRESH,hi
|
|
954 output_16
|
|
955 STRCAT_PRINT " "
|
|
956 WIN_TINY .80,.36
|
|
957 STRCPY "Amb.:"
|
|
958 movff ambient_light+0,lo
|
|
959 movff ambient_light+1,hi
|
|
960 output_16
|
|
961 STRCAT_PRINT " "
|
|
962
|
|
963 call get_rssi_level ; get rssi level
|
|
964 WIN_TINY .0,.54
|
|
965 STRCPY "AN17:"
|
|
966 movff ADRESL,lo
|
|
967 movff ADRESH,hi
|
|
968 output_16
|
|
969 STRCAT_PRINT " "
|
|
970 WIN_TINY .80,.54
|
|
971 STRCPY "RSSI:"
|
|
972 movff rssi_value,lo
|
|
973 output_8
|
|
974 STRCAT_PRINT " "
|
|
975
|
|
976 WIN_TINY .0,.72
|
|
977 STRCPY "HUD_Status:"
|
|
978 movff hud_status_byte,lo
|
|
979 output_8
|
|
980 STRCAT_PRINT " "
|
|
981 WIN_TINY .80,.72
|
|
982 STRCPY "HUD_BATT:"
|
|
983 movff hud_battery_mv+0,lo
|
|
984 movff hud_battery_mv+1,hi
|
|
985 output_16
|
|
986 STRCAT_PRINT "mV "
|
|
987
|
|
988 WIN_TINY .0,.90
|
|
989 STRCPY "Sens1.:"
|
|
990 movff o2_mv_sensor1+0,lo
|
|
991 movff o2_mv_sensor1+1,hi
|
|
992 output_16dp d'4'
|
|
993 STRCAT_PRINT "mV "
|
|
994 WIN_TINY .80,.90
|
|
995 STRCPY "Sens2:"
|
|
996 movff o2_mv_sensor2+0,lo
|
|
997 movff o2_mv_sensor2+1,hi
|
|
998 output_16dp d'4'
|
|
999 STRCAT_PRINT "mV "
|
|
1000
|
|
1001 WIN_TINY .0,.108
|
|
1002 STRCPY "Sens3.:"
|
|
1003 movff o2_mv_sensor3+0,lo
|
|
1004 movff o2_mv_sensor3+1,hi
|
|
1005 output_16dp d'4'
|
|
1006 STRCAT_PRINT "mV "
|
|
1007 WIN_TINY .80,.108 ; Space
|
|
1008
|
|
1009 WIN_TINY .0,.128
|
|
1010 STRCPY "ccDX:"
|
|
1011 movff compass_DX_f+0,lo ; Display calibrated data
|
|
1012 movff compass_CX_f+0,WREG ; by substracting compass_CX_f
|
|
1013 subwf lo,F ; lo := lo - W
|
|
1014 movff compass_DX_f+1,hi
|
|
1015 movff compass_CX_f+1,WREG
|
|
1016 subwfb hi,F
|
|
1017 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
1018 output_16
|
|
1019 STRCAT_PRINT " "
|
|
1020 WIN_TINY .80,.128
|
|
1021 STRCPY "ccDY:"
|
|
1022 movff compass_DY_f+0,lo
|
|
1023 movff compass_CY_f+0,WREG
|
|
1024 subwf lo,F
|
|
1025 movff compass_DY_f+1,hi
|
|
1026 movff compass_CY_f+1,WREG
|
|
1027 subwfb hi,F
|
|
1028 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
1029 output_16
|
|
1030 STRCAT_PRINT " "
|
|
1031 WIN_TINY .0,.146
|
|
1032 STRCPY "ccDZ:"
|
|
1033 movff compass_DZ_f+0,lo
|
|
1034 movff compass_CZ_f+0,WREG
|
|
1035 subwf lo,F
|
|
1036 movff compass_DZ_f+1,hi
|
|
1037 movff compass_CZ_f+1,WREG
|
|
1038 subwfb hi,F
|
|
1039 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
1040 output_16
|
|
1041 STRCAT_PRINT " "
|
|
1042 WIN_TINY .80,.146 ; Space
|
|
1043
|
|
1044 WIN_TINY .0,.164
|
|
1045 STRCPY "AcDX:"
|
|
1046 movff accel_DX_f+0,lo
|
|
1047 movff accel_DX_f+1,hi
|
|
1048 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
1049 output_16
|
|
1050 STRCAT_PRINT "mg "
|
|
1051 WIN_TINY .80,.164
|
|
1052 STRCPY "AcDY:"
|
|
1053 movff accel_DY_f+0,lo
|
|
1054 movff accel_DY_f+1,hi
|
|
1055 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
1056 output_16
|
|
1057 STRCAT_PRINT "mg "
|
|
1058 WIN_TINY .0,.182
|
|
1059 STRCPY "AcDZ:"
|
|
1060 movff accel_DZ_f+0,lo
|
|
1061 movff accel_DZ_f+1,hi
|
|
1062 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
1063 output_16
|
|
1064 STRCAT_PRINT "mg "
|
|
1065
|
|
1066 WIN_TINY .80,.182
|
|
1067 STRCPY "Head:"
|
|
1068 movff compass_heading+0,lo
|
|
1069 movff compass_heading+1,hi
|
|
1070
|
|
1071 btfsc hi,7 ; Uncalibrated compass ?
|
|
1072 bra TFT_update_compass_1
|
|
1073
|
|
1074 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
1075 output_16
|
|
1076 STRCAT_PRINT " "
|
|
1077 bra TFT_update_compass_2
|
|
1078
|
|
1079 TFT_update_compass_1:
|
|
1080 STRCAT_PRINT "---"
|
|
1081
|
|
1082 TFT_update_compass_2:
|
|
1083 WIN_TINY .0,.200
|
|
1084 STRCPY "calX:"
|
|
1085 movff compass_CX_f+0,lo
|
|
1086 movff compass_CX_f+1,hi
|
|
1087 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
1088 output_16
|
|
1089 STRCAT ", "
|
|
1090 movff compass_CY_f+0,lo
|
|
1091 movff compass_CY_f+1,hi
|
|
1092 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
1093 output_16
|
|
1094 STRCAT ", "
|
|
1095 movff compass_CZ_f+0,lo
|
|
1096 movff compass_CZ_f+1,hi
|
|
1097 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
1098 output_16
|
|
1099 STRCAT_PRINT " "
|
|
1100
|
|
1101 WIN_TINY .0,.218
|
|
1102 STRCPY "Roll:"
|
|
1103 movff compass_roll+0,lo
|
|
1104 movff compass_roll+1,hi
|
|
1105 call TFT_convert_signed_16bit
|
|
1106 output_16
|
|
1107 STRCAT_PRINT " "
|
|
1108
|
|
1109 WIN_TINY .80, .218
|
|
1110 STRCPY "Pitch:"
|
|
1111 movff compass_pitch+0,lo
|
|
1112 movff compass_pitch+1,hi
|
|
1113 call TFT_convert_signed_16bit
|
|
1114 output_16
|
|
1115 STRCAT_PRINT " "
|
|
1116
|
|
1117 ; call TFT_serial
|
|
1118 bcf leftbind
|
|
1119 return
|
|
1120
|
|
1121
|
|
1122 global TFT_surface_compass_mask
|
|
1123 TFT_surface_compass_mask:
|
|
1124 WIN_SMALL surf_compass_mask_column,surf_compass_mask_row
|
|
1125 call TFT_standard_color
|
|
1126 STRCPY_TEXT_PRINT tHeading ; Heading:
|
|
1127 return
|
|
1128
|
|
1129 global TFT_dive_compass_mask
|
|
1130 TFT_dive_compass_mask:
|
|
1131 WIN_TINY dive_compass_mask_column,dive_compass_mask_row
|
|
1132 call TFT_divemask_color
|
|
1133 STRCPY_TEXT_PRINT tHeading ; Heading:
|
|
1134 return
|
|
1135
|
|
1136
|
|
1137 global TFT_surface_compass_heading
|
|
1138 TFT_surface_compass_heading:
|
|
1139 rcall compass_heading_common
|
|
1140 WIN_STD surf_compass_head_column,surf_compass_head_row
|
|
1141 call TFT_standard_color
|
|
1142 lfsr FSR2,buffer
|
|
1143 movff compass_heading+0,lo
|
|
1144 movff compass_heading+1,hi
|
|
1145 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
1146 bsf leftbind
|
|
1147 output_16
|
|
1148 bcf leftbind
|
|
1149 STRCAT_PRINT "° "
|
|
1150 return
|
|
1151
|
|
1152 global TFT_dive_compass_heading
|
|
1153 TFT_dive_compass_heading:
|
|
1154 rcall compass_heading_common
|
|
1155 WIN_STD dive_compass_head_column,dive_compass_head_row
|
|
1156 call TFT_standard_color
|
|
1157 lfsr FSR2,buffer
|
|
1158 movff compass_heading+0,lo
|
|
1159 movff compass_heading+1,hi
|
|
1160 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
1161 bsf leftbind
|
|
1162 output_16
|
|
1163 bcf leftbind
|
|
1164 STRCAT_PRINT "° "
|
|
1165 return
|
|
1166
|
|
1167
|
|
1168 compass_heading_common:
|
|
1169 extern compass
|
|
1170 extern compass_filter
|
|
1171 rcall TFT_get_compass
|
|
1172 rcall TFT_get_compass
|
|
1173 rcall TFT_get_compass
|
|
1174 rcall TFT_get_compass
|
|
1175 rcall TFT_get_compass
|
|
1176 rcall TFT_get_compass
|
|
1177 call compass ; Do compass corrections.
|
|
1178 banksel common
|
|
1179 return
|
|
1180
|
|
1181 TFT_get_compass:
|
|
1182 call speed_normal
|
|
1183 call I2C_RX_compass ; Test Compass
|
|
1184 call I2C_RX_accelerometer ; Test Accelerometer
|
|
1185 call compass_filter ; Filter Raw compass + accel readings.
|
|
1186 banksel common
|
|
1187 return
|
|
1188
|
|
1189 global TFT_debug_output
|
|
1190 TFT_debug_output:
|
|
1191 return
|
|
1192 WIN_TINY .107,.0
|
|
1193 call TFT_standard_color
|
|
1194 lfsr FSR2,buffer
|
|
1195 movff CCPR1L,lo
|
|
1196 output_8
|
|
1197 STRCAT_PRINT ""
|
|
1198 return
|
|
1199
|
|
1200 global TFT_ftts
|
|
1201 TFT_ftts:
|
|
1202 movff char_I_extra_time,lo
|
|
1203 tstfsz lo
|
|
1204 bra $+4
|
|
1205 return ; char_I_extra_time=0, return.
|
|
1206 incf warning_counter,F ; increase counter
|
|
1207 call TFT_warning_set_window ; Sets the row and column for the current warning
|
|
1208 tstfsz WREG ; Is there room for the warning?
|
|
1209 return ; No
|
|
1210 movff char_I_extra_time,lo
|
|
1211 STRCPY "@+"
|
|
1212 bsf leftbind
|
|
1213 output_8
|
|
1214 PUTC ":"
|
|
1215 movff int_O_extra_ascenttime+0,lo
|
|
1216 movff int_O_extra_ascenttime+1,hi
|
|
1217 movf lo,W
|
|
1218 iorwf hi,W ; extra_ascenttime == 0 ?
|
|
1219 bz TFT_ftts2 ; No deco
|
|
1220 movf lo,W ; extra_ascenttime == 0xFFFF ?
|
|
1221 andwf hi,W
|
|
1222 incf WREG,w
|
|
1223 bz TFT_ftts2 ; Wait...
|
|
1224 output_16
|
|
1225 bcf leftbind
|
|
1226 PUTC "'"
|
|
1227 movlw warning_length ; Divemode string length
|
|
1228 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
|
|
1229 STRCAT_PRINT ""
|
|
1230 return
|
|
1231
|
|
1232 TFT_ftts2:
|
|
1233 STRCAT "---"
|
|
1234 bcf leftbind
|
|
1235 movlw warning_length ; Divemode string length
|
|
1236 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
|
|
1237 STRCAT_PRINT ""
|
|
1238 return
|
|
1239
|
|
1240
|
|
1241 ;=============================================================================
|
|
1242
|
|
1243 global TFT_temp_surfmode
|
|
1244 TFT_temp_surfmode:
|
|
1245 WIN_SMALL surf_temp_column,surf_temp_row
|
|
1246 call TFT_standard_color
|
|
1247
|
|
1248 SAFE_2BYTE_COPY temperature, lo
|
|
1249
|
|
1250 TSTOSS opt_units ; 0=°C, 1=°F
|
|
1251 bra TFT_temp_surfmode_metric
|
|
1252
|
|
1253 ;TFT_temp_surfmode_imperial:
|
|
1254 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
1255 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit
|
|
1256 lfsr FSR2,buffer ; Overwrite "-"
|
|
1257 bsf ignore_digit5 ; Full degrees only
|
|
1258 output_16
|
|
1259 STRCAT_PRINT ""
|
|
1260 call TFT_divemask_color
|
|
1261 WIN_SMALL surf_temp_column+4*8,surf_temp_row
|
|
1262 STRCPY_PRINT "°F"
|
|
1263 return
|
|
1264
|
|
1265 TFT_temp_surfmode_metric:
|
|
1266 lfsr FSR2,buffer
|
|
1267 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
1268 movlw d'3'
|
|
1269 movwf ignore_digits
|
|
1270 bsf ignore_digit5 ; Full degrees only
|
|
1271 output_16
|
|
1272
|
|
1273 ; read-back the buffer+3
|
|
1274 movff buffer+3,lo
|
|
1275 movlw " " ; Space
|
|
1276 cpfseq lo ; Was it a space (between +1°C and -1°C)?
|
|
1277 bra TFT_temp_surfmode1 ; No.
|
|
1278 movlw "0" ; Yes, print manual zero
|
|
1279 movff WREG,buffer+3
|
|
1280 bra TFT_temp_surfmode2
|
|
1281 TFT_temp_surfmode1:
|
|
1282 ; Test if output was negative (Flag set in TFT_convert_signed_16bit)
|
|
1283 btfss neg_flag ; Negative temperature?
|
|
1284 bra TFT_temp_surfmode3 ; No, continue
|
|
1285 ; Yes, negative temperature!
|
|
1286 movff buffer+3,buffer+2 ; remove two spaces manually
|
|
1287 movff buffer+4,buffer+3
|
|
1288 TFT_temp_surfmode2:
|
|
1289 movlw 0x00
|
|
1290 movff WREG,buffer+4
|
|
1291 TFT_temp_surfmode3:
|
|
1292 STRCAT_PRINT ""
|
|
1293 call TFT_divemask_color
|
|
1294 WIN_SMALL surf_temp_column+4*8,surf_temp_row
|
|
1295 STRCPY_PRINT "°C"
|
|
1296 return
|
|
1297
|
|
1298 ;=============================================================================
|
|
1299 global TFT_divemode_menu_cursor
|
|
1300 TFT_divemode_menu_cursor:
|
|
1301 WIN_BOX_BLACK divemode_menu_item1_row,divemode_menu_item3_row+.24,divemode_menu_item1_column-.8,divemode_menu_item1_column-.1
|
|
1302 WIN_BOX_BLACK divemode_menu_item4_row,divemode_menu_item6_row+.24,divemode_menu_item4_column-.8,divemode_menu_item4_column-.1
|
|
1303 call TFT_standard_color
|
|
1304
|
|
1305 movlw divemode_menu_item1_column-.8
|
|
1306 btfsc menupos,2 ; >3?
|
|
1307 movlw divemode_menu_item4_column-.8 ; Yes
|
|
1308 movff WREG,win_leftx2
|
|
1309
|
|
1310 movff menupos,lo ; Copy menu pos
|
|
1311 movlw divemode_menu_item6_row
|
|
1312 dcfsnz lo,F
|
|
1313 movlw divemode_menu_item1_row
|
|
1314 dcfsnz lo,F
|
|
1315 movlw divemode_menu_item2_row
|
|
1316 dcfsnz lo,F
|
|
1317 movlw divemode_menu_item3_row
|
|
1318 dcfsnz lo,F
|
|
1319 movlw divemode_menu_item4_row
|
|
1320 dcfsnz lo,F
|
|
1321 movlw divemode_menu_item5_row
|
|
1322 movff WREG,win_top
|
|
1323 movlw FT_SMALL
|
|
1324 movff WREG,win_font
|
|
1325 STRCPY_PRINT "\xb7" ; print cursor
|
|
1326 return
|
|
1327
|
|
1328 global TFT_temp_divemode
|
|
1329 TFT_temp_divemode:
|
|
1330 btfsc divemode_menu ; Is the dive mode menu shown?
|
|
1331 return ; Yes, return
|
|
1332 btfsc blinking_better_gas ; blinking better Gas?
|
|
1333 return ; Yes, no update of temperature now
|
|
1334 ; temperature
|
|
1335 WIN_SMALL dive_temp_column,dive_temp_row
|
|
1336 call TFT_standard_color
|
|
1337 bsf leftbind
|
|
1338
|
|
1339 SAFE_2BYTE_COPY temperature, lo
|
|
1340 TSTOSS opt_units ; 0=°C, 1=°F
|
|
1341 bra TFT_temp_divemode_metric
|
|
1342
|
|
1343 ;TFT_temp_divemode_imperial:
|
|
1344 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
1345 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit
|
|
1346 lfsr FSR2,buffer ; Overwrite "-" (There won't be less then -18°C underwater...)
|
|
1347 bsf ignore_digit5 ; Full degrees only
|
|
1348 output_16
|
|
1349 STRCAT_TEXT tLogTunitF
|
|
1350 TFT_temp_divemode_common:
|
|
1351 bcf leftbind
|
|
1352 movlw .4 ; limit to three chars
|
|
1353 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
|
|
1354 STRCAT_PRINT ""
|
|
1355 return ; Done.
|
|
1356
|
|
1357 TFT_temp_divemode_metric:
|
|
1358 lfsr FSR2,buffer
|
|
1359 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required
|
|
1360 movlw d'3'
|
|
1361 movwf ignore_digits
|
|
1362 bsf ignore_digit5 ; Full degrees only
|
|
1363 output_16
|
|
1364 STRCAT_TEXT tLogTunitC
|
|
1365 bra TFT_temp_divemode_common ; Done.
|
|
1366
|
|
1367 TFT_active_setpoint: ; Show setpoint
|
|
1368 WIN_STD active_gas_column,active_gas_row
|
|
1369 call TFT_standard_color
|
|
1370 btfsc is_bailout ; =1: Bailout
|
|
1371 bra TFT_active_setpoint_bail ; Show "Bailout" instead of Setpoint
|
|
1372
|
|
1373 lfsr FSR2,buffer
|
|
1374 movff char_I_const_ppO2,lo
|
|
1375 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo
|
|
1376 clrf hi
|
|
1377 bsf leftbind
|
|
1378 output_16dp d'3'
|
|
1379 bcf leftbind
|
|
1380 STRCAT_TEXT tbar
|
|
1381 TSTOSS opt_ccr_mode ; =0: Fixed SP, =1: Sensor
|
|
1382 bra $+4
|
|
1383 PUTC "*"
|
|
1384 STRCAT_PRINT ""
|
|
1385
|
|
1386 TFT_active_setpoint_diluent:
|
|
1387 call TFT_standard_color
|
|
1388 WIN_SMALL active_dil_column,active_dil_row
|
|
1389 movff char_I_O2_ratio,lo ; lo now stores O2 in %
|
|
1390 movff char_I_He_ratio,hi ; hi now stores He in %
|
|
1391 rcall TFT_show_dil_divemode2 ; Show diluent (Non-Inverted in all cases)
|
|
1392
|
|
1393 btfss better_gas_available ; =1: A better gas is available and a gas change is advised in divemode
|
|
1394 return ; Done.
|
|
1395 btg blinking_better_gas ; Toggle blink bit...
|
|
1396 btfss blinking_better_gas ; blink now?
|
|
1397 return ; No, Done.
|
|
1398
|
|
1399 movlw color_yellow ; Blink in yellow
|
|
1400 call TFT_set_color
|
|
1401 WIN_SMALL_INVERT active_dil_column,active_dil_row
|
|
1402 movff char_I_O2_ratio,lo ; lo now stores O2 in %
|
|
1403 movff char_I_He_ratio,hi ; hi now stores He in %
|
|
1404 rcall TFT_show_dil_divemode2 ; Show gas
|
|
1405 WIN_INVERT .0 ; Init new Wordprocessor
|
|
1406 call TFT_standard_color
|
|
1407 return ; Done.
|
|
1408
|
|
1409 TFT_show_dil_divemode2:
|
|
1410 lfsr FSR2,buffer
|
|
1411 call customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2
|
|
1412 STRCAT_PRINT ""
|
|
1413 return
|
|
1414
|
|
1415 TFT_active_setpoint_bail:
|
|
1416 STRCPY_TEXT_PRINT tDiveBailout ; Bailout
|
|
1417 bra TFT_active_setpoint_diluent
|
|
1418
|
|
1419 global TFT_active_gas_divemode
|
|
1420 TFT_active_gas_divemode: ; Display gas/Setpoint
|
|
1421 btfsc divemode_menu ; Is the dive mode menu shown?
|
|
1422 return ; Yes, return
|
|
1423 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode
|
|
1424 return
|
|
1425 btfsc FLAG_ccr_mode ; in CCR mode
|
|
1426 bra TFT_active_setpoint ; Yes, show setpoint
|
|
1427
|
|
1428 call TFT_standard_color
|
|
1429 WIN_STD active_gas_column,active_gas_row
|
|
1430 movff char_I_O2_ratio,lo ; lo now stores O2 in %
|
|
1431 movff char_I_He_ratio,hi ; hi now stores He in %
|
|
1432 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases)
|
|
1433 btfss better_gas_available ; =1: A better gas is available and a gas change is advised in divemode
|
|
1434 return ; Done.
|
|
1435
|
|
1436 btg blinking_better_gas ; Toggle blink bit...
|
|
1437 btfss blinking_better_gas ; blink now?
|
|
1438 return ; No, Done.
|
|
1439 movlw color_yellow ; Blink in yellow
|
|
1440 call TFT_set_color
|
|
1441 WIN_STD_INVERT active_gas_column,active_gas_row
|
|
1442 movff char_I_O2_ratio,lo ; lo now stores O2 in %
|
|
1443 movff char_I_He_ratio,hi ; hi now stores He in %
|
|
1444 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases)
|
|
1445 WIN_INVERT .0 ; Init new Wordprocessor
|
|
1446 call TFT_standard_color
|
|
1447 return ; Done.
|
|
1448
|
|
1449 TFT_active_gas_divemode2:
|
|
1450 lfsr FSR2,buffer
|
|
1451 call customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2
|
|
1452 STRCAT_PRINT ""
|
|
1453 return
|
|
1454
|
|
1455 global TFT_display_decotype_surface
|
|
1456 global TFT_display_decotype_surface1 ; Used from logbook!
|
|
1457 TFT_display_decotype_surface:
|
|
1458 WIN_STD surf_decotype_column,surf_decotype_row
|
|
1459 WIN_COLOR color_lightblue
|
|
1460 lfsr FSR2,buffer
|
|
1461 movff opt_dive_mode,lo ; 0=OC, 1=CC, 2=Gauge, 3=Apnea
|
|
1462 TFT_display_decotype_surface1: ; Used from logbook!
|
|
1463 tstfsz lo
|
|
1464 bra TFT_display_decotype_surface2
|
|
1465 STRCAT_TEXT_PRINT tDvOC ; OC
|
|
1466 bra TFT_display_decotype_exit
|
|
1467 TFT_display_decotype_surface2:
|
|
1468 decfsz lo,F
|
|
1469 bra TFT_display_decotype_surface3
|
|
1470 STRCAT_TEXT_PRINT tDvCC ; CC
|
|
1471 bra TFT_display_decotype_exit
|
|
1472 TFT_display_decotype_surface3:
|
|
1473 decfsz lo,F
|
|
1474 bra TFT_display_decotype_surface4
|
|
1475 STRCAT_TEXT_PRINT tDvGauge ; Gauge
|
|
1476 bra TFT_display_decotype_exit
|
|
1477 TFT_display_decotype_surface4:
|
|
1478 STRCAT_TEXT_PRINT tDvApnea ; Apnea
|
|
1479 TFT_display_decotype_exit:
|
|
1480 call TFT_standard_color
|
|
1481 return
|
|
1482 ;=============================================================================
|
|
1483
|
|
1484 global TFT_splist_surfmode ; Show Setpoint list
|
|
1485 extern gaslist_strcat_setpoint
|
|
1486 TFT_splist_surfmode:
|
|
1487 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
|
|
1488 ;SP 1
|
|
1489 WIN_SMALL surf_gaslist_column,surf_gaslist_row
|
|
1490 lfsr FSR2,buffer
|
|
1491 clrf PRODL
|
|
1492 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL#
|
|
1493 STRCAT_PRINT ""
|
|
1494 ;SP 2
|
|
1495 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1)
|
|
1496 lfsr FSR2,buffer
|
|
1497 movlw .1
|
|
1498 movwf PRODL
|
|
1499 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL#
|
|
1500 STRCAT_PRINT ""
|
|
1501 ;SP 3
|
|
1502 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2)
|
|
1503 lfsr FSR2,buffer
|
|
1504 movlw .2
|
|
1505 movwf PRODL
|
|
1506 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL#
|
|
1507 STRCAT_PRINT ""
|
|
1508 ;SP 4
|
|
1509 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3)
|
|
1510 lfsr FSR2,buffer
|
|
1511 movlw .3
|
|
1512 movwf PRODL
|
|
1513 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL#
|
|
1514 STRCAT_PRINT ""
|
|
1515 ;SP 5
|
|
1516 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4)
|
|
1517 lfsr FSR2,buffer
|
|
1518 movlw .4
|
|
1519 movwf PRODL
|
|
1520 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL#
|
|
1521 STRCAT_PRINT ""
|
|
1522 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
|
|
1523 bcf leftbind
|
|
1524 return
|
|
1525
|
|
1526 global TFT_gaslist_surfmode
|
|
1527 TFT_gaslist_surfmode: ; Displays Gas List
|
|
1528 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
|
|
1529 extern gaslist_strcat_gas_mod
|
|
1530 ;Gas 1
|
|
1531 WIN_SMALL surf_gaslist_column,surf_gaslist_row
|
|
1532 lfsr FSR2,buffer
|
|
1533 movlw .0
|
|
1534 movwf PRODL
|
|
1535 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string
|
|
1536 STRCAT_PRINT ""
|
|
1537 ;Gas 2
|
|
1538 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1)
|
|
1539 lfsr FSR2,buffer
|
|
1540 movlw .1
|
|
1541 movwf PRODL
|
|
1542 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string
|
|
1543 STRCAT_PRINT ""
|
|
1544 ;Gas 3
|
|
1545 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2)
|
|
1546 lfsr FSR2,buffer
|
|
1547 movlw .2
|
|
1548 movwf PRODL
|
|
1549 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string
|
|
1550 STRCAT_PRINT ""
|
|
1551 ;Gas 4
|
|
1552 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3)
|
|
1553 lfsr FSR2,buffer
|
|
1554 movlw .3
|
|
1555 movwf PRODL
|
|
1556 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string
|
|
1557 STRCAT_PRINT ""
|
|
1558 ;Gas 5
|
|
1559 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4)
|
|
1560 lfsr FSR2,buffer
|
|
1561 movlw .4
|
|
1562 movwf PRODL
|
|
1563 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string
|
|
1564 STRCAT_PRINT ""
|
|
1565 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
|
|
1566 bcf leftbind
|
|
1567 return
|
|
1568
|
|
1569 global TFT_dillist_surfmode
|
|
1570 TFT_dillist_surfmode: ; Displays Diluent List
|
|
1571 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
|
|
1572 ;Dil 1
|
|
1573 WIN_SMALL surf_gaslist_column,surf_gaslist_row
|
|
1574 lfsr FSR2,buffer
|
|
1575 movlw .5
|
|
1576 movwf PRODL
|
|
1577 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string
|
|
1578 STRCAT_PRINT ""
|
|
1579 ;Dil 2
|
|
1580 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1)
|
|
1581 lfsr FSR2,buffer
|
|
1582 movlw .6
|
|
1583 movwf PRODL
|
|
1584 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string
|
|
1585 STRCAT_PRINT ""
|
|
1586 ;Dil 3
|
|
1587 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2)
|
|
1588 lfsr FSR2,buffer
|
|
1589 movlw .7
|
|
1590 movwf PRODL
|
|
1591 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string
|
|
1592 STRCAT_PRINT ""
|
|
1593 ;Dil 4
|
|
1594 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3)
|
|
1595 lfsr FSR2,buffer
|
|
1596 movlw .8
|
|
1597 movwf PRODL
|
|
1598 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string
|
|
1599 STRCAT_PRINT ""
|
|
1600 ;Dil 5
|
|
1601 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4)
|
|
1602 lfsr FSR2,buffer
|
|
1603 movlw .9
|
|
1604 movwf PRODL
|
|
1605 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string
|
|
1606 STRCAT_PRINT ""
|
|
1607 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
|
|
1608 bcf leftbind
|
|
1609 return
|
|
1610
|
|
1611 global TFT_depth
|
|
1612 TFT_depth:
|
|
1613 SAFE_2BYTE_COPY rel_pressure, lo
|
|
1614 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
|
|
1615
|
|
1616 TSTOSS opt_units ; 0=m, 1=ft
|
|
1617 bra TFT_depth_metric
|
|
1618 ;TFT_depth_imperial
|
|
1619 WIN_LARGE depth_feet_column,depth_feet_row
|
|
1620 lfsr FSR2,buffer
|
|
1621 TFT_color_code warn_depth ; Color-code the output
|
|
1622
|
|
1623 clrf sub_a+1 ; Display 0ft if lower then 30cm
|
|
1624 movlw d'30'
|
|
1625 movwf sub_a+0
|
|
1626 movff hi,sub_b+1
|
|
1627 movff lo,sub_b+0
|
|
1628 call subU16 ; sub_c = sub_a - sub_b
|
|
1629 btfss neg_flag ; Depth lower then 0.4m?
|
|
1630 bra depth_less_0.3mtr_feet ; Yes, Show 0ft manually
|
|
1631
|
|
1632 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
|
|
1633 bsf leftbind
|
|
1634 output_16 ; feet in Big font
|
|
1635 bcf leftbind
|
|
1636 movlw .3 ; limit to three chars
|
|
1637 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
|
|
1638 STRCAT_PRINT "" ; Display feet
|
|
1639 return
|
|
1640
|
|
1641 depth_less_0.3mtr_feet:
|
|
1642 STRCAT_PRINT "0 " ; manual zero
|
|
1643 return
|
|
1644
|
|
1645 TFT_depth_metric:
|
|
1646 WIN_LARGE depth_column,depth_row
|
|
1647 TFT_color_code warn_depth ; Color-code the output
|
|
1648
|
|
1649 movlw .039
|
|
1650 cpfslt hi
|
|
1651 bra depth_greater_99_84mtr
|
|
1652
|
|
1653 btfsc depth_greater_100m ; Was depth>100m during last call
|
11
|
1654 rcall TFT_clear_depth ; Yes, clear depth area
|
0
|
1655 bcf depth_greater_100m ; Do this once only...
|
|
1656
|
11
|
1657 movlw .039
|
|
1658 cpfslt hi
|
|
1659 bra depth_greater_99_84mtr
|
|
1660
|
0
|
1661 lfsr FSR2,buffer
|
|
1662 movlw HIGH d'1000'
|
|
1663 movwf sub_a+1
|
|
1664 movlw LOW d'1000'
|
|
1665 movwf sub_a+0
|
|
1666 movff hi,sub_b+1
|
|
1667 movff lo,sub_b+0
|
|
1668 incf sub_b+0,F
|
|
1669 movlw d'0'
|
|
1670 addwfc sub_b+1,F ; Add 1mbar offset
|
|
1671 call sub16 ; sub_c = sub_a - sub_b
|
|
1672 movlw ' '
|
|
1673 btfss neg_flag ; Depth lower then 10m?
|
|
1674 movwf POSTINC2 ; Yes, add extra space
|
|
1675
|
|
1676 clrf sub_a+1
|
|
1677 movlw d'99'
|
|
1678 movwf sub_a+0
|
|
1679 movff hi,sub_b+1
|
|
1680 movff lo,sub_b+0
|
|
1681 call subU16 ; sub_c = sub_a - sub_b
|
|
1682 btfss neg_flag ; Depth lower then 1m?
|
|
1683 bra tft_depth2 ; Yes, display manual Zero
|
|
1684
|
|
1685 bsf leftbind
|
|
1686 bsf ignore_digit4
|
|
1687 output_16 ; Full meters in Big font
|
|
1688 bcf leftbind
|
|
1689 bra tft_depth3
|
|
1690
|
|
1691 tft_depth2:
|
|
1692 WIN_LARGE depth_column,depth_row
|
|
1693 STRCAT "0"
|
|
1694
|
|
1695 tft_depth3:
|
|
1696 STRCAT_PRINT "" ; Display full meters
|
|
1697
|
|
1698 ; .1m in MEDIUM font
|
|
1699 WIN_MEDIUM depth_dm_column,depth_dm_row
|
|
1700 TFT_color_code warn_depth ; Color-code the output
|
|
1701
|
|
1702 SAFE_2BYTE_COPY rel_pressure, lo
|
|
1703 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
|
|
1704
|
|
1705 lfsr FSR2,buffer
|
|
1706 PUTC "."
|
|
1707 movlw HIGH d'30' ; Display 0.0m if lower then 30cm
|
|
1708 movwf sub_a+1
|
|
1709 movlw LOW d'30'
|
|
1710 movwf sub_a+0
|
|
1711 movff hi,sub_b+1
|
|
1712 movff lo,sub_b+0
|
|
1713 call subU16 ; sub_c = sub_a - sub_b
|
|
1714 btfss neg_flag ; Depth lower then 0.3m?
|
|
1715 bra depth_less_0.3mtr ; Yes, Show ".0" manually
|
|
1716
|
|
1717 movlw d'4'
|
|
1718 movwf ignore_digits
|
|
1719 bsf ignore_digit5
|
|
1720 output_16dp d'0'
|
|
1721 STRCAT_PRINT "" ; Display decimeters
|
|
1722 WIN_FONT FT_SMALL
|
|
1723 return
|
|
1724
|
|
1725 depth_less_0.3mtr:
|
|
1726 STRCAT_PRINT "0" ; Display 0.0m manually
|
|
1727 WIN_FONT FT_SMALL
|
|
1728 return
|
|
1729
|
|
1730 depth_greater_99_84mtr: ; Display only in full meters
|
|
1731 btfss depth_greater_100m ; Is depth>100m already?
|
|
1732 rcall TFT_clear_depth ; No, clear depth area and set flag
|
|
1733 ; Depth is already in hi:lo
|
|
1734 ; Show depth in Full meters
|
|
1735 ; That means ignore figure 4 and 5
|
|
1736 lfsr FSR2,buffer
|
|
1737 bsf ignore_digit4
|
|
1738 bsf leftbind
|
|
1739 output_16
|
|
1740 bcf leftbind
|
|
1741 STRCAT_PRINT "" ; Display full meters only
|
|
1742 WIN_FONT FT_SMALL
|
|
1743 return
|
|
1744
|
|
1745 TFT_clear_depth: ; No, clear depth area and set flag
|
|
1746 WIN_BOX_BLACK depth_row, .77,.0, max_depth_column-.1 ;top, bottom, left, right
|
|
1747 bsf depth_greater_100m ; Set Flag
|
|
1748 return
|
|
1749
|
|
1750 ;=============================================================================
|
|
1751
|
|
1752 ; global TFT_user_image
|
|
1753 ;TFT_user_image:
|
|
1754 ; ;---- Display user image -------------------------------------------------
|
|
1755 ; ; Compute address in external EEPROM
|
|
1756 ; movff opt_skin,WREG
|
|
1757 ; mullw 0x50
|
|
1758 ; movff PRODL,ext_flash_address+1
|
|
1759 ; movf PRODH,W
|
|
1760 ; iorlw 0x30
|
|
1761 ; movwf ext_flash_address+2
|
|
1762 ;
|
|
1763 ; ; First pixel at @+4:
|
|
1764 ; movlw 4
|
|
1765 ; movwf ext_flash_address+0
|
|
1766 ;
|
|
1767 ; ; Read first pixel
|
|
1768 ; call ext_flash_read_block_start
|
|
1769 ;; movff SSP2BUF,skin_color+1 ; TFT format: HIGH is first...
|
|
1770 ; movwf SSP2BUF ; Write to buffer to initiate new read
|
|
1771 ; btfss SSP2STAT, BF ; Next byte ready ?
|
|
1772 ; bra $-2 ; NO: wait...
|
|
1773 ;; movff SSP2BUF,skin_color+0
|
|
1774 ; call ext_flash_read_block_stop
|
|
1775 ;
|
|
1776 ; ; Make a frame of the retrieved skin color.
|
|
1777 ; setf win_color1
|
|
1778 ; setf win_color2
|
|
1779 ; WIN_FRAME_COLOR16 user_image_upper-.1, user_image_upper+.100,user_image_left-.1, user_image_left+.50
|
|
1780 ;
|
|
1781 ; WIN_LEFT user_image_left+.25
|
|
1782 ; WIN_TOP user_image_upper+.50
|
|
1783 ;
|
|
1784 ; ; Display skin icon
|
|
1785 ; clrf ext_flash_address+0
|
|
1786 ; call TFT_write_flash_image_addr
|
|
1787 ;
|
|
1788 ; ;---- Print custom text string
|
|
1789 ; WIN_LEFT user_image_left+.50+.5
|
|
1790 ; WIN_TOP user_image_upper+.0
|
|
1791 ;
|
|
1792 ; ; ---- STRNCPY : String copy from RAM
|
|
1793 ; ; lfsr FSR0, opt_name ; Source
|
|
1794 ; lfsr FSR1, .13 ; Len max
|
|
1795 ; lfsr FSR2, buffer ; destination
|
|
1796 ;TFT_user_image_1:
|
|
1797 ; movf POSTINC0,W ; Get byte
|
|
1798 ; bz TFT_user_image_2 ; End if NULL
|
|
1799 ; movwf POSTINC2 ; NO: copy
|
|
1800 ; decfsz FSR1L ; Max len reached ?
|
|
1801 ; bra TFT_user_image_1 ; NO: loop
|
|
1802 ;TFT_user_image_2:
|
|
1803 ; clrf POSTINC2 ; Mark end of string
|
|
1804 ;
|
|
1805 ; goto aa_wordprocessor ; and print
|
|
1806
|
|
1807
|
|
1808 global TFT_custom_text
|
|
1809 TFT_custom_text: ; Show the custom text
|
|
1810 lfsr FSR0, opt_name ; Source
|
|
1811 WIN_SMALL surf_customtext_column,surf_customtext_row1 ; First row
|
|
1812 rcall TFT_custom_text_2 ; Show up to 12 chars and print
|
|
1813 incfsz lo,F ; Was lo=255?
|
|
1814 return ; No, all done.
|
|
1815 lfsr FSR0, opt_name+.12 ; Source
|
|
1816 WIN_SMALL surf_customtext_column,surf_customtext_row2 ; Second row
|
|
1817 rcall TFT_custom_text_2 ; Show up to 12 chars and print
|
|
1818 incfsz lo,F ; Was lo=255?
|
|
1819 return ; No, all done.
|
|
1820 lfsr FSR0, opt_name+.24 ; Source
|
|
1821 WIN_SMALL surf_customtext_column,surf_customtext_row3 ; Third row
|
|
1822 rcall TFT_custom_text_2 ; Show up to 12 chars and print
|
|
1823 incfsz lo,F ; Was lo=255?
|
|
1824 return ; No, all done.
|
|
1825 lfsr FSR0, opt_name+.36 ; Source
|
|
1826 WIN_SMALL surf_customtext_column,surf_customtext_row4 ; Forth row
|
|
1827 rcall TFT_custom_text_2 ; Show up to 12 chars and print
|
|
1828 incfsz lo,F ; Was lo=255?
|
|
1829 return ; No, all done.
|
|
1830 lfsr FSR0, opt_name+.48 ; Source
|
|
1831 WIN_SMALL surf_customtext_column,surf_customtext_row5 ; Fifth row
|
|
1832 rcall TFT_custom_text_2 ; Show up to 12 chars and print
|
|
1833 return ; Done.
|
|
1834
|
|
1835 TFT_custom_text_2:
|
|
1836 lfsr FSR2, buffer ; destination
|
|
1837 movlw .12
|
|
1838 movwf lo ; length/line
|
|
1839 TFT_custom_text_3:
|
|
1840 movf POSTINC0,W ; Get byte
|
|
1841 bz TFT_custom_text_4 ; End if NULL
|
|
1842 movwf POSTINC2 ; NO: copy
|
|
1843 decfsz lo,F ; Max len reached ?
|
|
1844 bra TFT_custom_text_3 ; NO: loop
|
|
1845 setf lo ; lo=255 -> more to come
|
|
1846 TFT_custom_text_4:
|
|
1847 clrf POSTINC2 ; Mark end of string
|
|
1848 goto aa_wordprocessor ; print and return
|
|
1849
|
|
1850
|
|
1851 ;=============================================================================
|
|
1852 global TFT_update_surf_press
|
|
1853 TFT_update_surf_press:
|
|
1854 WIN_SMALL surf_press_column,surf_press_row
|
|
1855 call TFT_standard_color
|
|
1856 SAFE_2BYTE_COPY amb_pressure, lo
|
|
1857 lfsr FSR2,buffer
|
|
1858 movff lo,sub_a+0
|
|
1859 movff hi,sub_a+1
|
|
1860 movff last_surfpressure_30min+0,sub_b+0
|
|
1861 movff last_surfpressure_30min+1,sub_b+1
|
|
1862 call subU16 ; sub_c = sub_a - sub_b
|
|
1863 btfsc neg_flag ; Pressure lower?
|
|
1864 rcall update_surf_press2 ; Yes, test threshold
|
|
1865
|
|
1866 tstfsz sub_c+1 ; >255mbar difference?
|
|
1867 bra update_surf_press_common; Yes, display!
|
|
1868 movlw d'10' ; 10mbar noise suppression
|
|
1869 subwf sub_c+0,W
|
|
1870 btfsc STATUS,C
|
|
1871 bra update_surf_press_common; Yes, display!
|
|
1872 SAFE_2BYTE_COPY last_surfpressure_30min, lo ; Overwrite with stable value...
|
|
1873
|
|
1874 update_surf_press_common:
|
|
1875 output_16
|
|
1876 ; Show only 4 figures
|
|
1877 movff buffer+1,buffer+0
|
|
1878 movff buffer+2,buffer+1
|
|
1879 movff buffer+3,buffer+2
|
|
1880 movff buffer+4,buffer+3
|
|
1881 movlw 0x00
|
|
1882 movff WREG,buffer+4
|
|
1883 STRCAT_PRINT ""
|
|
1884 call TFT_divemask_color
|
|
1885 WIN_SMALL surf_press_column+4*8,surf_press_row
|
|
1886 STRCPY_PRINT "mbar"
|
|
1887 return
|
|
1888
|
|
1889 update_surf_press2:
|
|
1890 movff lo,sub_b+0
|
|
1891 movff hi,sub_b+1
|
|
1892 movff last_surfpressure_30min+0,sub_a+0
|
|
1893 movff last_surfpressure_30min+1,sub_a+1
|
|
1894 call subU16 ; sub_c = sub_a - sub_b
|
|
1895 return
|
|
1896
|
|
1897 ;=============================================================================
|
|
1898
|
|
1899 global TFT_update_batt_voltage
|
|
1900 TFT_update_batt_voltage:
|
|
1901 movff batt_percent,lo ; Get battery percent
|
|
1902 TFT_color_code warn_battery; Color-code battery percent
|
|
1903 WIN_TINY batt_percent_column,batt_percent_row
|
|
1904 lfsr FSR2,buffer
|
|
1905 bsf leftbind
|
|
1906 output_8
|
|
1907 bcf leftbind
|
|
1908 STRCAT_PRINT "%"
|
|
1909 call TFT_standard_color
|
|
1910 WIN_TINY batt_voltage_column,batt_voltage_row
|
|
1911 lfsr FSR2,buffer
|
|
1912 movff batt_voltage+0,lo
|
|
1913 movff batt_voltage+1,hi
|
|
1914 bsf leftbind
|
|
1915 output_16dp .2
|
|
1916 bcf leftbind
|
|
1917 PUTC 'V'
|
|
1918 movff buffer+5,buffer+3
|
|
1919 movlw 0x00
|
|
1920 movff WREG,buffer+4 ; Only "x.yV"
|
|
1921 STRCAT_PRINT ""
|
|
1922 return
|
|
1923
|
|
1924 ;update_battery_debug:
|
|
1925 ; call TFT_standard_color
|
|
1926 ; WIN_TINY .70,.0
|
|
1927 ; lfsr FSR2,buffer
|
|
1928 ; movff battery_gauge+5,xC+3
|
|
1929 ; movff battery_gauge+4,xC+2
|
|
1930 ; movff battery_gauge+3,xC+1
|
|
1931 ; movff battery_gauge+2,xC+0
|
|
1932 ; ; battery_gauge:6 is nAs
|
|
1933 ; ; devide through 65536
|
|
1934 ; ; devide through 152
|
|
1935 ; ; Result is 0.01Ah in xC+1:xC+0
|
|
1936 ; movlw LOW .152
|
|
1937 ; movwf xB+0
|
|
1938 ; movlw HIGH .152
|
|
1939 ; movwf xB+1
|
|
1940 ; call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
|
|
1941 ; bsf leftbind
|
|
1942 ; movff xC+0,lo
|
|
1943 ; movff xC+1,hi
|
|
1944 ; output_16
|
|
1945 ; STRCAT_PRINT "x.01Ah"
|
|
1946 ; WIN_FONT FT_SMALL
|
|
1947 ; bcf leftbind
|
|
1948 ; return
|
|
1949
|
|
1950 ;=============================================================================
|
|
1951
|
|
1952 global TFT_convert_signed_16bit
|
|
1953 TFT_convert_signed_16bit:
|
|
1954 bcf neg_flag ; Positive temperature
|
|
1955 btfss hi,7 ; Negative temperature ?
|
|
1956 return ; No, return
|
|
1957 ; Yes, negative temperature!
|
|
1958 bsf neg_flag ; Negative temperature
|
|
1959 PUTC '-' ; Display "-"
|
|
1960 comf hi ; Then, 16bit sign changes.
|
|
1961 negf lo
|
|
1962 btfsc STATUS,C
|
|
1963 incf hi
|
|
1964 return ; and return
|
|
1965
|
|
1966 ;=============================================================================
|
|
1967
|
|
1968 global TFT_convert_date
|
|
1969 TFT_convert_date: ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
|
|
1970 movff opt_dateformat,WREG ; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD
|
|
1971 movwf EEDATA ; used as temp here
|
|
1972 tstfsz EEDATA
|
|
1973 bra TFT_convert_date1
|
|
1974 ; EEDATA was 0
|
|
1975 ; Use MMDDYY
|
|
1976 movff convert_value_temp+0,lo ;month
|
|
1977 bsf leftbind
|
|
1978 output_99x
|
|
1979 PUTC '.'
|
|
1980 movff convert_value_temp+1,lo ;day
|
|
1981 bra TFT_convert_date1_common ;year
|
|
1982
|
|
1983 TFT_convert_date1: ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD)
|
|
1984 decfsz EEDATA,F
|
|
1985 bra TFT_convert_date2 ; EEDATA was 2
|
|
1986 ; EEDATA was 1
|
|
1987 ; Use DDMMYY
|
|
1988 movff convert_value_temp+1,lo ;day
|
|
1989 bsf leftbind
|
|
1990 output_99x
|
|
1991 PUTC '.'
|
|
1992 movff convert_value_temp+0,lo ;month
|
|
1993
|
|
1994 TFT_convert_date1_common:
|
|
1995 bsf leftbind
|
|
1996 output_99x
|
|
1997 PUTC '.'
|
|
1998 movff convert_value_temp+2,lo ;year
|
|
1999 output_99x
|
|
2000 bcf leftbind
|
|
2001 return
|
|
2002
|
|
2003 TFT_convert_date2:
|
|
2004 ; Use YYMMDD
|
|
2005 movff convert_value_temp+2,lo ;year
|
|
2006 bsf leftbind
|
|
2007 output_99x
|
|
2008 PUTC '.'
|
|
2009 movff convert_value_temp+0,lo ;month
|
|
2010 output_99x
|
|
2011 PUTC '.'
|
|
2012 movff convert_value_temp+1,lo ;day
|
|
2013 output_99x
|
|
2014 bcf leftbind
|
|
2015 return
|
|
2016
|
|
2017 ;=============================================================================
|
|
2018
|
|
2019 global TFT_convert_date_short
|
|
2020 TFT_convert_date_short: ; converts into "DD/MM" or "MM/DD" or "MM/DD" in postinc2
|
|
2021 movff opt_dateformat,WREG ; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD
|
|
2022 movwf EEDATA ; used as temp here
|
|
2023 tstfsz EEDATA
|
|
2024 bra TFT_convert_date_short1
|
|
2025 ; EEDATA was 0
|
|
2026 ; Use MMDDYY
|
|
2027 TFT_convert_date_short_common:
|
|
2028 movff convert_value_temp+0,lo ;month
|
|
2029 bsf leftbind
|
|
2030 output_99x
|
|
2031 PUTC '.'
|
|
2032 movff convert_value_temp+1,lo ;day
|
|
2033 output_99x
|
|
2034 bcf leftbind
|
|
2035 return
|
|
2036
|
|
2037 TFT_convert_date_short1:
|
|
2038 decfsz EEDATA,F
|
|
2039 bra TFT_convert_date_short_common ; EEDATA was 2 -> Use YYMMDD
|
|
2040 ; EEDATA was 1
|
|
2041 ; Use DDMMYY
|
|
2042 movff convert_value_temp+1,lo ;day
|
|
2043 bsf leftbind
|
|
2044 output_99x
|
|
2045 PUTC '.'
|
|
2046 movff convert_value_temp+0,lo ;month
|
|
2047 output_99x
|
|
2048 bcf leftbind
|
|
2049 return
|
|
2050
|
|
2051 ;=============================================================================
|
|
2052
|
|
2053 global TFT_date
|
|
2054 TFT_date:
|
|
2055 WIN_TINY surf_date_column,surf_date_row ; Init new Wordprocessor
|
|
2056 call TFT_standard_color
|
|
2057 lfsr FSR2,buffer
|
|
2058 movff month,convert_value_temp+0
|
|
2059 movff day,convert_value_temp+1
|
|
2060 movff year,convert_value_temp+2
|
|
2061 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2
|
|
2062 STRCAT_PRINT ""
|
|
2063 return
|
|
2064
|
|
2065 ;=============================================================================
|
|
2066
|
|
2067 global TFT_max_pressure
|
|
2068 TFT_max_pressure:
|
|
2069 btfsc FLAG_apnoe_mode ; different display in apnoe mode
|
|
2070 bra TFT_max_pressure_apnoe
|
|
2071 TFT_max_pressure2:
|
|
2072 SAFE_2BYTE_COPY max_pressure, lo
|
|
2073 TFT_max_pressure3:
|
|
2074 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
|
|
2075 TSTOSS opt_units ; 0=m, 1=ft
|
|
2076 bra TFT_max_pressure2_metric
|
|
2077 ;TFT_max_pressure2_imperial
|
|
2078 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
|
|
2079 WIN_MEDIUM max_depth_feet_column,max_depth_feet_row
|
|
2080 lfsr FSR2,buffer
|
|
2081 call TFT_standard_color
|
|
2082 output_16_3
|
|
2083 STRCAT_PRINT ""
|
|
2084 return
|
|
2085
|
|
2086 TFT_max_pressure2_metric:
|
11
|
2087 WIN_MEDIUM max_depth_column,max_depth_row
|
|
2088
|
|
2089 movlw .039
|
|
2090 cpfslt hi
|
|
2091 bra max_depth_greater_99_84mtr
|
|
2092
|
|
2093 btfsc max_depth_greater_100m ; Was depth>100m during last call
|
|
2094 rcall TFT_clear_max_depth ; Yes, clear depth area
|
|
2095 bcf max_depth_greater_100m ; Do this once only...
|
|
2096
|
|
2097 movlw .039
|
|
2098 cpfslt hi
|
|
2099 bra max_depth_greater_99_84mtr
|
|
2100
|
|
2101 lfsr FSR2,buffer
|
|
2102 movlw HIGH d'1000'
|
|
2103 movwf sub_a+1
|
|
2104 movlw LOW d'1000'
|
|
2105 movwf sub_a+0
|
|
2106 movff hi,sub_b+1
|
|
2107 movff lo,sub_b+0
|
|
2108 incf sub_b+0,F
|
|
2109 movlw d'0'
|
|
2110 addwfc sub_b+1,F ; Add 1mbar offset
|
|
2111 call sub16 ; sub_c = sub_a - sub_b
|
|
2112 movlw ' '
|
|
2113 btfss neg_flag ; Depth lower then 10m?
|
|
2114 movwf POSTINC2 ; Yes, add extra space
|
|
2115
|
|
2116 clrf sub_a+1
|
|
2117 movlw d'99'
|
|
2118 movwf sub_a+0
|
|
2119 movff hi,sub_b+1
|
|
2120 movff lo,sub_b+0
|
|
2121 call subU16 ; sub_c = sub_a - sub_b
|
|
2122 btfss neg_flag ; Depth lower then 1m?
|
|
2123 bra tft_max_depth2 ; Yes, display manual Zero
|
|
2124
|
|
2125 bsf ignore_digit4 ; no 0.1m
|
|
2126 bsf leftbind
|
|
2127 output_16
|
|
2128 bra tft_max_depth3
|
|
2129
|
|
2130 tft_max_depth2:
|
0
|
2131 WIN_MEDIUM max_depth_column,max_depth_row
|
11
|
2132 STRCAT "0"
|
|
2133
|
|
2134 tft_max_depth3:
|
0
|
2135 call TFT_standard_color
|
11
|
2136 STRCAT_PRINT "" ; Display full meters
|
|
2137 bcf leftbind
|
|
2138
|
|
2139 ; .1m in SMALL font
|
|
2140 WIN_SMALL max_depth_dm_column,max_depth_dm_row
|
|
2141
|
|
2142 SAFE_2BYTE_COPY max_pressure, lo
|
|
2143 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
|
|
2144
|
|
2145 lfsr FSR2,buffer
|
|
2146 PUTC "."
|
|
2147
|
|
2148 movlw d'4'
|
|
2149 movwf ignore_digits
|
|
2150 bsf ignore_digit5
|
|
2151 bsf leftbind
|
|
2152 output_16dp d'0'
|
|
2153 STRCAT_PRINT "" ; Display decimeters
|
|
2154 bcf leftbind
|
|
2155 return
|
|
2156
|
|
2157 max_depth_greater_99_84mtr: ; Display only in full meters
|
|
2158 btfss max_depth_greater_100m ; Is max depth>100m already?
|
|
2159 rcall TFT_clear_max_depth ; No, clear max depth area and set flag
|
|
2160 ; Max. Depth is already in hi:lo
|
|
2161 ; Show max. depth in Full meters
|
|
2162 ; That means ignore figure 4 and 5
|
|
2163 lfsr FSR2,buffer
|
|
2164 bsf ignore_digit4
|
|
2165 bsf leftbind
|
0
|
2166 output_16
|
11
|
2167 bcf leftbind
|
|
2168 STRCAT_PRINT "" ; Display full meters only
|
|
2169 WIN_FONT FT_SMALL
|
0
|
2170 return
|
|
2171
|
11
|
2172 TFT_clear_max_depth: ; No, clear max. depth area and set flag
|
|
2173 WIN_BOX_BLACK max_depth_row,.49,max_depth_column, max_depth_dm_column+.13 ;top, bottom, left, right
|
|
2174 bsf max_depth_greater_100m ; Set Flag
|
|
2175 return
|
|
2176
|
|
2177
|
0
|
2178 TFT_max_pressure_apnoe:
|
|
2179 btfss FLAG_active_descent ; Are we descending?
|
|
2180 bra TFT_max_pressure2 ; Yes, show normal max.
|
|
2181 SAFE_2BYTE_COPY apnoe_max_pressure, lo
|
|
2182 bra TFT_max_pressure3 ; Show apnoe_max_pressure as max. depth
|
|
2183
|
|
2184 global TFT_display_apnoe_last_max
|
|
2185 TFT_display_apnoe_last_max:
|
|
2186 call TFT_divemask_color
|
|
2187 WIN_TINY last_max_apnoe_text_column,last_max_apnoe_text_row
|
|
2188 STRCPY_TEXT_PRINT tApnoeMax
|
|
2189
|
|
2190 call TFT_standard_color
|
|
2191 SAFE_2BYTE_COPY max_pressure, lo
|
|
2192 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
|
|
2193 TSTOSS opt_units ; 0=m, 1=ft
|
|
2194 bra TFT_display_apnoe_last_m_metric
|
|
2195 ;TFT_display_apnoe_last_max_imperial
|
|
2196 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
|
|
2197 WIN_MEDIUM apnoe_last_max_depth_column,apnoe_last_max_depth_row
|
|
2198 lfsr FSR2,buffer
|
|
2199 output_16
|
|
2200 STRCAT_PRINT ""
|
|
2201 return
|
|
2202
|
|
2203 TFT_display_apnoe_last_m_metric:
|
|
2204 WIN_MEDIUM apnoe_last_max_depth_column,apnoe_last_max_depth_row
|
|
2205 lfsr FSR2,buffer
|
|
2206 bsf ignore_digit5 ; do not display 1cm depth
|
|
2207 output_16dp d'3'
|
|
2208 STRCAT_PRINT ""
|
|
2209 return
|
|
2210
|
|
2211 ;=============================================================================
|
|
2212 global TFT_divemins
|
|
2213 TFT_divemins:
|
|
2214 movff divemins+0,lo
|
|
2215 movff divemins+1,hi
|
|
2216
|
|
2217 btfsc no_more_divesecs ; Ignore seconds?
|
|
2218 bra TFT_divemins2 ; Show minutes only
|
|
2219
|
|
2220 movlw .99
|
|
2221 cpfsgt lo ; bigger then 99?
|
|
2222 bra TFT_divemins1 ; No show mins:secs
|
|
2223 ; Yes, remove second display for the rest of the dive and clear seconds
|
|
2224 bsf no_more_divesecs ; Set flag
|
|
2225 ; Clear rest of seconds
|
|
2226 WIN_BOX_BLACK divetime_row, warning1_row,divetime_column,.159 ;top, bottom, left, right
|
|
2227 bra TFT_divemins2 ; Show minutes only
|
|
2228
|
|
2229 TFT_divemins1:
|
|
2230 WIN_MEDIUM divetime_column, divetime_row
|
|
2231 lfsr FSR2,buffer
|
|
2232 output_16_3 ; displays only last three figures from a 16Bit value (0-999)
|
|
2233 call TFT_standard_color
|
|
2234 STRCAT_PRINT "" ; Show minutes in large font
|
|
2235
|
|
2236 WIN_SMALL divetime_secs_column, divetime_secs_row ; left position for two sec figures
|
|
2237 lfsr FSR2,buffer
|
|
2238 PUTC ':'
|
|
2239 bsf leftbind
|
|
2240 movff divesecs,lo
|
|
2241 output_99x
|
|
2242 bcf leftbind
|
|
2243 STRCAT_PRINT "" ; Show seconds in small font
|
|
2244 return
|
|
2245
|
|
2246 TFT_divemins2:
|
|
2247 WIN_MEDIUM divetime_minsonly_column, divetime_row
|
|
2248 lfsr FSR2,buffer
|
|
2249 output_16
|
|
2250 call TFT_standard_color
|
|
2251 STRCAT_PRINT "" ; Show minutes in large font
|
|
2252 return
|
|
2253
|
|
2254 ;=============================================================================
|
|
2255 global TFT_display_apnoe_surface
|
|
2256 TFT_display_apnoe_surface:
|
|
2257 call TFT_divemask_color
|
|
2258 WIN_TINY surface_apnoe_text_column,surface_apnoe_text_row
|
|
2259 STRCPY_TEXT_PRINT tApnoeSurface
|
|
2260
|
|
2261 call TFT_standard_color
|
|
2262 WIN_MEDIUM surface_time_apnoe_column, surface_time_apnoe_row
|
|
2263 movff apnoe_surface_mins,lo
|
|
2264 lfsr FSR2,buffer
|
|
2265 output_8
|
|
2266 PUTC ':'
|
|
2267 movff apnoe_surface_secs,lo
|
|
2268 output_99x
|
|
2269 STRCAT_PRINT ""
|
|
2270 return
|
|
2271
|
|
2272 global TFT_apnoe_clear_surface
|
|
2273 TFT_apnoe_clear_surface:
|
|
2274 ; Clear Surface timer....
|
|
2275 WIN_BOX_BLACK surface_apnoe_text_row, .239, surface_apnoe_text_column, .159 ;top, bottom, left, right
|
|
2276 return
|
|
2277
|
|
2278 global TFT_display_apnoe_descent
|
|
2279 TFT_display_apnoe_descent: ; Descent divetime
|
|
2280 movff apnoe_mins,lo
|
|
2281 clrf hi
|
|
2282 WIN_MEDIUM divetime_column, divetime_row
|
|
2283 lfsr FSR2,buffer
|
|
2284 output_16_3 ; displays only last three figures from a 16Bit value (0-999)
|
|
2285 call TFT_standard_color
|
|
2286 STRCAT_PRINT "" ; Show minutes in large font
|
|
2287
|
|
2288 WIN_SMALL divetime_secs_column, divetime_secs_row ; left position for two sec figures
|
|
2289 lfsr FSR2,buffer
|
|
2290 PUTC ':'
|
|
2291 bsf leftbind
|
|
2292 movff apnoe_secs,lo
|
|
2293 output_99x
|
|
2294 bcf leftbind
|
|
2295 STRCAT_PRINT "" ; Show seconds in small font
|
|
2296 return
|
|
2297
|
|
2298 ;=============================================================================
|
|
2299 ; Writes ostc3 #Serial and Firmware version in splash screen
|
|
2300 ;
|
|
2301 global TFT_serial
|
|
2302 TFT_serial:
|
|
2303 WIN_TINY .0,.239-.14
|
|
2304
|
|
2305 STRCPY "OSTC3 #" ; Won't translate that...
|
|
2306 rcall TFT_cat_serial
|
|
2307
|
|
2308 STRCAT " v"
|
|
2309 rcall TFT_cat_firmware
|
|
2310
|
|
2311 ifdef __DEBUG
|
|
2312 movlw color_grey ; Write header in blue when
|
|
2313 call TFT_set_color ; compiled in DEBUG mode...
|
|
2314 STRCAT_PRINT "DEBUG"
|
|
2315 call TFT_standard_color
|
|
2316 else
|
|
2317 call TFT_standard_color
|
|
2318 STRCAT_PRINT ""
|
|
2319
|
|
2320 movlw softwareversion_beta ; =1: Beta, =0: Release
|
|
2321 decfsz WREG,F
|
|
2322 return ; Release version -> Return
|
|
2323
|
|
2324 call TFT_warnings_color
|
|
2325 WIN_LEFT .160-4*9/2 ; Right pad.
|
|
2326 STRCPY_TEXT_PRINT tBeta
|
|
2327 call TFT_standard_color
|
|
2328 endif
|
|
2329
|
|
2330 return
|
|
2331
|
|
2332
|
|
2333
|
|
2334 ;=============================================================================
|
|
2335 ; For the Information menu: append firmware x.yy version.
|
|
2336 global info_menu_firmware
|
|
2337 extern tFirmware
|
|
2338 info_menu_firmware:
|
|
2339 lfsr FSR1,tFirmware
|
|
2340 call strcat_text
|
|
2341 TFT_cat_firmware:
|
|
2342 movlw softwareversion_x
|
|
2343 movwf lo
|
|
2344 bsf leftbind
|
|
2345 output_8
|
|
2346 PUTC '.'
|
|
2347 movlw softwareversion_y
|
|
2348 movwf lo
|
|
2349 output_99x
|
|
2350 bcf leftbind
|
|
2351 return
|
|
2352
|
|
2353 ;-----------------------------------------------------------------------------
|
|
2354 ; For the Information menu: append serial number ostc3#42.
|
|
2355 global info_menu_serial
|
|
2356 extern tSerial
|
|
2357 info_menu_serial:
|
|
2358 lfsr FSR1,tSerial
|
|
2359 call strcat_text
|
|
2360 TFT_cat_serial:
|
|
2361 clrf EEADRH
|
|
2362 clrf EEADR ; Get Serial number LOW
|
|
2363 call read_eeprom ; read byte
|
|
2364 movff EEDATA,lo
|
|
2365 incf EEADR,F ; Get Serial number HIGH
|
|
2366 call read_eeprom ; read byte
|
|
2367 movff EEDATA,hi
|
|
2368
|
|
2369 bsf leftbind
|
|
2370 output_16
|
|
2371 bcf leftbind
|
|
2372 return
|
|
2373
|
|
2374 ;-----------------------------------------------------------------------------
|
|
2375 ; For the Information menu: Append total dives
|
|
2376 global info_menu_total_dives
|
|
2377 extern tTotalDives
|
|
2378 info_menu_total_dives:
|
|
2379 lfsr FSR1,tTotalDives
|
|
2380 call strcat_text
|
|
2381 TFT_cat_total_dives:
|
|
2382 read_int_eeprom .2
|
|
2383 movff EEDATA,lo
|
|
2384 read_int_eeprom .3
|
|
2385 movff EEDATA,hi
|
|
2386 bsf leftbind
|
|
2387 output_16
|
|
2388 bcf leftbind
|
|
2389 return
|
|
2390
|
|
2391 ;-----------------------------------------------------------------------------
|
|
2392 ; ppO2 menu
|
|
2393 global divesets_ppo2_max
|
|
2394 extern tPPO2Max
|
|
2395 extern tbar
|
|
2396 divesets_ppo2_max:
|
|
2397 lfsr FSR1,tPPO2Max
|
|
2398 call strcat_text
|
|
2399 movff opt_ppO2_max,lo
|
|
2400 movlw ppo2_warning_high
|
|
2401 divesets_ppo2_common:
|
|
2402 movwf up ; Save default value
|
|
2403 clrf hi
|
|
2404 bsf leftbind
|
|
2405 output_16dp d'3'
|
|
2406 bcf leftbind
|
|
2407 lfsr FSR1,tbar
|
|
2408 call strcat_text
|
|
2409
|
|
2410 movf up,W ; Default value
|
|
2411 cpfseq lo ; Current value
|
|
2412 bra divesets_ppo2_common2 ; Not default, add *
|
|
2413 return ; Default, Done.
|
|
2414 divesets_ppo2_common2:
|
|
2415 PUTC "*"
|
|
2416 return ; Done.
|
|
2417
|
|
2418 global divesets_ppo2_min
|
|
2419 extern tPPO2Min
|
|
2420 divesets_ppo2_min:
|
|
2421 lfsr FSR1,tPPO2Min
|
|
2422 call strcat_text
|
|
2423 movff opt_ppO2_min,lo
|
|
2424 movlw ppo2_warning_low
|
|
2425 bra divesets_ppo2_common
|
|
2426
|
|
2427 ;=============================================================================
|
|
2428
|
|
2429 global TFT_clear_warning_text
|
|
2430 TFT_clear_warning_text:
|
|
2431 btfss divemode ; in divemode?
|
|
2432 bra TFT_clear_warning_text2 ; No, setup for surface mode
|
|
2433 WIN_BOX_BLACK warning1_row, divemode_customview_row-3, warning1_column, warning_icon_column-3 ;top, bottom, left, right
|
|
2434 return
|
|
2435 TFT_clear_warning_text2:
|
|
2436 WIN_BOX_BLACK surf_warning1_row, surf_warning2_row+.24, surf_warning1_column, surf_warning1_column+.76 ;top, bottom, left, right
|
|
2437 return
|
|
2438
|
|
2439 global TFT_clear_warning_text_2nd_row
|
|
2440 TFT_clear_warning_text_2nd_row:
|
|
2441 btfss divemode ; in divemode?
|
|
2442 bra TFT_clear_warning_text_2nd_2 ; No, setup for surface mode
|
|
2443 WIN_BOX_BLACK warning2_row, divemode_customview_row-3, warning2_column, warning_icon_column-3 ;top, bottom, left, right
|
|
2444 return
|
|
2445 TFT_clear_warning_text_2nd_2:
|
|
2446 WIN_BOX_BLACK surf_warning2_row, surf_warning2_row+.24, surf_warning2_column, surf_warning2_column+.76 ;top, bottom, left, right
|
|
2447 return
|
|
2448
|
|
2449 global TFT_fillup_with_spaces
|
|
2450 TFT_fillup_with_spaces: ; Fillup FSR2 with spaces (Total string length in #WREG)
|
|
2451 movwf lo ; save max. string length into lo
|
|
2452 movf FSR2L,W ; Get current string length
|
|
2453 subwf lo,F ; lo-WREG
|
|
2454 btfsc STATUS,N ; longer then #lo already?
|
|
2455 return ; Yes, done.
|
|
2456 tstfsz lo ; Zero?
|
|
2457 bra TFT_fillup_with_spaces2 ; No.
|
|
2458 return ; Yes, done.
|
|
2459 TFT_fillup_with_spaces2:
|
|
2460 PUTC " " ; Add one space
|
|
2461 decfsz lo,F ; All done?
|
|
2462 bra TFT_fillup_with_spaces2 ; No, loop
|
|
2463 return ; Done.
|
|
2464
|
|
2465 global TFT_desaturation_time
|
|
2466 TFT_desaturation_time:
|
|
2467 rcall TFT_warning_set_window ; Sets the row and column for the current warning
|
|
2468 tstfsz WREG ; Is there room for the warning?
|
|
2469 return ; No
|
|
2470 STRCPY "Desat:"
|
|
2471 movff desaturation_time+0,lo ; divide by 60...
|
|
2472 movff desaturation_time+1,hi
|
|
2473 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo)
|
|
2474 bsf leftbind
|
|
2475 movf lo,W
|
|
2476 movff hi,lo
|
|
2477 movwf hi ; exchange lo and hi...
|
|
2478 output_8 ; Hours
|
|
2479 PUTC ':'
|
|
2480 movff hi,lo ; Minutes
|
|
2481 output_99x
|
|
2482 bcf leftbind
|
|
2483 movlw surf_warning_length ; Only use surface string length
|
|
2484 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
|
|
2485 STRCAT_PRINT ""
|
|
2486 return
|
|
2487
|
|
2488 global TFT_nofly_time
|
|
2489 TFT_nofly_time:
|
|
2490 rcall TFT_warning_set_window ; Sets the row and column for the current warning
|
|
2491 tstfsz WREG ; Is there room for the warning?
|
|
2492 return ; No
|
|
2493 STRCPY "NoFly:"
|
|
2494 movff nofly_time+0,lo ; divide by 60...
|
|
2495 movff nofly_time+1,hi
|
|
2496 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo)
|
|
2497 bsf leftbind
|
|
2498 movf lo,W
|
|
2499 movff hi,lo
|
|
2500 movwf hi ; exchange lo and hi...
|
|
2501 output_8 ; Hours
|
|
2502 PUTC ':'
|
|
2503 movff hi,lo ; Minutes
|
|
2504 output_99x
|
|
2505 bcf leftbind
|
|
2506 movlw surf_warning_length ; Only use surface string length
|
|
2507 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
|
|
2508 STRCAT_PRINT ""
|
|
2509 return
|
|
2510
|
|
2511 global TFT_warning_agf
|
|
2512 TFT_warning_agf:
|
|
2513 rcall TFT_warning_set_window ; Sets the row and column for the current warning
|
|
2514 tstfsz WREG ; Is there room for the warning?
|
|
2515 return ; No
|
|
2516 call TFT_warnings_color
|
|
2517 STRCPY_TEXT tDiveaGF_active ; "aGF!"
|
|
2518 movlw warning_length ; Divemode string length
|
|
2519 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
|
|
2520 STRCAT_PRINT ""
|
|
2521 call TFT_standard_color
|
|
2522 return
|
|
2523
|
|
2524 global TFT_warning_gf
|
|
2525 TFT_warning_gf: ;GF
|
|
2526 rcall TFT_warning_set_window ; Sets the row and column for the current warning
|
|
2527 tstfsz WREG ; Is there room for the warning?
|
|
2528 return ; No
|
|
2529 TFT_color_code warn_gf ; Color-code Output
|
|
2530 STRCPY "GF:"
|
|
2531 movff char_O_gradient_factor,lo ; gradient factor
|
|
2532 bsf leftbind
|
|
2533 output_8
|
|
2534 PUTC "%"
|
|
2535 movlw warning_length ; Divemode string length
|
|
2536 btfss divemode ; In Divemode?
|
|
2537 movlw surf_warning_length ; No, use surface string length
|
|
2538 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
|
|
2539 STRCAT_PRINT ""
|
|
2540 bcf leftbind
|
|
2541 call TFT_standard_color
|
|
2542 return
|
|
2543
|
|
2544 TFT_warning_set_window: ; Sets the row and column for the current warning
|
|
2545 ; ignore warning (now)?
|
|
2546 decf warning_counter,W ; -1
|
|
2547 bcf STATUS,C
|
|
2548 rrcf WREG,W ; (warning_counter-1)/2
|
|
2549 cpfseq warning_page
|
|
2550 retlw .255 ; WREG <> 0 -> Warning window not defined
|
|
2551
|
|
2552 call TFT_standard_color
|
|
2553
|
|
2554 btfss divemode ; in divemode?
|
|
2555 bra TFT_warning_set_window3 ; No, setup for surface mode
|
|
2556
|
|
2557 btfss warning_counter,0 ; Toggle with each warning
|
|
2558 bra TFT_warning_set_window2
|
|
2559 WIN_SMALL warning1_column,warning1_row
|
|
2560 bcf second_row_warning ; =1: The second row contains a warning
|
|
2561 retlw .0 ; WREG=0 -> Warning window defined
|
|
2562 TFT_warning_set_window2:
|
|
2563 WIN_SMALL warning2_column,warning2_row
|
|
2564 bsf second_row_warning ; =1: The second row contains a warning
|
|
2565 retlw .0 ; WREG=0 -> Warning window defined
|
|
2566
|
|
2567 TFT_warning_set_window3:
|
|
2568 btfss warning_counter,0 ; Toggle with each warning
|
|
2569 bra TFT_warning_set_window4
|
|
2570 WIN_SMALL surf_warning1_column,surf_warning1_row
|
|
2571 bcf second_row_warning ; =1: The second row contains a warning
|
|
2572 retlw .0 ; WREG=0 -> Warning window defined
|
|
2573 TFT_warning_set_window4:
|
|
2574 WIN_SMALL surf_warning2_column,surf_warning2_row
|
|
2575 bsf second_row_warning ; =1: The second row contains a warning
|
|
2576 retlw .0 ; WREG=0 -> Warning window defined
|
|
2577
|
|
2578
|
|
2579 global TFT_update_batt_percent_divemode
|
|
2580 TFT_update_batt_percent_divemode:
|
|
2581 rcall TFT_warning_set_window ; Sets the row and column for the current warning
|
|
2582 tstfsz WREG ; Is there room for the warning?
|
|
2583 return ; No
|
|
2584 movff batt_percent,lo ; Get battery percent
|
|
2585 TFT_color_code warn_battery; Color-code battery percent
|
|
2586 STRCPY "Batt:"
|
|
2587 bsf leftbind
|
|
2588 output_8
|
|
2589 bcf leftbind
|
|
2590 PUTC "%"
|
|
2591 movlw warning_length ; Divemode string length
|
|
2592 btfss divemode ; In Divemode?
|
|
2593 movlw surf_warning_length ; No, use surface string length
|
|
2594 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
|
|
2595 STRCAT_PRINT ""
|
|
2596 call TFT_standard_color
|
|
2597 return
|
|
2598
|
|
2599
|
|
2600 global TFT_gf_mask ; Setup Mask
|
|
2601 TFT_gf_mask:
|
|
2602 ; The mask
|
|
2603 call TFT_divemask_color
|
|
2604 WIN_TINY dive_gf_column1,dive_gf_text_row
|
|
2605 STRCPY_TEXT_PRINT tGFactors
|
|
2606 WIN_TINY dive_gf_column2,dive_gf_text_row
|
|
2607 STRCPY_TEXT_PRINT taGFactors
|
|
2608 WIN_TINY dive_gf_column3,dive_gf_text_row
|
|
2609 STRCPY_TEXT_PRINT tGFInfo
|
|
2610
|
|
2611 ; Show GF (Static)
|
|
2612 call TFT_disabled_color
|
|
2613 btfss use_agf
|
|
2614 call TFT_standard_color
|
|
2615
|
|
2616 WIN_STD dive_gf_column,dive_gf_row
|
|
2617 lfsr FSR2,buffer
|
|
2618 bsf leftbind
|
|
2619 movff opt_GF_low,lo
|
|
2620 output_8
|
|
2621 PUTC "/"
|
|
2622 movff opt_GF_high,lo
|
|
2623 output_8
|
|
2624 STRCAT_PRINT ""
|
|
2625 ; Show aGF (Static)
|
|
2626 call TFT_standard_color
|
|
2627 TSTOSS opt_enable_aGF ; =1: aGF can be selected underwater
|
|
2628 bra TFT_gf_mask2 ; Show "---" instead
|
|
2629
|
|
2630 btfss use_agf
|
|
2631 call TFT_disabled_color
|
|
2632
|
|
2633 WIN_STD dive_agf_column,dive_agf_row
|
|
2634 lfsr FSR2,buffer
|
|
2635 movff opt_aGF_low,lo
|
|
2636 output_8
|
|
2637 PUTC "/"
|
|
2638 movff opt_aGF_high,lo
|
|
2639 output_8
|
|
2640 STRCAT_PRINT ""
|
|
2641 bcf leftbind
|
|
2642 call TFT_standard_color
|
|
2643 return
|
|
2644
|
|
2645 TFT_gf_mask2:
|
|
2646 WIN_STD dive_agf_column+.10,dive_agf_row
|
|
2647 STRCPY_PRINT "---"
|
|
2648 bcf leftbind
|
|
2649 return
|
|
2650
|
|
2651 global TFT_gf_info ; Show GF informations
|
|
2652 TFT_gf_info:
|
|
2653 ; Show current GF
|
|
2654 movff char_O_gradient_factor,lo ; gradient factor absolute (Non-GF model)
|
|
2655 movff char_I_deco_model,hi
|
|
2656 decfsz hi,F ; jump over next line if char_I_deco_model == 1
|
|
2657 movff char_O_relative_gradient_GF,lo ; gradient factor relative (GF model)
|
|
2658 WIN_STD dive_currentgf_column,dive_currentgf_row
|
|
2659 lfsr FSR2,buffer
|
|
2660 output_8
|
|
2661 STRCAT_PRINT "%"
|
|
2662 return
|
|
2663
|
|
2664 global TFT_ead_end_tissues_clock_mask ; Setup Mask
|
|
2665 TFT_ead_end_tissues_clock_mask:
|
|
2666 ; The mask
|
|
2667 call TFT_divemask_color
|
|
2668 ; Put three columns at HUD positions
|
|
2669 WIN_TINY dive_custom_hud_column1,dive_custom_hud_row
|
|
2670 STRCPY_TEXT_PRINT tDiveClock
|
|
2671 WIN_TINY dive_custom_hud_column2,dive_custom_hud_row
|
|
2672 STRCPY_TEXT_PRINT tDiveEAD_END
|
|
2673 WIN_TINY dive_custom_hud_column3,dive_custom_hud_row
|
|
2674 STRCPY_TEXT_PRINT tDiveTissues
|
|
2675 call TFT_standard_color
|
|
2676 return
|
|
2677
|
|
2678 global TFT_ead_end_tissues_clock ; Show EAD/END, Tissues and clock
|
|
2679 TFT_ead_end_tissues_clock:
|
|
2680 ; Update clock and date
|
|
2681 WIN_SMALL dive_clock_column,dive_clock_row
|
|
2682 call TFT_clock2 ; print clock
|
|
2683 ; WIN_SMALL dive_date_column,dive_date_row
|
|
2684 ; lfsr FSR2,buffer
|
|
2685 ; movff month,convert_value_temp+0
|
|
2686 ; movff day,convert_value_temp+1
|
|
2687 ; movff year,convert_value_temp+2
|
|
2688 ; rcall TFT_convert_date_short ; converts into "DD/MM" or "MM/DD" or "MM/DD" in postinc2
|
|
2689 ; STRCAT_PRINT "."
|
|
2690
|
|
2691 ; Show END/EAD
|
|
2692 WIN_SMALL dive_ead_column,dive_ead_row
|
|
2693 STRCPY_TEXT tEAD ; EAD:
|
|
2694 movff char_O_EAD,lo
|
|
2695 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars
|
|
2696 WIN_SMALL dive_end_column,dive_end_row
|
|
2697 STRCPY_TEXT tEND ; END:
|
|
2698 movff char_O_END,lo
|
|
2699 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars
|
|
2700
|
|
2701 ; Show tissue diagram
|
|
2702 call TFT_divemask_color
|
|
2703 WIN_TINY dive_tissue_N2_column,dive_tissue_N2_row
|
|
2704 STRCPY_TEXT_PRINT tN2
|
|
2705 WIN_TINY dive_tissue_He_column,dive_tissue_He_row
|
|
2706 STRCPY_TEXT_PRINT tHe
|
|
2707 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation)
|
|
2708 movlb b'00000001' ; select ram bank 1
|
|
2709 rcall DISP_tissue_saturation_graph ; Show char_O_tissue_N2_saturation and char_O_tissue_He_saturation
|
|
2710 return
|
|
2711
|
|
2712 TFT_end_ead_common: ; print "lo m" (or ft) and limit to 8 chars
|
|
2713 bsf leftbind
|
|
2714 TSTOSS opt_units ; 0=Meters, 1=Feets
|
|
2715 bra TFT_end_ead_common_metric
|
|
2716 ;TFT_end_ead_common_imperial:
|
|
2717 ; With lo in m
|
|
2718 movf lo,W
|
|
2719 mullw .100 ; PRODL:PRODH = mbar/min
|
|
2720 movff PRODL,lo
|
|
2721 movff PRODH,hi
|
|
2722 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
|
|
2723 output_16_3
|
|
2724 STRCAT_TEXT tFeets
|
|
2725 clrf WREG
|
|
2726 movff WREG,buffer+.8 ; limit string length to 8
|
|
2727 bra TFT_end_ead_common_exit
|
|
2728 TFT_end_ead_common_metric:
|
|
2729 output_8
|
|
2730 STRCAT_TEXT tMeters
|
|
2731 TFT_end_ead_common_exit:
|
|
2732 bcf leftbind
|
|
2733 movlw .8
|
|
2734 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
|
|
2735 STRCAT_PRINT ""
|
|
2736 return
|
|
2737
|
|
2738 global TFT_surface_tissues
|
|
2739 TFT_surface_tissues: ; Show Tissue diagram in surface mode
|
|
2740 WIN_SMALL surf_tissue_N2_column,surf_tissue_N2_row
|
|
2741 STRCPY_TEXT_PRINT tN2
|
|
2742 WIN_SMALL surf_tissue_He_column,surf_tissue_He_row
|
|
2743 STRCPY_TEXT_PRINT tHe
|
|
2744
|
|
2745 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation)
|
|
2746 movlb b'00000001' ; select ram bank 1
|
|
2747
|
|
2748 movlw color_deepblue
|
|
2749 call TFT_set_color ; Make this configurable?
|
|
2750 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.29,.29
|
|
2751 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.37,.37
|
|
2752 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.45,.45
|
|
2753 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.53,.53
|
|
2754 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.61,.61
|
|
2755 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.69,.69
|
|
2756 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.77,.77
|
|
2757 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.85,.85
|
|
2758 WIN_FRAME_STD surf_tissue_diagram_top, surf_tissue_diagram_bottom, surf_tissue_diagram_left, surf_tissue_diagram_right ; outer frame
|
|
2759
|
|
2760 movlw .1
|
|
2761 movff WREG,win_height ; row bottom (0-239)
|
|
2762 movlw surf_tissue_diagram_left+.4 ; Surface mode
|
|
2763 movff WREG,win_leftx2 ; column left (0-159)
|
|
2764 movlw surf_tissue_diagram_right-surf_tissue_diagram_left-4 ; Width
|
|
2765 movff WREG,win_width
|
|
2766
|
|
2767 ;---- Draw N2 Tissues
|
|
2768 lfsr FSR2, char_O_tissue_N2_saturation
|
|
2769 movlw d'16'
|
|
2770 movwf wait_temp ; 16 tissues
|
|
2771 clrf waitms_temp ; Row offset
|
|
2772 surf_tissue_saturation_graph_N2:
|
|
2773 movlw surf_tissue_diagram_top+.23 ; surface mode
|
|
2774 addwf waitms_temp,W
|
|
2775 movff WREG,win_top ; row top (0-239)
|
|
2776 rcall surf_tissue_saturation_loop ; Show one tissue
|
|
2777 decfsz wait_temp,F
|
|
2778 bra surf_tissue_saturation_graph_N2
|
|
2779
|
|
2780 ;---- Draw He Tissues ----------------------------------------------------
|
|
2781 lfsr FSR2, char_O_tissue_He_saturation
|
|
2782 movlw d'16'
|
|
2783 movwf wait_temp ; 16 tissues
|
|
2784 clrf waitms_temp ; Row offset
|
|
2785 surf_tissue_saturation_graph_He:
|
|
2786 movlw surf_tissue_diagram_top+.23+.56 ; surface mode
|
|
2787 addwf waitms_temp,W
|
|
2788 movff WREG,win_top ; row top (0-239)
|
|
2789 rcall surf_tissue_saturation_loop ; Show one tissue
|
|
2790 decfsz wait_temp,F
|
|
2791 bra surf_tissue_saturation_graph_He
|
|
2792 return
|
|
2793
|
|
2794 surf_tissue_saturation_loop:
|
|
2795 call TFT_standard_color
|
|
2796 movlw .2 ; row spacing
|
|
2797 addwf waitms_temp,F
|
|
2798 movf POSTINC2,W ; Get tissue load
|
|
2799 bcf STATUS,C
|
|
2800 rrcf WREG ; And divide by 2
|
|
2801 movwf temp1
|
|
2802 movlw .20
|
|
2803 subwf temp1,F ; Subtract some offset
|
|
2804 movff win_width,WREG ; Max width.
|
|
2805 cpfslt temp1 ; skip if WREG < win_width
|
|
2806 movwf temp1
|
|
2807 movff temp1,win_bargraph
|
|
2808 call TFT_box
|
|
2809 return
|
|
2810
|
|
2811 ;=============================================================================
|
|
2812 ; Draw saturation graph, is surface mode or in dive mode.
|
|
2813 DISP_tissue_saturation_graph:
|
|
2814 ;---- Draw Frame
|
|
2815 WIN_FRAME_STD tissue_diagram_top, tissue_diagram_bottom, tissue_diagram_left, .159 ; outer frame
|
|
2816
|
|
2817 movlw .1
|
|
2818 movff WREG,win_height ; row bottom (0-239)
|
|
2819 movlw tissue_diagram_left+.3 ; divemode
|
|
2820 movff WREG,win_leftx2 ; column left (0-159)
|
|
2821 movlw .159-tissue_diagram_left-4 ; Width
|
|
2822 movff WREG,win_width
|
|
2823
|
|
2824 ;---- Draw N2 Tissues
|
|
2825 lfsr FSR2, char_O_tissue_N2_saturation
|
|
2826 movlw d'16'
|
|
2827 movwf wait_temp ; 16 tissues
|
|
2828 clrf waitms_temp ; Row offset
|
|
2829 tissue_saturation_graph_N2:
|
|
2830 movlw tissue_diagram_top+3 ; divemode
|
|
2831 addwf waitms_temp,W
|
|
2832 movff WREG,win_top ; row top (0-239)
|
|
2833 rcall tissue_saturation_graph_loop ; Show one tissue
|
|
2834 decfsz wait_temp,F
|
|
2835 bra tissue_saturation_graph_N2
|
|
2836
|
|
2837 ;---- Draw He Tissues ----------------------------------------------------
|
|
2838 lfsr FSR2, char_O_tissue_He_saturation
|
|
2839 movlw d'16'
|
|
2840 movwf wait_temp ; 16 tissues
|
|
2841 clrf waitms_temp ; Row offset
|
|
2842 tissue_saturation_graph_He:
|
|
2843 movlw tissue_diagram_top+3+.22 ; divemode
|
|
2844 addwf waitms_temp,W
|
|
2845 movff WREG,win_top ; row top (0-239)
|
|
2846
|
|
2847 rcall tissue_saturation_graph_loop ; Show one tissue
|
|
2848
|
|
2849 decfsz wait_temp,F
|
|
2850 bra tissue_saturation_graph_He
|
|
2851 return
|
|
2852
|
|
2853 tissue_saturation_graph_loop:
|
|
2854 call TFT_standard_color
|
|
2855 incf waitms_temp,F
|
|
2856 movf POSTINC2,W
|
|
2857 bcf STATUS,C
|
|
2858 rrcf WREG
|
|
2859 bcf STATUS,C
|
|
2860 rrcf WREG ; And divide by 4
|
|
2861 movwf temp1
|
|
2862 movlw .12
|
|
2863 subwf temp1,F ; Subtract some offset
|
|
2864 movff win_width,WREG ; Max width.
|
|
2865 cpfslt temp1 ; skip if WREG < win_width
|
|
2866 movwf temp1
|
|
2867 movff temp1,win_bargraph
|
|
2868 call TFT_box
|
|
2869 return
|
|
2870
|
|
2871 global TFT_display_cns
|
|
2872 TFT_display_cns:
|
|
2873 rcall TFT_warning_set_window ; Sets the row and column for the current warning
|
|
2874 tstfsz WREG ; Is there room for the warning?
|
|
2875 return ; No
|
|
2876 TFT_color_code warn_cns ; Color-code CNS output
|
|
2877 STRCPY_TEXT tCNS2 ; CNS:
|
|
2878 movff int_O_CNS_fraction+0,lo
|
|
2879 movff int_O_CNS_fraction+1,hi
|
|
2880 bsf leftbind
|
|
2881 output_16_3 ;Displays only 0...999
|
|
2882 bcf leftbind
|
|
2883 PUTC "%"
|
|
2884 movlw warning_length ; Divemode string length
|
|
2885 btfss divemode ; In Divemode?
|
|
2886 movlw surf_warning_length ; No, use surface string length
|
|
2887 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
|
|
2888 STRCAT_PRINT ""
|
|
2889 call TFT_standard_color
|
|
2890 return
|
|
2891
|
|
2892 global TFT_display_ppo2
|
|
2893 TFT_display_ppo2: ; Show ppO2 (ppO2 stored in xC, in mbar!)
|
|
2894 rcall TFT_warning_set_window ; Sets the row and column for the current warning
|
|
2895 tstfsz WREG ; Is there room for the warning?
|
|
2896 return ; No
|
|
2897 TFT_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC)
|
|
2898 STRCPY "O2:"
|
|
2899 ; Check very high ppO2 manually
|
|
2900 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar?
|
|
2901 bra TFT_show_ppO2_3 ; Yes, display fixed Value!
|
|
2902 movff xC+0,lo
|
|
2903 movff xC+1,hi
|
|
2904 bsf ignore_digit4
|
|
2905 output_16dp d'1'
|
|
2906 TFT_show_ppO2_2:
|
|
2907 movlw warning_length ; Divemode string length
|
|
2908 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
|
|
2909 STRCAT_PRINT ""
|
|
2910 call TFT_standard_color
|
|
2911 return
|
|
2912
|
|
2913 TFT_show_ppO2_3:
|
|
2914 STRCAT ">6.6"
|
|
2915 bra TFT_show_ppO2_2
|
|
2916
|
|
2917
|
|
2918 global TFT_LogOffset_Logtitle
|
|
2919 TFT_LogOffset_Logtitle:
|
|
2920 STRCPY_TEXT tLogOffset
|
|
2921 PUTC ":"
|
|
2922 call do_logoffset_common_read ; Offset into lo:hi
|
|
2923 bsf leftbind
|
|
2924 output_16
|
|
2925 bcf leftbind
|
|
2926 PUTC " "
|
|
2927 return ; No "_PRINT" here...
|
|
2928
|
|
2929
|
|
2930 global adjust_depth_with_salinity
|
|
2931 adjust_depth_with_salinity: ; computes salinity setting into lo:hi [mbar]
|
|
2932 btfsc simulatormode_active ; Do apply salinity in Simulatormode
|
|
2933 return
|
|
2934
|
|
2935 movff opt_salinity,WREG ; 0-5%
|
|
2936 addlw d'100' ; 1.00kg/l
|
|
2937 movwf wait_temp
|
|
2938
|
|
2939 movlw d'105' ; 105% ?
|
|
2940 cpfslt wait_temp ; Salinity higher limit
|
|
2941 return ; Out of limit, do not adjust lo:hi
|
|
2942 movlw d'99' ; 99% ?
|
|
2943 cpfsgt wait_temp ; Salinity lower limit
|
|
2944 return ; Out of limit, do not adjust lo:hi
|
|
2945
|
|
2946 movff lo,xA+0
|
|
2947 movff hi,xA+1
|
|
2948
|
|
2949 movlw d'102' ; 0,98bar/10m
|
|
2950 movwf xB+0
|
|
2951 clrf xB+1
|
|
2952 call mult16x16 ;xA*xB=xC (lo:hi * 100)
|
|
2953 movff wait_temp,xB+0 ; Salinity
|
|
2954 clrf xB+1
|
|
2955 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
|
|
2956 movff xC+0,lo
|
|
2957 movff xC+1,hi ; restore lo and hi with updated value
|
|
2958 return
|
|
2959
|
|
2960 global convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
|
|
2961 convert_mbar_to_feet: ; convert value in lo:hi from mbar to feet
|
|
2962 movff lo,xA+0
|
|
2963 movff hi,xA+1
|
|
2964
|
|
2965 movlw LOW d'328' ; 328feet/100m
|
|
2966 movwf xB+0
|
|
2967 movlw HIGH d'328'
|
|
2968 movwf xB+1
|
|
2969
|
|
2970 call mult16x16 ; xA*xB=xC (lo:hi * 328)
|
|
2971
|
|
2972 movlw d'50' ; round up
|
|
2973 addwf xC+0,F
|
|
2974 movlw 0
|
|
2975 addwfc xC+1,F
|
|
2976 addwfc xC+2,F
|
|
2977 addwfc xC+3,F
|
|
2978
|
|
2979 movlw LOW .10000
|
|
2980 movwf xB+0
|
|
2981 movlw HIGH .10000
|
|
2982 movwf xB+1
|
|
2983
|
|
2984 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
|
|
2985
|
|
2986 movff xC+0,lo
|
|
2987 movff xC+1,hi ; restore lo and hi with updated value
|
|
2988 return
|
|
2989
|
|
2990 global convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit
|
|
2991 convert_celsius_to_fahrenheit: ; convert value in lo:hi from celsius to fahrenheit
|
|
2992 ; Does it work with signed temperature? mH
|
|
2993 movff lo,xA+0
|
|
2994 movff hi,xA+1
|
|
2995
|
|
2996 movlw d'18' ; 1C = 1.8F
|
|
2997 movwf xB+0
|
|
2998 clrf xB+1
|
|
2999
|
|
3000 call mult16x16 ;xA*xB=xC (lo:hi * 18)
|
|
3001
|
|
3002 movlw d'10'
|
|
3003 movwf xB+0
|
|
3004 clrf xB+1
|
|
3005
|
|
3006 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
|
|
3007
|
|
3008 movlw LOW d'320' ; 0C = 32F
|
|
3009 addwf xC+0,F
|
|
3010 movlw HIGH d'320'
|
|
3011 addwfc xC+1,F
|
|
3012
|
|
3013 movff xC+0,lo
|
|
3014 movff xC+1,hi ; restore lo and hi with updated value
|
|
3015 return
|
|
3016
|
|
3017 END |