From 2486bf1797a6f519190973e68b6c791af024bbce Mon Sep 17 00:00:00 2001 From: Anders Knudsen Date: Fri, 19 Nov 2021 12:01:49 -0700 Subject: [PATCH 1/3] Adding Jeff Hendrix to AUTHORS --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index a254cd336..c5aa5662b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -38,6 +38,7 @@ Hyon Lim Hubert Jozwiak James Harrison Jan Staal +Jeff Hendrix Jeremy Waters Joe Hermaszewski Joe Poser From 45fe0abdcf6e419d8878e2a96aeed0e661364959 Mon Sep 17 00:00:00 2001 From: Jeff Hendrix Date: Fri, 19 Nov 2021 12:55:12 -0700 Subject: [PATCH 2/3] Add ability to adjust LED Strip color with RC channel --- docs/LedStrip.md | 4 +++- src/main/io/ledstrip.c | 15 ++++++++++++++- src/main/io/ledstrip.h | 3 ++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/docs/LedStrip.md b/docs/LedStrip.md index 2220ce26c..b61c2ce55 100644 --- a/docs/LedStrip.md +++ b/docs/LedStrip.md @@ -115,6 +115,7 @@ Each LED has one base function: * `G` - `G`PS state. * `S` - R`S`SSI level. * `L` - Battery `L`evel. +* `H` - C`H`annel. And each LED has overlays: @@ -125,7 +126,7 @@ And each LED has overlays: * `O` - Lars`O`n Scanner (Cylon Effect). * `N` - Blink on la`N`ding (throttle < 50%). -`cc` specifies the color number (0 based index). +`cc` specifies the color number (0 based index), or Channel number to adjust Hue Example: @@ -137,6 +138,7 @@ led 3 0,15:SD:AWI:0 led 4 7,7::C:1 led 5 8,8::C:2 led 6 8,9::B:1 +led 7 8,10::H:6 ``` To erase an led, and to mark the end of the chain, use `0,0::` as the second argument, like this: diff --git a/src/main/io/ledstrip.c b/src/main/io/ledstrip.c index e7a27ec76..27a1ff775 100644 --- a/src/main/io/ledstrip.c +++ b/src/main/io/ledstrip.c @@ -220,7 +220,7 @@ static const hsvColor_t* getSC(ledSpecialColorIds_e index) } static const char directionCodes[LED_DIRECTION_COUNT] = { 'N', 'E', 'S', 'W', 'U', 'D' }; -static const char baseFunctionCodes[LED_BASEFUNCTION_COUNT] = { 'C', 'F', 'A', 'L', 'S', 'G', 'R' }; +static const char baseFunctionCodes[LED_BASEFUNCTION_COUNT] = { 'C', 'F', 'A', 'L', 'S', 'G', 'R', 'H' }; static const char overlayCodes[LED_OVERLAY_COUNT] = { 'T', 'O', 'B', 'N', 'I', 'W' }; #define CHUNK_BUFFER_SIZE 11 @@ -438,6 +438,7 @@ static void applyLedFixedLayers(void) int fn = ledGetFunction(ledConfig); int hOffset = HSV_HUE_MAX; + uint8_t channel = 0; switch (fn) { case LED_FUNCTION_COLOR: @@ -470,6 +471,18 @@ static void applyLedFixedLayers(void) hOffset += scaleRange(getRSSI() * 100, 0, 1023, -30, 120); break; + case LED_FUNCTION_CHANNEL: + channel = ledGetColor(ledConfig) - 1; + color = HSV(RED); + hOffset = scaleRange(rxGetChannelValue(channel), PWM_RANGE_MIN, PWM_RANGE_MAX, -1, 360); + // add black and white to range of colors + if (hOffset < 0) { + color = HSV(BLACK); + } else if (hOffset > HSV_HUE_MAX) { + color = HSV(WHITE); + } + break; + default: break; } diff --git a/src/main/io/ledstrip.h b/src/main/io/ledstrip.h index 07ad853f8..ebd10ad24 100644 --- a/src/main/io/ledstrip.h +++ b/src/main/io/ledstrip.h @@ -24,7 +24,7 @@ #define LED_CONFIGURABLE_COLOR_COUNT 16 #define LED_MODE_COUNT 6 #define LED_DIRECTION_COUNT 6 -#define LED_BASEFUNCTION_COUNT 7 +#define LED_BASEFUNCTION_COUNT 8 #define LED_OVERLAY_COUNT 6 #define LED_SPECIAL_COLOR_COUNT 11 @@ -124,6 +124,7 @@ typedef enum { LED_FUNCTION_RSSI, LED_FUNCTION_GPS, LED_FUNCTION_THRUST_RING, + LED_FUNCTION_CHANNEL, } ledBaseFunctionId_e; typedef enum { From d8746b00233035ba1250a10e94b2080175eb4e6f Mon Sep 17 00:00:00 2001 From: root Date: Wed, 23 Feb 2022 13:05:41 -0700 Subject: [PATCH 3/3] bump group version number --- src/main/io/ledstrip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/io/ledstrip.c b/src/main/io/ledstrip.c index 27a1ff775..5f40694d5 100644 --- a/src/main/io/ledstrip.c +++ b/src/main/io/ledstrip.c @@ -73,7 +73,7 @@ #include "telemetry/telemetry.h" -PG_REGISTER_WITH_RESET_FN(ledStripConfig_t, ledStripConfig, PG_LED_STRIP_CONFIG, 0); +PG_REGISTER_WITH_RESET_FN(ledStripConfig_t, ledStripConfig, PG_LED_STRIP_CONFIG, 1); static bool ledStripInitialised = false; static bool ledStripEnabled = true;