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