refine power module

This commit is contained in:
gcw_4spBpAfv
2026-04-28 16:58:51 +08:00
parent fe3e26e21d
commit 4a3b111ce4
7 changed files with 93 additions and 90 deletions

View File

@@ -1984,7 +1984,10 @@ class NetworkManager:
elif inner_cmd == 4: # 上报电量
voltage = get_bus_voltage()
battery_percent = voltage_to_percent(voltage)
battery_data = {"battery": battery_percent, "voltage": round(voltage, 3)}
battery_data = {
"battery": battery_percent,
"voltage": round(float(voltage), 3),
}
self.safe_enqueue(battery_data, 2)
self.logger.info(f"电量上报: {battery_percent}%")
elif inner_cmd == 5: # OTA 升级