Fix Full Companion terminal diagnostics

This commit is contained in:
mikecarper committed 2026-08-29 16:57:44 -07:00
1 parent 19c9faab9c
commit fdf528bb27
7 files changed
+176 -9

No files matched your search

+35 -6
View File
@@ -9,7 +9,12 @@
#include "helpers/radiolib/RxBoostedGainDefaults.h"
#include "helpers/radiolib/CadTiming.h"
#if defined(ESP32_PLATFORM) && defined(BOARD_HAS_PSRAM)
#if COMPANION_FEATURE_MEMORY_DIAGNOSTICS
#include <helpers/CompanionTerminalDiagnostics.h>
#endif
#if defined(ESP32_PLATFORM) \
&& (defined(BOARD_HAS_PSRAM) || COMPANION_FEATURE_MEMORY_DIAGNOSTICS)
#include <esp_heap_caps.h>
#endif
@@ -2043,6 +2048,31 @@ bool MyMesh::handleLocalControlCommand(const char* command, char* reply,
if (!command || !reply || reply_size == 0) return false;
while (*command == ' ') command++;
if (strcmp(command, "board") == 0) {
const char* hardware_name = board.getManufacturerName();
snprintf(reply, reply_size, "%s",
hardware_name != NULL ? hardware_name : "Unknown hardware");
return true;
}
#if COMPANION_FEATURE_MEMORY_DIAGNOSTICS
if (strcmp(command, "memory") == 0) {
const mesh::CompanionMemoryDiagnostics diagnostics = {
(uint32_t)ESP.getFreeHeap(),
(uint32_t)ESP.getMinFreeHeap(),
(uint32_t)ESP.getMaxAllocHeap(),
(uint32_t)heap_caps_get_free_size(MALLOC_CAP_INTERNAL),
(uint32_t)heap_caps_get_largest_free_block(MALLOC_CAP_INTERNAL),
(uint32_t)ESP.getFreePsram(),
(uint32_t)ESP.getPsramSize(),
offline_queue_len,
getOfflineQueueCapacity()
};
mesh::formatCompanionMemoryDiagnostics(reply, reply_size, diagnostics);
return true;
}
#endif
if (handleCadCommand(command, reply, reply_size)) return true;
if (strcmp(command, "get radio.rxgain") == 0) {
@@ -5979,6 +6009,10 @@ void MyMesh::handleTerminalCommand(char* command) {
FIRMWARE_VERSION, (unsigned)FIRMWARE_VER_CODE, FIRMWARE_BUILD_DATE);
} else if (strcmp(command, "help") == 0) {
terminalOutput().print("Commands:\r\n");
terminalOutput().print(" board\r\n");
#if COMPANION_FEATURE_MEMORY_DIAGNOSTICS
terminalOutput().print(" memory\r\n");
#endif
terminalOutput().print(" get display.rotation\r\n");
terminalOutput().print(" set display.rotation <0|90|180|270>\r\n");
terminalOutput().print(" set {name|lat|lon|freq|tx|af} {value}\r\n");
@@ -6220,11 +6254,6 @@ bool MyMesh::handleCommand(const char* command, uint32_t sender_timestamp,
return true;
}
if (strcmp(command, "board") == 0) {
snprintf(reply, reply_capacity, "%s", board.getManufacturerName());
return true;
}
if (strcmp(command, "ver") == 0) {
snprintf(reply, reply_capacity, "%s (Build: %s)", FIRMWARE_VERSION,
FIRMWARE_BUILD_DATE);