Skip to content

Add ESP32 series support#14

Draft
Caffreyfans with Copilot wants to merge 2 commits into
masterfrom
copilot/compatible-adapt-esp32-series
Draft

Add ESP32 series support#14
Caffreyfans with Copilot wants to merge 2 commits into
masterfrom
copilot/compatible-adapt-esp32-series

Conversation

Copilot AI commented Apr 21, 2026

Copy link
Copy Markdown

The firmware was entirely ESP8266-specific. This PR makes it compile and run on ESP32, ESP32-S2, and ESP32-C3 by replacing or conditionally compiling all platform-specific code.

Platform abstraction

  • defines.h: Replaced manual typedef declarations with <stdint.h>. Added a platform-independent getChipId() inline helper:
    #ifdef ESP32
    inline uint32_t getChipId() {
        uint32_t chipId = 0;
        for (int i = 0; i < 32; i += 8)
            chipId |= ((ESP.getEfuseMac() >> (32 - i)) & 0xff) << i;
        return chipId;
    }
    #else
    inline uint32_t getChipId() { return ESP.getChipId(); }
    #endif
  • All ESP.getChipId() call sites updated to use getChipId().

Build environments

  • platformio.ini: Added esp32-base, esp32s2-base, esp32c3-base environments (espressif32 platform, LittleFS filesystem). Moved platform and flash-mode settings into per-environment blocks.

Conditional includes & APIs

  • HTTP client: ESP8266HTTPClient.hHTTPClient.h on ESP32 (IRbaby.cpp, IRbabyIR.cpp, IRbabyOTA.cpp)
  • WiFi: ESP8266WiFi.hWiFi.h on ESP32 (IRbabyUDP.cpp, IRbabyMsgHandler.cpp, IRbabyUserSettings.cpp)
  • OTA: ESPhttpUpdate / t_httpUpdate_returnhttpUpdate / HTTPUpdateResult on ESP32
  • Ticker: attach_scheduled() / attach_ms_scheduled()attach() / attach_ms() (ESP32 Ticker lacks scheduled variants)

Filesystem & system APIs

  • FSInfo64 / LittleFS.info64()FSInfo / LittleFS.info() on ESP32
  • clearBinFiles(): replaced Dir-based iteration (ESP8266-only) with File::openNextFile() on ESP32
  • settingsClear(): ESP.eraseConfig() + ESP.reset()WiFi.disconnect(true, true) + ESP.restart() on ESP32
  • ESP.getFlashChipSpeed() / ESP.getResetReason() guarded under #ifdef ESP8266; ESP32 uses esp_reset_reason() from <esp_system.h> and returns "N/A" for flash speed

Device identity

  • IRbabyha.cpp: device model field is now "ESP32" or "ESP8266" based on the compile target.

Copilot AI changed the title [WIP] Add compatibility support for ESP32 series products Add ESP32 series support Apr 21, 2026
Copilot AI requested a review from Caffreyfans April 21, 2026 08:57
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.

2 participants