Since the array is clean, we don't need to write a \0 after the command

Signed-off-by: Jesse Vincent <jesse@keyboard.io>
pull/1105/head
Jesse Vincent 3 years ago
parent 80e7408e03
commit aa34c150d2
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -42,8 +42,6 @@ EventHandlerResult FocusSerial::afterEachCycle() {
} while (command_[i - 1] != ' ' && i < 32);
if (command_[i - 1] == ' ')
command_[i - 1] = '\0';
else
command_[i] = '\0';
Runtime.onFocusEvent(command_);

@ -25,6 +25,10 @@ class FocusSerial : public kaleidoscope::Plugin {
public:
FocusSerial(void) {}
static constexpr char COMMENT = '#';
static constexpr char SEPARATOR = ' ';
static constexpr char NEWLINE = '\n';
bool handleHelp(const char *command,
const char *help_message);
@ -83,12 +87,9 @@ class FocusSerial : public kaleidoscope::Plugin {
}
bool isEOL() {
return Runtime.serialPort().peek() == '\n';
return Runtime.serialPort().peek() == NEWLINE;
}
static constexpr char COMMENT = '#';
static constexpr char SEPARATOR = ' ';
static constexpr char NEWLINE = '\n';
/* Hooks */
EventHandlerResult afterEachCycle();

Loading…
Cancel
Save