Merge pull request #1729 from rjmcdougall/pcf8563rtc

Adjust year, hour, minute for PCF8563
This commit is contained in:
Thomas Göttgens 2022-10-04 13:40:40 +02:00 committed by GitHub
commit dc097c7230
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -47,8 +47,8 @@ void readFromRTC()
rtc.begin(); rtc.begin();
auto tc = rtc.getDateTime(); auto tc = rtc.getDateTime();
tm t; tm t;
t.tm_year = tc.year; t.tm_year = tc.year - 1900;
t.tm_mon = tc.month; t.tm_mon = tc.month - 1;
t.tm_mday = tc.day; t.tm_mday = tc.day;
t.tm_hour = tc.hour; t.tm_hour = tc.hour;
t.tm_min = tc.minute; t.tm_min = tc.minute;
@ -112,7 +112,7 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv)
PCF8563_Class rtc; PCF8563_Class rtc;
rtc.begin(); rtc.begin();
tm *t = localtime(&tv->tv_sec); tm *t = localtime(&tv->tv_sec);
rtc.setDateTime(t->tm_year + 1900, t->tm_mon + 1, t->tm_wday, t->tm_hour, t->tm_min, t->tm_sec); rtc.setDateTime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
DEBUG_MSG("PCF8563_RTC setDateTime %02d-%02d-%02d %02d:%02d:%02d %ld\n", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, tv->tv_sec); DEBUG_MSG("PCF8563_RTC setDateTime %02d-%02d-%02d %02d:%02d:%02d %ld\n", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, tv->tv_sec);
} }
#elif defined(ARCH_ESP32) #elif defined(ARCH_ESP32)

View File

@ -12,7 +12,7 @@ build_flags =
lib_deps = lib_deps =
${esp32_base.lib_deps} ${esp32_base.lib_deps}
zinggjm/GxEPD2@^1.4.9 zinggjm/GxEPD2@^1.4.9
lewisxhe/PCF8563_Library@^0.0.1 https://github.com/lewisxhe/PCF8563_Library.git#91399f254651537c5ab338dacc7c10d1f087fd09
board_build.f_cpu = 240000000L board_build.f_cpu = 240000000L
upload_protocol = esptool upload_protocol = esptool
upload_port = /dev/ttyACM* upload_port = /dev/ttyACM*

View File

@ -14,5 +14,5 @@ lib_deps =
${nrf52840_base.lib_deps} ${nrf52840_base.lib_deps}
https://github.com/meshtastic/GxEPD2#afce87a97dda1ac31d8a28dc8fa7c6f55dc96a61 https://github.com/meshtastic/GxEPD2#afce87a97dda1ac31d8a28dc8fa7c6f55dc96a61
adafruit/Adafruit BusIO@^1.13.2 adafruit/Adafruit BusIO@^1.13.2
lewisxhe/PCF8563_Library@^0.0.1 https://github.com/lewisxhe/PCF8563_Library.git#91399f254651537c5ab338dacc7c10d1f087fd09
;upload_protocol = fs ;upload_protocol = fs