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.
- ["wifi.sta.enable", true]
- ["wifi.ap.enable", true]
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.