示例#1
0
    private void OnReceiveSkaterBatteryPowerHandler(object recvData)
    {
        char[] batteryPowerData = (char[])recvData;
        uint   voltHandred      = DigitUtility.GetUInt32(batteryPowerData);
        float  volt             = voltHandred * 0.01f;

        //太小则说明外部电源没接入
        int percentageRemainPower = SystemController.GetPercentageBatteryPower(volt);

        if (percentageRemainPower < GlobalDefine.MIN_BATTERY_VOLT)
        {
            Debug.Log("主电源开关没打开");
        }

        SetBatteryLevel(percentageRemainPower);
    }