* polledTimeout: add option to use CPU count instead of millis()
* use more "using" alias
* more c++/clear code, using typename (thanks @devyte)
* rename class name to include unit, introduce timeMax() and check it with assert()
* remove useless defines
* improve api readability, add micro-second unit
* update example
* mock: emulate getCycleCount, add/fix polledTimeout CI test
* + nano-seconds, assert -> message, comments, host test
* allow 0 for timeout (enables immediate timeout, fix division by 0)
* typo, set member instead of local variable
* unify error message
* slight change on checkExpired() allows "never expired"
also removed printed message, add YieldAndDelay, simplify calculations
* remove traces of debug.h/cpp in this PR
* include missing <limits> header
* back to original expired test, introduce boolean _neverExpires, fix reset(), getTimeout() is invalid
* fix expiredOneShot with _timeout==0 check
* reenable getTimeout()
* expose checkExpired with unit conversion
* fix timing comments, move critical code to iram
* add member ::neverExpires and use it where relevant
* improve clarity
* remove exposed checkExpired(), adapt LEAmDNS with equivalent
* add API ::resetToNeverExpires(), use it in LEAmDNS
* remove offending constness from ::flagged() LEAmDNS (due do API fix in PolledTimeout)
* simplify "Fast" base classes
* minor variable rename
* Fix examples
* compliance with good c++ manners
* minor changes for consistency
* add missing const
* expired() and bool() moved to iram
* constexpr compensation computing
* add/update comments
* move neverExpires and alwaysExpired
* Function added to detect baudrate
* Added uart_start_detect_baudrate, detectBaudrate() wrappers for HardwareSerial and an example usage SerialDetectBaudrate.ino
* Some layout changes to pass Travis tests
* Some more nitty-gritty layout changes to pass Travis tests
* Some even more nitty-gritty layout changes to pass Travis tests
* renamed one function to testBaudrate() and updated doc/reference.rst
* Minor updates to doc/reference.rst
* New lines added
* inefficient Print::write(data,len) shows message if used (only in debug mode)
* make HardwareSerial's write(data,len) efficient
* HardwareSerial: remove duplicate tests, move trivial code from .cpp to .h
* provide full version descriptor, displayed in debug mode
* unix: shows core version like under windows when git is unavailable
* store strings in progmem
* version string honours NDEBUG
* add ARDUINO_ESP8266_GIT_DESC
restore ARDUINO_ESP8266_GIT_VER
restore global variable "core_version"
don't print full version on setDebugOutput(true)
set platform.txt version to 2.4.1-pre
hide irrelevant boot version
fix typo
* lwip2: fix disconnection/reconnection issue
also:
improve version string
remove useless message
* lwip2: bump tag before 2.4.1
* lwip2: improve netif flags management on git side
* full-version string: remove useless NDEBUG in separate source file
* do not automatically enable sdk messages along with core messages
* automatically reenable sdk messages along with core messages *before* setup not after
* check serial port when showing version-string + move sdk messages enabler in hardware serial
* + license header
* updated and tested windows commands in platform.txt (without git)
* updated and tested windows commands in platform.txt (without git)
* update package builder accordingly
* Add a workaround-delay in Serial.flush()
In relation to #2536 and #2502
Tested at 80MHz and 160MHz with flash-frequency at both 40MHz and 80MHz, the bug mentioned in the above issues manifests in all cases. The proposed workaround seems to work fine, I tested at 2400bps, 9600bps, 115200bps, 230400bps and 2Mbps and didn't see anomalous output.
* Remove extraneous character
* Update HardwareSerial.cpp
* Changed WifInfo settings and WeMos board name
* Added board name to have in sketch and MDNS/OTA
* board naming convention
https://github.com/esp8266/Arduino/pull/2054
* Added Serial.baudRate() to get current baud rate
* Added more description
- Added note about Software Serial Implementation
- Indicate this will works on ESP8266 boards only
Tracking _written was required on AVR devices to work around a hardware
limitation when implementing flush(). The ESP8266 doesn't have the same
issue, so we can remove the tracking and make write() more lightweight.
The cost is a minor increase in work done in flush() when write() was not
previously called, but this should be much rarer than individual character
writes.
Prior to this change, if interrupts were disabled during a call to
HardwareSerial::write() when the circular buffer was full, or
HardwareSerial::flush() when the circular buffer was non-empty,
we would loop forever and trip a watchdog timeout.
Prior to this change, the interrupt could fire during initialisation,
necessitating a deep check that the HardwareSerial structure had valid
_tx_buffer or _rx_buffer each time an interrupt occurred.
By keeping uart_t's and HardwareSerial's (txEnabled, _tx_buffer) and
(rxEnabled, _rx_buffer) in sync, we can remove this extra check, as
well as fixing a null pointer dereference if e.g. _tx_buffer allocation
failed and write() was subsequently called.
This is required per the non-OS SDK doc, which states:
"Using non-OS SDK, please do not call any function defined with
ICACHE_FLASH_ATTR in the interrupt handler."
This avoids an "Illegal instruction" exception with epc1 pointing at a valid
instruction (in flash) for one of the moved methods.
Not sure why, but this reduces the occurrence rate of an occasional ~3.25 or
~7μs intercharacter delay, which was interfering with use of the UART to
generate precise timing pulses (such as driving WS2812 LEDs).
This avoids a race where the interrupt handler detects an empty _tx_buffer
just before we write data into it.
Note that commit d6f62943d4b511e7d5fe6147096c8979890416f5 works around
this race when data is continually added to _tx_buffer in the hung state.
We revert that change here as the race should no longer occur.
Testing performed:
- set UART_CONF1.txfifo_empty_thrhd=0x70 (which exacerbates the issue)
- generate a ~240 byte burst of data, sent in back-to-back Serial1.write(, 4)
calls, optionally followed by a Serial1.flush()
Test results:
- before this change, observe occasional unsent data and hang in flush()
(if used).
- after this change, data is sent as expected.
this introduces optimistic_yield() used for when standard library
methods are normally used in tight loops waiting for something to
happen, like available().
in this case we hang endless or until wtd triggers.
new:
now we overdrive the data in FIFO --> no hang / crash but we loss chars.
only happens by extensive use of os_printf!