diff --git a/ChangeLog.md b/ChangeLog.md index f60fa7a..9b3b93f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -20,6 +20,18 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm *** +## [2.2.1] - 2024-12-09 + +### Added + +- Added support for Arduino ESP32 Core versions >3.x.x, based on IDF >5.1.x + +### Fixed + +- Reordered steps to unset the prescaler on SAM/D boards. The incorrect order was causing a hang when waiting for sync. + +*** + ## [2.2.0] - 2024-08-14 _CRC and SAMD51 Support_ @@ -178,7 +190,8 @@ The first "official" release of this interrupt-based SDI-12 library for AVR and *** -[Unreleased]: https://github.com/EnviroDIY/Arduino-SDI-12/compare/v2.2.0...HEAD +[Unreleased]: https://github.com/EnviroDIY/Arduino-SDI-12/compare/v2.2.1...HEAD +[2.2.1]: https://github.com/EnviroDIY/Arduino-SDI-12/releases/tag/v2.2.1 [2.2.0]: https://github.com/EnviroDIY/Arduino-SDI-12/releases/tag/v2.2.0 [2.1.4]: https://github.com/EnviroDIY/Arduino-SDI-12/releases/tag/v2.1.4 [2.1.3]: https://github.com/EnviroDIY/Arduino-SDI-12/releases/tag/v2.1.3 diff --git a/src/SDI12.cpp b/src/SDI12.cpp index d7c7b0a..fa02954 100644 --- a/src/SDI12.cpp +++ b/src/SDI12.cpp @@ -99,7 +99,8 @@ int SDI12::peek() { // a public function that clears the buffer contents and resets the status of the buffer // overflow. void SDI12::clearBuffer() { - _rxBufferHead = _rxBufferTail = 0; + _rxBufferHead = 0; + _rxBufferTail = 0; _bufferOverflow = false; } diff --git a/src/SDI12.h b/src/SDI12.h index fe42161..b5d93ab 100644 --- a/src/SDI12.h +++ b/src/SDI12.h @@ -199,15 +199,26 @@ typedef const __FlashStringHelper* FlashString; { delay(SDI12_YIELD_MS); } #endif -#if defined(ESP32) || defined(ESP8266) +#if defined(ESP8266) || \ + (defined(ESP32) && !defined(ESP_IDF_VERSION) && !defined(ESP_IDF_VERSION_VAL)) +#define NEED_LOOKAHEAD_ENUM +#endif +#if (defined(ESP32) && defined(ESP_IDF_VERSION_VAL) && defined(ESP_IDF_VERSION)) +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 0) +// do nothing +#else +#define NEED_LOOKAHEAD_ENUM +#endif +#endif +#if defined NEED_LOOKAHEAD_ENUM /** * @brief This enumeration provides the lookahead options for parseInt(), parseFloat(). * * The rules set out here are used until either the first valid character is found or a * time out occurs due to lack of input. * - * This enum is part of the Stream parent class, but is missing from the ESP8266 and - * ESP32 cores. + * This enum is part of the Stream parent class, but is missing from the ESP8266 core + * and ESP32 cores prior to 3.0 (IDF prior to 5.1). */ enum LookaheadMode { /** All invalid characters are ignored. */ @@ -218,7 +229,8 @@ enum LookaheadMode { /** Only tabs, spaces, line feeds & carriage returns are skipped.*/ SKIP_WHITESPACE }; -#endif // defined(ESP32) || defined(ESP8266) +#endif // NEED_LOOKAHEAD_ENUM +#undef NEED_LOOKAHEAD_ENUM /** * @brief The main class for SDI 12 instances