Open up Datatypes.cs and add the following definitions to the public struct BalanceBoardState:
/// <summary>
/// Stones per sensor
/// </summary>
public BalanceBoardSensorsF SensorValuesSt;
and
/// <summary>
/// Total stones on the Balance Board
/// </summary>
public float WeightSt;
Next open up Wiimote.cs and add the following variable above the default constructor just below the Kg – Lb vars:
// kilograms to stones
private const float KG2ST = 6.35029318f;
Next we are going to add the code that populates these definitions/variables
Still within Wiimote.cs add the following code to the BalanceBoard case of the ParseExtension function just below the Kg – Lb equivalent code:
mWiimoteState.BalanceBoardState.SensorValuesSt.TopLeft = (mWiimoteState.BalanceBoardState.SensorValuesKg.TopLeft / KG2ST);
mWiimoteState.BalanceBoardState.SensorValuesSt.TopRight = (mWiimoteState.BalanceBoardState.SensorValuesKg.TopRight / KG2ST);
mWiimoteState.BalanceBoardState.SensorValuesSt.BottomLeft = (mWiimoteState.BalanceBoardState.SensorValuesKg.BottomLeft / KG2ST);
mWiimoteState.BalanceBoardState.SensorValuesSt.BottomRight = (mWiimoteState.BalanceBoardState.SensorValuesKg.BottomRight / KG2ST);
The above block of code enables calls to be made to obtain values for each of the four sensors in exactly the same way as you would for Kg’s and Lb’s e.g.
TopLeftInStones = ws.BalanceBoardState.SensorValuesSt.TopLeft;
Finally for total weight in stones add the following line below the equivalent Kg / Lb definitions:
mWiimoteState.BalanceBoardState.WeightSt = (mWiimoteState.BalanceBoardState.SensorValuesSt.TopLeft + mWiimoteState.BalanceBoardState.SensorValuesSt.TopRight + mWiimoteState.BalanceBoardState.SensorValuesSt.BottomLeft + mWiimoteState.BalanceBoardState.SensorValuesSt.BottomRight) / 4.0f;
And there you have it your balance board will now cater for the UK Stones measure and calls can be made using equivalent code to that provided for Kg’s and Lb’s.
say what do you think