feat(gateway): add ESP-Touch smartconfig provisioning support and enhance network management

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Tony
2026-04-30 18:49:38 +08:00
parent 4ce3513dd2
commit ae4669e1b3
10 changed files with 338 additions and 43 deletions
+22
View File
@@ -293,6 +293,13 @@ config GATEWAY_ESPNOW_SETUP_SUPPORTED
help
Enables ESP-NOW setup ingress when setup AP mode is entered.
config GATEWAY_SMARTCONFIG_SUPPORTED
bool "ESP-Touch smartconfig provisioning is supported"
depends on GATEWAY_WIFI_SUPPORTED
default y
help
Enables Lua-compatible ESP-Touch smartconfig provisioning for Wi-Fi credentials.
config GATEWAY_START_ESPNOW_SETUP_ENABLED
bool "Enter ESP-NOW setup mode at startup"
depends on GATEWAY_ESPNOW_SETUP_SUPPORTED
@@ -300,6 +307,21 @@ config GATEWAY_START_ESPNOW_SETUP_ENABLED
help
Starts the setup AP and ESP-NOW setup ingress immediately at boot. Disabled by default.
config GATEWAY_START_SMARTCONFIG_ENABLED
bool "Start ESP-Touch smartconfig at startup"
depends on GATEWAY_SMARTCONFIG_SUPPORTED
default n
help
Starts ESP-Touch provisioning at boot. Disabled by default so Wi-Fi stays off unless configured.
config GATEWAY_SMARTCONFIG_TIMEOUT_SEC
int "ESP-Touch smartconfig timeout seconds"
depends on GATEWAY_SMARTCONFIG_SUPPORTED
range 15 255
default 60
help
Timeout passed to ESP-IDF smartconfig before provisioning restarts internally.
choice GATEWAY_USB_STARTUP_MODE
prompt "USB Serial/JTAG startup mode"
default GATEWAY_USB_STARTUP_DEBUG_JTAG
+20
View File
@@ -53,6 +53,10 @@
#define CONFIG_GATEWAY_USB_SETUP_READ_TIMEOUT_MS 20
#endif
#ifndef CONFIG_GATEWAY_SMARTCONFIG_TIMEOUT_SEC
#define CONFIG_GATEWAY_SMARTCONFIG_TIMEOUT_SEC 60
#endif
namespace {
constexpr const char* kProjectName = "DALI_485_Gateway";
constexpr const char* kProjectVersion = "0.1.0";
@@ -94,6 +98,18 @@ constexpr bool kEspnowSetupStartupEnabled = true;
constexpr bool kEspnowSetupStartupEnabled = false;
#endif
#ifdef CONFIG_GATEWAY_SMARTCONFIG_SUPPORTED
constexpr bool kSmartconfigSupported = true;
#else
constexpr bool kSmartconfigSupported = false;
#endif
#ifdef CONFIG_GATEWAY_START_SMARTCONFIG_ENABLED
constexpr bool kSmartconfigStartupEnabled = true;
#else
constexpr bool kSmartconfigStartupEnabled = false;
#endif
#ifdef CONFIG_GATEWAY_USB_STARTUP_SETUP_SERIAL
constexpr bool kUsbSetupStartupEnabled = true;
#else
@@ -351,6 +367,10 @@ extern "C" void app_main(void) {
network_config.espnow_setup_enabled = profile.enable_espnow;
network_config.espnow_setup_startup_enabled =
profile.enable_espnow && kEspnowSetupStartupEnabled;
network_config.smartconfig_enabled = profile.enable_wifi && kSmartconfigSupported;
network_config.smartconfig_startup_enabled =
profile.enable_wifi && kSmartconfigSupported && kSmartconfigStartupEnabled;
network_config.smartconfig_timeout_sec = CONFIG_GATEWAY_SMARTCONFIG_TIMEOUT_SEC;
#ifdef CONFIG_GATEWAY_NETWORK_HTTP_ENABLED
network_config.http_enabled = true;
#else
+3
View File
@@ -628,7 +628,10 @@ CONFIG_GATEWAY_START_BLE_ENABLED=y
CONFIG_GATEWAY_WIFI_SUPPORTED=y
# CONFIG_GATEWAY_START_WIFI_STA_ENABLED is not set
CONFIG_GATEWAY_ESPNOW_SETUP_SUPPORTED=y
CONFIG_GATEWAY_SMARTCONFIG_SUPPORTED=y
# CONFIG_GATEWAY_START_ESPNOW_SETUP_ENABLED is not set
# CONFIG_GATEWAY_START_SMARTCONFIG_ENABLED is not set
CONFIG_GATEWAY_SMARTCONFIG_TIMEOUT_SEC=60
CONFIG_GATEWAY_USB_STARTUP_DEBUG_JTAG=y
# CONFIG_GATEWAY_USB_STARTUP_SETUP_SERIAL is not set
# end of Gateway Startup Services