static void applyLedAnimationLayer(bool updateNow, uint32_t *timer) { static uint8_t frameCounter = 0; const int animationFrames = ledGridHeight; if(updateNow) { frameCounter = (frameCounter + 1 < animationFrames) ? frameCounter + 1 : 0; *timer += LED_STRIP_HZ(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 = &masterConfig.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); } } }
static void applyLedAnimationLayer(void) { const ledConfig_t *ledConfig; if (ARMING_FLAG(ARMED)) { return; } uint8_t ledIndex; for (ledIndex = 0; ledIndex < ledCount; ledIndex++) { ledConfig = &ledConfigs[ledIndex]; if (GET_LED_Y(ledConfig) == previousRow) { setLedHsv(ledIndex, &hsv_white); scaleLedValue(ledIndex, 50); } else if (GET_LED_Y(ledConfig) == currentRow) { setLedHsv(ledIndex, &hsv_white); } else if (GET_LED_Y(ledConfig) == nextRow) { scaleLedValue(ledIndex, 50); } } }