@@ -251,14 +251,8 @@ bool WiFiConfig::StartAP()
251
251
// IP
252
252
int32_t IP = Settings_ESP3D::read_IP (ESP_AP_IP_VALUE);
253
253
IPAddress ip (IP);
254
+ IPAddress gw (0 ,0 ,0 ,0 );
254
255
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
- }
262
256
// Start AP
263
257
if (WiFi.softAP (SSID.c_str (), (password.length () > 0 )?password.c_str ():nullptr , channel)) {
264
258
String stmp = " AP SSID: '" + SSID;
@@ -270,6 +264,14 @@ bool WiFiConfig::StartAP()
270
264
output.printMSG (stmp.c_str ());
271
265
log_esp3d (" %s" ,stmp.c_str ());
272
266
// 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
+ }
273
275
#if defined (ARDUINO_ARCH_ESP32)
274
276
WiFi.setSleep (false );
275
277
WiFi.softAPsetHostname (NetConfig::hostname (true ));
0 commit comments