46 #include "../../ssid.h" 55 static struct ip_info
info;
82 printf(
"WiFi Event: %02x\n", event_p->event);
85 switch( event_p->event)
87 case EVENT_STAMODE_CONNECTED :
88 printf(
"Connect to [%s] ssid, channel[%d] \n " ,
89 event_p->event_info.connected.ssid ,
90 event_p->event_info.connected.channel);
93 case EVENT_STAMODE_DISCONNECTED :
94 printf(
"Disconnect from ssid:[%s], Reason:%02x\n " ,
95 event_p->event_info.disconnected.ssid ,
96 event_p->event_info.disconnected.reason);
101 case EVENT_STAMODE_AUTHMODE_CHANGE :
102 printf(
"New AuthMode: %02x -> %02x\n " ,
103 event_p->event_info.auth_change.old_mode ,
104 event_p->event_info.auth_change.new_mode);
107 case EVENT_STAMODE_GOT_IP :
108 printf(
"IP:[" IPSTR
"], Mask:[" IPSTR
"], GW:[" IPSTR
"]\n",
109 IP2STR( & event_p->event_info.got_ip.ip) ,
110 IP2STR( & event_p->event_info.got_ip.mask) ,
111 IP2STR( & event_p->event_info.got_ip.gw) );
112 printf(
"MAC:[" MACSTR
"]\n" ,
113 MAC2STR( event_p->event_info.sta_connected.mac) );
116 IP2STR( & event_p->event_info.got_ip.ip));
121 case EVENT_SOFTAPMODE_STACONNECTED :
122 printf(
"STACONNECTED MAC:[" MACSTR
"], AID:%02x\n " ,
123 MAC2STR( event_p->event_info.sta_connected.mac) ,
124 event_p->event_info. sta_connected.aid);
127 case EVENT_SOFTAPMODE_STADISCONNECTED :
128 printf(
"STADISCONNECTED MAC:[%s], AID:%02x\n " ,
129 MAC2STR( event_p->event_info.sta_connected.mac) ,
130 event_p->event_info. sta_connected.aid);
168 printf(
"Networking setup start\n");
172 const char *ssid = SSID;
173 const char *password = SSID_PASS;
178 if(wifi_get_opmode() != STATION_MODE)
180 printf(
"ESP8266 not in STATION mode, restarting in STATION mode...\r\n");
181 if(!wifi_station_disconnect())
182 printf(
"ERROR wifi_station_disconnect()\n");
183 if(!wifi_set_opmode( STATION_MODE))
184 printf(
"ERROR wifi_set_opmode(STATION_MODE)\n");
185 if(!wifi_station_set_reconnect_policy(FALSE))
186 printf(
"ERROR wifi_station_set_reconnect_policy(FALSE)\n");
187 if(!wifi_station_set_auto_connect(FALSE) )
188 printf(
"ERROR wifi_station_set_auto_connect(FALSE)\n");
189 if(wifi_get_phy_mode() != PHY_MODE_11N)
190 wifi_set_phy_mode(PHY_MODE_11N);
193 if(wifi_get_opmode() == STATION_MODE)
195 printf(
"ESP8266 in STATION mode...\r\n");
200 printf(
"ERROR wifi_set_config()\n");
202 printf(
"ERROR wifi_station_get_config()\n");
203 if(!wifi_get_macaddr(STATION_IF,
macaddr))
204 printf(
"ERROR wifi_get_macaddr()\n");
205 printf(
"wifi_get_opmode: %d, SSID:[%s], PASSWORD:[%s]\n",
206 (
int)wifi_get_opmode(),
214 printf(
"ESP8266 not in STATION mode\n");
218 if(!wifi_station_set_reconnect_policy(TRUE))
219 printf(
"ERROR wifi_station_set_reconnect_policy(TRUE)\n");
221 if(!wifi_station_set_auto_connect(TRUE) )
222 printf(
"ERROR wifi_station_set_auto_connect(TRUE)\n");
224 if(!wifi_station_connect())
225 printf(
"ERROR wifi_station_connect()\n");
227 if(!wifi_station_dhcpc_start())
228 printf(
"ERROR wifi_station_dhcpc_start()\n");
232 printf(
"Networking setup done\n");
Master include file for project Includes all project includes and defines here.
MEMSPACE void wifi_event_cb(System_Event_t *event_p)
WIFI Event Callback.
static struct ip_info info
MEMSPACE void setup_networking()
Code fragments if(!wifi_station_dhcpc_stop()) printf( "ERROR wifi_station_dhcpc_stop() \n ");...
#define snprintf(s, size, format, args...)
static struct station_config StationConfig
MEMSPACE WEAK_ATR char * strcpy(char *dest, const char *src)
copy a string
MEMSPACE char * ipv4_2str(uint32_t ip)
uint8_t ip_msg[64]
test task Runs corrected cube demo from Sem Optionally wireframe Earth viewer
MEMSPACE int printf(const char *format,...)
ili9341 driver inspired by Adafruit ili9341 code All code in this file has been rewritten by Mike Gor...
static uint8_t macaddr[6]
static char _ipv4_2str[32]
Convert IP address to string.