Skip to content

Conversation

@arunkumar-mourougappane
Copy link
Owner

No description provided.

…acro

Replaced USE_NEOPIXEL macro with USE_WEBSERVER for web server functionality,
enabling the web interface on both ESP32 Development Board and Feather ESP32-S3 TFT.

Changes:
- platformio.ini: Added -DUSE_WEBSERVER=1 to all environments
  - esp32dev: Now has web server enabled
  - adafruit_feather_esp32s3_tft: Web server enabled (was previously tied to NeoPixel)
  - test: Added USE_WEBSERVER flag and VERSION
  - test_feather: Added USE_WEBSERVER flag, fixed VERSION quotes

- src/main.cpp: Changed USE_NEOPIXEL to USE_WEBSERVER
  - Web server initialization controlled by USE_WEBSERVER
  - Updated comments to reflect availability on both boards

- src/command_interface.cpp: Changed USE_NEOPIXEL to USE_WEBSERVER
  - Web server commands available when USE_WEBSERVER is defined
  - Updated help text to remove "Feather only" restriction
  - printWebServerHelp() now under USE_WEBSERVER

- include/command_interface.h: Changed USE_NEOPIXEL to USE_WEBSERVER
  - Function declarations properly guarded

- src/web_server.cpp: Changed USE_NEOPIXEL to USE_WEBSERVER
  - Entire file now controlled by USE_WEBSERVER macro

- include/web_server.h: Changed USE_NEOPIXEL to USE_WEBSERVER
  - Header guards updated for proper compilation

Build results:
✅ esp32dev: Flash 84.9%, RAM 15.9% - SUCCESS
✅ adafruit_feather_esp32s3_tft: Flash 73.5%, RAM 15.5% - SUCCESS
✅ test: Flash 84.9%, RAM 15.9% - SUCCESS
✅ test_feather: Flash 73.5%, RAM 15.5% - SUCCESS

The web server feature is now available on both boards and can be
independently controlled via the USE_WEBSERVER macro.
Changed default Access Point SSID from static "ESP32-WiFiScanner" to
dynamically generated SSID based on device chip ID and MAC address.

SSID Format: <chip_id>_AABBCCDDEEFF
Example: 12345678_A0B1C2D3E4F5

Changes:
- src/wifi_manager.cpp:
  - Added #include <esp_system.h> for chip ID functions
  - Created generateDefaultSSID() function that:
    - Extracts device MAC address using esp_efuse_mac_get_default()
    - Gets chip ID using ESP.getEfuseMac()
    - Formats SSID as 8-hex-digit chip ID + underscore + 12-hex-digit MAC
  - Updated currentAPSSID initialization to use generateDefaultSSID()
  - Updated AP failure recovery to use generateDefaultSSID()

- include/config.h:
  - Added documentation about dynamic SSID generation
  - Kept AP_SSID define for backward compatibility
  - Clarified that static define is no longer used by default

Benefits:
✅ Each ESP32 device has a unique, identifiable SSID
✅ Easy to distinguish multiple devices in the same area
✅ MAC address visible in SSID helps with network management
✅ No SSID collisions when deploying multiple devices
✅ Chip ID provides additional device identification

Build results:
✅ esp32dev: Flash 84.9%, RAM 15.9% - SUCCESS
✅ adafruit_feather_esp32s3_tft: Flash 73.5%, RAM 15.5% - SUCCESS

The SSID is generated once at startup and remains consistent across
reboots for the same device.
Added intelligent monitoring system that automatically manages the web
server lifecycle based on WiFi connectivity state.

Changes:
- include/web_server.h:
  - Added monitorWebServerState() function declaration

- src/web_server.cpp:
  - Implemented monitorWebServerState() with state tracking:
    - Monitors WiFi connection status changes
    - Monitors WiFi mode transitions (Idle/Station/AP/Off)
    - Auto-starts web server when:
      * Switching to AP mode
      * Successfully connecting to WiFi in Station mode
    - Auto-stops web server when:
      * Disconnecting from WiFi in Station mode
    - Uses static variables to track state changes and prevent
      redundant start/stop operations

- src/main.cpp:
  - Added monitorWebServerState() call in main loop
  - Web server state now continuously monitored alongside requests

