Portable BMU variable update

Justin F gerph at gerph.org
Sun May 2 17:57:52 BST 2021


Hiya,

I've just updated the ROOL documentation to add an new flag to the 
BMUVariable_Flags for 'BatteryFailed'. So I went to add it to the OSLib
file, and found that there's a few bits which can be updated, and a 
mistake.

So here's a diff... and the explanation...

* Comment added for teh reference to the BMUVariables, to make it clear 
  where the canonical source is :-)
* A bunch of new variables for the more recently defined variables.
* Fix type of 'BMUBatteryChanged' which should be 'BMUBatteryCharged' -
  if you've been using it to detect that the battery was changed, it won't
  be effective ('cos nobody ever used it for that). So the change in
  the variable name will cause code to break, which is fine because it'll 
  tell people that it's wrong.
* BMUFlags for BatteryCharging, which has been there a while, and 
  BatteryFailing, which is new.
* BMUCommands for controlling the BMUEvent which are apparently new
  according to the documentation.

These are now all the changes from the documentation, but just those that
were quick and easy to update.

I'm not sure how to create pull requests/merge requests for subversion, so
hopefully this patch is useful...


--------

charles at laputa ~/projects/RO/oslib-svn/ro-oslib-code> svn diff
Index: !OSLib/Source/Core/oslib/Portable.swi
===================================================================
--- !OSLib/Source/Core/oslib/Portable.swi	(revision 467)
+++ !OSLib/Source/Core/oslib/Portable.swi	(working copy)
@@ -37,6 +37,7 @@
 TYPE
    Portable_BMUVariable = .Int;
 CONST
+   // From https://www.riscosopen.org/wiki/documentation/show/Battery%20Management%20Unit%20variables
    Portable_BMUVariableVersion         = Portable_BMUVariable: 0,
    Portable_BMUVariableNominalCharge   = Portable_BMUVariable: 1,
    Portable_BMUVariableMeasuredCharge  = Portable_BMUVariable: 2,
@@ -47,13 +48,23 @@
    Portable_BMUVariableInstCurrent     = Portable_BMUVariable: 8,
    Portable_BMUVariableInstTemperature = Portable_BMUVariable: 9,
    Portable_BMUVariableFlags           = Portable_BMUVariable: 10,
-   Portable_BMUVariableChargeRate      = Portable_BMUVariable: 11;
+   Portable_BMUVariableChargeRate      = Portable_BMUVariable: 11,
 
+   Portable_BMUVariableBatteryTimeRemaining         = Portable_BMUVariable: 21,
+   Portable_BMUVariableBatteryTimeMax               = Portable_BMUVariable: 22,
+   Portable_BMUVariableBatteryPercentage            = Portable_BMUVariable: 23,
+   Portable_BMUVariableBatteryChargeTimeRemaining   = Portable_BMUVariable: 24,
+   Portable_BMUVariableChargeCount                  = Portable_BMUVariable: 25,
+   Portable_BMUVariableSmoothedVoltage              = Portable_BMUVariable: 26,
+   Portable_BMUVariableSmoothedCurrent              = Portable_BMUVariable: 27,
+   Portable_BMUVariableSmoothedNominalCapacity      = Portable_BMUVariable: 28,
+   Portable_BMUVariableSmoothedCompensatedCapacity  = Portable_BMUVariable: 29;
+
 TYPE
    Portable_BMUFlags = .Bits;
 CONST
    Portable_BMUAtThreshold3     = Portable_BMUFlags: %1,
-   Portable_BMUBatteryChanged   = Portable_BMUFlags: %1,
+   Portable_BMUBatteryCharged   = Portable_BMUFlags: %1,
    Portable_BMULidOpen          = Portable_BMUFlags: %10,
    Portable_BMUAtThreshold2     = Portable_BMUFlags: %100,
    Portable_BMUBatteryFlat      = Portable_BMUFlags: %100,
@@ -62,7 +73,9 @@
    Portable_BMUChargingFault    = Portable_BMUFlags: %10000,
    Portable_BMUChargeStateKnown = Portable_BMUFlags: %100000,
    Portable_BMUBatteryPresent   = Portable_BMUFlags: %1000000,
-   Portable_BMUChargerConnected = Portable_BMUFlags: %10000000;
+   Portable_BMUChargerConnected = Portable_BMUFlags: %10000000,
+   Portable_BMUBatteryCharging  = Portable_BMUFlags: %100000000,
+   Portable_BMUBatteryFailing   = Portable_BMUFlags: %1000000000;
 
 TYPE
    Portable_ProcessorSpeed = .Bits;
@@ -76,7 +89,9 @@
    Portable_BMUPowerOff          = Portable_BMUCommand: 1,
    Portable_BMUSetAutostart      = Portable_BMUCommand: 4,
    Portable_BMUDisconnectCharger = Portable_BMUCommand: 5,
-   Portable_BMUConnectCharger    = Portable_BMUCommand: 6;
+   Portable_BMUConnectCharger    = Portable_BMUCommand: 6,
+   Portable_DisableBMUEvent      = Portable_BMUCommand: 7,
+   Portable_EnableBMUEvent       = Portable_BMUCommand: 8;
 
 SWI
    Portable_Speed =

--------

-- 
Charles Justin Ferguson
[ All information, speculation, opinion or data within, or attached to,
  this email is private and confidential. Such content may not be
  disclosed to third parties, or a public forum, without explicit
  permission being granted. ]



More information about the oslib-user mailing list