Thanks Meter 2357
Join Date: Dec 2009
Location: Clausthal-Zellerfeld / Munich
DONATE TO ME
[20.Jul.12][DEV] Lights Library v2 w/ correct LED color & notification while charging
If you don't know what a lights library is or what it does, then please move on. This topic is not for you.
Lights library with correct LED color & dual LED support
This lights library is based on the Pyramid lights library (HTC Sensation) by the CyanogenMod Project.
Differences to the normal lights lib we are currently using:
Show correct battery state:
- Based on HTC Pyramid lights lib from CyanogenMod Project
- Show correct battery state
- Add support for alternating LEDs (dual LED support)
By default AOSP-based ROMs already report the devices as fully charged (green LED) even though the device is only at 90% of its battery capacity. This lights library will still show the amber LED until the kernel reports the battery as full.
Add support for flashing LED while charging:
Version 2 contains a changed behavior in comparison to the older version. The description of the older verison can be found below.
In the new version the LED will flash in the same color of your current charge state if you get a notification while charging, i.e.:
- Charging & you get a notification --> Amber LED flashing
- Fully charged & you get a notification --> Green LED flashing
The old behavior has a main disadvantage that the dual LEDs might not work correctly if the device goes into deep sleep. This is hardware related. The newer version doesn't have such a limitation as it uses the hardware supported modes.
Originally Posted by marc1706
Add support for alternating LEDs:
It is something that has been bugging me for a while now.The scenario is simple:
Your phone is lying on the table and you are getting a short message, mail or maybe miss a call. Once you get back it will normally blink the notification led and you'll know that you missed something. What if you are charging your phone though? The phone will just show the charging LED and there is no way to tell you missed something unless you unlock your phone.
I've been missing a feature that'll show the charging LED while shortly flashing with a different LED color in order to notify you of a missed short message, mail, etc.
While the Leo has support for something similar it is actually somewhat weird:
First the amber LED shortly turns on and then after a small pause the green LED turns on for an instant. Afterwards there is a rather long pause and then it starts over. This is actually more or less an amber colored notification followed by a green colored notification. As the purpose of dual LED support is to show that we have a notification while charging this is not properly met by the native support the Leo has.
Thus I decided to add my own implementation that'll show one LED first (color depends on the charge level) and switch to the other LED color and then after one second back to the original color. This way the LEDs will always be on and thus correctly represent the fact that the device is charging while it's also able to show that there is a notification.
If you don't know how you can use the attached file then this topic is probably not for you.
My 18.104.22.168 kernel for the HTC HD2 repo: https://github.com/marc1706/desire_kernel_35
Devices: HTC HD2 (#2), Google Nexus 4
phpBB.com MOD-Team Member
Follow me on twitter