Active Topics

 


Reply
Thread Tools
dr_frost_dk's Avatar
Posts: 1,503 | Thanked: 2,688 times | Joined on Oct 2010 @ Denmark
#161
Version 1.2 is out hehe
still only precise to 2%
but now with background color to give a more visual battery left status / holy crap i better charge it.....

It is at Page #1, Post #3
 

The Following User Says Thank You to dr_frost_dk For This Useful Post:
dr_frost_dk's Avatar
Posts: 1,503 | Thanked: 2,688 times | Joined on Oct 2010 @ Denmark
#162
Queen Beecon Widget Battery meter V1.3 has been updated:
Now it just has 4 colors:
GREEN (50% - 100%)
YELLOW (15% - 50%)
ORANGE (5% - 15%)
RED (0% - 5%)
 

The Following User Says Thank You to dr_frost_dk For This Useful Post:
Posts: 7 | Thanked: 6 times | Joined on Apr 2010 @ outOnTheFields
#163
Originally Posted by dr_frost_dk View Post
--------------------------- Battery Meter --------------------

Heres the Beecon buffer import file and the CODE
Code:
x=$(hal-device | grep voltage.current | awk '{printf "%4.0f",$3}')
if [ $x -ge 4050 ];then
echo $x | awk '{printf "%1.3fV - %3.1f", $1 / 1000, 85 + ($1 - 4050) / 12}{print "%"}'
exit 0;fi
if [ $x -ge 3900 -a $x -lt 4050 ];then
echo $x | awk '{printf "%1.3fV - %3.1f", $1 / 1000, 70 + ($1 - 3900) / 10}{print "%"}'
exit 0;fi
if [ $x -ge 3800 -a $x -lt 3900 ];then
echo $x | awk '{printf "%1.3fV - %3.1f", $1 / 1000, 50 + ($1 - 3800) / 5}{print "%"}'
exit 0;fi
if [ $x -ge 3660 -a $x -lt 3800 ];then
echo $x | awk '{printf "%1.3fV - %3.1f", $1 / 1000, 15 + ($1 - 3660) / 4}{print "%"}'
exit 1;fi
if [ $x -ge 3600 -a $x -lt 3660 ];then
echo $x | awk '{printf "%1.3fV - %3.1f", $1 / 1000, 5 + ($1 - 3600) / 6}{print "%"}'
exit 2;fi
if [ $x -lt 3600 ];then
echo $x | awk '{printf "%1.3fV - %3.1f", $1 / 1000, ($1 - 3300) / 60}{print "%"}'
exit 3;fi
...
I'm not sure if this is true for all of you, but "grep voltage.current" will result in two lines for me:

Code:
battery.voltage.current = 4  (0x4)  (int)
battery.voltage.current = 4011  (0xfab)  (int)
and that was resulting in non working script for me (voltage showing as 44,011, percentage as 3257,8, etc..code was putting those two numbers together, and it was making the $1 reference incorrect). I'm not saying, that this is the best solution, and some of the coders out there might find a better way, but i've replaced
Code:
 grep battery.voltage
with
Code:
 grep -E 'voltage.current.+[[:digit:]]{4}'
and that fixed the input/output for me.

I hope this helps someone.

-M.
BTW: thanks for the nice piece of work here.
 

The Following User Says Thank You to miskooldfield For This Useful Post:
dr_frost_dk's Avatar
Posts: 1,503 | Thanked: 2,688 times | Joined on Oct 2010 @ Denmark
#164
thats weird, mine does not do that but thanks for the update, if anybody has a problem with the script they can use the changes that miskooldfield posted.

miskooldfield do you have any battery apps install that gives you current.voltage in both V without decimals and the standard mV value

but so far how is the script serving you, and is it 1.3?
 

The Following User Says Thank You to dr_frost_dk For This Useful Post:
Posts: 7 | Thanked: 6 times | Joined on Apr 2010 @ outOnTheFields
#165
I'm not sure, which app should do that. Only batt related app I have is actually battery graph - i will try to find out, whether this one could be causing it.
Yes, I'm using 1.3 and so far i can't really tell the script accuracy/reliability - so far i was able to notice, that there is about +-4% difference between the calculated percentage from your script and the "native" meter.
I'm successfully using the script only since today ... so i can't really provide much more value at this point..
-M.

Last edited by miskooldfield; 2011-01-15 at 21:47.
 

The Following User Says Thank You to miskooldfield For This Useful Post:
dr_frost_dk's Avatar
Posts: 1,503 | Thanked: 2,688 times | Joined on Oct 2010 @ Denmark
#166
you will see it when the charge gets low and the battery graph/internal battery meter shows 0ma left then the meter script i made will give you a % reading of whats left so you know for sure.

Just a note, when my script hits 0% phone shuts off.
 

The Following User Says Thank You to dr_frost_dk For This Useful Post:
Posts: 7 | Thanked: 6 times | Joined on Apr 2010 @ outOnTheFields
#167
after few more days of using this script i can say, that the method used for calculating percentage should be set as system default..
When the system meter reached zero, i still had almost 8 % left, and phone doesn't look like powering off at all. I didn't wanted the battery to drain completely as mine is more than one year old, and i really don't want to try whether it will survive that .
Just one more thank you for the good job. And by the way, if you know of a way, how the system battery meter (in the upper menu of desktop) can be "calibrated" with this script, please let me know. Meanwhile i will try to also find out if it is possible ...
-M.
 

