Pārlūkot izejas kodu

Shortcut dont call HardwareSerial::processevents if nothing active

This cut down some timings in yield.
main
Kurt Eckhardt pirms 5 gadiem
vecāks
revīzija
e3d940c44d
2 mainītis faili ar 4 papildinājumiem un 2 dzēšanām
  1. +1
    -1
      teensy4/HardwareSerial.h
  2. +3
    -1
      teensy4/yield.cpp

+ 1
- 1
teensy4/HardwareSerial.h Parādīt failu

@@ -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 Parādīt failu

@@ -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();
};

Notiek ielāde…
Atcelt
Saglabāt