The use of the ESP8266 in the world of IoT

User avatar
By aignaciors
#8495 Hello everyone,

I'm developing a IoT device, that uses the MQTT( from tuan ) + httpd codes, i mix the two codes in one to configure the device and after connect to a broker, but in user_init() function, when change the SSID of the deivce in SOFTAP mode, the DHCP just stop to work and i cannot to connect from other device in the ESP8266 unless i use the system_restore, anyone had this kind of problem?

Code: Select allvoid user_init(void)
{
   stdoutInit();
   ioInit();

   //system_restore();   

   /****** Print Some inf. about ESP ******/

   os_printf("\n\n");
   os_printf("\nPrinting AP Settings:\n");
   struct softap_config cfgESP;
   while(!wifi_softap_get_config(&cfgESP));
   os_printf("\nSSID:%s",cfgESP.ssid);
   os_printf("\nPASSWORD:%s",cfgESP.password);
   os_printf("\nCHANNEL:%d",cfgESP.channel);
   os_printf("\nAuthentification:%d",cfgESP.authmode);
   os_printf("\nSSID Hidden:%d",cfgESP.ssid_hidden);
   os_printf("\nMax Connections:%d",cfgESP.max_connection);
   os_printf("\n\n");

   /****** Change SSID ******/
   memset(cfgESP.ssid, 0, 32);
   strcpy(cfgESP.ssid, WIFI_APSSID);
   wifi_softap_set_config(&cfgESP);

   /****** Init WS ******/
   httpdInit(builtInUrls, 80);
   os_printf("\nWebServer=Ready\n");

   /****** MQTT polling to connect ******/
   os_timer_disarm(&mqtt_timer);
   os_timer_setfn(&mqtt_timer, (os_timer_func_t *)CheckForMQTT_cb, (void *)0);
   os_timer_arm(&mqtt_timer, 500, 1);
   os_printf("\nMQTT timer=Started\n");
}
You do not have the required permissions to view the files attached to this post.