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:
@@ -0,0 +1,62 @@
|
||||
#include "board_config.hh"
|
||||
#include "board_service.hh"
|
||||
#include "console_service.hh"
|
||||
#include "display_service.hh"
|
||||
#include "esp_log.h"
|
||||
#include "hardware_status.hh"
|
||||
#include "nvs_flash.h"
|
||||
#include "sd_service.hh"
|
||||
#include "wifi_provision.hh"
|
||||
#include "wifi_service.hh"
|
||||
#include <cinttypes>
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr char kTag[] = "frame-m1";
|
||||
|
||||
} // namespace
|
||||
|
||||
extern "C" void app_main(void) {
|
||||
using namespace frame::m1;
|
||||
|
||||
static hardware_status status;
|
||||
status.initialize_platform();
|
||||
const status_snapshot initial = status.snapshot();
|
||||
ESP_LOGI(kTag, "Frame M1 %s; IDF %s; toolchain %s", board::kFirmwareVersion,
|
||||
initial.idf_version, initial.toolchain_version);
|
||||
ESP_LOGI(kTag, "board=%s module=%s device=%s", board::kProduct, board::kModule,
|
||||
initial.device_id);
|
||||
ESP_LOGI(kTag,
|
||||
"cores=%" PRIu32 " flash=%u psram=%u part=%s reset=%" PRIu32 " image_sha256=%.16s",
|
||||
initial.cpu_cores, static_cast<unsigned>(initial.flash_bytes),
|
||||
static_cast<unsigned>(initial.psram_bytes), initial.partitions_ok ? "OK" : "FAIL",
|
||||
initial.reset_reason, initial.image_sha256);
|
||||
|
||||
const esp_err_t nvs_result = nvs_flash_init();
|
||||
if (nvs_result != ESP_OK) {
|
||||
ESP_LOGW(kTag, "NVS unavailable; Wi-Fi credentials will remain RAM-only: %s",
|
||||
esp_err_to_name(nvs_result));
|
||||
}
|
||||
|
||||
static board_service board(status);
|
||||
static sd_service storage(status);
|
||||
static wifi_service wifi(status);
|
||||
static wifi_provision provision(status, wifi);
|
||||
static display_service display(status);
|
||||
static console_service console(status, storage, wifi, provision);
|
||||
|
||||
const esp_err_t board_result = board.start();
|
||||
const esp_err_t storage_result = storage.start();
|
||||
const esp_err_t provision_mount_result = provision.initialize();
|
||||
const esp_err_t wifi_result = wifi.initialize();
|
||||
const esp_err_t display_result = display.start();
|
||||
const esp_err_t console_result = console.start();
|
||||
const esp_err_t saved_result = provision.start_saved_or_pending();
|
||||
|
||||
ESP_LOGI(kTag, "services board=%s storage=%s wifi=%s display=%s console=%s",
|
||||
esp_err_to_name(board_result), esp_err_to_name(storage_result),
|
||||
esp_err_to_name(wifi_result), esp_err_to_name(display_result),
|
||||
esp_err_to_name(console_result));
|
||||
ESP_LOGI(kTag, "provision mount=%s saved=%s", esp_err_to_name(provision_mount_result),
|
||||
esp_err_to_name(saved_result));
|
||||
}
|
||||
Reference in New Issue
Block a user