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