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