@ -117,14 +117,15 @@ Layer_::updateActiveLayers(void) {
void Layer_ : : updateHighestLayer ( void ) {
void Layer_ : : updateHighestLayer ( void ) {
// If layer_count is set, start there, otherwise search from the
// If layer_count is set, start there, otherwise search from the
// highest possible layer for the top active layer
// 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 ) ) {
if ( bitRead ( LayerState , i ) ) {
highestLayer = i ;
highestLayer = i ;
return ;
return ;
}
}
}
}
// return 0 if no higher active layers were found
// It's not possible to turn off the default layer (see
highestLayer = 0 ;
// updateActiveLayers()), so if no other layers are active:
highestLayer = defaultLayer ;
}
}
void Layer_ : : move ( uint8_t layer ) {
void Layer_ : : move ( uint8_t layer ) {