Merge PR #26: add M5Stack Cardputer-Adv support

Integrate mjgodat's keyboard/display Companion, USB Companion, Repeater and
Room Server support for Cardputer-Adv with Cap LoRa-1262.

Fix UI retry dispatch and ACK ownership, packet/storage bounds, numeric
input validation, sparse channel selection, optional-display shutdown,
keyboard layout limits, reserved GPIOs and Windows cross-drive includes.
Retain all 350 contacts and queue capacity using the existing contact cache;
account for the custom UI's runtime allocations in the RAM admission gate.
Carry the MultiMote and DejaVu notices with firmware packages and add CI
coverage for all four board roles plus the shared T-Deck Companion.

Validation: all four Cardputer roles and the T-Deck BLE Companion build;
Cardputer sanitizer, UI, layout, ownership, licensing and storage tests;
65 RAM-policy tests and 14 contact-cache tests. PlatformIO ran serially.

PR: https://github.com/mikecarper/MeshCore/pull/26
This commit is contained in:
mikecarper committed 2026-10-27 22:25:35 -07:00
commit 64a068506b
76 files changed
+27802 -4

No files matched your search

+4
View File
@@ -1195,6 +1195,10 @@ private:
MyMesh& companionMeshInstance();
// Keep the shared UI/CLI lvalue interface; the accessor never allocates.
#define the_mesh companionMeshInstance()
#elif CARDPUTER_ADV_UI
// The Cardputer-Adv UI owns a MyMesh subclass (variants/m5stack_cardputer_adv).
MyMesh& cardputerMeshInstance();
#define the_mesh cardputerMeshInstance()
#else
extern MyMesh the_mesh;
#endif
+45 -3
View File
@@ -268,11 +268,20 @@ static bool isNetworkTerminalActive();
DataStore store(LittleFS, rtc_clock);
#elif defined(ESP32)
#include <SPIFFS.h>
DataStore store(SPIFFS, rtc_clock);
#if CARDPUTER_ADV_UI
#include "CardputerDataStore.h"
CardputerDataStore store(SPIFFS, rtc_clock);
#else
DataStore store(SPIFFS, rtc_clock);
#endif
#endif
/* GLOBAL OBJECTS */
#ifdef DISPLAY_CLASS
#if CARDPUTER_ADV_UI
// Keyboard/display UI for the M5Stack Cardputer-Adv (variant-provided).
#include "CardputerMesh.h"
CardputerUITask ui_task(&board, &interface_manager);
#elif defined(DISPLAY_CLASS)
#include "UITask.h"
UITask ui_task(&board, &interface_manager);
#endif
@@ -293,6 +302,9 @@ static bool initializeCompanionMeshStorage() {
: "ERROR: insufficient PSRAM for Full Companion; startup stopped");
return false;
}
#elif CARDPUTER_ADV_UI
CardputerMesh the_mesh_cp(radio_driver, fast_rng, rtc_clock, tables, store, &ui_task);
MyMesh& cardputerMeshInstance() { return the_mesh_cp; }
#else
MyMesh the_mesh(radio_driver, fast_rng, rtc_clock, tables, store
#ifdef DISPLAY_CLASS
@@ -3831,6 +3843,16 @@ void setup() {
companion_display_begin_status = companion_display_available ? 1 : 0;
#endif
#endif
#endif
#if CARDPUTER_ADV_UI
DisplayDriver* cardputer_disp = NULL;
if (display.begin()) {
cardputer_disp = &display;
display.startFrame();
display.setTextSize(2);
display.drawTextCentered(display.width() / 2, 28, "Loading...");
display.endFrame();
}
#endif
int radioinit_attempts = 0;
@@ -4268,7 +4290,17 @@ void setup() {
the_mesh.applyGpsPrefs();
#endif
#ifdef DISPLAY_CLASS
#if CARDPUTER_ADV_UI
// microSD is optional: chat history and keyboard layouts.
FILESYSTEM* cardputer_sd = NULL;
if (SD.begin(PIN_SD_CS, lora_spi, 25000000)) {
cardputer_sd = &SD;
board.readKeyboardLayout(SD);
}
store.beginCustom(cardputer_sd);
the_mesh_cp.beginCustom();
ui_task.begin(cardputer_disp, &sensors, the_mesh.getNodePrefs(), the_mesh_cp.getCustomNodePrefs());
#elif defined(DISPLAY_CLASS)
#if defined(HELTEC_V4_DISPLAY_UNIFIED) && HELTEC_V4_DISPLAY_UNIFIED
// Retain the wrapper dependency in headless mode so live selection can
// enable a screen. The UI skips rendering while no backend is selected.
@@ -4370,7 +4402,11 @@ void loop() {
#if defined(ENABLE_USB_INTERFACE)
if (!host_kiss_usb_claimed) syncUsbTerminalInputEditing();
#endif
#if CARDPUTER_ADV_UI
the_mesh_cp.loop();
#else
the_mesh.loop();
#endif
#if defined(NRF52_PLATFORM) && defined(EXTRAFS) && !defined(QSPIFLASH)
// The flash-page number is retained across a software reset without trying
// to write primary identity storage while radio/BLE tasks are running.
@@ -4410,6 +4446,9 @@ void loop() {
#if defined(WIO_E5_MINI_HEADLESS_COMPANION_UI) && defined(PIN_USER_BTN)
serviceWioE5HeadlessControls();
#endif
#if CARDPUTER_ADV_UI
ui_task.loop();
#endif
#ifdef DISPLAY_CLASS
// Keep button/touch and critical UI power checks live. UITask itself skips
// only background redraws while the radio needs precise Morse timing.
@@ -4478,6 +4517,9 @@ void loop() {
if (pending) return pending;
if (mesh::isUsbLoggingWatchdogArmed()) return mask(Reason::UsbRecovery);
if (mesh::wireless::control().pending()) return mask(Reason::Wireless);
#if CARDPUTER_ADV_UI
if (ui_task.isAwake()) return mask(Reason::Button);
#endif
return 0;
}();
#if defined(ESP32_PLATFORM) && MESH_USB_LOGGING_AVAILABLE