Enable light palettes for all light subtypes

This commit is contained in:
Paul C Diem 2020-11-07 21:40:17 -06:00
parent c01a804108
commit 0d56b8f231

View File

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