File tree 2 files changed +4
-2
lines changed
2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ int CWifi::begin(const char* ssid) {
25
25
/* -------------------------------------------------------------------------- */
26
26
ni = CLwipIf::getInstance ().get (NI_WIFI_STATION);
27
27
CLwipIf::getInstance ().connectToAp (ssid, nullptr );
28
- if (ni != nullptr ) {
28
+ if (ni != nullptr && !_useStaticIp ) {
29
29
ni->DhcpStart ();
30
30
}
31
31
@@ -39,7 +39,7 @@ int CWifi::begin(const char* ssid, const char *passphrase) {
39
39
40
40
ni = CLwipIf::getInstance ().get (NI_WIFI_STATION);
41
41
CLwipIf::getInstance ().connectToAp (ssid, passphrase);
42
- if (ni != nullptr ) {
42
+ if (ni != nullptr && !_useStaticIp ) {
43
43
ni->DhcpStart ();
44
44
}
45
45
@@ -96,6 +96,7 @@ extern uint8_t *IpAddress2uint8(IPAddress a);
96
96
/* -------------------------------------------------------------------------- */
97
97
void CWifi::_config (IPAddress local_ip, IPAddress gateway, IPAddress subnet) {
98
98
/* -------------------------------------------------------------------------- */
99
+ _useStaticIp = local_ip != INADDR_NONE;
99
100
if (ni != nullptr ) {
100
101
ni->DhcpStop ();
101
102
ni->DhcpNotUsed ();
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ class CWifi {
9
9
private:
10
10
void _config (IPAddress local_ip, IPAddress gateway, IPAddress subnet);
11
11
unsigned long _timeout;
12
+ bool _useStaticIp = false ;
12
13
CNetIf *ni;
13
14
14
15
public:
You can’t perform that action at this time.
0 commit comments