feat(sim): e-ink simulator builds

SIM_EINK=landscape|portrait builds the e-ink firmware for the browser,
drawn by the same EinkGfxDisplay as the panel. index.html and mesh.html
pick a build from the URL. The simulated sensors get a GPS switch, so the
UI's GPS toggle works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-10-02 19:24:36 +02:00
co-authored by Claude Opus 5.5
parent b0e24bb076
commit 2589fe95ce
6 changed files with 157 additions and 5 deletions
+11
View File
@@ -1,4 +1,5 @@
#pragma once
#include <string.h>
#include <helpers/SensorManager.h>
@@ -35,11 +36,21 @@
// type turns out to matter for a demo.
class SimSensorManager : public SensorManager {
static float& envTemperatureRef() { static float t = 21.0f; return t; }
bool _gps = false; // the "gps" setting, as a real board's GPS switch: the UI's toggle needs it
public:
LocationProvider* getLocationProvider() override;
bool querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) override;
int getNumSettings() const override { return 1; }
const char* getSettingName(int i) const override { return i == 0 ? "gps" : NULL; }
const char* getSettingValue(int i) const override { return i == 0 ? (_gps ? "1" : "0") : NULL; }
bool setSettingValue(const char* name, const char* value) override {
if (strcmp(name, "gps") != 0) return false;
_gps = strcmp(value, "0") != 0;
return true;
}
static void setEnvTemperature(float celsius) { envTemperatureRef() = celsius; }
};