Merge pull request #9772 from pcdiem/lp1

Enable light palettes for all light subtypes
This commit is contained in:
Theo Arends 2020-11-08 09:17:52 +01:00 committed by GitHub
commit 2987540e21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -1741,8 +1741,8 @@ void LightPreparePower(power_t channels = 0xFFFFFFFF) { // 1 = only RGB, 2 =
void LightSetPaletteEntry(void)
{
uint8_t bri = light_state.getBri();
uint8_t * palette_entry = &Light.palette[Light.wheel * LST_MAX];
for (int i = 0; i < LST_MAX; i++) {
uint8_t * palette_entry = &Light.palette[Light.wheel * Light.subtype];
for (int i = 0; i < Light.subtype; i++) {
Light.new_color[i] = changeUIntScale(palette_entry[i], 0, 255, 0, bri);
}
light_state.setChannelsRaw(Light.new_color);
@ -2535,9 +2535,8 @@ bool LightColorEntry(char *buffer, uint32_t buffer_length)
}
#ifdef USE_LIGHT_PALETTE
else if (Light.palette_count) {
value--;
Light.wheel = value;
memcpy_P(&Light.entry_color, &Light.palette[value * LST_MAX], LST_MAX);
memcpy_P(&Light.entry_color, &Light.palette[value * Light.subtype], Light.subtype);
entry_type = 1; // Hexadecimal
}
#endif // USE_LIGHT_PALETTE