qmk/qmk_firmware

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

Open

#16.313 aberto em 10 de fev. de 2022

Ver no GitHub
 (1 comment) (0 reactions) (0 assignees)C (43.867 forks)batch import
bughelp wanted

Métricas do repositório

Stars
 (20.368 stars)
Métricas de merge de PR
 (Mesclagem média 20d 9h) (27 fundiu PRs em 30d)

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

Guia do colaborador