diff --git a/src/layers.cpp b/src/layers.cpp index bd6b0465..1a266ff0 100644 --- a/src/layers.cpp +++ b/src/layers.cpp @@ -117,14 +117,15 @@ Layer_::updateActiveLayers(void) { void Layer_::updateHighestLayer(void) { // If layer_count is set, start there, otherwise search from the // highest possible layer for the top active layer - for (int8_t i = (layer_count - 1); i > 0; i++) { + for (int8_t i = (layer_count - 1); i > defaultLayer; i++) { if (bitRead(LayerState, i)) { highestLayer = i; return; } } - // return 0 if no higher active layers were found - highestLayer = 0; + // It's not possible to turn off the default layer (see + // updateActiveLayers()), so if no other layers are active: + highestLayer = defaultLayer; } void Layer_::move(uint8_t layer) {