Skip to content
This repository was archived by the owner on Jan 29, 2023. It is now read-only.

Commit c4181b1

Browse files
authored
v1.8.0 to fix multiple-definitions linker error
### Releases v1.8.0 1. Fix `multiple-definitions` linker error and weird bug related to `src_cpp`. Check [Different behaviour using the src_cpp or src_h lib #80](khoih-prog/ESPAsync_WiFiManager#80) 2. Optimize library code by using `reference-passing` instead of `value-passing` 3. Update all examples
1 parent 1a360af commit c4181b1

File tree

28 files changed

+475
-165
lines changed

28 files changed

+475
-165
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
1414

1515
Please ensure to specify the following:
1616

17-
* Arduino IDE version (e.g. 1.8.16) or Platform.io version
17+
* Arduino IDE version (e.g. 1.8.19) or Platform.io version
1818
* Board Core Version (e.g. Arduino SAMDUE core v1.6.12, ESP8266 core v3.0.2, ArduinoCore-mbed v2.6.1, etc.)
1919
* Contextual information (e.g. what you were trying to achieve)
2020
* Simplest possible steps to reproduce
@@ -26,7 +26,7 @@ Please ensure to specify the following:
2626
### Example
2727

2828
```
29-
Arduino IDE version: 1.8.16
29+
Arduino IDE version: 1.8.19
3030
RASPBERRY_PI_PICO board
3131
ArduinoCore-mbed v2.6.1
3232
OS: Ubuntu 20.04 LTS

README.md

Lines changed: 108 additions & 88 deletions
Large diffs are not rendered by default.

changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
## Table of Contents
1313

1414
* [Changelog](#changelog)
15+
* [Releases v1.8.0](#releases-v180)
1516
* [Releases v1.7.3](#releases-v173)
1617
* [Releases v1.7.2](#releases-v172)
1718
* [Releases v1.7.1](#releases-v171)
@@ -29,6 +30,12 @@
2930

3031
## Changelog
3132

33+
### Releases v1.8.0
34+
35+
1. Fix `multiple-definitions` linker error and weird bug related to `src_cpp`. Check [Different behaviour using the src_cpp or src_h lib #80](https://github.com/khoih-prog/ESPAsync_WiFiManager/discussions/80)
36+
2. Optimize library code by using `reference-passing` instead of `value-passing`
37+
3. Update all examples
38+
3239
### Releases v1.7.3
3340

3441
1. Auto detect ESP32 core for LittleFS for WT32_ETH01

examples/Ethernet/BI_RTC_Alarm_STM32_Ethernet/BI_RTC_Alarm_STM32_Ethernet.ino

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@
3434

3535
#include "defines.h"
3636

37-
#include <Timezone_Generic.h> // https://github.com/khoih-prog/Timezone_Generic
37+
#define TIMEZONE_GENERIC_VERSION_MIN_TARGET "Timezone_Generic v1.8.0"
38+
#define TIMEZONE_GENERIC_VERSION_MIN 1008000
39+
40+
//////////////////////////////////////////
41+
42+
#include <Timezone_Generic.h> // https://github.com/khoih-prog/Timezone_Generic
43+
44+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
45+
#include "Timezone_Generic_Impl.h" // https://github.com/khoih-prog/Timezone_Generic
3846

3947
#include <STM32RTC.h>
4048

@@ -255,6 +263,14 @@ void setup()
255263
Serial.print(F("\nStart BI_RTC_Alarm_STM32_Ethernet on ")); Serial.print(BOARD_NAME);
256264
Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
257265
Serial.println(TIMEZONE_GENERIC_VERSION);
266+
267+
#if defined(TIMEZONE_GENERIC_VERSION_MIN)
268+
if (TIMEZONE_GENERIC_VERSION_INT < TIMEZONE_GENERIC_VERSION_MIN)
269+
{
270+
Serial.print("Warning. Must use this example on Version equal or later than : ");
271+
Serial.println(TIMEZONE_GENERIC_VERSION_MIN_TARGET);
272+
}
273+
#endif
258274

259275
ET_LOGWARN3(F("Board :"), BOARD_NAME, F(", setCsPin:"), USE_THIS_SS_PIN);
260276

examples/Ethernet/BI_RTC_STM32_Ethernet/BI_RTC_STM32_Ethernet.ino

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@
3535

3636
#include "defines.h"
3737

38-
#include <Timezone_Generic.h> // https://github.com/khoih-prog/Timezone_Generic
38+
#define TIMEZONE_GENERIC_VERSION_MIN_TARGET "Timezone_Generic v1.8.0"
39+
#define TIMEZONE_GENERIC_VERSION_MIN 1008000
40+
41+
//////////////////////////////////////////
42+
43+
#include <Timezone_Generic.h> // https://github.com/khoih-prog/Timezone_Generic
44+
45+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
46+
#include "Timezone_Generic_Impl.h" // https://github.com/khoih-prog/Timezone_Generic
3947

4048
#include <STM32RTC.h> // https://github.com/stm32duino/STM32RTC
4149

@@ -227,6 +235,14 @@ void setup()
227235
Serial.print(F("\nStart BI_RTC_STM32_Ethernet on ")); Serial.print(BOARD_NAME);
228236
Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
229237
Serial.println(TIMEZONE_GENERIC_VERSION);
238+
239+
#if defined(TIMEZONE_GENERIC_VERSION_MIN)
240+
if (TIMEZONE_GENERIC_VERSION_INT < TIMEZONE_GENERIC_VERSION_MIN)
241+
{
242+
Serial.print("Warning. Must use this example on Version equal or later than : ");
243+
Serial.println(TIMEZONE_GENERIC_VERSION_MIN_TARGET);
244+
}
245+
#endif
230246

231247
ET_LOGWARN3(F("Board :"), BOARD_NAME, F(", setCsPin:"), USE_THIS_SS_PIN);
232248

examples/Ethernet/RTC_Ethernet/RTC_Ethernet.ino

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@
1616

1717
#include "defines.h"
1818

19-
#include <Timezone_Generic.h> // https://github.com/khoih-prog/Timezone_Generic
19+
#define TIMEZONE_GENERIC_VERSION_MIN_TARGET "Timezone_Generic v1.8.0"
20+
#define TIMEZONE_GENERIC_VERSION_MIN 1008000
21+
22+
//////////////////////////////////////////
23+
24+
#include <Timezone_Generic.h> // https://github.com/khoih-prog/Timezone_Generic
25+
26+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
27+
#include "Timezone_Generic_Impl.h" // https://github.com/khoih-prog/Timezone_Generic
2028

2129
#include <DS323x_Generic.h> // https://github.com/khoih-prog/DS323x_Generic
2230

@@ -200,6 +208,14 @@ void setup()
200208
Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
201209
Serial.println(TIMEZONE_GENERIC_VERSION);
202210
Serial.println(DS323X_GENERIC_VERSION);
211+
212+
#if defined(TIMEZONE_GENERIC_VERSION_MIN)
213+
if (TIMEZONE_GENERIC_VERSION_INT < TIMEZONE_GENERIC_VERSION_MIN)
214+
{
215+
Serial.print("Warning. Must use this example on Version equal or later than : ");
216+
Serial.println(TIMEZONE_GENERIC_VERSION_MIN_TARGET);
217+
}
218+
#endif
203219

204220
Wire.begin();
205221

examples/Ethernet/RTC_STM32_Ethernet/RTC_STM32_Ethernet.ino

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@
1616

1717
#include "defines.h"
1818

19-
#include <Timezone_Generic.h> // https://github.com/khoih-prog/Timezone_Generic
19+
#define TIMEZONE_GENERIC_VERSION_MIN_TARGET "Timezone_Generic v1.8.0"
20+
#define TIMEZONE_GENERIC_VERSION_MIN 1008000
21+
22+
//////////////////////////////////////////
23+
24+
#include <Timezone_Generic.h> // https://github.com/khoih-prog/Timezone_Generic
25+
26+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
27+
#include "Timezone_Generic_Impl.h" // https://github.com/khoih-prog/Timezone_Generic
2028

2129
#include <DS323x_Generic.h> // https://github.com/khoih-prog/DS323x_Generic
2230

@@ -192,6 +200,14 @@ void setup()
192200
Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
193201
Serial.println(TIMEZONE_GENERIC_VERSION);
194202
Serial.println(DS323X_GENERIC_VERSION);
203+
204+
#if defined(TIMEZONE_GENERIC_VERSION_MIN)
205+
if (TIMEZONE_GENERIC_VERSION_INT < TIMEZONE_GENERIC_VERSION_MIN)
206+
{
207+
Serial.print("Warning. Must use this example on Version equal or later than : ");
208+
Serial.println(TIMEZONE_GENERIC_VERSION_MIN_TARGET);
209+
}
210+
#endif
195211

196212
Wire.begin();
197213

examples/Ethernet/TZ_NTP_Clock_Ethernet/TZ_NTP_Clock_Ethernet.ino

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@
2222

2323
//////////////////////////////////////////
2424

25-
#include <Timezone_Generic.h> // https://github.com/khoih-prog/Timezone_Generic
25+
#define TIMEZONE_GENERIC_VERSION_MIN_TARGET "Timezone_Generic v1.8.0"
26+
#define TIMEZONE_GENERIC_VERSION_MIN 1008000
27+
28+
//////////////////////////////////////////
29+
30+
#include <Timezone_Generic.h> // https://github.com/khoih-prog/Timezone_Generic
31+
32+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
33+
#include "Timezone_Generic_Impl.h" // https://github.com/khoih-prog/Timezone_Generic
2634

2735
#define USING_INITIALIZED_TZ false //true
2836

@@ -198,6 +206,14 @@ void setup()
198206
Serial.print(F("\nStart TZ_NTP_Clock_Ethernet on ")); Serial.print(BOARD_NAME);
199207
Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
200208
Serial.println(TIMEZONE_GENERIC_VERSION);
209+
210+
#if defined(TIMEZONE_GENERIC_VERSION_MIN)
211+
if (TIMEZONE_GENERIC_VERSION_INT < TIMEZONE_GENERIC_VERSION_MIN)
212+
{
213+
Serial.print("Warning. Must use this example on Version equal or later than : ");
214+
Serial.println(TIMEZONE_GENERIC_VERSION_MIN_TARGET);
215+
}
216+
#endif
201217

202218
#if USE_ETHERNET_WRAPPER
203219

examples/Ethernet/TZ_NTP_Clock_STM32_Ethernet/TZ_NTP_Clock_STM32_Ethernet.ino

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,15 @@
1818

1919
//////////////////////////////////////////
2020

21-
#include <Timezone_Generic.h> // https://github.com/khoih-prog/Timezone_Generic
21+
#define TIMEZONE_GENERIC_VERSION_MIN_TARGET "Timezone_Generic v1.8.0"
22+
#define TIMEZONE_GENERIC_VERSION_MIN 1008000
2223

24+
//////////////////////////////////////////
25+
26+
#include <Timezone_Generic.h> // https://github.com/khoih-prog/Timezone_Generic
27+
28+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
29+
#include "Timezone_Generic_Impl.h" // https://github.com/khoih-prog/Timezone_Generic
2330
#define USING_INITIALIZED_TZ false //true
2431

2532
#if USING_INITIALIZED_TZ
@@ -194,6 +201,14 @@ void setup()
194201
Serial.print(F("\nStart TZ_NTP_Clock_STM32_Ethernet on ")); Serial.print(BOARD_NAME);
195202
Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
196203
Serial.println(TIMEZONE_GENERIC_VERSION);
204+
205+
#if defined(TIMEZONE_GENERIC_VERSION_MIN)
206+
if (TIMEZONE_GENERIC_VERSION_INT < TIMEZONE_GENERIC_VERSION_MIN)
207+
{
208+
Serial.print("Warning. Must use this example on Version equal or later than : ");
209+
Serial.println(TIMEZONE_GENERIC_VERSION_MIN_TARGET);
210+
}
211+
#endif
197212

198213
ET_LOGWARN3(F("Board :"), BOARD_NAME, F(", setCsPin:"), USE_THIS_SS_PIN);
199214

examples/Ethernet/TZ_NTP_WorldClock_Ethernet/TZ_NTP_WorldClock_Ethernet.ino

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@
2222

2323
//////////////////////////////////////////
2424

25-
#include <Timezone_Generic.h> // https://github.com/khoih-prog/Timezone_Generic
25+
#define TIMEZONE_GENERIC_VERSION_MIN_TARGET "Timezone_Generic v1.8.0"
26+
#define TIMEZONE_GENERIC_VERSION_MIN 1008000
27+
28+
//////////////////////////////////////////
29+
30+
#include <Timezone_Generic.h> // https://github.com/khoih-prog/Timezone_Generic
31+
32+
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
33+
#include "Timezone_Generic_Impl.h" // https://github.com/khoih-prog/Timezone_Generic
2634

2735
// Australia Eastern Time Zone (Sydney, Melbourne)
2836
TimeChangeRule aEDT = {"AEDT", First, Sun, Oct, 2, 660}; // UTC + 11 hours
@@ -237,6 +245,14 @@ void setup()
237245
Serial.print(F("\nStart TZ_NTP_WorldClock_Ethernet on ")); Serial.print(BOARD_NAME);
238246
Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
239247
Serial.println(TIMEZONE_GENERIC_VERSION);
248+
249+
#if defined(TIMEZONE_GENERIC_VERSION_MIN)
250+
if (TIMEZONE_GENERIC_VERSION_INT < TIMEZONE_GENERIC_VERSION_MIN)
251+
{
252+
Serial.print("Warning. Must use this example on Version equal or later than : ");
253+
Serial.println(TIMEZONE_GENERIC_VERSION_MIN_TARGET);
254+
}
255+
#endif
240256

241257
#if USE_ETHERNET_WRAPPER
242258

0 commit comments

Comments
 (0)