feat: Add HELP, CONFIG, FACTORY commands; sync project docs

Firmware: HELP lists all 27 commands with syntax, CONFIG dumps
running config as key=value, FACTORY erases NVS and reboots.

Docs: update PROJECT, ROADMAP, TASKS, TODO to reflect v1.10
completion, v1.11 unreleased work, and esp32-web v0.1.5 state.
Remove stale v2.0 Flask phase-by-phase plan (now tracked in
~/git/esp32-web/). Clean deferred items from completed milestones.
This commit is contained in:
user
2026-02-14 14:26:01 +01:00
parent aea0a06a5f
commit 468a97713c
5 changed files with 212 additions and 153 deletions
+103
View File
@@ -2157,6 +2157,109 @@ static int cmd_handle(const char *cmd, char *reply, size_t reply_size)
return strlen(reply);
}
/* HELP */
if (strcmp(cmd, "HELP") == 0) {
int pos = 0;
pos += snprintf(reply + pos, reply_size - pos,
"OK HELP\n"
"STATUS — sensor status\n"
"CONFIG — dump all NVS settings\n"
"RATE <10-100> — set CSI ping rate (Hz)\n"
"POWER <2-20> — set TX power (dBm)\n"
"TARGET <ip> [port] — set data destination\n"
"HOSTNAME [name] — get/set hostname\n"
"CSI [ON|OFF] — toggle CSI collection\n"
"CSIMODE [RAW|COMPACT|HYBRID N] — CSI output mode\n"
"ADAPTIVE [ON|OFF] — adaptive sampling\n"
"THRESHOLD <0-1> — motion threshold\n"
"BLE [ON|OFF] — BLE scanning\n"
"SCANRATE <5-300> — BLE scan interval (s)\n"
"PROBERATE <1-300> — probe dedup cooldown (s)\n"
"CALIBRATE [STATUS|CLEAR|N] — baseline calibration\n"
"PRESENCE [ON|OFF|THRESHOLD] — presence detection\n"
"CHANSCAN [ON|OFF|NOW|INTERVAL] — channel scanning\n"
"LED [QUIET|AUTO] — LED mode\n"
"POWERSAVE [ON|OFF] — WiFi modem sleep\n"
"AUTH [secret|OFF] — HMAC authentication\n"
"FLOODTHRESH <n> [win] — deauth flood threshold\n"
"OTA <url> — firmware update\n"
"POWERTEST [dwell] — power profiling\n"
"PROFILE — heap/stack/CPU stats\n"
"IDENTIFY — LED solid 5s\n"
"REBOOT — restart sensor\n"
"FACTORY — erase config, reboot\n"
"HELP — this message");
return pos;
}
/* FACTORY — erase all NVS config and reboot */
if (strcmp(cmd, "FACTORY") == 0) {
snprintf(reply, reply_size, "OK FACTORY erasing config and rebooting");
/* Send reply before erasing */
nvs_handle_t fh;
if (nvs_open("csi_config", NVS_READWRITE, &fh) == ESP_OK) {
nvs_erase_all(fh);
nvs_commit(fh);
nvs_close(fh);
}
xTaskCreate(reboot_after_delay, "reboot", 1024, NULL, 1, NULL);
return strlen(reply);
}
/* CONFIG — dump all NVS settings */
if (strcmp(cmd, "CONFIG") == 0) {
const char *csi_mode_str = (s_csi_mode == CSI_MODE_COMPACT) ? "compact" :
(s_csi_mode == CSI_MODE_HYBRID) ? "hybrid" : "raw";
int pos = 0;
pos += snprintf(reply + pos, reply_size - pos,
"OK CONFIG\n"
"hostname=%s\n"
"send_rate=%d\n"
"tx_power=%d\n"
"target=%s:%d\n"
"csi=%s\n"
"csi_mode=%s\n"
"hybrid_n=%d\n"
"adaptive=%s\n"
"threshold=%.6f\n"
"ble=%s\n"
"scan_rate=%ds\n"
"probe_rate=%ds\n"
"presence=%s\n"
"pr_thresh=%.4f\n"
"baseline_nsub=%d\n"
"chanscan=%s\n"
"chanscan_int=%ds\n"
"led=%s\n"
"powersave=%s\n"
"auth=%s\n"
"flood_thresh=%d/%ds\n"
"boots=%lu",
s_hostname,
s_send_frequency,
(int)s_tx_power_dbm,
s_target_ip, s_target_port,
s_csi_enabled ? "on" : "off",
csi_mode_str,
s_hybrid_interval,
s_adaptive ? "on" : "off",
s_motion_threshold,
s_ble_enabled ? "on" : "off",
(int)(s_ble_scan_interval_us / 1000000LL),
(int)(s_probe_dedup_us / 1000000LL),
s_presence_enabled ? "on" : "off",
s_pr_threshold,
s_baseline_nsub,
s_chanscan_enabled ? "on" : "off",
s_chanscan_interval_s,
s_led_quiet ? "quiet" : "auto",
s_powersave ? "on" : "off",
s_auth_secret[0] ? "on" : "off",
s_flood_thresh, s_flood_window_s,
(unsigned long)s_boot_count);
return pos;
}
snprintf(reply, reply_size, "ERR UNKNOWN");
return strlen(reply);
}