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

This commit is contained in:
Dionysus 2024-05-08 19:34:42 -04:00
parent 7d4c5739ce
commit f02380a0b4
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
2 changed files with 15 additions and 7 deletions

View File

@ -43,14 +43,14 @@ And place the follow code AFTER the above lines:
```cpp ```cpp
// Display memory usage using the MemGet class // Display memory usage using the MemGet class
uint32_t freeHeap = memGet.getFreeHeap(); uint32_t freeHeap = ESP.getFreeHeap();
uint32_t totalHeap = memGet.getHeapSize(); uint32_t totalHeap = ESP.getHeapSize();
uint32_t usedHeap = totalHeap - freeHeap; uint32_t usedHeap = totalHeap - freeHeap;
display->drawString(x, y + FONT_HEIGHT_SMALL * 4, "Heap: " + String(usedHeap / 1024) + "/" + String(totalHeap / 1024) + " KB"); display->drawString(x, y + FONT_HEIGHT_SMALL * 4, "Heap: " + String(usedHeap / 1024) + "/" + String(totalHeap / 1024) + " KB");
// Display PSRAM usage using the MemGet class // Display PSRAM usage using the MemGet class
uint32_t freePsram = memGet.getFreePsram(); uint32_t freePsram = ESP.getFreePsram();
uint32_t totalPsram = memGet.getPsramSize(); uint32_t totalPsram = ESP.getPsramSize();
uint32_t usedPsram = totalPsram - freePsram; uint32_t usedPsram = totalPsram - freePsram;
display->drawString(x, y + FONT_HEIGHT_SMALL * 5, "PSRAM: " + String(usedPsram / 1024) + "/" + String(totalPsram / 1024) + " KB"); display->drawString(x, y + FONT_HEIGHT_SMALL * 5, "PSRAM: " + String(usedPsram / 1024) + "/" + String(totalPsram / 1024) + " KB");
``` ```

View File

@ -305,9 +305,17 @@ class MeshtasticMQTT(object):
data.ParseFromString(message_packet.decoded.payload) data.ParseFromString(message_packet.decoded.payload)
logging.info('Received telemetry:') logging.info('Received telemetry:')
data_dict = {key: value for key, value in data} data_dict = {}
print(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'): if getattr(data, 'device_metrics'):
text = { text = {
'battery_level' : getattr(data.device_metrics, 'battery_level'), 'battery_level' : getattr(data.device_metrics, 'battery_level'),