Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By Alessandro Collina
#18030 Hi
I'm using the esp8266 like a wifi-uart bridge.
I found this project that I'm using like model.

https://github.com/beckdac/ESP8266-transparent-bridge

Now, I want to change the ip address (default 192.168.4.1) to 192.168.1.1 but I don't know like I can do it.

Can you help me?
Thanks
Sandro
User avatar
By Alex P
#18486 SDK 1.0.0 (and I assume all subsequent versions) have a function for changing softAP IP. I have no idea in what source file it can be found (I found a reference to it in the Arduino-esp8266 ESP8266WiFi.cpp), but here is how it is used:

Code: Select allstruct ip_info info;

info.ip.addr = static_cast<uint32_t>(local_ip);
info.gw.addr = static_cast<uint32_t>(gateway);
info.netmask.addr = static_cast<uint32_t>(subnet);

wifi_softap_dhcps_stop();
wifi_set_ip_info(SOFTAP_IF, &info);
wifi_softap_dhcps_start();


The key here is wifi_set_ip_info(SOFTAP_IF, &info). It seems to work for me without any problems, although I've read somewhere (possibly the SDK) that it only executes if in user_init() :?
User avatar
By Alessandro Collina
#18498 Thank you very much Alex.

I had to make a few tweaks to make it works on my app. I post it so can be useful to someone


#define SOFTAP_IF 0x01
struct ip_info ipinfo;
if(wifi_get_ip_info(SOFTAP_IF, &ipinfo))
{
IP4_ADDR(&ipinfo.ip, 192, 168, 1, 1);
IP4_ADDR(&ipinfo.gw, 192, 168, 1, 1);
IP4_ADDR(&ipinfo.netmask, 255, 255, 255, 0);
if(!wifi_set_ip_info(SOFTAP_IF, &ipinfo))
{
#ifdef CTRL_LOGGING
os_printf("CTRL not set IP config!\r\n");
#endif
} else {
#ifdef CTRL_LOGGING
os_printf("CONFIGURATION WEB SERVER IP: " IPSTR "\r\n", IP2STR(&ipinfo.ip));
#endif
}
}
wifi_softap_dhcps_start();
User avatar
By josephchrzempiec
#78917 Hello i know this is a old post But i have the esp8266mod can someone tell me if it is possible to change that address the 192.168.4.1 to something else and where to find i can change it at?