feat: access point name and password setting, ap_on in status
- ap_ssid and ap_password on /api/network: empty name uses led-XXXXXX, a password of 8-63 characters makes the access point WPA2, empty is open; the password is never sent back (ap_password_set) - a running access point restarts when its name or password changes - /api/status reports ap_on; the web page gets the fields Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
af82cb4c4a
commit
59eb37cad5
7 files changed
+97
-6
No files matched your search
@@ -134,6 +134,8 @@ esp_err_t settings_load_net(net_cfg_t *c)
|
||||
char ap[8];
|
||||
get_str(h, "ap", ap, sizeof(ap), "on");
|
||||
c->ap_enabled = strcmp(ap, "off") != 0;
|
||||
get_str(h, "ap_ssid", c->ap_ssid, sizeof(c->ap_ssid), "");
|
||||
get_str(h, "ap_pass", c->ap_pass, sizeof(c->ap_pass), "");
|
||||
char ddp[8];
|
||||
get_str(h, "ddp", ddp, sizeof(ddp), "on");
|
||||
c->ddp_enabled = strcmp(ddp, "off") != 0;
|
||||
@@ -155,6 +157,8 @@ esp_err_t settings_save_net(const net_cfg_t *c)
|
||||
if (err == ESP_OK) err = nvs_set_str(h, "gateway", c->gateway);
|
||||
if (err == ESP_OK) err = nvs_set_str(h, "dns", c->dns);
|
||||
if (err == ESP_OK) err = nvs_set_str(h, "ap", c->ap_enabled ? "on" : "off");
|
||||
if (err == ESP_OK) err = nvs_set_str(h, "ap_ssid", c->ap_ssid);
|
||||
if (err == ESP_OK) err = nvs_set_str(h, "ap_pass", c->ap_pass);
|
||||
if (err == ESP_OK) err = nvs_set_str(h, "ddp", c->ddp_enabled ? "on" : "off");
|
||||
if (err == ESP_OK) err = nvs_commit(h);
|
||||
nvs_close(h);
|
||||
|
||||
Reference in new issue
Block a user