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