Files
MeshCore-Solo/variants/sim/target.h
T
JakubandClaude Sonnet 5 9cfb58a60b feat(sim): two-device messaging + repeater relay over a JS ether
Ports examples/simple_repeater to variants/sim/ (new sim_simple_repeater
native env + build_wasm_repeater.sh) and adds a JS "ether"
(variants/sim/web/mesh.html) that bridges two real companion_radio WASM
instances through a real simple_repeater instance in a strict A<->R<->B
topology (no direct A-B link), proving genuine relay routing rather than
a shortcut.

Also fixes multi-instance issues Phase 2's single-instance design never
surfaced: SimDisplayDriver's canvas context/id caching was keyed on a
single global instead of per-instance, and both wasm builds were missing
_malloc/_free/HEAPU8 runtime exports needed for the ether to poke bytes
into an instance's memory.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-03 09:14:15 +02:00

36 lines
1.1 KiB
C

#pragma once
// variants/sim -- native (host) "board" for running the real companion_radio
// app logic (MyMesh/UITask/DataStore) as a plain terminal program, with no
// real radio/display/BLE hardware. Follows the same target.h/target.cpp/
// platformio.ini triplet convention as every other board variant (see
// variants/generic-e22/ for the template this was modelled on).
#include <Mesh.h>
#include "SimRadio.h"
#include "SimMainBoard.h"
#include "SimRTCClock.h"
#include <helpers/SensorManager.h>
// Included here (rather than only where it's used) so its JS-facing
// sim_location_set() EMSCRIPTEN_KEEPALIVE export actually gets compiled
// into every SIM_PLATFORM target that includes target.h (companion_radio
// AND simple_repeater) -- an inline function nobody #includes never gets
// emitted at all, KEEPALIVE or not.
#include "SimLocationProvider.h"
#ifdef DISPLAY_CLASS
#include "SimDisplayDriver.h"
#endif
extern SimMainBoard board;
extern SimRadio radio_driver;
extern SimRTCClock rtc_clock;
extern SensorManager sensors;
#ifdef DISPLAY_CLASS
extern DISPLAY_CLASS display;
#endif
bool radio_init();
mesh::LocalIdentity radio_new_identity();