From 14e03cd59839691835dfc8a011a478f107b7ebfa Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Tue, 14 Feb 2017 11:59:28 +0100 Subject: [PATCH] TriColor: Remove a useless optimisation Do not store the previous layer state, and instead of updating only when the layer changes, just update anyway. It's not that costy anymore, with the recent `Layer.lookup` optimisations. Signed-off-by: Gergely Nagy --- src/Kaleidoscope/TriColor.cpp | 6 ------ src/Kaleidoscope/TriColor.h | 1 - 2 files changed, 7 deletions(-) diff --git a/src/Kaleidoscope/TriColor.cpp b/src/Kaleidoscope/TriColor.cpp index ad1e1484..ad0309be 100644 --- a/src/Kaleidoscope/TriColor.cpp +++ b/src/Kaleidoscope/TriColor.cpp @@ -25,16 +25,10 @@ namespace KaleidoscopePlugins { this->baseColor = baseColor; this->modColor = modColor; this->escColor = escColor; - previousLayerState = 0xffffffff; } void TriColor::update (void) { - uint8_t layerState = Layer.getLayerState (); - if (previousLayerState == layerState) - return; - previousLayerState = layerState; - for (uint8_t r = 0; r < ROWS; r++) { for (uint8_t c = 0; c < COLS; c++) { Key k = Layer.lookup (r, c); diff --git a/src/Kaleidoscope/TriColor.h b/src/Kaleidoscope/TriColor.h index a0c1cf7e..f7e900dc 100644 --- a/src/Kaleidoscope/TriColor.h +++ b/src/Kaleidoscope/TriColor.h @@ -31,7 +31,6 @@ namespace KaleidoscopePlugins { virtual void update (void) final; private: - uint32_t previousLayerState; cRGB baseColor; cRGB modColor; cRGB escColor;