Mercurial > public > hwos_code
comparison src/tft_outputs.asm @ 315:4f83470dcece new_screen_layout
VSIbar #3: remaining changes for the split style bar
author | Janos Kovacs <kovjanos@gmail.com> |
---|---|
date | Wed, 10 Jun 2015 22:32:38 +0100 |
parents | 453a3d13570f |
children | c6c934f05b42 |
comparison
equal
deleted
inserted
replaced
314:226e1405b86c | 315:4f83470dcece |
---|---|
535 STRCAT_TEXT_PRINT tMaxDepth | 535 STRCAT_TEXT_PRINT tMaxDepth |
536 WIN_TINY dm_mask_divetime_column,dm_mask_divetime_row | 536 WIN_TINY dm_mask_divetime_column,dm_mask_divetime_row |
537 STRCAT_TEXT_PRINT tDivetime | 537 STRCAT_TEXT_PRINT tDivetime |
538 endif | 538 endif |
539 | 539 |
540 ; DEBUG !!! | 540 if dm_offset == 0 |
541 movlw color_dark_red | 541 movlw color_dark_red |
542 call TFT_set_color | 542 call TFT_set_color |
543 WIN_FRAME_COLOR16 dm_velobar_top, dm_velobar_bot, dm_velobar_lft, dm_velobar_rgt ;top, bottom, left, right | 543 WIN_FRAME_COLOR16 dm_velobar_top, dm_velobar_bot, dm_velobar_lft, dm_velobar_rgt ;top, bottom, left, right |
544 | 544 WIN_FRAME_COLOR16 dm_sep_1_2_row, dm_sep_1_2_row, .0, .159 ;top, bottom, left, right |
545 movlw color_blue | 545 WIN_FRAME_COLOR16 dm_sep_2_3_row, dm_sep_2_3_row, .0, .159 ;top, bottom, left, right |
546 WIN_BOX_COLOR dm_velobar_top+.60, dm_velobar_top+.63, dm_velobar_lft+.1, dm_velobar_rgt-.1 ;top, bottom, left, right | 546 WIN_FRAME_COLOR16 dm_warning_row-.1, dm_warning_row-.1, dm_warning_column, .159 ;top, bottom, left, right |
547 call TFT_draw_gassep_line | |
548 endif | |
547 | 549 |
548 call TFT_standard_color | 550 call TFT_standard_color |
549 return | 551 return |
550 | 552 |
551 global TFT_clear_customview_divemode | 553 global TFT_clear_customview_divemode |
552 TFT_clear_customview_divemode: | 554 TFT_clear_customview_divemode: |
553 WIN_BOX_BLACK dm_customview_row, dm_customview_bot, dm_customview_column, dm_customview_rgt ; top, bottom, left, right | 555 WIN_BOX_BLACK dm_customview_row, dm_customview_bot, dm_customview_column, dm_customview_rgt ; top, bottom, left, right |
554 return | 556 return |
555 | 557 |
558 global TFT_draw_gassep_line | |
559 TFT_draw_gassep_line: | |
560 btfsc FLAG_apnoe_mode ; Ignore in Apnoe mode | |
561 return | |
562 btfsc divemode_menu ; Is the dive mode menu shown? | |
563 return ; Yes, return | |
564 if dm_offset == 0 | |
565 movlw color_dark_red | |
566 call TFT_set_color | |
567 WIN_FRAME_COLOR16 dm_gassep_row, dm_gassep_bot, dm_gassep_column, dm_gassep_column | |
568 endif | |
569 call TFT_standard_color | |
570 return | |
571 | |
556 ;========================================================================= | 572 ;========================================================================= |
557 | 573 |
558 global TFT_display_velocity | 574 global TFT_display_velocity |
559 TFT_display_velocity: ; With divA+0 = m/min | 575 TFT_display_velocity: ; With divA+0 = m/min |
576 ; Input is: | |
577 ; neg_flag: ascend=1, descend=0 | |
578 ; divA+0: rate in m/min | |
560 ; init flags used to store warning/attention | 579 ; init flags used to store warning/attention |
561 bcf velocity_warn | 580 bcf velocity_warn |
562 bcf velocity_attn | 581 bcf velocity_attn |
563 | 582 ; retain the neg_flag (descending information) |
583 bcf neg_flag_velocity | |
584 btfsc neg_flag | |
585 bsf neg_flag_velocity | |
564 ; check if old/new ascend logic is used | 586 ; check if old/new ascend logic is used |
565 TSTOSS opt_vsitextv2 ; 0=standard, 1=dynamic | 587 TSTOSS opt_vsitextv2 ; 0=standard, 1=dynamic |
566 bra TFT_dispay_velocity_std | 588 bra TFT_velocity_std ; static ascend rate limit |
567 | 589 ; initialize the multiplier/offset values, also required for the |
568 ; Input is: | 590 ; below-the-treshold bar |
569 ; neg_flag: ascend=1, descend=0 | 591 movlw .7 |
570 ; divA+0: rate in m/min | 592 movwf xC+0 |
571 | 593 movlw .6 |
594 movwf xC+1 | |
595 movlw .1 | |
596 movwf xC+2 | |
597 movlw .0 | |
598 movwf xC+3 | |
572 ; check if velocity is below the treshold level | 599 ; check if velocity is below the treshold level |
573 movlw velocity_display_threshold_2 | 600 movlw velocity_display_threshold_2 |
574 subwf divA+0,W | 601 subwf divA+0,W |
575 btfss STATUS,C | 602 btfss STATUS,C |
576 bra TFT_display_velocity_ntr | 603 bra TFT_velocity_ntr ; ascend/descend rare is below limit |
577 bsf display_velocity | 604 bsf display_velocity |
578 | 605 |
579 ; use a depth-dependent ascent rate warning | 606 ; use a depth-dependent ascent rate warning |
580 ; depth(ft): <20 >20 >40 >60 >75 >88 >101 >115 >128 >144 >164 | 607 ; depth(ft): <20 >20 >40 >60 >75 >88 >101 >115 >128 >144 >164 |
581 ; speed(ft/min): 23 26 29 33 36 43 49 56 59 62 66 | 608 ; speed(ft/min): 23 26 29 33 36 43 49 56 59 62 66 |
582 ; depth(m): <=6 >6 >12 >18 >23 >27 >31 >35 >39 >44 >50 | 609 ; depth(m): <=6 >6 >12 >18 >23 >27 >31 >35 >39 >44 >50 |
583 ; speed(m/min): 7 8 9 10 11 13 15 17 18 19 20 (warning) | 610 ; speed(m/min): 7 8 9 10 11 13 15 17 18 19 20 (warning) |
584 ; speed(m/min): 5 6 7 8 8 10 12 13 14 15 15 (attention) | 611 ; speed(m/min): 5 6 7 8 8 10 12 13 14 15 15 (attention) |
585 | 612 ; |
613 ; use different multipliers and offsets for the different ascend limits for | |
614 ; a smoother bar | |
586 ; w-multip 7 6 5 5 4 3 3 2 2 2 2 | 615 ; w-multip 7 6 5 5 4 3 3 2 2 2 2 |
587 ; a-multip 6 5 4 3 3 3 2 2 2 2 2 | 616 ; a-multip 6 5 4 3 3 3 2 2 2 2 2 |
588 ; w-offset 1 2 5 0 6 11 5 16 14 12 10 | 617 ; w-offset 1 2 5 0 6 11 5 16 14 12 10 |
589 ; a-offset 0 0 2 6 6 0 6 4 2 0 0 | 618 ; a-offset 0 0 2 6 6 0 6 4 2 0 0 |
590 | 619 |
591 ; retain the neg_flag (descending information) | |
592 bcf neg_flag_save | |
593 btfsc neg_flag | |
594 bsf neg_flag_save | |
595 | |
596 ; check if descending: no warning color if descending | 620 ; check if descending: no warning color if descending |
597 call TFT_standard_color | 621 call TFT_standard_color |
598 btfss neg_flag ; Ignore for descent! | 622 btfss neg_flag_velocity ; Ignore for descent! |
599 bra TFT_display_velocity_out | 623 bra TFT_velocity_disp |
600 | 624 ; get the actual depth |
601 SAFE_2BYTE_COPY rel_pressure, lo ; get the actual depth | 625 SAFE_2BYTE_COPY rel_pressure, lo ; get the actual depth |
602 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | 626 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] |
603 call convert_mbar_to_feet ; get depth in feet | 627 call convert_mbar_to_feet ; get depth in feet |
628 ; store current depth (in feet) into sub_a | |
629 movff lo,sub_a+0 | |
630 movff hi,sub_a+1 | |
604 ; xA will be used to store the warning/attention limits passed to the verification | 631 ; xA will be used to store the warning/attention limits passed to the verification |
605 clrf xA+0 | 632 clrf xA+0 |
606 clrf xA+1 | 633 clrf xA+1 |
607 | |
608 ; store current depth (in feet) into sub_a | |
609 movff lo,sub_a+0 | |
610 movff hi,sub_a+1 | |
611 | 634 |
612 ;TFT_display_velocity_asc_164: | 635 ;TFT_display_velocity_asc_164: |
613 ; store segment limit into sub_b | 636 ; store segment limit into sub_b |
614 clrf sub_b+1 | 637 clrf sub_b+1 |
615 movlw LOW d'164' | 638 movlw LOW d'164' |
876 bra TFT_velocity_attn ; Skip if no carry flag otherwise set to warning color | 899 bra TFT_velocity_attn ; Skip if no carry flag otherwise set to warning color |
877 ;bra TFT_velocity_def | 900 ;bra TFT_velocity_def |
878 | 901 |
879 TFT_velocity_def: | 902 TFT_velocity_def: |
880 call TFT_standard_color | 903 call TFT_standard_color |
881 bra TFT_display_velocity_out | 904 bra TFT_velocity_disp |
882 | 905 |
883 TFT_velocity_warn: | 906 TFT_velocity_warn: |
884 call TFT_warnings_color ; Set to warning color | 907 call TFT_warnings_color ; Set to warning color |
885 bsf win_invert | 908 bsf win_invert |
886 bsf velocity_warn | 909 bsf velocity_warn |
887 bra TFT_display_velocity_out | 910 bra TFT_velocity_disp |
888 | 911 |
889 TFT_velocity_attn: | 912 TFT_velocity_attn: |
890 call TFT_attention_color ; Set to attention color | 913 call TFT_attention_color ; Set to attention color |
891 bsf velocity_attn | 914 bsf velocity_attn |
892 ;bra TFT_display_velocity_out | 915 bra TFT_velocity_disp |
893 | 916 |
894 TFT_display_velocity_out: | 917 TFT_velocity_std: |
895 ; retain neg_flag value - restore | 918 ; initialize the multiplier/offset values for the graphical bar |
896 bcf neg_flag | 919 movlw .5 |
897 btfsc neg_flag_save | 920 movwf xC+0 |
898 bsf neg_flag | 921 movlw .3 |
899 bra TFT_dispay_velocity_disp | 922 movwf xC+1 |
900 | 923 movlw .0 |
901 TFT_dispay_velocity_std: | 924 movwf xC+2 |
925 movlw .6 | |
926 movwf xC+3 | |
927 | |
902 movlw velocity_display_threshold_1 ; lowest threshold for display vertical velocity | 928 movlw velocity_display_threshold_1 ; lowest threshold for display vertical velocity |
903 subwf divA+0,W | 929 subwf divA+0,W |
904 btfss STATUS,C | 930 btfss STATUS,C |
905 bra TFT_display_velocity_clear | 931 bra TFT_velocity_ntr ; under treshold, clear text and display VSIbar |
906 bsf display_velocity | 932 bsf display_velocity |
907 | 933 |
908 call TFT_standard_color | 934 call TFT_standard_color |
909 btfss neg_flag ; Ignore for descent! | 935 btfss neg_flag_velocity ; Ignore for descent! |
910 bra TFT_dispay_velocity_disp ; Skip check! | 936 bra TFT_velocity_disp ; Skip check! |
911 movff divA+0,lo | 937 movff divA+0,lo |
912 movlw color_code_velocity_warn_high ; Velocity warn [m/min] | 938 movlw color_code_velocity_warn_high ; Velocity warn [m/min] |
913 subwf lo,W | 939 subwf lo,W |
914 btfsc STATUS,C | 940 btfsc STATUS,C |
915 call TFT_warnings_color ; Set to warning color | 941 bra TFT_velocity_std_warn |
916 | 942 bra TFT_velocity_disp |
917 TFT_dispay_velocity_disp: | 943 |
944 TFT_velocity_std_warn: | |
945 call TFT_warnings_color ; Set to warning color | |
946 bsf velocity_warn | |
947 ;bsf TFT_velocity_disp | |
948 | |
949 TFT_velocity_disp: | |
918 WIN_SMALL dm_velocity_text_column, dm_velocity_text_row | 950 WIN_SMALL dm_velocity_text_column, dm_velocity_text_row |
919 TSTOSS opt_units ; 0=Meters, 1=Feets | 951 TSTOSS opt_units ; 0=Meters, 1=Feets |
920 bra TFT_display_velocity_metric | 952 bra TFT_velocity_metric |
921 ;TFT_display_velocity_imperial: | 953 ;TFT_velocity_imperial: |
922 movff divA+0,WREG ; divA+0 = m/min | 954 movff divA+0,WREG ; divA+0 = m/min |
923 mullw .100 ; PRODL:PRODH = mbar/min | 955 mullw .100 ; PRODL:PRODH = mbar/min |
924 movff PRODL,lo | 956 movff PRODL,lo |
925 movff PRODH,hi | 957 movff PRODH,hi |
926 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet | 958 call convert_mbar_to_feet ; convert value in lo:hi from mbar to feet |
927 movlw '-' | 959 movlw '-' |
928 btfsc neg_flag | 960 btfsc neg_flag_velocity |
929 movlw '+' | 961 movlw '+' |
930 movwf POSTINC2 | 962 movwf POSTINC2 |
931 bsf leftbind | 963 bsf leftbind |
932 output_16 | 964 output_16 |
933 bcf leftbind | 965 bcf leftbind |
934 STRCAT_TEXT_PRINT tVelImperial ; Unit switch | 966 STRCAT_TEXT_PRINT tVelImperial ; Unit switch |
967 bcf win_invert | |
968 bcf neg_flag | |
969 call TFT_velocity_VSIbar | |
970 bcf neg_flag_velocity | |
935 call TFT_standard_color | 971 call TFT_standard_color |
936 bcf win_invert | 972 return |
937 call TFT_display_VSIbar | 973 |
938 return | 974 TFT_velocity_metric: |
939 | |
940 TFT_display_velocity_metric: | |
941 movff divA+0,lo ; divA+0 = m/min | 975 movff divA+0,lo ; divA+0 = m/min |
942 movlw '-' | 976 movlw '-' |
943 btfsc neg_flag | 977 btfsc neg_flag_velocity |
944 movlw '+' | 978 movlw '+' |
945 movwf POSTINC2 | 979 movwf POSTINC2 |
946 output_99 | 980 output_99 |
947 STRCAT_TEXT_PRINT tVelMetric ; Unit switch | 981 STRCAT_TEXT_PRINT tVelMetric ; Unit switch |
982 bcf win_invert | |
983 bcf neg_flag | |
984 call TFT_velocity_VSIbar | |
985 bcf neg_flag_velocity | |
948 call TFT_standard_color | 986 call TFT_standard_color |
949 bcf win_invert | 987 return |
950 call TFT_display_VSIbar | 988 |
951 return | 989 TFT_velocity_VSIbar: |
952 | |
953 TFT_display_VSIbar: | |
954 ; use another logic when descending | 990 ; use another logic when descending |
955 btfss neg_flag | 991 btfss neg_flag_velocity |
956 bra TFT_dispay_VSIbar_desc | 992 bra TFT_velocity_VSIbar_desc |
993 call TFT_velocity_VSIbar_desc_clr | |
957 btfsc velocity_warn | 994 btfsc velocity_warn |
958 bra TFT_display_VSIbar_warn | 995 bra TFT_velocity_VSIbar_warn |
959 btfsc velocity_attn | 996 ; if all ok or attention, use attn's values |
960 bra TFT_display_VSIbar_attn | |
961 ; all ok, use attn's values | |
962 movff xC+1,sub_b+0 ; multiplier | 997 movff xC+1,sub_b+0 ; multiplier |
963 movff xC+3,sub_b+1 ; offset | 998 movff xC+3,sub_b+1 ; offset |
964 bra TFT_display_VSIbar_com | 999 bra TFT_velocity_VSIbar_com |
965 | 1000 |
966 TFT_display_VSIbar_warn: | 1001 TFT_velocity_VSIbar_warn: |
967 ; save multiplier and offset out from the xC | 1002 ; save multiplier and offset out from the xC |
968 movff xC+0,sub_b+0 ; multiplier | 1003 movff xC+0,sub_b+0 ; multiplier |
969 movff xC+2,sub_b+1 ; offset | 1004 movff xC+2,sub_b+1 ; offset |
970 bra TFT_display_VSIbar_com | 1005 ;bra TFT_velocity_VSIbar_com |
971 | 1006 |
972 TFT_display_VSIbar_attn: | 1007 TFT_velocity_VSIbar_com: |
973 ; save multiplier and offset out from the xC | |
974 movff xC+1,sub_b+0 ; multiplier | |
975 movff xC+3,sub_b+1 ; offset | |
976 ;bra TFT_display_VSIbar_com | |
977 | |
978 TFT_display_VSIbar_com: | |
979 ; multiply | 1008 ; multiply |
980 movff divA+0,xA+0 | 1009 movff divA+0,xA+0 |
981 clrf xA+1 | 1010 clrf xA+1 |
982 movff sub_b+0,xB+0 | 1011 movff sub_b+0,xB+0 |
983 clrf xB+1 | 1012 clrf xB+1 |
984 call mult16x16 ; xA*xB=xC | 1013 call mult16x16 ; xA*xB=xC |
985 movlw .1 | 1014 movlw .1 |
986 cpfslt xC+3 | 1015 cpfslt xC+3 |
987 bra TFT_display_VSIbar_max | 1016 bra TFT_velocity_VSIbar_max |
988 cpfslt xC+2 | 1017 cpfslt xC+2 |
989 bra TFT_display_VSIbar_max | 1018 bra TFT_velocity_VSIbar_max |
990 cpfslt xC+1 | 1019 cpfslt xC+1 |
991 bra TFT_display_VSIbar_max | 1020 bra TFT_velocity_VSIbar_max |
992 ; add offset | 1021 ; add offset |
993 movff sub_b+1,WREG | 1022 movff sub_b+1,WREG |
994 addwf xC+0,1 | 1023 addwf xC+0,1 |
995 btfsc STATUS,C | 1024 btfsc STATUS,C |
996 bra TFT_display_VSIbar_max | 1025 bra TFT_velocity_VSIbar_max |
997 ; check if out-of-range | 1026 ; check if out-of-range |
998 movff xC+0,divB | 1027 movff xC+0,divB |
999 movlw .60 | 1028 movlw .60 |
1000 cpfsgt divB | 1029 cpfsgt divB |
1001 bra TFT_display_VSIbar_draw | 1030 bra TFT_velocity_VSIbar_draw |
1002 | 1031 |
1003 TFT_display_VSIbar_max: | 1032 TFT_velocity_VSIbar_max: |
1004 movlw .60 | 1033 movlw .60 |
1005 movff WREG,divB | 1034 movff WREG,divB |
1006 | 1035 |
1007 TFT_display_VSIbar_draw: | 1036 TFT_velocity_VSIbar_draw: |
1008 ; calculate top&height for the bar and mask | 1037 ; calculate top&height for the bar and mask |
1009 ; 1. Bar: top=(bar_top+60-divB); height=divB | 1038 ; 1. Bar: top=(bar_top+60-divB); height=divB |
1010 movlw dm_velobar_top+.1 | 1039 movlw dm_velobar_top+.1 |
1011 movff WREG,sub_a+0 ; !!!!!! bar position must fit into lo !! | 1040 movff WREG,sub_a+0 ; !!!!!! bar position must fit into lo !! |
1012 movlw .60 | 1041 movlw .60 |
1013 addwf sub_a+0,1 | 1042 addwf sub_a+0,1 |
1014 clrf sub_a+1 | 1043 clrf sub_a+1 |
1015 movff divB,sub_b+0 | 1044 movff divB,sub_b+0 |
1016 clrf sub_b+1 | 1045 clrf sub_b+1 |
1017 call subU16 | 1046 call subU16 |
1047 | |
1048 movlw color_white | |
1049 WIN_BOX_COLOR dm_velobar_top+.60, dm_velobar_top+.63, dm_velobar_lft+.1, dm_velobar_rgt-.1 ;top, bottom, left, right | |
1018 | 1050 |
1019 movff sub_c+0,win_top | 1051 movff sub_c+0,win_top |
1020 movff divB,win_height | 1052 movff divB,win_height |
1021 movlw dm_velobar_width | 1053 movlw dm_velobar_width-.4 |
1022 movff WREG,win_width | 1054 movff WREG,win_width |
1023 movff WREG,win_bargraph | 1055 movff WREG,win_bargraph |
1024 movlw dm_velobar_lft+.1 | 1056 movlw dm_velobar_lft+.3 |
1025 movff WREG,win_leftx2 | 1057 movff WREG,win_leftx2 |
1026 movlw color_green | 1058 movlw color_green |
1027 call TFT_set_color | 1059 call TFT_set_color |
1028 btfsc velocity_attn | 1060 btfsc velocity_attn |
1029 call TFT_attention_color | 1061 call TFT_attention_color |
1055 movlw color_black | 1087 movlw color_black |
1056 call TFT_set_color | 1088 call TFT_set_color |
1057 call TFT_box | 1089 call TFT_box |
1058 return | 1090 return |
1059 | 1091 |
1060 TFT_dispay_VSIbar_desc: | 1092 TFT_velocity_VSIbar_desc: |
1061 ; clear the ascend part of the bar | 1093 ; clear the ascend part of the bar |
1062 call TFT_display_VSIbar_clr | 1094 call TFT_velocity_VSIbar_clr |
1063 ; TODO | 1095 ; divA+0=0 is descend, clear everything if it's actually zero |
1064 return | 1096 movlw .0 |
1065 | 1097 cpfsgt divA+0 |
1066 TFT_display_VSIbar_clr: ; clears the ascend part of hte bar | 1098 bra TFT_velocity_VSIbar_desc_clr |
1067 WIN_BOX_BLACK dm_velobar_top+.1,dm_velobar_top+.59,dm_velobar_lft+.1,dm_velobar_rgt-.1 | 1099 |
1068 movlw color_blue | 1100 ; Desc uses a single multiplier/offset value: *1 / +3 |
1101 movlw .1 | |
1102 movff WREG,sub_b+0 ; multiplier | |
1103 movlw .3 | |
1104 movff WREG,sub_b+1 ; offset | |
1105 ; multiply | |
1106 movff divA+0,xA+0 | |
1107 clrf xA+1 | |
1108 movff sub_b+0,xB+0 | |
1109 clrf xB+1 | |
1110 call mult16x16 ; xA*xB=xC | |
1111 movlw .1 | |
1112 cpfslt xC+3 | |
1113 bra TFT_velocity_VSIbar_desc_max | |
1114 cpfslt xC+2 | |
1115 bra TFT_velocity_VSIbar_desc_max | |
1116 cpfslt xC+1 | |
1117 bra TFT_velocity_VSIbar_desc_max | |
1118 ; add offset | |
1119 movff sub_b+1,WREG | |
1120 addwf xC+0,1 | |
1121 btfsc STATUS,C | |
1122 bra TFT_velocity_VSIbar_desc_max | |
1123 ; check if out-of-range | |
1124 movff xC+0,divB | |
1125 movlw .22 | |
1126 cpfsgt divB | |
1127 bra TFT_velocity_VSIbar_desc_draw | |
1128 | |
1129 TFT_velocity_VSIbar_desc_max: | |
1130 movlw .22 | |
1131 movff WREG,divB | |
1132 | |
1133 TFT_velocity_VSIbar_desc_draw: | |
1134 ; calculate top&height for the bar and mask | |
1135 ; 1. Bar: top=(bar_top+63); height=divB | |
1136 movlw dm_velobar_top+.1 | |
1137 movff WREG,sub_a+0 | |
1138 movlw .62 | |
1139 addwf sub_a+0,1 | |
1140 | |
1141 movlw color_white | |
1069 WIN_BOX_COLOR dm_velobar_top+.60, dm_velobar_top+.63, dm_velobar_lft+.1, dm_velobar_rgt-.1 ;top, bottom, left, right | 1142 WIN_BOX_COLOR dm_velobar_top+.60, dm_velobar_top+.63, dm_velobar_lft+.1, dm_velobar_rgt-.1 ;top, bottom, left, right |
1070 return | 1143 |
1071 | 1144 movff sub_a+0,win_top |
1072 TFT_display_velocity_ntr: ; velocity under treshold | 1145 movff divB,win_height |
1073 call TFT_display_velocity_clear | 1146 movlw dm_velobar_width-.4 |
1147 movff WREG,win_width | |
1148 movff WREG,win_bargraph | |
1149 movlw dm_velobar_lft+.3 | |
1150 movff WREG,win_leftx2 | |
1151 movlw color_green | |
1152 call TFT_set_color | |
1153 call TFT_box | |
1154 | |
1155 ;clear the rest | |
1156 movlw .22 | |
1157 cpfslt divB | |
1158 return ; divB !< 22 - the graph uses the full bar, no need to clear | |
1159 | |
1160 ; 2. Mask: top=(bar_top+63+divB); height=(23-divB) | |
1161 movlw .24 | |
1162 movff WREG,sub_a+0 | |
1163 clrf sub_a+1 | |
1164 movff divB,sub_b+0 | |
1165 clrf sub_b+1 | |
1166 call subU16 ; sub_c = sub_a - sub_b | |
1167 | |
1168 movlw dm_velobar_top | |
1169 movff WREG,sub_a+0 | |
1170 movlw .61 | |
1171 addwf sub_a+0,1 | |
1172 movff divB,WREG | |
1173 addwf sub_a+0,1 | |
1174 | |
1175 movff sub_a+0,win_top | |
1176 movff sub_c+0,win_height | |
1177 movlw dm_velobar_width | |
1178 movff WREG,win_width | |
1179 movff WREG,win_bargraph | |
1180 movlw dm_velobar_lft+.1 | |
1181 movff WREG,win_leftx2 | |
1182 movlw color_black | |
1183 call TFT_set_color | |
1184 call TFT_box | |
1185 return | |
1186 | |
1187 TFT_velocity_VSIbar_clr: ; clears the ascend part of the bar | |
1188 WIN_BOX_BLACK dm_velobar_top+.1,dm_velobar_top+.63,dm_velobar_lft+.1,dm_velobar_rgt-.1 | |
1189 if dm_offset == 0 | |
1190 movlw color_dark_red | |
1191 WIN_BOX_COLOR dm_velobar_top+.60, dm_velobar_top+.63, dm_velobar_lft+.1, dm_velobar_rgt-.1 ;top, bottom, left, right | |
1192 endif | |
1193 return | |
1194 | |
1195 TFT_velocity_VSIbar_desc_clr: ; clears the descend part of the bar | |
1196 WIN_BOX_BLACK dm_velobar_top+.61,dm_velobar_bot-.1,dm_velobar_lft+.1,dm_velobar_rgt-.1 | |
1197 if dm_offset == 0 | |
1198 movlw color_dark_red | |
1199 WIN_BOX_COLOR dm_velobar_top+.60, dm_velobar_top+.63, dm_velobar_lft+.1, dm_velobar_rgt-.1 ;top, bottom, left, right | |
1200 endif | |
1201 return | |
1202 | |
1203 TFT_velocity_ntr: ; velocity under treshold | |
1204 call TFT_velocity_clear | |
1074 ; use another logic when descending | 1205 ; use another logic when descending |
1075 btfss neg_flag | 1206 btfss neg_flag_velocity |
1076 bra TFT_dispay_VSIbar_desc | 1207 bra TFT_velocity_VSIbar_desc |
1077 movlw .7 | 1208 bra TFT_velocity_VSIbar |
1078 movwf xC+0 | 1209 |
1079 movlw .6 | 1210 global TFT_velocity_clear |
1080 movwf xC+1 | 1211 TFT_velocity_clear: |
1081 movlw .1 | |
1082 movwf xC+2 | |
1083 movlw .0 | |
1084 movwf xC+3 | |
1085 call TFT_display_VSIbar | |
1086 return | |
1087 | |
1088 global TFT_display_velocity_clear | |
1089 TFT_display_velocity_clear: | |
1090 btfss display_velocity ; Velocity was not displayed, do not delete | 1212 btfss display_velocity ; Velocity was not displayed, do not delete |
1091 return | 1213 return |
1092 bcf display_velocity ; Velocity was displayed, delete velocity now | 1214 bcf display_velocity ; Velocity was displayed, delete velocity now |
1093 ; Clear Text | 1215 ; Clear Text |
1094 WIN_BOX_BLACK dm_velocity_text_row, dm_velocity_text_bot, dm_velocity_text_column, dm_velocity_text_rgt ; top, bottom, left, right | 1216 WIN_BOX_BLACK dm_velocity_text_row, dm_velocity_text_bot, dm_velocity_text_column, dm_velocity_text_rgt ; top, bottom, left, right |
1113 global TFT_display_ndl_mask | 1235 global TFT_display_ndl_mask |
1114 TFT_display_ndl_mask: | 1236 TFT_display_ndl_mask: |
1115 btfsc divemode_menu ; Is the dive mode menu shown? | 1237 btfsc divemode_menu ; Is the dive mode menu shown? |
1116 return ; Yes, return | 1238 return ; Yes, return |
1117 rcall TFT_clear_decoarea ; Clear Dekostop and Dekosum | 1239 rcall TFT_clear_decoarea ; Clear Dekostop and Dekosum |
1118 call TFT_divemask_color | 1240 if dm_offset != 0 |
1241 call TFT_divemask_color | |
1242 else | |
1243 call TFT_attention_color | |
1244 endif | |
1119 WIN_STD dm_ndl_text_column, dm_ndl_text_row | 1245 WIN_STD dm_ndl_text_column, dm_ndl_text_row |
1120 STRCPY_TEXT_PRINT tNDL ; NDL | 1246 STRCPY_TEXT_PRINT tNDL ; NDL |
1121 call TFT_standard_color | 1247 call TFT_standard_color |
1122 return | 1248 return |
1123 | 1249 |
1162 | 1288 |
1163 global TFT_display_deko_mask | 1289 global TFT_display_deko_mask |
1164 TFT_display_deko_mask: | 1290 TFT_display_deko_mask: |
1165 rcall TFT_clear_decoarea | 1291 rcall TFT_clear_decoarea |
1166 WIN_STD dm_tts_text_column, dm_tts_text_row | 1292 WIN_STD dm_tts_text_column, dm_tts_text_row |
1167 call TFT_divemask_color | 1293 if dm_offset != 0 |
1294 call TFT_divemask_color | |
1295 else | |
1296 call TFT_attention_color | |
1297 endif | |
1168 STRCPY_TEXT_PRINT tTTS ; TTS | 1298 STRCPY_TEXT_PRINT tTTS ; TTS |
1169 call TFT_standard_color | 1299 call TFT_standard_color |
1170 bcf show_safety_stop ; Clear safety stop flag | 1300 bcf show_safety_stop ; Clear safety stop flag |
1171 return | 1301 return |
1172 | 1302 |
1981 call TFT_warning_set_window ; Sets the row and column for the current warning | 2111 call TFT_warning_set_window ; Sets the row and column for the current warning |
1982 tstfsz WREG ; Is there room for the warning? | 2112 tstfsz WREG ; Is there room for the warning? |
1983 return ; No | 2113 return ; No |
1984 call TFT_warning_set_window_com | 2114 call TFT_warning_set_window_com |
1985 else | 2115 else |
2116 btfsc divemode_menu ; Is the dive mode menu shown? | |
2117 return ; Yes, return | |
1986 call TFT_standard_color | 2118 call TFT_standard_color |
1987 WIN_SMALL dm_ftts_value_column, dm_ftts_value_row | 2119 WIN_SMALL dm_ftts_value_column, dm_ftts_value_row |
1988 endif | 2120 endif |
1989 | 2121 |
1990 movff char_I_extra_time,lo | 2122 movff char_I_extra_time,lo |