pull/595/head
Jesse Vincent 6 years ago
parent 35be55dc1e
commit 63e179365c

@ -308,7 +308,7 @@ class Hardware {
* do any device-specific initialization needed for factory hardware testing
*
*/
void enableHardwareTestMode() {}
void enableHardwareTestMode() {}
/** @} */
};

@ -103,7 +103,7 @@ bool ATMegaKeyboard::wasKeyswitchPressed(uint8_t row, byte col) {
bool ATMegaKeyboard::wasKeyswitchPressed(uint8_t keyIndex) {
keyIndex--;
return wasKeyswitchPressed(keyIndex / KeyboardHardware.matrix_columns,
keyIndex % KeyboardHardware.matrix_columns);
keyIndex % KeyboardHardware.matrix_columns);
}

@ -85,7 +85,7 @@ void Model01::setup(void) {
TWBR = 12; // This is 400mhz, which is the fastest we can drive the ATTiny
}
void Model01::enableHardwareTestMode () {
void Model01::enableHardwareTestMode() {
// Toggle the programming LEDS on
PORTD |= (1 << 5);

@ -34,7 +34,7 @@ void HardwareTestMode::waitForKeypress() {
while (1) {
KeyboardHardware.readMatrix();
if (KeyboardHardware.isKeyswitchPressed(actionKey) &&
! KeyboardHardware.wasKeyswitchPressed(actionKey)) {
! KeyboardHardware.wasKeyswitchPressed(actionKey)) {
break;
}
}
@ -68,7 +68,7 @@ void HardwareTestMode::testLeds(void) {
void HardwareTestMode::testMatrix() {
// Reset bad keys from previous tests.
chatter_data state[KeyboardHardware.matrix_columns * KeyboardHardware.matrix_rows] = {0,0,0};
chatter_data state[KeyboardHardware.matrix_columns * KeyboardHardware.matrix_rows] = {0, 0, 0};
constexpr cRGB red = CRGB(201, 0, 0);
constexpr cRGB blue = CRGB(0, 0, 201);
@ -81,10 +81,10 @@ void HardwareTestMode::testMatrix() {
for (byte col = 0; col < KeyboardHardware.matrix_columns; col++) {
uint8_t keynum = (row * KeyboardHardware.matrix_columns) + (col);
// If the key is toggled on
// If the key is toggled on
if (KeyboardHardware.isKeyswitchPressed(row, col) && ! KeyboardHardware.wasKeyswitchPressed(row, col)) {
// And it's too soon (in terms of cycles between changes)
state[keynum].tested = 1;
state[keynum].tested = 1;
if (state[keynum].cyclesSinceStateChange < CHATTER_CYCLE_LIMIT) {
state[keynum].bad = 1;
}
@ -98,15 +98,15 @@ void HardwareTestMode::testMatrix() {
}
// If we triggered chatter detection ever on this key
else if (state[keynum].bad == 1) {
else if (state[keynum].bad == 1) {
KeyboardHardware.setCrgbAt(row, col, red);
} else if (state[keynum].tested == 0) {
KeyboardHardware.setCrgbAt(row,col,yellow);
}
KeyboardHardware.setCrgbAt(row, col, yellow);
}
// If the key is not currently pressed and was not just released and is not marked bad
else if ( ! KeyboardHardware.isKeyswitchPressed(row, col)) {
else if (! KeyboardHardware.isKeyswitchPressed(row, col)) {
KeyboardHardware.setCrgbAt(row, col, blue);
}
}
}
}
::LEDControl.syncLeds();

Loading…
Cancel
Save