From cf66803288fd25d70ede58b51233554f8edf12ee Mon Sep 17 00:00:00 2001 From: Taylor Yu Date: Fri, 26 Aug 2022 12:12:51 -0500 Subject: [PATCH 1/2] use CRLF for Focus newlines Signed-off-by: Taylor Yu --- .../src/kaleidoscope/plugin/AutoShiftConfig.cpp | 4 ++-- .../src/kaleidoscope/plugin/DynamicMacros.cpp | 2 +- .../src/kaleidoscope/plugin/EEPROM-Keymap.cpp | 2 +- .../src/kaleidoscope/plugin/EEPROM-Settings.cpp | 4 ++-- .../src/kaleidoscope/plugin/FingerPainter.cpp | 2 +- .../src/kaleidoscope/plugin/FocusSerial.cpp | 2 +- .../src/kaleidoscope/plugin/FocusSerial.h | 2 +- .../kaleidoscope/device/dygma/raise/Focus.cpp | 10 +++++----- .../src/kaleidoscope/plugin/LayerFocus.cpp | 4 ++-- .../src/kaleidoscope/plugin/TypingBreaks.cpp | 16 ++++++++-------- src/kaleidoscope/plugin/LEDControl.cpp | 8 ++++---- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp b/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp index d2839b96..974afe8e 100644 --- a/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp +++ b/plugins/Kaleidoscope-AutoShift/src/kaleidoscope/plugin/AutoShiftConfig.cpp @@ -54,8 +54,8 @@ EventHandlerResult AutoShiftConfig::onFocusEvent(const char *command) { CATEGORIES, } subCommand; - if (::Focus.handleHelp(command, PSTR("autoshift.enabled\n" - "autoshift.timeout\n" + if (::Focus.handleHelp(command, PSTR("autoshift.enabled\r\n" + "autoshift.timeout\r\n" "autoshift.categories"))) return EventHandlerResult::OK; diff --git a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp index 6efc813a..32f14622 100644 --- a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp +++ b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp @@ -215,7 +215,7 @@ EventHandlerResult DynamicMacros::onNameQuery() { } EventHandlerResult DynamicMacros::onFocusEvent(const char *command) { - if (::Focus.handleHelp(command, PSTR("macros.map\nmacros.trigger"))) + if (::Focus.handleHelp(command, PSTR("macros.map\r\nmacros.trigger"))) return EventHandlerResult::OK; if (strncmp_P(command, PSTR("macros."), 7) != 0) diff --git a/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.cpp b/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.cpp index fae574b6..0e6de2a0 100644 --- a/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.cpp +++ b/plugins/Kaleidoscope-EEPROM-Keymap/src/kaleidoscope/plugin/EEPROM-Keymap.cpp @@ -102,7 +102,7 @@ void EEPROMKeymap::dumpKeymap(uint8_t layers, Key (*getkey)(uint8_t, KeyAddr)) { } EventHandlerResult EEPROMKeymap::onFocusEvent(const char *command) { - if (::Focus.handleHelp(command, PSTR("keymap.custom\nkeymap.default\nkeymap.onlyCustom"))) + if (::Focus.handleHelp(command, PSTR("keymap.custom\r\nkeymap.default\r\nkeymap.onlyCustom"))) return EventHandlerResult::OK; if (strncmp_P(command, PSTR("keymap."), 7) != 0) diff --git a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp index 5a21ee90..7fffad73 100644 --- a/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp +++ b/plugins/Kaleidoscope-EEPROM-Settings/src/kaleidoscope/plugin/EEPROM-Settings.cpp @@ -164,7 +164,7 @@ EventHandlerResult FocusSettingsCommand::onFocusEvent(const char *command) { GET_CRC, } sub_command; - if (::Focus.handleHelp(command, PSTR("settings.defaultLayer\nsettings.valid?\nsettings.version\nsettings.crc"))) + if (::Focus.handleHelp(command, PSTR("settings.defaultLayer\r\nsettings.valid?\r\nsettings.version\r\nsettings.crc"))) return EventHandlerResult::OK; if (strncmp_P(command, PSTR("settings."), 9) != 0) @@ -213,7 +213,7 @@ EventHandlerResult FocusEEPROMCommand::onFocusEvent(const char *command) { ERASE, } sub_command; - if (::Focus.handleHelp(command, PSTR("eeprom.contents\neeprom.free\neeprom.erase"))) + if (::Focus.handleHelp(command, PSTR("eeprom.contents\r\neeprom.free\r\neeprom.erase"))) return EventHandlerResult::OK; if (strcmp_P(command, PSTR("eeprom.contents")) == 0) diff --git a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp index 015f5eb1..22ef0729 100644 --- a/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp +++ b/plugins/Kaleidoscope-FingerPainter/src/kaleidoscope/plugin/FingerPainter.cpp @@ -100,7 +100,7 @@ EventHandlerResult FingerPainter::onFocusEvent(const char *command) { CLEAR, } sub_command; - if (::Focus.handleHelp(command, PSTR("fingerpainter.toggle\nfingerpainter.clear"))) + if (::Focus.handleHelp(command, PSTR("fingerpainter.toggle\r\nfingerpainter.clear"))) return EventHandlerResult::OK; if (strncmp_P(command, PSTR("fingerpainter."), 14) != 0) diff --git a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp index 6f81fa1e..70db42cd 100644 --- a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp +++ b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.cpp @@ -91,7 +91,7 @@ bool FocusSerial::handleHelp(const char *command, } EventHandlerResult FocusSerial::onFocusEvent(const char *command) { - if (handleHelp(command, PSTR("help\ndevice.reset\nplugins"))) + if (handleHelp(command, PSTR("help\r\ndevice.reset\r\nplugins"))) return EventHandlerResult::OK; if (strcmp_P(command, PSTR("device.reset")) == 0) { diff --git a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h index 0f08821a..0e591d83 100644 --- a/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h +++ b/plugins/Kaleidoscope-FocusSerial/src/kaleidoscope/plugin/FocusSerial.h @@ -43,7 +43,7 @@ class FocusSerial : public kaleidoscope::Plugin { EventHandlerResult sendName(const __FlashStringHelper *name) { Runtime.serialPort().print(name); delayAfterPrint(); - Runtime.serialPort().print(NEWLINE); + Runtime.serialPort().println(); delayAfterPrint(); return EventHandlerResult::OK; } diff --git a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/Focus.cpp b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/Focus.cpp index 70eca747..b99b4589 100644 --- a/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/Focus.cpp +++ b/plugins/Kaleidoscope-Hardware-Dygma-Raise/src/kaleidoscope/device/dygma/raise/Focus.cpp @@ -34,7 +34,7 @@ namespace raise { #endif EventHandlerResult Focus::onFocusEvent(const char *command) { - if (::Focus.handleHelp(command, PSTR("hardware.version\nhardware.side_power\nhardware.side_ver\nhardware.sled_ver\nhardware.sled_current\nhardware.layout\nhardware.joint\nhardware.keyscan\nhardware.crc_errors\nhardware.firmware"))) + if (::Focus.handleHelp(command, PSTR("hardware.version\r\nhardware.side_power\r\nhardware.side_ver\r\nhardware.sled_ver\r\nhardware.sled_current\r\nhardware.layout\r\nhardware.joint\r\nhardware.keyscan\r\nhardware.crc_errors\r\nhardware.firmware"))) return EventHandlerResult::OK; if (strncmp_P(command, PSTR("hardware."), 9) != 0) @@ -65,7 +65,7 @@ EventHandlerResult Focus::onFocusEvent(const char *command) { if (strcmp_P(command + 9, PSTR("side_ver")) == 0) { ::Focus.send("left:"); ::Focus.send(Runtime.device().side.leftVersion()); - ::Focus.send("\nright:"); + ::Focus.send("\r\nright:"); ::Focus.send(Runtime.device().side.rightVersion()); return EventHandlerResult::EVENT_CONSUMED; } @@ -73,7 +73,7 @@ EventHandlerResult Focus::onFocusEvent(const char *command) { if (strcmp_P(command + 9, PSTR("crc_errors")) == 0) { ::Focus.send("left:"); ::Focus.send(Runtime.device().side.leftCRCErrors()); - ::Focus.send("\nright:"); + ::Focus.send("\r\nright:"); ::Focus.send(Runtime.device().side.rightCRCErrors()); return EventHandlerResult::EVENT_CONSUMED; } @@ -81,7 +81,7 @@ EventHandlerResult Focus::onFocusEvent(const char *command) { if (strcmp_P(command + 9, PSTR("sled_ver")) == 0) { ::Focus.send("left:"); ::Focus.send(Runtime.device().side.leftSLEDVersion()); - ::Focus.send("\nright:"); + ::Focus.send("\r\nright:"); ::Focus.send(Runtime.device().side.rightSLEDVersion()); return EventHandlerResult::EVENT_CONSUMED; } @@ -90,7 +90,7 @@ EventHandlerResult Focus::onFocusEvent(const char *command) { if (::Focus.isEOL()) { ::Focus.send("left:"); ::Focus.send(Runtime.device().side.leftSLEDCurrent()); - ::Focus.send("\nright:"); + ::Focus.send("\r\nright:"); ::Focus.send(Runtime.device().side.rightSLEDCurrent()); return EventHandlerResult::EVENT_CONSUMED; } else { diff --git a/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.cpp b/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.cpp index 4fe4e1b2..91d89549 100644 --- a/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.cpp +++ b/plugins/Kaleidoscope-LayerFocus/src/kaleidoscope/plugin/LayerFocus.cpp @@ -33,8 +33,8 @@ EventHandlerResult LayerFocus::onNameQuery() { } EventHandlerResult LayerFocus::onFocusEvent(const char *command) { - if (::Focus.handleHelp(command, PSTR("layer.activate\nlayer.deactivate\nlayer.isActive" - "\nlayer.moveTo\nlayer.state"))) + if (::Focus.handleHelp(command, PSTR("layer.activate\r\nlayer.deactivate\r\nlayer.isActive" + "\r\nlayer.moveTo\r\nlayer.state"))) return EventHandlerResult::OK; if (strncmp_P(command, PSTR("layer."), 6) != 0) diff --git a/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp b/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp index a8164de8..f00c7fee 100644 --- a/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp +++ b/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp @@ -133,10 +133,10 @@ EventHandlerResult TypingBreaks::onSetup() { } #define FOCUS_HOOK_TYPINGBREAKS FOCUS_HOOK(TypingBreaks.focusHook, \ - "typingbreaks.idleTimeLimit\n" \ - "typingbreaks.lockTimeOut\n" \ - "typingbreaks.lockLength\n" \ - "typingbreaks.leftMaxKeys\n" \ + "typingbreaks.idleTimeLimit\r\n" \ + "typingbreaks.lockTimeOut\r\n" \ + "typingbreaks.lockLength\r\n" \ + "typingbreaks.leftMaxKeys\r\n" \ "typingbreaks.rightMaxKeys") EventHandlerResult TypingBreaks::onFocusEvent(const char *command) { @@ -148,10 +148,10 @@ EventHandlerResult TypingBreaks::onFocusEvent(const char *command) { RIGHT_MAX, } subCommand; - if (::Focus.handleHelp(command, PSTR("typingbreaks.idleTimeLimit\n" - "typingbreaks.lockTimeOut\n" - "typingbreaks.lockLength\n" - "typingbreaks.leftMaxKeys\n" + if (::Focus.handleHelp(command, PSTR("typingbreaks.idleTimeLimit\r\n" + "typingbreaks.lockTimeOut\r\n" + "typingbreaks.lockLength\r\n" + "typingbreaks.leftMaxKeys\r\n" "typingbreaks.rightMaxKeys"))) return EventHandlerResult::OK; diff --git a/src/kaleidoscope/plugin/LEDControl.cpp b/src/kaleidoscope/plugin/LEDControl.cpp index 7e85e7ba..8ae94d76 100644 --- a/src/kaleidoscope/plugin/LEDControl.cpp +++ b/src/kaleidoscope/plugin/LEDControl.cpp @@ -224,10 +224,10 @@ EventHandlerResult FocusLEDCommand::onFocusEvent(const char *command) { if (!Runtime.has_leds) return EventHandlerResult::OK; - if (::Focus.handleHelp(command, PSTR("led.at\n" - "led.setAll\n" - "led.mode\n" - "led.brightness\n" + if (::Focus.handleHelp(command, PSTR("led.at\r\n" + "led.setAll\r\n" + "led.mode\r\n" + "led.brightness\r\n" "led.theme"))) return EventHandlerResult::OK; From 4a030ae7e8ae290c3fee9193a2294928e619cad5 Mon Sep 17 00:00:00 2001 From: Taylor Yu Date: Fri, 26 Aug 2022 13:24:20 -0500 Subject: [PATCH 2/2] format Signed-off-by: Taylor Yu --- .../src/kaleidoscope/plugin/TypingBreaks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp b/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp index f00c7fee..7d660516 100644 --- a/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp +++ b/plugins/Kaleidoscope-TypingBreaks/src/kaleidoscope/plugin/TypingBreaks.cpp @@ -132,7 +132,7 @@ EventHandlerResult TypingBreaks::onSetup() { return EventHandlerResult::OK; } -#define FOCUS_HOOK_TYPINGBREAKS FOCUS_HOOK(TypingBreaks.focusHook, \ +#define FOCUS_HOOK_TYPINGBREAKS FOCUS_HOOK(TypingBreaks.focusHook, \ "typingbreaks.idleTimeLimit\r\n" \ "typingbreaks.lockTimeOut\r\n" \ "typingbreaks.lockLength\r\n" \