feat: ESP-NOW link, beat sync and control messages in the C++ driver
- espnow_link, ctrl_msg and beat_sync: the reliable link, envelopes and beat-synced timing. - ctrl_msg: accept an envelope with the trailing save byte. - patterns_frame() and espnow_link_poll() split out of their tasks, so the WebAssembly simulator can drive one frame and one link pass from a timer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
94e300f6ad
commit
24dd5ffb15
30 files changed
+2159
-158
No files matched your search
@@ -113,6 +113,8 @@ esp_err_t settings_load_net(net_cfg_t *c)
|
||||
memset(c, 0, sizeof(*c));
|
||||
c->ap_enabled = true;
|
||||
c->ddp_enabled = true;
|
||||
c->espnow_enabled = true;
|
||||
c->espnow_channel = 6;
|
||||
nvs_handle_t h;
|
||||
esp_err_t err = nvs_open(NS, NVS_READONLY, &h);
|
||||
if (err == ESP_ERR_NVS_NOT_FOUND) {
|
||||
@@ -139,6 +141,12 @@ esp_err_t settings_load_net(net_cfg_t *c)
|
||||
char ddp[8];
|
||||
get_str(h, "ddp", ddp, sizeof(ddp), "on");
|
||||
c->ddp_enabled = strcmp(ddp, "off") != 0;
|
||||
char espnow[8];
|
||||
get_str(h, "espnow", espnow, sizeof(espnow), "on");
|
||||
c->espnow_enabled = strcmp(espnow, "off") != 0;
|
||||
int64_t ch = 6;
|
||||
nvs_get_i64(h, "espnow_ch", &ch);
|
||||
c->espnow_channel = (uint8_t)(ch >= 1 && ch <= 13 ? ch : 6);
|
||||
nvs_close(h);
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -160,6 +168,8 @@ esp_err_t settings_save_net(const net_cfg_t *c)
|
||||
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_set_str(h, "espnow", c->espnow_enabled ? "on" : "off");
|
||||
if (err == ESP_OK) err = nvs_set_i64(h, "espnow_ch", c->espnow_channel);
|
||||
if (err == ESP_OK) err = nvs_commit(h);
|
||||
nvs_close(h);
|
||||
return err;
|
||||
|
||||
Reference in new issue
Block a user