Skip to content

v1.9.5 - ESP8266 Stability Overhaul

Choose a tag to compare

@martijnrenkema martijnrenkema released this 18 Feb 12:19

Rituals Diffuser Firmware v1.9.5

ESP8266 Stability Overhaul - Major heap fragmentation fixes addressing crash reports (#8, #3). Thanks to @FredericMa for optimization suggestions in PR #9.

ESP8266 Users: v1.9.5 includes major heap fragmentation fixes. NFC scent detection should now be stable. If you still experience crashes, use v1.8.5 as a fallback without NFC.

ESP32/ESP32-C3 Users: All features work reliably on ESP32 platforms.

What's Changed

MQTT Heap Fragmentation Fix (Critical)

  • Replaced all Arduino String concatenation in MQTT handler with snprintf and static buffers
  • All 14 Home Assistant discovery entities now use shared char[768] buffer instead of heap-allocated Strings
  • State publishing, availability, and subscribe topics all converted to zero-allocation
  • Eliminates ~70+ temporary String allocations per MQTT publish cycle

NFC/RFID Improvements

  • Reduced PCD_Init() frequency: only re-initializes after 3 consecutive failures instead of every second
  • Converted scent lookup from String objects to strstr with char arrays (zero heap allocation)
  • Fixed duplicate scent hex code for "Cotton Blossom" / "Black Oudh"
  • Added null-check for MFRC522 allocation failure

Boot & Connectivity Fixes

  • Fixed OTA and NTP not initializing when WiFi auto-reconnects before callback registration
  • Enabled update checker on ESP8266 with heap guards (was disabled since v1.8.0)
  • Update checker now rejects oversized and chunked HTTP responses on ESP8266
  • Fixed GPIO16 INPUT_PULLUP on ESP8266 (GPIO16 only supports INPUT)

Other Fixes

  • Logger returns minimal JSON when heap < 6KB instead of allocating large buffer
  • LED controller handles NeoPixelBus allocation failure gracefully
  • WiFi manager converted from String to char arrays (from PR #9)
  • Fan RPM calculation overflow fix for 64-bit intermediate (from PR #9)
  • Web server action processing race condition fix (from PR #9)
  • Frontend :has() CSS selector wrapped in try-catch for older browsers

Build Info

  • ESP8266: RAM 78.6%, Flash 74.4%
  • ESP32: RAM 21.6%, Flash 71.6%
  • ESP32-C3: RAM 19.2%, Flash 68.1%

Download Files

Platform Firmware Filesystem Flash Addresses
ESP8266 (Genie V1/V2) firmware_esp8266.bin littlefs_esp8266.bin 0x0 / 0x1E0000
ESP32 DevKit firmware_esp32.bin spiffs_esp32.bin 0x10000 / 0x3D0000
ESP32-C3 SuperMini firmware_esp32c3.bin spiffs_esp32c3.bin 0x10000 / 0x3D0000

Installation

Using esptool.py

# ESP8266 - flash BOTH files:
esptool.py --port /dev/cu.usbserial-XXXX --chip esp8266 --baud 460800 \
  write_flash 0x0 firmware_esp8266.bin 0x1E0000 littlefs_esp8266.bin

# ESP32 - flash BOTH files:
esptool.py --port /dev/cu.usbserial-XXXX --chip esp32 --baud 460800 \
  write_flash 0x10000 firmware_esp32.bin 0x3D0000 spiffs_esp32.bin

# ESP32-C3 SuperMini - flash BOTH files:
esptool.py --port /dev/cu.usbserial-XXXX --chip esp32c3 --baud 460800 \
  write_flash 0x10000 firmware_esp32c3.bin 0x3D0000 spiffs_esp32c3.bin

OTA Update (existing users)

Open http://rituals-diffuser.local → Firmware Update → Upload firmware_*.bin first, then littlefs_*/spiffs_* for web interface updates.