comparison src/tft_outputs.asm @ 318:6d8c82fe5a01 new_screen_layout

VSIbar #3d: more filter, neg_flag_velocity close to calculation, debug color for descend bar
author janos_kovacs <kovjanos@gmail.com>
date Thu, 11 Jun 2015 15:16:42 +0100
parents 7b64c0ba6a7e
children c23d9d524eb9
comparison
equal deleted inserted replaced
317:7b64c0ba6a7e 318:6d8c82fe5a01
572 ;========================================================================= 572 ;=========================================================================
573 573
574 global TFT_display_velocity 574 global TFT_display_velocity
575 TFT_display_velocity: ; With divA+0 = m/min 575 TFT_display_velocity: ; With divA+0 = m/min
576 ; Input is: 576 ; Input is:
577 ; neg_flag: ascend=1, descend=0 577 ; neg_flag_velocity: ascend=1, descend=0
578 ; divA+0: rate in m/min 578 ; divA+0: rate in m/min
579 ; init flags used to store warning/attention 579 ; init flags used to store warning/attention
580 bcf velocity_warn 580 bcf velocity_warn
581 bcf velocity_attn 581 bcf velocity_attn
582 ; retain the neg_flag (descending information)
583 bcf neg_flag_velocity
584 btfsc neg_flag
585 bsf neg_flag_velocity
586 ; check if old/new ascend logic is used 582 ; check if old/new ascend logic is used
587 TSTOSS opt_vsitextv2 ; 0=standard, 1=dynamic 583 TSTOSS opt_vsitextv2 ; 0=standard, 1=dynamic
588 bra TFT_velocity_std ; static ascend rate limit 584 bra TFT_velocity_std ; static ascend rate limit
589 ; initialize the multiplier/offset values, also required for the 585 ; initialize the multiplier/offset values, also required for the
590 ; below-the-treshold bar 586 ; below-the-treshold bar
595 movlw .1 591 movlw .1
596 movwf xC+2 592 movwf xC+2
597 movlw .0 593 movlw .0
598 movwf xC+3 594 movwf xC+3
599 ; check if velocity is below the treshold level 595 ; check if velocity is below the treshold level
596 bcf STATUS,C
600 movlw velocity_display_threshold_2 597 movlw velocity_display_threshold_2
601 subwf divA+0,W 598 subwf divA+0,W
602 btfss STATUS,C 599 btfss STATUS,C
603 bra TFT_velocity_ntr ; ascend/descend rare is below limit 600 bra TFT_velocity_ntr ; ascend/descend rare is below limit
604 bsf display_velocity 601 bsf display_velocity
883 TFT_velocity_check: 880 TFT_velocity_check:
884 ; move current ascent rate to lo 881 ; move current ascent rate to lo
885 clrf hi 882 clrf hi
886 movff divA+0,lo 883 movff divA+0,lo
887 ; Velocity warn [m/min] - we receive it from xA+0 884 ; Velocity warn [m/min] - we receive it from xA+0
885 bcf STATUS,C
888 movff xA+0,WREG 886 movff xA+0,WREG
889 ; compare the values 887 ; compare the values
890 subwf lo,W ; subtract W from lo, 888 subwf lo,W ; subtract W from lo,
891 btfsc STATUS,C ; Check if C (carry flag) is set. Cleared if the larger number is subtracted from smaller one 889 btfsc STATUS,C ; Check if C (carry flag) is set. Cleared if the larger number is subtracted from smaller one
892 bra TFT_velocity_warn ; Skip if no carry flag otherwise set to warning color 890 bra TFT_velocity_warn ; Skip if no carry flag otherwise set to warning color
893 ; not eq or gt warning trashold, lets check if it reach the attention level 891 ; not eq or gt warning trashold, lets check if it reach the attention level
894 ; Velocity attn [m/min] - we receive it from xA+1 892 ; Velocity attn [m/min] - we receive it from xA+1
893 bcf STATUS,C
895 movff xA+1,WREG 894 movff xA+1,WREG
896 ; compare the values 895 ; compare the values
897 subwf lo,W ; subtract W from lo, 896 subwf lo,W ; subtract W from lo,
898 btfsc STATUS,C ; Check if C (carry flag) is set. Cleared if the larger number is subtracted from smaller one 897 btfsc STATUS,C ; Check if C (carry flag) is set. Cleared if the larger number is subtracted from smaller one
899 bra TFT_velocity_attn ; Skip if no carry flag otherwise set to warning color 898 bra TFT_velocity_attn ; Skip if no carry flag otherwise set to warning color
923 movlw .0 922 movlw .0
924 movwf xC+2 923 movwf xC+2
925 movlw .6 924 movlw .6
926 movwf xC+3 925 movwf xC+3
927 926
928 movlw velocity_display_threshold_1 ; lowest threshold for display vertical velocity 927 bcf STATUS,C
928 movlw velocity_display_threshold_1 ; lowest threshold for display vertical velocity
929 subwf divA+0,W 929 subwf divA+0,W
930 btfss STATUS,C 930 btfss STATUS,C
931 bra TFT_velocity_ntr ; under treshold, clear text and display VSIbar 931 bra TFT_velocity_ntr ; under treshold, clear text and display VSIbar
932 bsf display_velocity 932 bsf display_velocity
933 933
934 call TFT_standard_color 934 call TFT_standard_color
935 btfss neg_flag_velocity ; Ignore for descent! 935 btfss neg_flag_velocity ; Ignore for descent!
936 bra TFT_velocity_disp ; Skip check! 936 bra TFT_velocity_disp ; Skip check!
937 bcf STATUS,C
937 movff divA+0,lo 938 movff divA+0,lo
938 movlw color_code_velocity_warn_high ; Velocity warn [m/min] 939 movlw color_code_velocity_warn_high ; Velocity warn [m/min]
939 subwf lo,W 940 subwf lo,W
940 btfsc STATUS,C 941 btfsc STATUS,C
941 bra TFT_velocity_std_warn 942 bra TFT_velocity_std_warn
965 bcf leftbind 966 bcf leftbind
966 STRCAT_TEXT_PRINT tVelImperial ; Unit switch 967 STRCAT_TEXT_PRINT tVelImperial ; Unit switch
967 bcf win_invert 968 bcf win_invert
968 bcf neg_flag 969 bcf neg_flag
969 call TFT_velocity_VSIbar 970 call TFT_velocity_VSIbar
970 bcf neg_flag_velocity
971 call TFT_standard_color 971 call TFT_standard_color
972 return 972 return
973 973
974 TFT_velocity_metric: 974 TFT_velocity_metric:
975 movff divA+0,lo ; divA+0 = m/min 975 movff divA+0,lo ; divA+0 = m/min
980 output_99 980 output_99
981 STRCAT_TEXT_PRINT tVelMetric ; Unit switch 981 STRCAT_TEXT_PRINT tVelMetric ; Unit switch
982 bcf win_invert 982 bcf win_invert
983 bcf neg_flag 983 bcf neg_flag
984 call TFT_velocity_VSIbar 984 call TFT_velocity_VSIbar
985 bcf neg_flag_velocity
986 call TFT_standard_color 985 call TFT_standard_color
987 return 986 return
988 987
989 TFT_velocity_VSIbar: 988 TFT_velocity_VSIbar:
990 ; use another logic when descending 989 ; use another logic when descending
1019 cpfslt xC+2 1018 cpfslt xC+2
1020 bra TFT_velocity_VSIbar_max 1019 bra TFT_velocity_VSIbar_max
1021 movlw .1 1020 movlw .1
1022 cpfslt xC+1 1021 cpfslt xC+1
1023 bra TFT_velocity_VSIbar_max 1022 bra TFT_velocity_VSIbar_max
1023 movlw .60
1024 cpfslt xC+0
1025 bra TFT_velocity_VSIbar_max
1024 ; add offset 1026 ; add offset
1027 bcf STATUS,C
1025 movff sub_b+1,WREG 1028 movff sub_b+1,WREG
1026 addwf xC+0,1 1029 addwf xC+0,1
1027 btfsc STATUS,C 1030 btfsc STATUS,C
1028 bra TFT_velocity_VSIbar_max 1031 bra TFT_velocity_VSIbar_max
1029 ; check if out-of-range 1032 ; check if out-of-range
1119 cpfslt xC+2 1122 cpfslt xC+2
1120 bra TFT_velocity_VSIbar_desc_max 1123 bra TFT_velocity_VSIbar_desc_max
1121 movlw .1 1124 movlw .1
1122 cpfslt xC+1 1125 cpfslt xC+1
1123 bra TFT_velocity_VSIbar_desc_max 1126 bra TFT_velocity_VSIbar_desc_max
1127 movlw .22
1128 cpfslt xC+1
1129 bra TFT_velocity_VSIbar_desc_max
1124 ; add offset 1130 ; add offset
1131 bcf STATUS,C
1125 movff sub_b+1,WREG 1132 movff sub_b+1,WREG
1126 addwf xC+0,1 1133 addwf xC+0,1
1127 btfsc STATUS,C 1134 btfsc STATUS,C
1128 bra TFT_velocity_VSIbar_desc_max 1135 bra TFT_velocity_VSIbar_desc_max
1129 ; check if out-of-range 1136 ; check if out-of-range
1153 movff WREG,win_width 1160 movff WREG,win_width
1154 movff WREG,win_bargraph 1161 movff WREG,win_bargraph
1155 movlw dm_velobar_lft+.2 1162 movlw dm_velobar_lft+.2
1156 movff WREG,win_leftx2 1163 movff WREG,win_leftx2
1157 movlw color_green 1164 movlw color_green
1165 movlw color_blue ; DEBUG
1158 call TFT_set_color 1166 call TFT_set_color
1159 call TFT_box 1167 call TFT_box
1160 1168
1161 ;clear the rest 1169 ;clear the rest
1162 movlw .22 1170 movlw .22