- src/wifi_manager.cpp:
  - Removed manual web server start calls from:
    * startStationMode()
    * startAccessPoint()
    * startAccessPoint(ssid, password)
  - Updated user messages to indicate auto-start behavior
  - Monitoring system now handles all web server lifecycle

Benefits:
✅ Web server automatically available in both AP and Station modes
✅ Seamless transitions when switching WiFi modes
✅ Graceful shutdown when WiFi disconnects in Station mode
✅ No manual intervention required
✅ Cleaner separation of concerns
✅ Prevents duplicate server instances

Behavior:
- AP Mode: Server starts immediately after AP initialization
- Station Mode: Server starts when WiFi connection established
- Station Disconnect: Server stops when connection lost
- Mode Switch: Server restarts with new IP address

Build results:
✅ esp32dev: Flash 85.0%, RAM 15.9% - SUCCESS
✅ adafruit_feather_esp32s3_tft: Flash 73.5%, RAM 15.5% - SUCCESS
Replaced hardcoded device names and version strings with dynamic
detection based on chip model and build configuration.

Changes:
- src/web_server.cpp:
  - Added getDeviceName() helper function:
    * Detects board type using Arduino board defines
    * Returns "Feather ESP32-S3 TFT" for Adafruit Feather boards
    * Returns "ESP32 Dev Module", "ESP32-S3 Dev Module", etc. for generic boards
    * Uses ESP.getChipModel() for accurate chip identification

  - Added getVersionString() helper function:
    * Extracts version from VERSION build flag
    * Uses proper macro stringification (STRINGIFY/TOSTRING)
    * Falls back to "3.0.0" if VERSION not defined

  - Replaced static HTML_FOOTER with generateHtmlFooter() function:
    * Dynamically generates footer with current version and device name
    * Updated all 10 page handlers to use generateHtmlFooter()

  - Updated homepage device badge:
    * Changed from hardcoded "Feather ESP32-S3 TFT"
    * Now displays actual device name dynamically

Benefits:
✅ Web interface correctly identifies device type automatically
✅ Version number pulled from build configuration
✅ No manual updates needed when changing boards
✅ Single codebase supports multiple ESP32 variants
✅ Accurate branding on each device (ESP32/ESP32-S3/ESP32-C3)

Examples:
- ESP32dev board: "ESP32 WiFi Utility v3.0.0 | ESP32 Dev Module"
- Feather board: "ESP32 WiFi Utility v3.0.0 | Feather ESP32-S3 TFT"

Build results:
✅ esp32dev: Flash 85.0%, RAM 15.9% - SUCCESS
✅ adafruit_feather_esp32s3_tft: Flash 73.6%, RAM 15.5% - SUCCESS
Minified HTML, CSS, and JavaScript content to significantly reduce
flash memory consumption while maintaining all functionality.

Changes:
- src/web_server.cpp:

  CSS Optimization:
  - Minified all CSS by removing whitespace, newlines, and comments
  - Reduced font stack from full list to just Arial for simplicity
  - Compressed color codes and spacing values
  - Removed unused progress-bar styles (kept only spinner)
  - Media queries condensed to single line

  JavaScript Optimization:
  - Minified all JavaScript functions
  - Shortened variable names (title->t, message->m, url->u, etc.)
  - Removed unnecessary whitespace and comments
  - Compressed function bodies to single lines

  HTML Optimization:
  - Removed verbose title prefix "ESP32 WiFi Utility" -> "ESP32 WiFi"
  - Simplified descriptions and labels throughout
  - Created generateNav() helper function to avoid nav menu repetition
  - Removed redundant "Professional" and "Quick" prefixes
  - Compressed QR code sections
  - Simplified footer (removed redundant subtitle)
  - Changed "Quick Stats" to "Stats"
  - Changed "Scan Networks" to "Scan"
  - Reduced verbose feature descriptions to concise bullets
  - Removed tips and extended descriptions
  - Minified inline styles (removed spaces, full names)

  Code Structure:
  - Replaced many R"rawliteral(...) blocks with direct string concatenation
  - Consolidated repeated HTML patterns
  - Reduced line count from 2115 to 1754 lines (361 lines = 17% reduction)

Memory Savings:
✅ ESP32dev: Flash reduced from 85.0% to 84.5% (~7KB saved)
✅ Feather ESP32-S3: Flash reduced from 73.6% to 73.1% (~7KB saved)
✅ RAM usage unchanged: 15.9% and 15.5% respectively

