mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-09-14 15:16:40 +00:00
feat(sim): add variants/sim/ — real companion_radio firmware on native + Emscripten
New board variant compiling the unmodified MyMesh/UITask/DataStore app logic against real mesh::Radio/MainBoard/RTCClock/RNG interfaces, for running the actual firmware outside embedded hardware: - Native (plain g++, platform = native): ASCII-art display over stdout, stdin-driven input, local-disk-backed DataStore/IdentityStore. - Emscripten/WASM (variants/sim/build_wasm.sh, since PlatformIO's native platform force-overrides any CC/CXX toolchain override back to system clang++): canvas-backed display, IDBFS-backed persistence across page reloads, JS-callable input via sim_enqueue_key(), emscripten_set_main_loop. Real rweather/Crypto (AES128/SHA256/Ed25519) vendored unmodified and proven working on both targets. variants/sim/web/index.html is a bare verification harness, not the polished website embed.
This commit is contained in:
@@ -33,6 +33,13 @@ static uint32_t _atoi(const char* sp) {
|
||||
#elif defined(ESP32)
|
||||
#include <SPIFFS.h>
|
||||
DataStore store(SPIFFS, rtc_clock);
|
||||
#elif defined(SIM_PLATFORM)
|
||||
#include <SimFS.h>
|
||||
// Real files under ./sim_data/ (relative to the process's cwd) so
|
||||
// NodePrefs/contacts/identity genuinely round-trip across process
|
||||
// restarts -- see SimFS.h.
|
||||
SimFS sim_fs("./sim_data");
|
||||
DataStore store(sim_fs, rtc_clock);
|
||||
#endif
|
||||
|
||||
#ifdef ESP32
|
||||
@@ -88,6 +95,11 @@ static uint32_t _atoi(const char* sp) {
|
||||
#elif defined(STM32_PLATFORM)
|
||||
#include <helpers/ArduinoSerialInterface.h>
|
||||
ArduinoSerialInterface serial_interface;
|
||||
#elif defined(SIM_PLATFORM)
|
||||
// No real BLE/USB companion-app transport in Phase 1 -- always reports
|
||||
// "not connected". See variants/sim/SimSerialInterface.h.
|
||||
#include <SimSerialInterface.h>
|
||||
SimSerialInterface serial_interface;
|
||||
#else
|
||||
#error "need to define a serial interface"
|
||||
#endif
|
||||
@@ -239,6 +251,18 @@ void setup() {
|
||||
serial_interface.begin(Serial);
|
||||
#endif
|
||||
the_mesh.startInterface(serial_interface);
|
||||
#elif defined(SIM_PLATFORM)
|
||||
// sim_fs already exists/mkdir'd itself in its constructor above.
|
||||
store.begin();
|
||||
the_mesh.begin(
|
||||
#ifdef DISPLAY_CLASS
|
||||
disp != NULL
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
);
|
||||
serial_interface.begin();
|
||||
the_mesh.startInterface(serial_interface);
|
||||
#else
|
||||
#error "need to define filesystem"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user