Resolve all cpplint readability/braces errors

pull/911/head
Jesse Vincent 4 years ago committed by Gergely Nagy
parent cc135a7eb7
commit e950aa1830
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -274,22 +274,24 @@ void RaiseKeyScanner::readMatrix() {
if (RaiseHands::leftHand.readKeys()) {
leftHandState = RaiseHands::leftHand.getKeyData();
// if ANSI, then swap r3c0 and r3c1 to match the PCB
if (RaiseHands::layout == LAYOUT_ANSI)
if (RaiseHands::layout == LAYOUT_ANSI) {
// only swap if bits are different
if ((leftHandState.rows[3] & (1 << 0)) ^ leftHandState.rows[3] & (1 << 1)) {
leftHandState.rows[3] ^= (1 << 0); // flip the bit
leftHandState.rows[3] ^= (1 << 1); // flip the bit
}
}
}
if (RaiseHands::rightHand.readKeys()) {
rightHandState = RaiseHands::rightHand.getKeyData();
// if ANSI, then swap r1c0 and r2c0 to match the PCB
if (RaiseHands::layout == LAYOUT_ANSI)
if (RaiseHands::layout == LAYOUT_ANSI) {
if ((rightHandState.rows[1] & (1 << 0)) ^ rightHandState.rows[2] & (1 << 0)) {
rightHandState.rows[1] ^= (1 << 0);
rightHandState.rows[2] ^= (1 << 0);
}
}
}
// if a side has just been replugged, initialise it

@ -48,7 +48,7 @@ EventHandlerResult Focus::onFocusEvent(const char *command) {
return EventHandlerResult::EVENT_CONSUMED;
}
if (strcmp_P(command + 9, PSTR("side_power")) == 0)
if (strcmp_P(command + 9, PSTR("side_power")) == 0) {
if (::Focus.isEOL()) {
::Focus.send(Runtime.device().side.getPower());
return EventHandlerResult::EVENT_CONSUMED;
@ -58,6 +58,7 @@ EventHandlerResult Focus::onFocusEvent(const char *command) {
Runtime.device().side.setPower(power);
return EventHandlerResult::EVENT_CONSUMED;
}
}
if (strcmp_P(command + 9, PSTR("side_ver")) == 0) {
::Focus.send("left:");
@ -83,7 +84,7 @@ EventHandlerResult Focus::onFocusEvent(const char *command) {
return EventHandlerResult::EVENT_CONSUMED;
}
if (strcmp_P(command + 9, PSTR("sled_current")) == 0)
if (strcmp_P(command + 9, PSTR("sled_current")) == 0) {
if (::Focus.isEOL()) {
::Focus.send("left:");
::Focus.send(Runtime.device().side.leftSLEDCurrent());
@ -96,6 +97,7 @@ EventHandlerResult Focus::onFocusEvent(const char *command) {
Runtime.device().side.setSLEDCurrent(current);
return EventHandlerResult::EVENT_CONSUMED;
}
}
if (strcmp_P(command + 9, PSTR("layout")) == 0) {
static const auto ANSI = Runtime.device().settings.Layout::ANSI;

@ -27,7 +27,7 @@ namespace raise {
class TWI {
public:
TWI(int addr) : addr_(addr), crc_errors_(0) {};
TWI(int addr) : addr_(addr), crc_errors_(0) {}
uint8_t writeTo(uint8_t *data, size_t length);
uint8_t readFrom(uint8_t* data, size_t length);

@ -167,9 +167,11 @@ void VirtualKeyScanner::readMatrix() {
std::string token;
std::getline(sline, token, ' ');
if (token == "") break; // end of line
else if (token == "#") break; // skip the rest of the line
else if ((token == "?" || token == "help") && isInteractive()) {
if (token == "") {
break; // end of line
} else if (token == "#") {
break; // skip the rest of the line
} else if ((token == "?" || token == "help") && isInteractive()) {
printHelp();
} else if (token == "Q") {
exit(0);

@ -59,6 +59,6 @@ __attribute__((weak))
EventHandlerResult Hooks::exploreSketch
<sketch_exploration::Sketch>() {
return EventHandlerResult::OK;
};
}
} // namespace kaleidoscope

@ -102,16 +102,13 @@ void HardwareTestMode::testMatrix() {
// If the key is held down
if (Runtime.device().isKeyswitchPressed(key_addr) && Runtime.device().wasKeyswitchPressed(key_addr)) {
Runtime.device().setCrgbAt(key_addr, green);
}
// If we triggered chatter detection ever on this key
else if (state[keynum].bad == 1) {
} else if (state[keynum].bad == 1) {
// If we triggered chatter detection ever on this key
Runtime.device().setCrgbAt(key_addr, red);
} else if (state[keynum].tested == 0) {
Runtime.device().setCrgbAt(key_addr, yellow);
}
// If the key is not currently pressed and was not just released and is not marked bad
else if (! Runtime.device().isKeyswitchPressed(key_addr)) {
} else if (! Runtime.device().isKeyswitchPressed(key_addr)) {
// If the key is not currently pressed and was not just released and is not marked bad
Runtime.device().setCrgbAt(key_addr, blue);
}
}

@ -35,7 +35,7 @@ namespace plugin {
class TestMode : public kaleidoscope::Plugin {
public:
DEPRECATED(MODEL01_TESTMODE) EventHandlerResult beforeReportingState() {};
DEPRECATED(MODEL01_TESTMODE) EventHandlerResult beforeReportingState() {}
};
}
}

Loading…
Cancel
Save