This cut down some timings in yield.main
| void enableSerialEvents(); | void enableSerialEvents(); | ||||
| void disableSerialEvents(); | void disableSerialEvents(); | ||||
| static void processSerialEvents(); | static void processSerialEvents(); | ||||
| static uint8_t serial_event_handlers_active; | |||||
| using Print::write; | using Print::write; | ||||
| // Only overwrite some of the virtualWrite functions if we are going to optimize them over Print version | // Only overwrite some of the virtualWrite functions if we are going to optimize them over Print version | ||||
| #else | #else | ||||
| static SerialEventCheckingFunctionPointer serial_event_handler_checks[7]; | static SerialEventCheckingFunctionPointer serial_event_handler_checks[7]; | ||||
| #endif | #endif | ||||
| static uint8_t serial_event_handlers_active; | |||||
| if (running) return; // TODO: does this need to be atomic? | if (running) return; // TODO: does this need to be atomic? | ||||
| running = 1; | running = 1; | ||||
| // USB Serail - Add hack to minimize impact... | // USB Serail - Add hack to minimize impact... | ||||
| if (usb_enable_serial_event_processing && Serial.available()) serialEvent(); | if (usb_enable_serial_event_processing && Serial.available()) serialEvent(); | ||||
| // Current workaround until integrate with EventResponder. | // Current workaround until integrate with EventResponder. | ||||
| HardwareSerial::processSerialEvents(); | |||||
| if (HardwareSerial::serial_event_handlers_active) HardwareSerial::processSerialEvents(); | |||||
| running = 0; | running = 0; | ||||
| EventResponder::runFromYield(); | EventResponder::runFromYield(); | ||||
| }; | }; |