forked from TioRuben/TTGO-T-Wristband
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add in UTC Offsets and DST Region Menus
Expand EEPROM type behaviour Modifcations to NTP code
- Loading branch information
1 parent
119ddb8
commit e3e29f6
Showing
27 changed files
with
724 additions
and
348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,34 @@ | ||
// Additions by John Heenan 2020 | ||
// Additions by John Heenan 2020 are as is and with no warranty. | ||
|
||
#pragma once | ||
|
||
#include <Arduino.h> | ||
#include <Wire.h> | ||
#include <pcf8563.h> | ||
#include <NTP.h> // for enums | ||
#include <NTP.h> | ||
#include "hal.hpp" | ||
#include "translations.hpp" | ||
|
||
extern time_t utcDST; | ||
#include "eeprom.hpp" // for settings_t | ||
#include <WiFiUdp.h> | ||
|
||
void initClock(); | ||
void rtcSleep(); | ||
RTC_Date getClockTime(); | ||
RTC_Date getUTCTime(); | ||
RTC_Date getUTCTime(time_t *utc=nullptr); | ||
void setTime(RTC_Date datetime); | ||
bool isUsingDST(); | ||
bool isDST(time_t utcNow); | ||
void | ||
setNtpUtcDst(time_t utcNow); | ||
bool isNothernHemispere(); | ||
void beginDST(int year); | ||
|
||
void initNTP(); | ||
RTC_Date syncTime(); | ||
|
||
class NTP2 | ||
{ // Any class named NTP2 has been declared a friend of the NTP class to get access to private declarations of NTP. | ||
public: // this minimises changes to the NTP class and also avoids unnecessary duplication here from the NTP class | ||
NTP2(NTP &ntp) : ntp(ntp) {} | ||
NTP &ntp; | ||
bool isDST(time_t utc); | ||
bool isDSTSouth(); | ||
void setUtcDst(time_t utcNow); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,29 @@ | ||
// Edits and additions by John Heenan | ||
// Edits and additions by John Heenan are as is and with no warranty | ||
#pragma once | ||
#include <Arduino.h> | ||
#include <Preferences.h> // now recommended to use NVS with Preferences library rather than EEPROM library | ||
#include <NTP.h> // for enums | ||
#include "timezones.hpp" | ||
|
||
#define MAGBIAS_FLOATS_MAX 3 | ||
void storeMagBiasEEPROM(float *magbias); | ||
void getMagBiasEEPROM(float *magbias); | ||
|
||
// Following added by John Heenan, 2020 | ||
|
||
#define SETTINGS_STRLEN_MAX 10 | ||
// Additions by John Heenan, 2020 are as is ans with no warranty | ||
|
||
typedef struct | ||
{ | ||
int eeprom_ver; | ||
float magbias[3]; | ||
bool imu_skip; | ||
bool dst_none; | ||
|
||
bool tz_uses_dst; | ||
int tz_offset; | ||
week_t tz_week; | ||
dow_t tz_wday; | ||
char tz_dst_name[SETTINGS_STRLEN_MAX + 1]; | ||
month_t tz_dst_month; | ||
int8_t tz_dst_hour; | ||
int tz_dst_offset; | ||
char tz_std_name[SETTINGS_STRLEN_MAX + 1]; | ||
month_t tz_std_month; | ||
int8_t tz_std_hour; | ||
int tz_std_offset; | ||
bool imu_skip; // if true them IMU is set to deep sleep and not to cause esp32 to wake up | ||
bool tz_uses_dst; // if user last choose a dst name then this is true, if user last choose a UTC offset then this is false | ||
int tz_offset; // only used when tz_uses_dst is false, however it is remembered | ||
char dst_region[DST_REGION_STRLEN_MAX + 1]; //only used when tz_uses_dst is true, however it is remembered | ||
|
||
} settings_t; | ||
|
||
extern settings_t settings; | ||
size_t storeSettings(); | ||
size_t loadSettings(); | ||
char *strcpy_settings(char *to, const char *from, size_t strlen_max); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include <Arduino.h> | ||
#include "wristband-tft.hpp" | ||
#include "eeprom.h" | ||
|
||
void actionTZ(); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Created by John Heenan 2020 | ||
#pragma once | ||
#include <NTP.h> // for enums | ||
|
||
|
||
#define DST_CODE_STRLEN_MAX 4 | ||
#define DST_REGION_STRLEN_MAX 20 | ||
#define DST_MAX 100 | ||
|
||
|
||
typedef struct | ||
{ | ||
char region[DST_REGION_STRLEN_MAX + 1]; | ||
week_t week; | ||
dow_t wday; | ||
char dst_code[DST_CODE_STRLEN_MAX + 1]; | ||
month_t dst_month; | ||
int8_t dst_hour; | ||
int dst_offset; | ||
char std_code[DST_CODE_STRLEN_MAX + 1]; | ||
month_t std_month; | ||
int8_t std_hour; | ||
int std_offset; | ||
|
||
} dst_t; | ||
|
||
extern int dst_index; | ||
extern int dst_length; | ||
extern dst_t dst_array[]; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.