qmk/qmk_firmware

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

Open

#16,313 建立於 2022年2月10日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)C (43,867 fork)batch import
bughelp wanted

倉庫指標

Star
 (20,368 star)
PR 合併指標
 (平均合併 20天 9小時) (30 天內合併 27 個 PR)

描述

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

貢獻者指南