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