@ -28,7 +28,7 @@ namespace plugin {
uint16_t ColormapEffect : : map_base_ ;
uint16_t ColormapEffect : : map_base_ ;
uint8_t ColormapEffect : : max_layers_ ;
uint8_t ColormapEffect : : max_layers_ ;
uint8_t ColormapEffect : : last_highest _layer_;
uint8_t ColormapEffect : : top _layer_;
void ColormapEffect : : max_layers ( uint8_t max_ ) {
void ColormapEffect : : max_layers ( uint8_t max_ ) {
if ( map_base_ ! = 0 )
if ( map_base_ ! = 0 )
@ -42,21 +42,20 @@ void ColormapEffect::onActivate(void) {
if ( ! Kaleidoscope . has_leds )
if ( ! Kaleidoscope . has_leds )
return ;
return ;
last_highest _layer_ = Layer . top ( ) ;
top _layer_ = Layer . top ( ) ;
if ( last_highest _layer_ < = max_layers_ )
if ( top _layer_ < = max_layers_ )
: : LEDPaletteTheme . updateHandler ( map_base_ , last_highest _layer_) ;
: : LEDPaletteTheme . updateHandler ( map_base_ , top _layer_) ;
}
}
void ColormapEffect : : update ( void ) {
void ColormapEffect : : refreshAt ( byte row , byte col ) {
if ( ! Kaleidoscope . has_leds | | Layer . top ( ) = = last_highest_layer_ )
if ( top_layer_ < = max_layers_ )
return ;
: : LEDPaletteTheme . refreshAt ( map_base_ , top_layer_ , row , col ) ;
onActivate ( ) ;
}
}
void ColormapEffect : : refreshAt ( byte row , byte col ) {
EventHandlerResult ColormapEffect : : onLayerChange ( ) {
if ( last_highest_layer_ < = max_layers_ )
if ( : : LEDControl . get_mode ( ) = = this )
: : LEDPaletteTheme . refreshAt ( map_base_ , last_highest_layer_ , row , col ) ;
onActivate ( ) ;
return EventHandlerResult : : OK ;
}
}
EventHandlerResult ColormapEffect : : onFocusEvent ( const char * command ) {
EventHandlerResult ColormapEffect : : onFocusEvent ( const char * command ) {