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

Commit

Permalink
v1.3.0
Browse files Browse the repository at this point in the history
### Releases v1.3.0

1. Add support to ESP32/ESP8266 using LittleFS/SPIFFS
2. Add support to AVR, UNO WiFi Rev2 boards.
3. Clean-up all compiler warnings possible.
4. Optimize library and examples to reduce memory usage by using Flash String whenever possible.
5. Add Table of Contents
  • Loading branch information
khoih-prog committed Jan 10, 2021
1 parent 9feb9c2 commit e97f854
Show file tree
Hide file tree
Showing 37 changed files with 2,083 additions and 821 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Contributing
## Contributing to Timezone_Generic

### Reporting Bugs

Expand All @@ -15,7 +15,7 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
Please ensure to specify the following:

* Arduino IDE version (e.g. 1.8.13) or Platform.io version
* `SAMD` Core Version (e.g. Arduino SAMD core v1.8.9, Adafruit SAMD core v1.6.4, Seeed Studio SAMD v1.8.1)
* `SAMD` Core Version (e.g. Arduino SAMD core v1.8.11, Adafruit SAMD core v1.6.4, Seeed Studio SAMD v1.8.1)
* Contextual information (e.g. what you were trying to achieve)
* Simplest possible steps to reproduce
* Anything that might be relevant in your opinion, such as:
Expand All @@ -27,7 +27,7 @@ Please ensure to specify the following:

