qmk/qmk_firmware

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

Open

#16.313 aperta il 10 feb 2022

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)C (43.867 fork)batch import
bughelp wanted

Metriche repository

Star
 (20.368 star)
Metriche merge PR
 (Merge medio 20g 9h) (27 PR mergiate in 30 g)

Descrizione

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

Guida contributor