mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-02 02:41:57 +00:00
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:
@@ -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; }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user