1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 08:45:36 +03:00

Add LED strip config values to MSP (#12995)

* Add LED strip config values to MSP

* change hue calculation + higher max frequency

* higher rainbow frequency

* define LED Strip task rate

* msp2

* fix delta size

* Update src/main/msp/msp.c

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>

* Update src/main/msp/msp.c

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>

---------

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
This commit is contained in:
ASDosjani 2023-09-05 17:09:31 +02:00 committed by GitHub
parent 37f119cf4f
commit 5cd2ab50e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 9 deletions

View file

@ -898,26 +898,26 @@ static void applyLedThrustRingLayer(bool updateNow, timeUs_t *timer)
static void applyRainbowLayer(bool updateNow, timeUs_t *timer)
{
//use offset as a fixed point number
static int offset = 0;
if (updateNow) {
*timer += HZ_TO_US(ledStripConfig()->ledstrip_rainbow_freq);
offset += ledStripConfig()->ledstrip_rainbow_freq;
*timer += HZ_TO_US(TASK_LEDSTRIP_RATE_HZ);
}
uint8_t rainbowLedIndex = 0;
for (unsigned i = 0; i < ledCounts.count; i++) {
const ledConfig_t *ledConfig = &ledStripStatusModeConfig()->ledConfigs[i];
if (ledGetOverlayBit(ledConfig, LED_OVERLAY_RAINBOW)) {
hsvColor_t ledColor;
ledColor.h = (offset + (rainbowLedIndex * ledStripConfig()->ledstrip_rainbow_delta)) % HSV_HUE_MAX;
ledColor.h = (offset / TASK_LEDSTRIP_RATE_HZ + rainbowLedIndex * ledStripConfig()->ledstrip_rainbow_delta) % (HSV_HUE_MAX + 1);
ledColor.s = 0;
ledColor.v = HSV_VALUE_MAX;
setLedHsv(i, &ledColor);
rainbowLedIndex++;
}
}
offset++;
}
typedef struct larsonParameters_s {