feat(m1): hardware status firmware with wifi web provisioning

Add the M1 milestone tree under poc/ (m1_hardware + poc_a apps,
shared common components, evidence schema). Merges the plan's
'm1 baseline+fixes' and 'wifi provisioning' batches: the poc/ tree is
entirely untracked and both concerns share files.

M1 hardware baseline:
- landscape ST7305 RIP display via LVGL I1 driver
- TF-card status log: JSONL telemetry with CRC32C per line; append
  buffer widened to line[640] after the 512-byte truncation defect
  (payload ~550B with real values) was root-caused on-device
- PCF85063 RTC read, SHTC3 temperature/humidity with plausibility
  checks, KEY input with short/long/portal press thresholds
- boot-time partition identity check and M1-002 boot record fields
  (device_id, image_sha256, reset_reason, services status)

WiFi web provisioning:
- softAP portal Frame-Setup-xxxx with HTTP endpoints /scan, /connect,
  /clear; httpd handlers never call httpd_stop (deadlock hazard) — a
  1s monitor task executes stop/start/connect actions
- credentials persist to system_fs wifi.json (littlefs) per the
  SEC-010 development exception (plaintext, documented in _doc)
- fallback: 5 disconnects without IP or 60s no-IP -> stop retry,
  portal returns; GOT_IP tears the AP down
- KEY >=3s hold requests the portal; prov start/stop/status console
  commands; ap_active/ap_mode_requested surfaces in status JSON/text

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
This commit is contained in:
2026-08-31 08:01:37 +08:00
co-authored by Sisyphus
parent e71bcce56e
commit 5f7c60c899
37 changed files with 3903 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
#pragma once
#include <cstddef>
#include <cstdint>
#include "driver/gpio.h"
#include "driver/i2c_types.h"
#include "driver/spi_master.h"
namespace frame::m1::board {
inline constexpr char kProduct[] = "Waveshare ESP32-S3-RLCD-4.2";
inline constexpr char kModule[] = "ESP32-S3-WROOM-1-N16R8";
inline constexpr char kFirmwareVersion[] = "0.1.0-dev.1";
inline constexpr char kIdfTag[] = "v6.0.2";
inline constexpr std::size_t kFlashBytes = 16U * 1024U * 1024U;
inline constexpr std::size_t kPsramBytes = 8U * 1024U * 1024U;
inline constexpr int kDisplayWidth = 400;
inline constexpr int kDisplayHeight = 300;
inline constexpr std::size_t kDisplayBufferBytes =
static_cast<std::size_t>(kDisplayWidth) * static_cast<std::size_t>(kDisplayHeight) / 8U;
inline constexpr spi_host_device_t kDisplayHost = SPI3_HOST;
inline constexpr int kDisplayClockHz = 10 * 1000 * 1000;
inline constexpr gpio_num_t kDisplaySck = GPIO_NUM_11;
inline constexpr gpio_num_t kDisplayMosi = GPIO_NUM_12;
inline constexpr gpio_num_t kDisplayDc = GPIO_NUM_5;
inline constexpr gpio_num_t kDisplayCs = GPIO_NUM_40;
inline constexpr gpio_num_t kDisplayReset = GPIO_NUM_41;
inline constexpr gpio_num_t kDisplayTe = GPIO_NUM_6;
inline constexpr i2c_port_num_t kI2cPort = I2C_NUM_0;
inline constexpr gpio_num_t kI2cSda = GPIO_NUM_13;
inline constexpr gpio_num_t kI2cScl = GPIO_NUM_14;
inline constexpr uint16_t kRtcAddress = 0x51;
inline constexpr uint16_t kSensorAddress = 0x70;
inline constexpr gpio_num_t kKey = GPIO_NUM_18;
inline constexpr gpio_num_t kSdClock = GPIO_NUM_38;
inline constexpr gpio_num_t kSdCommand = GPIO_NUM_21;
inline constexpr gpio_num_t kSdData0 = GPIO_NUM_39;
inline constexpr char kSdMount[] = "/frame";
} // namespace frame::m1::board