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