Notices


Reply
Thread Tools
No!No!No!Yes!'s Avatar
Posts: 700 | Thanked: 846 times | Joined on Nov 2009
#1051
Originally Posted by dr_frost_dk View Post
That works if i use exit code.....But im having a hard time to get it to work since im using AWK, heres a line from the script, where would i put the 'exit 1' code?

echo $x | awk '{if ($1 > 3900 && $1 <= 4050) printf "%1.3fV - %3.1f", $1 / 1000, 70 + ($1 - 3900) / 10}'

i have tried many different ways but cant seem to get it to use exit code......
You have solved ... I guess?!
__________________
Have a look at Queen BeeCon Widget (WIKI) Customizable and flexible widget-based multi-instance monitoring, alerting and interactive tool for the N900
Please provide comments and feedback for having QBW supported and enhanced further - (DONATE) - v1.3.3devel / v1.3.3testing / v1.3.3extras
 
dr_frost_dk's Avatar
Posts: 1,503 | Thanked: 2,688 times | Joined on Oct 2010 @ Denmark
#1052
kind off, used a more basic code "sh", not so elegant but it gets the job done.

Side Question:
why is the sh in the N900 terminal not "advanced" enough to use
Code:
if [[ $x -ge 3660 && $x -lt 3800 ]];then
as in my new beecon V1.2 i had to use
Code:
if [ $x -ge 3660 ];then if [ $x -lt 3800 ];then
which is kinda stupid double work.... and that's why i used AWK instead, and of course i still use AWK because it is easier to calculate in and can make it look "pretty" with #.### and ###.# like the old qbasic way (print using), sadly that's my only programming language i am a custom to since i started in about 1994, before that C64
Code:
if [ $x -ge 3660 ];then if [ $x -lt 3800 ];then
echo $x | awk '{printf "%1.3fV - %3.1f", $1 / 1000, 15 + ($1 - 3660) / 4}{print "%"}'
exit 1
fi;fi
But the new V1.2 really helps to get a quick overview of the battery level, with the colors
BLUE - (85% - 100%) - Full charge
GREEN - (50% - 85%) - Still good
YELLOW - (15% - 50%) - Getting Low
ORANGE - (5% - 15%) - Start thinking about finding your charger
RED - (0% - 5%) - I told you to find that charger!!!

Next Version maybe with voice control so that it screams at you when it is low

Last edited by dr_frost_dk; 2011-01-13 at 10:40.
 
No!No!No!Yes!'s Avatar
Posts: 700 | Thanked: 846 times | Joined on Nov 2009
#1053
Originally Posted by dr_frost_dk View Post
kind off, used a more basic code "sh", not so elegant but it gets the job done.

Side Question:
why is the sh in the N900 terminal not "advanced" enough to use
Code:
if [[ $x -ge 3660 && $x -lt 3800 ]];then
as in my new beecon V1.2 i had to use
Code:
if [ $x -ge 3660 ];then if [ $x -lt 3800 ];then
cond1 -a cond2 True if both cond1 and cond2 are true.
cond1 -o cond2 True if either cond1 or cond2 is true.

Have a look at this for further references
__________________
Have a look at Queen BeeCon Widget (WIKI) Customizable and flexible widget-based multi-instance monitoring, alerting and interactive tool for the N900
Please provide comments and feedback for having QBW supported and enhanced further - (DONATE) - v1.3.3devel / v1.3.3testing / v1.3.3extras
 

The Following User Says Thank You to No!No!No!Yes! For This Useful Post:
dr_frost_dk's Avatar
Posts: 1,503 | Thanked: 2,688 times | Joined on Oct 2010 @ Denmark
#1054
Nice , V1.2 will be soon replaced with V1.3

Thank you so much.
The code would not work, the one with && worked in ubuntu terminal so i thought i would be the same in maemo terminal.
But i just have to use -a instead of &&

Battery thread updated

Last edited by dr_frost_dk; 2011-01-13 at 11:20.
 
dr_frost_dk's Avatar
Posts: 1,503 | Thanked: 2,688 times | Joined on Oct 2010 @ Denmark
#1055
a little problem have arrived.....

i cannot get the blue color on since i can't figure out how to get "exit code -1", if i use
Code:
exit -1
it gives exit code 2???

how do i use exit code -1?

the color now gets orange when charge is over 85%......
 
dr_frost_dk's Avatar
Posts: 1,503 | Thanked: 2,688 times | Joined on Oct 2010 @ Denmark
#1056
BUMP.

Anybody knows the exact command to get exit code -1
 
No!No!No!Yes!'s Avatar
Posts: 700 | Thanked: 846 times | Joined on Nov 2009
#1057
Originally Posted by dr_frost_dk View Post
BUMP.

Anybody knows the exact command to get exit code -1
awk '{exit -1}'

however -1 is used to return some system error condition, so expect some extra output to be displayed
__________________
Have a look at Queen BeeCon Widget (WIKI) Customizable and flexible widget-based multi-instance monitoring, alerting and interactive tool for the N900
Please provide comments and feedback for having QBW supported and enhanced further - (DONATE) - v1.3.3devel / v1.3.3testing / v1.3.3extras
 
dr_frost_dk's Avatar
Posts: 1,503 | Thanked: 2,688 times | Joined on Oct 2010 @ Denmark
#1058
awk didn't work, it just crashed my hildon-desktop and now i have to add ALL my widgets again, it's good that they know their position

well im just going to use 4 colors, but thats ok
so now it's:
GREEN
YELLOW
ORANGE
RED
 
James_Littler's Avatar
Posts: 820 | Thanked: 436 times | Joined on May 2010 @ Portsmouth, UK.
#1059
Sorry for jumping in guys but I need a bit of help.

How do I start a terminal session with a command and leave it running?
e.g. how would I create a widget to open xterminal then run 'sudo kernel-config show' and leave the window open?

Thanks
 
seasharkvvv's Avatar
Posts: 77 | Thanked: 34 times | Joined on Jan 2011
#1060
hi im having trouble getting day and night beecon working. it looks great and i would really like it working. i didnt understand step 2. ccredit to the devlopers.

cheers, 1st post,,day 1 of getting new n900,,wanted to get the best widget :P after getting an amzing loopable wallpaper :P

i will no longer be a noob soon

Last edited by seasharkvvv; 2011-01-16 at 22:10.
 
Reply


 
Forum Jump


All times are GMT. The time now is 08:02.