From 1590ec297dc9faf34541f299358edfb935bfc003 Mon Sep 17 00:00:00 2001 From: Jonathan Roeber Date: Sat, 29 Sep 2018 16:23:43 -0400 Subject: [PATCH] fix #23 with ifdef check --- Adafruit_Thermal.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Adafruit_Thermal.cpp b/Adafruit_Thermal.cpp index cd84653..4ce4417 100644 --- a/Adafruit_Thermal.cpp +++ b/Adafruit_Thermal.cpp @@ -65,11 +65,19 @@ void Adafruit_Thermal::timeoutSet(unsigned long x) { // This function waits (if necessary) for the prior task to complete. void Adafruit_Thermal::timeoutWait() { +#ifdef ESP8266 + if(dtrEnabled) { + while(digitalRead(dtrPin) == HIGH){yield();}; + } else { + while((long)(micros() - resumeTime) < 0L){yield();}; // (syntax is rollover-proof) + } +#else if(dtrEnabled) { while(digitalRead(dtrPin) == HIGH); } else { while((long)(micros() - resumeTime) < 0L); // (syntax is rollover-proof) } +#endif } // Printer performance may vary based on the power supply voltage,