-
-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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 split&matrix encoder support #10517
Conversation
The changes in #10259 have also been incorporated into this PullRequest feature |
I'm adding a large ifdef and indenting it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__attribute__((weak))
✔️
I don't have the HW to test this.
This is just nitpicking, but IMHO simply "Basic/Advanced" would be better terms than "Basic/Flexible Support".
In JP's Discord, mtei pointed out that "peek_matrix can improve the scan rate", |
The "#if defined()" in the source makes it hard for me to read, so my first comment will focus on mitigating the readability with a formal change. The following pattern appears four times. The conditional expression is complex. #if defined(SPLIT_KEYBOARD) && defined(MATRIX_ENCODER_PINS_ABC) && defined(MATRIX_ENCODER_PINS_ABC_RIGHT)
//split keyboard,both encoder
:
:
#elif defined(SPLIT_KEYBOARD) && !defined(MATRIX_ENCODER_PINS_ABC) && defined(MATRIX_ENCODER_PINS_ABC_RIGHT)
//split keyboard,right only encoder
:
:
#else
//non split keyboard or left only encoder
:
:
#endif I made it a little easier to read. --> |
The following three functions are easier to read if you separate the body part of the process as static inline functions.
Here is an example of static inline
void encoder_read_all_common(pin_t *current_rows, pin_t *current_matrix,
uint8_t encoder_count, encoder_t *current_encoders)
{
bool isFirstScan = true;
for (int i = 0; i < encoder_count; i++) {
////
}
}
static void encoder_read_all(void) {
# if defined(split_keyboard_both_encoder)
if (isLeftHand) {
encoder_read_all_common(row_pins_left,
(pin_t *)matrix_encoders_pins_left,
NUMBER_OF_ENCODERS_LEFT,
encoders_left);
} else {
encoder_read_all_common(row_pins_right,
(pin_t *)matrix_encoders_pins_right,
NUMBER_OF_ENCODERS_RIGHT,
encoders_right);
}
# elif defined(split_keyboard_right_only_encoder)
encoder_read_all_common(row_pins_right,
(pin_t *)matrix_encoders_pins_right,
NUMBER_OF_ENCODERS_RIGHT,
encoders_right);
# else // non split keyboard or left only encoder
encoder_read_all_common(row_pins,
(pin_t *)matrix_encoders_pins,
NUMBER_OF_ENCODERS,
encoders)
# endif
} |
The code has been modified in response to the following review. |
I just wanted to leave a comment, because I was playing with this PR. #define MATRIX_ENCODER_PINS_ABC {{B1,B2,B6},{B1,B2,F6}} edit: Never mind, I was able to get my other encoders (with pronounced dents) to lock up by moving 2 at a time pretty fast and then turning one and then the other. Not sure if this would happen in normal usage. |
@russbot I was able to reproduce the behavior of the comments using PEC12R. The A-B phase of the rotary encoder takes four states: (0,0)(1,0)(1,1)(0,1). With Type A wiring, when one of them is at (1,1), it interferes with the other one's reading. If the Type B wiring seems to solve the problem, I'll add it to the docs. |
@hsakoh awesome thanks, i haven't been able to get it to stick once with, type b, on any of my encoders. |
I'm not sure why a Type-B circuit needs a diode to connect to C. |
Haha, so yeah sure, Type B doesn't need a diode in C. |
Conflict is happening, so I'm going to rebase |
I don't want to have this Pull Request for a long time because conflicts happen occasionally, @Erovia |
I tested by connecting encoders to each side of the split keyboard (Helix keyboard) one by one.
|
@mtei I don't have a Helix keyboard. |
(cherry picked from commit 1f97d33f677642d46f407a65aa43a81e4c998fa5)
To restart TravisCI, close and open , |
The review doesn't go forward, so I no longer have the motivation to contribute. Goodbye qmk. |
I was really hoping this would make it in |
Were sorry to see this. For travis CI, we're running into issues with it timing out and errorring out. As long as affected boards aren't erroring from compiling, that's fine. As for getting it merged, that cannot and will not get merged because you don't have time. We do this in our free time, as well. We don't get paid for this, so it can be hard to get free time to review. Also we have different expertise and different areas of the codebase that they're familiar with. We are more than willing to work with you, but the process will take time, so it follows the existing coding convention and doesn't break stuff. We would still like to work with you on this, if you're willing. |
Enables flexible wiring of Encoders.
Description
The following issues are in the current encoder feature.
(It is not impossible to wire A/B line to the matrix, but if you wire to GND, you cannot wire in parallel.)
This solves the two issues above.
Similar to #7209, but #10096 will also be improved.
I created and tested the circuit diagram on this gist on a breadboard.
Types of Changes
Issues Fixed or Closed by This PR
Checklist
I've only been touching QMK for a week now, I may have a fundamental misunderstanding.
So please be nice and gentle.