Esempio n. 1
0
        private void TryLoadingOnewheelType(byte[] hardwareRevisionArray)
        {
            if (hardwareRevisionArray is null || hardwareRevisionArray.Length < 2)
            {
                return;
            }

            ushort hardwareRevision = BitConverter.ToUInt16(hardwareRevisionArray, 0);

            // Based on: https://github.com/OnewheelCommunityEdition/OWCE_App/blob/4fc1923323543db849deccbf2998646cdf1bae31/OWCE/OWCE/OWBoard.cs#L458-L473
            if (hardwareRevision >= 1 && hardwareRevision <= 2999)
            {
                owType = OnewheelType.ONEWHEEL;
                Logger.Info("Received hardware revision of an original Onewheel.");
            }
            else if (hardwareRevision >= 3000 && hardwareRevision <= 3999)
            {
                owType = OnewheelType.ONEWHEEL_PLUS;
                Logger.Info("Received hardware revision of an Onewheel+.");
            }
            else if (hardwareRevision >= 4000 && hardwareRevision <= 4999)
            {
                owType = OnewheelType.ONEWHEEL_PLUS_XR;
                Logger.Info("Received hardware revision of an Onewheel+ XR.");
            }
            else if (hardwareRevision >= 5000 && hardwareRevision <= 5999)
            {
                owType = OnewheelType.ONEWHEEL_PINT;
                Logger.Info("Received hardware revision of a Pint.");
            }
        }
Esempio n. 2
0
        public static double ToAmpere(uint value, OnewheelType type)
        {
            double multiplier = 0;

            switch (type)
            {
            case OnewheelType.ONEWHEEL:
                multiplier = 0.9;
                break;

            case OnewheelType.ONEWHEEL_PLUS:
                multiplier = 1.8;
                break;

            case OnewheelType.ONEWHEEL_PLUS_XR:
                multiplier = 1.8;     // Not validated
                break;
            }

            double amp = value / 1000.0 * multiplier;

            return(Math.Round(amp, 2));
        }