Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Battery Status
#1
LCDHype Battery Status Plugin
------------------------------------------

1. Description:

Use this plugin to read system power variables.

2. Commands:

1. LifePercent - returns battery life in percent.
2. LifeTime - returns lifetime in format h:mmConfuseds (eg. 2:03:45). Result is -1 if unknown.
3. nLifeTime - returns lifetime in seconds. Result is -1 if unknown.
4. FullLifeTime - returns full lifetime in format h:mmConfuseds. Result is -1 if unknown.
5. nFullLifeTime - returns full lifetime in seconds. Result is -1 if unknown.
6. BatteryFlag - returns battery status in format: {High, Low, Critical, Charging, No Battery, Unknown}.
7. nBatteryFlag - returns battery status in a number. 1 = High, 4 = Low, 8 = Critical, etc. (see above).
8. ACFlag - returns power supply status in format: {AC Line, Battery}.
7. nACFlag - returns power supply status in a number. 0 = Battery, 1 = AC Line.


Examples:

This will give you your battery percent:
%UsePlugin('battery\batteryplugin.dll',LifePercent)

This will give you the remaining battery time:
%UsePlugin('battery\batteryplugin.dll',LifeTime)


Installation:

Place the DLL to LCDHypeFolder\plugins\Battery\ ,
restart LCDHype and you should see the plugin in the plugins section of LCDHype
(by the name of System Power Information).

Example script:


CODE

**************************
*     LCDHype Battery    *  
*           by           *
*       Predator_MF      *
**************************
#Header
%CleanUp.ClearVRAM()
%Common.SetPriority(1000)
%Param.RenderMode(Simple)
%LCD.Gfx_SetTextArea(0,0,127,31)
%DefVar(BattPLG='battery\batteryplugin.dll')
%DefFunc(BattPercent=%UsePlugin(%BattPLG(),LifePercent))
%DefFunc(BattFlag=%UsePlugin(%BattPLG(),nBatteryFlag))
%DefFunc(ACFlag=%UsePlugin(%BattPLG(),nACFlag))
%DefFunc(LifeTime=%UsePlugin(%BattPLG(),LifeTime))
%DefVar(Inversion,Local=0)
#EndHeader

#GfxMode        
%LCD.Gfx_SetOverlayMode()
/ show percentage on the right /
%Format.AlignRight()
%LCD.Gfx_SetFont('Arial',12,1,Bold)
%BattPercent()'%'

/ draw the battery with simple lines /
%Graph.Rect(1,1,74,14,1,0)
%Graph.Rect(74,4,80,11,1,1)
%Format.Bar(Horizontal,68,10,0,100,%BattPercent(),0,0,4,3)
%Graph.Rect(19,2,20,13,0,0)
%Graph.Rect(37,2,38,13,0,0)
%Graph.Rect(55,2,56,13,0,0)

/ some additional text /
%Common.CreateNewLine()
%Format.AlignLeft()
%Format.Offset(Horizontal,2)
%Format.Offset(Vertical,-3)
%If((%ACFlag() = 1) AND (%BattFlag() = 1))  / Charged /
Then{
 %Param.InvertMode(0)
 %Graph.Font('Arial',8,1)
 '  AC Line, Fully Charged'
 }
%If((%ACFlag() = 1) AND ((%BattFlag() = 8) OR (%BattFlag() = 9))) / Charging /
Then{
 %Param.InvertMode(0)
 %Graph.Font('Arial',10,1)
 ' AC Line, Charging...'
 }
  Else{
 %If((%ACFlag() = 0) AND (%BattFlag() ! 4)) /Battery /
 Then{
   %Param.InvertMode(0)
   %Graph.Font('Arial',8,1)
   'Battery left for: '
   %Common.CreateNewLine()
   %Format.Offset(Vertical,-14)
   %Graph.Font('Arial',10,1, Bold)
   %Format.AlignRight()  
   %If(%LifeTime() ! '-1') Then{
   %LifeTime()
   }
   Else{ / remaining time not calculated so show this /
    '-:--:--'
    }
   }
    Else{
    %If(%ACFlag() = 0)  / critical battery /
    Then{
     / Invert the whole screen so it blinks once per second /
     %If(%Inversion() = 0)
     Then{
       %Param.InvertMode(1)
       %Assign(Inversion,1)
       }
        Else{
        %Param.InvertMode(0)
        %Assign(Inversion,0)
        }
      }
    }
  }
#EndGfxMode


Attached Files Thumbnail(s)
   

.zip   Battery.zip (Size: 25,59 KB / Downloads: 3.003)


Forum Jump:


Users browsing this thread: 1 Guest(s)