qmk/qmk_firmware

[Bug] layer_state_set_user called in an endless loop if MOONLANDER_USER_LEDS is not defined

Open

#16.313 geöffnet am 10. Feb. 2022

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)C (43.867 Forks)batch import
bughelp wanted

Repository-Metriken

Stars
 (20.368 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 20T 9h) (27 gemergte PRs in 30 T)

Beschreibung

Describe the Bug

I've define a layer_state_set_user function like this:

uint32_t layer_state_set_user(layer_state_t state) {
    switch (get_highest_layer(state)) {
        case 0:
            autoshift_enable();
            break;
        default:
            autoshift_disable();
            break;
    }
    return state;
}

I also have KC_ASTG in the layout.

On layer 0, KC_ASTG have no effect at all because it get enable instantly.

I think this is caused by this line: https://github.com/qmk/qmk_firmware/blob/bc5d46aaadfdef5683d95e924e49ea6bc562c9f3/keyboards/moonlander/moonlander.c#L85 as moonlander_led_task is called in an infinite loop.

I've fix the problem by either:

  • remove the else block (and the 'if not defined')
  • or define MOONLANDER_USER_LEDS

Removing only the else block seems to do the trick but maybe there also something to do at line https://github.com/qmk/qmk_firmware/blob/bc5d46aaadfdef5683d95e924e49ea6bc562c9f3/keyboards/moonlander/moonlander.c#L391 (I'm not sure to fully understand the purpose of changing the layer state at this place)

System Information

  • Keyboard: Moonlander
  • Operating system: Manjaro
  • ARM GCC version: arm-none-eabi-gcc (Arch Repository) 11.2.0
  • QMK Firmware version: QMK Firmware 0.15.9
  • Any keyboard related software installed?
    • AutoHotKey
    • Karabiner
    • Other:

Additional Context

Disclaimer: I'm using the ZSA fork on branch firmware21

Contributor Guide