qmk/qmk_firmware

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

Ouverte

#16 313 ouverte le 10 févr. 2022

 (1 commentaire) (0 réaction) (0 personne assignée)C (43 867 forks)batch import
bughelp wanted

Métriques du dépôt

Stars
 (20 368 étoiles)
Métriques de merge PR
 (Métriques PR en attente)

Description

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

Guide contributeur