diff --git a/src/Kaleidoscope/HostOS-Focus.cpp b/src/Kaleidoscope/HostOS-Focus.cpp index fe5b45b3..2321e0b7 100644 --- a/src/Kaleidoscope/HostOS-Focus.cpp +++ b/src/Kaleidoscope/HostOS-Focus.cpp @@ -23,28 +23,14 @@ namespace KaleidoscopePlugins { namespace HostOS { bool Focus (const char *command) { - enum { - GET, - SET, - } subCommand; - - if (strncmp_P (command, PSTR ("hostos."), 7) != 0) - return false; - if (strcmp_P (command + 7, PSTR ("type")) == 0) - subCommand = GET; - else if (strcmp_P (command + 7, PSTR ("set")) == 0) - subCommand = SET; - else + if (strcmp_P (command, PSTR ("hostos.type")) != 0) return false; - switch (subCommand) { - case GET: + if (Serial.peek () == '\n') { Serial.println (::HostOS.os ()); - break; - case SET: + } else { uint8_t os = Serial.parseInt (); ::HostOS.os ((KaleidoscopePlugins::HostOS::Type) os); - break; } Serial.read (); diff --git a/src/Kaleidoscope/HostOS-Focus.h b/src/Kaleidoscope/HostOS-Focus.h index 7d104b76..9d77614d 100644 --- a/src/Kaleidoscope/HostOS-Focus.h +++ b/src/Kaleidoscope/HostOS-Focus.h @@ -28,9 +28,7 @@ namespace KaleidoscopePlugins { #define FOCUS_HOOK_HOSTOS \ FOCUS_HOOK(KaleidoscopePlugins::HostOS::Focus, \ - "hostos.type\n" \ - "-----------\n" \ - "Display the OS type, as known to the plugin.\n\n" \ - "hostos.set type\n" \ - "---------------\n" \ - "Set the OS type.") + "hostos.type [TYPE]\n" \ + "------------------\n" \ + "Set the OS type to `TYPE`; or display the " \ + "type, when called without arguments.")