Skip to content

Commit 0db6ec4

Browse files
d-a-vdevyte
authored andcommitted
lwip2: 3 sntp servers, autoip (169.254), esp-ping, espconn (#5444)
* lwip2: better handling of ipv4_addr/t type + 3 sntp servers * bump lwip2 version * Only with FEATURES=1: 3 sntp servers and AutoIP enabled (169.254 when dhcp server fails) * Only with FEATURES=1: 3 sntp servers and AutoIP enabled (169.254 when dhcp server fails) * local CI runner: select build type * new ipv4_addr/t definition makes things easier for IPAddress * update local CI runner * lwip2 changes * lwip2: port esp-ping and espconn
1 parent 6d42a26 commit 0db6ec4

File tree

16 files changed

+115
-43
lines changed

16 files changed

+115
-43
lines changed

cores/esp8266/IPAddress.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,6 @@ class IPAddress: public Printable {
152152
IPAddress(const ipv4_addr* fw_addr) { setV4(); v4() = fw_addr->addr; }
153153
IPAddress(const ip_addr_t& lwip_addr) { _ip = lwip_addr; }
154154

155-
#if LWIP_VERSION_MAJOR != 1
156-
IPAddress(ipv4_addr fw_addr) { setV4(); v4() = fw_addr.addr; }
157-
IPAddress(const ip_addr_t* lwip_addr) { _ip = *lwip_addr; }
158-
#endif
159-
160155
operator ip_addr_t () const { return _ip; }
161156
operator const ip_addr_t*() const { return &_ip; }
162157
operator ip_addr_t*() { return &_ip; }

tests/run_CI_locally.sh

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,37 @@ if [ "$branch" != "$branch" ]; then
4747
exit 1
4848
fi
4949
rm -rf arduino_ide arduino-nightly Arduino/libraries/ArduinoJson
50-
HOME=${TMPCI} TRAVIS_BUILD_DIR=${TMPCI} BUILD_TYPE=build tests/common.sh
50+
51+
while true; do
52+
53+
cat << EOF
54+
Which build?
55+
1. main
56+
2. debug even
57+
3. debug odd
58+
4. platformio
59+
5. package
60+
6. host
61+
7. style
62+
EOF
63+
64+
read ans
65+
66+
BUILD_TYPE=""
67+
case "$ans" in
68+
1) BUILD_TYPE=build;;
69+
2) BUILD_TYPE=debug_even;;
70+
3) BUILD_TYPE=debug_odd;;
71+
4) BUILD_TYPE=platformio;;
72+
5) BUILD_TYPE=package;;
73+
6) BUILD_TYPE=host;;
74+
7) BUILD_TYPE=style;;
75+
esac
76+
test -z "$BUILD_TYPE" || break
77+
done
78+
79+
# use pip2 for python2 with python3 is around, platformio doesn't like it
80+
cp tests/common.sh tests/common-custom.sh
81+
sed -i 's,pip ,pip2 ,g' tests/common-custom.sh
82+
83+
HOME=${TMPCI} TRAVIS_BUILD_DIR=${TMPCI} BUILD_TYPE=$BUILD_TYPE tests/common-custom.sh

tools/sdk/include/ip_addr.h

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,12 @@
2626
#define __IP_ADDR_H__
2727

2828
#include "c_types.h"
29+
#include "ipv4_addr.h"
2930

3031
#ifdef __cplusplus
3132
extern "C" {
3233
#endif
3334

34-
struct ipv4_addr {
35-
uint32 addr;
36-
};
37-
38-
typedef struct ipv4_addr ipv4_addr_t;
39-
40-
struct ip_info {
41-
struct ipv4_addr ip;
42-
struct ipv4_addr netmask;
43-
struct ipv4_addr gw;
44-
};
45-
4635
/**
4736
* Determine if two address are on the same network.
4837
*

tools/sdk/include/ipv4_addr.h

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* ESPRESSIF MIT License
3+
*
4+
* Copyright (c) 2016 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
5+
*
6+
* Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
7+
* it is free of charge, to any person obtaining a copy of this software and associated
8+
* documentation files (the "Software"), to deal in the Software without restriction, including
9+
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
10+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished
11+
* to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all copies or
14+
* substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22+
*
23+
*/
24+
25+
#ifndef __IPV4_ADDR_H__
26+
#define __IPV4_ADDR_H__
27+
28+
#include <stdint.h>
29+
#include <lwip/init.h>
30+
31+
// ipv4_addr is necessary for lwIP-v2 because
32+
// - espressif binary firmware is IPv4 only, under the name of ip_addr/_t
33+
// - ip_addr/_t is different when IPv6 is enabled with lwIP-v2
34+
// hence ipv4_addr/t is IPv4 version/copy of IPv4 ip_addr/_t
35+
// when IPv6 is enabled so we can deal with IPv4 use from firmware API.
36+
37+
// official lwIP's definitions (1.4 or 2)
38+
#include "lwip/ip_addr.h"
39+
40+
///////////////////////////////////////////////
41+
#if LWIP_VERSION_MAJOR == 1
42+
43+
#define ipv4_addr ip_addr
44+
45+
///////////////////////////////////////////////
46+
#else // lwIP-v2
47+
48+
#define ipv4_addr ip4_addr
49+
#define ipv4_addr_t ip4_addr_t
50+
51+
// defined in lwip-v1.4 sources only, used in fw
52+
struct ip_info {
53+
struct ipv4_addr ip;
54+
struct ipv4_addr netmask;
55+
struct ipv4_addr gw;
56+
};
57+
58+
///////////////////////////////////////////////
59+
#endif // lwIP-v2
60+
61+
#endif // __IPV4_ADDR_H__

tools/sdk/include/user_interface.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,7 @@
2828
#include "os_type.h"
2929
#ifdef LWIP_OPEN_SRC
3030

31-
#include "lwip/init.h"
32-
#if LWIP_VERSION_MAJOR == 1
33-
#define ipv4_addr ip_addr
34-
#endif
35-
#include "lwip/ip_addr.h"
36-
#if LWIP_VERSION_MAJOR != 1
37-
typedef struct ip4_addr ipv4_addr_t;
38-
#endif
31+
#include "ipv4_addr.h"
3932

4033
#else
4134
#error LWIP_OPEN_SRC must be defined

tools/sdk/lib/liblwip2-1460-feat.a

322 KB
Binary file not shown.

tools/sdk/lib/liblwip2-1460.a

291 KB
Binary file not shown.

tools/sdk/lib/liblwip2-536-feat.a

322 KB
Binary file not shown.

tools/sdk/lib/liblwip2-536.a

291 KB
Binary file not shown.

tools/sdk/lib/liblwip6-1460-feat.a

328 KB
Binary file not shown.

0 commit comments

Comments
 (0)