home *** CD-ROM | disk | FTP | other *** search
EPOC OPL Source | 2000-10-17 | 1.5 KB | 51 lines |
-
-
- REM Macro BatStat version 1.00
- REM Display the current battery statistics
- REM By Pascal NICOLAS, to be used with Macro5
- REM Last edited on 1 June 1998
-
- Include "Const.oph"
- Include "System.oxh"
- Include "Systinfo.oxh"
- Const displayTime% = 40 :REM 40=2*20=2 seconds
-
- PROC Macro:
- Local Status$(7), l%, mV&, x&, p%, w%
- Vector MainBatteryStatus&:
- BatteryVeryLow,BatteryLow,BatteryGood
- EndV
- BatteryZero::
- Status$="Empty"
- Goto EndVector
- BatteryVeryLow::
- Status$="Replace"
- Goto EndVector
- BatteryLow::
- Status$="Low"
- Goto EndVector
- BatteryGood::
- REM Remove the REM before the RETURN
- REM if you want the panel only
- REM when the batteries are low.
- REM Return
- Status$="OK"
- EndVector::
- SIBatteryVolts:(mV&, x&, x&, x&)
- p%=Max((mV&-2000)/10,0) :REM mVmin=2000 ; mVmax=3000
- gUpdate Off
- gFont KFontArialNormal15&
- l%=gTWidth(Status$)+94 :REM 94=10+60+4+10+10
- w%=gCreate(637-l%,185,l%,52,KgCreateVisible%,$01) :REM $01=KgCreate4ColourMode% :REM bottom right
- gButton "",KButtS5%,l%,52,KButtS5Raised%
- gAt 10,12 :gBox 60,28 :gFill 60*p%/100,28,0 :gMove 60,10 :gBox 4,8
- gTMode KtModeInvert% :gAt 25,32 :gPrint Num$(p%,3)+"%" :gTMode KtModeSet%
- gAt 84,32 :gPrint Status$
- gUpdate On :gUpdate
- REM gIPrint Num$(p%,3)+"% - "+Num$(mV&,5)+"mV - "+Status$,kBusyTopRight% :REM debug info
- Pause displayTime%
- gClose w%
- ENDP
-
-
-