Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit31f8045

Browse files
authored
Merge pull request#823 from JAndrassy/ethernet_return_to_dhcp
Ethernet - allow return to DHCP after begin with static IP
2 parentsfb8dc9d +6701a63 commit31f8045

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

‎libraries/Ethernet/src/Ethernet.cpp‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ int arduino::EthernetClass::begin(uint8_t *mac, unsigned long timeout, unsigned
88
_initializerCallback();
99
if (eth_if ==nullptr)return0;
1010
}
11+
eth_if->set_dhcp(true);
12+
_begin(mac, timeout, responseTimeout);
13+
}
1114

15+
intarduino::EthernetClass::_begin(uint8_t *mac,unsignedlong timeout,unsignedlong responseTimeout) {
1216
if (mac !=nullptr) {
1317
eth_if->get_emac().set_hwaddr(mac);
1418
}
@@ -53,7 +57,7 @@ int arduino::EthernetClass::begin(uint8_t *mac, IPAddress ip, IPAddress dns, IPA
5357
eth_if->set_network(_ip, _netmask, _gateway);
5458
eth_if->add_dns_server(_dnsServer1,nullptr);
5559

56-
auto ret =begin(mac, timeout, responseTimeout);
60+
auto ret =_begin(mac, timeout, responseTimeout);
5761
return ret;
5862
}
5963

‎libraries/Ethernet/src/Ethernet.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ class EthernetClass : public MbedSocketClass {
116116
constexprstaticintmaintain () {return DHCP_CHECK_NONE; }
117117

118118
private:
119+
int_begin(uint8_t *mac,unsignedlong timeout,unsignedlong responseTimeout);
120+
119121
volatile EthernetLinkStatus _currentNetworkStatus = Unknown;
120122
EthernetInterface net;
121123
EthernetInterface *eth_if = &net;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp