skitzo2000 / GMMK2-96

Glorious GMMK 2 96% QMK keymap by Skitzo2000
6 stars 3 forks source link

RGB Matrix compiling error #7

Closed DreamingLamb closed 10 months ago

DreamingLamb commented 1 year ago

Hey skitzo2000,

I'm trying to compile your keymap but keep getting the error below (yes, I'm trying to map for an ISO, with my own mapping, but I have also tried with your mappings and ANSI):


[DreamingSheep@SheepsDesk gmmk2_VIA]$ qmk compile -kb gmmk/gmmk2/p96/iso -km via
Ψ Compiling keymap with make --jobs=1 gmmk/gmmk2/p96/iso:via

QMK Firmware 0.22.14
Making gmmk/gmmk2/p96/iso with keymap via

arm-none-eabi-gcc.exe (GCC) 10.1.0
Copyright (C) 2020 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   47534       0   47534    b9ae gmmk_gmmk2_p96_iso_via.bin

Compiling: quantum/keymap_introspection.c                                                          In file included from quantum/keymap_introspection.c:5:
./keyboards/gmmk/gmmk2/p96/iso/keymaps/via/keymap.c:144:6: error: conflicting types for 'rgb_matrix_indicators_advanced_user'
  144 | void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from quantum/quantum.h:36,
                 from ./.build/obj_gmmk_gmmk2_p96_iso_via/src/default_keyboard.h:27,
                 from ./keyboards/gmmk/gmmk2/p96/iso/keymaps/via/keymap.c:17,
                 from quantum/keymap_introspection.c:5:
quantum/rgb_matrix/rgb_matrix.h:142:6: note: previous declaration of 'rgb_matrix_indicators_advanced_user' was here
  142 | bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from quantum/keymap_introspection.c:5:
./keyboards/gmmk/gmmk2/p96/iso/keymaps/via/keymap.c: In function 'rgb_matrix_indicators_advanced_user':
./keyboards/gmmk/gmmk2/p96/iso/keymaps/via/keymap.c:146:9: error: implicit declaration of function 'IS_HOST_LED_ON'; did you mean 'IS_LED_ON'? [-Werror=implicit-function-declaration]
  146 |     if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) {
      |         ^~~~~~~~~~~~~~
      |         IS_LED_ON
./keyboards/gmmk/gmmk2/p96/iso/keymaps/via/keymap.c:146:24: error: 'USB_LED_CAPS_LOCK' undeclared (first use in this function)
  146 |     if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) {
      |                        ^~~~~~~~~~~~~~~~~
./keyboards/gmmk/gmmk2/p96/iso/keymaps/via/keymap.c:146:24: note: each undeclared identifier is reported only once for each function it appears in
cc1.exe: all warnings being treated as errors
 [ERRORS]
 |
 |
 |
make[1]: *** [builddefs/common_rules.mk:361: .build/obj_gmmk_gmmk2_p96_iso_via/quantum/keymap_introspection.o] Error 1
Make finished with errors
make: *** [Makefile:392: gmmk/gmmk2/p96/iso:via] Error 1
[DreamingSheep@SheepsDesk gmmk2_VIA]$```
skitzo2000 commented 1 year ago

@DreamingLamb I haven't compiled this one in a bit. I'll pull and try to get you an answer over the weekend. More than likely something deprecated. I know in the past I have used bool instead of void on the keymap.c with a return 1 at the end, and its worked fine. But other reported issues so I changed it to void.

DreamingLamb commented 1 year ago

Thanks for any time you can spend on this! Really want a CapsLock LED before I commit to buying another GMMK2.

I saw the change the fixed #5 & #6, but if I'm honest, I haven't tried rolling back to that and testing it

DreamingLamb commented 10 months ago

Finally had some more time and brain power to look at this and this should do the job:

bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
    if (host_keyboard_led_state().caps_lock) {
        RGB_MATRIX_INDICATOR_SET_COLOR(54, 255, 255, 255); // assuming caps lock is at led #54
    } else {
        RGB_MATRIX_INDICATOR_SET_COLOR(54, 0, 0, 0);
    }
    return false;
}

That'll set Caps to white when on. I've compiled the ISO version and pushed it to my board and it is' working.

DreamingLamb commented 10 months ago

@skitzo2000 This might be useful to someone, so I'll add it here too, not sure if you want to add it to your code/have it commented out to help people. Code below will allow toggling the Num Lock and Caps Lock keys independently, although with a Red LED.

//Sheep's Modifier key LED toggles
bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
    if (host_keyboard_led_state().caps_lock) {
        RGB_MATRIX_INDICATOR_SET_COLOR(54, 255, 0, 0); // Assuming Caps Lock is at LED #54
    } else {
        RGB_MATRIX_INDICATOR_SET_COLOR(54, 0, 0, 0);
    }

    if (host_keyboard_led_state().num_lock) {
        RGB_MATRIX_INDICATOR_SET_COLOR(32, 255, 0, 0); // Assuming Num Lock is at LED #32
    } else {
        RGB_MATRIX_INDICATOR_SET_COLOR(32, 0, 0, 0);
    }

    return false;
}
//End of Sheep's Modifier key LED toggles

edit: Code brackets aren't working properly....

skitzo2000 commented 10 months ago

Awesome @DreamingLamb I'm so glad you got this figured out. I just haven't had enough time.

The code looks great. If you want feel free to make a pull request on my repo. I would be happy to include some new code!