From e7d1072c85d80908835689fd9f8b1611dbdfdad7 Mon Sep 17 00:00:00 2001 From: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com> Date: Mon, 24 Mar 2025 19:04:25 -0400 Subject: [PATCH] [core] Fix s2 build after crc header fix (#8459) --- esphome/core/helpers.cpp | 8 +++++--- tests/components/pipsolar/test.esp32-s2-idf.yaml | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 tests/components/pipsolar/test.esp32-s2-idf.yaml diff --git a/esphome/core/helpers.cpp b/esphome/core/helpers.cpp index e69f166600..1472726d31 100644 --- a/esphome/core/helpers.cpp +++ b/esphome/core/helpers.cpp @@ -70,7 +70,9 @@ static const uint16_t CRC16_8408_LE_LUT_L[] = {0x0000, 0x1189, 0x2312, 0x329b, 0 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7}; static const uint16_t CRC16_8408_LE_LUT_H[] = {0x0000, 0x1081, 0x2102, 0x3183, 0x4204, 0x5285, 0x6306, 0x7387, 0x8408, 0x9489, 0xa50a, 0xb58b, 0xc60c, 0xd68d, 0xe70e, 0xf78f}; +#endif +#if !defined(USE_ESP32) || defined(USE_ESP32_VARIANT_ESP32S2) static const uint16_t CRC16_1021_BE_LUT_L[] = {0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef}; static const uint16_t CRC16_1021_BE_LUT_H[] = {0x0000, 0x1231, 0x2462, 0x3653, 0x48c4, 0x5af5, 0x6ca6, 0x7e97, @@ -151,7 +153,7 @@ uint16_t crc16(const uint8_t *data, uint16_t len, uint16_t crc, uint16_t reverse } uint16_t crc16be(const uint8_t *data, uint16_t len, uint16_t crc, uint16_t poly, bool refin, bool refout) { -#ifdef USE_ESP32 +#if defined(USE_ESP32) && !defined(USE_ESP32_VARIANT_ESP32S2) if (poly == 0x1021) { crc = crc16_be(refin ? crc : (crc ^ 0xffff), data, len); return refout ? crc : (crc ^ 0xffff); @@ -160,7 +162,7 @@ uint16_t crc16be(const uint8_t *data, uint16_t len, uint16_t crc, uint16_t poly, if (refin) { crc ^= 0xffff; } -#ifndef USE_ESP32 +#if !defined(USE_ESP32) || defined(USE_ESP32_VARIANT_ESP32S2) if (poly == 0x1021) { while (len--) { uint8_t combo = (crc >> 8) ^ *data++; @@ -178,7 +180,7 @@ uint16_t crc16be(const uint8_t *data, uint16_t len, uint16_t crc, uint16_t poly, } } } -#ifndef USE_ESP32 +#if !defined(USE_ESP32) || defined(USE_ESP32_VARIANT_ESP32S2) } #endif return refout ? (crc ^ 0xffff) : crc; diff --git a/tests/components/pipsolar/test.esp32-s2-idf.yaml b/tests/components/pipsolar/test.esp32-s2-idf.yaml new file mode 100644 index 0000000000..b516342f3b --- /dev/null +++ b/tests/components/pipsolar/test.esp32-s2-idf.yaml @@ -0,0 +1,5 @@ +substitutions: + tx_pin: GPIO4 + rx_pin: GPIO5 + +<<: !include common.yaml