Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

timeoutWait function doesn't work with ESP8266 #23

Closed
certeza opened this issue Oct 31, 2016 · 1 comment · Fixed by #46 · May be fixed by #42
Closed

timeoutWait function doesn't work with ESP8266 #23

certeza opened this issue Oct 31, 2016 · 1 comment · Fixed by #46 · May be fixed by #42

Comments

@certeza
Copy link

certeza commented Oct 31, 2016

The timeoutWait function uses:
while((long)(micros() - resumeTime) < 0L); // (syntax is rollover-proof)

This won't work with ESP8266 because it leaves the processor no time to do other things.
For ESP8266 it should be changed to a delay() call.
I use delay(10) and that works fine.

@bmjbmj
Copy link

bmjbmj commented Nov 25, 2016

Yes I noticed the same when the printer printed: "Soft WDT reset ctx: cont, followed by a stack dump" after running throe a couple of lines from the example program provided. This is because hardware serial on the ESP8266 sends out debug information 'as a last will' ;-) A (barley working) workaround is to use 'yield();' in the example program but any longer transmission (like the picture) still fails.

digidigital added a commit to digidigital/Adafruit-Thermal-Printer-Library that referenced this issue May 25, 2017
digidigital added a commit to digidigital/Adafruit-Thermal-Printer-Library that referenced this issue May 25, 2017
Adding yield() enables the ESP8266 to do other things while waiting and prevents reboots due to watchdog timer timeouts..

I had a hard tme to find out that the while-loop was the cause for the reboots....

That´s exactly what yield() is for -> Passes control to other tasks when called. Ideally yield() should be used in functions that will take awhile to complete.
r734 added a commit to r734/Adafruit-Thermal-Printer-Library that referenced this issue Sep 29, 2018
@caternuson caternuson mentioned this issue Apr 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants