OpenStickFoundation/GP2040-CE

v0.5.4 inclusion - Ability to change the color of the addressable RGB Player LEDs

TheTrainGoes opened this issue · 1 comments

Currently, when the Player LEDs are set to RGB they default to green.

This can be changed via:
https://github.com/OpenStickFoundation/GP2040-CE/blob/main/src/addons/neopicoleds.cpp

Line 153-164

// Apply the player LEDs to our first 4 leds if we're in NEOPIXEL mode if (PLED_TYPE == PLED_TYPE_RGB) { switch (inputMode) { // HACK case INPUT_MODE_XINPUT: for (int i = 0; i < PLED_COUNT; i++) { float level = (static_cast<float>(PLED_MAX_LEVEL - neoPLEDs->getLedLevels()[i]) / static_cast<float>(PLED_MAX_LEVEL)); float brightness = as.GetBrightnessX() * level; rgbPLEDValues[i] = ((RGB)ColorGreen).value(neopico->GetFormat(), brightness); frame[PLED_PINS[i]] = rgbPLEDValues[i]; } } }

Specifically the (RGB)ColorGreen) value.

If this could be added into the boardconfig.H and web UI that would be great.

There are two parts to this:

1 - Add this into boardconfig.h as a #define that can be set to any of the available colors, this should be added into the sectino of the boardconfig file where the player LED info is set.

2 - Add this into web-config. This is more challenging since we do not currently have the ability to enable any of the player LED info. Ideally this would live in a new section of the LED configuration called Player LEDs

First drop down box - Player LED type
Option 1 - 'PLED_TYPE_NONE' - "No player LEDS"
Option 2 - 'PLED_TYPE_PWM' - "Player LEDs via GPIO" (will need to check for conflicts with other assigned pins)
Option 3 - 'PLED_TYPE_RGB' - "Player LEDs via RGB LED"

Entry box 1 - Player 1 assignment (when PWM selected above this becomes the GPIO for P1 LED, when in RGB this becomes the LED number in the chain)
Entry box 2 - Player 2 assignment (when PWM selected above this becomes the GPIO for P2 LED, when in RGB this becomes the LED number in the chain)
Entry box 3 - Player 3 assignment (when PWM selected above this becomes the GPIO for P3 LED, when in RGB this becomes the LED number in the chain)
Entry box 4 - Player 4 assignment (when PWM selected above this becomes the GPIO for P4 LED, when in RGB this becomes the LED number in the chain)

Second drop down box - Player LED color (only available if 'PLED_TYPE_RGB' is chosen)
Options are all the available colors.

as a note - the Player LEDs (if RGB) must be at the end of the chain and must be in order [example 10,11,12,13]).