Skip to content

388 Auto Dim LCD Backlight and Power LED

VK2EFL edited this page Jul 11, 2021 · 1 revision

Auto-Dim LCD Backlight and Power LED

The keyer supports an optional LED Power indicator, and can also dim the Display backlight and Power LED after a period of inactivity. This is done in order to preserve battery power.

To enable either or both features, follow these steps:

First, in keyer_features_and_options.h, you must uncomment this line (or the rest will be ignored):

#define FEATURE_LCD_BACKLIGHT_AUTO_DIM  // turn off LCD backlight and/or dim Power Indicator LED after x minutes (LED requires a PWM pin)

Second, if you want an LED Power indicator, specify a non-zero pin to light the LED in keyer_pin_settings.h. This must be a PWM pin, and likely needs a current limiting resistor in your circuit:

#if defined(FEATURE_LCD_BACKLIGHT_AUTO_DIM)
  #define keyer_power_led 0   // must be a PWM-capable pin
#endif

You can control the brightness of the Power LED when active and when inactive by changing these values in keyer_settings.h. Experiment to find values you are happy with. If keyer_power_led is zero above, these do nothing. If you never want the Power LED to dim, just set the keyer_power_led_asleep_duty to the same value as the awake setting. If you want it to turn off completely when inactive, set it to 0.

#if defined(FEATURE_LCD_BACKLIGHT_AUTO_DIM)
  #define keyer_power_led_awake_duty 255   // PWM duty cycle. 0 is 0%, 255 is 100%
  #define keyer_power_led_asleep_duty 25   // 25 is quite dim. Use 0 for off
#endif

Third, you can change the inactivity timer in keyer_settings.h (the unit is minutes, and the default is 5):

#define dim_backlight_inactive_time 5     // minutes - FEATURE_LCD_BACKLIGHT_AUTO_DIM

The Display and Power LED will switch back on when any activity resumes.

Note you can use this feature to have an LED Power indicator even if there is no display.

Clone this wiki locally