Limit layers we work on to max_layers_

The plugin should not try to set the colors of a layer higher than
`max_layers_`, because the colormap for that would be coming from an EEPROM area
that is not ours, and result in weird colors at best.

Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>
pull/389/head
Gergely Nagy 7 years ago
parent 7a582f3c4b
commit 3fdbc72f81

@ -44,6 +44,7 @@ void ColormapEffect::max_layers(uint8_t max_) {
void ColormapEffect::onActivate(void) {
last_highest_layer_ = Layer.top();
if (last_highest_layer_ <= max_layers_)
::LEDPaletteTheme.updateHandler(map_base_, last_highest_layer_);
}
@ -55,6 +56,7 @@ void ColormapEffect::update(void) {
}
void ColormapEffect::refreshAt(byte row, byte col) {
if (last_highest_layer_ <= max_layers_)
::LEDPaletteTheme.refreshAt(map_base_, last_highest_layer_, row, col);
}

Loading…
Cancel
Save