-
My goal is:
Allow user to change wifi ssid and password using WebUI when the GPIO0 is pushed -
My actions are:
Add- origin: https://github.com/mongoose-os-libs/wifi-setup-web-ui
in the mos.yml lib section -
The result I see is:
The WebUI works as expected, and then the AP is disabled -
My expectation & question is:
After push the GPIO 0 (zero, or any other), the AP is up again and the user can change the wifi SSID and password
Enable Web UI to setup Wifi
klimbot
#3
I use the following to turn AP on and off.
Took me a while to work out that the device config ap state does not change when you turn AP on/off, so I’m doing it explicitly. Probably means that this is not the right way to do it
static void enable_ap(void)
{
struct mgos_config_wifi_ap ap_cfg;
memcpy(&ap_cfg, mgos_sys_config_get_wifi_ap(), sizeof(ap_cfg));
ap_cfg.enable = true;
int result = mgos_wifi_setup_ap(&ap_cfg);
// Seems to be the easiest way to track AP enabled/disabled but it's not
// updated when the AP is turned on like your would expect
mgos_sys_config_set_wifi_ap_enable(true);
LOG(LL_INFO, ("Enabling AP"));
}
static void disable_ap(void)
{
struct mgos_config_wifi_ap ap_cfg;
memcpy(&ap_cfg, mgos_sys_config_get_wifi_ap(), sizeof(ap_cfg));
ap_cfg.enable = false;
int result = mgos_wifi_setup_ap(&ap_cfg);
// Seems to be the easiest way to track AP enabled/disabled but it's not
// updated when the AP is turned on like your would expect
mgos_sys_config_set_wifi_ap_enable(false);
LOG(LL_INFO, ("Disabling AP"));
}
1 Like
Switching from STA Mode to AP mode