Bläddra i källkod

Shortcut dont call HardwareSerial::processevents if nothing active

This cut down some timings in yield.
main
Kurt Eckhardt 5 år sedan
förälder
incheckning
e3d940c44d
2 ändrade filer med 4 tillägg och 2 borttagningar
  1. +1
    -1
      teensy4/HardwareSerial.h
  2. +3
    -1
      teensy4/yield.cpp

+ 1
- 1
teensy4/HardwareSerial.h Visa fil

@@ -181,6 +181,7 @@ public:
void enableSerialEvents();
void disableSerialEvents();
static void processSerialEvents();
static uint8_t serial_event_handlers_active;

using Print::write;
// Only overwrite some of the virtualWrite functions if we are going to optimize them over Print version
@@ -236,7 +237,6 @@ private:
#else
static SerialEventCheckingFunctionPointer serial_event_handler_checks[7];
#endif
static uint8_t serial_event_handlers_active;




+ 3
- 1
teensy4/yield.cpp Visa fil

@@ -39,12 +39,14 @@ void yield(void)
if (running) return; // TODO: does this need to be atomic?
running = 1;


// USB Serail - Add hack to minimize impact...
if (usb_enable_serial_event_processing && Serial.available()) serialEvent();

// Current workaround until integrate with EventResponder.
HardwareSerial::processSerialEvents();
if (HardwareSerial::serial_event_handlers_active) HardwareSerial::processSerialEvents();

running = 0;
EventResponder::runFromYield();
};

Laddar…
Avbryt
Spara