Skip to content

Commit 16cb8b8

Browse files
committed
remove lwip-v1.4 specific code
1 parent d979b57 commit 16cb8b8

27 files changed

+29
-639
lines changed

.travis.yml

-11
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,6 @@ jobs:
6969
env:
7070
- BUILD_PARITY=odd
7171

72-
- name: "Build lwIP-v1.4 (1)"
73-
stage: build
74-
script: $TRAVIS_BUILD_DIR/tests/build1.sh
75-
env:
76-
- BUILD_PARITY=even
77-
- name: "Build lwIP-v1.4 (2)"
78-
stage: build
79-
script: $TRAVIS_BUILD_DIR/tests/build1.sh
80-
env:
81-
- BUILD_PARITY=odd
82-
8372
- name: "Mac OSX can build sketches"
8473
os: osx
8574
stage: build

boards.txt

-238
Large diffs are not rendered by default.

cores/esp8266/AddrList.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ struct netifWrapper
128128
const char* ifmac () const { return (const char*)_netif->hwaddr; }
129129
int ifnumber () const { return _netif->num; }
130130
bool ifUp () const { return !!(_netif->flags & NETIF_FLAG_UP); }
131-
CONST netif* interface () const { return _netif; }
131+
const netif* interface () const { return _netif; }
132132

