mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 17:25:20 +03:00
Fixed ordering of the LED_STRIP overlays.
This commit is contained in:
parent
44f19bd128
commit
09353a2b5d
1 changed files with 8 additions and 47 deletions
|
@ -86,8 +86,6 @@ static bool ledStripEnabled = true;
|
||||||
|
|
||||||
static void ledStripDisable(void);
|
static void ledStripDisable(void);
|
||||||
|
|
||||||
//#define USE_LED_ANIMATION
|
|
||||||
|
|
||||||
#define HZ_TO_US(hz) ((int32_t)((1000 * 1000) / (hz)))
|
#define HZ_TO_US(hz) ((int32_t)((1000 * 1000) / (hz)))
|
||||||
|
|
||||||
#define MAX_TIMER_DELAY (5 * 1000 * 1000)
|
#define MAX_TIMER_DELAY (5 * 1000 * 1000)
|
||||||
|
@ -960,55 +958,21 @@ static void applyLedBlinkLayer(bool updateNow, timeUs_t *timer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_LED_ANIMATION
|
// In reverse order of priority
|
||||||
static void applyLedAnimationLayer(bool updateNow, timeUs_t *timer)
|
|
||||||
{
|
|
||||||
static uint8_t frameCounter = 0;
|
|
||||||
const int animationFrames = ledGridRows;
|
|
||||||
if (updateNow) {
|
|
||||||
frameCounter = (frameCounter + 1 < animationFrames) ? frameCounter + 1 : 0;
|
|
||||||
*timer += HZ_TO_US(20);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ARMING_FLAG(ARMED))
|
|
||||||
return;
|
|
||||||
|
|
||||||
int previousRow = frameCounter > 0 ? frameCounter - 1 : animationFrames - 1;
|
|
||||||
int currentRow = frameCounter;
|
|
||||||
int nextRow = (frameCounter + 1 < animationFrames) ? frameCounter + 1 : 0;
|
|
||||||
|
|
||||||
for (int ledIndex = 0; ledIndex < ledCounts.count; ledIndex++) {
|
|
||||||
const ledConfig_t *ledConfig = &ledStripConfig()->ledConfigs[ledIndex];
|
|
||||||
|
|
||||||
if (ledGetY(ledConfig) == previousRow) {
|
|
||||||
setLedHsv(ledIndex, getSC(LED_SCOLOR_ANIMATION));
|
|
||||||
scaleLedValue(ledIndex, 50);
|
|
||||||
} else if (ledGetY(ledConfig) == currentRow) {
|
|
||||||
setLedHsv(ledIndex, getSC(LED_SCOLOR_ANIMATION));
|
|
||||||
} else if (ledGetY(ledConfig) == nextRow) {
|
|
||||||
scaleLedValue(ledIndex, 50);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
timBlink,
|
timBlink,
|
||||||
timLarson,
|
timLarson,
|
||||||
timBattery,
|
timRing,
|
||||||
timRssi,
|
timIndicator,
|
||||||
#ifdef USE_GPS
|
|
||||||
timGps,
|
|
||||||
#endif
|
|
||||||
timWarning,
|
|
||||||
#ifdef USE_VTX_COMMON
|
#ifdef USE_VTX_COMMON
|
||||||
timVtx,
|
timVtx,
|
||||||
#endif
|
#endif
|
||||||
timIndicator,
|
#ifdef USE_GPS
|
||||||
#ifdef USE_LED_ANIMATION
|
timGps,
|
||||||
timAnimation,
|
|
||||||
#endif
|
#endif
|
||||||
timRing,
|
timBattery,
|
||||||
|
timRssi,
|
||||||
|
timWarning,
|
||||||
timTimerCount
|
timTimerCount
|
||||||
} timId_e;
|
} timId_e;
|
||||||
|
|
||||||
|
@ -1037,9 +1001,6 @@ static applyLayerFn_timed* layerTable[] = {
|
||||||
[timVtx] = &applyLedVtxLayer,
|
[timVtx] = &applyLedVtxLayer,
|
||||||
#endif
|
#endif
|
||||||
[timIndicator] = &applyLedIndicatorLayer,
|
[timIndicator] = &applyLedIndicatorLayer,
|
||||||
#ifdef USE_LED_ANIMATION
|
|
||||||
[timAnimation] = &applyLedAnimationLayer,
|
|
||||||
#endif
|
|
||||||
[timRing] = &applyLedThrustRingLayer
|
[timRing] = &applyLedThrustRingLayer
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue