Skip to content

feat: add ESP-IDF framework support#27

Open
ShaTie wants to merge 3 commits intodudanov:mainfrom
ShaTie:main
Open

feat: add ESP-IDF framework support#27
ShaTie wants to merge 3 commits intodudanov:mainfrom
ShaTie:main

Conversation

@ShaTie
Copy link

@ShaTie ShaTie commented Dec 25, 2025

Add Platform.h abstraction layer enabling ESP-IDF framework alongside Arduino:

  • millis(), random(), Stream, IPAddress implementations for ESP-IDF
  • ESP-IDF WiFi functions using esp_wifi.h and esp_netif.h
  • PROGMEM/pgm_read_byte fallback macros for ESP-IDF
  • Conditional __FlashStringHelper in Log.h

Tested on ESP32-C3.

Add Platform.h abstraction layer enabling ESP-IDF alongside Arduino:
- millis(), random(), Stream, IPAddress implementations for ESP-IDF
- ESP-IDF WiFi functions using esp_wifi.h and esp_netif.h
- PROGMEM/pgm_read_byte fallback macros for ESP-IDF
- Conditional __FlashStringHelper in Log.h

Enables use with ESPHome's ESP-IDF backend for MQTT TLS support.
Tested on ESP32-C3.
Copy link

@toiletbril toiletbril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Gormo
Copy link

Gormo commented Feb 7, 2026

Also tested it successfully on ESP32-C6.

@swoboda1337
Copy link

@dudanov thoughts on getting this merged? Thanks!

@dudanov
Copy link
Owner

dudanov commented Mar 11, 2026

Hi all. I've added simple CI build tests in #30.
@ShaTie please make an empty commit to run them.

@ShaTie ShaTie requested a review from swoboda1337 March 11, 2026 22:09
#ifdef ARDUINO_ARCH_ESP8266
// ESP8266 always has WiFi
#define HAS_WIFI 1
#elif defined(ESP32)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe ESP32 is only defined by Arduino. On pure ESP-IDF this wont be defined so you'll always get HAS_WIFI 0 even on chips with wifi. Should use CONFIG_IDF_TARGET_ESP32 or just check SOC_WIFI_SUPPORTED directly without the Arduino guard:

Suggested change
#elif defined(ESP32)
#elif __has_include("soc/soc_caps.h")
#include "soc/soc_caps.h"
#ifdef SOC_WIFI_SUPPORTED
#define HAS_WIFI 1
#else
#define HAS_WIFI 0
#endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants