Disable STA mode after setup

If you are asking a question, please follow this template:

  1. My goal is: [Able to disable WiFi STA mode after setup by user action]
  2. My actions are:
    [
    config_schema:
  • [“wifi.sta.enable”, true]

libs:

When user press a key (condition) :
mgos_sys_config_set_wifi_sta_connect_timeout(0);
mgos_sys_config_set_wifi_sta_enable(false);
]
3. The result I see is:
[
mgos_wifi.c:345 WiFi STA: Connect timeout

Exception 28 @ 0x402960b7, vaddr 0x00000000
A0: 0x40295ebb A1: 0x3ffffe20 A2: 0x00000000 A3: 0x3ffffe40
A4: 0x0000001e A5: 0x0000001f A6: 0x3fff01a4 A7: 0x00000001
A8: 0x00000032 A9: 0x00000170 A10: 0x00000019 A11: 0x00000001
A12: 0x3ffef75c A13: 0x00000000 A14: 0xffffffff A15: 0x3ffeee00
]
4. My expectation & question is:
[
How to properly enable/disable WiFi-STA mode using C code ?
]