Mercurial > public > hwos_code
annotate src/tft_outputs.asm @ 129:a329a948cede
minor cleanup
author | heinrichsweikamp |
---|---|
date | Thu, 03 Jul 2014 12:08:06 +0200 |
parents | 9e856337b225 |
children | c935f7fbd39c |
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 | |
126 | 2474 |
0 | 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 STRCAT "0" | |
2526 | |
2527 tft_depth3: | |
2528 STRCAT_PRINT "" ; Display full meters | |
2529 | |
2530 ; .1m in MEDIUM font | |
2531 WIN_MEDIUM depth_dm_column,depth_dm_row | |
2532 TFT_color_code warn_depth ; Color-code the output | |
2533 | |
2534 SAFE_2BYTE_COPY rel_pressure, lo | |
2535 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
126 | 2536 |
0 | 2537 PUTC "." |
2538 movlw HIGH d'30' ; Display 0.0m if lower then 30cm | |
2539 movwf sub_a+1 | |
2540 movlw LOW d'30' | |
2541 movwf sub_a+0 | |
2542 movff hi,sub_b+1 | |
2543 movff lo,sub_b+0 | |
2544 call subU16 ; sub_c = sub_a - sub_b | |
2545 btfss neg_flag ; Depth lower then 0.3m? | |
2546 bra depth_less_0.3mtr ; Yes, Show ".0" manually | |
2547 | |
2548 movlw d'4' | |
2549 movwf ignore_digits | |
2550 bsf ignore_digit5 | |
2551 output_16dp d'0' | |
2552 STRCAT_PRINT "" ; Display decimeters | |
2553 WIN_FONT FT_SMALL | |
2554 return | |
2555 | |
2556 depth_less_0.3mtr: | |
2557 STRCAT_PRINT "0" ; Display 0.0m manually | |
2558 WIN_FONT FT_SMALL | |
2559 return | |
2560 | |
2561 depth_greater_99_84mtr: ; Display only in full meters | |
2562 btfss depth_greater_100m ; Is depth>100m already? | |
2563 rcall TFT_clear_depth ; No, clear depth area and set flag | |
2564 ; Depth is already in hi:lo | |
2565 ; Show depth in Full meters | |
2566 ; That means ignore figure 4 and 5 | |
2567 lfsr FSR2,buffer | |
2568 bsf ignore_digit4 | |
2569 bsf leftbind | |
2570 output_16 | |
2571 bcf leftbind | |
2572 STRCAT_PRINT "" ; Display full meters only | |
2573 WIN_FONT FT_SMALL | |
2574 return | |
2575 | |
2576 TFT_clear_depth: ; No, clear depth area and set flag | |
2577 WIN_BOX_BLACK depth_row, .77,.0, max_depth_column-.1 ;top, bottom, left, right | |
2578 bsf depth_greater_100m ; Set Flag | |
2579 return | |
2580 | |
2581 ;============================================================================= | |
2582 | |
2583 ; global TFT_user_image | |
2584 ;TFT_user_image: | |
2585 ; ;---- Display user image ------------------------------------------------- | |
2586 ; ; Compute address in external EEPROM | |
2587 ; movff opt_skin,WREG | |
2588 ; mullw 0x50 | |
2589 ; movff PRODL,ext_flash_address+1 | |
2590 ; movf PRODH,W | |
2591 ; iorlw 0x30 | |
2592 ; movwf ext_flash_address+2 | |
2593 ; | |
2594 ; ; First pixel at @+4: | |
2595 ; movlw 4 | |
2596 ; movwf ext_flash_address+0 | |
2597 ; | |
2598 ; ; Read first pixel | |
2599 ; call ext_flash_read_block_start | |
2600 ;; movff SSP2BUF,skin_color+1 ; TFT format: HIGH is first... | |
2601 ; movwf SSP2BUF ; Write to buffer to initiate new read | |
2602 ; btfss SSP2STAT, BF ; Next byte ready ? | |
2603 ; bra $-2 ; NO: wait... | |
2604 ;; movff SSP2BUF,skin_color+0 | |
2605 ; call ext_flash_read_block_stop | |
2606 ; | |
2607 ; ; Make a frame of the retrieved skin color. | |
2608 ; setf win_color1 | |
2609 ; setf win_color2 | |
2610 ; WIN_FRAME_COLOR16 user_image_upper-.1, user_image_upper+.100,user_image_left-.1, user_image_left+.50 | |
2611 ; | |
2612 ; WIN_LEFT user_image_left+.25 | |
2613 ; WIN_TOP user_image_upper+.50 | |
2614 ; | |
2615 ; ; Display skin icon | |
2616 ; clrf ext_flash_address+0 | |
2617 ; call TFT_write_flash_image_addr | |
2618 ; | |
2619 ; ;---- Print custom text string | |
2620 ; WIN_LEFT user_image_left+.50+.5 | |
2621 ; WIN_TOP user_image_upper+.0 | |
2622 ; | |
2623 ; ; ---- STRNCPY : String copy from RAM | |
2624 ; ; lfsr FSR0, opt_name ; Source | |
2625 ; lfsr FSR1, .13 ; Len max | |
2626 ; lfsr FSR2, buffer ; destination | |
2627 ;TFT_user_image_1: | |
2628 ; movf POSTINC0,W ; Get byte | |
2629 ; bz TFT_user_image_2 ; End if NULL | |
2630 ; movwf POSTINC2 ; NO: copy | |
2631 ; decfsz FSR1L ; Max len reached ? | |
2632 ; bra TFT_user_image_1 ; NO: loop | |
2633 ;TFT_user_image_2: | |
2634 ; clrf POSTINC2 ; Mark end of string | |
2635 ; | |
2636 ; goto aa_wordprocessor ; and print | |
2637 | |
2638 | |
2639 global TFT_custom_text | |
2640 TFT_custom_text: ; Show the custom text | |
2641 lfsr FSR0, opt_name ; Source | |
2642 WIN_SMALL surf_customtext_column,surf_customtext_row1 ; First row | |
2643 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
2644 incfsz lo,F ; Was lo=255? | |
2645 return ; No, all done. | |
2646 lfsr FSR0, opt_name+.12 ; Source | |
2647 WIN_SMALL surf_customtext_column,surf_customtext_row2 ; Second row | |
2648 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
2649 incfsz lo,F ; Was lo=255? | |
2650 return ; No, all done. | |
2651 lfsr FSR0, opt_name+.24 ; Source | |
2652 WIN_SMALL surf_customtext_column,surf_customtext_row3 ; Third row | |
2653 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
2654 incfsz lo,F ; Was lo=255? | |
2655 return ; No, all done. | |
2656 lfsr FSR0, opt_name+.36 ; Source | |
2657 WIN_SMALL surf_customtext_column,surf_customtext_row4 ; Forth row | |
2658 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
2659 incfsz lo,F ; Was lo=255? | |
2660 return ; No, all done. | |
2661 lfsr FSR0, opt_name+.48 ; Source | |
2662 WIN_SMALL surf_customtext_column,surf_customtext_row5 ; Fifth row | |
2663 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
2664 return ; Done. | |
2665 | |
2666 TFT_custom_text_2: | |
2667 lfsr FSR2, buffer ; destination | |
2668 movlw .12 | |
2669 movwf lo ; length/line | |
2670 TFT_custom_text_3: | |
2671 movf POSTINC0,W ; Get byte | |
2672 bz TFT_custom_text_4 ; End if NULL | |
2673 movwf POSTINC2 ; NO: copy | |
2674 decfsz lo,F ; Max len reached ? | |
2675 bra TFT_custom_text_3 ; NO: loop | |
2676 setf lo ; lo=255 -> more to come | |
2677 TFT_custom_text_4: | |
2678 clrf POSTINC2 ; Mark end of string | |
2679 goto aa_wordprocessor ; print and return | |
2680 | |
2681 | |
2682 ;============================================================================= | |
2683 global TFT_update_surf_press | |
2684 TFT_update_surf_press: | |
2685 WIN_SMALL surf_press_column,surf_press_row | |
2686 call TFT_standard_color | |
2687 SAFE_2BYTE_COPY amb_pressure, lo | |
2688 movff lo,sub_a+0 | |
2689 movff hi,sub_a+1 | |
2690 movff last_surfpressure_30min+0,sub_b+0 | |
2691 movff last_surfpressure_30min+1,sub_b+1 | |
2692 call subU16 ; sub_c = sub_a - sub_b | |
2693 btfsc neg_flag ; Pressure lower? | |
2694 rcall update_surf_press2 ; Yes, test threshold | |
2695 | |
2696 tstfsz sub_c+1 ; >255mbar difference? | |
2697 bra update_surf_press_common; Yes, display! | |
2698 movlw d'10' ; 10mbar noise suppression | |
2699 subwf sub_c+0,W | |
2700 btfsc STATUS,C | |
2701 bra update_surf_press_common; Yes, display! | |
2702 SAFE_2BYTE_COPY last_surfpressure_30min, lo ; Overwrite with stable value... | |
2703 | |
2704 update_surf_press_common: | |
2705 output_16 | |
2706 ; Show only 4 figures | |
2707 movff buffer+1,buffer+0 | |
2708 movff buffer+2,buffer+1 | |
2709 movff buffer+3,buffer+2 | |
2710 movff buffer+4,buffer+3 | |
2711 movlw 0x00 | |
2712 movff WREG,buffer+4 | |
2713 STRCAT_PRINT "" | |
2714 call TFT_divemask_color | |
2715 WIN_SMALL surf_press_column+4*8,surf_press_row | |
2716 STRCPY_PRINT "mbar" | |
2717 return | |
2718 | |
2719 update_surf_press2: | |
2720 movff lo,sub_b+0 | |
2721 movff hi,sub_b+1 | |
2722 movff last_surfpressure_30min+0,sub_a+0 | |
2723 movff last_surfpressure_30min+1,sub_a+1 | |
2724 call subU16 ; sub_c = sub_a - sub_b | |
2725 return | |
2726 | |
2727 ;============================================================================= | |
2728 | |
2729 global TFT_update_batt_voltage | |
2730 TFT_update_batt_voltage: | |
2731 movff batt_percent,lo ; Get battery percent | |
2732 TFT_color_code warn_battery; Color-code battery percent | |
2733 WIN_TINY batt_percent_column,batt_percent_row | |
2734 bsf leftbind | |
2735 output_8 | |
2736 bcf leftbind | |
88 | 2737 STRCAT "% " |
2738 movlw 0x00 | |
2739 movff WREG,buffer+4 ; Only "xxx%" | |
2740 STRCAT_PRINT "" | |
0 | 2741 call TFT_standard_color |
2742 WIN_TINY batt_voltage_column,batt_voltage_row | |
2743 movff batt_voltage+0,lo | |
2744 movff batt_voltage+1,hi | |
2745 bsf leftbind | |
2746 output_16dp .2 | |
2747 bcf leftbind | |
2748 PUTC 'V' | |
2749 movff buffer+5,buffer+3 | |
2750 movlw 0x00 | |
2751 movff WREG,buffer+4 ; Only "x.yV" | |
24 | 2752 STRCAT_PRINT "" |
0 | 2753 return |
2754 | |
2755 ;update_battery_debug: | |
2756 ; call TFT_standard_color | |
2757 ; WIN_TINY .70,.0 | |
2758 ; movff battery_gauge+5,xC+3 | |
2759 ; movff battery_gauge+4,xC+2 | |
2760 ; movff battery_gauge+3,xC+1 | |
2761 ; movff battery_gauge+2,xC+0 | |
2762 ; ; battery_gauge:6 is nAs | |
2763 ; ; devide through 65536 | |
2764 ; ; devide through 152 | |
2765 ; ; Result is 0.01Ah in xC+1:xC+0 | |
2766 ; movlw LOW .152 | |
2767 ; movwf xB+0 | |
2768 ; movlw HIGH .152 | |
2769 ; movwf xB+1 | |
2770 ; call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
2771 ; bsf leftbind | |
2772 ; movff xC+0,lo | |
2773 ; movff xC+1,hi | |
2774 ; output_16 | |
2775 ; STRCAT_PRINT "x.01Ah" | |
2776 ; WIN_FONT FT_SMALL | |
2777 ; bcf leftbind | |
2778 ; return | |
2779 | |
2780 ;============================================================================= | |
2781 | |
2782 global TFT_convert_signed_16bit | |
2783 TFT_convert_signed_16bit: | |
2784 bcf neg_flag ; Positive temperature | |
2785 btfss hi,7 ; Negative temperature ? | |
2786 return ; No, return | |
2787 ; Yes, negative temperature! | |
2788 bsf neg_flag ; Negative temperature | |
2789 PUTC '-' ; Display "-" | |
2790 comf hi ; Then, 16bit sign changes. | |
2791 negf lo | |
2792 btfsc STATUS,C | |
2793 incf hi | |
2794 return ; and return | |
2795 | |
2796 ;============================================================================= | |
2797 | |
2798 global TFT_convert_date | |
2799 TFT_convert_date: ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | |
2800 movff opt_dateformat,WREG ; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD | |
2801 movwf EEDATA ; used as temp here | |
2802 tstfsz EEDATA | |
2803 bra TFT_convert_date1 | |
2804 ; EEDATA was 0 | |
2805 ; Use MMDDYY | |
2806 movff convert_value_temp+0,lo ;month | |
2807 bsf leftbind | |
2808 output_99x | |
2809 PUTC '.' | |
2810 movff convert_value_temp+1,lo ;day | |
2811 bra TFT_convert_date1_common ;year | |
2812 | |
2813 TFT_convert_date1: ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD) | |
2814 decfsz EEDATA,F | |
2815 bra TFT_convert_date2 ; EEDATA was 2 | |
2816 ; EEDATA was 1 | |
2817 ; Use DDMMYY | |
2818 movff convert_value_temp+1,lo ;day | |
2819 bsf leftbind | |
2820 output_99x | |
2821 PUTC '.' | |
2822 movff convert_value_temp+0,lo ;month | |
2823 | |
2824 TFT_convert_date1_common: | |
2825 bsf leftbind | |
2826 output_99x | |
2827 PUTC '.' | |
2828 movff convert_value_temp+2,lo ;year | |
2829 output_99x | |
2830 bcf leftbind | |
2831 return | |
2832 | |
2833 TFT_convert_date2: | |
2834 ; Use YYMMDD | |
2835 movff convert_value_temp+2,lo ;year | |
2836 bsf leftbind | |
2837 output_99x | |
2838 PUTC '.' | |
2839 movff convert_value_temp+0,lo ;month | |
2840 output_99x | |
2841 PUTC '.' | |
2842 movff convert_value_temp+1,lo ;day | |
2843 output_99x | |
2844 bcf leftbind | |
2845 return | |
2846 | |
2847 ;============================================================================= | |
2848 | |
2849 global TFT_convert_date_short | |
2850 TFT_convert_date_short: ; converts into "DD/MM" or "MM/DD" or "MM/DD" in postinc2 | |
2851 movff opt_dateformat,WREG ; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD | |
2852 movwf EEDATA ; used as temp here | |
2853 tstfsz EEDATA | |
2854 bra TFT_convert_date_short1 | |
2855 ; EEDATA was 0 | |
2856 ; Use MMDDYY | |
2857 TFT_convert_date_short_common: | |
2858 movff convert_value_temp+0,lo ;month | |
2859 bsf leftbind | |
2860 output_99x | |
2861 PUTC '.' | |
2862 movff convert_value_temp+1,lo ;day | |
2863 output_99x | |
2864 bcf leftbind | |
2865 return | |
2866 | |
2867 TFT_convert_date_short1: | |
2868 decfsz EEDATA,F | |
2869 bra TFT_convert_date_short_common ; EEDATA was 2 -> Use YYMMDD | |
2870 ; EEDATA was 1 | |
2871 ; Use DDMMYY | |
2872 movff convert_value_temp+1,lo ;day | |
2873 bsf leftbind | |
2874 output_99x | |
2875 PUTC '.' | |
2876 movff convert_value_temp+0,lo ;month | |
2877 output_99x | |
2878 bcf leftbind | |
2879 return | |
2880 | |
2881 ;============================================================================= | |
2882 | |
2883 global TFT_date | |
2884 TFT_date: | |
48 | 2885 WIN_SMALL surf_date_column,surf_date_row ; Init new Wordprocessor |
0 | 2886 call TFT_standard_color |
2887 movff month,convert_value_temp+0 | |
2888 movff day,convert_value_temp+1 | |
2889 movff year,convert_value_temp+2 | |
2890 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | |
2891 STRCAT_PRINT "" | |
2892 return | |
2893 | |
2894 ;============================================================================= | |
2895 | |
2896 global TFT_max_pressure | |
2897 TFT_max_pressure: | |
2898 btfsc FLAG_apnoe_mode ; different display in apnoe mode | |
2899 bra TFT_max_pressure_apnoe | |
2900 TFT_max_pressure2: | |
2901 SAFE_2BYTE_COPY max_pressure, lo | |
2902 TFT_max_pressure3: | |
2903 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
2904 TSTOSS opt_units ; 0=m, 1=ft | |
2905 bra TFT_max_pressure2_metric | |
2906 ;TFT_max_pressure2_imperial | |
2907 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
2908 WIN_MEDIUM max_depth_feet_column,max_depth_feet_row | |
2909 call TFT_standard_color | |
2910 output_16_3 | |
2911 STRCAT_PRINT "" | |
2912 return | |
2913 | |
2914 TFT_max_pressure2_metric: | |
11 | 2915 WIN_MEDIUM max_depth_column,max_depth_row |
2916 | |
2917 movlw .039 | |
2918 cpfslt hi | |
2919 bra max_depth_greater_99_84mtr | |
2920 | |
2921 btfsc max_depth_greater_100m ; Was depth>100m during last call | |
2922 rcall TFT_clear_max_depth ; Yes, clear depth area | |
2923 bcf max_depth_greater_100m ; Do this once only... | |
2924 | |
2925 movlw .039 | |
2926 cpfslt hi | |
2927 bra max_depth_greater_99_84mtr | |
2928 | |
2929 movlw HIGH d'1000' | |
2930 movwf sub_a+1 | |
2931 movlw LOW d'1000' | |
2932 movwf sub_a+0 | |
2933 movff hi,sub_b+1 | |
2934 movff lo,sub_b+0 | |
2935 incf sub_b+0,F | |
2936 movlw d'0' | |
2937 addwfc sub_b+1,F ; Add 1mbar offset | |
2938 call sub16 ; sub_c = sub_a - sub_b | |
2939 movlw ' ' | |
2940 btfss neg_flag ; Depth lower then 10m? | |
2941 movwf POSTINC2 ; Yes, add extra space | |
2942 | |
2943 clrf sub_a+1 | |
2944 movlw d'99' | |
2945 movwf sub_a+0 | |
2946 movff hi,sub_b+1 | |
2947 movff lo,sub_b+0 | |
2948 call subU16 ; sub_c = sub_a - sub_b | |
2949 btfss neg_flag ; Depth lower then 1m? | |
2950 bra tft_max_depth2 ; Yes, display manual Zero | |
2951 | |
2952 bsf ignore_digit4 ; no 0.1m | |
2953 bsf leftbind | |
2954 output_16 | |
2955 bra tft_max_depth3 | |
2956 | |
2957 tft_max_depth2: | |
0 | 2958 WIN_MEDIUM max_depth_column,max_depth_row |
11 | 2959 STRCAT "0" |
2960 | |
2961 tft_max_depth3: | |
0 | 2962 call TFT_standard_color |
11 | 2963 STRCAT_PRINT "" ; Display full meters |
2964 bcf leftbind | |
2965 | |
2966 ; .1m in SMALL font | |
2967 WIN_SMALL max_depth_dm_column,max_depth_dm_row | |
2968 | |
2969 SAFE_2BYTE_COPY max_pressure, lo | |
2970 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
2971 | |
2972 PUTC "." | |
2973 | |
2974 movlw d'4' | |
2975 movwf ignore_digits | |
2976 bsf ignore_digit5 | |
2977 bsf leftbind | |
2978 output_16dp d'0' | |
2979 STRCAT_PRINT "" ; Display decimeters | |
2980 bcf leftbind | |
2981 return | |
2982 | |
2983 max_depth_greater_99_84mtr: ; Display only in full meters | |
2984 btfss max_depth_greater_100m ; Is max depth>100m already? | |
2985 rcall TFT_clear_max_depth ; No, clear max depth area and set flag | |
2986 ; Max. Depth is already in hi:lo | |
2987 ; Show max. depth in Full meters | |
2988 ; That means ignore figure 4 and 5 | |
2989 lfsr FSR2,buffer | |
2990 bsf ignore_digit4 | |
2991 bsf leftbind | |
0 | 2992 output_16 |
11 | 2993 bcf leftbind |
2994 STRCAT_PRINT "" ; Display full meters only | |
2995 WIN_FONT FT_SMALL | |
0 | 2996 return |
2997 | |
11 | 2998 TFT_clear_max_depth: ; No, clear max. depth area and set flag |
2999 WIN_BOX_BLACK max_depth_row,.49,max_depth_column, max_depth_dm_column+.13 ;top, bottom, left, right | |
3000 bsf max_depth_greater_100m ; Set Flag | |
3001 return | |
3002 | |
3003 | |
0 | 3004 TFT_max_pressure_apnoe: |
3005 btfss FLAG_active_descent ; Are we descending? | |
3006 bra TFT_max_pressure2 ; Yes, show normal max. | |
3007 SAFE_2BYTE_COPY apnoe_max_pressure, lo | |
3008 bra TFT_max_pressure3 ; Show apnoe_max_pressure as max. depth | |
3009 | |
3010 global TFT_display_apnoe_last_max | |
3011 TFT_display_apnoe_last_max: | |
3012 call TFT_divemask_color | |
3013 WIN_TINY last_max_apnoe_text_column,last_max_apnoe_text_row | |
3014 STRCPY_TEXT_PRINT tApnoeMax | |
3015 | |
3016 call TFT_standard_color | |
3017 SAFE_2BYTE_COPY max_pressure, lo | |
3018 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
3019 TSTOSS opt_units ; 0=m, 1=ft | |
3020 bra TFT_display_apnoe_last_m_metric | |
3021 ;TFT_display_apnoe_last_max_imperial | |
3022 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
3023 WIN_MEDIUM apnoe_last_max_depth_column,apnoe_last_max_depth_row | |
3024 output_16 | |
3025 STRCAT_PRINT "" | |
3026 return | |
3027 | |
3028 TFT_display_apnoe_last_m_metric: | |
3029 WIN_MEDIUM apnoe_last_max_depth_column,apnoe_last_max_depth_row | |
3030 bsf ignore_digit5 ; do not display 1cm depth | |
3031 output_16dp d'3' | |
3032 STRCAT_PRINT "" | |
3033 return | |
3034 | |
3035 ;============================================================================= | |
3036 global TFT_divemins | |
3037 TFT_divemins: | |
3038 movff divemins+0,lo | |
3039 movff divemins+1,hi | |
98 | 3040 bcf leftbind |
0 | 3041 |
3042 btfsc no_more_divesecs ; Ignore seconds? | |
3043 bra TFT_divemins2 ; Show minutes only | |
3044 | |
3045 movlw .99 | |
3046 cpfsgt lo ; bigger then 99? | |
3047 bra TFT_divemins1 ; No show mins:secs | |
3048 ; Yes, remove second display for the rest of the dive and clear seconds | |
3049 bsf no_more_divesecs ; Set flag | |
3050 ; Clear rest of seconds | |
3051 WIN_BOX_BLACK divetime_row, warning1_row,divetime_column,.159 ;top, bottom, left, right | |
3052 bra TFT_divemins2 ; Show minutes only | |
3053 | |
3054 TFT_divemins1: | |
3055 WIN_MEDIUM divetime_column, divetime_row | |
3056 output_16_3 ; displays only last three figures from a 16Bit value (0-999) | |
3057 call TFT_standard_color | |
3058 STRCAT_PRINT "" ; Show minutes in large font | |
3059 | |
3060 WIN_SMALL divetime_secs_column, divetime_secs_row ; left position for two sec figures | |
3061 PUTC ':' | |
3062 bsf leftbind | |
3063 movff divesecs,lo | |
3064 output_99x | |
3065 bcf leftbind | |
3066 STRCAT_PRINT "" ; Show seconds in small font | |
3067 return | |
3068 | |
3069 TFT_divemins2: | |
3070 WIN_MEDIUM divetime_minsonly_column, divetime_row | |
3071 output_16 | |
3072 call TFT_standard_color | |
3073 STRCAT_PRINT "" ; Show minutes in large font | |
3074 return | |
3075 | |
3076 ;============================================================================= | |
3077 global TFT_display_apnoe_surface | |
3078 TFT_display_apnoe_surface: | |
3079 call TFT_divemask_color | |
3080 WIN_TINY surface_apnoe_text_column,surface_apnoe_text_row | |
3081 STRCPY_TEXT_PRINT tApnoeSurface | |
3082 | |
3083 call TFT_standard_color | |
3084 WIN_MEDIUM surface_time_apnoe_column, surface_time_apnoe_row | |
3085 movff apnoe_surface_mins,lo | |
3086 output_8 | |
3087 PUTC ':' | |
3088 movff apnoe_surface_secs,lo | |
3089 output_99x | |
3090 STRCAT_PRINT "" | |
3091 return | |
3092 | |
3093 global TFT_apnoe_clear_surface | |
3094 TFT_apnoe_clear_surface: | |
3095 ; Clear Surface timer.... | |
3096 WIN_BOX_BLACK surface_apnoe_text_row, .239, surface_apnoe_text_column, .159 ;top, bottom, left, right | |
3097 return | |
3098 | |
3099 global TFT_display_apnoe_descent | |
3100 TFT_display_apnoe_descent: ; Descent divetime | |
3101 movff apnoe_mins,lo | |
3102 clrf hi | |
3103 WIN_MEDIUM divetime_column, divetime_row | |
3104 output_16_3 ; displays only last three figures from a 16Bit value (0-999) | |
3105 call TFT_standard_color | |
3106 STRCAT_PRINT "" ; Show minutes in large font | |
3107 WIN_SMALL divetime_secs_column, divetime_secs_row ; left position for two sec figures | |
3108 PUTC ':' | |
3109 bsf leftbind | |
3110 movff apnoe_secs,lo | |
3111 output_99x | |
3112 bcf leftbind | |
3113 STRCAT_PRINT "" ; Show seconds in small font | |
38 | 3114 |
3115 | |
3116 call TFT_divemask_color | |
3117 WIN_TINY total_apnoe_text_column,total_apnoe_text_row | |
3118 STRCPY_TEXT_PRINT tApnoeTotal | |
3119 call TFT_standard_color | |
3120 movff divemins,lo | |
3121 clrf hi | |
3122 WIN_MEDIUM apnoe_total_divetime_column, apnoe_total_divetime_row | |
3123 output_16_3 ; displays only last three figures from a 16Bit value (0-999) | |
3124 call TFT_standard_color | |
3125 STRCAT_PRINT "" ; Show minutes in large font | |
3126 WIN_SMALL apnoe_total_divetime_secs_column, apnoe_total_divetime_secs_row ; left position for two sec figures | |
3127 PUTC ':' | |
3128 bsf leftbind | |
3129 movff divesecs,lo | |
3130 output_99x | |
3131 bcf leftbind | |
3132 STRCAT_PRINT "" ; Show seconds in small font | |
0 | 3133 return |
3134 | |
3135 ;============================================================================= | |
3136 ; Writes ostc3 #Serial and Firmware version in splash screen | |
3137 ; | |
3138 global TFT_serial | |
3139 TFT_serial: | |
3140 WIN_TINY .0,.239-.14 | |
3141 STRCPY "OSTC3 #" ; Won't translate that... | |
3142 rcall TFT_cat_serial | |
3143 | |
3144 STRCAT " v" | |
3145 rcall TFT_cat_firmware | |
3146 | |
3147 ifdef __DEBUG | |
3148 movlw color_grey ; Write header in blue when | |
3149 call TFT_set_color ; compiled in DEBUG mode... | |
3150 STRCAT_PRINT "DEBUG" | |
3151 else | |
76 | 3152 WIN_COLOR color_greenish |
3153 STRCAT_PRINT "" | |
0 | 3154 call TFT_standard_color |
76 | 3155 |
0 | 3156 movlw softwareversion_beta ; =1: Beta, =0: Release |
3157 decfsz WREG,F | |
3158 return ; Release version -> Return | |
3159 | |
3160 call TFT_warnings_color | |
3161 WIN_LEFT .160-4*9/2 ; Right pad. | |
3162 STRCPY_TEXT_PRINT tBeta | |
3163 endif | |
76 | 3164 call TFT_standard_color |
0 | 3165 return |
3166 | |
3167 | |
3168 | |
3169 ;============================================================================= | |
3170 ; For the Information menu: append firmware x.yy version. | |
3171 global info_menu_firmware | |
3172 extern tFirmware | |
3173 info_menu_firmware: | |
3174 lfsr FSR1,tFirmware | |
3175 call strcat_text | |
76 | 3176 global TFT_cat_firmware |
0 | 3177 TFT_cat_firmware: |
3178 movlw softwareversion_x | |
3179 movwf lo | |
3180 bsf leftbind | |
3181 output_8 | |
3182 PUTC '.' | |
3183 movlw softwareversion_y | |
3184 movwf lo | |
3185 output_99x | |
3186 bcf leftbind | |
3187 return | |
3188 | |
3189 ;----------------------------------------------------------------------------- | |
3190 ; For the Information menu: append serial number ostc3#42. | |
3191 global info_menu_serial | |
3192 extern tSerial | |
3193 info_menu_serial: | |
3194 lfsr FSR1,tSerial | |
3195 call strcat_text | |
76 | 3196 global TFT_cat_serial |
0 | 3197 TFT_cat_serial: |
3198 clrf EEADRH | |
3199 clrf EEADR ; Get Serial number LOW | |
3200 call read_eeprom ; read byte | |
3201 movff EEDATA,lo | |
3202 incf EEADR,F ; Get Serial number HIGH | |
3203 call read_eeprom ; read byte | |
3204 movff EEDATA,hi | |
3205 | |
3206 bsf leftbind | |
3207 output_16 | |
3208 bcf leftbind | |
3209 return | |
3210 | |
3211 ;----------------------------------------------------------------------------- | |
3212 ; For the Information menu: Append total dives | |
3213 global info_menu_total_dives | |
3214 extern tTotalDives | |
3215 info_menu_total_dives: | |
3216 lfsr FSR1,tTotalDives | |
3217 call strcat_text | |
3218 TFT_cat_total_dives: | |
3219 read_int_eeprom .2 | |
3220 movff EEDATA,lo | |
3221 read_int_eeprom .3 | |
3222 movff EEDATA,hi | |
3223 bsf leftbind | |
3224 output_16 | |
3225 bcf leftbind | |
3226 return | |
3227 | |
62 | 3228 ; For the Information menu: Append battery voltage |
3229 global info_menu_battery_volts | |
3230 extern tBatteryV | |
3231 info_menu_battery_volts: | |
3232 lfsr FSR1,tBatteryV | |
3233 call strcat_text | |
3234 movff batt_voltage+1,hi | |
3235 movff batt_voltage+0,lo | |
3236 bsf leftbind | |
3237 output_16dp .2 ; x.xxx | |
3238 bcf leftbind | |
3239 PUTC "V" | |
3240 return | |
3241 | |
0 | 3242 ;----------------------------------------------------------------------------- |
3243 ; ppO2 menu | |
3244 global divesets_ppo2_max | |
3245 extern tPPO2Max | |
3246 extern tbar | |
3247 divesets_ppo2_max: | |
3248 lfsr FSR1,tPPO2Max | |
3249 call strcat_text | |
3250 movff opt_ppO2_max,lo | |
3251 movlw ppo2_warning_high | |
3252 divesets_ppo2_common: | |
3253 movwf up ; Save default value | |
3254 clrf hi | |
3255 bsf leftbind | |
3256 output_16dp d'3' | |
3257 bcf leftbind | |
3258 lfsr FSR1,tbar | |
3259 call strcat_text | |
3260 | |
3261 movf up,W ; Default value | |
3262 cpfseq lo ; Current value | |
3263 bra divesets_ppo2_common2 ; Not default, add * | |
3264 return ; Default, Done. | |
3265 divesets_ppo2_common2: | |
3266 PUTC "*" | |
3267 return ; Done. | |
3268 | |
3269 global divesets_ppo2_min | |
3270 extern tPPO2Min | |
3271 divesets_ppo2_min: | |
3272 lfsr FSR1,tPPO2Min | |
3273 call strcat_text | |
3274 movff opt_ppO2_min,lo | |
3275 movlw ppo2_warning_low | |
3276 bra divesets_ppo2_common | |
3277 | |
3278 ;============================================================================= | |
3279 | |
3280 global TFT_clear_warning_text | |
3281 TFT_clear_warning_text: | |
3282 btfss divemode ; in divemode? | |
3283 bra TFT_clear_warning_text2 ; No, setup for surface mode | |
3284 WIN_BOX_BLACK warning1_row, divemode_customview_row-3, warning1_column, warning_icon_column-3 ;top, bottom, left, right | |
3285 return | |
3286 TFT_clear_warning_text2: | |
3287 WIN_BOX_BLACK surf_warning1_row, surf_warning2_row+.24, surf_warning1_column, surf_warning1_column+.76 ;top, bottom, left, right | |
3288 return | |
3289 | |
3290 global TFT_clear_warning_text_2nd_row | |
3291 TFT_clear_warning_text_2nd_row: | |
3292 btfss divemode ; in divemode? | |
3293 bra TFT_clear_warning_text_2nd_2 ; No, setup for surface mode | |
3294 WIN_BOX_BLACK warning2_row, divemode_customview_row-3, warning2_column, warning_icon_column-3 ;top, bottom, left, right | |
3295 return | |
3296 TFT_clear_warning_text_2nd_2: | |
3297 WIN_BOX_BLACK surf_warning2_row, surf_warning2_row+.24, surf_warning2_column, surf_warning2_column+.76 ;top, bottom, left, right | |
3298 return | |
3299 | |
3300 global TFT_fillup_with_spaces | |
3301 TFT_fillup_with_spaces: ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3302 movwf lo ; save max. string length into lo | |
3303 movf FSR2L,W ; Get current string length | |
3304 subwf lo,F ; lo-WREG | |
3305 btfsc STATUS,N ; longer then #lo already? | |
3306 return ; Yes, done. | |
3307 tstfsz lo ; Zero? | |
3308 bra TFT_fillup_with_spaces2 ; No. | |
3309 return ; Yes, done. | |
3310 TFT_fillup_with_spaces2: | |
3311 PUTC " " ; Add one space | |
3312 decfsz lo,F ; All done? | |
3313 bra TFT_fillup_with_spaces2 ; No, loop | |
3314 return ; Done. | |
3315 | |
3316 global TFT_desaturation_time | |
3317 TFT_desaturation_time: | |
3318 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3319 tstfsz WREG ; Is there room for the warning? | |
3320 return ; No | |
3321 STRCPY "Desat:" | |
3322 movff desaturation_time+0,lo ; divide by 60... | |
3323 movff desaturation_time+1,hi | |
3324 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
3325 bsf leftbind | |
3326 movf lo,W | |
3327 movff hi,lo | |
3328 movwf hi ; exchange lo and hi... | |
3329 output_8 ; Hours | |
3330 PUTC ':' | |
3331 movff hi,lo ; Minutes | |
3332 output_99x | |
3333 bcf leftbind | |
3334 movlw surf_warning_length ; Only use surface string length | |
3335 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
60 | 3336 movlw .0 |
3337 movff WREG,buffer+11 | |
0 | 3338 STRCAT_PRINT "" |
3339 return | |
3340 | |
3341 global TFT_nofly_time | |
3342 TFT_nofly_time: | |
3343 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3344 tstfsz WREG ; Is there room for the warning? | |
3345 return ; No | |
3346 STRCPY "NoFly:" | |
3347 movff nofly_time+0,lo ; divide by 60... | |
3348 movff nofly_time+1,hi | |
3349 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
3350 bsf leftbind | |
3351 movf lo,W | |
3352 movff hi,lo | |
3353 movwf hi ; exchange lo and hi... | |
3354 output_8 ; Hours | |
3355 PUTC ':' | |
3356 movff hi,lo ; Minutes | |
3357 output_99x | |
3358 bcf leftbind | |
3359 movlw surf_warning_length ; Only use surface string length | |
3360 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
60 | 3361 movlw .0 |
3362 movff WREG,buffer+11 | |
0 | 3363 STRCAT_PRINT "" |
3364 return | |
3365 | |
3366 global TFT_warning_agf | |
3367 TFT_warning_agf: | |
3368 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3369 tstfsz WREG ; Is there room for the warning? | |
3370 return ; No | |
3371 call TFT_warnings_color | |
3372 STRCPY_TEXT tDiveaGF_active ; "aGF!" | |
3373 movlw warning_length ; Divemode string length | |
3374 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3375 STRCAT_PRINT "" | |
3376 call TFT_standard_color | |
3377 return | |
3378 | |
3379 global TFT_warning_gf | |
3380 TFT_warning_gf: ;GF | |
3381 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3382 tstfsz WREG ; Is there room for the warning? | |
3383 return ; No | |
3384 TFT_color_code warn_gf ; Color-code Output | |
3385 STRCPY "GF:" | |
3386 movff char_O_gradient_factor,lo ; gradient factor | |
3387 bsf leftbind | |
3388 output_8 | |
3389 PUTC "%" | |
3390 movlw warning_length ; Divemode string length | |
3391 btfss divemode ; In Divemode? | |
3392 movlw surf_warning_length ; No, use surface string length | |
3393 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3394 STRCAT_PRINT "" | |
3395 bcf leftbind | |
3396 call TFT_standard_color | |
3397 return | |
3398 | |
3399 TFT_warning_set_window: ; Sets the row and column for the current warning | |
3400 ; ignore warning (now)? | |
3401 decf warning_counter,W ; -1 | |
3402 bcf STATUS,C | |
3403 rrcf WREG,W ; (warning_counter-1)/2 | |
3404 cpfseq warning_page | |
3405 retlw .255 ; WREG <> 0 -> Warning window not defined | |
3406 | |
3407 call TFT_standard_color | |
3408 | |
3409 btfss divemode ; in divemode? | |
3410 bra TFT_warning_set_window3 ; No, setup for surface mode | |
3411 | |
3412 btfss warning_counter,0 ; Toggle with each warning | |
3413 bra TFT_warning_set_window2 | |
3414 WIN_SMALL warning1_column,warning1_row | |
3415 bcf second_row_warning ; =1: The second row contains a warning | |
3416 retlw .0 ; WREG=0 -> Warning window defined | |
3417 TFT_warning_set_window2: | |
3418 WIN_SMALL warning2_column,warning2_row | |
3419 bsf second_row_warning ; =1: The second row contains a warning | |
3420 retlw .0 ; WREG=0 -> Warning window defined | |
3421 | |
3422 TFT_warning_set_window3: | |
3423 btfss warning_counter,0 ; Toggle with each warning | |
3424 bra TFT_warning_set_window4 | |
3425 WIN_SMALL surf_warning1_column,surf_warning1_row | |
3426 bcf second_row_warning ; =1: The second row contains a warning | |
3427 retlw .0 ; WREG=0 -> Warning window defined | |
3428 TFT_warning_set_window4: | |
3429 WIN_SMALL surf_warning2_column,surf_warning2_row | |
3430 bsf second_row_warning ; =1: The second row contains a warning | |
3431 retlw .0 ; WREG=0 -> Warning window defined | |
3432 | |
3433 | |
3434 global TFT_update_batt_percent_divemode | |
3435 TFT_update_batt_percent_divemode: | |
3436 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3437 tstfsz WREG ; Is there room for the warning? | |
3438 return ; No | |
3439 movff batt_percent,lo ; Get battery percent | |
3440 TFT_color_code warn_battery; Color-code battery percent | |
3441 STRCPY "Batt:" | |
3442 bsf leftbind | |
3443 output_8 | |
3444 bcf leftbind | |
3445 PUTC "%" | |
3446 movlw warning_length ; Divemode string length | |
3447 btfss divemode ; In Divemode? | |
3448 movlw surf_warning_length ; No, use surface string length | |
3449 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3450 STRCAT_PRINT "" | |
3451 call TFT_standard_color | |
3452 return | |
3453 | |
3454 | |
3455 global TFT_gf_mask ; Setup Mask | |
3456 TFT_gf_mask: | |
3457 ; The mask | |
3458 call TFT_divemask_color | |
3459 WIN_TINY dive_gf_column1,dive_gf_text_row | |
3460 STRCPY_TEXT_PRINT tGFactors | |
3461 WIN_TINY dive_gf_column2,dive_gf_text_row | |
3462 STRCPY_TEXT_PRINT taGFactors | |
3463 WIN_TINY dive_gf_column3,dive_gf_text_row | |
3464 STRCPY_TEXT_PRINT tGFInfo | |
3465 | |
3466 ; Show GF (Static) | |
3467 call TFT_disabled_color | |
3468 btfss use_agf | |
3469 call TFT_standard_color | |
3470 | |
3471 WIN_STD dive_gf_column,dive_gf_row | |
3472 bsf leftbind | |
3473 movff opt_GF_low,lo | |
3474 output_8 | |
3475 PUTC "/" | |
3476 movff opt_GF_high,lo | |
3477 output_8 | |
3478 STRCAT_PRINT "" | |
3479 ; Show aGF (Static) | |
3480 call TFT_standard_color | |
3481 TSTOSS opt_enable_aGF ; =1: aGF can be selected underwater | |
3482 bra TFT_gf_mask2 ; Show "---" instead | |
3483 | |
3484 btfss use_agf | |
3485 call TFT_disabled_color | |
3486 | |
3487 WIN_STD dive_agf_column,dive_agf_row | |
3488 movff opt_aGF_low,lo | |
3489 output_8 | |
3490 PUTC "/" | |
3491 movff opt_aGF_high,lo | |
3492 output_8 | |
3493 STRCAT_PRINT "" | |
3494 bcf leftbind | |
3495 call TFT_standard_color | |
3496 return | |
3497 | |
3498 TFT_gf_mask2: | |
3499 WIN_STD dive_agf_column+.10,dive_agf_row | |
3500 STRCPY_PRINT "---" | |
3501 bcf leftbind | |
3502 return | |
3503 | |
3504 global TFT_gf_info ; Show GF informations | |
3505 TFT_gf_info: | |
3506 ; Show current GF | |
3507 movff char_O_gradient_factor,lo ; gradient factor absolute (Non-GF model) | |
3508 movff char_I_deco_model,hi | |
3509 decfsz hi,F ; jump over next line if char_I_deco_model == 1 | |
3510 movff char_O_relative_gradient_GF,lo ; gradient factor relative (GF model) | |
3511 WIN_STD dive_currentgf_column,dive_currentgf_row | |
3512 output_8 | |
3513 STRCAT_PRINT "%" | |
3514 return | |
3515 | |
3516 global TFT_ead_end_tissues_clock_mask ; Setup Mask | |
3517 TFT_ead_end_tissues_clock_mask: | |
3518 ; The mask | |
3519 call TFT_divemask_color | |
3520 ; Put three columns at HUD positions | |
3521 WIN_TINY dive_custom_hud_column1,dive_custom_hud_row | |
3522 STRCPY_TEXT_PRINT tDiveClock | |
3523 WIN_TINY dive_custom_hud_column2,dive_custom_hud_row | |
3524 STRCPY_TEXT_PRINT tDiveEAD_END | |
3525 WIN_TINY dive_custom_hud_column3,dive_custom_hud_row | |
3526 STRCPY_TEXT_PRINT tDiveTissues | |
3527 call TFT_standard_color | |
3528 return | |
3529 | |
3530 global TFT_ead_end_tissues_clock ; Show EAD/END, Tissues and clock | |
3531 TFT_ead_end_tissues_clock: | |
3532 ; Update clock and date | |
3533 WIN_SMALL dive_clock_column,dive_clock_row | |
3534 call TFT_clock2 ; print clock | |
105 | 3535 ; WIN_SMALL dive_endtime_column,dive_endtime_row |
3536 ; | |
3537 ; btfss decostop_active ; Already in nodeco mode ? | |
3538 ; bra TFT_ead_end_tissues_clock2 ; No, overwrite with some spaces | |
3539 ; | |
3540 ; STRCPY 0x94 ; "End of dive" icon | |
3541 ; movff hours,WREG | |
3542 ; mullw .60 | |
3543 ; movf mins,W | |
3544 ; addwf PRODL | |
3545 ; movlw .0 | |
3546 ; addwfc PRODH | |
3547 ; movff PRODL, lo | |
3548 ; movff PRODH, hi | |
3549 ; | |
3550 ; ; Add TTS | |
3551 ; movff int_O_ascenttime+0,WREG ; TTS | |
3552 ; addwf lo,F | |
3553 ; movff int_O_ascenttime+1,WREG ; TTS is 16bits | |
3554 ; addwfc hi,F | |
3555 ; | |
3556 ; call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
3557 ; movf hi,W | |
3558 ; movff lo,hi | |
3559 ; movwf lo ; exchange lo and hi | |
3560 ; output_99x | |
3561 ; PUTC ':' | |
3562 ; movff hi,lo | |
3563 ; output_99x | |
3564 ; STRCAT_PRINT "" | |
3565 ; bra TFT_ead_end_tissues_clock3 | |
3566 ; | |
3567 ;TFT_ead_end_tissues_clock2: | |
3568 ; STRCPY_PRINT " " | |
3569 ;TFT_ead_end_tissues_clock3: | |
0 | 3570 |
3571 ; Show END/EAD | |
3572 WIN_SMALL dive_ead_column,dive_ead_row | |
3573 STRCPY_TEXT tEAD ; EAD: | |
3574 movff char_O_EAD,lo | |
3575 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars | |
3576 WIN_SMALL dive_end_column,dive_end_row | |
3577 STRCPY_TEXT tEND ; END: | |
3578 movff char_O_END,lo | |
3579 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars | |
3580 | |
3581 ; Show tissue diagram | |
3582 call TFT_divemask_color | |
3583 WIN_TINY dive_tissue_N2_column,dive_tissue_N2_row | |
3584 STRCPY_TEXT_PRINT tN2 | |
3585 WIN_TINY dive_tissue_He_column,dive_tissue_He_row | |
3586 STRCPY_TEXT_PRINT tHe | |
3587 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation) | |
3588 movlb b'00000001' ; select ram bank 1 | |
3589 rcall DISP_tissue_saturation_graph ; Show char_O_tissue_N2_saturation and char_O_tissue_He_saturation | |
3590 return | |
3591 | |
3592 TFT_end_ead_common: ; print "lo m" (or ft) and limit to 8 chars | |
3593 bsf leftbind | |
3594 TSTOSS opt_units ; 0=Meters, 1=Feets | |
3595 bra TFT_end_ead_common_metric | |
3596 ;TFT_end_ead_common_imperial: | |
3597 ; With lo in m | |
3598 movf lo,W | |
3599 mullw .100 ; PRODL:PRODH = mbar/min | |
3600 movff PRODL,lo | |
3601 movff PRODH,hi | |
3602 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
3603 output_16_3 | |
3604 STRCAT_TEXT tFeets | |
3605 clrf WREG | |
3606 movff WREG,buffer+.8 ; limit string length to 8 | |
3607 bra TFT_end_ead_common_exit | |
3608 TFT_end_ead_common_metric: | |
3609 output_8 | |
3610 STRCAT_TEXT tMeters | |
3611 TFT_end_ead_common_exit: | |
3612 bcf leftbind | |
3613 movlw .8 | |
3614 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3615 STRCAT_PRINT "" | |
3616 return | |
3617 | |
3618 global TFT_surface_tissues | |
3619 TFT_surface_tissues: ; Show Tissue diagram in surface mode | |
3620 WIN_SMALL surf_tissue_N2_column,surf_tissue_N2_row | |
3621 STRCPY_TEXT_PRINT tN2 | |
3622 WIN_SMALL surf_tissue_He_column,surf_tissue_He_row | |
3623 STRCPY_TEXT_PRINT tHe | |
3624 | |
3625 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation) | |
3626 movlb b'00000001' ; select ram bank 1 | |
3627 | |
3628 movlw color_deepblue | |
3629 call TFT_set_color ; Make this configurable? | |
3630 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.29,.29 | |
3631 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.37,.37 | |
3632 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.45,.45 | |
3633 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.53,.53 | |
3634 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.61,.61 | |
3635 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.69,.69 | |
3636 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.77,.77 | |
3637 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.85,.85 | |
3638 WIN_FRAME_STD surf_tissue_diagram_top, surf_tissue_diagram_bottom, surf_tissue_diagram_left, surf_tissue_diagram_right ; outer frame | |
3639 | |
3640 movlw .1 | |
3641 movff WREG,win_height ; row bottom (0-239) | |
3642 movlw surf_tissue_diagram_left+.4 ; Surface mode | |
3643 movff WREG,win_leftx2 ; column left (0-159) | |
3644 movlw surf_tissue_diagram_right-surf_tissue_diagram_left-4 ; Width | |
3645 movff WREG,win_width | |
3646 | |
3647 ;---- Draw N2 Tissues | |
3648 lfsr FSR2, char_O_tissue_N2_saturation | |
3649 movlw d'16' | |
3650 movwf wait_temp ; 16 tissues | |
3651 clrf waitms_temp ; Row offset | |
3652 surf_tissue_saturation_graph_N2: | |
3653 movlw surf_tissue_diagram_top+.23 ; surface mode | |
3654 addwf waitms_temp,W | |
3655 movff WREG,win_top ; row top (0-239) | |
3656 rcall surf_tissue_saturation_loop ; Show one tissue | |
3657 decfsz wait_temp,F | |
3658 bra surf_tissue_saturation_graph_N2 | |
3659 | |
3660 ;---- Draw He Tissues ---------------------------------------------------- | |
3661 lfsr FSR2, char_O_tissue_He_saturation | |
3662 movlw d'16' | |
3663 movwf wait_temp ; 16 tissues | |
3664 clrf waitms_temp ; Row offset | |
3665 surf_tissue_saturation_graph_He: | |
3666 movlw surf_tissue_diagram_top+.23+.56 ; surface mode | |
3667 addwf waitms_temp,W | |
3668 movff WREG,win_top ; row top (0-239) | |
3669 rcall surf_tissue_saturation_loop ; Show one tissue | |
3670 decfsz wait_temp,F | |
3671 bra surf_tissue_saturation_graph_He | |
3672 return | |
3673 | |
3674 surf_tissue_saturation_loop: | |
3675 call TFT_standard_color | |
3676 movlw .2 ; row spacing | |
3677 addwf waitms_temp,F | |
3678 movf POSTINC2,W ; Get tissue load | |
3679 bcf STATUS,C | |
3680 rrcf WREG ; And divide by 2 | |
3681 movwf temp1 | |
3682 movlw .20 | |
3683 subwf temp1,F ; Subtract some offset | |
3684 movff win_width,WREG ; Max width. | |
3685 cpfslt temp1 ; skip if WREG < win_width | |
3686 movwf temp1 | |
3687 movff temp1,win_bargraph | |
3688 call TFT_box | |
3689 return | |
3690 | |
3691 ;============================================================================= | |
3692 ; Draw saturation graph, is surface mode or in dive mode. | |
3693 DISP_tissue_saturation_graph: | |
3694 ;---- Draw Frame | |
50 | 3695 call TFT_standard_color |
3696 WIN_FRAME_COLOR16 tissue_diagram_top, tissue_diagram_bottom, tissue_diagram_left, .159 ; outer frame | |
0 | 3697 |
3698 movlw .1 | |
3699 movff WREG,win_height ; row bottom (0-239) | |
3700 movlw tissue_diagram_left+.3 ; divemode | |
3701 movff WREG,win_leftx2 ; column left (0-159) | |
3702 movlw .159-tissue_diagram_left-4 ; Width | |
3703 movff WREG,win_width | |
3704 | |
3705 ;---- Draw N2 Tissues | |
3706 lfsr FSR2, char_O_tissue_N2_saturation | |
3707 movlw d'16' | |
3708 movwf wait_temp ; 16 tissues | |
3709 clrf waitms_temp ; Row offset | |
3710 tissue_saturation_graph_N2: | |
3711 movlw tissue_diagram_top+3 ; divemode | |
3712 addwf waitms_temp,W | |
3713 movff WREG,win_top ; row top (0-239) | |
3714 rcall tissue_saturation_graph_loop ; Show one tissue | |
3715 decfsz wait_temp,F | |
3716 bra tissue_saturation_graph_N2 | |
3717 | |
3718 ;---- Draw He Tissues ---------------------------------------------------- | |
3719 lfsr FSR2, char_O_tissue_He_saturation | |
3720 movlw d'16' | |
3721 movwf wait_temp ; 16 tissues | |
3722 clrf waitms_temp ; Row offset | |
3723 tissue_saturation_graph_He: | |
3724 movlw tissue_diagram_top+3+.22 ; divemode | |
3725 addwf waitms_temp,W | |
3726 movff WREG,win_top ; row top (0-239) | |
3727 | |
3728 rcall tissue_saturation_graph_loop ; Show one tissue | |
3729 | |
3730 decfsz wait_temp,F | |
3731 bra tissue_saturation_graph_He | |
3732 return | |
3733 | |
3734 tissue_saturation_graph_loop: | |
3735 call TFT_standard_color | |
3736 incf waitms_temp,F | |
3737 movf POSTINC2,W | |
3738 bcf STATUS,C | |
3739 rrcf WREG | |
3740 bcf STATUS,C | |
3741 rrcf WREG ; And divide by 4 | |
3742 movwf temp1 | |
3743 movlw .12 | |
3744 subwf temp1,F ; Subtract some offset | |
3745 movff win_width,WREG ; Max width. | |
3746 cpfslt temp1 ; skip if WREG < win_width | |
3747 movwf temp1 | |
3748 movff temp1,win_bargraph | |
3749 call TFT_box | |
3750 return | |
3751 | |
55 | 3752 |
0 | 3753 global TFT_display_cns |
3754 TFT_display_cns: | |
3755 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3756 tstfsz WREG ; Is there room for the warning? | |
3757 return ; No | |
3758 TFT_color_code warn_cns ; Color-code CNS output | |
3759 STRCPY_TEXT tCNS2 ; CNS: | |
3760 movff int_O_CNS_fraction+0,lo | |
3761 movff int_O_CNS_fraction+1,hi | |
3762 bsf leftbind | |
3763 output_16_3 ;Displays only 0...999 | |
3764 bcf leftbind | |
3765 PUTC "%" | |
3766 movlw warning_length ; Divemode string length | |
3767 btfss divemode ; In Divemode? | |
3768 movlw surf_warning_length ; No, use surface string length | |
3769 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3770 STRCAT_PRINT "" | |
3771 call TFT_standard_color | |
3772 return | |
3773 | |
3774 global TFT_display_ppo2 | |
3775 TFT_display_ppo2: ; Show ppO2 (ppO2 stored in xC, in mbar!) | |
3776 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3777 tstfsz WREG ; Is there room for the warning? | |
3778 return ; No | |
3779 TFT_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) | |
55 | 3780 STRCPY "ppO2:" |
0 | 3781 ; Check very high ppO2 manually |
3782 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? | |
3783 bra TFT_show_ppO2_3 ; Yes, display fixed Value! | |
3784 movff xC+0,lo | |
3785 movff xC+1,hi | |
3786 bsf ignore_digit4 | |
3787 output_16dp d'1' | |
3788 TFT_show_ppO2_2: | |
3789 movlw warning_length ; Divemode string length | |
3790 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3791 STRCAT_PRINT "" | |
3792 call TFT_standard_color | |
3793 return | |
3794 | |
3795 TFT_show_ppO2_3: | |
3796 STRCAT ">6.6" | |
3797 bra TFT_show_ppO2_2 | |
3798 | |
3799 | |
3800 global TFT_LogOffset_Logtitle | |
3801 TFT_LogOffset_Logtitle: | |
3802 STRCPY_TEXT tLogOffset | |
3803 PUTC ":" | |
3804 call do_logoffset_common_read ; Offset into lo:hi | |
3805 bsf leftbind | |
3806 output_16 | |
3807 bcf leftbind | |
3808 PUTC " " | |
3809 return ; No "_PRINT" here... | |
3810 | |
3811 | |
3812 global adjust_depth_with_salinity | |
3813 adjust_depth_with_salinity: ; computes salinity setting into lo:hi [mbar] | |
3814 btfsc simulatormode_active ; Do apply salinity in Simulatormode | |
3815 return | |
3816 | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
3817 global adjust_depth_with_salinity_log |
0 | 3818 movff opt_salinity,WREG ; 0-5% |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
3819 adjust_depth_with_salinity_log: ; computes salinity setting (FROM WREG!) into lo:hi [mbar] |
0 | 3820 addlw d'100' ; 1.00kg/l |
3821 movwf wait_temp | |
3822 | |
3823 movlw d'105' ; 105% ? | |
3824 cpfslt wait_temp ; Salinity higher limit | |
3825 return ; Out of limit, do not adjust lo:hi | |
3826 movlw d'99' ; 99% ? | |
3827 cpfsgt wait_temp ; Salinity lower limit | |
3828 return ; Out of limit, do not adjust lo:hi | |
3829 | |
3830 movff lo,xA+0 | |
3831 movff hi,xA+1 | |
3832 | |
3833 movlw d'102' ; 0,98bar/10m | |
3834 movwf xB+0 | |
3835 clrf xB+1 | |
3836 call mult16x16 ;xA*xB=xC (lo:hi * 100) | |
3837 movff wait_temp,xB+0 ; Salinity | |
3838 clrf xB+1 | |
3839 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3840 movff xC+0,lo | |
3841 movff xC+1,hi ; restore lo and hi with updated value | |
3842 return | |
3843 | |
3844 global convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
3845 convert_mbar_to_feet: ; convert value in lo:hi from mbar to feet | |
3846 movff lo,xA+0 | |
3847 movff hi,xA+1 | |
3848 | |
3849 movlw LOW d'328' ; 328feet/100m | |
3850 movwf xB+0 | |
3851 movlw HIGH d'328' | |
3852 movwf xB+1 | |
3853 | |
3854 call mult16x16 ; xA*xB=xC (lo:hi * 328) | |
3855 | |
3856 movlw d'50' ; round up | |
3857 addwf xC+0,F | |
3858 movlw 0 | |
3859 addwfc xC+1,F | |
3860 addwfc xC+2,F | |
3861 addwfc xC+3,F | |
3862 | |
3863 movlw LOW .10000 | |
3864 movwf xB+0 | |
3865 movlw HIGH .10000 | |
3866 movwf xB+1 | |
3867 | |
3868 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3869 | |
3870 movff xC+0,lo | |
3871 movff xC+1,hi ; restore lo and hi with updated value | |
3872 return | |
3873 | |
3874 global convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit | |
3875 convert_celsius_to_fahrenheit: ; convert value in lo:hi from celsius to fahrenheit | |
3876 ; Does it work with signed temperature? mH | |
3877 movff lo,xA+0 | |
3878 movff hi,xA+1 | |
3879 | |
3880 movlw d'18' ; 1C = 1.8F | |
3881 movwf xB+0 | |
3882 clrf xB+1 | |
3883 | |
3884 call mult16x16 ;xA*xB=xC (lo:hi * 18) | |
3885 | |
3886 movlw d'10' | |
3887 movwf xB+0 | |
3888 clrf xB+1 | |
3889 | |
3890 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3891 | |
3892 movlw LOW d'320' ; 0C = 32F | |
3893 addwf xC+0,F | |
3894 movlw HIGH d'320' | |
3895 addwfc xC+1,F | |
3896 | |
3897 movff xC+0,lo | |
3898 movff xC+1,hi ; restore lo and hi with updated value | |
3899 return | |
3900 | |
3901 END |