# HG changeset patch # User ideenmodellierer # Date 1725995792 -7200 # Node ID a7f4451ba69e26340c31e2d2482fafc09e6430cb # Parent 651d21777b616dd6383c589e069c56e4f47d9159 Added hysteresis for ascent speed coloring: In the previous version acenting with a speed close to the color limits caused a fast changing of the color for depth visiualization. To avoid this "blinking" a hysteresis has been added to the speed evaluation function. diff -r 651d21777b61 -r a7f4451ba69e Discovery/Src/data_central.c --- a/Discovery/Src/data_central.c Fri Sep 06 18:43:30 2024 +0200 +++ b/Discovery/Src/data_central.c Tue Sep 10 21:16:32 2024 +0200 @@ -922,23 +922,27 @@ #define SPEED_SLOW (5.0f) #define SPEED_MEDIUM (10.0f) #define SPEED_HIGH (15.0f) +#define SPEED_HYSTERESE (1.0f) uint8_t drawingColor_from_ascentspeed(float speed) { + static uint8_t lastColor = 0; + uint8_t color = CLUT_Font020; - if(speed >= SPEED_HIGH) + if((speed >= SPEED_HIGH) || ((lastColor == CLUT_WarningRed) && (speed >= SPEED_HIGH - SPEED_HYSTERESE))) { color = CLUT_WarningRed; } - else if(speed >= SPEED_MEDIUM) + else if((speed >= SPEED_MEDIUM) || ((lastColor == CLUT_WarningYellow) && (speed >= SPEED_MEDIUM - SPEED_HYSTERESE))) { color = CLUT_WarningYellow; } - else if(speed >= SPEED_SLOW) + else if((speed >= SPEED_SLOW) || ((lastColor == CLUT_NiceGreen) && (speed >= SPEED_SLOW - SPEED_HYSTERESE))) { color = CLUT_NiceGreen; } + lastColor = color; return color; }