losungepaper/losungepaper.ino

54 lines
1.8 KiB
C++
Executable File

#include "epd2in7.h"
#include "epdpaint.h"
// b/w e-Paper
#define COLORED 0
#define UNCOLORED 1
Epd epd;
int DEEP_SLEEP_TIME_uS = 6 * 60 * 60 * 1000 * 1000; // time to deep sleep in microseconds (not milliseconds!)
// WiFi
char wiFiSSID[] = "SSID"; // SSID of your network
char wiFiPSK[] = "PRE-SHARED KEY"; //password of your WPA Network
// NTP (Network Time Protocol)
const String ntpServer = "pool.ntp.org"; // address of ntp server; may also be your router, other local service, etc.
const long gmtOffset_sec = 3600; // for localization (gmt = greenwich mean time); in germany: 3600
const int daylightOffset_sec = 3600; // for daylight saving
// style of the frame shown
sFONT TITLE_FONT = Font20;
char TITLE_TEXT[] = "Losung heute";
sFONT TEXT_FONT = Font12; // for the daily text
int TEXT_WIDTH = 168; // width of the box around the text; should be a multiple of the width of the font (eg. Font8 => multiple of 8)
int TEXT_PADDING_TOP = 40;
int TEXT_PADDING_BETWEEN_BLOCKS = 20; // pixels between the lines
int TEXT_PADDING_BETWEEN_LINES = 1; // pixels between the lines
sFONT SOURCE_FONT = Font8; // for the position in bible
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("[INFO] Initializing e-Paper...");
if (epd.Init() != 0) {
Serial.println("[FATAL] Failed initializing e-Paper; Exiting...");
return;
}
Serial.println("[INFO] Initialized e-Paper!");
connectWiFi();
String html = getHTML();
showDailyText(getLosungFromHTML(html), getLehrtextFromHTML(html), getLosungSourceFromHTML(html), getLehrtextSourceFromHTML(html));
// deep sleep for 6 hours
esp_sleep_enable_timer_wakeup(DEEP_SLEEP_TIME_uS);
Serial.printf("[ESP32] Going to deep sleep mode.\n");
esp_deep_sleep_start();
}
void loop() {
}