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