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