I honestly don’t understand neither point from 1 to 4.
If you want to set default AP mode or STA mode then in your mos.yml set that one to enable and the other to disable. If you want AP+STA, then keep both enabled.
If you want to know if the system is in one or other mode, there are a number of functions you can call, search the forum, it has been answered before. You can also call the usual config functions and get the wifi mode you are interested in:
result = mgos_sys_config_get_wifi_sta_enable();
result = mgos_sys_config_get_wifi_ap_enable();
If you want to set a mode, that will use the complementary functions:
If you want to control the mode at runtime, that is a bit more involved but it also has been answered before in the forum. Search and look at the wifi configuration solutions around, there are libraries you can use; sorry I can’t paste a link right now.
When holding a button during RESET, the library would enable the AP mode.
I already tried, using “mgos_sys_config_get_wifi_ap_enable()” could not detect the AP mode being enabled.
In the “mgos_wifi.c” line 458
bool mgos_wifi_setup(struct mgos_config_wifi cfg)
{
if (trigger_ap || (cfg->ap.enable && sta_cfg == NULL)) {
struct mgos_config_wifi_ap ap_cfg;
memcpy(&ap_cfg, &cfg->ap, sizeof(ap_cfg));
ap_cfg.enable = true;
LOG(LL_INFO, (“WiFi mode: %s”, “AP”));
/ Disable STA if it was enabled. /
mgos_wifi_setup_sta(&dummy_sta_cfg);
result = mgos_wifi_setup_ap(&ap_cfg); #ifdef MGOS_WIFI_ENABLE_AP_STA / ifdef-ok */
}
}
I would like to determine the WiFi mode being setup in real time.
My issue at the moment is, the library already has the AP mode setup when/how to enable.
However, application level not knowing this is being enabled in AP mode.