Skip to content

Commit f9f2ec6

Browse files
committed
Fix AP randomly do not set IP
Decrease AP workload by disabling gateway
1 parent db140ff commit f9f2ec6

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

esp3d/src/include/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#define _VERSION_ESP3D_H
2323

2424
//version and sources location
25-
#define FW_VERSION "3.0.0.a107"
25+
#define FW_VERSION "3.0.0.a108"
2626
#define REPOSITORY "https://github.com/luc-github/ESP3D/tree/3.0"
2727

2828
#endif //_VERSION_ESP3D_H

esp3d/src/modules/wifi/wificonfig.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,8 @@ bool WiFiConfig::StartAP()
251251
//IP
252252
int32_t IP = Settings_ESP3D::read_IP(ESP_AP_IP_VALUE);
253253
IPAddress ip(IP);
254+
IPAddress gw(0,0,0,0);
254255
IPAddress mask(DEFAULT_AP_MASK_VALUE);
255-
//Set static IP
256-
log_esp3d("Use: %s / %s / %s", ip.toString().c_str(),ip.toString().c_str(),mask.toString().c_str());
257-
if (!WiFi.softAPConfig(ip, ip, mask)) {
258-
output.printERROR("Set IP to AP failed");
259-
} else {
260-
output.printMSG(ip.toString().c_str());
261-
}
262256
//Start AP
263257
if(WiFi.softAP(SSID.c_str(), (password.length() > 0)?password.c_str():nullptr, channel)) {
264258
String stmp = "AP SSID: '" + SSID;
@@ -270,6 +264,14 @@ bool WiFiConfig::StartAP()
270264
output.printMSG(stmp.c_str());
271265
log_esp3d("%s",stmp.c_str());
272266
//must be done after starting AP not before
267+
Hal::wait(100);
268+
//Set static IP
269+
log_esp3d("Use: %s / %s / %s", ip.toString().c_str(),ip.toString().c_str(),mask.toString().c_str());
270+
if (!WiFi.softAPConfig(ip, gw, mask)) {
271+
output.printERROR("Set IP to AP failed");
272+
} else {
273+
output.printMSG(ip.toString().c_str());
274+
}
273275
#if defined (ARDUINO_ARCH_ESP32)
274276
WiFi.setSleep(false);
275277
WiFi.softAPsetHostname(NetConfig::hostname(true));

0 commit comments

Comments
 (0)