From 66234c5694b67f9a33d330a702c4a86b58fc718d Mon Sep 17 00:00:00 2001 From: ford-jones Date: Mon, 18 Aug 2025 12:03:14 +1200 Subject: [PATCH] Update metadata struct to include device battery level --- src/main.cpp | 1 + src/mesh/generated/meshtastic/mesh.pb.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 9e46021c9..6e44f5bfe 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1477,6 +1477,7 @@ extern meshtastic_DeviceMetadata getDeviceMetadata() deviceMetadata.hw_model = HW_VENDOR; deviceMetadata.hasRemoteHardware = moduleConfig.remote_hardware.enabled; deviceMetadata.excluded_modules = meshtastic_ExcludedModules_EXCLUDED_NONE; + deviceMetadata.remaining_battery = powerStatus->getBatteryChargePercent(); #if MESHTASTIC_EXCLUDE_REMOTEHARDWARE deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_REMOTEHARDWARE_CONFIG; #endif diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index 1d1ff47e0..249d41b97 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -1110,6 +1110,8 @@ typedef struct _meshtastic_DeviceMetadata { bool hasRemoteHardware; /* Has PKC capabilities */ bool hasPKC; + /* How much battery the device has left */ + uint8_t remaining_battery; /* Bit field of boolean for excluded modules (bitwise OR of ExcludedModules) */ uint32_t excluded_modules;