The Following User Says Thank You to miskooldfield For This Useful Post:
Posts: 1,341 | Thanked: 708 times | Joined on Feb 2010
#168
Matan (or anyone) could integrate that to modified-hildon-desktop maybe, to replace the factory faulty power gauge.
This was talked in some thread months ago when Mugen batteries came to use and everyone noticed only BME/HAL voltage-level gives sensible output.
 

The Following User Says Thank You to zimon For This Useful Post:
D4rKlar's Avatar
Posts: 675 | Thanked: 923 times | Joined on Apr 2010 @ London
#169
Would it be possible to post the command to simply calculate and display % only, without backgrounds or anything?

Kind Regards and thanks again mate!
D4rKlar
__________________
_________________________
_________________________________
_
* D4rKlar on DeviantART * Maemo5 on DeviantART *
_
* M4riNa D4rK Theme and Iconset *
_
 

The Following User Says Thank You to D4rKlar For This Useful Post:
Posts: 7 | Thanked: 6 times | Joined on Apr 2010 @ outOnTheFields
#170
make a file,
nano /home/user/MyDocs/tmp/batteryCheck.sh
paste this in
x=$(hal-device | grep -E 'voltage.current.+[[:digit:]]{4}' | awk '{printf "%4.0f",$3}')
if [ $x -ge 4050 ];then
echo $x | awk '{printf "%1.3fV - %3.1f", $1 / 1000, 85 + ($1 - 4050) / 12}{print "%"}'
exit 0;fi
if [ $x -ge 3900 -a $x -lt 4050 ];then
echo $x | awk '{printf "%1.3fV - %3.1f", $1 / 1000, 70 + ($1 - 3900) / 10}{print "%"}'
exit 0;fi
if [ $x -ge 3800 -a $x -lt 3900 ];then
echo $x | awk '{printf "%1.3fV - %3.1f", $1 / 1000, 50 + ($1 - 3800) / 5}{print "%"}'
exit 0;fi
if [ $x -ge 3660 -a $x -lt 3800 ];then
echo $x | awk '{printf "%1.3fV - %3.1f", $1 / 1000, 15 + ($1 - 3660) / 4}{print "%"}'
exit 1;fi
if [ $x -ge 3600 -a $x -lt 3660 ];then
echo $x | awk '{printf "%1.3fV - %3.1f", $1 / 1000, 5 + ($1 - 3600) / 6}{print "%"}'
exit 2;fi
if [ $x -lt 3600 ];then
echo $x | awk '{printf "%1.3fV - %3.1f", $1 / 1000, ($1 - 3300) / 60}{print "%"}'
exit 3;fi
save, exit nano
change file permission; set "executable"
chmod +x /home/user/MyDocs/tmp/batteryCheck.sh
and run the script with
sh /home/user/MyDocs/tmp/batteryCheck.sh
if you want, you can put this script into the usr/bin with
cp /home/user/MyDocs/tmp/batteryCheck.sh /usr/bin/
and launch via
batteryCheck
in terminal.

I hope that is what you wanted.
-M.

Forgot this:
if you wnat just percentage, then use this code instead of the first one:
x=$(hal-device | grep -E 'voltage.current.+[[:digit:]]{4}' | awk '{printf "%4.0f",$3}')
if [ $x -ge 4050 ];then
echo $x | awk '{printf "%3.1f", $1 / 1000, 85 + ($1 - 4050) / 12}{print "%"}'
exit 0;fi
if [ $x -ge 3900 -a $x -lt 4050 ];then
echo $x | awk '{printf "%3.1f", $1 / 1000, 70 + ($1 - 3900) / 10}{print "%"}'
exit 0;fi
if [ $x -ge 3800 -a $x -lt 3900 ];then
echo $x | awk '{printf "%3.1f", $1 / 1000, 50 + ($1 - 3800) / 5}{print "%"}'
exit 0;fi
if [ $x -ge 3660 -a $x -lt 3800 ];then
echo $x | awk '{printf "%3.1f", $1 / 1000, 15 + ($1 - 3660) / 4}{print "%"}'
exit 1;fi
if [ $x -ge 3600 -a $x -lt 3660 ];then
echo $x | awk '{printf "%3.1f", $1 / 1000, 5 + ($1 - 3600) / 6}{print "%"}'
exit 2;fi
if [ $x -lt 3600 ];then
echo $x | awk '{printf "%3.1f", $1 / 1000, ($1 - 3300) / 60}{print "%"}'
exit 3;fi
this one results in 18.0% instead of 4.011V - 92.3%

Last edited by miskooldfield; 2011-01-18 at 18:22.
 

The Following 2 Users Say Thank You to miskooldfield For This Useful Post:
Reply

Tags
battery, battery test, best battery, good bad ugly, modding, mugen battery, scud battery, tool got banned, yasirrfc


 
Forum Jump


All times are GMT. The time now is 13:44.