电池电压忽略负值

serial
Matthew 1 year ago
parent 350d08862c
commit 25a66b6821

@ -438,8 +438,16 @@ bool CPhoneDevice::QuerySystemProperties(std::map<std::string, std::string>& pro
else if (it->first == (PROP_BATTERY_VOLTAGE))
{
// double val = GpioControl::getBatteryVoltage() * 3.0 / 1000.0; // // BatVol
double val = GpioControl::getBatteryVoltage() / 1000.0; // // BatVol
double val = -1; // // BatVol
char str[32] = { 0 };
for (int idx = 0; idx < 3; idx++)
{
val = GpioControl::getBatteryVoltage() / 1000.0; // // BatVol
if (val >= 0)
{
break;
}
}
snprintf(str, sizeof(str), "%.1f", val);
it->second = str;
}

Loading…
Cancel
Save