Copyright © https://mongoose-os.com

Mongoose OS Forum

frame

mos config won't save

Hi Everyone,

I'm trying to set wifi.sta.ssid and wifi.sta.pass to "" or NULL or BLANK and then save the config.

static void bridge_setup_erase_sta_credentials(void)
{
  /* Local variables */
  struct mgos_config_wifi_sta sta_setup;
  char *msg = NULL;

  /* Erase ssid, pass */
  mgos_wifi_disconnect(); //disconnect STA.
  memcpy(&sta_setup, mgos_sys_config_get_wifi_sta(), sizeof(sta_setup));
  sta_setup.ssid = "";
  sta_setup.pass = "";
  sta_setup.enable = false;
  if(mgos_wifi_setup_sta(&sta_setup))
  {
    LOG(LL_ERROR, ("STA credentials erased"));//debug
    save_cfg(&mgos_sys_config, &msg);//test
  } else
  {
    LOG(LL_ERROR, ("Unable to erase STA credentials"));//debug
  }
}

When I run this, the printout is STA credentials erased. But when I run mos config-get wifi from the command line, it shows up as the OLD sta.ssid and sta.pass. Can someone point out where I'm going wrong?

Many thanks!!
Andrew

Comments

Sign In or Register to comment.