fixed timezone compile error (issue #256)
This commit is contained in:
parent
ebefd5d234
commit
954687fe61
@ -4,6 +4,10 @@
|
||||
// The mother of all embedded development...
|
||||
#include <Arduino.h>
|
||||
|
||||
// Time functions
|
||||
#include <Time.h>
|
||||
#include <Timezone.h>
|
||||
|
||||
// std::set for unified array functions
|
||||
#include <set>
|
||||
#include <array>
|
||||
@ -102,6 +106,7 @@ extern std::array<uint64_t, 0xff>::iterator it;
|
||||
extern std::array<uint64_t, 0xff> beacons;
|
||||
|
||||
extern TaskHandle_t irqHandlerTask, wifiSwitchTask;
|
||||
extern Timezone myTZ; // make Timezone myTZ globally available
|
||||
|
||||
// application includes
|
||||
#include "led.h"
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define _GPSREAD_H
|
||||
|
||||
#include <TinyGPS++.h> // library for parsing NMEA data
|
||||
#include <Time.h>
|
||||
|
||||
#ifdef GPS_I2C // Needed for reading from I2C Bus
|
||||
#include <Wire.h>
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#include "globals.h"
|
||||
#include "rcommand.h"
|
||||
#include <TimeLib.h>
|
||||
|
||||
// LMIC-Arduino LoRaWAN Stack
|
||||
#include <lmic.h>
|
||||
|
@ -2,8 +2,6 @@
|
||||
#define _RTCTIME_H
|
||||
|
||||
#include "globals.h"
|
||||
#include <Time.h>
|
||||
#include <Timezone.h>
|
||||
#include <Wire.h> // must be included here so that Arduino library object file references work
|
||||
#include <RtcDS3231.h>
|
||||
|
||||
@ -20,7 +18,6 @@ typedef enum {
|
||||
} clock_state_t;
|
||||
|
||||
extern RtcDS3231<TwoWire> Rtc; // make RTC instance globally available
|
||||
extern Timezone myTZ; // make Timezone myTZ globally available
|
||||
|
||||
int rtc_init(void);
|
||||
int set_rtctime(uint32_t UTCTime);
|
||||
|
@ -132,10 +132,10 @@ void do_timesync() {
|
||||
#ifdef HAS_RTC
|
||||
if (!set_rtctime(RtcDateTime(now())))
|
||||
ESP_LOGE(TAG, "RTC set time failure");
|
||||
#endif
|
||||
time_t tt = myTZ.toLocal(now());
|
||||
ESP_LOGI(TAG, "GPS has set system time to %02d/%02d/%d %02d:%02d:%02d",
|
||||
month(tt), day(tt), year(tt), hour(tt), minute(tt), second(tt));
|
||||
#endif
|
||||
return;
|
||||
} else {
|
||||
ESP_LOGI(TAG, "No valid GPS time");
|
||||
|
@ -458,9 +458,9 @@ void user_request_network_time_callback(void *pVoidUserUTCTime,
|
||||
#ifdef HAS_RTC
|
||||
if (!set_rtctime(*pUserUTCTime))
|
||||
ESP_LOGE(TAG, "RTC set time failure");
|
||||
#endif
|
||||
time_t t = myTZ.toLocal(now());
|
||||
ESP_LOGI(TAG,
|
||||
"LORA Network has set system time to %02d/%02d/%d %02d:%02d:%02d",
|
||||
month(t), day(t), year(t), hour(t), minute(t), second(t));
|
||||
#endif
|
||||
}
|
||||
|
@ -77,6 +77,11 @@ std::set<uint16_t, std::less<uint16_t>, Mallocator<uint16_t>> macs;
|
||||
// initialize payload encoder
|
||||
PayloadConvert payload(PAYLOAD_BUFFER_SIZE);
|
||||
|
||||
// set Time Zone, fetch user setting from paxcounter.conf
|
||||
TimeChangeRule myDST = DAYLIGHT_TIME;
|
||||
TimeChangeRule mySTD = STANDARD_TIME;
|
||||
Timezone myTZ(myDST, mySTD);
|
||||
|
||||
// local Tag for logging
|
||||
static const char TAG[] = "main";
|
||||
|
||||
|
@ -7,11 +7,6 @@ static const char TAG[] = "main";
|
||||
|
||||
RtcDS3231<TwoWire> Rtc(Wire); // RTC hardware i2c interface
|
||||
|
||||
// set Time Zone, fetch user setting from paxcounter.conf
|
||||
TimeChangeRule myDST = DAYLIGHT_TIME;
|
||||
TimeChangeRule mySTD = STANDARD_TIME;
|
||||
Timezone myTZ(myDST, mySTD);
|
||||
|
||||
// initialize RTC
|
||||
int rtc_init(void) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user