[GH-ISSUE #632] using Static IP but with only last octet changed. #529

Closed
opened 2026-02-28 01:25:43 +03:00 by kerem · 0 comments
Owner

Originally created by @mehulvarsh on GitHub (Jun 26, 2018).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/632

Hi Team,

I want to use WiFi Manager with Static IP configuration but only need to change the last octet of local IP. When i am doing it, the modified IP is working only on DHCP networks and not on all networks. the code is as below:

IPAddress _ip2 = WiFi.localIP();
_ip2[3]=240;
IPAddress _gw2 = IPAddress(192, 168, 1, 1);
IPAddress _sn2 = IPAddress(255, 255, 255, 0);
wifiManager.setSTAStaticIPConfig(_ip2, _gw2, _sn2);
Serial.print("local ip2: ");
Serial.println(WiFi.localIP());
Serial.print("modified ip2: ");
Serial.println(_ip2);

I want to change the local ip as the setSTAStaticIPConfig is doing but only changing the last octet. I tried my hands on changing the WifiManager.cpp file but no success. Can you please create a new function which can take "int" as input and can change the last octet of local IP?

Originally created by @mehulvarsh on GitHub (Jun 26, 2018). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/632 Hi Team, I want to use WiFi Manager with Static IP configuration but only need to change the last octet of local IP. When i am doing it, the modified IP is working only on DHCP networks and not on all networks. the code is as below: IPAddress _ip2 = WiFi.localIP(); _ip2[3]=240; IPAddress _gw2 = IPAddress(192, 168, 1, 1); IPAddress _sn2 = IPAddress(255, 255, 255, 0); wifiManager.setSTAStaticIPConfig(_ip2, _gw2, _sn2); Serial.print("local ip2: "); Serial.println(WiFi.localIP()); Serial.print("modified ip2: "); Serial.println(_ip2); I want to change the local ip as the setSTAStaticIPConfig is doing but only changing the last octet. I tried my hands on changing the WifiManager.cpp file but no success. Can you please create a new function which can take "int" as input and can change the last octet of local IP?
kerem 2026-02-28 01:25:43 +03:00
  • closed this issue
  • added the
    wontfix
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#529
No description provided.