Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/fc/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -2043,8 +2043,8 @@ static void cliWaypoints(char *cmdline)
static void printLed(uint8_t dumpMask, const ledConfig_t *ledConfigs, const ledConfig_t *defaultLedConfigs)
{
const char *format = "led %u %s";
char ledConfigBuffer[20];
char ledConfigDefaultBuffer[20];
char ledConfigBuffer[LED_CONFIG_STRING_LENGTH];
char ledConfigDefaultBuffer[LED_CONFIG_STRING_LENGTH];
for (uint32_t i = 0; i < LED_MAX_STRIP_LENGTH; i++) {
ledConfig_t ledConfig = ledConfigs[i];
generateLedConfig(&ledConfig, ledConfigBuffer, sizeof(ledConfigBuffer));
Expand Down
15 changes: 7 additions & 8 deletions src/main/io/ledstrip.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static void ledStripDisable(void);
const hsvColor_t hsv[] = {
// H S V
[COLOR_BLACK] = { 0, 0, 0},
[COLOR_WHITE] = { 0, 0, 255},
[COLOR_WHITE] = { 0, 255, 255},
[COLOR_RED] = { 0, 0, 255},
[COLOR_ORANGE] = { 30, 0, 255},
[COLOR_YELLOW] = { 60, 0, 255},
Expand Down Expand Up @@ -342,8 +342,7 @@ void generateLedConfig(ledConfig_t *ledConfig, char *ledConfigBuffer, size_t buf
}
*fptr = 0;

// TODO - check buffer length
tfp_sprintf(ledConfigBuffer, "%u,%u:%s:%s:%u", ledGetX(ledConfig), ledGetY(ledConfig), directions, baseFunctionOverlays, ledGetColor(ledConfig));
tfp_snprintf(ledConfigBuffer, bufferSize, "%u,%u:%s:%s:%u", ledGetX(ledConfig), ledGetY(ledConfig), directions, baseFunctionOverlays, ledGetColor(ledConfig));
}

typedef enum {
Expand Down Expand Up @@ -871,11 +870,11 @@ static void applyLedRainbowLayer(bool updateNow, timeUs_t *timer)
const ledConfig_t *ledConfig = &ledStripConfig()->ledConfigs[i];

if (ledGetOverlayBit(ledConfig, LED_OVERLAY_RAINBOW)) {
hsvColor_t ledColor;
getLedHsv(i, &ledColor);
ledColor.h = (rainbowHue + (rainbowIndex * rainbowDelta)) % 360;
ledColor.s = 0; // Force full color saturation (Required)
ledColor.v = 255; // Force full brightness (Required)
const hsvColor_t ledColor = {
.h = (rainbowHue + (rainbowIndex * rainbowDelta)) % 360,
.s = 0, // full saturation (INAV stores saturation inverted)
.v = 255, // full brightness
};
setLedHsv(i, &ledColor);
rainbowIndex++;
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/io/ledstrip.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
#define LED_DIRECTION_COUNT 6
#define LED_BASEFUNCTION_COUNT 8
#define LED_OVERLAY_COUNT 8

// Longest CLI representation of one LED, e.g. "15,15:NESWUD:CTOBNIWEV:15" (25 characters) plus the terminator
#define LED_CONFIG_STRING_LENGTH 32
#define LED_SPECIAL_COLOR_COUNT 9

#define LED_FUNCTION_OFFSET 8
Expand Down
Empty file modified src/utils/update_cli_docs.py
100644 → 100755
Empty file.
Loading