qmk_firmware icon indicating copy to clipboard operation
qmk_firmware copied to clipboard

23775 rgblight.h compile time bug

Open rynfox13 opened this issue 9 months ago • 3 comments

Description

Patching the bug where defining a specific number of addressable RGB LEDs causes RGBLIGHT_LED_COUNT to be redefined.

When specifying the number of RGB LEDs in the keymap's config.h (as below), there's a compile error redefining RGBLIGHT_LED_COUNT. This fixes that compile time error.

I'm not sure how to add a test other than compiling this.

This is the relevant sections of my keymap's config.h (my specific keymap is not included.)

// keyboards/handwired/dactyl_manuform/5x6/keymaps/kaze/config.h

//#define RGB_DI_PIN F4
#undef WS2812_DI_PIN
#define WS2812_DI_PIN F4
#undef RGBLED_NUM
#define RGBLED_NUM 10
#define RGBLIGHT_ANIMATIONS

Types of Changes

  • [x] Core
  • [x] Bugfix
  • [ ] New feature
  • [ ] Enhancement/optimization
  • [ ] Keyboard (addition or update)
  • [ ] Keymap/layout/userspace (addition or update)
  • [ ] Documentation

Issues Fixed or Closed by This PR

  • #23775

Checklist

  • [x] My code follows the code style of this project: C, Python
  • [x] I have read the PR Checklist document and have made the appropriate changes.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [x] I have read the CONTRIBUTING document.
  • [ ] I have added tests to cover my changes.
  • [x] I have tested the changes and verified that they work and don't break anything (as well as I can manage).

rynfox13 avatar May 22 '24 19:05 rynfox13

Your keymap uses outdated macros (#defines), and you should probably run qmk lint on it to ferret out other problems. #define RGB_ANIMATIONS doesn't include all RGB effects anymore either. Reviewing the documentation (breaking changes) might help.

The line of code you've added is in a block with the comment // DEPRECATED DEFINES - DO NOT USE above it, so I am doubtful changes will be made there.

lesshonor avatar May 22 '24 19:05 lesshonor

I understand it's deprecated (I actually missed that in the documentation and code... Gotta love hyper-focus on the fix not what's around it) but I figure it's still a bug worthy of being fixed.

That said, qmk lint didn't say anything (please don't judge my bad soldering... I got the columns backward on half of my keyboard):

❯ git status
On branch 23775-rgblights-compile-error
Untracked files:
  (use "git add <file>..." to include in what will be committed)
	keyboards/handwired/dactyl_manuform/5x6/keymaps/kaze/

nothing added to commit but untracked files present (use "git add" to track)
❯ cat keyboards/handwired/dactyl_manuform/5x6/keymaps/kaze/config.h
/*
Copyright 2012 Jun Wako <[email protected]>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/


#pragma once


#define USE_SERIAL
#undef SOFT_SERIAL_PIN
#define SOFT_SERIAL_PIN D2

//#define MASTER_LEFT
// #define MASTER_RIGHT
#define EE_HANDS

#define SPLIT_USB_DETECT
#define SPLIT_USB_TIMEOUT 2000

// Rows are doubled-up

// This sets the display to the 128x32 displays I'm using.
//define OLED_DISPLAY_128X32


// wiring of each half
#undef MATRIX_COL_PINS
// Left
//# define MATRIX_COL_PINS { B7, B5, B4, E6, D7, C6 }
// Right
# define MATRIX_COL_PINS { C6, D7, E6, B4, B5, B7 }

#undef MATRIX_ROW_PINS
#define MATRIX_ROW_PINS { B6, B2, B3, B1, F7, F6 }

//#define RGB_DI_PIN F4
#undef WS2812_DI_PIN
#define WS2812_DI_PIN F4
#undef RGBLED_NUM
#define RGBLED_NUM 10
#define RGBLIGHT_ANIMATIONS
❯ qmk lint
Ψ Lint check passed!

rynfox13 avatar May 22 '24 21:05 rynfox13

(I am by no means an "expert with QMK." This is only my second keyboard... and the first one that is actually working well.) image

rynfox13 avatar May 22 '24 21:05 rynfox13