mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-09-26 20:56:37 +00:00
feat(sim): board feature parity (reset/GPS/sensors/admin/keyboard) + input fixes
Rounds out the browser sim harness with the rest of the physical board's interactions: a reset button (JS-driven, since board.reboot() is inert under -sEXIT_RUNTIME=0), GPS input wired into a real LocationProvider via new SimSensorManager, JS-settable battery/environment telemetry, an admin/repeater-login test hook (sendRoomLogin against the default "password"), and full physical-keyboard text entry (printable ASCII passthrough into the existing KeyboardWidget, Tab->KEY_KB_ENTER submit). Also fixes three real bugs found while exercising all of this in a real browser: - UITask.cpp's native-only stdin poll branch had no __EMSCRIPTEN__ exclusion, so it also compiled into the wasm build and called a real, blocking window.prompt() on nearly every frame -- the actual cause of the reported time/controls jumping. Now gated to native only. - 'n'/'p' were mapped as Next/Prev keyboard shortcuts, colliding with typing those literal letters. Removed the shortcuts; added explicit Next/Prev buttons to mesh.html (previously relied solely on them). - Buttons grabbed native browser keyboard focus on click, so a later stray Enter/Space could silently re-trigger a previously-clicked button (e.g. Reset). mousedown now calls preventDefault() on all buttons. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -49,12 +49,15 @@ public:
|
||||
};
|
||||
|
||||
// Single instance, mirroring the pattern of every other Sim* global
|
||||
// (board/radio_driver/rtc_clock/sensors) declared in target.h/target.cpp --
|
||||
// this one isn't wired into target.h/.cpp itself since nothing on the
|
||||
// SIM_PLATFORM boot path currently constructs a LocationProvider at all
|
||||
// (see the class comment above), so it lives here instead as a
|
||||
// self-contained, opt-in addition.
|
||||
extern SensorManager sensors; // defined in variants/sim/target.cpp
|
||||
// (board/radio_driver/rtc_clock/sensors) declared in target.h/target.cpp.
|
||||
// Typed as SimSensorManager, not the SensorManager base, because C++
|
||||
// requires every declaration of the same global variable to agree on its
|
||||
// exact type -- target.cpp's actual `SimSensorManager sensors;` definition
|
||||
// would otherwise conflict with a base-typed extern here. This only
|
||||
// compiles because target.h includes SimSensorManager.h (which declares
|
||||
// the class) before this file -- see target.h's own comment on that
|
||||
// ordering.
|
||||
extern SimSensorManager sensors; // defined in variants/sim/target.cpp
|
||||
inline SimLocationProvider& sim_location_provider() {
|
||||
static SimLocationProvider instance;
|
||||
return instance;
|
||||
|
||||
Reference in New Issue
Block a user