Mercurial > public > hwos_code
annotate src/tft_outputs.asm @ 87:82750b8dfcee
CHANGE: Color schemes improved
author | heinrichsweikamp |
---|---|
date | Wed, 02 Apr 2014 10:25:24 +0200 |
parents | 45a420beb534 |
children | 2a992aba61ef |
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 | |
2612 STRCAT_PRINT "%" | |
2613 call TFT_standard_color | |
2614 WIN_TINY batt_voltage_column,batt_voltage_row | |
2615 lfsr FSR2,buffer | |
2616 movff batt_voltage+0,lo | |
2617 movff batt_voltage+1,hi | |
2618 bsf leftbind | |
2619 output_16dp .2 | |
2620 bcf leftbind | |
2621 PUTC 'V' | |
2622 movff buffer+5,buffer+3 | |
2623 movlw 0x00 | |
2624 movff WREG,buffer+4 ; Only "x.yV" | |
24 | 2625 STRCAT_PRINT "" |
0 | 2626 return |
2627 | |
2628 ;update_battery_debug: | |
2629 ; call TFT_standard_color | |
2630 ; WIN_TINY .70,.0 | |
2631 ; lfsr FSR2,buffer | |
2632 ; movff battery_gauge+5,xC+3 | |
2633 ; movff battery_gauge+4,xC+2 | |
2634 ; movff battery_gauge+3,xC+1 | |
2635 ; movff battery_gauge+2,xC+0 | |
2636 ; ; battery_gauge:6 is nAs | |
2637 ; ; devide through 65536 | |
2638 ; ; devide through 152 | |
2639 ; ; Result is 0.01Ah in xC+1:xC+0 | |
2640 ; movlw LOW .152 | |
2641 ; movwf xB+0 | |
2642 ; movlw HIGH .152 | |
2643 ; movwf xB+1 | |
2644 ; call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
2645 ; bsf leftbind | |
2646 ; movff xC+0,lo | |
2647 ; movff xC+1,hi | |
2648 ; output_16 | |
2649 ; STRCAT_PRINT "x.01Ah" | |
2650 ; WIN_FONT FT_SMALL | |
2651 ; bcf leftbind | |
2652 ; return | |
2653 | |
2654 ;============================================================================= | |
2655 | |
2656 global TFT_convert_signed_16bit | |
2657 TFT_convert_signed_16bit: | |
2658 bcf neg_flag ; Positive temperature | |
2659 btfss hi,7 ; Negative temperature ? | |
2660 return ; No, return | |
2661 ; Yes, negative temperature! | |
2662 bsf neg_flag ; Negative temperature | |
2663 PUTC '-' ; Display "-" | |
2664 comf hi ; Then, 16bit sign changes. | |
2665 negf lo | |
2666 btfsc STATUS,C | |
2667 incf hi | |
2668 return ; and return | |
2669 | |
2670 ;============================================================================= | |
2671 | |
2672 global TFT_convert_date | |
2673 TFT_convert_date: ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | |
2674 movff opt_dateformat,WREG ; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD | |
2675 movwf EEDATA ; used as temp here | |
2676 tstfsz EEDATA | |
2677 bra TFT_convert_date1 | |
2678 ; EEDATA was 0 | |
2679 ; Use MMDDYY | |
2680 movff convert_value_temp+0,lo ;month | |
2681 bsf leftbind | |
2682 output_99x | |
2683 PUTC '.' | |
2684 movff convert_value_temp+1,lo ;day | |
2685 bra TFT_convert_date1_common ;year | |
2686 | |
2687 TFT_convert_date1: ; Read date format (0=MMDDYY, 1=DDMMYY, 2=YYMMDD) | |
2688 decfsz EEDATA,F | |
2689 bra TFT_convert_date2 ; EEDATA was 2 | |
2690 ; EEDATA was 1 | |
2691 ; Use DDMMYY | |
2692 movff convert_value_temp+1,lo ;day | |
2693 bsf leftbind | |
2694 output_99x | |
2695 PUTC '.' | |
2696 movff convert_value_temp+0,lo ;month | |
2697 | |
2698 TFT_convert_date1_common: | |
2699 bsf leftbind | |
2700 output_99x | |
2701 PUTC '.' | |
2702 movff convert_value_temp+2,lo ;year | |
2703 output_99x | |
2704 bcf leftbind | |
2705 return | |
2706 | |
2707 TFT_convert_date2: | |
2708 ; Use YYMMDD | |
2709 movff convert_value_temp+2,lo ;year | |
2710 bsf leftbind | |
2711 output_99x | |
2712 PUTC '.' | |
2713 movff convert_value_temp+0,lo ;month | |
2714 output_99x | |
2715 PUTC '.' | |
2716 movff convert_value_temp+1,lo ;day | |
2717 output_99x | |
2718 bcf leftbind | |
2719 return | |
2720 | |
2721 ;============================================================================= | |
2722 | |
2723 global TFT_convert_date_short | |
2724 TFT_convert_date_short: ; converts into "DD/MM" or "MM/DD" or "MM/DD" in postinc2 | |
2725 movff opt_dateformat,WREG ; =0:MMDDYY, =1:DDMMYY, =2:YYMMDD | |
2726 movwf EEDATA ; used as temp here | |
2727 tstfsz EEDATA | |
2728 bra TFT_convert_date_short1 | |
2729 ; EEDATA was 0 | |
2730 ; Use MMDDYY | |
2731 TFT_convert_date_short_common: | |
2732 movff convert_value_temp+0,lo ;month | |
2733 bsf leftbind | |
2734 output_99x | |
2735 PUTC '.' | |
2736 movff convert_value_temp+1,lo ;day | |
2737 output_99x | |
2738 bcf leftbind | |
2739 return | |
2740 | |
2741 TFT_convert_date_short1: | |
2742 decfsz EEDATA,F | |
2743 bra TFT_convert_date_short_common ; EEDATA was 2 -> Use YYMMDD | |
2744 ; EEDATA was 1 | |
2745 ; Use DDMMYY | |
2746 movff convert_value_temp+1,lo ;day | |
2747 bsf leftbind | |
2748 output_99x | |
2749 PUTC '.' | |
2750 movff convert_value_temp+0,lo ;month | |
2751 output_99x | |
2752 bcf leftbind | |
2753 return | |
2754 | |
2755 ;============================================================================= | |
2756 | |
2757 global TFT_date | |
2758 TFT_date: | |
48 | 2759 WIN_SMALL surf_date_column,surf_date_row ; Init new Wordprocessor |
0 | 2760 call TFT_standard_color |
2761 lfsr FSR2,buffer | |
2762 movff month,convert_value_temp+0 | |
2763 movff day,convert_value_temp+1 | |
2764 movff year,convert_value_temp+2 | |
2765 call TFT_convert_date ; converts into "DD/MM/YY" or "MM/DD/YY" or "YY/MM/DD" in postinc2 | |
2766 STRCAT_PRINT "" | |
2767 return | |
2768 | |
2769 ;============================================================================= | |
2770 | |
2771 global TFT_max_pressure | |
2772 TFT_max_pressure: | |
2773 btfsc FLAG_apnoe_mode ; different display in apnoe mode | |
2774 bra TFT_max_pressure_apnoe | |
2775 TFT_max_pressure2: | |
2776 SAFE_2BYTE_COPY max_pressure, lo | |
2777 TFT_max_pressure3: | |
2778 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
2779 TSTOSS opt_units ; 0=m, 1=ft | |
2780 bra TFT_max_pressure2_metric | |
2781 ;TFT_max_pressure2_imperial | |
2782 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
2783 WIN_MEDIUM max_depth_feet_column,max_depth_feet_row | |
2784 lfsr FSR2,buffer | |
2785 call TFT_standard_color | |
2786 output_16_3 | |
2787 STRCAT_PRINT "" | |
2788 return | |
2789 | |
2790 TFT_max_pressure2_metric: | |
11 | 2791 WIN_MEDIUM max_depth_column,max_depth_row |
2792 | |
2793 movlw .039 | |
2794 cpfslt hi | |
2795 bra max_depth_greater_99_84mtr | |
2796 | |
2797 btfsc max_depth_greater_100m ; Was depth>100m during last call | |
2798 rcall TFT_clear_max_depth ; Yes, clear depth area | |
2799 bcf max_depth_greater_100m ; Do this once only... | |
2800 | |
2801 movlw .039 | |
2802 cpfslt hi | |
2803 bra max_depth_greater_99_84mtr | |
2804 | |
2805 lfsr FSR2,buffer | |
2806 movlw HIGH d'1000' | |
2807 movwf sub_a+1 | |
2808 movlw LOW d'1000' | |
2809 movwf sub_a+0 | |
2810 movff hi,sub_b+1 | |
2811 movff lo,sub_b+0 | |
2812 incf sub_b+0,F | |
2813 movlw d'0' | |
2814 addwfc sub_b+1,F ; Add 1mbar offset | |
2815 call sub16 ; sub_c = sub_a - sub_b | |
2816 movlw ' ' | |
2817 btfss neg_flag ; Depth lower then 10m? | |
2818 movwf POSTINC2 ; Yes, add extra space | |
2819 | |
2820 clrf sub_a+1 | |
2821 movlw d'99' | |
2822 movwf sub_a+0 | |
2823 movff hi,sub_b+1 | |
2824 movff lo,sub_b+0 | |
2825 call subU16 ; sub_c = sub_a - sub_b | |
2826 btfss neg_flag ; Depth lower then 1m? | |
2827 bra tft_max_depth2 ; Yes, display manual Zero | |
2828 | |
2829 bsf ignore_digit4 ; no 0.1m | |
2830 bsf leftbind | |
2831 output_16 | |
2832 bra tft_max_depth3 | |
2833 | |
2834 tft_max_depth2: | |
0 | 2835 WIN_MEDIUM max_depth_column,max_depth_row |
11 | 2836 STRCAT "0" |
2837 | |
2838 tft_max_depth3: | |
0 | 2839 call TFT_standard_color |
11 | 2840 STRCAT_PRINT "" ; Display full meters |
2841 bcf leftbind | |
2842 | |
2843 ; .1m in SMALL font | |
2844 WIN_SMALL max_depth_dm_column,max_depth_dm_row | |
2845 | |
2846 SAFE_2BYTE_COPY max_pressure, lo | |
2847 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
2848 | |
2849 lfsr FSR2,buffer | |
2850 PUTC "." | |
2851 | |
2852 movlw d'4' | |
2853 movwf ignore_digits | |
2854 bsf ignore_digit5 | |
2855 bsf leftbind | |
2856 output_16dp d'0' | |
2857 STRCAT_PRINT "" ; Display decimeters | |
2858 bcf leftbind | |
2859 return | |
2860 | |
2861 max_depth_greater_99_84mtr: ; Display only in full meters | |
2862 btfss max_depth_greater_100m ; Is max depth>100m already? | |
2863 rcall TFT_clear_max_depth ; No, clear max depth area and set flag | |
2864 ; Max. Depth is already in hi:lo | |
2865 ; Show max. depth in Full meters | |
2866 ; That means ignore figure 4 and 5 | |
2867 lfsr FSR2,buffer | |
2868 bsf ignore_digit4 | |
2869 bsf leftbind | |
0 | 2870 output_16 |
11 | 2871 bcf leftbind |
2872 STRCAT_PRINT "" ; Display full meters only | |
2873 WIN_FONT FT_SMALL | |
0 | 2874 return |
2875 | |
11 | 2876 TFT_clear_max_depth: ; No, clear max. depth area and set flag |
2877 WIN_BOX_BLACK max_depth_row,.49,max_depth_column, max_depth_dm_column+.13 ;top, bottom, left, right | |
2878 bsf max_depth_greater_100m ; Set Flag | |
2879 return | |
2880 | |
2881 | |
0 | 2882 TFT_max_pressure_apnoe: |
2883 btfss FLAG_active_descent ; Are we descending? | |
2884 bra TFT_max_pressure2 ; Yes, show normal max. | |
2885 SAFE_2BYTE_COPY apnoe_max_pressure, lo | |
2886 bra TFT_max_pressure3 ; Show apnoe_max_pressure as max. depth | |
2887 | |
2888 global TFT_display_apnoe_last_max | |
2889 TFT_display_apnoe_last_max: | |
2890 call TFT_divemask_color | |
2891 WIN_TINY last_max_apnoe_text_column,last_max_apnoe_text_row | |
2892 STRCPY_TEXT_PRINT tApnoeMax | |
2893 | |
2894 call TFT_standard_color | |
2895 SAFE_2BYTE_COPY max_pressure, lo | |
2896 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
2897 TSTOSS opt_units ; 0=m, 1=ft | |
2898 bra TFT_display_apnoe_last_m_metric | |
2899 ;TFT_display_apnoe_last_max_imperial | |
2900 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
2901 WIN_MEDIUM apnoe_last_max_depth_column,apnoe_last_max_depth_row | |
2902 lfsr FSR2,buffer | |
2903 output_16 | |
2904 STRCAT_PRINT "" | |
2905 return | |
2906 | |
2907 TFT_display_apnoe_last_m_metric: | |
2908 WIN_MEDIUM apnoe_last_max_depth_column,apnoe_last_max_depth_row | |
2909 lfsr FSR2,buffer | |
2910 bsf ignore_digit5 ; do not display 1cm depth | |
2911 output_16dp d'3' | |
2912 STRCAT_PRINT "" | |
2913 return | |
2914 | |
2915 ;============================================================================= | |
2916 global TFT_divemins | |
2917 TFT_divemins: | |
2918 movff divemins+0,lo | |
2919 movff divemins+1,hi | |
2920 | |
2921 btfsc no_more_divesecs ; Ignore seconds? | |
2922 bra TFT_divemins2 ; Show minutes only | |
2923 | |
2924 movlw .99 | |
2925 cpfsgt lo ; bigger then 99? | |
2926 bra TFT_divemins1 ; No show mins:secs | |
2927 ; Yes, remove second display for the rest of the dive and clear seconds | |
2928 bsf no_more_divesecs ; Set flag | |
2929 ; Clear rest of seconds | |
2930 WIN_BOX_BLACK divetime_row, warning1_row,divetime_column,.159 ;top, bottom, left, right | |
2931 bra TFT_divemins2 ; Show minutes only | |
2932 | |
2933 TFT_divemins1: | |
2934 WIN_MEDIUM divetime_column, divetime_row | |
2935 lfsr FSR2,buffer | |
2936 output_16_3 ; displays only last three figures from a 16Bit value (0-999) | |
2937 call TFT_standard_color | |
2938 STRCAT_PRINT "" ; Show minutes in large font | |
2939 | |
2940 WIN_SMALL divetime_secs_column, divetime_secs_row ; left position for two sec figures | |
2941 lfsr FSR2,buffer | |
2942 PUTC ':' | |
2943 bsf leftbind | |
2944 movff divesecs,lo | |
2945 output_99x | |
2946 bcf leftbind | |
2947 STRCAT_PRINT "" ; Show seconds in small font | |
2948 return | |
2949 | |
2950 TFT_divemins2: | |
2951 WIN_MEDIUM divetime_minsonly_column, divetime_row | |
2952 lfsr FSR2,buffer | |
2953 output_16 | |
2954 call TFT_standard_color | |
2955 STRCAT_PRINT "" ; Show minutes in large font | |
2956 return | |
2957 | |
2958 ;============================================================================= | |
2959 global TFT_display_apnoe_surface | |
2960 TFT_display_apnoe_surface: | |
2961 call TFT_divemask_color | |
2962 WIN_TINY surface_apnoe_text_column,surface_apnoe_text_row | |
2963 STRCPY_TEXT_PRINT tApnoeSurface | |
2964 | |
2965 call TFT_standard_color | |
2966 WIN_MEDIUM surface_time_apnoe_column, surface_time_apnoe_row | |
2967 movff apnoe_surface_mins,lo | |
2968 lfsr FSR2,buffer | |
2969 output_8 | |
2970 PUTC ':' | |
2971 movff apnoe_surface_secs,lo | |
2972 output_99x | |
2973 STRCAT_PRINT "" | |
2974 return | |
2975 | |
2976 global TFT_apnoe_clear_surface | |
2977 TFT_apnoe_clear_surface: | |
2978 ; Clear Surface timer.... | |
2979 WIN_BOX_BLACK surface_apnoe_text_row, .239, surface_apnoe_text_column, .159 ;top, bottom, left, right | |
2980 return | |
2981 | |
2982 global TFT_display_apnoe_descent | |
2983 TFT_display_apnoe_descent: ; Descent divetime | |
2984 movff apnoe_mins,lo | |
2985 clrf hi | |
2986 WIN_MEDIUM divetime_column, divetime_row | |
2987 lfsr FSR2,buffer | |
2988 output_16_3 ; displays only last three figures from a 16Bit value (0-999) | |
2989 call TFT_standard_color | |
2990 STRCAT_PRINT "" ; Show minutes in large font | |
2991 WIN_SMALL divetime_secs_column, divetime_secs_row ; left position for two sec figures | |
2992 lfsr FSR2,buffer | |
2993 PUTC ':' | |
2994 bsf leftbind | |
2995 movff apnoe_secs,lo | |
2996 output_99x | |
2997 bcf leftbind | |
2998 STRCAT_PRINT "" ; Show seconds in small font | |
38 | 2999 |
3000 | |
3001 call TFT_divemask_color | |
3002 WIN_TINY total_apnoe_text_column,total_apnoe_text_row | |
3003 STRCPY_TEXT_PRINT tApnoeTotal | |
3004 call TFT_standard_color | |
3005 movff divemins,lo | |
3006 clrf hi | |
3007 WIN_MEDIUM apnoe_total_divetime_column, apnoe_total_divetime_row | |
3008 lfsr FSR2,buffer | |
3009 output_16_3 ; displays only last three figures from a 16Bit value (0-999) | |
3010 call TFT_standard_color | |
3011 STRCAT_PRINT "" ; Show minutes in large font | |
3012 WIN_SMALL apnoe_total_divetime_secs_column, apnoe_total_divetime_secs_row ; left position for two sec figures | |
3013 lfsr FSR2,buffer | |
3014 PUTC ':' | |
3015 bsf leftbind | |
3016 movff divesecs,lo | |
3017 output_99x | |
3018 bcf leftbind | |
3019 STRCAT_PRINT "" ; Show seconds in small font | |
0 | 3020 return |
3021 | |
3022 ;============================================================================= | |
3023 ; Writes ostc3 #Serial and Firmware version in splash screen | |
3024 ; | |
3025 global TFT_serial | |
3026 TFT_serial: | |
3027 WIN_TINY .0,.239-.14 | |
3028 STRCPY "OSTC3 #" ; Won't translate that... | |
3029 rcall TFT_cat_serial | |
3030 | |
3031 STRCAT " v" | |
3032 rcall TFT_cat_firmware | |
3033 | |
3034 ifdef __DEBUG | |
3035 movlw color_grey ; Write header in blue when | |
3036 call TFT_set_color ; compiled in DEBUG mode... | |
3037 STRCAT_PRINT "DEBUG" | |
3038 else | |
76 | 3039 WIN_COLOR color_greenish |
3040 STRCAT_PRINT "" | |
0 | 3041 call TFT_standard_color |
76 | 3042 |
0 | 3043 movlw softwareversion_beta ; =1: Beta, =0: Release |
3044 decfsz WREG,F | |
3045 return ; Release version -> Return | |
3046 | |
3047 call TFT_warnings_color | |
3048 WIN_LEFT .160-4*9/2 ; Right pad. | |
3049 STRCPY_TEXT_PRINT tBeta | |
3050 endif | |
76 | 3051 call TFT_standard_color |
0 | 3052 return |
3053 | |
3054 | |
3055 | |
3056 ;============================================================================= | |
3057 ; For the Information menu: append firmware x.yy version. | |
3058 global info_menu_firmware | |
3059 extern tFirmware | |
3060 info_menu_firmware: | |
3061 lfsr FSR1,tFirmware | |
3062 call strcat_text | |
76 | 3063 global TFT_cat_firmware |
0 | 3064 TFT_cat_firmware: |
3065 movlw softwareversion_x | |
3066 movwf lo | |
3067 bsf leftbind | |
3068 output_8 | |
3069 PUTC '.' | |
3070 movlw softwareversion_y | |
3071 movwf lo | |
3072 output_99x | |
3073 bcf leftbind | |
3074 return | |
3075 | |
3076 ;----------------------------------------------------------------------------- | |
3077 ; For the Information menu: append serial number ostc3#42. | |
3078 global info_menu_serial | |
3079 extern tSerial | |
3080 info_menu_serial: | |
3081 lfsr FSR1,tSerial | |
3082 call strcat_text | |
76 | 3083 global TFT_cat_serial |
0 | 3084 TFT_cat_serial: |
3085 clrf EEADRH | |
3086 clrf EEADR ; Get Serial number LOW | |
3087 call read_eeprom ; read byte | |
3088 movff EEDATA,lo | |
3089 incf EEADR,F ; Get Serial number HIGH | |
3090 call read_eeprom ; read byte | |
3091 movff EEDATA,hi | |
3092 | |
3093 bsf leftbind | |
3094 output_16 | |
3095 bcf leftbind | |
3096 return | |
3097 | |
3098 ;----------------------------------------------------------------------------- | |
3099 ; For the Information menu: Append total dives | |
3100 global info_menu_total_dives | |
3101 extern tTotalDives | |
3102 info_menu_total_dives: | |
3103 lfsr FSR1,tTotalDives | |
3104 call strcat_text | |
3105 TFT_cat_total_dives: | |
3106 read_int_eeprom .2 | |
3107 movff EEDATA,lo | |
3108 read_int_eeprom .3 | |
3109 movff EEDATA,hi | |
3110 bsf leftbind | |
3111 output_16 | |
3112 bcf leftbind | |
3113 return | |
3114 | |
62 | 3115 ; For the Information menu: Append battery voltage |
3116 global info_menu_battery_volts | |
3117 extern tBatteryV | |
3118 info_menu_battery_volts: | |
3119 lfsr FSR1,tBatteryV | |
3120 call strcat_text | |
3121 movff batt_voltage+1,hi | |
3122 movff batt_voltage+0,lo | |
3123 bsf leftbind | |
3124 output_16dp .2 ; x.xxx | |
3125 bcf leftbind | |
3126 PUTC "V" | |
3127 return | |
3128 | |
0 | 3129 ;----------------------------------------------------------------------------- |
3130 ; ppO2 menu | |
3131 global divesets_ppo2_max | |
3132 extern tPPO2Max | |
3133 extern tbar | |
3134 divesets_ppo2_max: | |
3135 lfsr FSR1,tPPO2Max | |
3136 call strcat_text | |
3137 movff opt_ppO2_max,lo | |
3138 movlw ppo2_warning_high | |
3139 divesets_ppo2_common: | |
3140 movwf up ; Save default value | |
3141 clrf hi | |
3142 bsf leftbind | |
3143 output_16dp d'3' | |
3144 bcf leftbind | |
3145 lfsr FSR1,tbar | |
3146 call strcat_text | |
3147 | |
3148 movf up,W ; Default value | |
3149 cpfseq lo ; Current value | |
3150 bra divesets_ppo2_common2 ; Not default, add * | |
3151 return ; Default, Done. | |
3152 divesets_ppo2_common2: | |
3153 PUTC "*" | |
3154 return ; Done. | |
3155 | |
3156 global divesets_ppo2_min | |
3157 extern tPPO2Min | |
3158 divesets_ppo2_min: | |
3159 lfsr FSR1,tPPO2Min | |
3160 call strcat_text | |
3161 movff opt_ppO2_min,lo | |
3162 movlw ppo2_warning_low | |
3163 bra divesets_ppo2_common | |
3164 | |
3165 ;============================================================================= | |
3166 | |
3167 global TFT_clear_warning_text | |
3168 TFT_clear_warning_text: | |
3169 btfss divemode ; in divemode? | |
3170 bra TFT_clear_warning_text2 ; No, setup for surface mode | |
3171 WIN_BOX_BLACK warning1_row, divemode_customview_row-3, warning1_column, warning_icon_column-3 ;top, bottom, left, right | |
3172 return | |
3173 TFT_clear_warning_text2: | |
3174 WIN_BOX_BLACK surf_warning1_row, surf_warning2_row+.24, surf_warning1_column, surf_warning1_column+.76 ;top, bottom, left, right | |
3175 return | |
3176 | |
3177 global TFT_clear_warning_text_2nd_row | |
3178 TFT_clear_warning_text_2nd_row: | |
3179 btfss divemode ; in divemode? | |
3180 bra TFT_clear_warning_text_2nd_2 ; No, setup for surface mode | |
3181 WIN_BOX_BLACK warning2_row, divemode_customview_row-3, warning2_column, warning_icon_column-3 ;top, bottom, left, right | |
3182 return | |
3183 TFT_clear_warning_text_2nd_2: | |
3184 WIN_BOX_BLACK surf_warning2_row, surf_warning2_row+.24, surf_warning2_column, surf_warning2_column+.76 ;top, bottom, left, right | |
3185 return | |
3186 | |
3187 global TFT_fillup_with_spaces | |
3188 TFT_fillup_with_spaces: ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3189 movwf lo ; save max. string length into lo | |
3190 movf FSR2L,W ; Get current string length | |
3191 subwf lo,F ; lo-WREG | |
3192 btfsc STATUS,N ; longer then #lo already? | |
3193 return ; Yes, done. | |
3194 tstfsz lo ; Zero? | |
3195 bra TFT_fillup_with_spaces2 ; No. | |
3196 return ; Yes, done. | |
3197 TFT_fillup_with_spaces2: | |
3198 PUTC " " ; Add one space | |
3199 decfsz lo,F ; All done? | |
3200 bra TFT_fillup_with_spaces2 ; No, loop | |
3201 return ; Done. | |
3202 | |
3203 global TFT_desaturation_time | |
3204 TFT_desaturation_time: | |
3205 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3206 tstfsz WREG ; Is there room for the warning? | |
3207 return ; No | |
3208 STRCPY "Desat:" | |
3209 movff desaturation_time+0,lo ; divide by 60... | |
3210 movff desaturation_time+1,hi | |
3211 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
3212 bsf leftbind | |
3213 movf lo,W | |
3214 movff hi,lo | |
3215 movwf hi ; exchange lo and hi... | |
3216 output_8 ; Hours | |
3217 PUTC ':' | |
3218 movff hi,lo ; Minutes | |
3219 output_99x | |
3220 bcf leftbind | |
3221 movlw surf_warning_length ; Only use surface string length | |
3222 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
60 | 3223 movlw .0 |
3224 movff WREG,buffer+11 | |
0 | 3225 STRCAT_PRINT "" |
3226 return | |
3227 | |
3228 global TFT_nofly_time | |
3229 TFT_nofly_time: | |
3230 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3231 tstfsz WREG ; Is there room for the warning? | |
3232 return ; No | |
3233 STRCPY "NoFly:" | |
3234 movff nofly_time+0,lo ; divide by 60... | |
3235 movff nofly_time+1,hi | |
3236 call convert_time ; converts hi:lo in minutes to hours (hi) and minutes (lo) | |
3237 bsf leftbind | |
3238 movf lo,W | |
3239 movff hi,lo | |
3240 movwf hi ; exchange lo and hi... | |
3241 output_8 ; Hours | |
3242 PUTC ':' | |
3243 movff hi,lo ; Minutes | |
3244 output_99x | |
3245 bcf leftbind | |
3246 movlw surf_warning_length ; Only use surface string length | |
3247 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
60 | 3248 movlw .0 |
3249 movff WREG,buffer+11 | |
0 | 3250 STRCAT_PRINT "" |
3251 return | |
3252 | |
3253 global TFT_warning_agf | |
3254 TFT_warning_agf: | |
3255 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3256 tstfsz WREG ; Is there room for the warning? | |
3257 return ; No | |
3258 call TFT_warnings_color | |
3259 STRCPY_TEXT tDiveaGF_active ; "aGF!" | |
3260 movlw warning_length ; Divemode string length | |
3261 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3262 STRCAT_PRINT "" | |
3263 call TFT_standard_color | |
3264 return | |
3265 | |
3266 global TFT_warning_gf | |
3267 TFT_warning_gf: ;GF | |
3268 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3269 tstfsz WREG ; Is there room for the warning? | |
3270 return ; No | |
3271 TFT_color_code warn_gf ; Color-code Output | |
3272 STRCPY "GF:" | |
3273 movff char_O_gradient_factor,lo ; gradient factor | |
3274 bsf leftbind | |
3275 output_8 | |
3276 PUTC "%" | |
3277 movlw warning_length ; Divemode string length | |
3278 btfss divemode ; In Divemode? | |
3279 movlw surf_warning_length ; No, use surface string length | |
3280 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3281 STRCAT_PRINT "" | |
3282 bcf leftbind | |
3283 call TFT_standard_color | |
3284 return | |
3285 | |
3286 TFT_warning_set_window: ; Sets the row and column for the current warning | |
3287 ; ignore warning (now)? | |
3288 decf warning_counter,W ; -1 | |
3289 bcf STATUS,C | |
3290 rrcf WREG,W ; (warning_counter-1)/2 | |
3291 cpfseq warning_page | |
3292 retlw .255 ; WREG <> 0 -> Warning window not defined | |
3293 | |
3294 call TFT_standard_color | |
3295 | |
3296 btfss divemode ; in divemode? | |
3297 bra TFT_warning_set_window3 ; No, setup for surface mode | |
3298 | |
3299 btfss warning_counter,0 ; Toggle with each warning | |
3300 bra TFT_warning_set_window2 | |
3301 WIN_SMALL warning1_column,warning1_row | |
3302 bcf second_row_warning ; =1: The second row contains a warning | |
3303 retlw .0 ; WREG=0 -> Warning window defined | |
3304 TFT_warning_set_window2: | |
3305 WIN_SMALL warning2_column,warning2_row | |
3306 bsf second_row_warning ; =1: The second row contains a warning | |
3307 retlw .0 ; WREG=0 -> Warning window defined | |
3308 | |
3309 TFT_warning_set_window3: | |
3310 btfss warning_counter,0 ; Toggle with each warning | |
3311 bra TFT_warning_set_window4 | |
3312 WIN_SMALL surf_warning1_column,surf_warning1_row | |
3313 bcf second_row_warning ; =1: The second row contains a warning | |
3314 retlw .0 ; WREG=0 -> Warning window defined | |
3315 TFT_warning_set_window4: | |
3316 WIN_SMALL surf_warning2_column,surf_warning2_row | |
3317 bsf second_row_warning ; =1: The second row contains a warning | |
3318 retlw .0 ; WREG=0 -> Warning window defined | |
3319 | |
3320 | |
3321 global TFT_update_batt_percent_divemode | |
3322 TFT_update_batt_percent_divemode: | |
3323 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3324 tstfsz WREG ; Is there room for the warning? | |
3325 return ; No | |
3326 movff batt_percent,lo ; Get battery percent | |
3327 TFT_color_code warn_battery; Color-code battery percent | |
3328 STRCPY "Batt:" | |
3329 bsf leftbind | |
3330 output_8 | |
3331 bcf leftbind | |
3332 PUTC "%" | |
3333 movlw warning_length ; Divemode string length | |
3334 btfss divemode ; In Divemode? | |
3335 movlw surf_warning_length ; No, use surface string length | |
3336 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3337 STRCAT_PRINT "" | |
3338 call TFT_standard_color | |
3339 return | |
3340 | |
3341 | |
3342 global TFT_gf_mask ; Setup Mask | |
3343 TFT_gf_mask: | |
3344 ; The mask | |
3345 call TFT_divemask_color | |
3346 WIN_TINY dive_gf_column1,dive_gf_text_row | |
3347 STRCPY_TEXT_PRINT tGFactors | |
3348 WIN_TINY dive_gf_column2,dive_gf_text_row | |
3349 STRCPY_TEXT_PRINT taGFactors | |
3350 WIN_TINY dive_gf_column3,dive_gf_text_row | |
3351 STRCPY_TEXT_PRINT tGFInfo | |
3352 | |
3353 ; Show GF (Static) | |
3354 call TFT_disabled_color | |
3355 btfss use_agf | |
3356 call TFT_standard_color | |
3357 | |
3358 WIN_STD dive_gf_column,dive_gf_row | |
3359 lfsr FSR2,buffer | |
3360 bsf leftbind | |
3361 movff opt_GF_low,lo | |
3362 output_8 | |
3363 PUTC "/" | |
3364 movff opt_GF_high,lo | |
3365 output_8 | |
3366 STRCAT_PRINT "" | |
3367 ; Show aGF (Static) | |
3368 call TFT_standard_color | |
3369 TSTOSS opt_enable_aGF ; =1: aGF can be selected underwater | |
3370 bra TFT_gf_mask2 ; Show "---" instead | |
3371 | |
3372 btfss use_agf | |
3373 call TFT_disabled_color | |
3374 | |
3375 WIN_STD dive_agf_column,dive_agf_row | |
3376 lfsr FSR2,buffer | |
3377 movff opt_aGF_low,lo | |
3378 output_8 | |
3379 PUTC "/" | |
3380 movff opt_aGF_high,lo | |
3381 output_8 | |
3382 STRCAT_PRINT "" | |
3383 bcf leftbind | |
3384 call TFT_standard_color | |
3385 return | |
3386 | |
3387 TFT_gf_mask2: | |
3388 WIN_STD dive_agf_column+.10,dive_agf_row | |
3389 STRCPY_PRINT "---" | |
3390 bcf leftbind | |
3391 return | |
3392 | |
3393 global TFT_gf_info ; Show GF informations | |
3394 TFT_gf_info: | |
3395 ; Show current GF | |
3396 movff char_O_gradient_factor,lo ; gradient factor absolute (Non-GF model) | |
3397 movff char_I_deco_model,hi | |
3398 decfsz hi,F ; jump over next line if char_I_deco_model == 1 | |
3399 movff char_O_relative_gradient_GF,lo ; gradient factor relative (GF model) | |
3400 WIN_STD dive_currentgf_column,dive_currentgf_row | |
3401 lfsr FSR2,buffer | |
3402 output_8 | |
3403 STRCAT_PRINT "%" | |
3404 return | |
3405 | |
3406 global TFT_ead_end_tissues_clock_mask ; Setup Mask | |
3407 TFT_ead_end_tissues_clock_mask: | |
3408 ; The mask | |
3409 call TFT_divemask_color | |
3410 ; Put three columns at HUD positions | |
3411 WIN_TINY dive_custom_hud_column1,dive_custom_hud_row | |
3412 STRCPY_TEXT_PRINT tDiveClock | |
3413 WIN_TINY dive_custom_hud_column2,dive_custom_hud_row | |
3414 STRCPY_TEXT_PRINT tDiveEAD_END | |
3415 WIN_TINY dive_custom_hud_column3,dive_custom_hud_row | |
3416 STRCPY_TEXT_PRINT tDiveTissues | |
3417 call TFT_standard_color | |
3418 return | |
3419 | |
3420 global TFT_ead_end_tissues_clock ; Show EAD/END, Tissues and clock | |
3421 TFT_ead_end_tissues_clock: | |
3422 ; Update clock and date | |
3423 WIN_SMALL dive_clock_column,dive_clock_row | |
3424 call TFT_clock2 ; print clock | |
3425 ; WIN_SMALL dive_date_column,dive_date_row | |
3426 ; lfsr FSR2,buffer | |
3427 ; movff month,convert_value_temp+0 | |
3428 ; movff day,convert_value_temp+1 | |
3429 ; movff year,convert_value_temp+2 | |
3430 ; rcall TFT_convert_date_short ; converts into "DD/MM" or "MM/DD" or "MM/DD" in postinc2 | |
3431 ; STRCAT_PRINT "." | |
3432 | |
3433 ; Show END/EAD | |
3434 WIN_SMALL dive_ead_column,dive_ead_row | |
3435 STRCPY_TEXT tEAD ; EAD: | |
3436 movff char_O_EAD,lo | |
3437 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars | |
3438 WIN_SMALL dive_end_column,dive_end_row | |
3439 STRCPY_TEXT tEND ; END: | |
3440 movff char_O_END,lo | |
3441 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars | |
3442 | |
3443 ; Show tissue diagram | |
3444 call TFT_divemask_color | |
3445 WIN_TINY dive_tissue_N2_column,dive_tissue_N2_row | |
3446 STRCPY_TEXT_PRINT tN2 | |
3447 WIN_TINY dive_tissue_He_column,dive_tissue_He_row | |
3448 STRCPY_TEXT_PRINT tHe | |
3449 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation) | |
3450 movlb b'00000001' ; select ram bank 1 | |
3451 rcall DISP_tissue_saturation_graph ; Show char_O_tissue_N2_saturation and char_O_tissue_He_saturation | |
3452 return | |
3453 | |
3454 TFT_end_ead_common: ; print "lo m" (or ft) and limit to 8 chars | |
3455 bsf leftbind | |
3456 TSTOSS opt_units ; 0=Meters, 1=Feets | |
3457 bra TFT_end_ead_common_metric | |
3458 ;TFT_end_ead_common_imperial: | |
3459 ; With lo in m | |
3460 movf lo,W | |
3461 mullw .100 ; PRODL:PRODH = mbar/min | |
3462 movff PRODL,lo | |
3463 movff PRODH,hi | |
3464 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
3465 output_16_3 | |
3466 STRCAT_TEXT tFeets | |
3467 clrf WREG | |
3468 movff WREG,buffer+.8 ; limit string length to 8 | |
3469 bra TFT_end_ead_common_exit | |
3470 TFT_end_ead_common_metric: | |
3471 output_8 | |
3472 STRCAT_TEXT tMeters | |
3473 TFT_end_ead_common_exit: | |
3474 bcf leftbind | |
3475 movlw .8 | |
3476 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3477 STRCAT_PRINT "" | |
3478 return | |
3479 | |
3480 global TFT_surface_tissues | |
3481 TFT_surface_tissues: ; Show Tissue diagram in surface mode | |
3482 WIN_SMALL surf_tissue_N2_column,surf_tissue_N2_row | |
3483 STRCPY_TEXT_PRINT tN2 | |
3484 WIN_SMALL surf_tissue_He_column,surf_tissue_He_row | |
3485 STRCPY_TEXT_PRINT tHe | |
3486 | |
3487 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation) | |
3488 movlb b'00000001' ; select ram bank 1 | |
3489 | |
3490 movlw color_deepblue | |
3491 call TFT_set_color ; Make this configurable? | |
3492 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.29,.29 | |
3493 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.37,.37 | |
3494 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.45,.45 | |
3495 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.53,.53 | |
3496 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.61,.61 | |
3497 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.69,.69 | |
3498 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.77,.77 | |
3499 WIN_FRAME_COLOR16 surf_tissue_diagram_top+.23,surf_tissue_diagram_bottom-.4,.85,.85 | |
3500 WIN_FRAME_STD surf_tissue_diagram_top, surf_tissue_diagram_bottom, surf_tissue_diagram_left, surf_tissue_diagram_right ; outer frame | |
3501 | |
3502 movlw .1 | |
3503 movff WREG,win_height ; row bottom (0-239) | |
3504 movlw surf_tissue_diagram_left+.4 ; Surface mode | |
3505 movff WREG,win_leftx2 ; column left (0-159) | |
3506 movlw surf_tissue_diagram_right-surf_tissue_diagram_left-4 ; Width | |
3507 movff WREG,win_width | |
3508 | |
3509 ;---- Draw N2 Tissues | |
3510 lfsr FSR2, char_O_tissue_N2_saturation | |
3511 movlw d'16' | |
3512 movwf wait_temp ; 16 tissues | |
3513 clrf waitms_temp ; Row offset | |
3514 surf_tissue_saturation_graph_N2: | |
3515 movlw surf_tissue_diagram_top+.23 ; surface mode | |
3516 addwf waitms_temp,W | |
3517 movff WREG,win_top ; row top (0-239) | |
3518 rcall surf_tissue_saturation_loop ; Show one tissue | |
3519 decfsz wait_temp,F | |
3520 bra surf_tissue_saturation_graph_N2 | |
3521 | |
3522 ;---- Draw He Tissues ---------------------------------------------------- | |
3523 lfsr FSR2, char_O_tissue_He_saturation | |
3524 movlw d'16' | |
3525 movwf wait_temp ; 16 tissues | |
3526 clrf waitms_temp ; Row offset | |
3527 surf_tissue_saturation_graph_He: | |
3528 movlw surf_tissue_diagram_top+.23+.56 ; surface mode | |
3529 addwf waitms_temp,W | |
3530 movff WREG,win_top ; row top (0-239) | |
3531 rcall surf_tissue_saturation_loop ; Show one tissue | |
3532 decfsz wait_temp,F | |
3533 bra surf_tissue_saturation_graph_He | |
3534 return | |
3535 | |
3536 surf_tissue_saturation_loop: | |
3537 call TFT_standard_color | |
3538 movlw .2 ; row spacing | |
3539 addwf waitms_temp,F | |
3540 movf POSTINC2,W ; Get tissue load | |
3541 bcf STATUS,C | |
3542 rrcf WREG ; And divide by 2 | |
3543 movwf temp1 | |
3544 movlw .20 | |
3545 subwf temp1,F ; Subtract some offset | |
3546 movff win_width,WREG ; Max width. | |
3547 cpfslt temp1 ; skip if WREG < win_width | |
3548 movwf temp1 | |
3549 movff temp1,win_bargraph | |
3550 call TFT_box | |
3551 return | |
3552 | |
3553 ;============================================================================= | |
3554 ; Draw saturation graph, is surface mode or in dive mode. | |
3555 DISP_tissue_saturation_graph: | |
3556 ;---- Draw Frame | |
50 | 3557 call TFT_standard_color |
3558 WIN_FRAME_COLOR16 tissue_diagram_top, tissue_diagram_bottom, tissue_diagram_left, .159 ; outer frame | |
0 | 3559 |
3560 movlw .1 | |
3561 movff WREG,win_height ; row bottom (0-239) | |
3562 movlw tissue_diagram_left+.3 ; divemode | |
3563 movff WREG,win_leftx2 ; column left (0-159) | |
3564 movlw .159-tissue_diagram_left-4 ; Width | |
3565 movff WREG,win_width | |
3566 | |
3567 ;---- Draw N2 Tissues | |
3568 lfsr FSR2, char_O_tissue_N2_saturation | |
3569 movlw d'16' | |
3570 movwf wait_temp ; 16 tissues | |
3571 clrf waitms_temp ; Row offset | |
3572 tissue_saturation_graph_N2: | |
3573 movlw tissue_diagram_top+3 ; divemode | |
3574 addwf waitms_temp,W | |
3575 movff WREG,win_top ; row top (0-239) | |
3576 rcall tissue_saturation_graph_loop ; Show one tissue | |
3577 decfsz wait_temp,F | |
3578 bra tissue_saturation_graph_N2 | |
3579 | |
3580 ;---- Draw He Tissues ---------------------------------------------------- | |
3581 lfsr FSR2, char_O_tissue_He_saturation | |
3582 movlw d'16' | |
3583 movwf wait_temp ; 16 tissues | |
3584 clrf waitms_temp ; Row offset | |
3585 tissue_saturation_graph_He: | |
3586 movlw tissue_diagram_top+3+.22 ; divemode | |
3587 addwf waitms_temp,W | |
3588 movff WREG,win_top ; row top (0-239) | |
3589 | |
3590 rcall tissue_saturation_graph_loop ; Show one tissue | |
3591 | |
3592 decfsz wait_temp,F | |
3593 bra tissue_saturation_graph_He | |
3594 return | |
3595 | |
3596 tissue_saturation_graph_loop: | |
3597 call TFT_standard_color | |
3598 incf waitms_temp,F | |
3599 movf POSTINC2,W | |
3600 bcf STATUS,C | |
3601 rrcf WREG | |
3602 bcf STATUS,C | |
3603 rrcf WREG ; And divide by 4 | |
3604 movwf temp1 | |
3605 movlw .12 | |
3606 subwf temp1,F ; Subtract some offset | |
3607 movff win_width,WREG ; Max width. | |
3608 cpfslt temp1 ; skip if WREG < win_width | |
3609 movwf temp1 | |
3610 movff temp1,win_bargraph | |
3611 call TFT_box | |
3612 return | |
3613 | |
55 | 3614 |
0 | 3615 global TFT_display_cns |
3616 TFT_display_cns: | |
3617 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3618 tstfsz WREG ; Is there room for the warning? | |
3619 return ; No | |
3620 TFT_color_code warn_cns ; Color-code CNS output | |
3621 STRCPY_TEXT tCNS2 ; CNS: | |
3622 movff int_O_CNS_fraction+0,lo | |
3623 movff int_O_CNS_fraction+1,hi | |
3624 bsf leftbind | |
3625 output_16_3 ;Displays only 0...999 | |
3626 bcf leftbind | |
3627 PUTC "%" | |
3628 movlw warning_length ; Divemode string length | |
3629 btfss divemode ; In Divemode? | |
3630 movlw surf_warning_length ; No, use surface string length | |
3631 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3632 STRCAT_PRINT "" | |
3633 call TFT_standard_color | |
3634 return | |
3635 | |
3636 global TFT_display_ppo2 | |
3637 TFT_display_ppo2: ; Show ppO2 (ppO2 stored in xC, in mbar!) | |
3638 rcall TFT_warning_set_window ; Sets the row and column for the current warning | |
3639 tstfsz WREG ; Is there room for the warning? | |
3640 return ; No | |
3641 TFT_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) | |
55 | 3642 STRCPY "ppO2:" |
0 | 3643 ; Check very high ppO2 manually |
3644 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar? | |
3645 bra TFT_show_ppO2_3 ; Yes, display fixed Value! | |
3646 movff xC+0,lo | |
3647 movff xC+1,hi | |
3648 bsf ignore_digit4 | |
3649 output_16dp d'1' | |
3650 TFT_show_ppO2_2: | |
3651 movlw warning_length ; Divemode string length | |
3652 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) | |
3653 STRCAT_PRINT "" | |
3654 call TFT_standard_color | |
3655 return | |
3656 | |
3657 TFT_show_ppO2_3: | |
3658 STRCAT ">6.6" | |
3659 bra TFT_show_ppO2_2 | |
3660 | |
3661 | |
3662 global TFT_LogOffset_Logtitle | |
3663 TFT_LogOffset_Logtitle: | |
3664 STRCPY_TEXT tLogOffset | |
3665 PUTC ":" | |
3666 call do_logoffset_common_read ; Offset into lo:hi | |
3667 bsf leftbind | |
3668 output_16 | |
3669 bcf leftbind | |
3670 PUTC " " | |
3671 return ; No "_PRINT" here... | |
3672 | |
3673 | |
3674 global adjust_depth_with_salinity | |
3675 adjust_depth_with_salinity: ; computes salinity setting into lo:hi [mbar] | |
3676 btfsc simulatormode_active ; Do apply salinity in Simulatormode | |
3677 return | |
3678 | |
3679 movff opt_salinity,WREG ; 0-5% | |
3680 addlw d'100' ; 1.00kg/l | |
3681 movwf wait_temp | |
3682 | |
3683 movlw d'105' ; 105% ? | |
3684 cpfslt wait_temp ; Salinity higher limit | |
3685 return ; Out of limit, do not adjust lo:hi | |
3686 movlw d'99' ; 99% ? | |
3687 cpfsgt wait_temp ; Salinity lower limit | |
3688 return ; Out of limit, do not adjust lo:hi | |
3689 | |
3690 movff lo,xA+0 | |
3691 movff hi,xA+1 | |
3692 | |
3693 movlw d'102' ; 0,98bar/10m | |
3694 movwf xB+0 | |
3695 clrf xB+1 | |
3696 call mult16x16 ;xA*xB=xC (lo:hi * 100) | |
3697 movff wait_temp,xB+0 ; Salinity | |
3698 clrf xB+1 | |
3699 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3700 movff xC+0,lo | |
3701 movff xC+1,hi ; restore lo and hi with updated value | |
3702 return | |
3703 | |
3704 global convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | |
3705 convert_mbar_to_feet: ; convert value in lo:hi from mbar to feet | |
3706 movff lo,xA+0 | |
3707 movff hi,xA+1 | |
3708 | |
3709 movlw LOW d'328' ; 328feet/100m | |
3710 movwf xB+0 | |
3711 movlw HIGH d'328' | |
3712 movwf xB+1 | |
3713 | |
3714 call mult16x16 ; xA*xB=xC (lo:hi * 328) | |
3715 | |
3716 movlw d'50' ; round up | |
3717 addwf xC+0,F | |
3718 movlw 0 | |
3719 addwfc xC+1,F | |
3720 addwfc xC+2,F | |
3721 addwfc xC+3,F | |
3722 | |
3723 movlw LOW .10000 | |
3724 movwf xB+0 | |
3725 movlw HIGH .10000 | |
3726 movwf xB+1 | |
3727 | |
3728 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3729 | |
3730 movff xC+0,lo | |
3731 movff xC+1,hi ; restore lo and hi with updated value | |
3732 return | |
3733 | |
3734 global convert_celsius_to_fahrenheit ; convert value in lo:hi from celsius to fahrenheit | |
3735 convert_celsius_to_fahrenheit: ; convert value in lo:hi from celsius to fahrenheit | |
3736 ; Does it work with signed temperature? mH | |
3737 movff lo,xA+0 | |
3738 movff hi,xA+1 | |
3739 | |
3740 movlw d'18' ; 1C = 1.8F | |
3741 movwf xB+0 | |
3742 clrf xB+1 | |
3743 | |
3744 call mult16x16 ;xA*xB=xC (lo:hi * 18) | |
3745 | |
3746 movlw d'10' | |
3747 movwf xB+0 | |
3748 clrf xB+1 | |
3749 | |
3750 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder | |
3751 | |
3752 movlw LOW d'320' ; 0C = 32F | |
3753 addwf xC+0,F | |
3754 movlw HIGH d'320' | |
3755 addwfc xC+1,F | |
3756 | |
3757 movff xC+0,lo | |
3758 movff xC+1,hi ; restore lo and hi with updated value | |
3759 return | |
3760 | |
3761 END |