Only need keysPerLayer in the updating branch of the conditional

pull/365/head
James N. V. Cash 7 years ago
parent 0073be9a74
commit c298d22827

@ -116,7 +116,6 @@ bool EEPROMKeymap::focusKeymapLayer(const char *command) {
if (layer >= max_layers_) { if (layer >= max_layers_) {
return false; return false;
} }
uint16_t keysPerLayer = ROWS * COLS;
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++) {
@ -126,6 +125,7 @@ bool EEPROMKeymap::focusKeymapLayer(const char *command) {
} }
} }
} else { } else {
uint16_t keysPerLayer = ROWS * COLS;
uint16_t offset = layer * keysPerLayer; 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(offset + k, parseKey()); updateKey(offset + k, parseKey());

Loading…
Cancel
Save