All Forums
 Microsoft Windows CE
 General CE
 Changing backlight timeouts (CE.NET)
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Author Topic  

ctacke

877 Posts

Posted - 01 Jul 2003 :  18:21:58  Show Profile  Email Poster
The display's backlight can be turned off automatically using the system inactivity timer. There are different timeouts, depending on wheter the system believes it is running on "AC" power or batteries.

The timeouts can be set in the Control Panel, ADSLOAD.REG or programmatically.



Important: The current specification for Windows CE backlight control is posted at forum topic 1902. The information at this topic is retained for reference purposes for older systems.





Registry Settings

The backlight timouts for CE.NET are stored in the registry under the following keys:
[HKEY_CURRENT_USER\ControlPanel\Backlight]
"BatteryTimeout"=dword:3C   ; seconds of inactivity before turning off backlight
"UseBattery"=dword:1 ; 1=use BatteryTimeout when on battery
; 0=don't turn off backlight when on battery

"ACTimeout"=dword:3C ; seconds of inactivity before turning off backlight
"UseExt"=dword:1 ; 1=use ACTimeout when on "AC" power
; 0=don't turn off backlight when on "AC" power

[HKEY_LOCAL_MACHINE\Platform\Backlight]
"BLightLevel4On"=dword:00 ; brightness level when running
"BLightLevel4Off"=dword:A0 ; brightness level when "off"


In this example, the BLightLevel4Off state is set to be dim (0xA0) instead of fully off (0xFF).

CE.NET adds the UseExt and UseBattery keys, which CE 3.0 did not use.

NOTE: The boot code on some ADS systems does not support registry keys outside of the HKEY_LOCAL_MACHINE branch. For these devices you can still programmatically set the values from a startup application to achieve the same effect.


Changing the Settings Programmatically

If you change them programmatically, and disable a timeout, you must rename the timeout key to have an "Old" prefix. In all cases you must set an event so the backlight driver knows you've made the changes.

Here is an example of disabling both timeouts:
HKEY    hKey;

DWORD value = 0;
DWORD type = 0;
DWORD size = 0;

if(ERROR_SUCCESS == RegOpenKeyEx(HKEY_CURRENT_USER, _T("ControlPanelBackLight"), 0, 0, &hKey))
{
value = 0;
type = REG_DWORD;
size = sizeof(DWORD);

// change the reg keys for AC power
RegSetValueEx(hKey, _T("UseExt"), 0, REG_DWORD, (BYTE*)&value, sizeof(DWORD));
RegQueryValueEx(hKey, _T("ACTimeout"), 0, &type, (BYTE*)&value, &size);
RegSetValueEx(hKey, _T("OldACTimeout"), 0, REG_DWORD, (BYTE*)&value, sizeof(DWORD));
RegDeleteValue(hKey, _T("ACTimeout"));

// change the reg keys for Battery power
value = 0;
RegSetValueEx(hKey, _T("UseBattery"), 0, REG_DWORD, (BYTE*)&value, sizeof(DWORD));
RegQueryValueEx(hKey, _T("BatteryTimeout"), 0, &type, (BYTE*)&value, &size);
RegSetValueEx(hKey, _T("OldBatteryTimeout"), 0, REG_DWORD, (BYTE*)&value, sizeof(DWORD));
RegDeleteValue(hKey, _T("BatteryTimeout"));

RegCloseKey(hKey);

// notify the driver we've made changes
HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, _T("BackLightChangeEvent"));
if(hEvent)
{
SetEvent(hEvent);
CloseHandle(hEvent);
}
}


For further reading about using backlight inverters with ADS products, see the backlight topic index.
For further reading about power management, see the CE power management topic index.

Drew Kidder
ADS Technology Transfer

Edited by akidder 8-Dec-2003: clarify the changes for CE.NET; add link to backlight and topic indexes
Edited by akidder 30-Mar-2006: Post link to current backlight control spec.

pacsciinst

15 Posts

Posted - 26 Apr 2005 :  13:41:47  Show Profile  Email Poster
In reference to topic 717 (backlight inactivity timer), is there a way to programmatically change the System sleep timer? I understand how to change the registry settings, but is there a need to fire an event to the OS inactivity driver to implement the setting change? Also, how does the BitsyX know when it is in battery or AC power mode? Can it be automated to switch between the two modes? If not, how can the mode be changed manually?

What I need is to disable sleep mode when in AC power mode, and enable the timer in battery power mode, but when I change the settings, only the AC power mode works.

Thanks,
Louie
Go to Top of Page

cmc

4 Posts

Posted - 26 Apr 2005 :  14:03:30  Show Profile  Email Poster
Windows CE API call "SystemParametersInfo" should help in settings
system sleep timeouts etc.

SPI_SETBATTERYIDLETIMEOUT and SPI_SETEXTERNALIDLETIMEOUT action parameters should work.

I suppose WinCE OS takes care of switching between external and battery power automatically. This works for a Pocket PC but
not for bitsy.

Sunil
Go to Top of Page

pacsciinst

15 Posts

Posted - 26 Apr 2005 :  16:43:03  Show Profile  Email Poster
I'll try "PowerManager/ReloadActivityTimeouts" event and see if it works...
Go to Top of Page
  Topic  
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Jump To:
Eurotech Support Forums © Eurotech Inc. Go To Top Of Page
This page was generated in 0.03 seconds. Snitz Forums 2000