- 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>
56 lines
2.1 KiB
C
56 lines
2.1 KiB
C
/*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "esp_err.h"
|
|
|
|
struct wifi_creds_t {
|
|
char ssid[33];
|
|
char pass[65];
|
|
};
|
|
|
|
struct net_cfg_t {
|
|
char hostname[64]; // mDNS name, without ".local"
|
|
bool use_static; // false: DHCP on the client interface
|
|
char ip[16]; // static client address, dotted quad
|
|
char netmask[16];
|
|
char gateway[16];
|
|
char dns[16]; // optional; empty uses the gateway
|
|
bool ap_enabled; // the access point (led-XXXXXX) is on; default on
|
|
char ap_ssid[33]; // access point name; empty uses led-XXXXXX from the MAC
|
|
char ap_pass[65]; // access point password, 8-63 characters (WPA2); empty is an open network
|
|
bool ddp_enabled; // DDP pixels and frame sync are received; default on
|
|
bool espnow_enabled; // ESP-NOW link to led-controller (0x4C wire protocol); default on
|
|
uint8_t espnow_channel; // Wi-Fi channel shared with the controller and its bridge; default 6
|
|
};
|
|
|
|
/** @brief Read saved Wi-Fi client credentials. ESP_ERR_NVS_NOT_FOUND if none are saved. */
|
|
esp_err_t settings_load_wifi(wifi_creds_t *c);
|
|
|
|
/** @brief Save Wi-Fi client credentials to NVS. */
|
|
esp_err_t settings_save_wifi(const wifi_creds_t *c);
|
|
|
|
struct hw_cfg_t {
|
|
char order[4]; // colour order of the strip: rgb, rbg, grb, gbr, brg or bgr
|
|
uint8_t max_brightness; // ceiling for every output colour, 0-255
|
|
int num_leds; // 1-512
|
|
int pin; // GPIO for the data line
|
|
uint8_t global_brightness; // this device's own brightness, 0-255 (under max_brightness)
|
|
uint8_t master_brightness; // master scale for this device, 0-255, set from "All devices"
|
|
};
|
|
|
|
/** @brief Read the LED strip settings. Missing keys get their defaults (grb, 255, 119). */
|
|
esp_err_t settings_load_hw(hw_cfg_t *c);
|
|
|
|
/** @brief Save the LED strip settings. */
|
|
esp_err_t settings_save_hw(const hw_cfg_t *c);
|
|
|
|
/** @brief Read network settings. Missing keys get their defaults (hostname "led", DHCP). */
|
|
esp_err_t settings_load_net(net_cfg_t *c);
|
|
|
|
/** @brief Save network settings to NVS. */
|
|
esp_err_t settings_save_net(const net_cfg_t *c);
|