优化代码

serial
Matthew 1 year ago
parent 25a66b6821
commit 9ca1047c5a

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

Loading…
Cancel
Save