Files
wadamesh/web/compat/SD.h
T
JoshandClaude Opus 5.5 517bb7b80d web: T-LoRa Pager simulator (-DWADA_SIM_PAGER=ON)
The host build laid out as the Pager: 480x222, no touch, keyboard and rotary
encoder as the only input, with the UI's own TLORA_PAGER branches compiled in,
so the Pager's screens can be reviewed and scripted without flashing.

- web/sim_pager/: keyboard/encoder bridge, stubs for the codec, I2S, haptics,
  IMU, charger and gauge, README and a tour script. Environment switches fake
  the hardware states: WADA_SIM_CHARGING, WADA_SIM_CHARGE_HOT,
  WADA_SIM_CARE_HOLD, WADA_SIM_SOC (+ _DROP), WADA_SIM_USE_MA,
  WADA_SIM_FACEDOWN, WADA_SIM_PICKUP, WADA_SIM_BAG.
- Script commands for the Pager: holdkey (accent picker; holdkey space to
  lock; holdkey shift / fn for the modifier shortcuts).
- device_caps.h: a WADA_SIM_PAGER caps block. Off by default; the normal web
  and host builds are unchanged.
- Host fixes it needed: INT_MAX include for glibc, SD.begin(ss, SPIClass&) in
  the SD shim, panelSleep() on WebDisplay.
- Host SPIFFS lists a directory the way SPIFFS does: every file, with its
  folder in the name ("/lock/a.jpg"). The host keeps such files in real
  folders, and readdir() handed the folder back as an entry, which the file
  manager showed as a 0 B file (/lock, /msgs). Affects the host builds only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Josh <8422439+MrYoshii@users.noreply.github.com>
2026-10-26 16:35:53 +01:00

34 lines
1.4 KiB
C++

#pragma once
// microSD on the web board: there is no card (CAP_SD 0). SD exists so shared code that
// names it links; begin() fails and every file operation finds nothing.
#include "arduino/FS.h"
typedef enum { CARD_NONE, CARD_MMC, CARD_SD, CARD_SDHC, CARD_UNKNOWN } sdcard_type_t;
class SPIClass;
namespace fs {
class SDFS : public FS {
public:
SDFS();
bool begin(uint8_t ssPin = 0, SPIClass* spi = nullptr, uint32_t frequency = 4000000,
const char* mountpoint = "/sd", uint8_t max_files = 5, bool format_if_empty = false) {
(void)ssPin; (void)spi; (void)frequency; (void)mountpoint; (void)max_files; (void)format_if_empty;
return false;
}
bool begin(uint8_t ssPin, SPIClass& spi, uint32_t frequency = 4000000,
const char* mountpoint = "/sd", uint8_t max_files = 5, bool format_if_empty = false) {
return begin(ssPin, &spi, frequency, mountpoint, max_files, format_if_empty); // arduino-esp32's signature
}
void end() {}
sdcard_type_t cardType() { return CARD_NONE; }
uint64_t cardSize() { return 0; }
size_t numSectors() { return 0; }
size_t sectorSize() { return 512; }
uint64_t totalBytes() { return 0; }
uint64_t usedBytes() { return 0; }
bool readRAW(uint8_t*, uint32_t) { return false; }
bool writeRAW(uint8_t*, uint32_t) { return false; }
protected:
uint8_t _pdrv = 0xFF; // as arduino-esp32's SDFS (the UI reads it for f_mkfs/f_getfree)
};
}
extern fs::SDFS SD;