From e950aa18303ce0280e3760b321fca6533356d219 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Wed, 30 Sep 2020 20:31:41 -0700 Subject: [PATCH] Resolve all cpplint readability/braces errors --- src/kaleidoscope/device/dygma/Raise.cpp | 6 ++++-- src/kaleidoscope/device/dygma/raise/Focus.cpp | 6 ++++-- src/kaleidoscope/device/dygma/raise/TWI.h | 2 +- src/kaleidoscope/device/virtual/Virtual.cpp | 8 +++++--- src/kaleidoscope/hooks.cpp | 2 +- src/kaleidoscope/plugin/HardwareTestMode.cpp | 11 ++++------- src/kaleidoscope/plugin/Model01-TestMode.h | 2 +- 7 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/kaleidoscope/device/dygma/Raise.cpp b/src/kaleidoscope/device/dygma/Raise.cpp index eb3d5c5b..eb5e725a 100644 --- a/src/kaleidoscope/device/dygma/Raise.cpp +++ b/src/kaleidoscope/device/dygma/Raise.cpp @@ -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 diff --git a/src/kaleidoscope/device/dygma/raise/Focus.cpp b/src/kaleidoscope/device/dygma/raise/Focus.cpp index 5e09b320..e7a70560 100644 --- a/src/kaleidoscope/device/dygma/raise/Focus.cpp +++ b/src/kaleidoscope/device/dygma/raise/Focus.cpp @@ -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; diff --git a/src/kaleidoscope/device/dygma/raise/TWI.h b/src/kaleidoscope/device/dygma/raise/TWI.h index 5d96abb2..75298b21 100644 --- a/src/kaleidoscope/device/dygma/raise/TWI.h +++ b/src/kaleidoscope/device/dygma/raise/TWI.h @@ -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); diff --git a/src/kaleidoscope/device/virtual/Virtual.cpp b/src/kaleidoscope/device/virtual/Virtual.cpp index 5d99492e..875ac028 100644 --- a/src/kaleidoscope/device/virtual/Virtual.cpp +++ b/src/kaleidoscope/device/virtual/Virtual.cpp @@ -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); diff --git a/src/kaleidoscope/hooks.cpp b/src/kaleidoscope/hooks.cpp index cd9525bf..abd0eea0 100644 --- a/src/kaleidoscope/hooks.cpp +++ b/src/kaleidoscope/hooks.cpp @@ -59,6 +59,6 @@ __attribute__((weak)) EventHandlerResult Hooks::exploreSketch () { return EventHandlerResult::OK; -}; +} } // namespace kaleidoscope diff --git a/src/kaleidoscope/plugin/HardwareTestMode.cpp b/src/kaleidoscope/plugin/HardwareTestMode.cpp index 3d059081..9dabc4a6 100644 --- a/src/kaleidoscope/plugin/HardwareTestMode.cpp +++ b/src/kaleidoscope/plugin/HardwareTestMode.cpp @@ -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); } } diff --git a/src/kaleidoscope/plugin/Model01-TestMode.h b/src/kaleidoscope/plugin/Model01-TestMode.h index d8abd4b3..ac308cea 100644 --- a/src/kaleidoscope/plugin/Model01-TestMode.h +++ b/src/kaleidoscope/plugin/Model01-TestMode.h @@ -35,7 +35,7 @@ namespace plugin { class TestMode : public kaleidoscope::Plugin { public: - DEPRECATED(MODEL01_TESTMODE) EventHandlerResult beforeReportingState() {}; + DEPRECATED(MODEL01_TESTMODE) EventHandlerResult beforeReportingState() {} }; } }