mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-04 17:30:42 +08:00
Fix AP randomly do not set IP
Decrease AP workload by disabling gateway
This commit is contained in:
parent
db140ffa24
commit
f9f2ec6522
@ -22,7 +22,7 @@
|
||||
#define _VERSION_ESP3D_H
|
||||
|
||||
//version and sources location
|
||||
#define FW_VERSION "3.0.0.a107"
|
||||
#define FW_VERSION "3.0.0.a108"
|
||||
#define REPOSITORY "https://github.com/luc-github/ESP3D/tree/3.0"
|
||||
|
||||
#endif //_VERSION_ESP3D_H
|
||||
|
@ -251,14 +251,8 @@ bool WiFiConfig::StartAP()
|
||||
//IP
|
||||
int32_t IP = Settings_ESP3D::read_IP(ESP_AP_IP_VALUE);
|
||||
IPAddress ip(IP);
|
||||
IPAddress gw(0,0,0,0);
|
||||
IPAddress mask(DEFAULT_AP_MASK_VALUE);
|
||||
//Set static IP
|
||||
log_esp3d("Use: %s / %s / %s", ip.toString().c_str(),ip.toString().c_str(),mask.toString().c_str());
|
||||
if (!WiFi.softAPConfig(ip, ip, mask)) {
|
||||
output.printERROR("Set IP to AP failed");
|
||||
} else {
|
||||
output.printMSG(ip.toString().c_str());
|
||||
}
|
||||
//Start AP
|
||||
if(WiFi.softAP(SSID.c_str(), (password.length() > 0)?password.c_str():nullptr, channel)) {
|
||||
String stmp = "AP SSID: '" + SSID;
|
||||
@ -270,6 +264,14 @@ bool WiFiConfig::StartAP()
|
||||
output.printMSG(stmp.c_str());
|
||||
log_esp3d("%s",stmp.c_str());
|
||||
//must be done after starting AP not before
|
||||
Hal::wait(100);
|
||||
//Set static IP
|
||||
log_esp3d("Use: %s / %s / %s", ip.toString().c_str(),ip.toString().c_str(),mask.toString().c_str());
|
||||
if (!WiFi.softAPConfig(ip, gw, mask)) {
|
||||
output.printERROR("Set IP to AP failed");
|
||||
} else {
|
||||
output.printMSG(ip.toString().c_str());
|
||||
}
|
||||
#if defined (ARDUINO_ARCH_ESP32)
|
||||
WiFi.setSleep(false);
|
||||
WiFi.softAPsetHostname(NetConfig::hostname(true));
|
||||
|
Loading…
x
Reference in New Issue
Block a user