comparison src/tft_outputs.asm @ 300:5ad479f2a868

Merged Screen layout mod #1 into Screen layout work #3
author Janos Kovacs <kovjanos@gmail.com>
date Sun, 31 May 2015 21:24:16 +0200
parents 653a3ab08062
children 9b1b0b32e7d5
comparison
equal deleted inserted replaced
299:6c4800af27ac 300:5ad479f2a868
239 movff hi,sub_b+1 239 movff hi,sub_b+1
240 movff hi_temp,hi 240 movff hi_temp,hi
241 movff lo_temp,lo ; Restore hi, lo 241 movff lo_temp,lo ; Restore hi, lo
242 call subU16 ; sub_c = sub_a - sub_b 242 call subU16 ; sub_c = sub_a - sub_b
243 btfss neg_flag 243 btfss neg_flag
244 bra TFT_warnings_color ; Set to warning color 244 bra TFT_color_code_depth_warn ; Set to warning color
245 call TFT_standard_color 245 call TFT_color_code_ppo2_depth ; check depth against MOD
246 return 246 return
247
248 TFT_color_code_ppo2_depth:
249 SAFE_2BYTE_COPY amb_pressure, xA
250 movlw d'10'
251 movwf xB+0
252 clrf xB+1
253 call div16x16 ; xC=p_amb/10
254
255 movff xC+0,xA+0
256 movff xC+1,xA+1
257 movff char_I_O2_ratio,xB+0 ; =O2 ratio
258 clrf xB+1
259 call mult16x16 ; char_I_O2_ratio * p_amb/10
260
261 ; Check if ppO2>6,55bar
262 tstfsz xC+2 ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar?
263 ;bra TFT_color_code_warn ; Yes, warn in warning color
264 bra TFT_color_code_depth_warn
265 ; Check if ppO2>3,30bar
266 btfsc xC+1,7
267 bra TFT_color_code_depth_warn
268
269 movff xC+0,sub_a+0
270 movff xC+1,sub_a+1
271 movff opt_ppO2_max,WREG ; PPO2 Max for MOD calculation and color coding in divemode
272 mullw d'100'
273 movff PRODL,sub_b+0
274 movff PRODH,sub_b+1
275 call subU16 ; sub_c = sub_a - sub_b
276 btfss neg_flag
277 bra TFT_color_code_depth_warn
278
279 movff xC+0,sub_a+0
280 movff xC+1,sub_a+1
281 movff opt_ppO2_min,WREG ; PPO2 min for Sensors and color coding in divemode
282 mullw d'100'
283 movff PRODL,sub_b+0
284 movff PRODH,sub_b+1
285 call subU16 ; sub_c = sub_a - sub_b
286 btfsc neg_flag
287 bra TFT_color_code_depth_warn
288 if dm_offset != 0
289 call TFT_standard_color
290 else
291 movlw color_green
292 call TFT_set_color
293 endif
294 bcf blinking_depth_warning ; reset warning
295 return
296
297 TFT_color_code_depth_warn:
298 bsf blinking_depth_warning ; Set warning
299 bra TFT_warnings_color ; Set to warning color
247 300
248 TFT_color_code_cns: 301 TFT_color_code_cns:
249 movff int_O_CNS_fraction+1,lo ; copy into bank1 302 movff int_O_CNS_fraction+1,lo ; copy into bank1
250 tstfsz lo ; >255% ? 303 tstfsz lo ; >255% ?
251 bra TFT_warnings_color ; Yes 304 bra TFT_warnings_color ; Yes
396 449
397 global TFT_show_color_schemes 450 global TFT_show_color_schemes
398 TFT_show_color_schemes: ; update the color schemes 451 TFT_show_color_schemes: ; update the color schemes
399 bsf divemode ; put in divemode 452 bsf divemode ; put in divemode
400 call TFT_divemask_color 453 call TFT_divemask_color
401 WIN_TINY divemode_mask_depth_column,divemode_mask_depth_row+.40 454 WIN_TINY .12,.40
402 STRCAT_TEXT_PRINT tDepth 455 STRCAT_TEXT_PRINT tDepth
403 WIN_TINY divemode_mask_maxdepth_column,divemode_mask_maxdepth_row+.40 456 WIN_TINY .62,.40
404 STRCAT_TEXT_PRINT tMaxDepth 457 STRCAT_TEXT_PRINT tMaxDepth
405 WIN_TINY divemode_mask_divetime_column,divemode_mask_divetime_row+.40 458 WIN_TINY .122,.40
406 STRCAT_TEXT_PRINT tDivetime 459 STRCAT_TEXT_PRINT tDivetime
407 460
408 ; Show some demo screen 461 ; Show some demo screen
409 462
410 ; Depth demo 463 ; Depth demo
411 call TFT_standard_color 464 call TFT_standard_color
412 WIN_MEDIUM depth_column+.3,depth_row+.40 465 WIN_MEDIUM .3,.54
413 movlw LOW .5172 466 movlw LOW .5172
414 movwf lo 467 movwf lo
415 movlw HIGH .5172 468 movlw HIGH .5172
416 movwf hi 469 movwf hi
417 bsf leftbind 470 bsf leftbind
418 bsf ignore_digit4 471 bsf ignore_digit4
419 output_16 ; Full meters in Big font 472 output_16 ; Full meters in Big font
420 bcf leftbind 473 bcf leftbind
421 STRCAT_PRINT "" ; Display full meters 474 STRCAT_PRINT "" ; Display full meters
422 WIN_SMALL depth_dm_column-.15,max_depth_dm_row+.40 475 WIN_SMALL .25,.66
423 movlw LOW .5172 476 movlw LOW .5172
424 movwf lo 477 movwf lo
425 movlw HIGH .5172 478 movlw HIGH .5172
426 movwf hi 479 movwf hi
427 PUTC "." 480 PUTC "."
431 output_16dp d'0' ; .1m in SMALL font 484 output_16dp d'0' ; .1m in SMALL font
432 STRCAT_PRINT "" ; Display decimeters 485 STRCAT_PRINT "" ; Display decimeters
433 WIN_FONT FT_SMALL 486 WIN_FONT FT_SMALL
434 487
435 ; Max. Depth demo 488 ; Max. Depth demo
436 WIN_MEDIUM max_depth_column,max_depth_row+.40 489 WIN_MEDIUM .64,.54
437 bsf ignore_digit4 ; no 0.1m 490 bsf ignore_digit4 ; no 0.1m
438 bsf leftbind 491 bsf leftbind
439 movlw LOW .6349 492 movlw LOW .6349
440 movwf lo 493 movwf lo
441 movlw HIGH .6349 494 movlw HIGH .6349
442 movwf hi 495 movwf hi
443 output_16 496 output_16
444 STRCAT_PRINT "" ; Display full meters 497 STRCAT_PRINT "" ; Display full meters
445 bcf leftbind 498 bcf leftbind
446 ; .1m in SMALL font 499 ; .1m in SMALL font
447 WIN_SMALL max_depth_dm_column,max_depth_dm_row+.40 500 WIN_SMALL .87,.66
448 PUTC "." 501 PUTC "."
449 movlw d'4' 502 movlw d'4'
450 movwf ignore_digits 503 movwf ignore_digits
451 bsf ignore_digit5 504 bsf ignore_digit5
452 bsf leftbind 505 bsf leftbind
459 bcf leftbind 512 bcf leftbind
460 513
461 ; Divetime demo 514 ; Divetime demo
462 movff mins,lo 515 movff mins,lo
463 clrf hi 516 clrf hi
464 WIN_MEDIUM divetime_column, divetime_row+.40 517 WIN_MEDIUM .103, .54
465 output_16_3 ; limit to 999 and display only (0-999) 518 output_16_3 ; limit to 999 and display only (0-999)
466 STRCAT_PRINT "" ; Show minutes in large font 519 STRCAT_PRINT "" ; Show minutes in large font
467 WIN_SMALL divetime_secs_column, divetime_secs_row+.40 ; left position for two sec figures 520 WIN_SMALL .139, .66 ; left position for two sec figures
468 PUTC ':' 521 PUTC ':'
469 bsf leftbind 522 bsf leftbind
470 movff secs,lo 523 movff secs,lo
471 output_99x 524 output_99x
472 bcf leftbind 525 bcf leftbind
475 bcf divemode ; don't stay in divemode 528 bcf divemode ; don't stay in divemode
476 return 529 return
477 530
478 global TFT_divemode_mask 531 global TFT_divemode_mask
479 TFT_divemode_mask: ; Displays mask in Dive-Mode 532 TFT_divemode_mask: ; Displays mask in Dive-Mode
480 call TFT_divemask_color 533 if dm_offset != 0
481 WIN_TINY divemode_mask_depth_column,divemode_mask_depth_row 534 call TFT_divemask_color
482 STRCAT_TEXT_PRINT tDepth 535 WIN_TINY dm_mask_depth_column,dm_mask_depth_row
483 WIN_TINY divemode_mask_maxdepth_column,divemode_mask_maxdepth_row 536 STRCAT_TEXT_PRINT tDepth
484 STRCAT_TEXT_PRINT tMaxDepth 537 WIN_TINY dm_mask_maxdepth_column,dm_mask_maxdepth_row
485 WIN_TINY divemode_mask_divetime_column,divemode_mask_divetime_row 538 STRCAT_TEXT_PRINT tMaxDepth
486 STRCAT_TEXT_PRINT tDivetime 539 WIN_TINY dm_mask_divetime_column,dm_mask_divetime_row
487 540 STRCAT_TEXT_PRINT tDivetime
541 endif
488 call TFT_standard_color 542 call TFT_standard_color
489 return 543 return
490 544
491 global TFT_clear_customview_divemode 545 global TFT_clear_customview_divemode
492 TFT_clear_customview_divemode: 546 TFT_clear_customview_divemode:
493 WIN_BOX_BLACK divemode_customview_row, .163, .0, .159 ; top, bottom, left, right 547 WIN_BOX_BLACK dm_customview_row, dm_customview_bot, dm_customview_column, dm_customview_rgt ; top, bottom, left, right
494 return 548 return
495 549
496 global TFT_display_velocity 550 global TFT_display_velocity
497 TFT_display_velocity: ; With divA+0 = m/min 551 TFT_display_velocity: ; With divA+0 = m/min
498 TFT_color_code warn_velocity ; Color-code Output (With divA+0 = m/min) 552 TFT_color_code warn_velocity ; Color-code Output (With divA+0 = m/min)
499 WIN_SMALL velocity_text_column,velocity_text_row 553 WIN_SMALL dm_velocity_text_column, dm_velocity_text_row
500 554
501 TSTOSS opt_units ; 0=Meters, 1=Feets 555 TSTOSS opt_units ; 0=Meters, 1=Feets
502 bra TFT_display_velocity_metric 556 bra TFT_display_velocity_metric
503 ;TFT_display_velocity_imperial: 557 ;TFT_display_velocity_imperial:
504 movff divA+0,WREG ; divA+0 = m/min 558 movff divA+0,WREG ; divA+0 = m/min
529 return 583 return
530 584
531 global TFT_display_velocity_clear 585 global TFT_display_velocity_clear
532 TFT_display_velocity_clear: 586 TFT_display_velocity_clear:
533 ; Clear Text 587 ; Clear Text
534 WIN_BOX_BLACK velocity_text_row, velocity_text_row+.22, velocity_text_column, (velocity_text_column+.7*.8)-1 ; top, bottom, left, right 588 WIN_BOX_BLACK dm_velocity_text_row, dm_velocity_text_bot, dm_velocity_text_column, dm_velocity_text_rgt ; top, bottom, left, right
535 return 589 return
536 590
537 global TFT_clear_decoarea 591 global TFT_clear_decoarea
538 TFT_clear_decoarea: 592 TFT_clear_decoarea:
539 WIN_BOX_BLACK decostop_1st_stop_row, .239, decostop_1st_stop_column ,.159 ; top, bottom, left, right 593 WIN_BOX_BLACK dm_decostop_1st_stop_row, .239, dm_decostop_1st_stop_column, .159 ; top, bottom, left, right
540 return 594 return
541 595
542 global TFT_clear_divemode_menu 596 global TFT_clear_divemode_menu
543 TFT_clear_divemode_menu: 597 TFT_clear_divemode_menu:
544 WIN_BOX_BLACK divemode_menu_row, divemode_menu_lower, divemode_menu_left ,divemode_menu_right ; top, bottom, left, right 598 if dm_offset != 0
599 WIN_BOX_BLACK dm_menu_row, dm_menu_lower, dm_menu_left, dm_menu_right ; top, bottom, left, right
600 else
601 WIN_BOX_BLACK dm_3rdrow_top, dm_3rdrow_bot, dm_3rdrow_lft, dm_3rdrow_rgt ; top, bottom, left, right
602 endif
545 return 603 return
546 604
547 global TFT_display_ndl_mask 605 global TFT_display_ndl_mask
548 TFT_display_ndl_mask: 606 TFT_display_ndl_mask:
549 btfsc divemode_menu ; Is the dive mode menu shown? 607 btfsc divemode_menu ; Is the dive mode menu shown?
550 return ; Yes, return 608 return ; Yes, return
551 rcall TFT_clear_decoarea ; Clear Dekostop and Dekosum 609 rcall TFT_clear_decoarea ; Clear Dekostop and Dekosum
552 call TFT_divemask_color 610 call TFT_divemask_color
553 WIN_STD ndl_text_column,ndl_text_row 611 WIN_STD dm_ndl_text_column, dm_ndl_text_row
554 STRCPY_TEXT_PRINT tNDL ; NDL 612 STRCPY_TEXT_PRINT tNDL ; NDL
555 call TFT_standard_color 613 call TFT_standard_color
556 return 614 return
557 615
558 global TFT_show_TTS_divemode 616 global TFT_show_TTS_divemode
560 btfsc divemode_menu ; Is the dive mode menu shown? 618 btfsc divemode_menu ; Is the dive mode menu shown?
561 return ; Yes, return 619 return ; Yes, return
562 call TFT_standard_color 620 call TFT_standard_color
563 movff int_O_ascenttime+0,lo ; TTS 621 movff int_O_ascenttime+0,lo ; TTS
564 movff int_O_ascenttime+1,hi ; on 16bits 622 movff int_O_ascenttime+1,hi ; on 16bits
565 WIN_MEDIUM tts_value_column,tts_value_row 623 WIN_MEDIUM dm_tts_value_column, dm_tts_value_row
566 output_16_3 ;Displays only 0...999 624 output_16_3 ;Displays only 0...999
567 STRCAT_PRINT "'" 625 STRCAT_PRINT "'"
568 return 626 return
569 627
570 global TFT_display_ndl 628 global TFT_display_ndl
571 TFT_display_ndl: 629 TFT_display_ndl:
572 btfsc divemode_menu ; Is the dive mode menu shown? 630 btfsc divemode_menu ; Is the dive mode menu shown?
573 return ; Yes, return 631 return ; Yes, return
574 WIN_MEDIUM ndl_value_column,ndl_value_row 632 WIN_MEDIUM dm_ndl_value_column, dm_ndl_value_row
575 call TFT_standard_color 633 call TFT_standard_color
576 movff char_O_nullzeit,lo ; Get NDL from C-code 634 movff char_O_nullzeit,lo ; Get NDL from C-code
577 output_8 635 output_8
578 STRCAT_PRINT "'" 636 STRCAT_PRINT "'"
579 return 637 return
580 638
581 global TFT_divemode_warning 639 global TFT_divemode_warning
582 TFT_divemode_warning: 640 TFT_divemode_warning:
583 bsf dive_warning_displayed ; =1: The warning sign is shown 641 bsf dive_warning_displayed ; =1: The warning sign is shown
584 WIN_TOP warning_icon_row 642 WIN_TOP dm_warning_icon_row
585 WIN_LEFT warning_icon_column 643 WIN_LEFT dm_warning_icon_column
586 TFT_WRITE_PROM_IMAGE dive_warning2_block ; Show Warning icon 644 TFT_WRITE_PROM_IMAGE dive_warning2_block ; Show Warning icon
587 return 645 return
588 646
589 global TFT_divemode_warning_clear 647 global TFT_divemode_warning_clear
590 TFT_divemode_warning_clear: 648 TFT_divemode_warning_clear:
591 btfss dive_warning_displayed ; =1: The warning sign is shown 649 btfss dive_warning_displayed ; =1: The warning sign is shown
592 return 650 return
593 bcf dive_warning_displayed ; clear only once 651 bcf dive_warning_displayed ; clear only once
594 WIN_BOX_BLACK warning_icon_row, warning_icon_row+.38, warning_icon_column, warning_icon_column+.21; top, bottom, left, right 652 WIN_BOX_BLACK dm_warning_icon_row, dm_warning_icon_bot, dm_warning_icon_column, dm_warning_icon_rgt ; top, bottom, left, right
595 return 653 return
596 654
597 global TFT_display_deko_mask 655 global TFT_display_deko_mask
598 TFT_display_deko_mask: 656 TFT_display_deko_mask:
599 rcall TFT_clear_decoarea 657 rcall TFT_clear_decoarea
600 WIN_STD tts_text_column,tts_text_row 658 WIN_STD dm_tts_text_column, dm_tts_text_row
601 call TFT_divemask_color 659 call TFT_divemask_color
602 STRCPY_TEXT_PRINT tTTS ; TTS 660 STRCPY_TEXT_PRINT tTTS ; TTS
603 call TFT_standard_color 661 call TFT_standard_color
604 bcf show_safety_stop ; Clear safety stop flag 662 bcf show_safety_stop ; Clear safety stop flag
605 return 663 return
646 704
647 global TFT_display_deko 705 global TFT_display_deko
648 TFT_display_deko: 706 TFT_display_deko:
649 btfsc divemode_menu ; Is the dive mode menu shown? 707 btfsc divemode_menu ; Is the dive mode menu shown?
650 return ; Yes, return 708 return ; Yes, return
651 WIN_MEDIUM decostop_1st_stop_column,decostop_1st_stop_row 709 WIN_MEDIUM dm_decostop_1st_stop_column, dm_decostop_1st_stop_row
652 TFT_color_code warn_ceiling ; Color-code Output 710 TFT_color_code warn_ceiling ; Color-code Output
653 movff char_O_first_deco_depth,lo ; Ceiling in m 711 movff char_O_first_deco_depth,lo ; Ceiling in m
654 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) 712 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
655 movff char_O_first_deco_time,lo ; length of first stop in min 713 movff char_O_first_deco_time,lo ; length of first stop in min
656 output_99 714 output_99
659 return 717 return
660 718
661 global TFT_decoplan 719 global TFT_decoplan
662 TFT_decoplan: 720 TFT_decoplan:
663 call TFT_divemask_color 721 call TFT_divemask_color
664 WIN_TINY decoplan_title_column,decoplan_title_row 722 WIN_TINY dm_custom_decoplan_title_column, dm_custom_decoplan_title_row
665 STRCPY_TEXT_PRINT tDiveDecoplan 723 STRCPY_TEXT_PRINT tDiveDecoplan
666 call TFT_standard_color 724 call TFT_standard_color
667 725
668 movff char_O_deco_depth+1,lo 726 movff char_O_deco_depth+1,lo
669 tstfsz lo ; Show another stop? 727 tstfsz lo ; Show another stop?
670 bra TFT_display_deko2 ; Yes 728 bra TFT_display_deko2 ; Yes
671 ; No, clear output and return 729 ; No, clear output and return
672 call TFT_standard_color 730 call TFT_standard_color
673 WIN_SMALL decostop_4th_stop_column,decostop_4th_stop_row 731 WIN_SMALL dm_cust_dstop_4th_stop_column,dm_cust_dstop_4th_stop_row
674 STRCPY_PRINT " --- " 732 STRCPY_PRINT " --- "
675 WIN_BOX_BLACK decostop_2nd_stop_row, divemode_simtext_row-1, decostop_2nd_stop_column, decostop_4th_stop_column ; top, bottom, left, right 733 WIN_BOX_BLACK dm_cust_dstop_2nd_stop_row, dm_customview_bot, dm_cust_dstop_2nd_stop_column, dm_cust_dstop_4th_stop_column ; top, bottom, left, right
676 WIN_BOX_BLACK decostop_5th_stop_row, divemode_simtext_row-1, decostop_5th_stop_column, decostop_6th_stop_column ; top, bottom, left, right 734 WIN_BOX_BLACK dm_cust_dstop_5th_stop_row, dm_customview_bot, dm_cust_dstop_5th_stop_column, dm_cust_dstop_6th_stop_column ; top, bottom, left, right
677 WIN_BOX_BLACK decostop_6th_stop_row, divemode_simtext_row-1, decostop_6th_stop_column, .159 ; top, bottom, left, right 735 WIN_BOX_BLACK dm_cust_dstop_6th_stop_row, dm_customview_bot, dm_cust_dstop_6th_stop_column, .159 ; top, bottom, left, right
678 return 736 return
679 TFT_display_deko2: 737 TFT_display_deko2:
680 WIN_SMALL decostop_2nd_stop_column,decostop_2nd_stop_row 738 WIN_SMALL dm_cust_dstop_2nd_stop_column, dm_cust_dstop_2nd_stop_row
681 movff char_O_deco_depth+1,lo ; stop in m 739 movff char_O_deco_depth+1,lo ; stop in m
682 bcf lo,7 ; Clear GAS_SWITCH bit 740 bcf lo,7 ; Clear GAS_SWITCH bit
683 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) 741 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
684 movff char_O_deco_time+1,lo ; length of stop in min 742 movff char_O_deco_time+1,lo ; length of stop in min
685 output_99 743 output_99
686 STRCAT_PRINT "'" 744 STRCAT_PRINT "'"
687 movff char_O_deco_depth+2,lo 745 movff char_O_deco_depth+2,lo
688 tstfsz lo ; Show another stop? 746 tstfsz lo ; Show another stop?
689 bra TFT_display_deko3 ; Yes 747 bra TFT_display_deko3 ; Yes
690 ; No, clear output and return 748 ; No, clear output and return
691 WIN_BOX_BLACK decostop_3rd_stop_row, divemode_simtext_row-1, decostop_2nd_stop_column, decostop_4th_stop_column ; top, bottom, left, right 749 WIN_BOX_BLACK dm_cust_dstop_3rd_stop_row, dm_customview_bot, dm_cust_dstop_2nd_stop_column, dm_cust_dstop_4th_stop_column ; top, bottom, left, right
692 WIN_BOX_BLACK decostop_4th_stop_row, divemode_simtext_row-1, decostop_4th_stop_column, .159 ; top, bottom, left, right 750 WIN_BOX_BLACK dm_cust_dstop_4th_stop_row, dm_customview_bot, dm_cust_dstop_4th_stop_column, .159 ; top, bottom, left, right
693 return 751 return
694 752
695 TFT_display_deko3: 753 TFT_display_deko3:
696 WIN_SMALL decostop_3rd_stop_column,decostop_3rd_stop_row 754 WIN_SMALL dm_cust_dstop_3rd_stop_column, dm_cust_dstop_3rd_stop_row
697 movff char_O_deco_depth+2,lo ; stop in m 755 movff char_O_deco_depth+2,lo ; stop in m
698 bcf lo,7 ; Clear GAS_SWITCH bit 756 bcf lo,7 ; Clear GAS_SWITCH bit
699 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) 757 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
700 movff char_O_deco_time+2,lo ; length of stop in min 758 movff char_O_deco_time+2,lo ; length of stop in min
701 output_99 759 output_99
703 761
704 movff char_O_deco_depth+3,lo 762 movff char_O_deco_depth+3,lo
705 tstfsz lo ; Show another stop? 763 tstfsz lo ; Show another stop?
706 bra TFT_display_deko4 ; Yes 764 bra TFT_display_deko4 ; Yes
707 ; No, clear output and return 765 ; No, clear output and return
708 WIN_BOX_BLACK decostop_4th_stop_row, divemode_simtext_row-1, decostop_4th_stop_column, .159 ; top, bottom, left, right 766 WIN_BOX_BLACK dm_cust_dstop_4th_stop_row, dm_customview_bot, dm_cust_dstop_4th_stop_column, .159 ; top, bottom, left, right
709 return ; Done. 767 return ; Done.
710 768
711 TFT_display_deko4: 769 TFT_display_deko4:
712 WIN_SMALL decostop_4th_stop_column,decostop_4th_stop_row 770 WIN_SMALL dm_cust_dstop_4th_stop_column, dm_cust_dstop_4th_stop_row
713 movff char_O_deco_depth+3,lo ; stop in m 771 movff char_O_deco_depth+3,lo ; stop in m
714 bcf lo,7 ; Clear GAS_SWITCH bit 772 bcf lo,7 ; Clear GAS_SWITCH bit
715 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) 773 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
716 movff char_O_deco_time+3,lo ; length of stop in min 774 movff char_O_deco_time+3,lo ; length of stop in min
717 output_99 775 output_99
719 777
720 movff char_O_deco_depth+4,lo 778 movff char_O_deco_depth+4,lo
721 tstfsz lo ; Show another stop? 779 tstfsz lo ; Show another stop?
722 bra TFT_display_deko5 ; Yes 780 bra TFT_display_deko5 ; Yes
723 ; No, clear output and return 781 ; No, clear output and return
724 WIN_BOX_BLACK decostop_5th_stop_row, divemode_simtext_row-1, decostop_5th_stop_column, decostop_6th_stop_column ; top, bottom, left, right 782 WIN_BOX_BLACK dm_cust_dstop_5th_stop_row, dm_customview_bot, dm_cust_dstop_5th_stop_column, dm_cust_dstop_6th_stop_column ; top, bottom, left, right
725 WIN_BOX_BLACK decostop_6th_stop_row, divemode_simtext_row-1, decostop_6th_stop_column, .159 ; top, bottom, left, right 783 WIN_BOX_BLACK dm_cust_dstop_6th_stop_row, dm_customview_bot, dm_cust_dstop_6th_stop_column, .159 ; top, bottom, left, right
726 return ; Done. 784 return ; Done.
727 785
728 TFT_display_deko5: 786 TFT_display_deko5:
729 WIN_SMALL decostop_5th_stop_column,decostop_5th_stop_row 787 WIN_SMALL dm_cust_dstop_5th_stop_column, dm_cust_dstop_5th_stop_row
730 movff char_O_deco_depth+4,lo ; stop in m 788 movff char_O_deco_depth+4,lo ; stop in m
731 bcf lo,7 ; Clear GAS_SWITCH bit 789 bcf lo,7 ; Clear GAS_SWITCH bit
732 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) 790 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
733 movff char_O_deco_time+4,lo ; length of stop in min 791 movff char_O_deco_time+4,lo ; length of stop in min
734 output_99 792 output_99
735 STRCAT_PRINT "'" 793 STRCAT_PRINT "'"
736 movff char_O_deco_depth+5,lo 794 movff char_O_deco_depth+5,lo
737 tstfsz lo ; Show another stop? 795 tstfsz lo ; Show another stop?
738 bra TFT_display_deko6 ; Yes 796 bra TFT_display_deko6 ; Yes
739 ; No, clear output and return 797 ; No, clear output and return
740 WIN_BOX_BLACK decostop_6th_stop_row, divemode_simtext_row-1, decostop_6th_stop_column, .159 ; top, bottom, left, right 798 WIN_BOX_BLACK dm_cust_dstop_6th_stop_row, dm_customview_bot, dm_cust_dstop_6th_stop_column, .159 ; top, bottom, left, right
741 return ; Done. 799 return ; Done.
742 TFT_display_deko6: 800 TFT_display_deko6:
743 WIN_SMALL decostop_6th_stop_column,decostop_6th_stop_row 801 WIN_SMALL dm_cust_dstop_6th_stop_column, dm_cust_dstop_6th_stop_row
744 movff char_O_deco_depth+5,lo ; stop in m 802 movff char_O_deco_depth+5,lo ; stop in m
745 bcf lo,7 ; Clear GAS_SWITCH bit 803 bcf lo,7 ; Clear GAS_SWITCH bit
746 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) 804 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
747 movff char_O_deco_time+5,lo ; length of stop in min 805 movff char_O_deco_time+5,lo ; length of stop in min
748 output_99 806 output_99
749 STRCAT_PRINT "'" 807 STRCAT_PRINT "'"
750 movff char_O_deco_depth+6,lo 808 movff char_O_deco_depth+6,lo
751 tstfsz lo ; Show another stop? 809 tstfsz lo ; Show another stop?
752 bra TFT_display_deko7 ; Yes 810 bra TFT_display_deko7 ; Yes
753 ; No, clear output and return 811 ; No, clear output and return
754 WIN_BOX_BLACK decostop_7th_stop_row, divemode_simtext_row-1, decostop_7th_stop_column, .159 ; top, bottom, left, right 812 WIN_BOX_BLACK dm_cust_dstop_7th_stop_row, dm_customview_bot, dm_cust_dstop_7th_stop_column, .159 ; top, bottom, left, right
755 return ; Done. 813 return ; Done.
756 TFT_display_deko7: 814 TFT_display_deko7:
757 WIN_SMALL decostop_7th_stop_column,decostop_7th_stop_row 815 WIN_SMALL dm_cust_dstop_7th_stop_column, dm_cust_dstop_7th_stop_row
758 movff char_O_deco_depth+6,lo ; stop in m 816 movff char_O_deco_depth+6,lo ; stop in m
759 bcf lo,7 ; Clear GAS_SWITCH bit 817 bcf lo,7 ; Clear GAS_SWITCH bit
760 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft) 818 rcall TFT_display_deko_output_depth ; Outputs depth (stored in lo) to POSTINC2 with "m" or w/o (For ft)
761 movff char_O_deco_time+6,lo ; length of stop in min 819 movff char_O_deco_time+6,lo ; length of stop in min
762 output_99 820 output_99
772 ; bra TFT_display_ndl_mask2 ; Clear gradient factor 830 ; bra TFT_display_ndl_mask2 ; Clear gradient factor
773 ; 831 ;
774 832
775 global TFT_clear_safety_stop 833 global TFT_clear_safety_stop
776 TFT_clear_safety_stop: 834 TFT_clear_safety_stop:
777 WIN_BOX_BLACK safetystop_text_row, ndl_text_row-.4, safetystop_text_column, .159 ; top, bottom, left, right 835 WIN_BOX_BLACK dm_safetystop_row, dm_safetystop_bot, dm_safetystop_text_column, .159 ; top, bottom, left, right
778 return 836 return
779 837
780 global TFT_show_safety_stop 838 global TFT_show_safety_stop
781 TFT_show_safety_stop: 839 TFT_show_safety_stop:
782 tstfsz safety_stop_countdown ; Countdown at zero? 840 tstfsz safety_stop_countdown ; Countdown at zero?
796 bsf safety_stop_active ; Set flag 854 bsf safety_stop_active ; Set flag
797 decf safety_stop_countdown,F ; Reduce countdown 855 decf safety_stop_countdown,F ; Reduce countdown
798 856
799 btfsc divemode_menu ; Is the dive mode menu shown? 857 btfsc divemode_menu ; Is the dive mode menu shown?
800 return ; Yes, return 858 return ; Yes, return
801 btfsc menuview 859 ;btfsc menuview
802 bra TFT_show_safety_stop3 ; No room when menuview=1... 860 ;bra TFT_show_safety_stop3 ; No room when menuview=1...
803 861 if dm_offset != 0
804 rcall TFT_divemask_color 862 call TFT_divemask_color
805 WIN_STD safetystop_text_column,safetystop_text_row 863 else
864 call TFT_standard_color
865 endif
866 WIN_STD dm_safetystop_text_column, dm_safetystop_text_row
806 STRCPY_TEXT_PRINT tDiveSafetyStop 867 STRCPY_TEXT_PRINT tDiveSafetyStop
807 TFT_show_safety_stop3: 868 TFT_show_safety_stop3:
808 rcall TFT_attention_color ; show in yellow 869 call TFT_attention_color ; show in yellow
809 WIN_MEDIUM safetystop_column,safetystop_row 870 WIN_MEDIUM dm_safetystop_column, dm_safetystop_row
810 lfsr FSR2,buffer 871 lfsr FSR2,buffer
811 movff safety_stop_countdown,lo 872 movff safety_stop_countdown,lo
812 clrf hi 873 clrf hi
813 call convert_time ; converts hi:lo in seconds to mins (hi) and seconds (lo) 874 call convert_time ; converts hi:lo in seconds to mins (hi) and seconds (lo)
814 movf hi,W 875 movf hi,W
820 PUTC ':' 881 PUTC ':'
821 movff hi,lo 882 movff hi,lo
822 output_99x 883 output_99x
823 STRCAT_PRINT "" 884 STRCAT_PRINT ""
824 WIN_FONT FT_SMALL 885 WIN_FONT FT_SMALL
825 rcall TFT_standard_color 886 call TFT_standard_color
826 return 887 return
827 888
828 global TFT_mask_avr_stopwatch ; Show mask for average depth and stopwatch 889 global TFT_mask_avr_stopwatch ; Show mask for average depth and stopwatch
829 TFT_mask_avr_stopwatch: 890 TFT_mask_avr_stopwatch:
830 ; The mask 891 ; The mask
831 call TFT_divemask_color 892 call TFT_divemask_color
832 WIN_TINY dive_custom_avr_stop_column1,dive_custom_avr_stop_row 893 WIN_TINY dm_custom_avr_stop_title_column1,dm_custom_avr_stop_title_row
833 STRCPY_TEXT_PRINT tDiveTotalAvr 894 STRCPY_TEXT_PRINT tDiveTotalAvr
834 WIN_TINY dive_custom_avr_stop_column2,dive_custom_avr_stop_row 895 WIN_TINY dm_custom_avr_stop_title_column2,dm_custom_avr_stop_title_row
835 STRCPY_TEXT_PRINT tDiveStopwatch 896 STRCPY_TEXT_PRINT tDiveStopwatch
836 WIN_TINY dive_custom_avr_stop_column3,dive_custom_avr_stop_row 897 WIN_TINY dm_custom_avr_stop_title_column3,dm_custom_avr_stop_title_row
837 STRCPY_TEXT_PRINT tDiveStopAvr 898 STRCPY_TEXT_PRINT tDiveStopAvr
838 call TFT_standard_color 899 call TFT_standard_color
839 return 900 return
840 901
841 global TFT_dyn_gaslist 902 global TFT_dyn_gaslist
842 TFT_dyn_gaslist: ; Show the dynamic gaslist 903 TFT_dyn_gaslist: ; Show the dynamic gaslist
843 ; The mask 904 ; The mask
844 call TFT_divemask_color 905 call TFT_divemask_color
845 WIN_TINY dive_custom_dyn_mask_column,dive_custom_dyn_mask_row 906 WIN_TINY dm_custom_dyn_gas_mask_column,dm_custom_dyn_gas_mask_row
846 STRCPY_TEXT_PRINT tGaslist 907 STRCPY_TEXT_PRINT tGaslist
847 ; call TFT_standard_color 908 ; call TFT_standard_color
848 909
849 WIN_SMALL dive_custom_dyn_mask_column1,dive_custom_dyn_mask_row1 910 WIN_SMALL dm_custom_dyn_gas_column1,dm_custom_dyn_gas_row1
850 movlw .1 911 movlw .1
851 movwf uart1_temp 912 movwf uart1_temp
852 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint 913 bsf short_gas_decriptions ; =1: Use short versions of gaslist_strcat_gas_mod and gaslist_strcat_setpoint
853 rcall TFT_dyn_gaslist_common 914 rcall TFT_dyn_gaslist_common
854 WIN_SMALL dive_custom_dyn_mask_column1,dive_custom_dyn_mask_row2 915 WIN_SMALL dm_custom_dyn_gas_column1,dm_custom_dyn_gas_row2
855 incf uart1_temp,F ; +1 916 incf uart1_temp,F ; +1
856 movf uart1_temp,W ; into W 917 movf uart1_temp,W ; into W
857 rcall TFT_dyn_gaslist_common 918 rcall TFT_dyn_gaslist_common
858 WIN_SMALL dive_custom_dyn_mask_column2,dive_custom_dyn_mask_row1 919 WIN_SMALL dm_custom_dyn_gas_column2,dm_custom_dyn_gas_row1
859 incf uart1_temp,F ; +1 920 incf uart1_temp,F ; +1
860 movf uart1_temp,W ; into W 921 movf uart1_temp,W ; into W
861 rcall TFT_dyn_gaslist_common 922 rcall TFT_dyn_gaslist_common
862 WIN_SMALL dive_custom_dyn_mask_column2,dive_custom_dyn_mask_row2 923 WIN_SMALL dm_custom_dyn_gas_column2,dm_custom_dyn_gas_row2
863 incf uart1_temp,F ; +1 924 incf uart1_temp,F ; +1
864 movf uart1_temp,W ; into W 925 movf uart1_temp,W ; into W
865 rcall TFT_dyn_gaslist_common 926 rcall TFT_dyn_gaslist_common
866 call TFT_standard_color 927 call TFT_standard_color
867 return 928 return
889 global TFT_update_avr_stopwatch ; Update average depth and stopwatch 950 global TFT_update_avr_stopwatch ; Update average depth and stopwatch
890 TFT_update_avr_stopwatch: 951 TFT_update_avr_stopwatch:
891 call TFT_standard_color 952 call TFT_standard_color
892 SAFE_2BYTE_COPY average_divesecs,lo 953 SAFE_2BYTE_COPY average_divesecs,lo
893 call convert_time ; lo=secs, hi=mins 954 call convert_time ; lo=secs, hi=mins
894 WIN_MEDIUM dive_avr_stop_column2,dive_avr_stop_row 955 WIN_MEDIUM dm_custom_avr_stop_column2,dm_custom_avr_stop_row
895 bsf leftbind 956 bsf leftbind
896 movf hi,W 957 movf hi,W
897 movff lo,hi 958 movff lo,hi
898 movwf lo ; exchange lo and hi 959 movwf lo ; exchange lo and hi
899 output_8 960 output_8
911 ;TFT_update_avr_stopwatch_imperial 972 ;TFT_update_avr_stopwatch_imperial
912 movff avr_rel_pressure_total+0,lo 973 movff avr_rel_pressure_total+0,lo
913 movff avr_rel_pressure_total+1,hi 974 movff avr_rel_pressure_total+1,hi
914 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 975 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
915 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet 976 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
916 WIN_MEDIUM dive_avr_stop_column1,dive_avr_stop_row 977 WIN_MEDIUM dm_custom_avr_stop_column1,dm_custom_avr_stop_row
917 bsf leftbind 978 bsf leftbind
918 output_16 ; yxz 979 output_16 ; yxz
919 STRCAT_PRINT " " 980 STRCAT_PRINT " "
920 ; Stopped average depth 981 ; Stopped average depth
921 movff avr_rel_pressure+0,lo 982 movff avr_rel_pressure+0,lo
922 movff avr_rel_pressure+1,hi 983 movff avr_rel_pressure+1,hi
923 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 984 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
924 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet 985 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
925 WIN_MEDIUM dive_avr_stop_column3,dive_avr_stop_row 986 WIN_MEDIUM dm_custom_avr_stop_column3,dm_custom_avr_stop_row
926 output_16 ; yxz 987 output_16 ; yxz
927 bcf leftbind 988 bcf leftbind
928 STRCAT_PRINT " " 989 STRCAT_PRINT " "
929 return 990 return
930 991
931 TFT_update_avr_stopwatch_metric: 992 TFT_update_avr_stopwatch_metric:
932 ; Non-resettable average depth 993 ; Non-resettable average depth
933 movff avr_rel_pressure_total+0,lo 994 movff avr_rel_pressure_total+0,lo
934 movff avr_rel_pressure_total+1,hi 995 movff avr_rel_pressure_total+1,hi
935 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 996 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
936 WIN_MEDIUM dive_avr_stop_column1,dive_avr_stop_row 997 WIN_MEDIUM dm_custom_avr_stop_column1,dm_custom_avr_stop_row
937 bsf ignore_digit5 ; no cm 998 bsf ignore_digit5 ; no cm
938 output_16dp .3 ; yxz.a 999 output_16dp .3 ; yxz.a
939 STRCAT_PRINT " " 1000 STRCAT_PRINT " "
940 ; Stopped average depth 1001 ; Stopped average depth
941 movff avr_rel_pressure+0,lo 1002 movff avr_rel_pressure+0,lo
942 movff avr_rel_pressure+1,hi 1003 movff avr_rel_pressure+1,hi
943 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 1004 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
944 WIN_MEDIUM dive_avr_stop_column3,dive_avr_stop_row 1005 WIN_MEDIUM dm_custom_avr_stop_column3,dm_custom_avr_stop_row
945 bsf ignore_digit5 ; no cm 1006 bsf ignore_digit5 ; no cm
946 output_16dp .3 ; yxz.a 1007 output_16dp .3 ; yxz.a
947 bcf leftbind 1008 bcf leftbind
948 bcf ignore_digit5 1009 bcf ignore_digit5
949 STRCAT_PRINT " " 1010 STRCAT_PRINT " "
950 return 1011 return
951 1012
952 global TFT_ceiling_mask ; The ceiling mask 1013 global TFT_ceiling_mask ; The ceiling mask
953 TFT_ceiling_mask: 1014 TFT_ceiling_mask:
954 call TFT_divemask_color 1015 call TFT_divemask_color
955 WIN_TINY dive_ceiling_text_column,dive_ceiling_text_row 1016 WIN_TINY dm_custom_ceiling_text_column,dm_custom_ceiling_text_row
956 STRCPY_TEXT_PRINT tCeiling 1017 STRCPY_TEXT_PRINT tCeiling
957 call TFT_standard_color 1018 call TFT_standard_color
958 return 1019 return
959 1020
960 global TFT_ceiling ; Ceiling 1021 global TFT_ceiling ; Ceiling
961 TFT_ceiling: 1022 TFT_ceiling:
962 call TFT_standard_color 1023 call TFT_standard_color
963 WIN_MEDIUM dive_ceiling_value_column,dive_ceiling_value_row 1024 WIN_MEDIUM dm_custom_ceiling_value_column,dm_custom_ceiling_value_row
964 movff int_O_ceiling+0,lo 1025 movff int_O_ceiling+0,lo
965 movff int_O_ceiling+1,hi 1026 movff int_O_ceiling+1,hi
966 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 1027 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
967 bsf leftbind 1028 bsf leftbind
968 TSTOSS opt_units ; 0=m, 1=ft 1029 TSTOSS opt_units ; 0=m, 1=ft
983 return 1044 return
984 1045
985 global TFT_hud_mask ; The HUD mask 1046 global TFT_hud_mask ; The HUD mask
986 TFT_hud_mask: 1047 TFT_hud_mask:
987 call TFT_divemask_color 1048 call TFT_divemask_color
988 WIN_TINY dive_custom_hud_column1,dive_custom_hud_row 1049 WIN_TINY dm_custom_hud_column1,dm_custom_hud_row
989 STRCPY_TEXT_PRINT tDiveHudMask1 1050 STRCPY_TEXT_PRINT tDiveHudMask1
990 WIN_TINY dive_custom_hud_column2,dive_custom_hud_row 1051 WIN_TINY dm_custom_hud_column2,dm_custom_hud_row
991 STRCPY_TEXT_PRINT tDiveHudMask2 1052 STRCPY_TEXT_PRINT tDiveHudMask2
992 WIN_TINY dive_custom_hud_column3,dive_custom_hud_row 1053 WIN_TINY dm_custom_hud_column3,dm_custom_hud_row
993 STRCPY_TEXT_PRINT tDiveHudMask3 1054 STRCPY_TEXT_PRINT tDiveHudMask3
994 call TFT_standard_color 1055 call TFT_standard_color
995 return 1056 return
996 1057
997 global TFT_hud_voltages 1058 global TFT_hud_voltages
998 TFT_hud_voltages: ; Show HUD details 1059 TFT_hud_voltages: ; Show HUD details
999 WIN_SMALL .5,dive_hud_data_row 1060 WIN_SMALL dm_custom_hud_sensor1_column,dm_custom_hud_data_row
1000 call TFT_standard_color 1061 call TFT_standard_color
1001 btfss use_O2_sensor1 1062 btfss use_O2_sensor1
1002 call TFT_warnings_color 1063 call TFT_warnings_color
1003 movff o2_mv_sensor1+0,lo 1064 movff o2_mv_sensor1+0,lo
1004 movff o2_mv_sensor1+1,hi 1065 movff o2_mv_sensor1+1,hi
1005 bsf leftbind 1066 bsf leftbind
1006 output_16dp .4 ; x.xx 1067 output_16dp .4 ; x.xx
1007 bcf leftbind 1068 bcf leftbind
1008 STRCAT_PRINT "mV " 1069 STRCAT_PRINT "mV "
1009 WIN_SMALL .55,dive_hud_data_row 1070 WIN_SMALL dm_custom_hud_sensor2_column,dm_custom_hud_data_row
1010 call TFT_standard_color 1071 call TFT_standard_color
1011 btfss use_O2_sensor2 1072 btfss use_O2_sensor2
1012 call TFT_warnings_color 1073 call TFT_warnings_color
1013 movff o2_mv_sensor2+0,lo 1074 movff o2_mv_sensor2+0,lo
1014 movff o2_mv_sensor2+1,hi 1075 movff o2_mv_sensor2+1,hi
1015 bsf leftbind 1076 bsf leftbind
1016 output_16dp .4 ; x.xx 1077 output_16dp .4 ; x.xx
1017 bcf leftbind 1078 bcf leftbind
1018 STRCAT_PRINT "mV " 1079 STRCAT_PRINT "mV "
1019 WIN_SMALL .105,dive_hud_data_row 1080 WIN_SMALL dm_custom_hud_sensor3_column,dm_custom_hud_data_row
1020 call TFT_standard_color 1081 call TFT_standard_color
1021 btfss use_O2_sensor3 1082 btfss use_O2_sensor3
1022 call TFT_warnings_color 1083 call TFT_warnings_color
1023 movff o2_mv_sensor3+0,lo 1084 movff o2_mv_sensor3+0,lo
1024 movff o2_mv_sensor3+1,hi 1085 movff o2_mv_sensor3+1,hi
1036 btfsc use_O2_sensor1 ; Use Sensor 1? 1097 btfsc use_O2_sensor1 ; Use Sensor 1?
1037 bra TFT_update_hud1 ; Yes 1098 bra TFT_update_hud1 ; Yes
1038 btfss dive_hud1_displayed ; Was the sensor shown? 1099 btfss dive_hud1_displayed ; Was the sensor shown?
1039 bra TFT_update_hud2 ; Yes, skip clear 1100 bra TFT_update_hud2 ; Yes, skip clear
1040 bcf dive_hud1_displayed ; No, clear display flag 1101 bcf dive_hud1_displayed ; No, clear display flag
1041 WIN_BOX_BLACK dive_hud_data_row, dive_hud_data_row+.31, dive_hud_sensor1_column, dive_hud_sensor2_column ; top, bottom, left, right 1102 WIN_BOX_BLACK dm_custom_hud_data_row, dm_customview_bot, dm_custom_hud_sensor1_column, dm_custom_hud_sensor2_column ; top, bottom, left, right
1042 WIN_STD dive_hud_sensor1_column+.7,dive_hud_data_row+.5 1103 WIN_STD dm_custom_hud_sensor1_column+.7, dm_custom_hud_data_row+.5
1043 call TFT_standard_color 1104 call TFT_standard_color
1044 STRCPY_PRINT "---" 1105 STRCPY_PRINT "---"
1045 bra TFT_update_hud2 ; Skip Sensor 1 1106 bra TFT_update_hud2 ; Skip Sensor 1
1046 TFT_update_hud1: 1107 TFT_update_hud1:
1047 WIN_MEDIUM dive_hud_sensor1_column,dive_hud_data_row 1108 WIN_MEDIUM dm_custom_hud_sensor1_column,dm_custom_hud_data_row
1048 movff o2_ppo2_sensor1,lo 1109 movff o2_ppo2_sensor1,lo
1049 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo 1110 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo
1050 btfss voting_logic_sensor1 ; Sensor within voting logic? 1111 btfss voting_logic_sensor1 ; Sensor within voting logic?
1051 bsf win_invert ; No, invert output... 1112 bsf win_invert ; No, invert output...
1052 btfss voting_logic_sensor1 1113 btfss voting_logic_sensor1
1060 btfsc use_O2_sensor2 ; Use Sensor 2? 1121 btfsc use_O2_sensor2 ; Use Sensor 2?
1061 bra TFT_update_hud3 ; Yes 1122 bra TFT_update_hud3 ; Yes
1062 btfss dive_hud2_displayed ; Was the sensor shown? 1123 btfss dive_hud2_displayed ; Was the sensor shown?
1063 bra TFT_update_hud4 ; Yes, skip clear 1124 bra TFT_update_hud4 ; Yes, skip clear
1064 bcf dive_hud2_displayed ; No, clear display flag 1125 bcf dive_hud2_displayed ; No, clear display flag
1065 WIN_BOX_BLACK dive_hud_data_row, dive_hud_data_row+.31, dive_hud_sensor2_column, dive_hud_sensor3_column ; top, bottom, left, right 1126 WIN_BOX_BLACK dm_custom_hud_data_row, dm_customview_bot, dm_custom_hud_sensor2_column, dm_custom_hud_sensor3_column ; top, bottom, left, right
1066 WIN_STD dive_hud_sensor2_column+.7,dive_hud_data_row+.5 1127 WIN_STD dm_custom_hud_sensor2_column+.7, dm_custom_hud_data_row+.5
1067 call TFT_standard_color 1128 call TFT_standard_color
1068 STRCPY_PRINT "---" 1129 STRCPY_PRINT "---"
1069 bra TFT_update_hud4 ; Skip Sensor 2 1130 bra TFT_update_hud4 ; Skip Sensor 2
1070 TFT_update_hud3: 1131 TFT_update_hud3:
1071 WIN_MEDIUM dive_hud_sensor2_column,dive_hud_data_row 1132 WIN_MEDIUM dm_custom_hud_sensor2_column,dm_custom_hud_data_row
1072 movff o2_ppo2_sensor2,lo 1133 movff o2_ppo2_sensor2,lo
1073 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo 1134 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo
1074 btfss voting_logic_sensor2 ; Sensor within voting logic? 1135 btfss voting_logic_sensor2 ; Sensor within voting logic?
1075 bsf win_invert ; No, invert output... 1136 bsf win_invert ; No, invert output...
1076 btfss voting_logic_sensor2 1137 btfss voting_logic_sensor2
1084 btfsc use_O2_sensor3 ; Use Sensor 3? 1145 btfsc use_O2_sensor3 ; Use Sensor 3?
1085 bra TFT_update_hud5 ; Yes 1146 bra TFT_update_hud5 ; Yes
1086 btfss dive_hud3_displayed ; Was the sensor shown? 1147 btfss dive_hud3_displayed ; Was the sensor shown?
1087 bra TFT_update_hud6 ; Yes, skip clear 1148 bra TFT_update_hud6 ; Yes, skip clear
1088 bcf dive_hud3_displayed ; No, clear display flag 1149 bcf dive_hud3_displayed ; No, clear display flag
1089 WIN_BOX_BLACK dive_hud_data_row, dive_hud_data_row+.31, dive_hud_sensor3_column, .159 ; top, bottom, left, right 1150 WIN_BOX_BLACK dm_custom_hud_data_row, dm_customview_bot, dm_custom_hud_sensor3_column, .159 ; top, bottom, left, right
1090 WIN_STD dive_hud_sensor3_column+.7,dive_hud_data_row+.5 1151 WIN_STD dm_custom_hud_sensor3_column+.7, dm_custom_hud_data_row+.5
1091 call TFT_standard_color 1152 call TFT_standard_color
1092 STRCPY_PRINT "---" 1153 STRCPY_PRINT "---"
1093 bra TFT_update_hud6 ; Skip Sensor 3 1154 bra TFT_update_hud6 ; Skip Sensor 3
1094 TFT_update_hud5: 1155 TFT_update_hud5:
1095 WIN_MEDIUM dive_hud_sensor3_column,dive_hud_data_row 1156 WIN_MEDIUM dm_custom_hud_sensor3_column,dm_custom_hud_data_row
1096 movff o2_ppo2_sensor3,lo 1157 movff o2_ppo2_sensor3,lo
1097 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo 1158 TFT_color_code warn_ppo2_hud ; With ppO2 [cbar] in lo
1098 btfss voting_logic_sensor3 ; Sensor within voting logic? 1159 btfss voting_logic_sensor3 ; Sensor within voting logic?
1099 bsf win_invert ; No, invert output... 1160 bsf win_invert ; No, invert output...
1100 btfss voting_logic_sensor3 1161 btfss voting_logic_sensor3
1390 movwf lo ; exchange lo and hi 1451 movwf lo ; exchange lo and hi
1391 output_99x 1452 output_99x
1392 PUTC ':' 1453 PUTC ':'
1393 movff hi,lo 1454 movff hi,lo
1394 output_99x 1455 output_99x
1395 movlw warning_length ; Divemode string length 1456 movlw dm_warning_length ; Divemode string length
1396 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 1457 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
1397 STRCAT_PRINT "" 1458 STRCAT_PRINT ""
1398 return 1459 return
1399 1460
1400 global TFT_ftts 1461 global TFT_ftts
1401 TFT_ftts: 1462 TFT_ftts:
1402 movff char_I_extra_time,lo 1463 movff char_I_extra_time,lo
1403 tstfsz lo 1464 tstfsz lo
1404 bra $+4 1465 bra $+4
1405 return ; char_I_extra_time=0, return. 1466 return ; char_I_extra_time=0, return.
1406 incf warning_counter,F ; increase counter 1467
1407 call TFT_warning_set_window ; Sets the row and column for the current warning 1468 if dm_offset !=0
1408 tstfsz WREG ; Is there room for the warning? 1469 incf warning_counter,F ; increase counter
1409 return ; No 1470 call TFT_warning_set_window ; Sets the row and column for the current warning
1471 tstfsz WREG ; Is there room for the warning?
1472 return ; No
1473 else
1474 call TFT_standard_color
1475 WIN_SMALL dm_ftts_value_column, dm_ftts_value_row
1476 endif
1477
1410 movff char_I_extra_time,lo 1478 movff char_I_extra_time,lo
1411 STRCPY "@+" 1479 STRCPY "@+"
1412 bsf leftbind 1480 bsf leftbind
1413 output_8 1481 output_8
1414 PUTC ":" 1482 PUTC ":"
1422 incf WREG,w 1490 incf WREG,w
1423 bz TFT_ftts2 ; Wait... 1491 bz TFT_ftts2 ; Wait...
1424 output_16 1492 output_16
1425 bcf leftbind 1493 bcf leftbind
1426 PUTC "'" 1494 PUTC "'"
1427 movlw warning_length ; Divemode string length 1495 movlw dm_warning_length ; Divemode string length
1428 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 1496 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
1429 STRCAT_PRINT "" 1497 STRCAT_PRINT ""
1430 return 1498 return
1431 1499
1432 TFT_ftts2: 1500 TFT_ftts2:
1433 STRCAT "---" 1501 STRCAT "---"
1434 bcf leftbind 1502 bcf leftbind
1435 movlw warning_length ; Divemode string length 1503 movlw dm_warning_length ; Divemode string length
1436 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 1504 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
1437 STRCAT_PRINT "" 1505 STRCAT_PRINT ""
1438 return 1506 return
1439 1507
1440 1508
1495 return 1563 return
1496 1564
1497 ;============================================================================= 1565 ;=============================================================================
1498 global TFT_divemode_menu_cursor 1566 global TFT_divemode_menu_cursor
1499 TFT_divemode_menu_cursor: 1567 TFT_divemode_menu_cursor:
1500 WIN_BOX_BLACK divemode_menu_item1_row,divemode_menu_item3_row+.24,divemode_menu_item1_column-.8,divemode_menu_item1_column-.1 1568 WIN_BOX_BLACK dm_menu_row+.1, dm_menu_lower-.1, dm_menu_item1_column-.8, dm_menu_item1_column-.1
1501 WIN_BOX_BLACK divemode_menu_item4_row,divemode_menu_item6_row+.24,divemode_menu_item4_column-.8,divemode_menu_item4_column-.1 1569 WIN_BOX_BLACK dm_menu_row+.1, dm_menu_lower-.1, dm_menu_item4_column-.8, dm_menu_item4_column-.1
1502 call TFT_standard_color 1570 call TFT_standard_color
1503 1571
1504 movlw divemode_menu_item1_column-.8 1572 movlw dm_menu_item1_column-.8
1505 btfsc menupos,2 ; >3? 1573 btfsc menupos,2 ; >3?
1506 movlw divemode_menu_item4_column-.8 ; Yes 1574 movlw dm_menu_item4_column-.8 ; Yes
1507 movff WREG,win_leftx2 1575 movff WREG,win_leftx2
1508 1576
1509 movff menupos,lo ; Copy menu pos 1577 movff menupos,lo ; Copy menu pos
1510 movlw divemode_menu_item6_row 1578 movlw dm_menu_item6_row
1511 dcfsnz lo,F 1579 dcfsnz lo,F
1512 movlw divemode_menu_item1_row 1580 movlw dm_menu_item1_row
1513 dcfsnz lo,F 1581 dcfsnz lo,F
1514 movlw divemode_menu_item2_row 1582 movlw dm_menu_item2_row
1515 dcfsnz lo,F 1583 dcfsnz lo,F
1516 movlw divemode_menu_item3_row 1584 movlw dm_menu_item3_row
1517 dcfsnz lo,F 1585 dcfsnz lo,F
1518 movlw divemode_menu_item4_row 1586 movlw dm_menu_item4_row
1519 dcfsnz lo,F 1587 dcfsnz lo,F
1520 movlw divemode_menu_item5_row 1588 movlw dm_menu_item5_row
1521 movff WREG,win_top 1589 movff WREG,win_top
1522 movlw FT_SMALL 1590 movlw FT_SMALL
1523 movff WREG,win_font 1591 movff WREG,win_font
1524 STRCPY_PRINT "\xb7" ; print cursor 1592 STRCPY_PRINT "\xb7" ; print cursor
1525 return 1593 return
1529 btfsc divemode_menu ; Is the dive mode menu shown? 1597 btfsc divemode_menu ; Is the dive mode menu shown?
1530 return ; Yes, return 1598 return ; Yes, return
1531 btfsc blinking_better_gas ; blinking better Gas? 1599 btfsc blinking_better_gas ; blinking better Gas?
1532 return ; Yes, no update of temperature now 1600 return ; Yes, no update of temperature now
1533 ; temperature 1601 ; temperature
1534 WIN_SMALL dive_temp_column,dive_temp_row 1602 WIN_SMALL dm_temp_column,dm_temp_row
1535 call TFT_standard_color 1603 call TFT_standard_color
1536 bsf leftbind 1604 bsf leftbind
1537 1605
1538 SAFE_2BYTE_COPY temperature, lo 1606 SAFE_2BYTE_COPY temperature, lo
1539 TSTOSS opt_units ; 0=°C, 1=°F 1607 TSTOSS opt_units ; 0=°C, 1=°F
1575 PUTC "*" 1643 PUTC "*"
1576 STRCAT_PRINT "" 1644 STRCAT_PRINT ""
1577 return 1645 return
1578 1646
1579 TFT_active_setpoint: ; Show setpoint 1647 TFT_active_setpoint: ; Show setpoint
1580 WIN_STD active_gas_column,active_gas_row 1648 WIN_STD dm_active_gas_column, dm_active_gas_row
1581 call TFT_standard_color 1649 call TFT_standard_color
1582 btfsc is_bailout ; =1: Bailout 1650 btfsc is_bailout ; =1: Bailout
1583 bra TFT_active_setpoint_bail ; Show "Bailout" instead of Setpoint 1651 bra TFT_active_setpoint_bail ; Show "Bailout" instead of Setpoint
1584 1652
1585 rcall TFT_active_setpoint2 ; show setpoint (Non-Inverted in all cases) 1653 rcall TFT_active_setpoint2 ; show setpoint (Non-Inverted in all cases)
1591 bra TFT_active_setpoint_diluent ; Done. 1659 bra TFT_active_setpoint_diluent ; Done.
1592 1660
1593 movlw color_yellow ; Blink in yellow 1661 movlw color_yellow ; Blink in yellow
1594 call TFT_set_color 1662 call TFT_set_color
1595 bsf win_invert ; Set invert flag 1663 bsf win_invert ; Set invert flag
1596 WIN_STD active_gas_column,active_gas_row 1664 WIN_STD dm_active_gas_column, dm_active_gas_row
1597 movff char_I_const_ppO2,lo 1665 movff char_I_const_ppO2,lo
1598 clrf hi 1666 clrf hi
1599 bsf leftbind 1667 bsf leftbind
1600 output_16dp d'3' 1668 output_16dp d'3'
1601 bcf leftbind 1669 bcf leftbind
1606 STRCAT_PRINT "" 1674 STRCAT_PRINT ""
1607 bcf win_invert ; Reset invert flag 1675 bcf win_invert ; Reset invert flag
1608 1676
1609 TFT_active_setpoint_diluent: 1677 TFT_active_setpoint_diluent:
1610 call TFT_standard_color 1678 call TFT_standard_color
1611 WIN_SMALL active_dil_column,active_dil_row 1679 if dm_offset != 0
1680 WIN_SMALL dm_active_dil_column, dm_active_dil_row
1681 else
1682 WIN_STD dm_active_dil_column, dm_active_dil_row
1683 endif
1612 movff char_I_O2_ratio,lo ; lo now stores O2 in % 1684 movff char_I_O2_ratio,lo ; lo now stores O2 in %
1613 movff char_I_He_ratio,hi ; hi now stores He in % 1685 movff char_I_He_ratio,hi ; hi now stores He in %
1614 rcall TFT_show_dil_divemode2 ; Show diluent (Non-Inverted in all cases) 1686 rcall TFT_show_dil_divemode2 ; Show diluent (Non-Inverted in all cases)
1615 1687
1616 btfss better_gas_available ; =1: A better gas is available and a gas change is advised in divemode 1688 btfss better_gas_available ; =1: A better gas is available and a gas change is advised in divemode
1620 return ; No, Done. 1692 return ; No, Done.
1621 1693
1622 movlw color_yellow ; Blink in yellow 1694 movlw color_yellow ; Blink in yellow
1623 call TFT_set_color 1695 call TFT_set_color
1624 bsf win_invert ; Set invert flag 1696 bsf win_invert ; Set invert flag
1625 WIN_SMALL active_dil_column,active_dil_row 1697 if dm_offset != 0
1698 WIN_SMALL dm_active_dil_column, dm_active_dil_row
1699 else
1700 WIN_STD dm_active_dil_column, dm_active_dil_row
1701 endif
1626 movff char_I_O2_ratio,lo ; lo now stores O2 in % 1702 movff char_I_O2_ratio,lo ; lo now stores O2 in %
1627 movff char_I_He_ratio,hi ; hi now stores He in % 1703 movff char_I_He_ratio,hi ; hi now stores He in %
1628 rcall TFT_show_dil_divemode2 ; Show gas 1704 rcall TFT_show_dil_divemode2 ; Show gas
1629 bcf win_invert ; Reset invert flag 1705 bcf win_invert ; Reset invert flag
1630 call TFT_standard_color 1706 call TFT_standard_color
1647 return 1723 return
1648 btfsc FLAG_ccr_mode ; in CCR mode 1724 btfsc FLAG_ccr_mode ; in CCR mode
1649 bra TFT_active_setpoint ; Yes, show setpoint 1725 bra TFT_active_setpoint ; Yes, show setpoint
1650 1726
1651 call TFT_standard_color 1727 call TFT_standard_color
1652 WIN_STD active_gas_column,active_gas_row 1728 WIN_STD dm_active_gas_column, dm_active_gas_row
1653 movff char_I_O2_ratio,lo ; lo now stores O2 in % 1729 movff char_I_O2_ratio,lo ; lo now stores O2 in %
1654 movff char_I_He_ratio,hi ; hi now stores He in % 1730 movff char_I_He_ratio,hi ; hi now stores He in %
1655 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases) 1731 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases)
1656 btfss better_gas_available ; =1: A better gas is available and a gas change is advised in divemode 1732 btfss better_gas_available ; =1: A better gas is available and a gas change is advised in divemode
1657 return ; Done. 1733 return ; Done.
1659 btg blinking_better_gas ; Toggle blink bit... 1735 btg blinking_better_gas ; Toggle blink bit...
1660 btfss blinking_better_gas ; blink now? 1736 btfss blinking_better_gas ; blink now?
1661 return ; No, Done. 1737 return ; No, Done.
1662 call TFT_attention_color ; blink in yellow 1738 call TFT_attention_color ; blink in yellow
1663 bsf win_invert ; Set invert flag 1739 bsf win_invert ; Set invert flag
1664 WIN_STD active_gas_column,active_gas_row 1740 WIN_STD dm_active_gas_column, dm_active_gas_row
1665 movff char_I_O2_ratio,lo ; lo now stores O2 in % 1741 movff char_I_O2_ratio,lo ; lo now stores O2 in %
1666 movff char_I_He_ratio,hi ; hi now stores He in % 1742 movff char_I_He_ratio,hi ; hi now stores He in %
1667 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases) 1743 rcall TFT_active_gas_divemode2 ; Show gas (Non-Inverted in all cases)
1668 bcf win_invert ; Reset invert flag 1744 bcf win_invert ; Reset invert flag
1669 call TFT_standard_color 1745 call TFT_standard_color
1808 bsf ccr_diluent_setup ; Use CCR Diluents... 1884 bsf ccr_diluent_setup ; Use CCR Diluents...
1809 rcall TFT_gaslist_surfmode ; Use OC/BAIL routine 1885 rcall TFT_gaslist_surfmode ; Use OC/BAIL routine
1810 bcf ccr_diluent_setup ; Clear flag 1886 bcf ccr_diluent_setup ; Clear flag
1811 return 1887 return
1812 1888
1889 ;==================================================================
1890
1813 global TFT_depth 1891 global TFT_depth
1814 TFT_depth: 1892 TFT_depth:
1815 SAFE_2BYTE_COPY rel_pressure, lo 1893 SAFE_2BYTE_COPY rel_pressure, lo
1816 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 1894 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
1895
1896 TFT_color_code warn_depth ; Color-code the output
1897 call TFT_depth_blink
1898 WIN_LARGE dm_depth_column, dm_depth_row
1817 1899
1818 TSTOSS opt_units ; 0=m, 1=ft 1900 TSTOSS opt_units ; 0=m, 1=ft
1819 bra TFT_depth_metric 1901 bra TFT_depth_metric
1820 ;TFT_depth_imperial 1902 ;TFT_depth_imperial
1821 WIN_LARGE depth_feet_column,depth_feet_row
1822 TFT_color_code warn_depth ; Color-code the output
1823
1824 clrf sub_a+1 ; Display 0ft if lower then 30cm 1903 clrf sub_a+1 ; Display 0ft if lower then 30cm
1825 movlw d'30' 1904 movlw d'30'
1826 movwf sub_a+0 1905 movwf sub_a+0
1827 movff hi,sub_b+1 1906 movff hi,sub_b+1
1828 movff lo,sub_b+0 1907 movff lo,sub_b+0
1835 output_16 ; feet in Big font 1914 output_16 ; feet in Big font
1836 bcf leftbind 1915 bcf leftbind
1837 movlw .3 ; limit to three chars 1916 movlw .3 ; limit to three chars
1838 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 1917 call TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
1839 STRCAT_PRINT "" ; Display feet 1918 STRCAT_PRINT "" ; Display feet
1919 bcf win_invert ; Reset invert flag
1840 return 1920 return
1841 1921
1842 depth_less_0.3mtr_feet: 1922 depth_less_0.3mtr_feet:
1843 STRCAT_PRINT "0 " ; manual zero 1923 STRCAT_PRINT "0 " ; manual zero
1924 bcf win_invert ; Reset invert flag
1844 return 1925 return
1845 1926
1846 TFT_depth_metric: 1927 TFT_depth_metric:
1847 WIN_LARGE depth_column,depth_row
1848 TFT_color_code warn_depth ; Color-code the output
1849
1850 movlw .039 1928 movlw .039
1851 cpfslt hi 1929 cpfslt hi
1852 bra depth_greater_99_84mtr 1930 bra depth_greater_99_84mtr
1853 1931
1854 btfsc depth_greater_100m ; Was depth>100m during last call 1932 btfsc depth_greater_100m ; Was depth>100m during last call
1893 1971
1894 tft_depth3: 1972 tft_depth3:
1895 STRCAT_PRINT "" ; Display full meters 1973 STRCAT_PRINT "" ; Display full meters
1896 1974
1897 ; .1m in MEDIUM font 1975 ; .1m in MEDIUM font
1898 WIN_MEDIUM depth_dm_column,depth_dm_row 1976 WIN_MEDIUM dm_depth_dm_column, dm_depth_dm_row
1899 TFT_color_code warn_depth ; Color-code the output 1977 TFT_color_code warn_depth ; Color-code the output
1900 1978
1901 SAFE_2BYTE_COPY rel_pressure, lo 1979 SAFE_2BYTE_COPY rel_pressure, lo
1902 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 1980 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
1903 1981
1915 movlw d'4' 1993 movlw d'4'
1916 movwf ignore_digits 1994 movwf ignore_digits
1917 bsf ignore_digit5 1995 bsf ignore_digit5
1918 output_16dp d'0' 1996 output_16dp d'0'
1919 STRCAT_PRINT "" ; Display decimeters 1997 STRCAT_PRINT "" ; Display decimeters
1998 bcf win_invert ; Reset invert flag
1920 WIN_FONT FT_SMALL 1999 WIN_FONT FT_SMALL
1921 return 2000 return
1922 2001
1923 depth_less_0.3mtr: 2002 depth_less_0.3mtr:
1924 STRCAT_PRINT "0" ; Display 0.0m manually 2003 STRCAT_PRINT "0" ; Display 0.0m manually
2004 bcf win_invert ; Reset invert flag
1925 WIN_FONT FT_SMALL 2005 WIN_FONT FT_SMALL
1926 return 2006 return
1927 2007
1928 depth_greater_99_84mtr: ; Display only in full meters 2008 depth_greater_99_84mtr: ; Display only in full meters
1929 btfss depth_greater_100m ; Is depth>100m already? 2009 btfss depth_greater_100m ; Is depth>100m already?
1930 rcall TFT_clear_depth ; No, clear depth area and set flag 2010 rcall TFT_clear_depth ; No, clear depth area and set flag
2011 TFT_color_code warn_depth
1931 ; Depth is already in hi:lo 2012 ; Depth is already in hi:lo
1932 ; Show depth in Full meters 2013 ; Show depth in Full meters
1933 ; That means ignore figure 4 and 5 2014 ; That means ignore figure 4 and 5
1934 lfsr FSR2,buffer 2015 lfsr FSR2,buffer
1935 bsf ignore_digit4 2016 bsf ignore_digit4
1936 bsf leftbind 2017 bsf leftbind
1937 output_16 2018 output_16
1938 bcf leftbind 2019 bcf leftbind
1939 STRCAT_PRINT "" ; Display full meters only 2020 STRCAT_PRINT "" ; Display full meters only
2021 bcf win_invert ; Reset invert flag
1940 WIN_FONT FT_SMALL 2022 WIN_FONT FT_SMALL
1941 return 2023 return
1942 2024
1943 TFT_clear_depth: ; No, clear depth area and set flag 2025 TFT_clear_depth: ; No, clear depth area and set flag
1944 WIN_BOX_BLACK depth_row, .77,.0, max_depth_column-.1 ;top, bottom, left, right 2026 WIN_BOX_BLACK dm_depth_row, dm_depth_bot, dm_depth_column, dm_depth_rgt ;top, bottom, left, right
1945 bsf depth_greater_100m ; Set Flag 2027 bsf depth_greater_100m ; Set Flag
1946 return 2028 return
2029
2030 TFT_depth_blink:
2031 ; check if previous cycle had the blinking warning or not
2032 btfsc blinking_depth_prev ; did we have warning prev?
2033 bra TFT_depth_blink_prevwarn ; Yes
2034
2035 ; No; check if it's set now
2036 btfsc blinking_depth_warning ; do we have warning set now?
2037 bra TFT_depth_blink_warn ; Yes - so we have warning now but not prev
2038
2039 ; no warning in previous cycle, no warning now, reset all flags
2040 bcf blinking_depth_prev ; reset prev flag
2041 bcf blinking_depth_toggle ; reset toggle
2042 bcf win_invert
2043 ; all done
2044 return
2045
2046 TFT_depth_blink_prevwarn:
2047 ; ...we had warning in previous cycle, check if we still have the warning set
2048 btfss blinking_depth_warning ; do we still have the warning?
2049 bra TFT_depth_blink_prevwarn_nowarn ; No, clear the depth area
2050
2051 ; we still have the warning, set previous flag for next cycle...
2052 bsf blinking_depth_prev ; set prev flag
2053 ; and set toggle and invert if required
2054 btfss blinking_depth_toggle ; do we have the toggle set?
2055 bra TFT_depth_blink_set ; No: set inverse, do color_box, set flag
2056 bra TFT_depth_blink_reset ; Yes: clear inverse, do black box, reset flag
2057
2058 TFT_depth_blink_prevwarn_nowarn:
2059 ; we had warning, but not now... (e.g. ascended or switched to better gas)
2060 ; reset the previous cycle flag for the next cycle...
2061 bcf blinking_depth_prev ; reset prev flag
2062 ; clear it - just in case if we had a blinked before
2063 bra TFT_depth_blink_reset ; Yes: clear inverse, do black box, reset flag
2064
2065 TFT_depth_blink_warn:
2066 ; new blinking warning activated (had no warning in previous cycle)
2067 bsf blinking_depth_prev ; set prev flag
2068 ; set toggle and invert
2069 bra TFT_depth_blink_set
2070
2071 TFT_depth_blink_set:
2072 ; clear the area with color
2073 movlw color_red ; that should not be hardcoded...
2074 WIN_BOX_COLOR dm_depth_row, dm_depth_bot, dm_depth_column, dm_depth_rgt ;top, bottom, left, right
2075 ;set the invert color
2076 bsf win_invert
2077 ; set the toggle
2078 bsf blinking_depth_toggle
2079 ; all done
2080 return
2081
2082 TFT_depth_blink_reset:
2083 ; clear the area with black
2084 WIN_BOX_BLACK dm_depth_row, dm_depth_bot, dm_depth_column, dm_depth_rgt ;top, bottom, left, right
2085 ;reset the invert color
2086 bcf win_invert
2087 ; reset the toggle
2088 bcf blinking_depth_toggle
2089 ; if it's still warning...
2090 btfsc blinking_depth_warning
2091 call TFT_warnings_color
2092 ; all done
2093 return
1947 2094
1948 ;============================================================================= 2095 ;=============================================================================
1949 2096
1950 global TFT_custom_text 2097 global TFT_custom_text
1951 TFT_custom_text: ; Show the custom text 2098 TFT_custom_text: ; Show the custom text
2226 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 2373 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
2227 TSTOSS opt_units ; 0=m, 1=ft 2374 TSTOSS opt_units ; 0=m, 1=ft
2228 bra TFT_max_pressure2_metric 2375 bra TFT_max_pressure2_metric
2229 ;TFT_max_pressure2_imperial 2376 ;TFT_max_pressure2_imperial
2230 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet 2377 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
2231 WIN_MEDIUM max_depth_feet_column,max_depth_feet_row 2378 WIN_MEDIUM dm_max_depth_column, dm_max_depth_row
2232 call TFT_standard_color 2379 call TFT_standard_color
2233 output_16_3 2380 output_16_3
2234 STRCAT_PRINT "" 2381 STRCAT_PRINT ""
2235 return 2382 return
2236 2383
2237 TFT_max_pressure2_metric: 2384 TFT_max_pressure2_metric:
2238 WIN_MEDIUM max_depth_column,max_depth_row 2385 WIN_MEDIUM dm_max_depth_column, dm_max_depth_row
2239 2386
2240 movlw .039 2387 movlw .039
2241 cpfslt hi 2388 cpfslt hi
2242 bra max_depth_greater_99_84mtr 2389 bra max_depth_greater_99_84mtr
2243 2390
2276 bsf leftbind 2423 bsf leftbind
2277 output_16 2424 output_16
2278 bra tft_max_depth3 2425 bra tft_max_depth3
2279 2426
2280 tft_max_depth2: 2427 tft_max_depth2:
2281 WIN_MEDIUM max_depth_column,max_depth_row 2428 WIN_MEDIUM dm_max_depth_column, dm_max_depth_row
2282 STRCAT "0" 2429 STRCAT "0"
2283 2430
2284 tft_max_depth3: 2431 tft_max_depth3:
2285 call TFT_standard_color 2432 call TFT_standard_color
2286 STRCAT_PRINT "" ; Display full meters 2433 STRCAT_PRINT "" ; Display full meters
2287 bcf leftbind 2434 bcf leftbind
2288 2435
2289 ; .1m in SMALL font 2436 ; .1m in SMALL font
2290 WIN_SMALL max_depth_dm_column,max_depth_dm_row 2437 WIN_SMALL dm_max_depth_dm_column, dm_max_depth_dm_row
2291 2438
2292 SAFE_2BYTE_COPY max_pressure, lo 2439 SAFE_2BYTE_COPY max_pressure, lo
2293 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 2440 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
2294 2441
2295 PUTC "." 2442 PUTC "."
2317 STRCAT_PRINT "" ; Display full meters only 2464 STRCAT_PRINT "" ; Display full meters only
2318 WIN_FONT FT_SMALL 2465 WIN_FONT FT_SMALL
2319 return 2466 return
2320 2467
2321 TFT_clear_max_depth: ; No, clear max. depth area and set flag 2468 TFT_clear_max_depth: ; No, clear max. depth area and set flag
2322 WIN_BOX_BLACK max_depth_row,.49,max_depth_column, max_depth_dm_column+.13 ;top, bottom, left, right 2469 WIN_BOX_BLACK dm_max_depth_row, dm_max_depth_bot, dm_max_depth_column, dm_max_depth_rgt ;top, bottom, left, right
2323 bsf max_depth_greater_100m ; Set Flag 2470 bsf max_depth_greater_100m ; Set Flag
2324 return 2471 return
2325 2472
2326 2473
2327 TFT_max_pressure_apnoe: 2474 TFT_max_pressure_apnoe:
2331 bra TFT_max_pressure3 ; Show apnoe_max_pressure as max. depth 2478 bra TFT_max_pressure3 ; Show apnoe_max_pressure as max. depth
2332 2479
2333 global TFT_display_apnoe_last_max 2480 global TFT_display_apnoe_last_max
2334 TFT_display_apnoe_last_max: 2481 TFT_display_apnoe_last_max:
2335 call TFT_divemask_color 2482 call TFT_divemask_color
2336 WIN_TINY last_max_apnoe_text_column,last_max_apnoe_text_row 2483 WIN_TINY dm_apnoe_last_max_depth_text_col, dm_apnoe_last_max_depth_text_row
2337 STRCPY_TEXT_PRINT tApnoeMax 2484 STRCPY_TEXT_PRINT tApnoeMax
2338 2485
2339 call TFT_standard_color 2486 call TFT_standard_color
2340 SAFE_2BYTE_COPY max_pressure, lo 2487 SAFE_2BYTE_COPY max_pressure, lo
2341 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] 2488 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar]
2342 TSTOSS opt_units ; 0=m, 1=ft 2489 TSTOSS opt_units ; 0=m, 1=ft
2343 bra TFT_display_apnoe_last_m_metric 2490 bra TFT_display_apnoe_last_m_metric
2344 ;TFT_display_apnoe_last_max_imperial 2491 ;TFT_display_apnoe_last_max_imperial
2345 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet 2492 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet
2346 WIN_MEDIUM apnoe_last_max_depth_column,apnoe_last_max_depth_row 2493 WIN_MEDIUM dm_apnoe_last_max_depth_column, dm_apnoe_last_max_depth_row
2347 output_16 2494 output_16
2348 STRCAT_PRINT "" 2495 STRCAT_PRINT ""
2349 return 2496 return
2350 2497
2351 TFT_display_apnoe_last_m_metric: 2498 TFT_display_apnoe_last_m_metric:
2352 WIN_MEDIUM apnoe_last_max_depth_column,apnoe_last_max_depth_row 2499 WIN_MEDIUM dm_apnoe_last_max_depth_column, dm_apnoe_last_max_depth_row
2353 bsf ignore_digit5 ; do not display 1cm depth 2500 bsf ignore_digit5 ; do not display 1cm depth
2354 output_16dp d'3' 2501 output_16dp d'3'
2355 STRCAT_PRINT "" 2502 STRCAT_PRINT ""
2356 return 2503 return
2357 2504
2358 ;============================================================================= 2505 ;=============================================================================
2359 global TFT_divemins 2506 global TFT_divemins
2360 TFT_divemins: 2507 TFT_divemins:
2361 movff divemins+0,lo 2508 movff divemins+0,lo
2362 movff divemins+1,hi 2509 movff divemins+1,hi
2363 bcf leftbind 2510
2364 2511 ; Already showing divemins > 99min
2365 btfsc no_more_divesecs ; Ignore seconds? 2512 btfsc no_more_divesecs ; Ignore seconds?
2366 bra TFT_divemins2 ; Show minutes only 2513 bra TFT_divemins2 ; Show minutes only
2367 2514
2515 ; check if divemins has hi, definitely > 99min
2516 movlw .1
2517 cpfslt hi ; HI less than 1?
2518 bra TFT_divemins_clr ; No, show mins only
2519
2520 ; check if divemins (when HI is zero) > 99min
2368 movlw .99 2521 movlw .99
2369 cpfsgt lo ; bigger then 99? 2522 cpfsgt lo ; bigger than 99?
2370 bra TFT_divemins1 ; No show mins:secs 2523 bra TFT_divemins1 ; No show mins:secs
2524
2525 TFT_divemins_clr:
2371 ; Yes, remove second display for the rest of the dive and clear seconds 2526 ; Yes, remove second display for the rest of the dive and clear seconds
2372 bsf no_more_divesecs ; Set flag 2527 bsf no_more_divesecs ; Set flag
2373 ; Clear rest of seconds 2528 ; Clear rest of seconds
2374 WIN_BOX_BLACK divetime_row, warning1_row,divetime_column,.159 ;top, bottom, left, right 2529 WIN_BOX_BLACK dm_divetime_row, dm_divetime_bot, dm_divetime_column, dm_divetime_rgt ;top, bottom, left, right
2375 bra TFT_divemins2 ; Show minutes only 2530 bra TFT_divemins2 ; Show minutes only
2376 2531
2377 TFT_divemins1: 2532 TFT_divemins1:
2378 WIN_MEDIUM divetime_column, divetime_row 2533 ; Print out the minutes, up to 99min, only 2chars !
2379 output_16_3 ; displays only last three figures from a 16Bit value (0-999) 2534 call TFT_standard_color
2380 call TFT_standard_color 2535 WIN_MEDIUM dm_divetime_column, dm_divetime_row
2536
2537 movlw .9
2538 cpfsgt lo ; bigger then 9?
2539 bra TFT_divemins1_pad ; No, need padding
2540 ; Yes, just print out the value
2541 bsf leftbind
2542 movff divemins+0,lo
2543 output_99x ; displays only last two figures from a 8Bit value (00-99)
2544 bcf leftbind
2381 STRCAT_PRINT "" ; Show minutes in large font 2545 STRCAT_PRINT "" ; Show minutes in large font
2382 2546 bra TFT_divemins1_sec
2383 WIN_SMALL divetime_secs_column, divetime_secs_row ; left position for two sec figures 2547
2548 TFT_divemins1_pad:
2549 bcf leftbind
2550 PUTC " " ; Add a padding space
2551 bsf leftbind
2552 movff divemins+0,lo
2553 output_99 ; displays only last two figures from a 8Bit value (0-99)
2554 bcf leftbind
2555 STRCAT_PRINT "" ; Show minutes in large font
2556
2557 TFT_divemins1_sec:
2558 ; Print out the seconds
2559 WIN_SMALL dm_divetime_secs_column, dm_divetime_secs_row ; left position for two sec figures
2384 PUTC ':' 2560 PUTC ':'
2385 bsf leftbind 2561 bsf leftbind
2386 movff divesecs,lo 2562 movff divesecs,lo
2387 output_99x 2563 output_99x
2388 bcf leftbind 2564 bcf leftbind
2389 STRCAT_PRINT "" ; Show seconds in small font 2565 STRCAT_PRINT "" ; Show seconds in small font
2390 return 2566 return
2391 2567
2392 TFT_divemins2: 2568 TFT_divemins2:
2393 WIN_MEDIUM divetime_minsonly_column, divetime_row 2569 call TFT_standard_color
2394 output_16 2570 WIN_MEDIUM dm_divetime_minsonly_column, dm_divetime_row
2395 call TFT_standard_color 2571 bcf leftbind
2572
2573 ; if we are at or over the limit, do a WARNIGN color
2574 ; 9999 = 27 0F = [39][15]
2575 movlw .38
2576 cpfsgt hi ; hi > 38 ?
2577 bra TFT_divemins2_out ; No, hi <= 38, no need to warn
2578
2579 movlw .40
2580 cpfslt hi ; hi < 40 ?
2581 bra TFT_divemins2_warn ; No, hi >= 40, need to warn
2582
2583 ; hi = 39, check lo. check 14 as 9999 should be already WARN!
2584 movlw .14
2585 cpfsgt lo
2586 bra TFT_divemins2_out ; No, lo <= 14, no need to warn
2587 ; Yes, lo > 14, need to warn
2588
2589 TFT_divemins2_warn:
2590 call TFT_warnings_color
2591 bsf win_invert
2592
2593 TFT_divemins2_out:
2594 output_16_4
2396 STRCAT_PRINT "" ; Show minutes in large font 2595 STRCAT_PRINT "" ; Show minutes in large font
2596 bcf win_invert
2397 return 2597 return
2398 2598
2399 ;============================================================================= 2599 ;=============================================================================
2400 global TFT_display_apnoe_surface 2600 global TFT_display_apnoe_surface
2401 TFT_display_apnoe_surface: 2601 TFT_display_apnoe_surface:
2402 call TFT_divemask_color 2602 call TFT_divemask_color
2403 WIN_TINY surface_apnoe_text_column,surface_apnoe_text_row 2603 WIN_TINY dm_apnoe_surface_time_text_col, dm_apnoe_surface_time_text_row
2404 STRCPY_TEXT_PRINT tApnoeSurface 2604 STRCPY_TEXT_PRINT tApnoeSurface
2405 2605
2406 call TFT_standard_color 2606 call TFT_standard_color
2407 WIN_MEDIUM surface_time_apnoe_column, surface_time_apnoe_row 2607 WIN_MEDIUM dm_apnoe_surface_time_column, dm_apnoe_surface_time_row
2408 movff apnoe_surface_mins,lo 2608 movff apnoe_surface_mins,lo
2409 output_8 2609 output_8
2410 PUTC ':' 2610 PUTC ':'
2411 movff apnoe_surface_secs,lo 2611 movff apnoe_surface_secs,lo
2412 output_99x 2612 output_99x
2414 return 2614 return
2415 2615
2416 global TFT_apnoe_clear_surface 2616 global TFT_apnoe_clear_surface
2417 TFT_apnoe_clear_surface: 2617 TFT_apnoe_clear_surface:
2418 ; Clear Surface timer.... 2618 ; Clear Surface timer....
2419 WIN_BOX_BLACK surface_apnoe_text_row, .239, surface_apnoe_text_column, .159 ;top, bottom, left, right 2619 WIN_BOX_BLACK dm_apnoe_surface_time_text_row, .239, dm_apnoe_surface_time_text_col, .159 ;top, bottom, left, right
2420 return 2620 return
2421 2621
2422 global TFT_display_apnoe_descent 2622 global TFT_display_apnoe_descent
2423 TFT_display_apnoe_descent: ; Descent divetime 2623 TFT_display_apnoe_descent: ; Descent divetime
2424 movff apnoe_mins,lo 2624 movff apnoe_mins,lo
2425 clrf hi 2625 clrf hi
2426 WIN_MEDIUM divetime_column, divetime_row 2626 WIN_MEDIUM dm_divetime_apnoe_column, dm_divetime_apnoe_row
2427 output_16_3 ; displays only last three figures from a 16Bit value (0-999) 2627 output_16_3 ; displays only last three figures from a 16Bit value (0-999)
2428 call TFT_standard_color 2628 call TFT_standard_color
2429 STRCAT_PRINT "" ; Show minutes in large font 2629 STRCAT_PRINT "" ; Show minutes in large font
2430 WIN_SMALL divetime_secs_column, divetime_secs_row ; left position for two sec figures 2630 WIN_SMALL dm_divetime_apnoe_secs_column, dm_divetime_apnoe_secs_row ; left position for two sec figures
2431 PUTC ':' 2631 PUTC ':'
2432 bsf leftbind 2632 bsf leftbind
2433 movff apnoe_secs,lo 2633 movff apnoe_secs,lo
2434 output_99x 2634 output_99x
2435 bcf leftbind 2635 bcf leftbind
2436 STRCAT_PRINT "" ; Show seconds in small font 2636 STRCAT_PRINT "" ; Show seconds in small font
2437 2637
2438 call TFT_divemask_color 2638 call TFT_divemask_color
2439 WIN_TINY total_apnoe_text_column,total_apnoe_text_row 2639 WIN_TINY dm_total_apnoe_text_column,dm_total_apnoe_text_row
2440 STRCPY_TEXT_PRINT tApnoeTotal 2640 STRCPY_TEXT_PRINT tApnoeTotal
2441 call TFT_standard_color 2641 call TFT_standard_color
2442 movff divemins,lo 2642 movff divemins,lo
2443 clrf hi 2643 clrf hi
2444 WIN_MEDIUM apnoe_total_divetime_column, apnoe_total_divetime_row 2644 WIN_MEDIUM dm_apnoe_total_divetime_column, dm_apnoe_total_divetime_row
2445 output_16_3 ; displays only last three figures from a 16Bit value (0-999) 2645 output_16_3 ; displays only last three figures from a 16Bit value (0-999)
2446 call TFT_standard_color 2646 call TFT_standard_color
2447 STRCAT_PRINT "" ; Show minutes in large font 2647 STRCAT_PRINT "" ; Show minutes in large font
2448 WIN_SMALL apnoe_total_divetime_secs_column, apnoe_total_divetime_secs_row ; left position for two sec figures 2648 WIN_SMALL dm_apnoe_total_divetime_secs_col, dm_apnoe_total_divetime_secs_row ; left position for two sec figures
2449 PUTC ':' 2649 PUTC ':'
2450 bsf leftbind 2650 bsf leftbind
2451 movff divesecs,lo 2651 movff divesecs,lo
2452 output_99x 2652 output_99x
2453 bcf leftbind 2653 bcf leftbind
2646 2846
2647 global TFT_clear_warning_text 2847 global TFT_clear_warning_text
2648 TFT_clear_warning_text: 2848 TFT_clear_warning_text:
2649 btfss divemode ; in divemode? 2849 btfss divemode ; in divemode?
2650 bra TFT_clear_warning_text2 ; No, setup for surface mode 2850 bra TFT_clear_warning_text2 ; No, setup for surface mode
2651 WIN_BOX_BLACK warning1_row, divemode_customview_row-3, warning1_column, warning_icon_column-3 ;top, bottom, left, right 2851 WIN_BOX_BLACK dm_warning_row, dm_warning_bot, dm_warning_column, dm_warning_rgt ;top, bottom, left, right
2652 return 2852 return
2653 TFT_clear_warning_text2: 2853 TFT_clear_warning_text2:
2654 WIN_BOX_BLACK surf_warning1_row, surf_warning2_row+.24, surf_warning1_column, surf_warning1_column+.76 ;top, bottom, left, right 2854 WIN_BOX_BLACK surf_warning1_row, surf_warning2_row+.24, surf_warning1_column, surf_warning1_column+.76 ;top, bottom, left, right
2655 return 2855 return
2656 2856
2657 global TFT_clear_warning_text_2nd_row 2857 global TFT_clear_warning_text_2nd_row
2658 TFT_clear_warning_text_2nd_row: 2858 TFT_clear_warning_text_2nd_row:
2659 btfss divemode ; in divemode? 2859 btfss divemode ; in divemode?
2660 bra TFT_clear_warning_text_2nd_2 ; No, setup for surface mode 2860 bra TFT_clear_warning_text_2nd_2 ; No, setup for surface mode
2661 WIN_BOX_BLACK warning2_row, divemode_customview_row-3, warning2_column, warning_icon_column-3 ;top, bottom, left, right 2861 WIN_BOX_BLACK dm_warning2_row, dm_warning2_bot, dm_warning2_column, dm_warning2_rgt ;top, bottom, left, right
2662 return 2862 return
2663 TFT_clear_warning_text_2nd_2: 2863 TFT_clear_warning_text_2nd_2:
2664 WIN_BOX_BLACK surf_warning2_row, surf_warning2_row+.24, surf_warning2_column, surf_warning2_column+.76 ;top, bottom, left, right 2864 WIN_BOX_BLACK surf_warning2_row, surf_warning2_row+.24, surf_warning2_column, surf_warning2_column+.76 ;top, bottom, left, right
2665 return 2865 return
2666 2866
2735 rcall TFT_warning_set_window ; Sets the row and column for the current warning 2935 rcall TFT_warning_set_window ; Sets the row and column for the current warning
2736 tstfsz WREG ; Is there room for the warning? 2936 tstfsz WREG ; Is there room for the warning?
2737 return ; No 2937 return ; No
2738 call TFT_warnings_color 2938 call TFT_warnings_color
2739 STRCPY_TEXT tDiveaGF_active ; "aGF!" 2939 STRCPY_TEXT tDiveaGF_active ; "aGF!"
2740 movlw warning_length ; Divemode string length 2940 movlw dm_warning_length ; Divemode string length
2741 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 2941 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
2742 STRCAT_PRINT "" 2942 STRCAT_PRINT ""
2743 call TFT_standard_color 2943 call TFT_standard_color
2744 return 2944 return
2745 2945
2748 rcall TFT_warning_set_window ; Sets the row and column for the current warning 2948 rcall TFT_warning_set_window ; Sets the row and column for the current warning
2749 tstfsz WREG ; Is there room for the warning? 2949 tstfsz WREG ; Is there room for the warning?
2750 return ; No 2950 return ; No
2751 call TFT_warnings_color 2951 call TFT_warnings_color
2752 STRCPY_TEXT tDiveFallback ; "Fallback!" 2952 STRCPY_TEXT tDiveFallback ; "Fallback!"
2753 movlw warning_length ; Divemode string length 2953 movlw dm_warning_length ; Divemode string length
2754 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 2954 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
2755 STRCAT_PRINT "" 2955 STRCAT_PRINT ""
2756 call TFT_standard_color 2956 call TFT_standard_color
2757 return 2957 return
2758 2958
2765 STRCPY "GF:" 2965 STRCPY "GF:"
2766 movff char_O_gradient_factor,lo ; gradient factor 2966 movff char_O_gradient_factor,lo ; gradient factor
2767 bsf leftbind 2967 bsf leftbind
2768 output_8 2968 output_8
2769 PUTC "%" 2969 PUTC "%"
2770 movlw warning_length ; Divemode string length 2970 movlw dm_warning_length ; Divemode string length
2771 btfss divemode ; In Divemode? 2971 btfss divemode ; In Divemode?
2772 movlw surf_warning_length ; No, use surface string length 2972 movlw surf_warning_length ; No, use surface string length
2773 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 2973 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
2774 STRCAT_PRINT "" 2974 STRCAT_PRINT ""
2775 bcf leftbind 2975 bcf leftbind
2789 btfss divemode ; in divemode? 2989 btfss divemode ; in divemode?
2790 bra TFT_warning_set_window3 ; No, setup for surface mode 2990 bra TFT_warning_set_window3 ; No, setup for surface mode
2791 2991
2792 btfss warning_counter,0 ; Toggle with each warning 2992 btfss warning_counter,0 ; Toggle with each warning
2793 bra TFT_warning_set_window2 2993 bra TFT_warning_set_window2
2794 WIN_SMALL warning1_column,warning1_row 2994 WIN_SMALL dm_warning1_column, dm_warning1_row
2795 bcf second_row_warning ; =1: The second row contains a warning 2995 bcf second_row_warning ; =1: The second row contains a warning
2796 retlw .0 ; WREG=0 -> Warning window defined 2996 retlw .0 ; WREG=0 -> Warning window defined
2797 TFT_warning_set_window2: 2997 TFT_warning_set_window2:
2798 WIN_SMALL warning2_column,warning2_row 2998 WIN_SMALL dm_warning2_column, dm_warning2_row
2799 bsf second_row_warning ; =1: The second row contains a warning 2999 bsf second_row_warning ; =1: The second row contains a warning
2800 retlw .0 ; WREG=0 -> Warning window defined 3000 retlw .0 ; WREG=0 -> Warning window defined
2801 3001
2802 TFT_warning_set_window3: 3002 TFT_warning_set_window3:
2803 btfss warning_counter,0 ; Toggle with each warning 3003 btfss warning_counter,0 ; Toggle with each warning
2821 STRCPY "Batt:" 3021 STRCPY "Batt:"
2822 bsf leftbind 3022 bsf leftbind
2823 output_8 3023 output_8
2824 bcf leftbind 3024 bcf leftbind
2825 PUTC "%" 3025 PUTC "%"
2826 movlw warning_length ; Divemode string length 3026 movlw dm_warning_length ; Divemode string length
2827 btfss divemode ; In Divemode? 3027 btfss divemode ; In Divemode?
2828 movlw surf_warning_length ; No, use surface string length 3028 movlw surf_warning_length ; No, use surface string length
2829 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 3029 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
2830 STRCAT_PRINT "" 3030 STRCAT_PRINT ""
2831 call TFT_standard_color 3031 call TFT_standard_color
2834 3034
2835 global TFT_gf_mask ; Setup Mask 3035 global TFT_gf_mask ; Setup Mask
2836 TFT_gf_mask: 3036 TFT_gf_mask:
2837 ; The mask 3037 ; The mask
2838 call TFT_divemask_color 3038 call TFT_divemask_color
2839 WIN_TINY dive_gf_column1,dive_gf_text_row 3039 WIN_TINY dm_custom_gf_title_col1, dm_custom_gf_title_row
2840 STRCPY_TEXT_PRINT tGFactors 3040 STRCPY_TEXT_PRINT tGFactors
2841 WIN_TINY dive_gf_column2,dive_gf_text_row 3041 WIN_TINY dm_custom_gf_title_col2, dm_custom_gf_title_row
2842 STRCPY_TEXT_PRINT taGFactors 3042 STRCPY_TEXT_PRINT taGFactors
2843 WIN_TINY dive_gf_column3,dive_gf_text_row 3043 WIN_TINY dm_custom_gf_title_col3, dm_custom_gf_title_row
2844 STRCPY_TEXT_PRINT tGFInfo 3044 STRCPY_TEXT_PRINT tGFInfo
2845 3045
2846 ; Show GF (Static) 3046 ; Show GF (Static)
2847 call TFT_disabled_color 3047 call TFT_disabled_color
2848 btfss use_agf 3048 btfss use_agf
2849 call TFT_standard_color 3049 call TFT_standard_color
2850 3050
2851 WIN_STD dive_gf_column,dive_gf_row 3051 WIN_STD dm_custom_gf_column, dm_custom_gf_row
2852 bsf leftbind 3052 bsf leftbind
2853 movff opt_GF_low,lo 3053 movff opt_GF_low,lo
2854 output_8 3054 output_8
2855 PUTC "/" 3055 PUTC "/"
2856 movff opt_GF_high,lo 3056 movff opt_GF_high,lo
2862 bra TFT_gf_mask2 ; Show "---" instead 3062 bra TFT_gf_mask2 ; Show "---" instead
2863 3063
2864 btfss use_agf 3064 btfss use_agf
2865 call TFT_disabled_color 3065 call TFT_disabled_color
2866 3066
2867 WIN_STD dive_agf_column,dive_agf_row 3067 WIN_STD dm_custom_agf_column, dm_custom_agf_row
2868 movff opt_aGF_low,lo 3068 movff opt_aGF_low,lo
2869 output_8 3069 output_8
2870 PUTC "/" 3070 PUTC "/"
2871 movff opt_aGF_high,lo 3071 movff opt_aGF_high,lo
2872 output_8 3072 output_8
2874 bcf leftbind 3074 bcf leftbind
2875 call TFT_standard_color 3075 call TFT_standard_color
2876 return 3076 return
2877 3077
2878 TFT_gf_mask2: 3078 TFT_gf_mask2:
2879 WIN_STD dive_agf_column+.10,dive_agf_row 3079 WIN_STD dm_custom_agf_column+.10, dm_custom_agf_row
2880 STRCPY_PRINT "---" 3080 STRCPY_PRINT "---"
2881 bcf leftbind 3081 bcf leftbind
2882 return 3082 return
2883 3083
2884 global TFT_gf_info ; Show GF informations 3084 global TFT_gf_info ; Show GF informations
2886 ; Show current GF 3086 ; Show current GF
2887 movff char_O_gradient_factor,lo ; gradient factor absolute (Non-GF model) 3087 movff char_O_gradient_factor,lo ; gradient factor absolute (Non-GF model)
2888 movff char_I_deco_model,hi 3088 movff char_I_deco_model,hi
2889 decfsz hi,F ; jump over next line if char_I_deco_model == 1 3089 decfsz hi,F ; jump over next line if char_I_deco_model == 1
2890 movff char_O_relative_gradient_GF,lo ; gradient factor relative (GF model) 3090 movff char_O_relative_gradient_GF,lo ; gradient factor relative (GF model)
2891 WIN_STD dive_currentgf_column,dive_currentgf_row 3091 WIN_STD dm_custom_currentgf_column, dm_custom_currentgf_row
2892 output_8 3092 output_8
2893 STRCAT_PRINT "%" 3093 STRCAT_PRINT "%"
2894 return 3094 return
2895 3095
2896 global TFT_ead_end_tissues_clock_mask ; Setup Mask 3096 global TFT_ead_end_tissues_clock_mask ; Setup Mask
2900 btfsc FLAG_apnoe_mode ; In Apnoe mode? 3100 btfsc FLAG_apnoe_mode ; In Apnoe mode?
2901 bra TFT_ead_end_tissues_clock_mask2 ; Yes 3101 bra TFT_ead_end_tissues_clock_mask2 ; Yes
2902 btfsc FLAG_gauge_mode ; In Gauge mode? 3102 btfsc FLAG_gauge_mode ; In Gauge mode?
2903 bra TFT_ead_end_tissues_clock_mask2 ; Yes 3103 bra TFT_ead_end_tissues_clock_mask2 ; Yes
2904 ; Put three columns at HUD positions 3104 ; Put three columns at HUD positions
2905 WIN_TINY dive_custom_hud_column2,dive_custom_hud_row 3105 WIN_TINY dm_custom_ead_column, dm_custom_eadend_title_row
2906 STRCPY_TEXT_PRINT tDiveEAD_END 3106 STRCPY_TEXT_PRINT tDiveEAD_END
2907 WIN_TINY dive_custom_hud_column3,dive_custom_hud_row 3107 WIN_TINY dm_custom_tissue_title_column, dm_custom_tissue_title_row
2908 STRCPY_TEXT_PRINT tDiveTissues 3108 STRCPY_TEXT_PRINT tDiveTissues
2909 TFT_ead_end_tissues_clock_mask2: ; Show only clock 3109 TFT_ead_end_tissues_clock_mask2: ; Show only clock
2910 WIN_TINY dive_custom_hud_column1,dive_custom_hud_row 3110 WIN_TINY dm_custom_clock_column, dm_custom_clock_title_row
2911 STRCPY_TEXT_PRINT tDiveClock 3111 STRCPY_TEXT_PRINT tDiveClock
2912 call TFT_standard_color 3112 call TFT_standard_color
2913 return 3113 return
2914 3114
2915 global TFT_ead_end_tissues_clock ; Show EAD/END, Tissues and clock 3115 global TFT_ead_end_tissues_clock ; Show EAD/END, Tissues and clock
2916 TFT_ead_end_tissues_clock: 3116 TFT_ead_end_tissues_clock:
2917 ; Update clock and date 3117 ; Update clock and date
2918 WIN_SMALL dive_clock_column,dive_clock_row 3118 WIN_SMALL dm_custom_clock_column, dm_custom_clock_row
2919 call TFT_clock2 ; print clock 3119 call TFT_clock2 ; print clock
2920 3120
2921 btfsc FLAG_apnoe_mode ; In Apnoe mode? 3121 btfsc FLAG_apnoe_mode ; In Apnoe mode?
2922 return ; Yes, done. 3122 return ; Yes, done.
2923 btfsc FLAG_gauge_mode ; In Gauge mode? 3123 btfsc FLAG_gauge_mode ; In Gauge mode?
2958 ;TFT_ead_end_tissues_clock2: 3158 ;TFT_ead_end_tissues_clock2:
2959 ; STRCPY_PRINT " " 3159 ; STRCPY_PRINT " "
2960 ;TFT_ead_end_tissues_clock3: 3160 ;TFT_ead_end_tissues_clock3:
2961 3161
2962 ; Show END/EAD 3162 ; Show END/EAD
2963 WIN_SMALL dive_ead_column,dive_ead_row 3163 WIN_SMALL dm_custom_ead_column, dm_custom_ead_row
2964 STRCPY_TEXT tEAD ; EAD: 3164 STRCPY_TEXT tEAD ; EAD:
2965 movff char_O_EAD,lo 3165 movff char_O_EAD,lo
2966 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars 3166 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars
2967 WIN_SMALL dive_end_column,dive_end_row 3167 WIN_SMALL dm_custom_end_column, dm_custom_end_row
2968 STRCPY_TEXT tEND ; END: 3168 STRCPY_TEXT tEND ; END:
2969 movff char_O_END,lo 3169 movff char_O_END,lo
2970 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars 3170 rcall TFT_end_ead_common ; print "lo m" (or ft) and limit to 8 chars
2971 3171
2972 ; Show tissue diagram 3172 ; Show tissue diagram
2973 call TFT_divemask_color 3173 call TFT_divemask_color
2974 WIN_TINY dive_tissue_N2_column,dive_tissue_N2_row 3174 WIN_TINY dm_custom_tissue_N2_column, dm_custom_tissue_N2_row
2975 STRCPY_TEXT_PRINT tN2 3175 STRCPY_TEXT_PRINT tN2
2976 WIN_TINY dive_tissue_He_column,dive_tissue_He_row 3176 WIN_TINY dm_custom_tissue_He_column, dm_custom_tissue_He_row
2977 STRCPY_TEXT_PRINT tHe 3177 STRCPY_TEXT_PRINT tHe
2978 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation) 3178 call deco_calc_desaturation_time ; calculate desaturation time (and char_O_tissue_N2_saturation and char_O_tissue_He_saturation)
2979 movlb b'00000001' ; select ram bank 1 3179 movlb b'00000001' ; select ram bank 1
2980 rcall DISP_tissue_saturation_graph ; Show char_O_tissue_N2_saturation and char_O_tissue_He_saturation 3180 rcall DISP_tissue_saturation_graph ; Show char_O_tissue_N2_saturation and char_O_tissue_He_saturation
2981 return 3181 return
3030 3230
3031 movlw .1 3231 movlw .1
3032 movff WREG,win_height ; row bottom (0-239) 3232 movff WREG,win_height ; row bottom (0-239)
3033 movlw surf_tissue_diagram_left+.4 ; Surface mode 3233 movlw surf_tissue_diagram_left+.4 ; Surface mode
3034 movff WREG,win_leftx2 ; column left (0-159) 3234 movff WREG,win_leftx2 ; column left (0-159)
3035 movlw surf_tissue_diagram_right-surf_tissue_diagram_left-4 ; Width 3235 movlw surf_tissue_diagram_right - surf_tissue_diagram_left - .4 ; Width
3036 movff WREG,win_width 3236 movff WREG,win_width
3037 3237
3038 ;---- Draw N2 Tissues 3238 ;---- Draw N2 Tissues
3039 lfsr FSR2, char_O_tissue_N2_saturation 3239 lfsr FSR2, char_O_tissue_N2_saturation
3040 movlw d'16' 3240 movlw d'16'
3082 ;============================================================================= 3282 ;=============================================================================
3083 ; Draw saturation graph, is surface mode or in dive mode. 3283 ; Draw saturation graph, is surface mode or in dive mode.
3084 DISP_tissue_saturation_graph: 3284 DISP_tissue_saturation_graph:
3085 ;---- Draw Frame 3285 ;---- Draw Frame
3086 call TFT_standard_color 3286 call TFT_standard_color
3087 WIN_FRAME_COLOR16 tissue_diagram_top, tissue_diagram_bottom, tissue_diagram_left, .159 ; outer frame 3287 WIN_FRAME_COLOR16 dm_custom_tissue_diagram_top, dm_custom_tissue_diagram_bottom, dm_custom_tissue_diagram_left, .159 ; outer frame
3088 3288
3089 movlw .1 3289 movlw .1
3090 movff WREG,win_height ; row bottom (0-239) 3290 movff WREG,win_height ; row bottom (0-239)
3091 movlw tissue_diagram_left+.3 ; divemode 3291 movlw dm_custom_tissue_diagram_left+.3 ; divemode
3092 movff WREG,win_leftx2 ; column left (0-159) 3292 movff WREG,win_leftx2 ; column left (0-159)
3093 movlw .159-tissue_diagram_left-4 ; Width 3293 movlw .159-dm_custom_tissue_diagram_left-.4 ; Width
3094 movff WREG,win_width 3294 movff WREG,win_width
3095 3295
3096 ;---- Draw N2 Tissues 3296 ;---- Draw N2 Tissues
3097 lfsr FSR2, char_O_tissue_N2_saturation 3297 lfsr FSR2, char_O_tissue_N2_saturation
3098 movlw d'16' 3298 movlw d'16'
3099 movwf wait_temp ; 16 tissues 3299 movwf wait_temp ; 16 tissues
3100 clrf waitms_temp ; Row offset 3300 clrf waitms_temp ; Row offset
3101 tissue_saturation_graph_N2: 3301 tissue_saturation_graph_N2:
3102 movlw tissue_diagram_top+3 ; divemode 3302 movlw dm_custom_tissue_diagram_top+.3 ; divemode
3103 addwf waitms_temp,W 3303 addwf waitms_temp,W
3104 movff WREG,win_top ; row top (0-239) 3304 movff WREG,win_top ; row top (0-239)
3105 rcall tissue_saturation_graph_loop ; Show one tissue 3305 rcall tissue_saturation_graph_loop ; Show one tissue
3106 decfsz wait_temp,F 3306 decfsz wait_temp,F
3107 bra tissue_saturation_graph_N2 3307 bra tissue_saturation_graph_N2
3110 lfsr FSR2, char_O_tissue_He_saturation 3310 lfsr FSR2, char_O_tissue_He_saturation
3111 movlw d'16' 3311 movlw d'16'
3112 movwf wait_temp ; 16 tissues 3312 movwf wait_temp ; 16 tissues
3113 clrf waitms_temp ; Row offset 3313 clrf waitms_temp ; Row offset
3114 tissue_saturation_graph_He: 3314 tissue_saturation_graph_He:
3115 movlw tissue_diagram_top+3+.22 ; divemode 3315 movlw dm_custom_tissue_diagram_top+.3+.22 ; divemode
3116 addwf waitms_temp,W 3316 addwf waitms_temp,W
3117 movff WREG,win_top ; row top (0-239) 3317 movff WREG,win_top ; row top (0-239)
3118 3318
3119 rcall tissue_saturation_graph_loop ; Show one tissue 3319 rcall tissue_saturation_graph_loop ; Show one tissue
3120 3320
3152 movff int_O_CNS_fraction+1,hi 3352 movff int_O_CNS_fraction+1,hi
3153 bsf leftbind 3353 bsf leftbind
3154 output_16_3 ;Displays only 0...999 3354 output_16_3 ;Displays only 0...999
3155 bcf leftbind 3355 bcf leftbind
3156 PUTC "%" 3356 PUTC "%"
3157 movlw warning_length ; Divemode string length 3357 movlw dm_warning_length ; Divemode string length
3158 btfss divemode ; In Divemode? 3358 btfss divemode ; In Divemode?
3159 movlw surf_warning_length ; No, use surface string length 3359 movlw surf_warning_length ; No, use surface string length
3160 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 3360 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
3161 STRCAT_PRINT "" 3361 STRCAT_PRINT ""
3162 call TFT_standard_color 3362 call TFT_standard_color
3175 movff xC+0,lo 3375 movff xC+0,lo
3176 movff xC+1,hi 3376 movff xC+1,hi
3177 bsf ignore_digit4 3377 bsf ignore_digit4
3178 output_16dp d'1' 3378 output_16dp d'1'
3179 TFT_show_ppO2_2: 3379 TFT_show_ppO2_2:
3180 movlw warning_length ; Divemode string length 3380 movlw dm_warning_length ; Divemode string length
3181 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG) 3381 rcall TFT_fillup_with_spaces ; Fillup FSR2 with spaces (Total string length in #WREG)
3182 STRCAT_PRINT "" 3382 STRCAT_PRINT ""
3183 call TFT_standard_color 3383 call TFT_standard_color
3184 return 3384 return
3185 3385