In theory there should be a way to change brightness via the LCD module but I couldn't suss it out... for better or worse here is how I change brightness...
first of all be sure to follow the instructions here
https://www.olimex.com/wiki/How_to_add_pwm
check /proc/config.gz before rushing off to recompile a kernel you might already have it (sunxi pwm)...
(add pwm-sunxi to /etc/modules for good measure !)
in addition in script.bin make sure you have changed these settings (like this)
lcd_pwm_not_used = 1
lcd_pwm_used = 0
in the first LCD stanza
it might just be a good idea to have something connected to the debug serial port in case anything goes wrong ;)
once rebooted you should see something in /sys/ like this /sys/class/pwm-sunxi/pwm0
that being the case add to /etc/rc.local (before exti 0!)
echo "40" > /sys/class/pwm-sunxi/pwm0/duty_percent
now when you boot your backlight should be at 40%... (time to test the LiPo again me thinks!)
the lowest I could go was 25% anything lower seems to blank the display, its not impossible that messing with the duty frequency you could go lower, but 25% is so dim its basically pointless...
btw you cant sudo echo as the pipe wont inherit root, I seem to remember there is some FU with tee to get round this, of course you can sudo su for a quick while, because you're really not dim enough to be running as root all the time now are you...
It might be interesting I post an update for controlling the LCD Brightness on the newer mainline kernel images - Debian 11 Bullseye.
Tested under XFCE desktop environment.
The brightness can be controlled by setting value in range from 1 to 10 in /sys/class/backlight/backlight/brightness.
For the complete standby of the display I disabled xfce4 power manager and used xset dpms.
# Disable xfce power-manager monitor control
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/blank-on-ac -s 0
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/dpms-on-ac-sleep -s 0
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/dpms-on-ac-off -s 0
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/dpms-enabled -s false
# Using xset dpms
xset dpms force on
...
# Turn off display
COUNT=$(cat /sys/class/backlight/backlight/brightness)
while [ $COUNT -gt 1 ]; do
COUNT=$(($COUNT - 1))
echo $COUNT > /sys/class/backlight/backlight/brightness
sleep 0.1
done
# USING xset dpms to turn off the monitor
xset dpms force off
Kernel 3.4 Image LCD standby code:
# Turn off display
COUNT=$(cat /sys/class/pwm-sunxi/pwm0/duty_percent)
while [ $COUNT -gt 20 ]; do
COUNT=$(($COUNT - 5))
echo $COUNT > /sys/class/pwm-sunxi/pwm0/duty_percent
sleep 0.1
done
# LCD power GPIO disable
echo 0 > /sys/class/gpio/gpio58_ph8/value # GPIO might be manually added if missing
# echo 0 > /sys/class/gpio/gpio232/value # mainline GPIO