Skip to content

Commit 7f29375

Browse files
author
Spacehuhn
committed
RTC
1 parent 602a7a6 commit 7f29375

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

esp8266_deauther/DisplayUI.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,16 @@ void DisplayUI::setup() {
6363
setupButtons();
6464
buttonTime = currentTime;
6565

66+
#ifdef RTC_DS3231
67+
bool h12;
68+
bool PM_time;
69+
clock.setClockMode(false);
70+
clockHour = clock.getHour(h12, PM_time);
71+
clockMinute = clock.getMinute();
72+
#else
6673
clockHour = random(12);
6774
clockMinute = random(60);
75+
#endif
6876

6977
// ===== MENUS ===== //
7078

@@ -891,4 +899,10 @@ void DisplayUI::setTime(int h, int m, int s) {
891899
clockHour = h;
892900
clockMinute = m;
893901
clockSecond = s;
902+
903+
#ifdef RTC_DS3231
904+
clock.setHour(clockHour);
905+
clock.setMinute(clockMinute);
906+
clock.setSecond(clockSecond);
907+
#endif
894908
}

esp8266_deauther/DisplayUI.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
#include <SH1106Spi.h>
2424
#endif /* if defined(SSD1306_I2C) */
2525

26+
#ifdef RTC_DS3231
27+
#include <DS3231.h>
28+
#endif
29+
2630
#include <SimpleButton.h>
2731

2832
using namespace simplebutton;
@@ -184,6 +188,10 @@ class DisplayUI {
184188
int clockSecond = 0;
185189

186190
uint32_t clockTime = 0;
191+
192+
#ifdef RTC_DS3231
193+
DS3231 clock;
194+
#endif
187195
};
188196

189197
// ===== FONT ===== //

esp8266_deauther/LED.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "Scan.h" // used in update()
1515

1616
// Inlcude libraries for Neopixel or LED_MY92xx if used
17-
#if defined(NEOPIXEL_LED)
17+
#if defined(NEOPIXEL_LED) || defined(LED_NEOPIXEL_RGB) || defined(LED_NEOPIXEL_GRB)
1818
#include <Adafruit_NeoPixel.h>
1919
#elif defined(LED_MY92)
2020
#include <my92xx.h>

0 commit comments

Comments
 (0)