-
-
Notifications
You must be signed in to change notification settings - Fork 39.2k
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
[Core][Bugfix] Joystick: Ignore axis-related code when axes count=0 #16983
Conversation
The analog joystick feature does not compile accross all platforms (see qmk#4226 (review)) All joystick related code is put between #if JOYSTICK_AXES_COUNT > 0 This also reduces the size of the compiled code when you only want to use joystick buttons. \### How to reproduce bug: 1. `qmk new-keyboard` 2. select the MCU `GD32VF103` (other options don't matter) 3. `rules.mk` Add `JOYSTICK_ENABLE = yes` 4. `config.h` : Add ```c #define JOYSTICK_BUTTON_COUNT 1 #define JOYSTICK_AXES_COUNT 0 ``` 5. (optional) Change a key to `JS_BUTTON0` in keymap 6. run `qmk compile` against new keyboard Errors will show related to the ADC. \### Disclaimer 1. I do not have the proper HW to debug on all keyboards, but it does work from the RP2040 branch which has a similar problem See qmk#14877 (comment) 2. I guess `ifeq ($(shell expr $(JOYSTICK_AXES_COUNT) \> 0), 1)` ain't so pretty, but it didn't work with `#ifneq ($(JOYSTICK_AXES_COUNT), 0) ??
The (Also im fairly certain this wont work, as |
I am looking forward to that! The logic in the joystick parts are a bit confusing to me. Where can I find references to that reformatting, either in plans or in PRs? |
Do you mean it won't work in |
|
Then I guess it ain't possible to make that work unless we start defining the number of axis in |
The change doesn't really make much sense anyway as you can configure axes to not read from the ADC with |
Nope, should remain config.h only at the moment. As I mention, 9a86f5c the code causing this issue is going shortly so I dont think we need to go forward with the proposed changes right now. |
It is only avoiding compilation of ADC code for the joystick, as the joystick only uses it for reading analog axes. Doesn't prohibit other features from using the ADC.
Which branch is it part of? GitHub isn't tracking it anymore (rebased) and I can't find it through search Perhaps the joystick buttons should be removed in favour of using programmable buttons? I am trying to use both, but they step on each others toes when trying to use with a flight simulator 🙄 |
Closing as recommended. |
@fauxpark True, but it still tries to compile it, which can break, unless you explicit that the driver is This PR was aimed at people trying to make a keymap using joystick buttons but no axis, which is indeed particular. |
The analog joystick feature does not compile accross all platforms (see #4226 (review))
All joystick related code is put between
#if JOYSTICK_AXES_COUNT > 0
This also reduces the size of the compiled code when you only want to use joystick buttons.
How to reproduce bug:
qmk new-keyboard
GD32VF103
(other options don't matter)rules.mk
AddJOYSTICK_ENABLE = yes
config.h
: AddJS_BUTTON0
in keymapqmk compile
against new keyboardErrors will show related to the ADC.
Disclaimer
TBH, I'm mostly submitting this PR because it allows me to 🙈 on the bug I described in [Core] Add Raspberry Pi RP2040 support #14877 (comment)
ifeq ($(shell expr $(JOYSTICK_AXES_COUNT) \> 0), 1)
ain't so pretty,but it didn't work with
#ifneq ($(JOYSTICK_AXES_COUNT), 0)
??Description
Types of Changes
Issues Fixed or Closed by This PR
None
Checklist