Skip to content

Conversation

@bdraco
Copy link

@bdraco bdraco commented Jan 22, 2026

Moves HTTP response code strings (e.g., "OK", "Not Found", "Internal Server Error") to flash memory on ESP8266, saving ~700 bytes of RAM.

  • Added platform-specific macros in literals.h:
    • DECLARE_STR - stores strings in PROGMEM on ESP8266, constexpr elsewhere
    • STR - returns __FlashStringHelper* on ESP8266, const char* elsewhere
    • STR_RETURN_TYPE - platform-appropriate return type
  • Updated responseCodeToString() to use these macros
  • No changes for ESP32 or other platforms (they continue using constexpr)

ESP8266 has only ~45KB usable RAM. These strings were consuming RAM unnecessarily when they could be stored in flash and accessed via PROGMEM.

@mathieucarbou mathieucarbou force-pushed the response_strings_flash_esp8266 branch from e83943d to a6649d3 Compare January 22, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants