mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-13 18:36:01 +08:00
Fixed the issue where Ethernet static IP cannot be set. (#1080)
This commit is contained in:
parent
750ef32921
commit
a57850afd6
@ -137,10 +137,10 @@ typedef uint ESP3DSettingIndex;
|
||||
#define ESP_SERIAL_BRIDGE_BAUD 1225 // 4 bytes= int
|
||||
#define ESP_TIME_ZONE 1229 // 7 bytes 6+1 = string
|
||||
#define ESP_ETH_STA_IP_VALUE 1237 // 4 bytes xxx.xxx.xxx.xxx
|
||||
#define ESP_ETH_STA_MASK_VALUE 1240 // 4 bytes xxx.xxx.xxx.xxx
|
||||
#define ESP_ETH_STA_GATEWAY_VALUE 1244 // 4 bytes xxx.xxx.xxx.xxx
|
||||
#define ESP_ETH_STA_DNS_VALUE 1248 // 4 bytes xxx.xxx.xxx.xxx
|
||||
#define ESP_USB_SERIAL_BAUD_RATE 1252 // 4 bytes= int
|
||||
#define ESP_ETH_STA_MASK_VALUE 1241 // 4 bytes xxx.xxx.xxx.xxx
|
||||
#define ESP_ETH_STA_GATEWAY_VALUE 1245 // 4 bytes xxx.xxx.xxx.xxx
|
||||
#define ESP_ETH_STA_DNS_VALUE 1249 // 4 bytes xxx.xxx.xxx.xxx
|
||||
#define ESP_USB_SERIAL_BAUD_RATE 1253 // 4 bytes= int
|
||||
|
||||
// Hidden password
|
||||
#define HIDDEN_PASSWORD "********"
|
||||
|
@ -161,7 +161,14 @@ bool EthConfig::begin(int8_t& espMode) {
|
||||
}
|
||||
if (res) {
|
||||
// Static IP or DHCP client ?
|
||||
if ((ESP3DSettings::readByte(ESP_ETH_STA_IP_MODE) == DHCP_MODE)) {
|
||||
if ((ESP3DSettings::readByte(ESP_ETH_STA_IP_MODE) != DHCP_MODE)) {
|
||||
int32_t IP = ESP3DSettings::read_IP(ESP_ETH_STA_IP_VALUE);
|
||||
int32_t GW = ESP3DSettings::read_IP(ESP_ETH_STA_GATEWAY_VALUE);
|
||||
int32_t MK = ESP3DSettings::read_IP(ESP_ETH_STA_MASK_VALUE);
|
||||
int32_t DNS = ESP3DSettings::read_IP(ESP_ETH_STA_DNS_VALUE);
|
||||
IPAddress ip(IP), mask(MK), gateway(GW), dns(DNS);
|
||||
ETH.config(ip, gateway, mask, dns);
|
||||
} else {
|
||||
uint64_t start = millis();
|
||||
String ip = ETH.localIP().toString();
|
||||
esp3d_log("IP");
|
||||
|
Loading…
x
Reference in New Issue
Block a user