133133
const ip_addr_t* ipFromNetifNum () const
134134
{

cores/esp8266/Client.h

-2
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,9 @@ class Client: public Stream {
4242
uint8_t* rawIPAddress(IPAddress& addr) {
4343
return addr.raw_address();
4444
}
45-
#if LWIP_VERSION_MAJOR != 1
4645
const uint8_t* rawIPAddress(const IPAddress& addr) {
4746
return addr.raw_address();
4847
}
49-
#endif
5048
};
5149

5250
#endif

cores/esp8266/Esp-version.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,18 @@
2121
#include <Arduino.h>
2222
#include <user_interface.h>
2323
#include <core_version.h>
24-
#include <lwip/init.h> // LWIP_VERSION_*
2524
#include <lwipopts.h> // LWIP_HASH_STR (lwip2)
2625
#include <bearssl/bearssl_git.h> // BEARSSL_GIT short hash
2726

2827
#define STRHELPER(x) #x
2928
#define STR(x) STRHELPER(x) // stringifier
3029

3130
static const char arduino_esp8266_git_ver [] PROGMEM = "/Core:" STR(ARDUINO_ESP8266_GIT_DESC) "=";
32-
#if LWIP_VERSION_MAJOR > 1
3331
#if LWIP_IPV6
3432
static const char lwip_version [] PROGMEM = "/lwIP:IPv6+" LWIP_HASH_STR;
3533
#else
3634
static const char lwip_version [] PROGMEM = "/lwIP:" LWIP_HASH_STR;
3735
#endif
38-
#endif
3936
static const char bearssl_version [] PROGMEM = "/BearSSL:" STR(BEARSSL_GIT);
4037

4138
String EspClass::getFullVersion() {

cores/esp8266/IPAddress.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ bool IPAddress::isValid(const char* arg) {
180180
return IPAddress().fromString(arg);
181181
}
182182

183-
CONST IPAddress INADDR_ANY; // generic "0.0.0.0" for IPv4 & IPv6
183+
const IPAddress INADDR_ANY; // generic "0.0.0.0" for IPv4 & IPv6
184184
const IPAddress INADDR_NONE(255,255,255,255);
185185

186186
/**************************************/

cores/esp8266/IPAddress.h

+2-20
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,9 @@
2727
#include <lwip/init.h>
2828
#include <lwip/ip_addr.h>
2929

30-
#if LWIP_VERSION_MAJOR == 1
31-
// compatibility macros to make lwIP-v1 compiling lwIP-v2 API
32-
#define LWIP_IPV6_NUM_ADDRESSES 0
33-
#define ip_2_ip4(x) (x)
34-
#define ipv4_addr ip_addr
35-
#define ipv4_addr_t ip_addr_t
36-
#define IP_IS_V4_VAL(x) (1)
37-
#define IP_SET_TYPE_VAL(x,y) do { (void)0; } while (0)
38-
#define IP_ANY_TYPE (&ip_addr_any)
39-
#define IP4_ADDR_ANY IPADDR_ANY
40-
#define IP4_ADDR_ANY4 IP_ADDR_ANY
41-
#define IPADDR4_INIT(x) { x }
42-
#define CONST /* nothing: lwIP-v1 does not use const */
43-
#define ip4_addr_netcmp ip_addr_netcmp
44-
#define netif_dhcp_data(netif) ((netif)->dhcp)
45-
#else // lwIP-v2+
46-
#define CONST const
4730
#if !LWIP_IPV6
48-
struct ip_addr: ipv4_addr { };
31+
//struct ip_addr: ipv4_addr { };
4932
#endif // !LWIP_IPV6
50-
#endif // lwIP-v2+
5133

5234
// A class to make it easier to handle and pass around IP addresses
5335
// IPv6 update:
@@ -220,7 +202,7 @@ class IPAddress: public Printable {
220202

221203
};
222204

223-
extern CONST IPAddress INADDR_ANY;
205+
extern const IPAddress INADDR_ANY;
224206
extern const IPAddress INADDR_NONE;
225207

226208
#endif

cores/esp8266/Udp.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ class UDP: public Stream {
8383
// Return the port of the host who sent the current incoming packet
8484
virtual uint16_t remotePort() =0;
8585
protected:
86+
8687
uint8_t* rawIPAddress(IPAddress& addr) {
8788
return addr.raw_address();
8889
}
89-
#if LWIP_VERSION_MAJOR != 1
90+
9091
const uint8_t* rawIPAddress(const IPAddress& addr) {
9192
return addr.raw_address();
9293
}
93-
#endif
9494
};
9595

9696
#endif

cores/esp8266/sntp-lwip2.cpp

-40
Original file line numberDiff line numberDiff line change
@@ -60,44 +60,6 @@ void settimeofday_cb (const TrivialCB& cb)
6060

6161
extern "C" {
6262

63-
#if LWIP_VERSION_MAJOR == 1
64-
65-
#include <pgmspace.h>
66-
67-
static const char stod14[] PROGMEM = "settimeofday() can't set time!\n";
68-
bool sntp_set_timezone(sint8 timezone);
69-
bool sntp_set_timezone_in_seconds(int32_t timezone)
70-
{
71-
return sntp_set_timezone((sint8)(timezone/(60*60))); //TODO: move this to the same file as sntp_set_timezone() in lwip1.4, and implement correctly over there.
72-
}
73-
74-
void sntp_set_daylight(int daylight);
75-
76-
int settimeofday(const struct timeval* tv, const struct timezone* tz)
77-
{
78-
if (tz) /*before*/
79-
{
80-
sntp_set_timezone_in_seconds(tz->tz_minuteswest * 60);
81-
// apparently tz->tz_dsttime is a bitfield and should not be further used (cf man)
82-
sntp_set_daylight(0);
83-
}
84-
if (tv) /* after*/
85-
{
86-
// can't call lwip1.4's static sntp_set_system_time()
87-
os_printf(stod14);
88-
89-
// reset time subsystem
90-
timeshift64_is_set = false;
91-
92-
return -1;
93-
}
94-
return 0;
95-
}
96-
97-
#endif // lwip 1.4 only
98-
99-
#if LWIP_VERSION_MAJOR == 2
100-
10163
#include <lwip/apps/sntp.h>
10264

10365
uint32_t sntp_real_timestamp = 0;
@@ -128,6 +90,4 @@ int settimeofday(const struct timeval* tv, const struct timezone* tz)
12890
return 0;
12991
}
13092

131-
#endif // lwip2 only
132-
13393
};

cores/esp8266/time.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ int clock_gettime(clockid_t unused, struct timespec *tp)
7373
return 0;
7474
}
7575

76-
#if LWIP_VERSION_MAJOR == 1
77-
// hack for espressif time management included in patched lwIP-1.4
78-
#define sntp_real_timestamp sntp_get_current_timestamp()
79-
#endif
80-
81-
#if LWIP_VERSION_MAJOR != 1
82-
8376
// backport Espressif api
8477

