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()) { if (RaiseHands::leftHand.readKeys()) {
leftHandState = RaiseHands::leftHand.getKeyData(); leftHandState = RaiseHands::leftHand.getKeyData();
// if ANSI, then swap r3c0 and r3c1 to match the PCB // 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 // only swap if bits are different
if ((leftHandState.rows[3] & (1 << 0)) ^ leftHandState.rows[3] & (1 << 1)) { if ((leftHandState.rows[3] & (1 << 0)) ^ leftHandState.rows[3] & (1 << 1)) {
leftHandState.rows[3] ^= (1 << 0); // flip the bit leftHandState.rows[3] ^= (1 << 0); // flip the bit
leftHandState.rows[3] ^= (1 << 1); // flip the bit leftHandState.rows[3] ^= (1 << 1); // flip the bit
} }
}
} }
if (RaiseHands::rightHand.readKeys()) { if (RaiseHands::rightHand.readKeys()) {
rightHandState = RaiseHands::rightHand.getKeyData(); rightHandState = RaiseHands::rightHand.getKeyData();
// if ANSI, then swap r1c0 and r2c0 to match the PCB // 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)) { if ((rightHandState.rows[1] & (1 << 0)) ^ rightHandState.rows[2] & (1 << 0)) {
rightHandState.rows[1] ^= (1 << 0); rightHandState.rows[1] ^= (1 << 0);
rightHandState.rows[2] ^= (1 << 0); rightHandState.rows[2] ^= (1 << 0);
} }
}
} }
// if a side has just been replugged, initialise it // if a side has just been replugged, initialise it

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

@ -27,7 +27,7 @@ namespace raise {
class TWI { class TWI {
public: 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 writeTo(uint8_t *data, size_t length);
uint8_t readFrom(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::string token;
std::getline(sline, token, ' '); std::getline(sline, token, ' ');
if (token == "") break; // end of line if (token == "") {
else if (token == "#") break; // skip the rest of the line break; // end of line
else if ((token == "?" || token == "help") && isInteractive()) { } else if (token == "#") {
break; // skip the rest of the line
} else if ((token == "?" || token == "help") && isInteractive()) {
printHelp(); printHelp();
} else if (token == "Q") { } else if (token == "Q") {
exit(0); exit(0);

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

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

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

Loading…
Cancel
Save