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:
parent
37f119cf4f
commit
5cd2ab50e4
6 changed files with 28 additions and 9 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue