home *** CD-ROM | disk | FTP | other *** search
/ PSION CD 2 / PsionCDVol2.iso / Programs / 12 / Macro5SIS.sis / M5Macros.sis / BatStat.opl (.txt) < prev    next >
Encoding:
EPOC OPL Source  |  2000-10-17  |  1.5 KB  |  51 lines

  1.  
  2.  
  3. REM Macro BatStat version 1.00
  4. REM Display the current battery statistics
  5. REM By Pascal NICOLAS, to be used with Macro5
  6. REM Last edited on 1 June 1998
  7.  
  8. Include "Const.oph"
  9. Include "System.oxh"
  10. Include "Systinfo.oxh"
  11. Const displayTime% = 40 :REM 40=2*20=2 seconds
  12.  
  13. PROC Macro:
  14.     Local Status$(7), l%, mV&, x&, p%, w%
  15.     Vector MainBatteryStatus&:
  16.         BatteryVeryLow,BatteryLow,BatteryGood
  17.     EndV
  18.     BatteryZero::
  19.         Status$="Empty"
  20.         Goto EndVector
  21.     BatteryVeryLow::
  22.         Status$="Replace"
  23.         Goto EndVector
  24.     BatteryLow::
  25.         Status$="Low"
  26.         Goto EndVector
  27.     BatteryGood::
  28.         REM Remove the REM before the RETURN
  29.         REM if you want the panel only
  30.         REM when the batteries are low.
  31.         REM Return
  32.         Status$="OK"
  33.     EndVector::
  34.     SIBatteryVolts:(mV&, x&, x&, x&)
  35.     p%=Max((mV&-2000)/10,0) :REM mVmin=2000 ; mVmax=3000
  36.     gUpdate Off
  37.     gFont KFontArialNormal15&
  38.     l%=gTWidth(Status$)+94 :REM 94=10+60+4+10+10
  39.     w%=gCreate(637-l%,185,l%,52,KgCreateVisible%,$01) :REM $01=KgCreate4ColourMode% :REM bottom right
  40.     gButton "",KButtS5%,l%,52,KButtS5Raised%
  41.     gAt 10,12 :gBox 60,28 :gFill 60*p%/100,28,0 :gMove 60,10 :gBox 4,8
  42.     gTMode KtModeInvert% :gAt 25,32 :gPrint Num$(p%,3)+"%" :gTMode KtModeSet%
  43.     gAt 84,32 :gPrint Status$
  44.     gUpdate On :gUpdate
  45.     REM gIPrint Num$(p%,3)+"% - "+Num$(mV&,5)+"mV - "+Status$,kBusyTopRight% :REM debug info
  46.     Pause displayTime%
  47.     gClose w%
  48. ENDP
  49.  
  50.  
  51.