Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add description in Bluetooth docs for requiring NKRO to be disabled #10359

Merged
merged 2 commits into from
Sep 22, 2020

Conversation

pwlandoll
Copy link
Contributor

Expand documentation in Bluetooth rules.mk options for requiring

Description

As seen in #10314, the Bluetooth documentation is missing some information about support for NKRO, and how enabling it can be problematic.
This change expands slightly on the Bluetooth feature documentation, and while not nearly comprehensive or sufficient for covering managing Bluetooth in qmk, could likely save some time and troubleshooting.

Types of Changes

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

Issues Fixed or Closed by This PR

None

Checklist

  • My code follows the code style of this project: C, Python
  • 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.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@drashna drashna requested a review from a team September 19, 2020 03:06
Copy link
Member

@fauxpark fauxpark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 674 in lufa.c should perhaps also be changed to:

if ((where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) && !keymap_config.nkro) {

just to be sure.

@drashna
Copy link
Member

drashna commented Sep 20, 2020

Honestly, I think that maybe we should add a message if both bluetooth and NKRO are enabled, so it's obvious at build time. Not a hard error, but something so users can see it.

@pwlandoll
Copy link
Contributor Author

A warning like that probably would have saved me more time than if it were only in the documentation, I like that. I can try to tackle that, but I don't feel confident in being able to make the change correctly and test it.

in lufa.c:

    if ((where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) && keymap_config.nkro) {
        print("Both Bluetooth output and NKRO are enabled. This will cause errors in Bluetooth output.\n");
    }
    if ((where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) && !keymap_config.nkro) {
#    ifdef MODULE_ADAFRUIT_BLE

Or is there somewhere earlier on in the build process where the rules are checked and the warning could be surfaced there?

@fauxpark
Copy link
Member

fauxpark commented Sep 20, 2020

That print() will not work unless the Console feature is enabled, and you are looking at the output in QMK Toolbox or hid_listen.
Something like the following in tmk_core/common.mk should do the trick:

ifeq ($(strip $(NKRO_ENABLE)), yes)
    ifeq ($(PROTOCOL), VUSB)
        $(info NKRO is not currently supported on V-USB, and has been disabled.)
    else ifeq ($(strip $(BLUETOOTH_ENABLE), yes))
        $(info NKRO is not currently supported with Bluetooth, and has been disabled.)
    else ifneq ($(BLUETOOTH),)
        $(info NKRO is not currently supported with Bluetooth, and has been disabled.)
    else
        TMK_COMMON_DEFS += -DNKRO_ENABLE
        SHARED_EP_ENABLE = yes
    endif
endif

@pwlandoll
Copy link
Contributor Author

Updating checklist with changes from af17d3d

Types of Changes

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

Issues Fixed or Closed by This PR

None

Checklist

  • My code follows the code style of this project: C, Python
  • 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.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@pwlandoll
Copy link
Contributor Author

Also, thanks for the help @fauxpark and @drashna :)

@fauxpark
Copy link
Member

Just looking around for appearances of keymap_config.nkro, it seems like it is actually possible for this to be set to 1 even if NKRO is not compiled in - neither process_magic.c nor bootmagic.c have #ifdef NKRO_ENABLE guards around their NKRO-related code.

@fauxpark
Copy link
Member

fauxpark commented Sep 22, 2020

On further inspection my above comment is incorrect, as when NKRO_ENABLE = no none of the code which checks keymap_config.nkro will be compiled in anyway. Maybe it's worth adding ifdefs around the bootmagic/magic NKRO stuff too to save a couple tens of bytes, but for now I'm happy with this. Thanks a lot!

@fauxpark fauxpark merged commit 0fbb1e5 into qmk:master Sep 22, 2020
@pwlandoll
Copy link
Contributor Author

Excellent, thanks @fauxpark!

@maberalc
Copy link

I think NKRO should not be disabled on Build. I mean, I’m using my keyboard wired and on Bluetooth. When I connect it to Bluetooth I boot with bootmagic to disable nkro, and then when I go wired I enable it.

@pwlandoll
Copy link
Contributor Author

@fauxpark , do you think there would be a way to have NKRO enabled for wired mode while disabling it in Bluetooth mode?

rgoulter pushed a commit to rgoulter/qmk_firmware that referenced this pull request Oct 4, 2020
kjganz pushed a commit to kjganz/qmk_firmware that referenced this pull request Oct 28, 2020
BorisTestov pushed a commit to BorisTestov/qmk_firmware that referenced this pull request May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants