comparison Discovery/Src/data_central.c @ 895:94535e672583 Evo_2_23

Zusammenf?hren
author heinrichsweikamp
date Wed, 18 Sep 2024 14:31:06 +0200
parents a7f4451ba69e
children d4622533271d
comparison
equal deleted inserted replaced
894:9e2f9b91e827 895:94535e672583
920 } 920 }
921 921
922 #define SPEED_SLOW (5.0f) 922 #define SPEED_SLOW (5.0f)
923 #define SPEED_MEDIUM (10.0f) 923 #define SPEED_MEDIUM (10.0f)
924 #define SPEED_HIGH (15.0f) 924 #define SPEED_HIGH (15.0f)
925 #define SPEED_HYSTERESE (1.0f)
925 926
926 uint8_t drawingColor_from_ascentspeed(float speed) 927 uint8_t drawingColor_from_ascentspeed(float speed)
927 { 928 {
929 static uint8_t lastColor = 0;
930
928 uint8_t color = CLUT_Font020; 931 uint8_t color = CLUT_Font020;
929 932
930 if(speed >= SPEED_HIGH) 933 if((speed >= SPEED_HIGH) || ((lastColor == CLUT_WarningRed) && (speed >= SPEED_HIGH - SPEED_HYSTERESE)))
931 { 934 {
932 color = CLUT_WarningRed; 935 color = CLUT_WarningRed;
933 } 936 }
934 else if(speed >= SPEED_MEDIUM) 937 else if((speed >= SPEED_MEDIUM) || ((lastColor == CLUT_WarningYellow) && (speed >= SPEED_MEDIUM - SPEED_HYSTERESE)))
935 { 938 {
936 color = CLUT_WarningYellow; 939 color = CLUT_WarningYellow;
937 } 940 }
938 else if(speed >= SPEED_SLOW) 941 else if((speed >= SPEED_SLOW) || ((lastColor == CLUT_NiceGreen) && (speed >= SPEED_SLOW - SPEED_HYSTERESE)))
939 { 942 {
940 color = CLUT_NiceGreen; 943 color = CLUT_NiceGreen;
941 } 944 }
945 lastColor = color;
942 return color; 946 return color;
943 } 947 }
944 948
945 949