Update metadata struct to include device battery level

This commit is contained in:
ford-jones 2025-08-18 12:03:14 +12:00
parent 7505fe7a7c
commit 66234c5694
2 changed files with 3 additions and 0 deletions

View File

@ -1477,6 +1477,7 @@ extern meshtastic_DeviceMetadata getDeviceMetadata()
deviceMetadata.hw_model = HW_VENDOR; deviceMetadata.hw_model = HW_VENDOR;
deviceMetadata.hasRemoteHardware = moduleConfig.remote_hardware.enabled; deviceMetadata.hasRemoteHardware = moduleConfig.remote_hardware.enabled;
deviceMetadata.excluded_modules = meshtastic_ExcludedModules_EXCLUDED_NONE; deviceMetadata.excluded_modules = meshtastic_ExcludedModules_EXCLUDED_NONE;
deviceMetadata.remaining_battery = powerStatus->getBatteryChargePercent();
#if MESHTASTIC_EXCLUDE_REMOTEHARDWARE #if MESHTASTIC_EXCLUDE_REMOTEHARDWARE
deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_REMOTEHARDWARE_CONFIG; deviceMetadata.excluded_modules |= meshtastic_ExcludedModules_REMOTEHARDWARE_CONFIG;
#endif #endif

View File

@ -1110,6 +1110,8 @@ typedef struct _meshtastic_DeviceMetadata {
bool hasRemoteHardware; bool hasRemoteHardware;
/* Has PKC capabilities */ /* Has PKC capabilities */
bool hasPKC; bool hasPKC;
/* How much battery the device has left */
uint8_t remaining_battery;
/* Bit field of boolean for excluded modules /* Bit field of boolean for excluded modules
(bitwise OR of ExcludedModules) */ (bitwise OR of ExcludedModules) */
uint32_t excluded_modules; uint32_t excluded_modules;