Mercurial > public > hwos_code
annotate src/tft_outputs.asm @ 117:6c577737c34e
minor
author | heinrichsweikamp |
---|---|
date | Wed, 25 Jun 2014 12:39:14 +0200 |
parents | 737d6f488729 |
children | abd30446e1cd |
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 | |
1789 lfsr FSR2,buffer | |
1790 movff compass_heading+0,lo | |
1791 movff compass_heading+1,hi | |
1792 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required | |
1793 bsf leftbind | |
1794 output_16 | |
1795 bcf leftbind | |
29
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1796 STRCAT "° " |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1797 rcall tft_compass_cardinal ; Add cardinal and ordinal to POSTINC2 |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1798 STRCAT_PRINT " " |
0 | 1799 return |
1800 | |
1801 global TFT_dive_compass_heading | |
1802 TFT_dive_compass_heading: | |
1803 rcall compass_heading_common | |
16
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
1804 btfsc compass_fast_mode ; In fast mode? |
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
1805 bra TFT_dive_compass_heading2 ; Yes |
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
1806 ; No, update 1/second max. |
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
1807 movff sensor_state_counter,lo |
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
1808 movlw .6 |
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
1809 cpfsgt lo |
83 | 1810 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
|
1811 TFT_dive_compass_heading2: |
0 | 1812 WIN_STD dive_compass_head_column,dive_compass_head_row |
1813 call TFT_standard_color | |
1814 lfsr FSR2,buffer | |
1815 movff compass_heading+0,lo | |
1816 movff compass_heading+1,hi | |
1817 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required | |
1818 bsf leftbind | |
1819 output_16 | |
1820 bcf leftbind | |
29
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1821 STRCAT "° " |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1822 rcall tft_compass_cardinal ; Add cardinal and ordinal to POSTINC2 |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1823 STRCAT_PRINT " " |
83 | 1824 TFT_dive_compass_heading3: |
85 | 1825 return ; No graphical output (yet) |
1826 | |
83 | 1827 movff compass_heading+0,sub_a+0 |
1828 movff compass_heading+1,sub_a+1 | |
1829 movlw .45 | |
1830 movwf sub_b+0 | |
1831 clrf sub_b+1 | |
1832 call subU16 ; sub_c = sub_a - sub_b (with UNSIGNED values) | |
1833 btfss neg_flag ; Result <0? | |
1834 bra TFT_dive_compass_heading_graph1 ; No | |
1835 ; Yes | |
1836 movlw LOW .360 | |
1837 movwf sub_a+0 | |
1838 movlw HIGH .360 | |
1839 movwf sub_a+1 | |
1840 movff sub_c+0,sub_b+0 | |
1841 movff sub_c+1,sub_b+1 | |
1842 call subU16 ; sub_c = sub_a - sub_b (with UNSIGNED values) | |
1843 | |
1844 TFT_dive_compass_heading_graph1: | |
1845 WIN_SMALL dive_compass_head_column+.70,dive_compass_head_row | |
1846 movff sub_c+0,lo | |
1847 movff sub_c+1,hi | |
1848 call TFT_standard_color | |
1849 lfsr FSR2,buffer | |
1850 bsf leftbind | |
1851 output_16 | |
1852 bcf leftbind | |
1853 STRCAT_PRINT " " | |
1854 | |
1855 ; Draw marks (left border of graphic is in lo) | |
1856 movlw b'00011111' | |
1857 andwf lo,F ; Get lowest 5bits of heading | |
1858 movlw d'30' | |
1859 cpfslt lo | |
1860 movwf lo ; Limit to 30 | |
1861 rlncf lo,F ; x2 | |
1862 ; marks parameters | |
1863 WIN_BOX_BLACK dive_compass_graph_row,dive_compass_graph_row+dive_compass_graph_height,.0,.159 | |
1864 call TFT_standard_color | |
1865 WIN_SMALL .77,dive_compass_graph_row ; Center of screen | |
1866 STRCPY_PRINT "^" | |
1867 call TFT_divemask_color | |
1868 movlw dive_compass_graph_row | |
1869 movff WREG,win_top | |
1870 movlw dive_compass_graph_height | |
1871 movff WREG,win_height | |
1872 movlw dive_compass_graph_width | |
1873 movff WREG,win_width+0 | |
1874 clrf win_width+1 | |
1875 ; marks draw loop | |
1876 movlw .6 | |
1877 movwf hi ; amount of marks (max.) | |
1878 clrf lo_temp | |
1879 TFT_dive_compass_heading_graph2: | |
1880 movlw LOW .319 | |
1881 movwf sub_a+0 | |
1882 movlw HIGH .319 | |
1883 movwf sub_a+1 | |
1884 movff lo,sub_b+0 | |
1885 movff lo_temp,sub_b+1 | |
1886 call subU16 | |
1887 btfsc neg_flag | |
1888 bra TFT_dive_compass_heading_graph3 ; Abort when negative | |
1889 movff sub_c+0,PRODL | |
1890 movff sub_c+1,PRODH | |
1891 call TFT_box_write_16bit_win_left ; With column in PRODL:PRODH | |
1892 ;---- Define Window ------------------------------------------------------ | |
1893 movf win_width,W | |
1894 bcf STATUS,C | |
1895 rlcf WREG | |
1896 movwf win_width+0 | |
1897 movlw 0 | |
1898 rlcf WREG | |
1899 movwf win_width+1 | |
1900 call TFT_box_16bit_win_left | |
1901 movlw .56 ; 60 px. space | |
1902 addwf lo,F | |
1903 movlw .0 | |
1904 addwfc lo_temp,F | |
1905 ; movlw .160 | |
1906 ; cpfslt lo | |
1907 ; bra TFT_dive_compass_heading_graph3 ; Abort | |
1908 decfsz hi,F | |
1909 bra TFT_dive_compass_heading_graph2 | |
1910 TFT_dive_compass_heading_graph3: | |
0 | 1911 return |
1912 | |
29
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1913 tft_compass_cardinal: |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1914 btfsc hi,0 ; Heading >255°? |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1915 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
|
1916 ; 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
|
1917 movlw .23 |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1918 subwf lo,W |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1919 btfss STATUS,C |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1920 bra tft_compass_cardinal_N |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1921 movlw .68 |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1922 subwf lo,W |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1923 btfss STATUS,C |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1924 bra tft_compass_cardinal_NE |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1925 movlw .113 |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1926 subwf lo,W |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1927 btfss STATUS,C |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1928 bra tft_compass_cardinal_E |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1929 movlw .158 |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1930 subwf lo,W |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1931 btfss STATUS,C |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1932 bra tft_compass_cardinal_SE |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1933 movlw .203 |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1934 subwf lo,W |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1935 btfss STATUS,C |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1936 bra tft_compass_cardinal_S |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1937 movlw .248 |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1938 subwf lo,W |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1939 btfss STATUS,C |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1940 bra tft_compass_cardinal_SW |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1941 bra tft_compass_cardinal_W |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1942 |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1943 tft_compass_cardinal2: |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1944 movlw .37 |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1945 subwf lo,W |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1946 btfss STATUS,C |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1947 bra tft_compass_cardinal_W |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1948 movlw .82 |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1949 subwf lo,W |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1950 btfss STATUS,C |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1951 bra tft_compass_cardinal_NW |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1952 bra tft_compass_cardinal_N |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1953 |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1954 tft_compass_cardinal_N: |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1955 STRCAT_TEXT tN |
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_NE: |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1958 STRCAT_TEXT tNE |
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_E: |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1961 STRCAT_TEXT tE |
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_SE: |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1964 STRCAT_TEXT tSE |
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_S: |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1967 STRCAT_TEXT tS |
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_SW: |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1970 STRCAT_TEXT tSW |
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_W: |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1973 STRCAT_TEXT tW |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1974 return |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1975 tft_compass_cardinal_NW: |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1976 STRCAT_TEXT tNW |
50c3e2c7ba7a
adding cardinal (and ordinal) directions for the compass
heinrichsweikamp
parents:
24
diff
changeset
|
1977 return |
0 | 1978 |
1979 compass_heading_common: | |
1980 extern compass | |
1981 extern compass_filter | |
1982 rcall TFT_get_compass | |
1983 rcall TFT_get_compass | |
1984 rcall TFT_get_compass | |
1985 rcall TFT_get_compass | |
1986 rcall TFT_get_compass | |
1987 rcall TFT_get_compass | |
1988 call compass ; Do compass corrections. | |
1989 banksel common | |
16
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
1990 |
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
1991 ; More then compass_fast_treshold? |
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
1992 movff compass_heading_old+0,sub_a+0 |
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
1993 movff compass_heading_old+1,sub_a+1 |
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
1994 movff compass_heading+0,sub_b+0 |
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
1995 movff compass_heading+1,sub_b+1 |
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
1996 call sub16 |
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
1997 movff compass_heading+0,compass_heading_old+0 ; copy new "old" |
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
1998 movff compass_heading+1,compass_heading_old+1 |
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
1999 |
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
2000 bcf compass_fast_mode |
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
2001 movlw compass_fast_treshold |
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
2002 cpfslt sub_c+0 ; > compass_fast_treshold? |
7b06f20881be
calm compass reading for minor heading changes
heinrichsweikamp
parents:
13
diff
changeset
|
2003 bsf compass_fast_mode ; Yes! |
0 | 2004 return |
2005 | |
2006 TFT_get_compass: | |
2007 call speed_normal | |
2008 call I2C_RX_compass ; Test Compass | |
2009 call I2C_RX_accelerometer ; Test Accelerometer | |
2010 call compass_filter ; Filter Raw compass + accel readings. | |
2011 banksel common | |
2012 return | |
2013 | |
2014 global TFT_debug_output | |
2015 TFT_debug_output: | |
117 | 2016 return |
113 | 2017 btfss c3_hardware |
106 | 2018 return |
113 | 2019 WIN_TINY .80,.0 |
2020 call TFT_standard_color | |
2021 lfsr FSR2,buffer | |
2022 movff flag10,lo | |
2023 output_8 | |
2024 STRCAT_PRINT "" | |
2025 return | |
2026 | |
2027 WIN_TINY .110,.0 | |
0 | 2028 call TFT_standard_color |
2029 lfsr FSR2,buffer | |
113 | 2030 movff o2_mv_sensor1+0,lo |
2031 movff o2_mv_sensor1+1,hi | |
105 | 2032 output_16 |
0 | 2033 STRCAT_PRINT "" |
113 | 2034 |
2035 WIN_TINY .110,.15 | |
2036 lfsr FSR2,buffer | |
2037 movff o2_mv_sensor2+0,lo | |
2038 movff o2_mv_sensor2+1,hi | |
2039 output_16 | |
2040 STRCAT_PRINT "" | |
2041 | |
2042 WIN_TINY .110,.30 | |
2043 lfsr FSR2,buffer | |
2044 movff o2_mv_sensor3+0,lo | |
2045 movff o2_mv_sensor3+1,hi | |
2046 output_16 | |
2047 STRCAT_PRINT "" | |
2048 | |
0 | 2049 return |
2050 | |
55 | 2051 global TFT_divetimeout ; Show timeout counter |
2052 TFT_divetimeout: | |
2053 call TFT_warning_set_window ; Sets the row and column for the current warning | |
2054 tstfsz WREG ; Is there room for the warning? | |
2055 return ; No | |
2056 | |
2057 call TFT_standard_color | |
2058 STRCPY 0x94 ; "End of dive" icon | |
2059 movlw LOW divemode_timeout | |
2060 movwf sub_a+0 | |
2061 movlw HIGH divemode_timeout | |
2062 movwf sub_a+1 | |
2063 movff timeout_counter,sub_b+0 | |
2064 movff timeout_counter2,sub_b+1 | |
2065 call subU16 ; sub_c = sub_a - sub_b (with UNSIGNED values) | |
2066 movff sub_c+0, lo | |
2067 movff sub_c+1, hi | |
2068 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
2069 movf hi,W | |
2070 movff lo,hi | |
2071 movwf lo ; exchange lo and hi | |
2072 output_99x | |
2073 PUTC ':' | |
2074 movff hi,lo | |
2075 output_99x | |
2076 movlw warning_length ; Divemode string length | |
2077 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
2078 STRCAT_PRINT "" | |
2079 return | |
2080 | |
0 | 2081 global TFT_ftts |
2082 TFT_ftts: | |
2083 movff char_I_extra_time,lo | |
2084 tstfsz lo | |
2085 bra $+4 | |
2086 return ; char_I_extra_time=0, return. | |
2087 incf warning_counter,F ; increase counter | |
2088 call TFT_warning_set_window ; Sets the row and column for the current warning | |
2089 tstfsz WREG ; Is there room for the warning? | |
2090 return ; No | |
2091 movff char_I_extra_time,lo | |
2092 STRCPY "@+" | |
2093 bsf leftbind | |
2094 output_8 | |
2095 PUTC ":" | |
2096 movff int_O_extra_ascenttime+0,lo | |
2097 movff int_O_extra_ascenttime+1,hi | |
2098 movf lo,W | |
2099 iorwf hi,W ; extra_ascenttime == 0 ? | |
2100 bz TFT_ftts2 ; No deco | |
2101 movf lo,W ; extra_ascenttime == 0xFFFF ? | |
2102 andwf hi,W | |
2103 incf WREG,w | |
2104 bz TFT_ftts2 ; Wait... | |
2105 output_16 | |
2106 bcf leftbind | |
2107 PUTC "'" | |
2108 movlw warning_length ; Divemode string length | |
2109 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
2110 STRCAT_PRINT "" | |
2111 return | |
2112 | |
2113 TFT_ftts2: | |
2114 STRCAT "---" | |
2115 bcf leftbind | |
2116 movlw warning_length ; Divemode string length | |
2117 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
2118 STRCAT_PRINT "" | |
2119 return | |
2120 | |
2121 | |
2122 ;============================================================================= | |
2123 | |
2124 global TFT_temp_surfmode | |
2125 TFT_temp_surfmode: | |
2126 WIN_SMALL surf_temp_column,surf_temp_row | |
2127 call TFT_standard_color | |
2128 | |
2129 SAFE_2BYTE_COPY temperature, lo | |
2130 | |
2131 TSTOSS opt_units ; 0=°C, 1=°F | |
2132 bra TFT_temp_surfmode_metric | |
2133 | |
2134 ;TFT_temp_surfmode_imperial: | |
2135 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required | |
2136 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit | |
2137 lfsr FSR2,buffer ; Overwrite "-" | |
2138 bsf ignore_digit5 ; Full degrees only | |
2139 output_16 | |
2140 STRCAT_PRINT "" | |
2141 call TFT_divemask_color | |
2142 WIN_SMALL surf_temp_column+4*8,surf_temp_row | |
2143 STRCPY_PRINT "°F" | |
2144 return | |
2145 | |
2146 TFT_temp_surfmode_metric: | |
2147 lfsr FSR2,buffer | |
2148 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required | |
2149 movlw d'3' | |
2150 movwf ignore_digits | |
2151 bsf ignore_digit5 ; Full degrees only | |
2152 output_16 | |
2153 | |
13
2af021c66b0d
fix negative temperature display in surfacemode
heinrichsweikamp
parents:
11
diff
changeset
|
2154 ; read-back the buffer+4 |
2af021c66b0d
fix negative temperature display in surfacemode
heinrichsweikamp
parents:
11
diff
changeset
|
2155 movff buffer+4,lo |
0 | 2156 movlw " " ; Space |
2157 cpfseq lo ; Was it a space (between +1°C and -1°C)? | |
2158 bra TFT_temp_surfmode1 ; No. | |
2159 movlw "0" ; Yes, print manual zero | |
2160 movff WREG,buffer+3 | |
2161 bra TFT_temp_surfmode2 | |
2162 TFT_temp_surfmode1: | |
2163 ; Test if output was negative (Flag set in TFT_convert_signed_16bit) | |
2164 btfss neg_flag ; Negative temperature? | |
2165 bra TFT_temp_surfmode3 ; No, continue | |
2166 ; Yes, negative temperature! | |
2167 movff buffer+3,buffer+2 ; remove two spaces manually | |
2168 movff buffer+4,buffer+3 | |
2169 TFT_temp_surfmode2: | |
2170 movlw 0x00 | |
2171 movff WREG,buffer+4 | |
2172 TFT_temp_surfmode3: | |
2173 STRCAT_PRINT "" | |
2174 call TFT_divemask_color | |
2175 WIN_SMALL surf_temp_column+4*8,surf_temp_row | |
2176 STRCPY_PRINT "°C" | |
2177 return | |
2178 | |
2179 ;============================================================================= | |
2180 global TFT_divemode_menu_cursor | |
2181 TFT_divemode_menu_cursor: | |
2182 WIN_BOX_BLACK divemode_menu_item1_row,divemode_menu_item3_row+.24,divemode_menu_item1_column-.8,divemode_menu_item1_column-.1 | |
2183 WIN_BOX_BLACK divemode_menu_item4_row,divemode_menu_item6_row+.24,divemode_menu_item4_column-.8,divemode_menu_item4_column-.1 | |
2184 call TFT_standard_color | |
2185 | |
2186 movlw divemode_menu_item1_column-.8 | |
2187 btfsc menupos,2 ; >3? | |
2188 movlw divemode_menu_item4_column-.8 ; Yes | |
2189 movff WREG,win_leftx2 | |
2190 | |
2191 movff menupos,lo ; Copy menu pos | |
2192 movlw divemode_menu_item6_row | |
2193 dcfsnz lo,F | |
2194 movlw divemode_menu_item1_row | |
2195 dcfsnz lo,F | |
2196 movlw divemode_menu_item2_row | |
2197 dcfsnz lo,F | |
2198 movlw divemode_menu_item3_row | |
2199 dcfsnz lo,F | |
2200 movlw divemode_menu_item4_row | |
2201 dcfsnz lo,F | |
2202 movlw divemode_menu_item5_row | |
2203 movff WREG,win_top | |
2204 movlw FT_SMALL | |
2205 movff WREG,win_font | |
2206 STRCPY_PRINT "\xb7" ; print cursor | |
2207 return | |
2208 | |
2209 global TFT_temp_divemode | |
2210 TFT_temp_divemode: | |
2211 btfsc divemode_menu ; Is the dive mode menu shown? | |
2212 return ; Yes, return | |
2213 btfsc blinking_better_gas ; blinking better Gas? | |
2214 return ; Yes, no update of temperature now | |
2215 ; temperature | |
2216 WIN_SMALL dive_temp_column,dive_temp_row | |
2217 call TFT_standard_color | |
2218 bsf leftbind | |
2219 | |
2220 SAFE_2BYTE_COPY temperature, lo | |
2221 TSTOSS opt_units ; 0=°C, 1=°F | |
2222 bra TFT_temp_divemode_metric | |
2223 | |
2224 ;TFT_temp_divemode_imperial: | |
2225 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required | |
2226 call convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit | |
2227 lfsr FSR2,buffer ; Overwrite "-" (There won't be less then -18°C underwater...) | |
2228 bsf ignore_digit5 ; Full degrees only | |
2229 output_16 | |
2230 STRCAT_TEXT tLogTunitF | |
2231 TFT_temp_divemode_common: | |
2232 bcf leftbind | |
2233 movlw .4 ; limit to three chars | |
2234 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
2235 STRCAT_PRINT "" | |
2236 return ; Done. | |
2237 | |
2238 TFT_temp_divemode_metric: | |
2239 lfsr FSR2,buffer | |
2240 call TFT_convert_signed_16bit ; converts lo:hi into signed-short and adds '-' to POSTINC2 if required | |
2241 movlw d'3' | |
2242 movwf ignore_digits | |
2243 bsf ignore_digit5 ; Full degrees only | |
2244 output_16 | |
2245 STRCAT_TEXT tLogTunitC | |
2246 bra TFT_temp_divemode_common ; Done. | |
2247 | |
2248 TFT_active_setpoint: ; Show setpoint | |
2249 WIN_STD active_gas_column,active_gas_row | |
2250 call TFT_standard_color | |
2251 btfsc is_bailout ; =1: Bailout | |
2252 bra TFT_active_setpoint_bail ; Show "Bailout" instead of Setpoint | |
2253 | |
2254 lfsr FSR2,buffer | |
2255 movff char_I_const_ppO2,lo | |
2256 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo | |
2257 clrf hi | |
2258 bsf leftbind | |
2259 output_16dp d'3' | |
2260 bcf leftbind | |
2261 STRCAT_TEXT tbar | |
2262 TSTOSS opt_ccr_mode ; =0: Fixed SP, =1: Sensor | |
2263 bra $+4 | |
2264 PUTC "*" | |
2265 STRCAT_PRINT "" | |
2266 | |
2267 TFT_active_setpoint_diluent: | |
2268 call TFT_standard_color | |
2269 WIN_SMALL active_dil_column,active_dil_row | |
2270 movff char_I_O2_ratio,lo ; lo now stores O2 in % | |
2271 movff char_I_He_ratio,hi ; hi now stores He in % | |
2272 rcall TFT_show_dil_divemode2 ; Show diluent (Non-Inverted in all cases) | |
2273 | |
2274 btfss better_gas_available ; =1: A better gas is available and a gas change is advised in divemode | |
2275 return ; Done. | |
2276 btg blinking_better_gas ; Toggle blink bit... | |
2277 btfss blinking_better_gas ; blink now? | |
2278 return ; No, Done. | |
2279 | |
2280 movlw color_yellow ; Blink in yellow | |
2281 call TFT_set_color | |
2282 WIN_SMALL_INVERT active_dil_column,active_dil_row | |
2283 movff char_I_O2_ratio,lo ; lo now stores O2 in % | |
2284 movff char_I_He_ratio,hi ; hi now stores He in % | |
2285 rcall TFT_show_dil_divemode2 ; Show gas | |
2286 WIN_INVERT .0 ; Init new Wordprocessor | |
2287 call TFT_standard_color | |
2288 return ; Done. | |
2289 | |
2290 TFT_show_dil_divemode2: | |
2291 lfsr FSR2,buffer | |
2292 call customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 | |
2293 STRCAT_PRINT "" | |
2294 return | |
2295 | |
2296 TFT_active_setpoint_bail: | |
2297 STRCPY_TEXT_PRINT tDiveBailout ; Bailout | |
2298 bra TFT_active_setpoint_diluent | |
2299 | |
2300 global TFT_active_gas_divemode | |
2301 TFT_active_gas_divemode: ; Display gas/Setpoint | |
2302 btfsc divemode_menu ; Is the dive mode menu shown? | |
2303 return ; Yes, return | |
2304 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode | |
2305 return | |
2306 btfsc FLAG_ccr_mode ; in CCR mode | |
2307 bra TFT_active_setpoint ; Yes, show setpoint | |
2308 | |
2309 call TFT_standard_color | |
2310 WIN_STD active_gas_column,active_gas_row | |
2311 movff char_I_O2_ratio,lo ; lo now stores O2 in % | |
2312 movff char_I_He_ratio,hi ; hi now stores He in % | |
2313 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases) | |
2314 btfss better_gas_available ; =1: A better gas is available and a gas change is advised in divemode | |
2315 return ; Done. | |
2316 | |
2317 btg blinking_better_gas ; Toggle blink bit... | |
2318 btfss blinking_better_gas ; blink now? | |
2319 return ; No, Done. | |
50 | 2320 call TFT_attention_color ; blink in yellow |
0 | 2321 WIN_STD_INVERT active_gas_column,active_gas_row |
2322 movff char_I_O2_ratio,lo ; lo now stores O2 in % | |
2323 movff char_I_He_ratio,hi ; hi now stores He in % | |
2324 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases) | |
2325 WIN_INVERT .0 ; Init new Wordprocessor | |
2326 call TFT_standard_color | |
2327 return ; Done. | |
2328 | |
2329 TFT_active_gas_divemode2: | |
2330 lfsr FSR2,buffer | |
2331 call customview_show_mix ; Put "Nxlo", "Txlo/hi", "Air" or "O2" into Postinc2 | |
2332 STRCAT_PRINT "" | |
2333 return | |
2334 | |
2335 global TFT_display_decotype_surface | |
2336 TFT_display_decotype_surface: | |
2337 WIN_STD surf_decotype_column,surf_decotype_row | |
2338 WIN_COLOR color_lightblue | |
2339 lfsr FSR2,buffer | |
2340 movff opt_dive_mode,lo ; 0=OC, 1=CC, 2=Gauge, 3=Apnea | |
2341 tstfsz lo | |
2342 bra TFT_display_decotype_surface2 | |
116
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
2343 TFT_display_decotype_surface0: |
0 | 2344 STRCAT_TEXT_PRINT tDvOC ; OC |
2345 bra TFT_display_decotype_exit | |
2346 TFT_display_decotype_surface2: | |
2347 decfsz lo,F | |
2348 bra TFT_display_decotype_surface3 | |
113 | 2349 STRCAT_TEXT_PRINT tDvCC ; CC |
2350 call TFT_standard_color | |
2351 WIN_TINY surf_decotype_column+.18,surf_decotype_row+.12 | |
2352 | |
2353 TSTOSS opt_ccr_mode ; =0: Fixed SP, =1: Sensor | |
2354 bra TFT_display_decotype_cc_fixed | |
2355 ; Sensor mode | |
2356 STRCPY_TEXT tCCRModeSensor ; Sensor | |
2357 bra TFT_display_decotype_cc_common | |
2358 TFT_display_decotype_cc_fixed: | |
2359 STRCPY_TEXT tCCRModeFixedSP ; Fixed | |
2360 TFT_display_decotype_cc_common: | |
2361 STRCAT_PRINT "" | |
0 | 2362 bra TFT_display_decotype_exit |
2363 TFT_display_decotype_surface3: | |
2364 decfsz lo,F | |
2365 bra TFT_display_decotype_surface4 | |
116
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
2366 TFT_display_decotype_surface3_1: |
0 | 2367 STRCAT_TEXT_PRINT tDvGauge ; Gauge |
2368 bra TFT_display_decotype_exit | |
2369 TFT_display_decotype_surface4: | |
2370 STRCAT_TEXT_PRINT tDvApnea ; Apnea | |
2371 TFT_display_decotype_exit: | |
2372 call TFT_standard_color | |
2373 return | |
40 | 2374 |
116
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
2375 global TFT_display_decotype_surface1 ; Used from logbook! |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
2376 TFT_display_decotype_surface1: ; Used from logbook! |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
2377 tstfsz lo |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
2378 bra TFT_display_decotype_surface1_2 |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
2379 bra TFT_display_decotype_surface0 ;OC |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
2380 TFT_display_decotype_surface1_2: |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
2381 decfsz lo,F |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
2382 bra TFT_display_decotype_surface1_3 |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
2383 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
|
2384 TFT_display_decotype_surface1_3: |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
2385 decfsz lo,F |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
2386 bra TFT_display_decotype_surface4 ; Apnea |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
2387 bra TFT_display_decotype_surface3_1 ; Gauge |
737d6f488729
show decomode in logbook and simulator w/o sensor type
heinrichsweikamp
parents:
113
diff
changeset
|
2388 |
0 | 2389 ;============================================================================= |
2390 | |
2391 global TFT_splist_surfmode ; Show Setpoint list | |
2392 extern gaslist_strcat_setpoint | |
2393 TFT_splist_surfmode: | |
2394 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
2395 ;SP 1 | |
2396 WIN_SMALL surf_gaslist_column,surf_gaslist_row | |
2397 lfsr FSR2,buffer | |
2398 clrf PRODL | |
2399 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL# | |
2400 STRCAT_PRINT "" | |
2401 ;SP 2 | |
2402 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1) | |
2403 lfsr FSR2,buffer | |
2404 movlw .1 | |
2405 movwf PRODL | |
2406 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL# | |
2407 STRCAT_PRINT "" | |
2408 ;SP 3 | |
2409 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2) | |
2410 lfsr FSR2,buffer | |
2411 movlw .2 | |
2412 movwf PRODL | |
2413 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL# | |
2414 STRCAT_PRINT "" | |
2415 ;SP 4 | |
2416 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3) | |
2417 lfsr FSR2,buffer | |
2418 movlw .3 | |
2419 movwf PRODL | |
2420 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL# | |
2421 STRCAT_PRINT "" | |
2422 ;SP 5 | |
2423 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4) | |
2424 lfsr FSR2,buffer | |
2425 movlw .4 | |
2426 movwf PRODL | |
2427 call gaslist_strcat_setpoint ; Show SP#+1 of PRODL# | |
2428 STRCAT_PRINT "" | |
2429 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
2430 bcf leftbind | |
2431 return | |
2432 | |
2433 global TFT_gaslist_surfmode | |
2434 TFT_gaslist_surfmode: ; Displays Gas List | |
2435 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
2436 extern gaslist_strcat_gas_mod | |
2437 ;Gas 1 | |
2438 WIN_SMALL surf_gaslist_column,surf_gaslist_row | |
2439 lfsr FSR2,buffer | |
2440 movlw .0 | |
2441 movwf PRODL | |
2442 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
2443 STRCAT_PRINT "" | |
2444 ;Gas 2 | |
2445 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1) | |
2446 lfsr FSR2,buffer | |
2447 movlw .1 | |
2448 movwf PRODL | |
2449 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
2450 STRCAT_PRINT "" | |
2451 ;Gas 3 | |
2452 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2) | |
2453 lfsr FSR2,buffer | |
2454 movlw .2 | |
2455 movwf PRODL | |
2456 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
2457 STRCAT_PRINT "" | |
2458 ;Gas 4 | |
2459 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3) | |
2460 lfsr FSR2,buffer | |
2461 movlw .3 | |
2462 movwf PRODL | |
2463 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
2464 STRCAT_PRINT "" | |
2465 ;Gas 5 | |
2466 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4) | |
2467 lfsr FSR2,buffer | |
2468 movlw .4 | |
2469 movwf PRODL | |
2470 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
2471 STRCAT_PRINT "" | |
2472 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
2473 bcf leftbind | |
2474 return | |
2475 | |
2476 global TFT_dillist_surfmode | |
2477 TFT_dillist_surfmode: ; Displays Diluent List | |
2478 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
2479 ;Dil 1 | |
2480 WIN_SMALL surf_gaslist_column,surf_gaslist_row | |
2481 lfsr FSR2,buffer | |
2482 movlw .5 | |
2483 movwf PRODL | |
2484 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
2485 STRCAT_PRINT "" | |
2486 ;Dil 2 | |
2487 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.1) | |
2488 lfsr FSR2,buffer | |
2489 movlw .6 | |
2490 movwf PRODL | |
2491 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
2492 STRCAT_PRINT "" | |
2493 ;Dil 3 | |
2494 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.2) | |
2495 lfsr FSR2,buffer | |
2496 movlw .7 | |
2497 movwf PRODL | |
2498 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
2499 STRCAT_PRINT "" | |
2500 ;Dil 4 | |
2501 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.3) | |
2502 lfsr FSR2,buffer | |
2503 movlw .8 | |
2504 movwf PRODL | |
2505 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
2506 STRCAT_PRINT "" | |
2507 ;Dil 5 | |
2508 WIN_SMALL surf_gaslist_column,surf_gaslist_row+(surf_gaslist_spacing*.4) | |
2509 lfsr FSR2,buffer | |
2510 movlw .9 | |
2511 movwf PRODL | |
2512 call gaslist_strcat_gas_mod ;Append gas description of gas #PRODL (0-4) to current string | |
2513 STRCAT_PRINT "" | |
2514 bcf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint | |
2515 bcf leftbind | |
2516 return | |
2517 | |
2518 global TFT_depth | |
2519 TFT_depth: | |
2520 SAFE_2BYTE_COPY rel_pressure, lo | |
2521 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
2522 | |
2523 TSTOSS opt_units ; 0=m, 1=ft | |
2524 bra TFT_depth_metric | |
2525 ;TFT_depth_imperial | |
2526 WIN_LARGE depth_feet_column,depth_feet_row | |
2527 lfsr FSR2,buffer | |
2528 TFT_color_code warn_depth ; Color-code the output | |
2529 | |
2530 clrf sub_a+1 ; Display 0ft if lower then 30cm | |
2531 movlw d'30' | |
2532 movwf sub_a+0 | |
2533 movff hi,sub_b+1 | |
2534 movff lo,sub_b+0 | |
2535 call subU16 ; sub_c = sub_a - sub_b | |
2536 btfss neg_flag ; Depth lower then 0.4m? | |
2537 bra depth_less_0.3mtr_feet ; Yes, Show 0ft manually | |
2538 | |
2539 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
2540 bsf leftbind | |
2541 output_16 ; feet in Big font | |
2542 bcf leftbind | |
2543 movlw .3 ; limit to three chars | |
2544 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
2545 STRCAT_PRINT "" ; Display feet | |
2546 return | |
2547 | |
2548 depth_less_0.3mtr_feet: | |
2549 STRCAT_PRINT "0 " ; manual zero | |
2550 return | |
2551 | |
2552 TFT_depth_metric: | |
2553 WIN_LARGE depth_column,depth_row | |
2554 TFT_color_code warn_depth ; Color-code the output | |
2555 | |
2556 movlw .039 | |
2557 cpfslt hi | |
2558 bra depth_greater_99_84mtr | |
2559 | |
2560 btfsc depth_greater_100m ; Was depth>100m during last call | |
11 | 2561 rcall TFT_clear_depth ; Yes, clear depth area |
0 | 2562 bcf depth_greater_100m ; Do this once only... |
2563 | |
11 | 2564 movlw .039 |
2565 cpfslt hi | |
2566 bra depth_greater_99_84mtr | |
2567 | |
0 | 2568 lfsr FSR2,buffer |
2569 movlw HIGH d'1000' | |
2570 movwf sub_a+1 | |
2571 movlw LOW d'1000' | |
2572 movwf sub_a+0 | |
2573 movff hi,sub_b+1 | |
2574 movff lo,sub_b+0 | |
2575 incf sub_b+0,F | |
2576 movlw d'0' | |
2577 addwfc sub_b+1,F ; Add 1mbar offset | |
2578 call sub16 ; sub_c = sub_a - sub_b | |
2579 movlw ' ' | |
2580 btfss neg_flag ; Depth lower then 10m? | |
2581 movwf POSTINC2 ; Yes, add extra space | |
2582 | |
2583 clrf sub_a+1 | |
2584 movlw d'99' | |
2585 movwf sub_a+0 | |
2586 movff hi,sub_b+1 | |
2587 movff lo,sub_b+0 | |
2588 call subU16 ; sub_c = sub_a - sub_b | |
2589 btfss neg_flag ; Depth lower then 1m? | |
2590 bra tft_depth2 ; Yes, display manual Zero | |
2591 | |
2592 bsf leftbind | |
2593 bsf ignore_digit4 | |
2594 output_16 ; Full meters in Big font | |
2595 bcf leftbind | |
2596 bra tft_depth3 | |
2597 | |
2598 tft_depth2: | |
2599 WIN_LARGE depth_column,depth_row | |
2600 STRCAT "0" | |
2601 | |
2602 tft_depth3: | |
2603 STRCAT_PRINT "" ; Display full meters | |
2604 | |
2605 ; .1m in MEDIUM font | |
2606 WIN_MEDIUM depth_dm_column,depth_dm_row | |
2607 TFT_color_code warn_depth ; Color-code the output | |
2608 | |
2609 SAFE_2BYTE_COPY rel_pressure, lo | |
2610 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
2611 | |
2612 lfsr FSR2,buffer | |
2613 PUTC "." | |
2614 movlw HIGH d'30' ; Display 0.0m if lower then 30cm | |
2615 movwf sub_a+1 | |
2616 movlw LOW d'30' | |
2617 movwf sub_a+0 | |
2618 movff hi,sub_b+1 | |
2619 movff lo,sub_b+0 | |
2620 call subU16 ; sub_c = sub_a - sub_b | |
2621 btfss neg_flag ; Depth lower then 0.3m? | |
2622 bra depth_less_0.3mtr ; Yes, Show ".0" manually | |
2623 | |
2624 movlw d'4' | |
2625 movwf ignore_digits | |
2626 bsf ignore_digit5 | |
2627 output_16dp d'0' | |
2628 STRCAT_PRINT "" ; Display decimeters | |
2629 WIN_FONT FT_SMALL | |
2630 return | |
2631 | |
2632 depth_less_0.3mtr: | |
2633 STRCAT_PRINT "0" ; Display 0.0m manually | |
2634 WIN_FONT FT_SMALL | |
2635 return | |
2636 | |
2637 depth_greater_99_84mtr: ; Display only in full meters | |
2638 btfss depth_greater_100m ; Is depth>100m already? | |
2639 rcall TFT_clear_depth ; No, clear depth area and set flag | |
2640 ; Depth is already in hi:lo | |
2641 ; Show depth in Full meters | |
2642 ; That means ignore figure 4 and 5 | |
2643 lfsr FSR2,buffer | |
2644 bsf ignore_digit4 | |
2645 bsf leftbind | |
2646 output_16 | |
2647 bcf leftbind | |
2648 STRCAT_PRINT "" ; Display full meters only | |
2649 WIN_FONT FT_SMALL | |
2650 return | |
2651 | |
2652 TFT_clear_depth: ; No, clear depth area and set flag | |
2653 WIN_BOX_BLACK depth_row, .77,.0, max_depth_column-.1 ;top, bottom, left, right | |
2654 bsf depth_greater_100m ; Set Flag | |
2655 return | |
2656 | |
2657 ;============================================================================= | |
2658 | |
2659 ; global TFT_user_image | |
2660 ;TFT_user_image: | |
2661 ; ;---- Display user image ------------------------------------------------- | |
2662 ; ; Compute address in external EEPROM | |
2663 ; movff opt_skin,WREG | |
2664 ; mullw 0x50 | |
2665 ; movff PRODL,ext_flash_address+1 | |
2666 ; movf PRODH,W | |
2667 ; iorlw 0x30 | |
2668 ; movwf ext_flash_address+2 | |
2669 ; | |
2670 ; ; First pixel at @+4: | |
2671 ; movlw 4 | |
2672 ; movwf ext_flash_address+0 | |
2673 ; | |
2674 ; ; Read first pixel | |
2675 ; call ext_flash_read_block_start | |
2676 ;; movff SSP2BUF,skin_color+1 ; TFT format: HIGH is first... | |
2677 ; movwf SSP2BUF ; Write to buffer to initiate new read | |
2678 ; btfss SSP2STAT, BF ; Next byte ready ? | |
2679 ; bra $-2 ; NO: wait... | |
2680 ;; movff SSP2BUF,skin_color+0 | |
2681 ; call ext_flash_read_block_stop | |
2682 ; | |
2683 ; ; Make a frame of the retrieved skin color. | |
2684 ; setf win_color1 | |
2685 ; setf win_color2 | |
2686 ; WIN_FRAME_COLOR16 user_image_upper-.1, user_image_upper+.100,user_image_left-.1, user_image_left+.50 | |
2687 ; | |
2688 ; WIN_LEFT user_image_left+.25 | |
2689 ; WIN_TOP user_image_upper+.50 | |
2690 ; | |
2691 ; ; Display skin icon | |
2692 ; clrf ext_flash_address+0 | |
2693 ; call TFT_write_flash_image_addr | |
2694 ; | |
2695 ; ;---- Print custom text string | |
2696 ; WIN_LEFT user_image_left+.50+.5 | |
2697 ; WIN_TOP user_image_upper+.0 | |
2698 ; | |
2699 ; ; ---- STRNCPY : String copy from RAM | |
2700 ; ; lfsr FSR0, opt_name ; Source | |
2701 ; lfsr FSR1, .13 ; Len max | |
2702 ; lfsr FSR2, buffer ; destination | |
2703 ;TFT_user_image_1: | |
2704 ; movf POSTINC0,W ; Get byte | |
2705 ; bz TFT_user_image_2 ; End if NULL | |
2706 ; movwf POSTINC2 ; NO: copy | |
2707 ; decfsz FSR1L ; Max len reached ? | |
2708 ; bra TFT_user_image_1 ; NO: loop | |
2709 ;TFT_user_image_2: | |
2710 ; clrf POSTINC2 ; Mark end of string | |
2711 ; | |
2712 ; goto aa_wordprocessor ; and print | |
2713 | |
2714 | |
2715 global TFT_custom_text | |
2716 TFT_custom_text: ; Show the custom text | |
2717 lfsr FSR0, opt_name ; Source | |
2718 WIN_SMALL surf_customtext_column,surf_customtext_row1 ; First row | |
2719 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
2720 incfsz lo,F ; Was lo=255? | |
2721 return ; No, all done. | |
2722 lfsr FSR0, opt_name+.12 ; Source | |
2723 WIN_SMALL surf_customtext_column,surf_customtext_row2 ; Second row | |
2724 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
2725 incfsz lo,F ; Was lo=255? | |
2726 return ; No, all done. | |
2727 lfsr FSR0, opt_name+.24 ; Source | |
2728 WIN_SMALL surf_customtext_column,surf_customtext_row3 ; Third row | |
2729 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
2730 incfsz lo,F ; Was lo=255? | |
2731 return ; No, all done. | |
2732 lfsr FSR0, opt_name+.36 ; Source | |
2733 WIN_SMALL surf_customtext_column,surf_customtext_row4 ; Forth row | |
2734 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
2735 incfsz lo,F ; Was lo=255? | |
2736 return ; No, all done. | |
2737 lfsr FSR0, opt_name+.48 ; Source | |
2738 WIN_SMALL surf_customtext_column,surf_customtext_row5 ; Fifth row | |
2739 rcall TFT_custom_text_2 ; Show up to 12 chars and print | |
2740 return ; Done. | |
2741 | |
2742 TFT_custom_text_2: | |
2743 lfsr FSR2, buffer ; destination | |
2744 movlw .12 | |
2745 movwf lo ; length/line | |
2746 TFT_custom_text_3: | |
2747 movf POSTINC0,W ; Get byte | |
2748 bz TFT_custom_text_4 ; End if NULL | |
2749 movwf POSTINC2 ; NO: copy | |
2750 decfsz lo,F ; Max len reached ? | |
2751 bra TFT_custom_text_3 ; NO: loop | |
2752 setf lo ; lo=255 -> more to come | |
2753 TFT_custom_text_4: | |
2754 clrf POSTINC2 ; Mark end of string | |
2755 goto aa_wordprocessor ; print and return | |
2756 | |
2757 | |
2758 ;============================================================================= | |
2759 global TFT_update_surf_press | |
2760 TFT_update_surf_press: | |
2761 WIN_SMALL surf_press_column,surf_press_row | |
2762 call TFT_standard_color | |
2763 SAFE_2BYTE_COPY amb_pressure, lo | |
2764 lfsr FSR2,buffer | |
2765 movff lo,sub_a+0 | |
2766 movff hi,sub_a+1 | |
2767 movff last_surfpressure_30min+0,sub_b+0 | |
2768 movff last_surfpressure_30min+1,sub_b+1 | |
2769 call subU16 ; sub_c = sub_a - sub_b | |
2770 btfsc neg_flag ; Pressure lower? | |
2771 rcall update_surf_press2 ; Yes, test threshold | |
2772 | |
2773 tstfsz sub_c+1 ; >255mbar difference? | |
2774 bra update_surf_press_common; Yes, display! | |
2775 movlw d'10' ; 10mbar noise suppression | |
2776 subwf sub_c+0,W | |
2777 btfsc STATUS,C | |
2778 bra update_surf_press_common; Yes, display! | |
2779 SAFE_2BYTE_COPY last_surfpressure_30min, lo ; Overwrite with stable value... | |
2780 | |
2781 update_surf_press_common: | |
2782 output_16 | |
2783 ; Show only 4 figures | |
2784 movff buffer+1,buffer+0 | |
2785 movff buffer+2,buffer+1 | |
2786 movff buffer+3,buffer+2 | |
2787 movff buffer+4,buffer+3 | |
2788 movlw 0x00 | |
2789 movff WREG,buffer+4 | |
2790 STRCAT_PRINT "" | |
2791 call TFT_divemask_color | |
2792 WIN_SMALL surf_press_column+4*8,surf_press_row | |
2793 STRCPY_PRINT "mbar" | |
2794 return | |
2795 | |
2796 update_surf_press2: | |
2797 movff lo,sub_b+0 | |
2798 movff hi,sub_b+1 | |
2799 movff last_surfpressure_30min+0,sub_a+0 | |
2800 movff last_surfpressure_30min+1,sub_a+1 | |
2801 call subU16 ; sub_c = sub_a - sub_b | |
2802 return | |
2803 | |
2804 ;============================================================================= | |
2805 | |
2806 global TFT_update_batt_voltage | |
2807 TFT_update_batt_voltage: | |
2808 movff batt_percent,lo ; Get battery percent | |
2809 TFT_color_code warn_battery; Color-code battery percent | |
2810 WIN_TINY batt_percent_column,batt_percent_row | |
2811 lfsr FSR2,buffer | |
2812 bsf leftbind | |
2813 output_8 | |
2814 bcf leftbind | |
88 | 2815 STRCAT "% " |
2816 movlw 0x00 | |
2817 movff WREG,buffer+4 ; Only "xxx%" | |
2818 STRCAT_PRINT "" | |
0 | 2819 call TFT_standard_color |
2820 WIN_TINY batt_voltage_column,batt_voltage_row | |
2821 lfsr FSR2,buffer | |
2822 movff batt_voltage+0,lo | |
2823 movff batt_voltage+1,hi | |
2824 bsf leftbind | |
2825 output_16dp .2 | |
2826 bcf leftbind | |
2827 PUTC 'V' | |
2828 movff buffer+5,buffer+3 | |
2829 movlw 0x00 | |
2830 movff WREG,buffer+4 ; Only "x.yV" | |
24 | 2831 STRCAT_PRINT "" |
0 | 2832 return |
2833 | |
2834 ;update_battery_debug: | |
2835 ; call TFT_standard_color | |
2836 ; WIN_TINY .70,.0 | |
2837 ; lfsr FSR2,buffer | |
2838 ; movff battery_gauge+5,xC+3 | |
2839 ; movff battery_gauge+4,xC+2 | |
2840 ; movff battery_gauge+3,xC+1 | |
2841 ; movff battery_gauge+2,xC+0 | |
2842 ; ; battery_gauge:6 is nAs | |
2843 ; ; devide through 65536 | |
2844 ; ; devide through 152 | |
2845 ; ; Result is 0.01Ah in xC+1:xC+0 | |
2846 ; movlw LOW .152 | |
2847 ; movwf xB+0 | |
2848 ; movlw HIGH .152 | |
2849 ; movwf xB+1 | |
2850 ; call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
2851 ; bsf leftbind | |
2852 ; movff xC+0,lo | |
2853 ; movff xC+1,hi | |
2854 ; output_16 | |
2855 ; STRCAT_PRINT "x.01Ah" | |
2856 ; WIN_FONT FT_SMALL | |
2857 ; bcf leftbind | |
2858 ; return | |
2859 | |
2860 ;============================================================================= | |
2861 | |
2862 global TFT_convert_signed_16bit | |
2863 TFT_convert_signed_16bit: | |
2864 bcf neg_flag ; Positive temperature | |
2865 btfss hi,7 ; Negative temperature ? | |
2866 return ; No, return | |
2867 ; Yes, negative temperature! | |
2868 bsf neg_flag ; Negative temperature | |
2869 PUTC '-' ; Display "-" | |
2870 comf hi ; Then, 16bit sign changes. | |
2871 negf lo | |
2872 btfsc STATUS,C | |
2873 incf hi | |
2874 return ; and return | |
2875 | |
2876 ;============================================================================= | |
2877 | |
2878 global TFT_convert_date | |
2879 TFT_convert_date: ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | |
2880 movff opt_dateformat,WREG ; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD | |
2881 movwf EEDATA ; used as temp here | |
2882 tstfsz EEDATA | |
2883 bra TFT_convert_date1 | |
2884 ; EEDATA was 0 | |
2885 ; Use MMDDYY | |
2886 movff convert_value_temp+0,lo ;month | |
2887 bsf leftbind | |
2888 output_99x | |
2889 PUTC '.' | |
2890 movff convert_value_temp+1,lo ;day | |
2891 bra TFT_convert_date1_common ;year | |
2892 | |
2893 TFT_convert_date1: ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD) | |
2894 decfsz EEDATA,F | |
2895 bra TFT_convert_date2 ; EEDATA was 2 | |
2896 ; EEDATA was 1 | |
2897 ; Use DDMMYY | |
2898 movff convert_value_temp+1,lo ;day | |
2899 bsf leftbind | |
2900 output_99x | |
2901 PUTC '.' | |
2902 movff convert_value_temp+0,lo ;month | |
2903 | |
2904 TFT_convert_date1_common: | |
2905 bsf leftbind | |
2906 output_99x | |
2907 PUTC '.' | |
2908 movff convert_value_temp+2,lo ;year | |
2909 output_99x | |
2910 bcf leftbind | |
2911 return | |
2912 | |
2913 TFT_convert_date2: | |
2914 ; Use YYMMDD | |
2915 movff convert_value_temp+2,lo ;year | |
2916 bsf leftbind | |
2917 output_99x | |
2918 PUTC '.' | |
2919 movff convert_value_temp+0,lo ;month | |
2920 output_99x | |
2921 PUTC '.' | |
2922 movff convert_value_temp+1,lo ;day | |
2923 output_99x | |
2924 bcf leftbind | |
2925 return | |
2926 | |
2927 ;============================================================================= | |
2928 | |
2929 global TFT_convert_date_short | |
2930 TFT_convert_date_short: ; converts into "DD/MM" or "MM/DD" or "MM/DD" in postinc2 | |
2931 movff opt_dateformat,WREG ; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD | |
2932 movwf EEDATA ; used as temp here | |
2933 tstfsz EEDATA | |
2934 bra TFT_convert_date_short1 | |
2935 ; EEDATA was 0 | |
2936 ; Use MMDDYY | |
2937 TFT_convert_date_short_common: | |
2938 movff convert_value_temp+0,lo ;month | |
2939 bsf leftbind | |
2940 output_99x | |
2941 PUTC '.' | |
2942 movff convert_value_temp+1,lo ;day | |
2943 output_99x | |
2944 bcf leftbind | |
2945 return | |
2946 | |
2947 TFT_convert_date_short1: | |
2948 decfsz EEDATA,F | |
2949 bra TFT_convert_date_short_common ; EEDATA was 2 -> Use YYMMDD | |
2950 ; EEDATA was 1 | |
2951 ; Use DDMMYY | |
2952 movff convert_value_temp+1,lo ;day | |
2953 bsf leftbind | |
2954 output_99x | |
2955 PUTC '.' | |
2956 movff convert_value_temp+0,lo ;month | |
2957 output_99x | |
2958 bcf leftbind | |
2959 return | |
2960 | |
2961 ;============================================================================= | |
2962 | |
2963 global TFT_date | |
2964 TFT_date: | |
48 | 2965 WIN_SMALL surf_date_column,surf_date_row ; Init new Wordprocessor |
0 | 2966 call TFT_standard_color |
2967 lfsr FSR2,buffer | |
2968 movff month,convert_value_temp+0 | |
2969 movff day,convert_value_temp+1 | |
2970 movff year,convert_value_temp+2 | |
2971 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | |
2972 STRCAT_PRINT "" | |
2973 return | |
2974 | |
2975 ;============================================================================= | |
2976 | |
2977 global TFT_max_pressure | |
2978 TFT_max_pressure: | |
2979 btfsc FLAG_apnoe_mode ; different display in apnoe mode | |
2980 bra TFT_max_pressure_apnoe | |
2981 TFT_max_pressure2: | |
2982 SAFE_2BYTE_COPY max_pressure, lo | |
2983 TFT_max_pressure3: | |
2984 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
2985 TSTOSS opt_units ; 0=m, 1=ft | |
2986 bra TFT_max_pressure2_metric | |
2987 ;TFT_max_pressure2_imperial | |
2988 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
2989 WIN_MEDIUM max_depth_feet_column,max_depth_feet_row | |
2990 lfsr FSR2,buffer | |
2991 call TFT_standard_color | |
2992 output_16_3 | |
2993 STRCAT_PRINT "" | |
2994 return | |
2995 | |
2996 TFT_max_pressure2_metric: | |
11 | 2997 WIN_MEDIUM max_depth_column,max_depth_row |
2998 | |
2999 movlw .039 | |
3000 cpfslt hi | |
3001 bra max_depth_greater_99_84mtr | |
3002 | |
3003 btfsc max_depth_greater_100m ; Was depth>100m during last call | |
3004 rcall TFT_clear_max_depth ; Yes, clear depth area | |
3005 bcf max_depth_greater_100m ; Do this once only... | |
3006 | |
3007 movlw .039 | |
3008 cpfslt hi | |
3009 bra max_depth_greater_99_84mtr | |
3010 | |
3011 lfsr FSR2,buffer | |
3012 movlw HIGH d'1000' | |
3013 movwf sub_a+1 | |
3014 movlw LOW d'1000' | |
3015 movwf sub_a+0 | |
3016 movff hi,sub_b+1 | |
3017 movff lo,sub_b+0 | |
3018 incf sub_b+0,F | |
3019 movlw d'0' | |
3020 addwfc sub_b+1,F ; Add 1mbar offset | |
3021 call sub16 ; sub_c = sub_a - sub_b | |
3022 movlw ' ' | |
3023 btfss neg_flag ; Depth lower then 10m? | |
3024 movwf POSTINC2 ; Yes, add extra space | |
3025 | |
3026 clrf sub_a+1 | |
3027 movlw d'99' | |
3028 movwf sub_a+0 | |
3029 movff hi,sub_b+1 | |
3030 movff lo,sub_b+0 | |
3031 call subU16 ; sub_c = sub_a - sub_b | |
3032 btfss neg_flag ; Depth lower then 1m? | |
3033 bra tft_max_depth2 ; Yes, display manual Zero | |
3034 | |
3035 bsf ignore_digit4 ; no 0.1m | |
3036 bsf leftbind | |
3037 output_16 | |
3038 bra tft_max_depth3 | |
3039 | |
3040 tft_max_depth2: | |
0 | 3041 WIN_MEDIUM max_depth_column,max_depth_row |
11 | 3042 STRCAT "0" |
3043 | |
3044 tft_max_depth3: | |
0 | 3045 call TFT_standard_color |
11 | 3046 STRCAT_PRINT "" ; Display full meters |
3047 bcf leftbind | |
3048 | |
3049 ; .1m in SMALL font | |
3050 WIN_SMALL max_depth_dm_column,max_depth_dm_row | |
3051 | |
3052 SAFE_2BYTE_COPY max_pressure, lo | |
3053 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
3054 | |
3055 lfsr FSR2,buffer | |
3056 PUTC "." | |
3057 | |
3058 movlw d'4' | |
3059 movwf ignore_digits | |
3060 bsf ignore_digit5 | |
3061 bsf leftbind | |
3062 output_16dp d'0' | |
3063 STRCAT_PRINT "" ; Display decimeters | |
3064 bcf leftbind | |
3065 return | |
3066 | |
3067 max_depth_greater_99_84mtr: ; Display only in full meters | |
3068 btfss max_depth_greater_100m ; Is max depth>100m already? | |
3069 rcall TFT_clear_max_depth ; No, clear max depth area and set flag | |
3070 ; Max. Depth is already in hi:lo | |
3071 ; Show max. depth in Full meters | |
3072 ; That means ignore figure 4 and 5 | |
3073 lfsr FSR2,buffer | |
3074 bsf ignore_digit4 | |
3075 bsf leftbind | |
0 | 3076 output_16 |
11 | 3077 bcf leftbind |
3078 STRCAT_PRINT "" ; Display full meters only | |
3079 WIN_FONT FT_SMALL | |
0 | 3080 return |
3081 | |
11 | 3082 TFT_clear_max_depth: ; No, clear max. depth area and set flag |
3083 WIN_BOX_BLACK max_depth_row,.49,max_depth_column, max_depth_dm_column+.13 ;top, bottom, left, right | |
3084 bsf max_depth_greater_100m ; Set Flag | |
3085 return | |
3086 | |
3087 | |
0 | 3088 TFT_max_pressure_apnoe: |
3089 btfss FLAG_active_descent ; Are we descending? | |
3090 bra TFT_max_pressure2 ; Yes, show normal max. | |
3091 SAFE_2BYTE_COPY apnoe_max_pressure, lo | |
3092 bra TFT_max_pressure3 ; Show apnoe_max_pressure as max. depth | |
3093 | |
3094 global TFT_display_apnoe_last_max | |
3095 TFT_display_apnoe_last_max: | |
3096 call TFT_divemask_color | |
3097 WIN_TINY last_max_apnoe_text_column,last_max_apnoe_text_row | |
3098 STRCPY_TEXT_PRINT tApnoeMax | |
3099 | |
3100 call TFT_standard_color | |
3101 SAFE_2BYTE_COPY max_pressure, lo | |
3102 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
3103 TSTOSS opt_units ; 0=m, 1=ft | |
3104 bra TFT_display_apnoe_last_m_metric | |
3105 ;TFT_display_apnoe_last_max_imperial | |
3106 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
3107 WIN_MEDIUM apnoe_last_max_depth_column,apnoe_last_max_depth_row | |
3108 lfsr FSR2,buffer | |
3109 output_16 | |
3110 STRCAT_PRINT "" | |
3111 return | |
3112 | |
3113 TFT_display_apnoe_last_m_metric: | |
3114 WIN_MEDIUM apnoe_last_max_depth_column,apnoe_last_max_depth_row | |
3115 lfsr FSR2,buffer | |
3116 bsf ignore_digit5 ; do not display 1cm depth | |
3117 output_16dp d'3' | |
3118 STRCAT_PRINT "" | |
3119 return | |
3120 | |
3121 ;============================================================================= | |
3122 global TFT_divemins | |
3123 TFT_divemins: | |
3124 movff divemins+0,lo | |
3125 movff divemins+1,hi | |
98 | 3126 bcf leftbind |
0 | 3127 |
3128 btfsc no_more_divesecs ; Ignore seconds? | |
3129 bra TFT_divemins2 ; Show minutes only | |
3130 | |
3131 movlw .99 | |
3132 cpfsgt lo ; bigger then 99? | |
3133 bra TFT_divemins1 ; No show mins:secs | |
3134 ; Yes, remove second display for the rest of the dive and clear seconds | |
3135 bsf no_more_divesecs ; Set flag | |
3136 ; Clear rest of seconds | |
3137 WIN_BOX_BLACK divetime_row, warning1_row,divetime_column,.159 ;top, bottom, left, right | |
3138 bra TFT_divemins2 ; Show minutes only | |
3139 | |
3140 TFT_divemins1: | |
3141 WIN_MEDIUM divetime_column, divetime_row | |
3142 lfsr FSR2,buffer | |
3143 output_16_3 ; displays only last three figures from a 16Bit value (0-999) | |
3144 call TFT_standard_color | |
3145 STRCAT_PRINT "" ; Show minutes in large font | |
3146 | |
3147 WIN_SMALL divetime_secs_column, divetime_secs_row ; left position for two sec figures | |
3148 lfsr FSR2,buffer | |
3149 PUTC ':' | |
3150 bsf leftbind | |
3151 movff divesecs,lo | |
3152 output_99x | |
3153 bcf leftbind | |
3154 STRCAT_PRINT "" ; Show seconds in small font | |
3155 return | |
3156 | |
3157 TFT_divemins2: | |
3158 WIN_MEDIUM divetime_minsonly_column, divetime_row | |
3159 lfsr FSR2,buffer | |
3160 output_16 | |
3161 call TFT_standard_color | |
3162 STRCAT_PRINT "" ; Show minutes in large font | |
3163 return | |
3164 | |
3165 ;============================================================================= | |
3166 global TFT_display_apnoe_surface | |
3167 TFT_display_apnoe_surface: | |
3168 call TFT_divemask_color | |
3169 WIN_TINY surface_apnoe_text_column,surface_apnoe_text_row | |
3170 STRCPY_TEXT_PRINT tApnoeSurface | |
3171 | |
3172 call TFT_standard_color | |
3173 WIN_MEDIUM surface_time_apnoe_column, surface_time_apnoe_row | |
3174 movff apnoe_surface_mins,lo | |
3175 lfsr FSR2,buffer | |
3176 output_8 | |
3177 PUTC ':' | |
3178 movff apnoe_surface_secs,lo | |
3179 output_99x | |
3180 STRCAT_PRINT "" | |
3181 return | |
3182 | |
3183 global TFT_apnoe_clear_surface | |
3184 TFT_apnoe_clear_surface: | |
3185 ; Clear Surface timer.... | |
3186 WIN_BOX_BLACK surface_apnoe_text_row, .239, surface_apnoe_text_column, .159 ;top, bottom, left, right | |
3187 return | |
3188 | |
3189 global TFT_display_apnoe_descent | |
3190 TFT_display_apnoe_descent: ; Descent divetime | |
3191 movff apnoe_mins,lo | |
3192 clrf hi | |
3193 WIN_MEDIUM divetime_column, divetime_row | |
3194 lfsr FSR2,buffer | |
3195 output_16_3 ; displays only last three figures from a 16Bit value (0-999) | |
3196 call TFT_standard_color | |
3197 STRCAT_PRINT "" ; Show minutes in large font | |
3198 WIN_SMALL divetime_secs_column, divetime_secs_row ; left position for two sec figures | |
3199 lfsr FSR2,buffer | |
3200 PUTC ':' | |
3201 bsf leftbind | |
3202 movff apnoe_secs,lo | |
3203 output_99x | |
3204 bcf leftbind | |
3205 STRCAT_PRINT "" ; Show seconds in small font | |
38 | 3206 |
3207 | |
3208 call TFT_divemask_color | |
3209 WIN_TINY total_apnoe_text_column,total_apnoe_text_row | |
3210 STRCPY_TEXT_PRINT tApnoeTotal | |
3211 call TFT_standard_color | |
3212 movff divemins,lo | |
3213 clrf hi | |
3214 WIN_MEDIUM apnoe_total_divetime_column, apnoe_total_divetime_row | |
3215 lfsr FSR2,buffer | |
3216 output_16_3 ; displays only last three figures from a 16Bit value (0-999) | |
3217 call TFT_standard_color | |
3218 STRCAT_PRINT "" ; Show minutes in large font | |
3219 WIN_SMALL apnoe_total_divetime_secs_column, apnoe_total_divetime_secs_row ; left position for two sec figures | |
3220 lfsr FSR2,buffer | |
3221 PUTC ':' | |
3222 bsf leftbind | |
3223 movff divesecs,lo | |
3224 output_99x | |
3225 bcf leftbind | |
3226 STRCAT_PRINT "" ; Show seconds in small font | |
0 | 3227 return |
3228 | |
3229 ;============================================================================= | |
3230 ; Writes ostc3 #Serial and Firmware version in splash screen | |
3231 ; | |
3232 global TFT_serial | |
3233 TFT_serial: | |
3234 WIN_TINY .0,.239-.14 | |
3235 STRCPY "OSTC3 #" ; Won't translate that... | |
3236 rcall TFT_cat_serial | |
3237 | |
3238 STRCAT " v" | |
3239 rcall TFT_cat_firmware | |
3240 | |
3241 ifdef __DEBUG | |
3242 movlw color_grey ; Write header in blue when | |
3243 call TFT_set_color ; compiled in DEBUG mode... | |
3244 STRCAT_PRINT "DEBUG" | |
3245 else | |
76 | 3246 WIN_COLOR color_greenish |
3247 STRCAT_PRINT "" | |
0 | 3248 call TFT_standard_color |
76 | 3249 |
0 | 3250 movlw softwareversion_beta ; =1: Beta, =0: Release |
3251 decfsz WREG,F | |
3252 return ; Release version -> Return | |
3253 | |
3254 call TFT_warnings_color | |
3255 WIN_LEFT .160-4*9/2 ; Right pad. | |
3256 STRCPY_TEXT_PRINT tBeta | |
3257 endif | |
76 | 3258 call TFT_standard_color |
0 | 3259 return |
3260 | |
3261 | |
3262 | |
3263 ;============================================================================= | |
3264 ; For the Information menu: append firmware x.yy version. | |
3265 global info_menu_firmware | |
3266 extern tFirmware | |
3267 info_menu_firmware: | |
3268 lfsr FSR1,tFirmware | |
3269 call strcat_text | |
76 | 3270 global TFT_cat_firmware |
0 | 3271 TFT_cat_firmware: |
3272 movlw softwareversion_x | |
3273 movwf lo | |
3274 bsf leftbind | |
3275 output_8 | |
3276 PUTC '.' | |
3277 movlw softwareversion_y | |
3278 movwf lo | |
3279 output_99x | |
3280 bcf leftbind | |
3281 return | |
3282 | |
3283 ;----------------------------------------------------------------------------- | |
3284 ; For the Information menu: append serial number ostc3#42. | |
3285 global info_menu_serial | |
3286 extern tSerial | |
3287 info_menu_serial: | |
3288 lfsr FSR1,tSerial | |
3289 call strcat_text | |
76 | 3290 global TFT_cat_serial |
0 | 3291 TFT_cat_serial: |
3292 clrf EEADRH | |
3293 clrf EEADR ; Get Serial number LOW | |
3294 call read_eeprom ; read byte | |
3295 movff EEDATA,lo | |
3296 incf EEADR,F ; Get Serial number HIGH | |
3297 call read_eeprom ; read byte | |
3298 movff EEDATA,hi | |
3299 | |
3300 bsf leftbind | |
3301 output_16 | |
3302 bcf leftbind | |
3303 return | |
3304 | |
3305 ;----------------------------------------------------------------------------- | |
3306 ; For the Information menu: Append total dives | |
3307 global info_menu_total_dives | |
3308 extern tTotalDives | |
3309 info_menu_total_dives: | |
3310 lfsr FSR1,tTotalDives | |
3311 call strcat_text | |
3312 TFT_cat_total_dives: | |
3313 read_int_eeprom .2 | |
3314 movff EEDATA,lo | |
3315 read_int_eeprom .3 | |
3316 movff EEDATA,hi | |
3317 bsf leftbind | |
3318 output_16 | |
3319 bcf leftbind | |
3320 return | |
3321 | |
62 | 3322 ; For the Information menu: Append battery voltage |
3323 global info_menu_battery_volts | |
3324 extern tBatteryV | |
3325 info_menu_battery_volts: | |
3326 lfsr FSR1,tBatteryV | |
3327 call strcat_text | |
3328 movff batt_voltage+1,hi | |
3329 movff batt_voltage+0,lo | |
3330 bsf leftbind | |
3331 output_16dp .2 ; x.xxx | |
3332 bcf leftbind | |
3333 PUTC "V" | |
3334 return | |
3335 | |
0 | 3336 ;----------------------------------------------------------------------------- |
3337 ; ppO2 menu | |
3338 global divesets_ppo2_max | |
3339 extern tPPO2Max | |
3340 extern tbar | |
3341 divesets_ppo2_max: | |
3342 lfsr FSR1,tPPO2Max | |
3343 call strcat_text | |
3344 movff opt_ppO2_max,lo | |
3345 movlw ppo2_warning_high | |
3346 divesets_ppo2_common: | |
3347 movwf up ; Save default value | |
3348 clrf hi | |
3349 bsf leftbind | |
3350 output_16dp d'3' | |
3351 bcf leftbind | |
3352 lfsr FSR1,tbar | |
3353 call strcat_text | |
3354 | |
3355 movf up,W ; Default value | |
3356 cpfseq lo ; Current value | |
3357 bra divesets_ppo2_common2 ; Not default, add * | |
3358 return ; Default, Done. | |
3359 divesets_ppo2_common2: | |
3360 PUTC "*" | |
3361 return ; Done. | |
3362 | |
3363 global divesets_ppo2_min | |
3364 extern tPPO2Min | |
3365 divesets_ppo2_min: | |
3366 lfsr FSR1,tPPO2Min | |
3367 call strcat_text | |
3368 movff opt_ppO2_min,lo | |
3369 movlw ppo2_warning_low | |
3370 bra divesets_ppo2_common | |
3371 | |
3372 ;============================================================================= | |
3373 | |
3374 global TFT_clear_warning_text | |
3375 TFT_clear_warning_text: | |
3376 btfss divemode ; in divemode? | |
3377 bra TFT_clear_warning_text2 ; No, setup for surface mode | |
3378 WIN_BOX_BLACK warning1_row, divemode_customview_row-3, warning1_column, warning_icon_column-3 ;top, bottom, left, right | |
3379 return | |
3380 TFT_clear_warning_text2: | |
3381 WIN_BOX_BLACK surf_warning1_row, surf_warning2_row+.24, surf_warning1_column, surf_warning1_column+.76 ;top, bottom, left, right | |
3382 return | |
3383 | |
3384 global TFT_clear_warning_text_2nd_row | |
3385 TFT_clear_warning_text_2nd_row: | |
3386 btfss divemode ; in divemode? | |
3387 bra TFT_clear_warning_text_2nd_2 ; No, setup for surface mode | |
3388 WIN_BOX_BLACK warning2_row, divemode_customview_row-3, warning2_column, warning_icon_column-3 ;top, bottom, left, right | |
3389 return | |
3390 TFT_clear_warning_text_2nd_2: | |
3391 WIN_BOX_BLACK surf_warning2_row, surf_warning2_row+.24, surf_warning2_column, surf_warning2_column+.76 ;top, bottom, left, right | |
3392 return | |
3393 | |
3394 global TFT_fillup_with_spaces | |
3395 TFT_fillup_with_spaces: ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3396 movwf lo ; save max. string length into lo | |
3397 movf FSR2L,W ; Get current string length | |
3398 subwf lo,F ; lo-WREG | |
3399 btfsc STATUS,N ; longer then #lo already? | |
3400 return ; Yes, done. | |
3401 tstfsz lo ; Zero? | |
3402 bra TFT_fillup_with_spaces2 ; No. | |
3403 return ; Yes, done. | |
3404 TFT_fillup_with_spaces2: | |
3405 PUTC " " ; Add one space | |
3406 decfsz lo,F ; All done? | |
3407 bra TFT_fillup_with_spaces2 ; No, loop | |
3408 return ; Done. | |
3409 | |
3410 global TFT_desaturation_time | |
3411 TFT_desaturation_time: | |
3412 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3413 tstfsz WREG ; Is there room for the warning? | |
3414 return ; No | |
3415 STRCPY "Desat:" | |
3416 movff desaturation_time+0,lo ; divide by 60... | |
3417 movff desaturation_time+1,hi | |
3418 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
3419 bsf leftbind | |
3420 movf lo,W | |
3421 movff hi,lo | |
3422 movwf hi ; exchange lo and hi... | |
3423 output_8 ; Hours | |
3424 PUTC ':' | |
3425 movff hi,lo ; Minutes | |
3426 output_99x | |
3427 bcf leftbind | |
3428 movlw surf_warning_length ; Only use surface string length | |
3429 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
60 | 3430 movlw .0 |
3431 movff WREG,buffer+11 | |
0 | 3432 STRCAT_PRINT "" |
3433 return | |
3434 | |
3435 global TFT_nofly_time | |
3436 TFT_nofly_time: | |
3437 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3438 tstfsz WREG ; Is there room for the warning? | |
3439 return ; No | |
3440 STRCPY "NoFly:" | |
3441 movff nofly_time+0,lo ; divide by 60... | |
3442 movff nofly_time+1,hi | |
3443 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
3444 bsf leftbind | |
3445 movf lo,W | |
3446 movff hi,lo | |
3447 movwf hi ; exchange lo and hi... | |
3448 output_8 ; Hours | |
3449 PUTC ':' | |
3450 movff hi,lo ; Minutes | |
3451 output_99x | |
3452 bcf leftbind | |
3453 movlw surf_warning_length ; Only use surface string length | |
3454 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
60 | 3455 movlw .0 |
3456 movff WREG,buffer+11 | |
0 | 3457 STRCAT_PRINT "" |
3458 return | |
3459 | |
3460 global TFT_warning_agf | |
3461 TFT_warning_agf: | |
3462 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3463 tstfsz WREG ; Is there room for the warning? | |
3464 return ; No | |
3465 call TFT_warnings_color | |
3466 STRCPY_TEXT tDiveaGF_active ; "aGF!" | |
3467 movlw warning_length ; Divemode string length | |
3468 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3469 STRCAT_PRINT "" | |
3470 call TFT_standard_color | |
3471 return | |
3472 | |
3473 global TFT_warning_gf | |
3474 TFT_warning_gf: ;GF | |
3475 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3476 tstfsz WREG ; Is there room for the warning? | |
3477 return ; No | |
3478 TFT_color_code warn_gf ; Color-code Output | |
3479 STRCPY "GF:" | |
3480 movff char_O_gradient_factor,lo ; gradient factor | |
3481 bsf leftbind | |
3482 output_8 | |
3483 PUTC "%" | |
3484 movlw warning_length ; Divemode string length | |
3485 btfss divemode ; In Divemode? | |
3486 movlw surf_warning_length ; No, use surface string length | |
3487 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3488 STRCAT_PRINT "" | |
3489 bcf leftbind | |
3490 call TFT_standard_color | |
3491 return | |
3492 | |
3493 TFT_warning_set_window: ; Sets the row and column for the current warning | |
3494 ; ignore warning (now)? | |
3495 decf warning_counter,W ; -1 | |
3496 bcf STATUS,C | |
3497 rrcf WREG,W ; (warning_counter-1)/2 | |
3498 cpfseq warning_page | |
3499 retlw .255 ; WREG <> 0 -> Warning window not defined | |
3500 | |
3501 call TFT_standard_color | |
3502 | |
3503 btfss divemode ; in divemode? | |
3504 bra TFT_warning_set_window3 ; No, setup for surface mode | |
3505 | |
3506 btfss warning_counter,0 ; Toggle with each warning | |
3507 bra TFT_warning_set_window2 | |
3508 WIN_SMALL warning1_column,warning1_row | |
3509 bcf second_row_warning ; =1: The second row contains a warning | |
3510 retlw .0 ; WREG=0 -> Warning window defined | |
3511 TFT_warning_set_window2: | |
3512 WIN_SMALL warning2_column,warning2_row | |
3513 bsf second_row_warning ; =1: The second row contains a warning | |
3514 retlw .0 ; WREG=0 -> Warning window defined | |
3515 | |
3516 TFT_warning_set_window3: | |
3517 btfss warning_counter,0 ; Toggle with each warning | |
3518 bra TFT_warning_set_window4 | |
3519 WIN_SMALL surf_warning1_column,surf_warning1_row | |
3520 bcf second_row_warning ; =1: The second row contains a warning | |
3521 retlw .0 ; WREG=0 -> Warning window defined | |
3522 TFT_warning_set_window4: | |
3523 WIN_SMALL surf_warning2_column,surf_warning2_row | |
3524 bsf second_row_warning ; =1: The second row contains a warning | |
3525 retlw .0 ; WREG=0 -> Warning window defined | |
3526 | |
3527 | |
3528 global TFT_update_batt_percent_divemode | |
3529 TFT_update_batt_percent_divemode: | |
3530 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3531 tstfsz WREG ; Is there room for the warning? | |
3532 return ; No | |
3533 movff batt_percent,lo ; Get battery percent | |
3534 TFT_color_code warn_battery; Color-code battery percent | |
3535 STRCPY "Batt:" | |
3536 bsf leftbind | |
3537 output_8 | |
3538 bcf leftbind | |
3539 PUTC "%" | |
3540 movlw warning_length ; Divemode string length | |
3541 btfss divemode ; In Divemode? | |
3542 movlw surf_warning_length ; No, use surface string length | |
3543 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3544 STRCAT_PRINT "" | |
3545 call TFT_standard_color | |
3546 return | |
3547 | |
3548 | |
3549 global TFT_gf_mask ; Setup Mask | |
3550 TFT_gf_mask: | |
3551 ; The mask | |
3552 call TFT_divemask_color | |
3553 WIN_TINY dive_gf_column1,dive_gf_text_row | |
3554 STRCPY_TEXT_PRINT tGFactors | |
3555 WIN_TINY dive_gf_column2,dive_gf_text_row | |
3556 STRCPY_TEXT_PRINT taGFactors | |
3557 WIN_TINY dive_gf_column3,dive_gf_text_row | |
3558 STRCPY_TEXT_PRINT tGFInfo | |
3559 | |
3560 ; Show GF (Static) | |
3561 call TFT_disabled_color | |
3562 btfss use_agf | |
3563 call TFT_standard_color | |
3564 | |
3565 WIN_STD dive_gf_column,dive_gf_row | |
3566 lfsr FSR2,buffer | |
3567 bsf leftbind | |
3568 movff opt_GF_low,lo | |
3569 output_8 | |
3570 PUTC "/" | |
3571 movff opt_GF_high,lo | |
3572 output_8 | |
3573 STRCAT_PRINT "" | |
3574 ; Show aGF (Static) | |
3575 call TFT_standard_color | |
3576 TSTOSS opt_enable_aGF ; =1: aGF can be selected underwater | |
3577 bra TFT_gf_mask2 ; Show "---" instead | |
3578 | |
3579 btfss use_agf | |
3580 call TFT_disabled_color | |
3581 | |
3582 WIN_STD dive_agf_column,dive_agf_row | |
3583 lfsr FSR2,buffer | |
3584 movff opt_aGF_low,lo | |
3585 output_8 | |
3586 PUTC "/" | |
3587 movff opt_aGF_high,lo | |
3588 output_8 | |
3589 STRCAT_PRINT "" | |
3590 bcf leftbind | |
3591 call TFT_standard_color | |
3592 return | |
3593 | |
3594 TFT_gf_mask2: | |
3595 WIN_STD dive_agf_column+.10,dive_agf_row | |
3596 STRCPY_PRINT "---" | |
3597 bcf leftbind | |
3598 return | |
3599 | |
3600 global TFT_gf_info ; Show GF informations | |
3601 TFT_gf_info: | |
3602 ; Show current GF | |
3603 movff char_O_gradient_factor,lo ; gradient factor absolute (Non-GF model) | |
3604 movff char_I_deco_model,hi | |
3605 decfsz hi,F ; jump over next line if char_I_deco_model == 1 | |
3606 movff char_O_relative_gradient_GF,lo ; gradient factor relative (GF model) | |
3607 WIN_STD dive_currentgf_column,dive_currentgf_row | |
3608 lfsr FSR2,buffer | |
3609 output_8 | |
3610 STRCAT_PRINT "%" | |
3611 return | |
3612 | |
3613 global TFT_ead_end_tissues_clock_mask ; Setup Mask | |
3614 TFT_ead_end_tissues_clock_mask: | |
3615 ; The mask | |
3616 call TFT_divemask_color | |
3617 ; Put three columns at HUD positions | |
3618 WIN_TINY dive_custom_hud_column1,dive_custom_hud_row | |
3619 STRCPY_TEXT_PRINT tDiveClock | |
3620 WIN_TINY dive_custom_hud_column2,dive_custom_hud_row | |
3621 STRCPY_TEXT_PRINT tDiveEAD_END | |
3622 WIN_TINY dive_custom_hud_column3,dive_custom_hud_row | |
3623 STRCPY_TEXT_PRINT tDiveTissues | |
3624 call TFT_standard_color | |
3625 return | |
3626 | |
3627 global TFT_ead_end_tissues_clock ; Show EAD/END, Tissues and clock | |
3628 TFT_ead_end_tissues_clock: | |
3629 ; Update clock and date | |
3630 WIN_SMALL dive_clock_column,dive_clock_row | |
3631 call TFT_clock2 ; print clock | |
105 | 3632 ; WIN_SMALL dive_endtime_column,dive_endtime_row |
3633 ; lfsr FSR2,buffer | |
3634 ; | |
3635 ; btfss decostop_active ; Already in nodeco mode ? | |
3636 ; bra TFT_ead_end_tissues_clock2 ; No, overwrite with some spaces | |
3637 ; | |
3638 ; STRCPY 0x94 ; "End of dive" icon | |
3639 ; movff hours,WREG | |
3640 ; mullw .60 | |
3641 ; movf mins,W | |
3642 ; addwf PRODL | |
3643 ; movlw .0 | |
3644 ; addwfc PRODH | |
3645 ; movff PRODL, lo | |
3646 ; movff PRODH, hi | |
3647 ; | |
3648 ; ; Add TTS | |
3649 ; movff int_O_ascenttime+0,WREG ; TTS | |
3650 ; addwf lo,F | |
3651 ; movff int_O_ascenttime+1,WREG ; TTS is 16bits | |
3652 ; addwfc hi,F | |
3653 ; | |
3654 ; call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
3655 ; movf hi,W | |
3656 ; movff lo,hi | |
3657 ; movwf lo ; exchange lo and hi | |
3658 ; output_99x | |
3659 ; PUTC ':' | |
3660 ; movff hi,lo | |
3661 ; output_99x | |
3662 ; STRCAT_PRINT "" | |
3663 ; bra TFT_ead_end_tissues_clock3 | |
3664 ; | |
3665 ;TFT_ead_end_tissues_clock2: | |
3666 ; STRCPY_PRINT " " | |
3667 ;TFT_ead_end_tissues_clock3: | |
0 | 3668 |
3669 ; Show END/EAD | |
3670 WIN_SMALL dive_ead_column,dive_ead_row | |
3671 STRCPY_TEXT tEAD ; EAD: | |
3672 movff char_O_EAD,lo | |
3673 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars | |
3674 WIN_SMALL dive_end_column,dive_end_row | |
3675 STRCPY_TEXT tEND ; END: | |
3676 movff char_O_END,lo | |
3677 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars | |
3678 | |
3679 ; Show tissue diagram | |
3680 call TFT_divemask_color | |
3681 WIN_TINY dive_tissue_N2_column,dive_tissue_N2_row | |
3682 STRCPY_TEXT_PRINT tN2 | |
3683 WIN_TINY dive_tissue_He_column,dive_tissue_He_row | |
3684 STRCPY_TEXT_PRINT tHe | |
3685 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation) | |
3686 movlb b'00000001' ; select ram bank 1 | |
3687 rcall DISP_tissue_saturation_graph ; Show char_O_tissue_N2_saturation and char_O_tissue_He_saturation | |
3688 return | |
3689 | |
3690 TFT_end_ead_common: ; print "lo m" (or ft) and limit to 8 chars | |
3691 bsf leftbind | |
3692 TSTOSS opt_units ; 0=Meters, 1=Feets | |
3693 bra TFT_end_ead_common_metric | |
3694 ;TFT_end_ead_common_imperial: | |
3695 ; With lo in m | |
3696 movf lo,W | |
3697 mullw .100 ; PRODL:PRODH = mbar/min | |
3698 movff PRODL,lo | |
3699 movff PRODH,hi | |
3700 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
3701 output_16_3 | |
3702 STRCAT_TEXT tFeets | |
3703 clrf WREG | |
3704 movff WREG,buffer+.8 ; limit string length to 8 | |
3705 bra TFT_end_ead_common_exit | |
3706 TFT_end_ead_common_metric: | |
3707 output_8 | |
3708 STRCAT_TEXT tMeters | |
3709 TFT_end_ead_common_exit: | |
3710 bcf leftbind | |
3711 movlw .8 | |
3712 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3713 STRCAT_PRINT "" | |
3714 return | |
3715 | |
3716 global TFT_surface_tissues | |
3717 TFT_surface_tissues: ; Show Tissue diagram in surface mode | |
3718 WIN_SMALL surf_tissue_N2_column,surf_tissue_N2_row | |
3719 STRCPY_TEXT_PRINT tN2 | |
3720 WIN_SMALL surf_tissue_He_column,surf_tissue_He_row | |
3721 STRCPY_TEXT_PRINT tHe | |
3722 | |
3723 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation) | |
3724 movlb b'00000001' ; select ram bank 1 | |
3725 | |
3726 movlw color_deepblue | |
3727 call TFT_set_color ; Make this configurable? | |
3728 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.29,.29 | |
3729 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.37,.37 | |
3730 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.45,.45 | |
3731 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.53,.53 | |
3732 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.61,.61 | |
3733 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.69,.69 | |
3734 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.77,.77 | |
3735 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.85,.85 | |
3736 WIN_FRAME_STD surf_tissue_diagram_top, surf_tissue_diagram_bottom, surf_tissue_diagram_left, surf_tissue_diagram_right ; outer frame | |
3737 | |
3738 movlw .1 | |
3739 movff WREG,win_height ; row bottom (0-239) | |
3740 movlw surf_tissue_diagram_left+.4 ; Surface mode | |
3741 movff WREG,win_leftx2 ; column left (0-159) | |
3742 movlw surf_tissue_diagram_right-surf_tissue_diagram_left-4 ; Width | |
3743 movff WREG,win_width | |
3744 | |
3745 ;---- Draw N2 Tissues | |
3746 lfsr FSR2, char_O_tissue_N2_saturation | |
3747 movlw d'16' | |
3748 movwf wait_temp ; 16 tissues | |
3749 clrf waitms_temp ; Row offset | |
3750 surf_tissue_saturation_graph_N2: | |
3751 movlw surf_tissue_diagram_top+.23 ; surface mode | |
3752 addwf waitms_temp,W | |
3753 movff WREG,win_top ; row top (0-239) | |
3754 rcall surf_tissue_saturation_loop ; Show one tissue | |
3755 decfsz wait_temp,F | |
3756 bra surf_tissue_saturation_graph_N2 | |
3757 | |
3758 ;---- Draw He Tissues ---------------------------------------------------- | |
3759 lfsr FSR2, char_O_tissue_He_saturation | |
3760 movlw d'16' | |
3761 movwf wait_temp ; 16 tissues | |
3762 clrf waitms_temp ; Row offset | |
3763 surf_tissue_saturation_graph_He: | |
3764 movlw surf_tissue_diagram_top+.23+.56 ; surface mode | |
3765 addwf waitms_temp,W | |
3766 movff WREG,win_top ; row top (0-239) | |
3767 rcall surf_tissue_saturation_loop ; Show one tissue | |
3768 decfsz wait_temp,F | |
3769 bra surf_tissue_saturation_graph_He | |
3770 return | |
3771 | |
3772 surf_tissue_saturation_loop: | |
3773 call TFT_standard_color | |
3774 movlw .2 ; row spacing | |
3775 addwf waitms_temp,F | |
3776 movf POSTINC2,W ; Get tissue load | |
3777 bcf STATUS,C | |
3778 rrcf WREG ; And divide by 2 | |
3779 movwf temp1 | |
3780 movlw .20 | |
3781 subwf temp1,F ; Subtract some offset | |
3782 movff win_width,WREG ; Max width. | |
3783 cpfslt temp1 ; skip if WREG < win_width | |
3784 movwf temp1 | |
3785 movff temp1,win_bargraph | |
3786 call TFT_box | |
3787 return | |
3788 | |
3789 ;============================================================================= | |
3790 ; Draw saturation graph, is surface mode or in dive mode. | |
3791 DISP_tissue_saturation_graph: | |
3792 ;---- Draw Frame | |
50 | 3793 call TFT_standard_color |
3794 WIN_FRAME_COLOR16 tissue_diagram_top, tissue_diagram_bottom, tissue_diagram_left, .159 ; outer frame | |
0 | 3795 |
3796 movlw .1 | |
3797 movff WREG,win_height ; row bottom (0-239) | |
3798 movlw tissue_diagram_left+.3 ; divemode | |
3799 movff WREG,win_leftx2 ; column left (0-159) | |
3800 movlw .159-tissue_diagram_left-4 ; Width | |
3801 movff WREG,win_width | |
3802 | |
3803 ;---- Draw N2 Tissues | |
3804 lfsr FSR2, char_O_tissue_N2_saturation | |
3805 movlw d'16' | |
3806 movwf wait_temp ; 16 tissues | |
3807 clrf waitms_temp ; Row offset | |
3808 tissue_saturation_graph_N2: | |
3809 movlw tissue_diagram_top+3 ; divemode | |
3810 addwf waitms_temp,W | |
3811 movff WREG,win_top ; row top (0-239) | |
3812 rcall tissue_saturation_graph_loop ; Show one tissue | |
3813 decfsz wait_temp,F | |
3814 bra tissue_saturation_graph_N2 | |
3815 | |
3816 ;---- Draw He Tissues ---------------------------------------------------- | |
3817 lfsr FSR2, char_O_tissue_He_saturation | |
3818 movlw d'16' | |
3819 movwf wait_temp ; 16 tissues | |
3820 clrf waitms_temp ; Row offset | |
3821 tissue_saturation_graph_He: | |
3822 movlw tissue_diagram_top+3+.22 ; divemode | |
3823 addwf waitms_temp,W | |
3824 movff WREG,win_top ; row top (0-239) | |
3825 | |
3826 rcall tissue_saturation_graph_loop ; Show one tissue | |
3827 | |
3828 decfsz wait_temp,F | |
3829 bra tissue_saturation_graph_He | |
3830 return | |
3831 | |
3832 tissue_saturation_graph_loop: | |
3833 call TFT_standard_color | |
3834 incf waitms_temp,F | |
3835 movf POSTINC2,W | |
3836 bcf STATUS,C | |
3837 rrcf WREG | |
3838 bcf STATUS,C | |
3839 rrcf WREG ; And divide by 4 | |
3840 movwf temp1 | |
3841 movlw .12 | |
3842 subwf temp1,F ; Subtract some offset | |
3843 movff win_width,WREG ; Max width. | |
3844 cpfslt temp1 ; skip if WREG < win_width | |
3845 movwf temp1 | |
3846 movff temp1,win_bargraph | |
3847 call TFT_box | |
3848 return | |
3849 | |
55 | 3850 |
0 | 3851 global TFT_display_cns |
3852 TFT_display_cns: | |
3853 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3854 tstfsz WREG ; Is there room for the warning? | |
3855 return ; No | |
3856 TFT_color_code warn_cns ; Color-code CNS output | |
3857 STRCPY_TEXT tCNS2 ; CNS: | |
3858 movff int_O_CNS_fraction+0,lo | |
3859 movff int_O_CNS_fraction+1,hi | |
3860 bsf leftbind | |
3861 output_16_3 ;Displays only 0...999 | |
3862 bcf leftbind | |
3863 PUTC "%" | |
3864 movlw warning_length ; Divemode string length | |
3865 btfss divemode ; In Divemode? | |
3866 movlw surf_warning_length ; No, use surface string length | |
3867 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3868 STRCAT_PRINT "" | |
3869 call TFT_standard_color | |
3870 return | |
3871 | |
3872 global TFT_display_ppo2 | |
3873 TFT_display_ppo2: ; Show ppO2 (ppO2 stored in xC, in mbar!) | |
3874 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3875 tstfsz WREG ; Is there room for the warning? | |
3876 return ; No | |
3877 TFT_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) | |
55 | 3878 STRCPY "ppO2:" |
0 | 3879 ; Check very high ppO2 manually |
3880 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? | |
3881 bra TFT_show_ppO2_3 ; Yes, display fixed Value! | |
3882 movff xC+0,lo | |
3883 movff xC+1,hi | |
3884 bsf ignore_digit4 | |
3885 output_16dp d'1' | |
3886 TFT_show_ppO2_2: | |
3887 movlw warning_length ; Divemode string length | |
3888 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3889 STRCAT_PRINT "" | |
3890 call TFT_standard_color | |
3891 return | |
3892 | |
3893 TFT_show_ppO2_3: | |
3894 STRCAT ">6.6" | |
3895 bra TFT_show_ppO2_2 | |
3896 | |
3897 | |
3898 global TFT_LogOffset_Logtitle | |
3899 TFT_LogOffset_Logtitle: | |
3900 STRCPY_TEXT tLogOffset | |
3901 PUTC ":" | |
3902 call do_logoffset_common_read ; Offset into lo:hi | |
3903 bsf leftbind | |
3904 output_16 | |
3905 bcf leftbind | |
3906 PUTC " " | |
3907 return ; No "_PRINT" here... | |
3908 | |
3909 | |
3910 global adjust_depth_with_salinity | |
3911 adjust_depth_with_salinity: ; computes salinity setting into lo:hi [mbar] | |
3912 btfsc simulatormode_active ; Do apply salinity in Simulatormode | |
3913 return | |
3914 | |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
3915 global adjust_depth_with_salinity_log |
0 | 3916 movff opt_salinity,WREG ; 0-5% |
99
87cc1adfe4da
show event "bailout" in the internal logbook
heinrichsweikamp
parents:
98
diff
changeset
|
3917 adjust_depth_with_salinity_log: ; computes salinity setting (FROM WREG!) into lo:hi [mbar] |
0 | 3918 addlw d'100' ; 1.00kg/l |
3919 movwf wait_temp | |
3920 | |
3921 movlw d'105' ; 105% ? | |
3922 cpfslt wait_temp ; Salinity higher limit | |
3923 return ; Out of limit, do not adjust lo:hi | |
3924 movlw d'99' ; 99% ? | |
3925 cpfsgt wait_temp ; Salinity lower limit | |
3926 return ; Out of limit, do not adjust lo:hi | |
3927 | |
3928 movff lo,xA+0 | |
3929 movff hi,xA+1 | |
3930 | |
3931 movlw d'102' ; 0,98bar/10m | |
3932 movwf xB+0 | |
3933 clrf xB+1 | |
3934 call mult16x16 ;xA*xB=xC (lo:hi * 100) | |
3935 movff wait_temp,xB+0 ; Salinity | |
3936 clrf xB+1 | |
3937 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3938 movff xC+0,lo | |
3939 movff xC+1,hi ; restore lo and hi with updated value | |
3940 return | |
3941 | |
3942 global convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
3943 convert_mbar_to_feet: ; convert value in lo:hi from mbar to feet | |
3944 movff lo,xA+0 | |
3945 movff hi,xA+1 | |
3946 | |
3947 movlw LOW d'328' ; 328feet/100m | |
3948 movwf xB+0 | |
3949 movlw HIGH d'328' | |
3950 movwf xB+1 | |
3951 | |
3952 call mult16x16 ; xA*xB=xC (lo:hi * 328) | |
3953 | |
3954 movlw d'50' ; round up | |
3955 addwf xC+0,F | |
3956 movlw 0 | |
3957 addwfc xC+1,F | |
3958 addwfc xC+2,F | |
3959 addwfc xC+3,F | |
3960 | |
3961 movlw LOW .10000 | |
3962 movwf xB+0 | |
3963 movlw HIGH .10000 | |
3964 movwf xB+1 | |
3965 | |
3966 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3967 | |
3968 movff xC+0,lo | |
3969 movff xC+1,hi ; restore lo and hi with updated value | |
3970 return | |
3971 | |
3972 global convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit | |
3973 convert_celsius_to_fahrenheit: ; convert value in lo:hi from celsius to fahrenheit | |
3974 ; Does it work with signed temperature? mH | |
3975 movff lo,xA+0 | |
3976 movff hi,xA+1 | |
3977 | |
3978 movlw d'18' ; 1C = 1.8F | |
3979 movwf xB+0 | |
3980 clrf xB+1 | |
3981 | |
3982 call mult16x16 ;xA*xB=xC (lo:hi * 18) | |
3983 | |
3984 movlw d'10' | |
3985 movwf xB+0 | |
3986 clrf xB+1 | |
3987 | |
3988 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3989 | |
3990 movlw LOW d'320' ; 0C = 32F | |
3991 addwf xC+0,F | |
3992 movlw HIGH d'320' | |
3993 addwfc xC+1,F | |
3994 | |
3995 movff xC+0,lo | |
3996 movff xC+1,hi ; restore lo and hi with updated value | |
3997 return | |
3998 | |
3999 END |