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