qmk / qmk_firmware

Open-source keyboard firmware for Atmel AVR and Arm USB families
https://qmk.fm
GNU General Public License v2.0
18.1k stars 38.92k forks source link

[Bug] rgblight Compile-time error when specifying the number of LEDs #23775

Open rynfox13 opened 4 months ago

rynfox13 commented 4 months ago

Describe the Bug

There's a bug in the RGB code causing a compile time issue:

❯ qmk compile
Ψ Compiling keymap with gmake -r -R -f builddefs/build_keyboard.mk -s KEYBOARD=handwired/dactyl_manuform/5x6 KEYMAP=kaze KEYBOARD_FILESAFE=handwired_dactyl_manuform_5x6 TARGET=handwired_dactyl_manuform_5x6_kaze INTERMEDIATE_OUTPUT=.build/obj_handwired_dactyl_manuform_5x6_kaze VERBOSE=false COLOR=true SILENT=false QMK_BIN="qmk"

avr-gcc (Homebrew AVR GCC 8.5.0_2) 8.5.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Size before:
   text    data     bss     dec     hex filename
      0   22382       0   22382    576e handwired_dactyl_manuform_5x6_kaze.hex

Compiling: .build/obj_handwired_dactyl_manuform_5x6_kaze/src/default_keyboard.c                     [OK]
Compiling: quantum/keymap_introspection.c                                                           [OK]
Compiling: quantum/quantum.c                                                                        [OK]
Compiling: quantum/bitwise.c                                                                        [OK]
Compiling: quantum/led.c                                                                            [OK]
Compiling: quantum/action.c                                                                         [OK]
Compiling: quantum/action_layer.c                                                                   [OK]
Compiling: quantum/action_tapping.c                                                                 [OK]
Compiling: quantum/action_util.c                                                                    [OK]
Compiling: quantum/eeconfig.c                                                                       [OK]
Compiling: quantum/keyboard.c                                                                       [OK]
Compiling: quantum/keymap_common.c                                                                  [OK]
Compiling: quantum/keycode_config.c                                                                 [OK]
Compiling: quantum/sync_timer.c                                                                     [OK]
Compiling: quantum/logging/debug.c                                                                  [OK]
Compiling: quantum/logging/sendchar.c                                                               [OK]
Compiling: quantum/matrix_common.c                                                                  [OK]
Compiling: quantum/matrix.c                                                                         [OK]
Compiling: quantum/debounce/sym_defer_g.c                                                           [OK]
Compiling: quantum/split_common/split_util.c                                                        [OK]
Compiling: quantum/split_common/transport.c                                                         [OK]
Compiling: quantum/split_common/transactions.c                                                      [OK]
Compiling: quantum/main.c                                                                           [OK]
Assembling: platforms/avr/xprintf.S                                                                 [OK]
Compiling: platforms/avr/printf.c                                                                   [OK]
Compiling: quantum/color.c                                                                          [OK]
Compiling: quantum/rgblight/rgblight.c                                                             In file included from quantum/rgblight/rgblight.c:21:
quantum/rgblight/rgblight.h:21: error: "RGBLIGHT_LED_COUNT" redefined [-Werror]
 #    define RGBLIGHT_LED_COUNT RGBLED_NUM

In file included from <command-line>:
./.build/obj_handwired_dactyl_manuform_5x6_kaze/src/info_config.h:61: note: this is the location of the previous definition
 #    define RGBLIGHT_LED_COUNT 12

cc1: all warnings being treated as errors
 [ERRORS]
 |
 |
 |
gmake: *** [builddefs/common_rules.mk:373: .build/obj_handwired_dactyl_manuform_5x6_kaze/quantum/rgblight/rgblight.o] Error 1

Very simple fix, add a #undef before the #define (see additional detail below).

Keyboard Used

handwire/dactyl_manuform/5x6

Link to product page (if applicable)

No response

Operating System

macOS

qmk doctor Output

No response

Is AutoHotKey / Karabiner installed

Other keyboard-related software installed

No response

Additional Context

Patch:

diff --git a/quantum/rgblight/rgblight.h b/quantum/rgblight/rgblight.h
index 9e2b073776..4b02e8b63f 100644
--- a/quantum/rgblight/rgblight.h
+++ b/quantum/rgblight/rgblight.h
@@ -18,6 +18,7 @@

 // DEPRECATED DEFINES - DO NOT USE
 #if defined(RGBLED_NUM)
+#    undef RGBLIGHT_LED_COUNT
 #    define RGBLIGHT_LED_COUNT RGBLED_NUM
 #endif
 // ========
drashna commented 4 months ago

update your repo. I can't reproduce this with the default keymap, and enabling rgblight from the command line.

Also, run qmk clean -a and retry.