From b9a3bdb982abe1905e6c3ecb55c0e6344f95495b Mon Sep 17 00:00:00 2001 From: Bram Inniger Date: Tue, 5 Dec 2023 07:19:14 +0200 Subject: [PATCH] [Keyboard] Fix oled layer display order for Aurora boards (#22521) --- keyboards/splitkb/aurora/corne/corne.c | 21 ++++++++++++-------- keyboards/splitkb/aurora/helix/helix.c | 21 ++++++++++++-------- keyboards/splitkb/aurora/lily58/lily58.c | 21 ++++++++++++-------- keyboards/splitkb/aurora/sofle_v2/sofle_v2.c | 21 ++++++++++++-------- keyboards/splitkb/aurora/sweep/sweep.c | 21 ++++++++++++-------- 5 files changed, 65 insertions(+), 40 deletions(-) diff --git a/keyboards/splitkb/aurora/corne/corne.c b/keyboards/splitkb/aurora/corne/corne.c index 11ed0500ad..d95a448021 100644 --- a/keyboards/splitkb/aurora/corne/corne.c +++ b/keyboards/splitkb/aurora/corne/corne.c @@ -212,14 +212,19 @@ static void render_layer_state(void) { 0x20, 0x9d, 0x9e, 0x9f, 0x20, 0x20, 0xbd, 0xbe, 0xbf, 0x20, 0x20, 0xdd, 0xde, 0xdf, 0x20, 0}; - if(layer_state_is(_LOWER)) { - oled_write_P(lower_layer, false); - } else if(layer_state_is(_RAISE)) { - oled_write_P(raise_layer, false); - } else if(layer_state_is(_DEFAULT)) { - oled_write_P(default_layer, false); - } else { - oled_write_P(adjust_layer, false); + + switch (get_highest_layer(layer_state | default_layer_state)) { + case _LOWER: + oled_write_P(lower_layer, false); + break; + case _RAISE: + oled_write_P(raise_layer, false); + break; + case _ADJUST: + oled_write_P(adjust_layer, false); + break; + default: + oled_write_P(default_layer, false); } } diff --git a/keyboards/splitkb/aurora/helix/helix.c b/keyboards/splitkb/aurora/helix/helix.c index a6ba65aeb5..3d3094cbd1 100644 --- a/keyboards/splitkb/aurora/helix/helix.c +++ b/keyboards/splitkb/aurora/helix/helix.c @@ -208,14 +208,19 @@ void render_layer_state(void) { 0x20, 0x9d, 0x9e, 0x9f, 0x20, 0x20, 0xbd, 0xbe, 0xbf, 0x20, 0x20, 0xdd, 0xde, 0xdf, 0x20, 0}; - if(layer_state_is(_LOWER)) { - oled_write_P(lower_layer, false); - } else if(layer_state_is(_RAISE)) { - oled_write_P(raise_layer, false); - } else if(layer_state_is(_DEFAULT)) { - oled_write_P(default_layer, false); - } else { - oled_write_P(adjust_layer, false); + + switch (get_highest_layer(layer_state | default_layer_state)) { + case _LOWER: + oled_write_P(lower_layer, false); + break; + case _RAISE: + oled_write_P(raise_layer, false); + break; + case _ADJUST: + oled_write_P(adjust_layer, false); + break; + default: + oled_write_P(default_layer, false); } } diff --git a/keyboards/splitkb/aurora/lily58/lily58.c b/keyboards/splitkb/aurora/lily58/lily58.c index 828ac84f47..83e4ecbe08 100644 --- a/keyboards/splitkb/aurora/lily58/lily58.c +++ b/keyboards/splitkb/aurora/lily58/lily58.c @@ -212,14 +212,19 @@ void render_layer_state(void) { 0x20, 0x9d, 0x9e, 0x9f, 0x20, 0x20, 0xbd, 0xbe, 0xbf, 0x20, 0x20, 0xdd, 0xde, 0xdf, 0x20, 0}; - if(layer_state_is(_LOWER)) { - oled_write_P(lower_layer, false); - } else if(layer_state_is(_RAISE)) { - oled_write_P(raise_layer, false); - } else if(layer_state_is(_DEFAULT)) { - oled_write_P(default_layer, false); - } else { - oled_write_P(adjust_layer, false); + + switch (get_highest_layer(layer_state | default_layer_state)) { + case _LOWER: + oled_write_P(lower_layer, false); + break; + case _RAISE: + oled_write_P(raise_layer, false); + break; + case _ADJUST: + oled_write_P(adjust_layer, false); + break; + default: + oled_write_P(default_layer, false); } } diff --git a/keyboards/splitkb/aurora/sofle_v2/sofle_v2.c b/keyboards/splitkb/aurora/sofle_v2/sofle_v2.c index f5cb0573ce..4d51b88bba 100644 --- a/keyboards/splitkb/aurora/sofle_v2/sofle_v2.c +++ b/keyboards/splitkb/aurora/sofle_v2/sofle_v2.c @@ -212,14 +212,19 @@ void render_layer_state(void) { 0x20, 0x9d, 0x9e, 0x9f, 0x20, 0x20, 0xbd, 0xbe, 0xbf, 0x20, 0x20, 0xdd, 0xde, 0xdf, 0x20, 0}; - if(layer_state_is(_LOWER)) { - oled_write_P(lower_layer, false); - } else if(layer_state_is(_RAISE)) { - oled_write_P(raise_layer, false); - } else if(layer_state_is(_DEFAULT)) { - oled_write_P(default_layer, false); - } else { - oled_write_P(adjust_layer, false); + + switch (get_highest_layer(layer_state | default_layer_state)) { + case _LOWER: + oled_write_P(lower_layer, false); + break; + case _RAISE: + oled_write_P(raise_layer, false); + break; + case _ADJUST: + oled_write_P(adjust_layer, false); + break; + default: + oled_write_P(default_layer, false); } } diff --git a/keyboards/splitkb/aurora/sweep/sweep.c b/keyboards/splitkb/aurora/sweep/sweep.c index 605847d99b..80abd94eea 100644 --- a/keyboards/splitkb/aurora/sweep/sweep.c +++ b/keyboards/splitkb/aurora/sweep/sweep.c @@ -212,14 +212,19 @@ void render_layer_state(void) { 0x20, 0x9d, 0x9e, 0x9f, 0x20, 0x20, 0xbd, 0xbe, 0xbf, 0x20, 0x20, 0xdd, 0xde, 0xdf, 0x20, 0}; - if(layer_state_is(_LOWER)) { - oled_write_P(lower_layer, false); - } else if(layer_state_is(_RAISE)) { - oled_write_P(raise_layer, false); - } else if(layer_state_is(_DEFAULT)) { - oled_write_P(default_layer, false); - } else { - oled_write_P(adjust_layer, false); + + switch (get_highest_layer(layer_state | default_layer_state)) { + case _LOWER: + oled_write_P(lower_layer, false); + break; + case _RAISE: + oled_write_P(raise_layer, false); + break; + case _ADJUST: + oled_write_P(adjust_layer, false); + break; + default: + oled_write_P(default_layer, false); } }