From 23e0df27c3cb1491f71e3dee3e3c211e384ada3a Mon Sep 17 00:00:00 2001 From: BlueMatthew Date: Mon, 4 Mar 2024 11:06:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=85=85=E7=94=B5=E6=80=BB?= =?UTF-8?q?=E7=BA=BF=E7=94=B5=E5=8E=8B=E7=9A=84=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/PhoneDevice.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 4452ef9b..2f22a189 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -422,7 +422,19 @@ bool CPhoneDevice::QuerySystemProperties(std::map& pro } else if (it->first == (PROP_CHARGING_BUS_VOL)) { - it->second = std::to_string(GpioControl::getChargingBusVoltage()); + double val = -1; + char str[32] = { 0 }; + for (int idx = 0; idx < 3; idx++) + { + val = GpioControl::getChargingBusVoltage(); + if (val < 0) + { + continue; + } + snprintf(str, sizeof(str), "%.1f", (val / 1000.0)); + it->second = str; + break; + } } else if (it->first == (PROP_BATTERY_VOLTAGE)) {