The use of the ESP8266 in the world of IoT

User avatar
By aignaciors
#11469 Hello everyone,

I have been using esp-07 and esp-12 in softap+sta mode but even if I set the parameters of AP, the module just don't appear your SSID configured in my network list. I would like to know if somebody had this kind of problem or something similar, :( the code that I'm using is:

Code: Select allstatic char ssid[33];
   static char password[33];
   static uint8_t macaddr[6];
   
   struct softap_config apConfig;
   //wifi_set_opmode(0x3);

   os_memset(apConfig.password, 0, sizeof(apConfig.password));
   os_sprintf(password, "%s", WIFI_APPASSWORD);
   os_memcpy(apConfig.password, password, os_strlen(password));

   os_memset(apConfig.ssid, 0, sizeof(apConfig.ssid));
   os_sprintf(ssid, "%s", WIFI_APSSID);
   os_memcpy(apConfig.ssid, ssid, os_strlen(ssid));

   apConfig.authmode = AUTH_WEP;
   //apConfig.authmode = AUTH_WPA_WPA2_PSK;
   //apConfig.authmode = AUTH_OPEN;
   apConfig.channel = 7;
   apConfig.max_connection = 10;
   apConfig.ssid_hidden = 0;
   wifi_softap_set_config(&apConfig);

   wifi_softap_dhcps_start();
   switch(wifi_softap_dhcps_status())
   {
      case DHCP_STOPPED:
         INFO("\nDHCP Server parou!\n");
      break;
      case DHCP_STARTED:
         INFO("\nDHCP Server foi iniciado!\n");
      break;
   }
User avatar
By RBatty
#11593 Hi,

i have a very similar problem: i want to use the softap mode (also tried softap+sta) and can't set the AP config.
wifi_softap_set_config(&config) always returns false and the configuration is not set.
Maybe it is the same problem with your code. (my code ist nearly identical to your example)

I have no idea how to fix it. Is something missing in the softAP initializing?
User avatar
By aignaciors
#11791 Hi,

I fixed creating a task in user_init and calling this function after, like below:

Code: Select allvoid user_init(){
.
..
...
.....

system_os_task(loop, user_procTaskPrio,user_procTaskQueue, user_procTaskQueueLen);
}


static void ICACHE_FLASH_ATTR loop(os_event_t *events) {
    os_delay_us(1000000);
    INFO(".");
    configureAP();
    system_os_post(user_procTaskPrio, 0, 0 );
}


:D