Skip to content

Commit effb55d

Browse files
committed
Add support for Print::flush() on ESP32 (espressif/arduino-esp32#6084)
1 parent 39692a7 commit effb55d

File tree

5 files changed

+13
-3
lines changed

5 files changed

+13
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
StreamUtils - Change log
22
========================
33

4+
HEAD
5+
----
6+
7+
* Add support for `Print::flush()` on ESP32
8+
49
1.6.3 (2022/05/11)
510
-----
611

extras/test/cores/esp32/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ target_include_directories(Esp32Core
1919
target_compile_definitions(Esp32Core
2020
PUBLIC
2121
ARDUINO_ARCH_ESP32
22+
ESP_ARDUINO_VERSION_MAJOR=2
23+
ESP_ARDUINO_VERSION_MINOR=0
24+
ESP_ARDUINO_VERSION_PATCH=5
2225
)

extras/test/cores/esp32/Print.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ struct Print {
1313
virtual ~Print() {}
1414
virtual size_t write(const uint8_t *buffer, size_t size) = 0;
1515
virtual size_t write(uint8_t data) = 0;
16+
virtual void flush() {}
1617

1718
virtual int availableForWrite() {
1819
return 0;

extras/test/cores/esp32/Stream.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ struct Stream : Print {
1212
virtual int available() = 0;
1313
virtual int read() = 0;
1414
virtual int peek() = 0;
15-
virtual void flush() = 0;
1615

1716
virtual size_t readBytes(char *buffer, size_t length) {
1817
size_t count = 0;

src/StreamUtils/Configuration.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
#pragma once
66

77
#ifndef STREAMUTILS_PRINT_FLUSH_EXISTS
8-
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_SAMD) || \
9-
defined(ARDUINO_ARCH_AVR)
8+
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_SAMD) || \
9+
defined(ARDUINO_ARCH_AVR) || \
10+
(defined(ARDUINO_ARCH_ESP32) && ESP_ARDUINO_VERSION_MAJOR >= 2 && \
11+
ESP_ARDUINO_VERSION_PATCH >= 3)
1012
#define STREAMUTILS_PRINT_FLUSH_EXISTS 1
1113
#else
1214
#define STREAMUTILS_PRINT_FLUSH_EXISTS 0

0 commit comments

Comments
 (0)