```
Arduino IDE version: 1.8.13
Arduino SAMD Core Version 1.8.9
Arduino SAMD Core Version 1.8.11
OS: Ubuntu 20.04 LTS
Linux xy-Inspiron-3593 5.4.0-51-generic #56-Ubuntu SMP Mon Oct 5 14:28:49 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Expand Down
977 changes: 625 additions & 352 deletions README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
Built by Khoi Hoang https://github.com/khoih-prog/Timezone_Generic
Licensed under MIT license
Version: 1.2.6
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.2.4 K Hoang 17/10/2020 Initial porting to support SAM DUE, SAMD21, SAMD51, nRF52, ESP32/ESP8266, STM32, etc. boards
using SPIFFS, LittleFS, EEPROM, FlashStorage, DueFlashStorage.
1.2.5 K Hoang 28/10/2020 Add examples to use STM32 Built-In RTC.
1.2.6 K Hoang 01/11/2020 Allow un-initialized TZ then use begin() method to set the actual TZ (Credit of 6v6gt)
1.3.0 K Hoang 09/01/2021 Add support to ESP32/ESP8266 using LittleFS/SPIFFS, and to AVR, UNO WiFi Rev2, etc.
Fix compiler warnings.
*****************************************************************************************************************************/
/****************************************************************************************************************************
STM32 has five clock sources: HSI, HSE, LSI, LSE, PLL.
Expand Down Expand Up @@ -258,7 +260,11 @@ void setup()
Serial.begin(115200);
while (!Serial);

Serial.println("\nStart BI_RTC_Alarm_STM32_Ethernet on " + String(BOARD_NAME) + ", using " + String(SHIELD_TYPE));
delay(200);

Serial.print(F("\nStart BI_RTC_Alarm_STM32_Ethernet on ")); Serial.print(BOARD_NAME);
Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
Serial.println(TIMEZONE_GENERIC_VERSION);

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

Expand Down
4 changes: 3 additions & 1 deletion examples/Ethernet/BI_RTC_Alarm_STM32_Ethernet/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
Built by Khoi Hoang https://github.com/khoih-prog/Timezone_Generic
Licensed under MIT license
Version: 1.2.6
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.2.4 K Hoang 17/10/2020 Initial porting to support SAM DUE, SAMD21, SAMD51, nRF52, ESP32/ESP8266, STM32, etc. boards
using SPIFFS, LittleFS, EEPROM, FlashStorage, DueFlashStorage.
1.2.5 K Hoang 28/10/2020 Add examples to use STM32 Built-In RTC.
1.2.6 K Hoang 01/11/2020 Allow un-initialized TZ then use begin() method to set the actual TZ (Credit of 6v6gt)
1.3.0 K Hoang 09/01/2021 Add support to ESP32/ESP8266 using LittleFS/SPIFFS, and to AVR, UNO WiFi Rev2, etc.
Fix compiler warnings.
*****************************************************************************************************************************/

#ifndef defines_h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
Built by Khoi Hoang https://github.com/khoih-prog/Timezone_Generic
Licensed under MIT license
Version: 1.2.6
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.2.4 K Hoang 17/10/2020 Initial porting to support SAM DUE, SAMD21, SAMD51, nRF52, ESP32/ESP8266, STM32, etc. boards
using SPIFFS, LittleFS, EEPROM, FlashStorage, DueFlashStorage.
1.2.5 K Hoang 28/10/2020 Add examples to use STM32 Built-In RTC.
1.2.6 K Hoang 01/11/2020 Allow un-initialized TZ then use begin() method to set the actual TZ (Credit of 6v6gt)
1.3.0 K Hoang 09/01/2021 Add support to ESP32/ESP8266 using LittleFS/SPIFFS, and to AVR, UNO WiFi Rev2, etc.
Fix compiler warnings.
*****************************************************************************************************************************/
/****************************************************************************************************************************
STM32 has five clock sources: HSI, HSE, LSI, LSE, PLL.
Expand Down Expand Up @@ -230,7 +232,11 @@ void setup()
Serial.begin(115200);
while (!Serial);

Serial.println("\nStart BI_RTC_STM32_Ethernet on " + String(BOARD_NAME) + ", using " + String(SHIELD_TYPE));
delay(200);

Serial.print(F("\nStart BI_RTC_STM32_Ethernet on ")); Serial.print(BOARD_NAME);
Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
Serial.println(TIMEZONE_GENERIC_VERSION);

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

Expand Down
4 changes: 3 additions & 1 deletion examples/Ethernet/BI_RTC_STM32_Ethernet/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
Built by Khoi Hoang https://github.com/khoih-prog/Timezone_Generic
Licensed under MIT license
Version: 1.2.6
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.2.4 K Hoang 17/10/2020 Initial porting to support SAM DUE, SAMD21, SAMD51, nRF52, ESP32/ESP8266, STM32, etc. boards
using SPIFFS, LittleFS, EEPROM, FlashStorage, DueFlashStorage.
1.2.5 K Hoang 28/10/2020 Add examples to use STM32 Built-In RTC.
1.2.6 K Hoang 01/11/2020 Allow un-initialized TZ then use begin() method to set the actual TZ (Credit of 6v6gt)
1.3.0 K Hoang 09/01/2021 Add support to ESP32/ESP8266 using LittleFS/SPIFFS, and to AVR, UNO WiFi Rev2, etc.
Fix compiler warnings.
*****************************************************************************************************************************/

#ifndef defines_h
Expand Down
14 changes: 10 additions & 4 deletions examples/Ethernet/RTC_Ethernet/RTC_Ethernet.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
Built by Khoi Hoang https://github.com/khoih-prog/Timezone_Generic
Licensed under MIT license
Version: 1.2.6
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.2.4 K Hoang 17/10/2020 Initial porting to support SAM DUE, SAMD21, SAMD51, nRF52, ESP32/ESP8266, STM32, etc. boards
using SPIFFS, LittleFS, EEPROM, FlashStorage, DueFlashStorage.
1.2.5 K Hoang 28/10/2020 Add examples to use STM32 Built-In RTC.
1.2.6 K Hoang 01/11/2020 Allow un-initialized TZ then use begin() method to set the actual TZ (Credit of 6v6gt)
1.3.0 K Hoang 09/01/2021 Add support to ESP32/ESP8266 using LittleFS/SPIFFS, and to AVR, UNO WiFi Rev2, etc.
Fix compiler warnings.
*****************************************************************************************************************************/

#include "defines.h"
Expand Down Expand Up @@ -150,7 +152,7 @@ void getNTPTime(void)
//rtc.now( DateTime(epoch_t) );

// 4) DateTime(unsigned long epoch). The best and easiest way
rtc.now( DateTime(epoch) );
rtc.now( DateTime((uint32_t) epoch) );

// print the hour, minute and second:
Serial.print(F("The UTC time is ")); // UTC is the time at Greenwich Meridian (GMT)
Expand Down Expand Up @@ -200,8 +202,12 @@ void setup()
Serial.begin(115200);
while (!Serial);

Serial.print("\nStart RTC_Ethernet on " + String(BOARD_NAME));
Serial.println(" with " + String(SHIELD_TYPE));
delay(200);

Serial.print(F("\nStart RTC_Ethernet on ")); Serial.print(BOARD_NAME);
Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
Serial.println(TIMEZONE_GENERIC_VERSION);
Serial.println(DS323X_GENERIC_VERSION);

Wire.begin();

Expand Down
34 changes: 21 additions & 13 deletions examples/Ethernet/RTC_Ethernet/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
Built by Khoi Hoang https://github.com/khoih-prog/Timezone_Generic
Licensed under MIT license
Version: 1.2.6
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.2.4 K Hoang 17/10/2020 Initial porting to support SAM DUE, SAMD21, SAMD51, nRF52, ESP32/ESP8266, STM32, etc. boards
using SPIFFS, LittleFS, EEPROM, FlashStorage, DueFlashStorage.
1.2.5 K Hoang 28/10/2020 Add examples to use STM32 Built-In RTC.
1.2.6 K Hoang 01/11/2020 Allow un-initialized TZ then use begin() method to set the actual TZ (Credit of 6v6gt)
1.3.0 K Hoang 09/01/2021 Add support to ESP32/ESP8266 using LittleFS/SPIFFS, and to AVR, UNO WiFi Rev2, etc.
Fix compiler warnings.
*****************************************************************************************************************************/

#ifndef defines_h
Expand Down Expand Up @@ -229,19 +231,25 @@
#endif

#elif ( defined(ESP8266) )
// For ESP8266
#warning Use ESP8266 architecture
#include <ESP8266mDNS.h>
#define ETHERNET_USE_ESP8266
#define BOARD_TYPE "ESP8266"
// For ESP8266
#warning Use ESP8266 architecture
#include <ESP8266mDNS.h>
#define ETHERNET_USE_ESP8266
#define BOARD_TYPE "ESP8266"

#define USE_LITTLEFS true
#define USE_SPIFFS false

#elif ( defined(ESP32) )
// For ESP32
#warning Use ESP32 architecture
#define ETHERNET_USE_ESP32
#define BOARD_TYPE "ESP32"
// For ESP32
#warning Use ESP32 architecture
#define ETHERNET_USE_ESP32
#define BOARD_TYPE "ESP32"

#define W5500_RST_PORT 21

#define W5500_RST_PORT 21
#define USE_LITTLEFS true
#define USE_SPIFFS false

#else
// For Mega
Expand Down Expand Up @@ -280,9 +288,9 @@
#define USE_ETHERNET false
#define USE_ETHERNET2 false
#define USE_ETHERNET3 false
#define USE_ETHERNET_LARGE false
#define USE_ETHERNET_LARGE true
#define USE_ETHERNET_ESP8266 false
#define USE_ETHERNET_ENC true
#define USE_ETHERNET_ENC false
#define USE_CUSTOM_ETHERNET false

#if !USE_ETHERNET_WRAPPER
Expand Down
69 changes: 17 additions & 52 deletions examples/Ethernet/RTC_STM32_Ethernet/RTC_STM32_Ethernet.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
Built by Khoi Hoang https://github.com/khoih-prog/Timezone_Generic
Licensed under MIT license
Version: 1.2.6
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.2.4 K Hoang 17/10/2020 Initial porting to support SAM DUE, SAMD21, SAMD51, nRF52, ESP32/ESP8266, STM32, etc. boards
using SPIFFS, LittleFS, EEPROM, FlashStorage, DueFlashStorage.
1.2.5 K Hoang 28/10/2020 Add examples to use STM32 Built-In RTC.
1.2.6 K Hoang 01/11/2020 Allow un-initialized TZ then use begin() method to set the actual TZ (Credit of 6v6gt)
1.3.0 K Hoang 09/01/2021 Add support to ESP32/ESP8266 using LittleFS/SPIFFS, and to AVR, UNO WiFi Rev2, etc.
Fix compiler warnings.
*****************************************************************************************************************************/

#include "defines.h"
Expand All @@ -32,20 +34,10 @@ DS323x rtc;

//////////////////////////////////////////

#define USING_INITIALIZED_TZ false //true

#if USING_INITIALIZED_TZ
// US Eastern Time Zone (New York, Detroit,Toronto)
TimeChangeRule myDST = {"EDT", Second, Sun, Mar, 2, -240}; // Daylight time = UTC - 4 hours
TimeChangeRule mySTD = {"EST", First, Sun, Nov, 2, -300}; // Standard time = UTC - 5 hours
Timezone myTZ(myDST, mySTD);
#else
// Allow a "blank" TZ object then use begin() method to set the actual TZ.
// Feature added by 6v6gt (https://forum.arduino.cc/index.php?topic=711259)
Timezone myTZ ;
TimeChangeRule myDST;
TimeChangeRule mySTD;
#endif
// US Eastern Time Zone (New York, Detroit)
TimeChangeRule myDST = {"EDT", Second, Sun, Mar, 2, -240}; //Daylight time = UTC - 4 hours
TimeChangeRule mySTD = {"EST", First, Sun, Nov, 2, -300}; //Standard time = UTC - 5 hours
Timezone myTZ(myDST, mySTD);

// If TimeChangeRules are already stored in EEPROM, comment out the three
// lines above and uncomment the line below.
Expand Down Expand Up @@ -130,7 +122,7 @@ void getNTPTime(void)

// print Unix time:
Serial.println(epoch);

// Get the time_t from epoch
time_t epoch_t = epoch;

Expand All @@ -154,8 +146,8 @@ void getNTPTime(void)
//rtc.now( DateTime(epoch_t) );

// 4) DateTime(unsigned long epoch). The best and easiest way
rtc.now( DateTime(epoch) );
rtc.now( DateTime((uint32_t) epoch) );

// print the hour, minute and second:
Serial.print(F("The UTC time is ")); // UTC is the time at Greenwich Meridian (GMT)
Serial.print((epoch % 86400L) / 3600); // print the hour (86400 equals secs per day)
Expand Down Expand Up @@ -204,7 +196,12 @@ void setup()
Serial.begin(115200);
while (!Serial);

Serial.println("\nStart RTC_STM32_Ethernet on " + String(BOARD_NAME) + ", using " + String(SHIELD_TYPE));
delay(200);

Serial.print(F("\nStart RTC_STM32_Ethernet on ")); Serial.print(BOARD_NAME);
Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
Serial.println(TIMEZONE_GENERIC_VERSION);
Serial.println(DS323X_GENERIC_VERSION);

Wire.begin();

Expand Down Expand Up @@ -251,38 +248,6 @@ void setup()
Serial.print(F("You're connected to the network, IP = "));
Serial.println(Ethernet.localIP());

#if !(USING_INITIALIZED_TZ)

// Can read this info from EEPROM, storage, etc
String tzName = "EDT/EST" ;

// Time zone rules can be set as below or dynamically built, say through a configuration
// interface, or fetched from eeprom, flash etc.

if ( tzName == "EDT/EST" )
{
// America Eastern Time
myDST = (TimeChangeRule) {"EDT", Second, Sun, Mar, 2, -240}; // Daylight time = UTC - 4 hours
mySTD = (TimeChangeRule) {"EST", First, Sun, Nov, 2, -300}; // Standard time = UTC - 5 hours
}
else if ( tzName == "CET/CEST" )
{
// central Europe
myDST = (TimeChangeRule) {"CEST", Last, Sun, Mar, 2, 120};
mySTD = (TimeChangeRule) {"CET", Last, Sun, Oct, 3, 60};
}

else if ( tzName == "GMT/BST" )
{
// UK
myDST = (TimeChangeRule) {"BST", Last, Sun, Mar, 1, 60};
mySTD = (TimeChangeRule) {"GMT", Last, Sun, Oct, 2, 0};
}

myTZ.init( myDST, mySTD ) ;

#endif

Udp.begin(localPort);

rtc.attach(Wire);
Expand All @@ -297,7 +262,7 @@ void loop()
// Display time from RTC
DateTime now = rtc.now();

Serial.println("============================");
Serial.println(F("============================"));

time_t utc = now.get_time_t();
time_t local = myTZ.toLocal(utc, &tcr);
Expand Down
4 changes: 3 additions & 1 deletion examples/Ethernet/RTC_STM32_Ethernet/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
Built by Khoi Hoang https://github.com/khoih-prog/Timezone_Generic
Licensed under MIT license
Version: 1.2.6
Version: 1.3.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.2.4 K Hoang 17/10/2020 Initial porting to support SAM DUE, SAMD21, SAMD51, nRF52, ESP32/ESP8266, STM32, etc. boards
using SPIFFS, LittleFS, EEPROM, FlashStorage, DueFlashStorage.
1.2.5 K Hoang 28/10/2020 Add examples to use STM32 Built-In RTC.
1.2.6 K Hoang 01/11/2020 Allow un-initialized TZ then use begin() method to set the actual TZ (Credit of 6v6gt)
1.3.0 K Hoang 09/01/2021 Add support to ESP32/ESP8266 using LittleFS/SPIFFS, and to AVR, UNO WiFi Rev2, etc.
Fix compiler warnings.
*****************************************************************************************************************************/

#ifndef defines_h
Expand Down
Loading

0 comments on commit e97f854

Please sign in to comment.