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