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