Skip to content

Commit

Permalink
Add support for ESP32 Arduino Core 3
Browse files Browse the repository at this point in the history
Signed-off-by: Sara Damiano <[email protected]>
  • Loading branch information
SRGDamia1 committed Dec 9, 2024
1 parent 661d54d commit 35d35e8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
15 changes: 14 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/SDI12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
20 changes: 16 additions & 4 deletions src/SDI12.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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
Expand Down

0 comments on commit 35d35e8

Please sign in to comment.