meshtastic

- Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.acid.vegas/-c.git
Log | Files | Refs | Archive | README | LICENSE

commit f02380a0b41e3ab01d521fb3f4f902c0533a96ad
parent 7d4c5739ced426e258396e1b4c6ddadb80648801
Author: acidvegas <acid.vegas@acid.vegas>
Date: Wed, 8 May 2024 19:34:42 -0400

Fixed ram/psram display. memGet.h wasnt needed as we can call this directly from ESP

Diffstat:
Mdocs/FIRMWARE.md | 8++++----
Mmeshmqtt.py | 14+++++++++++---

2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/docs/FIRMWARE.md b/docs/FIRMWARE.md
@@ -43,14 +43,14 @@ And place the follow code AFTER the above lines:
 
 ```cpp
 // Display memory usage using the MemGet class
-uint32_t freeHeap = memGet.getFreeHeap();
-uint32_t totalHeap = memGet.getHeapSize();
+uint32_t freeHeap = ESP.getFreeHeap();
+uint32_t totalHeap = ESP.getHeapSize();
 uint32_t usedHeap = totalHeap - freeHeap;
 display->drawString(x, y + FONT_HEIGHT_SMALL * 4, "Heap: " + String(usedHeap / 1024) + "/" + String(totalHeap / 1024) + " KB");
 
 // Display PSRAM usage using the MemGet class
-uint32_t freePsram = memGet.getFreePsram();
-uint32_t totalPsram = memGet.getPsramSize();
+uint32_t freePsram = ESP.getFreePsram();
+uint32_t totalPsram = ESP.getPsramSize();
 uint32_t usedPsram = totalPsram - freePsram;
 display->drawString(x, y + FONT_HEIGHT_SMALL * 5, "PSRAM: " + String(usedPsram / 1024) + "/" + String(totalPsram / 1024) + " KB");
 ```
diff --git a/meshmqtt.py b/meshmqtt.py
@@ -305,9 +305,17 @@ class MeshtasticMQTT(object):
 				data.ParseFromString(message_packet.decoded.payload)
 				logging.info('Received telemetry:')
 
-				data_dict = {key: value for key, value in data}
-				print(data_dict)
-
+				data_dict = {}
+				for field, value in data.ListFields():
+					if field.name == 'device_metrics':
+						text = clean_dict({item.name: getattr(value, item.name) for item in value.DESCRIPTOR.fields if hasattr(value, item.name)})
+						if text:
+							logging.info(text)
+					else:
+						data_dict[field.name] = value
+						
+				logging.info(data_dict)
+				
 				if getattr(data, 'device_metrics'):
 					text = {
 						'battery_level'       : getattr(data.device_metrics, 'battery_level'),