mirror of
https://github.com/openstenoproject/qmk
synced 2024-11-09 01:39:12 +00:00
ergodox_ez: fixed bug where debounce() was called without calculating changed (#5589)
This commit is contained in:
parent
fa4052c26e
commit
3761c28bf9
1 changed files with 20 additions and 7 deletions
|
@ -123,6 +123,17 @@ void matrix_power_up(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reads and stores a row, returning
|
||||||
|
// whether a change occurred.
|
||||||
|
static inline bool store_raw_matrix_row(uint8_t index) {
|
||||||
|
matrix_row_t temp = read_cols(index);
|
||||||
|
if (raw_matrix[index] != temp) {
|
||||||
|
raw_matrix[index] = temp;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t matrix_scan(void) {
|
uint8_t matrix_scan(void) {
|
||||||
if (mcp23018_status) { // if there was an error
|
if (mcp23018_status) { // if there was an error
|
||||||
if (++mcp23018_reset_loop == 0) {
|
if (++mcp23018_reset_loop == 0) {
|
||||||
|
@ -157,22 +168,24 @@ uint8_t matrix_scan(void) {
|
||||||
#ifdef LEFT_LEDS
|
#ifdef LEFT_LEDS
|
||||||
mcp23018_status = ergodox_left_leds_update();
|
mcp23018_status = ergodox_left_leds_update();
|
||||||
#endif // LEFT_LEDS
|
#endif // LEFT_LEDS
|
||||||
|
bool changed = false;
|
||||||
for (uint8_t i = 0; i < MATRIX_ROWS_PER_SIDE; i++) {
|
for (uint8_t i = 0; i < MATRIX_ROWS_PER_SIDE; i++) {
|
||||||
// select rows from left and right hands
|
// select rows from left and right hands
|
||||||
select_row(i);
|
uint8_t left_index = i;
|
||||||
select_row(i + MATRIX_ROWS_PER_SIDE);
|
uint8_t right_index = i + MATRIX_ROWS_PER_SIDE;
|
||||||
|
select_row(left_index);
|
||||||
|
select_row(right_index);
|
||||||
|
|
||||||
// we don't need a 30us delay anymore, because selecting a
|
// we don't need a 30us delay anymore, because selecting a
|
||||||
// left-hand row requires more than 30us for i2c.
|
// left-hand row requires more than 30us for i2c.
|
||||||
|
|
||||||
// grab left + right cols.
|
|
||||||
raw_matrix[i] = read_cols(i);
|
|
||||||
raw_matrix[i+MATRIX_ROWS_PER_SIDE] = read_cols(i+MATRIX_ROWS_PER_SIDE);
|
|
||||||
|
|
||||||
|
changed |= store_raw_matrix_row(left_index);
|
||||||
|
changed |= store_raw_matrix_row(right_index);
|
||||||
|
|
||||||
unselect_rows();
|
unselect_rows();
|
||||||
}
|
}
|
||||||
|
|
||||||
debounce(raw_matrix, matrix, MATRIX_ROWS, true);
|
debounce(raw_matrix, matrix, MATRIX_ROWS, changed);
|
||||||
matrix_scan_quantum();
|
matrix_scan_quantum();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in a new issue