Add LDR auto-brightness toggle for ESP32-2432S028R/2USB #725
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add configurable LDR auto-brightness for ESP32-2432S028R/2USB
Overview
Adds user-configurable LDR (Light Dependent Resistor) auto-brightness feature for ESP32-2432S028R and ESP32-2432S028_2USB boards, allowing users to choose between automatic ambient light adjustment or fixed brightness via WiFi configuration portal.
Features
Changes
New Settings
useLDR(boolean): Toggle auto-brightness (default: false)Brightness(0-255): Maximum when auto, fixed when manual (default: 250)Modified Files
DEFAULT_USELDR, JSON keys, anduseLDRfield toTSettingsuseLDRwith backward-compatible defaultsuseLDRloading from SD card configstrlen()instead of string comparison)Settings.useLDRflag at init and runtimeLDR_PIN 34assignmentBug Fixes
strlen(getValue()) > 0WiFi.status() == WL_CONNECTEDshouldSaveConfigblock and once unconditionally after WiFi connectionshouldSaveConfig == trueTechnical Details
Hardware Calibration
LDR_MIN = 0: Brightest (direct light, LDR low resistance pulls voltage low)LDR_MAX = 500: Near complete darkness (LDR high resistance, voltage stays high)Performance
Configuration Examples
SD Card
/config.json:{ "useLDR": true, "Brightness": 200 }SPIFFS
/config.json:{ "useLDR": false, "Brightness": 150 }Backward Compatibility
useLDRdefault tofalseBrightnessdefault to250Testing
Supported Boards
Both boards share identical LDR hardware configuration.
User Experience