Merge pull request #6 from jamesnvc/addressing-issues

Fix very bad bug in layerwise implementation
pull/365/head
Gergely Nagy 7 years ago committed by GitHub
commit 604e64fb91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -113,8 +113,9 @@ bool EEPROMKeymap::focusKeymapLayer(const char *command) {
} }
uint8_t layer = Serial.parseInt(); uint8_t layer = Serial.parseInt();
uint16_t keysPerLayer = ROWS * COLS; if (layer >= max_layers_) {
uint16_t offset = layer * keysPerLayer; return false;
}
if (Serial.peek() == '\n') { if (Serial.peek() == '\n') {
for (uint8_t row = 0; row < ROWS; row++) { for (uint8_t row = 0; row < ROWS; row++) {
for (uint8_t col = 0; col < COLS; col++) { for (uint8_t col = 0; col < COLS; col++) {
@ -124,8 +125,10 @@ bool EEPROMKeymap::focusKeymapLayer(const char *command) {
} }
} }
} else { } else {
uint16_t keysPerLayer = ROWS * COLS;
uint16_t offset = layer * keysPerLayer;
for (uint16_t k = 0; (k < keysPerLayer) && (Serial.peek() != '\n'); k++) { for (uint16_t k = 0; (k < keysPerLayer) && (Serial.peek() != '\n'); k++) {
updateKey(layer + k, parseKey()); updateKey(offset + k, parseKey());
} }
} }

Loading…
Cancel
Save