Initialize Serial from Kaleidoscope.setup()

To work around an issue on OSX, initalize Serial as the very first thing in
`Kaleidoscope.setup`. This is a - hopefully - temporary workaround, until we can
track down the real issue.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/489/head
Gergely Nagy 6 years ago
parent d6cbd0e890
commit 06c2a71962
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -26,6 +26,16 @@ Kaleidoscope_::Kaleidoscope_(void) {
void void
Kaleidoscope_::setup(void) { Kaleidoscope_::setup(void) {
// We are explicitly initializing the Serial port as early as possible to
// (temporarily, hopefully) work around an issue on OSX. If we initialize
// Serial too late, no matter what we do, we'll end up reading garbage from
// the serial port. For more information, see the following issue:
// https://github.com/keyboardio/Kaleidoscope-Bundle-Keyboardio/pull/7
//
// TODO(anyone): Figure out a way we can get rid of this, and fix the bug
// properly.
Serial.begin(9600);
kaleidoscope::Hooks::onSetup(); kaleidoscope::Hooks::onSetup();
KeyboardHardware.setup(); KeyboardHardware.setup();

@ -85,10 +85,6 @@ class FocusSerial : public kaleidoscope::Plugin {
static constexpr char SEPARATOR = ' '; static constexpr char SEPARATOR = ' ';
/* Hooks */ /* Hooks */
EventHandlerResult onSetup() {
Serial.begin(9600);
return EventHandlerResult::OK;
}
EventHandlerResult beforeReportingState(); EventHandlerResult beforeReportingState();
EventHandlerResult onFocusEvent(const char *command); EventHandlerResult onFocusEvent(const char *command);

Loading…
Cancel
Save