Potentiometer based LCD Brightness Control#284
Open
TadeuBotelho wants to merge 5 commits intoducalex:masterfrom
Open
Potentiometer based LCD Brightness Control#284TadeuBotelho wants to merge 5 commits intoducalex:masterfrom
TadeuBotelho wants to merge 5 commits intoducalex:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Potentiometer-based LCD Brightness Control (ESP32-S3 devkit)
Summary
control (GPIO 6 / ADC1_CH5) for the
esp32-s3-devkittarget inRetro-Go v1.46.
(potentiometer on GPIO 7 / ADC1_CH6).
What Was Changed / Added
Target Configuration Defines
File:
components/retro-go/targets/esp32-s3-devkit/config.hRG_BRIGHTNESS_POTENTIOMETER_ENABLED--- Enable the feature\RG_BRIGHTNESS_POTENTIOMETER_ADC_UNIT--- ADC unit(e.g.
ADC_UNIT_1)\RG_BRIGHTNESS_POTENTIOMETER_ADC_CHANNEL--- ADC channel(
ADC_CHANNEL_5)\RG_BRIGHTNESS_POTENTIOMETER_ADC_ATTEN--- Attenuation(
ADC_ATTEN_DB_11)\RG_BRIGHTNESS_POTENTIOMETER_CALC_BRIGHTNESS(raw)--- Conversionmacro (raw → 0--100%)\
RG_BRIGHTNESS_POTENTIOMETER_UPDATE_THRESHOLD--- Hysteresisthreshold (e.g. 5%)\
RG_BRIGHTNESS_POTENTIOMETER_UPDATE_INTERVAL--- Update interval(e.g. 100 ms)
Modifications in
components/retro-go/rg_input.cAdded
rg_input_read_brightness_potentiometer_raw()Added periodic block inside
input_task():Runs every
RG_BRIGHTNESS_POTENTIOMETER_UPDATE_INTERVALApplies hysteresis logic
When delta exceeds
RG_BRIGHTNESS_POTENTIOMETER_UPDATE_THRESHOLD, calls:Added safety check before setting brightness:
Ensures the display driver is initialized before adjusting
brightness.
Added ADC initialization in
rg_input_init():Wiring Diagram (Summary)
Standard 3-pin potentiometer:
Recommended value: 10kΩ
If noise is observed: - Add 100 nF capacitor between wiper and GND -
Improve grounding - Increase sample averaging
Behavior and Design Decisions
fluctuations.
blackout.
startup instability.
How to Build and Test
From project root:
Flash example:
Look for log messages such as:
Initializing ADC brightness potentiometer driver...Brightness potentiometer adjusted backlight to %d%%Debugging Tips
If brightness does not respond:
RG_BRIGHTNESS_POTENTIOMETER_ENABLEDis definedModified files
Target config: config.h — added brightness potentiometer defines.
Input driver: rg_input.c — added ADC init, rg_input_read_brightness_potentiometer_raw(), and input_task() brightness handling.
Future Improvements
limits)
License / Credit
Implementation follows Retro-Go project structure and coding patterns.
May be adapted for other targets by adjusting GPIO and ADC channel
definitions.