Benefits:
✅ Significant flash memory savings (~7KB)
✅ All functionality preserved
✅ Faster page loads (smaller HTML)
✅ Same visual appearance
✅ More headroom for future features

Build results:
✅ esp32dev: Flash 84.5%, RAM 15.9% - SUCCESS
✅ adafruit_feather_esp32s3_tft: Flash 73.1%, RAM 15.5% - SUCCESS
@arunkumar-mourougappane arunkumar-mourougappane linked an issue Oct 17, 2025 that may be closed by this pull request
@github-actions
Copy link

📊 Build Size Analysis

Metric Base (main) Current (PR) Change
Flash Usage 77.7% 84.5% ⚠️ Changed
RAM Usage 15.8% 15.9% ⚠️ Changed

Analysis

  • Flash usage shows the percentage of ESP32 flash memory used
  • RAM usage shows the percentage of runtime memory used
  • Changes in memory usage should be reviewed for optimization opportunities

This analysis helps maintain optimal memory usage across code changes.

@arunkumar-mourougappane arunkumar-mourougappane merged commit d6ce540 into main Oct 17, 2025
7 checks passed
@arunkumar-mourougappane arunkumar-mourougappane deleted the enable-web-server-for-espressif32 branch October 17, 2025 02:03
arunkumar-mourougappane added a commit that referenced this pull request Oct 17, 2025
Major Updates to README:

1. New "What's New in v3.1.0" Section:
   - Web Server Now Available on Both Boards
     * Previously Feather-only, now works on ESP32dev too
     * Updated access instructions for both AP and Station modes

   - Clickable Network Details View (Issue #10)
     * Interactive WiFi scanning with detailed info pages
     * 8-level signal quality scale
     * Channel congestion analysis with ratings
     * Security assessment for all encryption types
     * Connection recommendations
     * Smart caching (50 networks, 5-minute timeout)

   - Memory Optimization Achievements
     * ESP32dev: -27.7 KB flash (84.5% → 82.4%)
     * Feather: -25.4 KB flash (73.1% → 71.3%)
     * PROGMEM storage, F() macro, compiler flags

   - Comprehensive Test Coverage
     * 19 automated test cases
     * 100% pass rate on both boards
     * Complete test documentation

   - Auto-Restart Web Server
     * Seamless mode transitions
     * Dynamic device configuration

2. Version Badge Updates:
   - Added version badge: 3.1.0-dev
   - Added changelog link badge

3. Feature Section Updates:
   - Web Server Interface: Changed from "Feather Only" to "Available on Both Boards!"
   - Added clickable network details to web interface features
   - Updated with comprehensive network information display
   - Added visual indicators and color-coded ratings

4. Testing Section Added:
   - New section 4: Running Tests (Optional)
   - Commands for running automated tests
   - Test coverage summary
   - Pass rate statistics
   - Link to test documentation

5. Command Reference Updates:
   - Web Server Commands: Updated header from "Feather Only" to "Available on Both Boards!"
   - Enhanced description noting v3.0.0+ availability
   - Added clickable network details mention

6. Professional Dashboard Updates:
   - Scan Networks page now mentions clickable details (v3.1.0+)
   - Added bullet points for network detail features
   - Signal quality, congestion, security details listed

7. Memory & Performance Updates:
   - Added memory optimization metrics
   - Web server caching details
   - Flash usage reduction statistics
   - Updated code organization section with memory efficiency details

8. Code Organization Updates:
   - Total lines: ~4400+ → ~4500+
   - Added web interface line count (336+ lines)
   - Detailed memory optimization techniques
   - Updated test coverage information (19 test cases)
   - Compiler optimization flags documented

9. Future Enhancements Updates:
   - Marked Web Interface as ✅ Implemented (v3.0.0+)
   - Marked Clickable Network Details as ✅ Implemented (v3.1.0+)
   - Updated checkboxes to reflect completed features

Key Messaging Changes:
- Emphasis on dual-board support for web server
- Highlighting of new interactive features
- Memory optimization achievements
- Comprehensive test coverage
- Professional quality assurance

All changes accurately reflect the commits since v3.0.0 release:
- Web server enablement for ESP32dev (PR #8)
- Memory optimization (PR #9)
- Clickable AP details implementation (Issue #10)
- Comprehensive test coverage
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.

Enable web server for espressif32

2 participants