//Main code function
static void ICACHE_FLASH_ATTR
loop(os_event_t *events)
{
//os_printf("Hello\n\r");
//Keep track of whether we're connected
static bool connected = false;
//Debug message to print out whether we're connected or not
os_printf("The connected state is %s\n", connected ? "true" : "false");
//If we're not connected, connect, otherwise to nothing
if(!connected)
{
os_printf("Now going to connect to AP\n");
wifi_station_connect();
connected = true;
}
os_delay_us(10000); system_os_post(user_procTaskPrio, 0, 0 );
}
The output then becomes
add if0
The connected state is false
Now going to connect to AP
scandone
The connected state is true
The connected state is true
...
The connected state is true
scandone
no shhh... found, reconnect after 1s
The connected state is true
etc. It still seems to be printing out the wrong event call back messages.