8578
bool sntp_set_timezone_in_seconds (int32_t timezone_sec)
@@ -103,8 +96,6 @@ uint32 sntp_get_current_timestamp()
10396
return sntp_real_timestamp;
10497
}
10598

106-
#endif
107-
10899
time_t time(time_t * t)
109100
{
110101
if (t)

libraries/ESP8266NetBIOS/ESP8266NetBIOS.cpp

+2-7
Original file line numberDiff line numberDiff line change
@@ -172,21 +172,16 @@ void ESP8266NetBIOS::end()
172172
}
173173
}
174174

175-
void ESP8266NetBIOS::_recv(udp_pcb *upcb, pbuf *pb, CONST ip_addr_t *addr, uint16_t port)
175+
void ESP8266NetBIOS::_recv(udp_pcb *upcb, pbuf *pb, const ip_addr_t *addr, uint16_t port)
176176
{
177177
(void)upcb;
178178
(void)addr;
179179
(void)port;
180180
while(pb != NULL) {
181181
uint8_t * data = (uint8_t*)((pb)->payload);
182182
size_t len = pb->len;
183-
#if LWIP_VERSION_MAJOR == 1
184-
// check UdpContext.h
185-
ip_addr_t* saddr = &current_iphdr_src;
186-
#else
187183
// check UdpContext.h
188184
const ip_addr_t* saddr = &ip_data.current_iphdr_src;
189-
#endif
190185

191186
if (len >= sizeof(struct NBNSQUESTION)) {
192187
struct NBNSQUESTION * question = (struct NBNSQUESTION *)data;
@@ -267,7 +262,7 @@ void ESP8266NetBIOS::_recv(udp_pcb *upcb, pbuf *pb, CONST ip_addr_t *addr, uint1
267262
}
268263
}
269264

270-
void ESP8266NetBIOS::_s_recv(void *arg, udp_pcb *upcb, pbuf *p, CONST ip_addr_t *addr, uint16_t port)
265+
void ESP8266NetBIOS::_s_recv(void *arg, udp_pcb *upcb, pbuf *p, const ip_addr_t *addr, uint16_t port)
271266
{
272267
reinterpret_cast<ESP8266NetBIOS*>(arg)->_recv(upcb, p, addr, port);
273268
}

libraries/ESP8266NetBIOS/ESP8266NetBIOS.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#define __ESPNBNS_h__
44

55
extern "C" {
6-
#include "lwip/init.h" // LWIP_VERSION_
76
#include <lwip/ip_addr.h>
87
}
98
#include <ESP8266WiFi.h>
@@ -28,8 +27,8 @@ class ESP8266NetBIOS
2827
void _getnbname(char *nbname, char *name, uint8_t maxlen);
2928
void _makenbname(char *name, char *nbname, uint8_t outlen);
3029

31-
void _recv(udp_pcb *upcb, pbuf *pb, CONST ip_addr_t *addr, uint16_t port);
32-
static void _s_recv(void *arg, udp_pcb *upcb, pbuf *p, CONST ip_addr_t *addr, uint16_t port);
30+
void _recv(udp_pcb *upcb, pbuf *pb, const ip_addr_t *addr, uint16_t port);
31+
static void _s_recv(void *arg, udp_pcb *upcb, pbuf *p, const ip_addr_t *addr, uint16_t port);
3332

3433
public:
3534
ESP8266NetBIOS();

libraries/ESP8266WiFi/examples/StaticLease/StaticLease.ino

-16
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
11

2-
#include <lwip/init.h>
3-
4-
#if LWIP_VERSION_MAJOR == 1
5-
6-
void setup() {
7-
Serial.begin(115200);
8-
Serial.println("wifi_softap_add_dhcps_lease() is not implemented with lwIP-v1");
9-
}
10-
11-
void loop() {
12-
}
13-
14-
#else
15-
162
/* Create a WiFi access point and provide static lease */
173

184
#include <ESP8266WiFi.h>
@@ -104,5 +90,3 @@ void setup() {
10490
void loop() {
10591
server.handleClient();
10692
}
107-
108-
#endif // lwIP-v2

libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp

+3-12
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,7 @@ extern "C" {
4141
#include "lwip/err.h"
4242
#include "lwip/dns.h"
4343
#include "lwip/dhcp.h"
44-
#include "lwip/init.h" // LWIP_VERSION_
45-
#if LWIP_VERSION_MAJOR == 1
46-
#include "lwip/sntp.h"
47-
#else
4844
#include "lwip/apps/sntp.h"
49-
#endif
5045
}
5146

5247
#include "WiFiClient.h"
@@ -588,7 +583,7 @@ bool ESP8266WiFiGenericClass::isSleepLevelMax () {
588583
// ------------------------------------------------ Generic Network function ---------------------------------------------
589584
// -----------------------------------------------------------------------------------------------------------------------
590585

591-
void wifi_dns_found_callback(const char *name, CONST ip_addr_t *ipaddr, void *callback_arg);
586+
void wifi_dns_found_callback(const char *name, const ip_addr_t *ipaddr, void *callback_arg);
592587

593588
static bool _dns_lookup_pending = false;
594589

@@ -701,7 +696,7 @@ int ESP8266WiFiGenericClass::hostByName(const char* aHostname, IPAddress& aResul
701696
* @param ipaddr
702697
* @param callback_arg
703698
*/
704-
void wifi_dns_found_callback(const char *name, CONST ip_addr_t *ipaddr, void *callback_arg)
699+
void wifi_dns_found_callback(const char *name, const ip_addr_t *ipaddr, void *callback_arg)
705700
{
706701
(void) name;
707702
if (!_dns_lookup_pending) {
@@ -770,11 +765,7 @@ bool ESP8266WiFiGenericClass::shutdown (uint32 sleepUs, WiFiState* state)
770765
uint8_t i = 0;
771766
for (auto& ntp: state->state.ntp)
772767
{
773-
#if LWIP_VERSION_MAJOR == 1
774-
ntp = sntp_getserver(i++);
775-
#else
776768
ntp = *sntp_getserver(i++);
777-
#endif
778769
}
779770
i = 0;
780771
for (auto& dns: state->state.dns)
@@ -814,7 +805,7 @@ bool ESP8266WiFiGenericClass::resumeFromShutdown (WiFiState* state)
814805
DEBUG_WIFI("core: resume: static address '%s'\n", local.toString().c_str());
815806
WiFi.config(state->state.ip.ip, state->state.ip.gw, state->state.ip.netmask, state->state.dns[0], state->state.dns[1]);
816807
uint8_t i = 0;
817-
for (CONST auto& ntp: state->state.ntp)
808+
for (const auto& ntp: state->state.ntp)
818809
{
819810
IPAddress ip(ntp);
820811
if (ip.isSet())

libraries/ESP8266WiFi/src/ESP8266WiFiGratuitous.cpp

+1-14
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,7 @@
1919

2020
extern "C"
2121
{
22-
#include "lwip/init.h" // LWIP_VERSION_*
23-
#if LWIP_VERSION_MAJOR == 1
24-
#include "netif/wlan_lwip_if.h" // eagle_lwip_getif()
25-
#include "netif/etharp.h" // gratuitous arp
26-
#include "user_interface.h"
27-
#else
2822
#include "lwip/etharp.h" // gratuitous arp
29-
#endif
3023
} // extern "C"
3124

3225
#include <Schedule.h>
@@ -44,14 +37,8 @@ void ESP8266WiFiGratuitous::stationKeepAliveNow ()
4437
if (
4538
(interface->flags & NETIF_FLAG_LINK_UP)
4639
&& (interface->flags & NETIF_FLAG_UP)
47-
#if LWIP_VERSION_MAJOR == 1
48-
&& interface == eagle_lwip_getif(STATION_IF) /* lwip1 does not set if->num properly */
49-
&& (!ip_addr_isany(&interface->ip_addr))
50-
#else
5140
&& interface->num == STATION_IF
52-
&& (!ip4_addr_isany_val(*netif_ip4_addr(interface)))
53-
#endif
54-
)
41+
&& (!ip4_addr_isany_val(*netif_ip4_addr(interface))))
5542
{
5643
etharp_gratuitous(interface);
5744
break;

0 commit comments

Comments
 (0)