Minor adjustments

This commit is contained in:
jonas
2020-01-05 17:02:55 +01:00
parent c6f95e9cfd
commit a5acbd85f4
5 changed files with 8 additions and 16 deletions

View File

@@ -64,7 +64,7 @@ void connectToWifi() {
}
if(connectTries >= 20) {
Serial.println("Unable to connect to " + WiFi.SSID() + ". ESP32 going to deep sleep.");
Serial.println("WIFI: Unable to connect to " + WiFi.SSID() + ". ESP32 going to deep sleep.");
esp_wifi_stop();
esp_bt_controller_disable();
esp_deep_sleep_start();
@@ -72,7 +72,7 @@ void connectToWifi() {
connectTries++;
}
Serial.println("WIFI: Connected to network");
Serial.println("WIFI: Connected to network: " + WiFi.SSID());
Serial.println(WiFi.localIP());
Serial.println(WiFi.macAddress());
}
@@ -111,8 +111,8 @@ String getShowerthought() {
// Connect to reddit.com and fetch the showerthought data using the web client
Serial.println("Fetching Showerthougt");
if(!client.connect(host, port)) {
Serial.println("connection 1 failed!");
return "Impossible to connect to Reddit";
Serial.println("SECURE CLIENT: Connection 1 failed!");
return "Unable to connect to Reddit";
}
String url = "/r/Showerthoughts/random.json?sort=hot&limit=1&t=day";
client.print(String("GET ") + url + " HTTP/1.1\r\n" +
@@ -122,7 +122,7 @@ String getShowerthought() {
unsigned long timeout = millis();
while (client.available() == 0) {
if (millis() - timeout > 5000) {
Serial.println(">>> Client Timeout !");
Serial.println("SECURE CLIENT: Client Timeout!");
client.stop();
return "Reddit did not respond in time";
}
@@ -160,7 +160,7 @@ String getShowerthought() {
while(client.connected()) {
String line = client.readStringUntil('\n');
if (line == "\r") {
Serial.println("headers received");
Serial.println("DEBUG: Headers received");
break;
}
}

View File

@@ -2,7 +2,7 @@
This code uses an ESP32 to fetch latest posts from [/r/showerthoughts](https://www.reddit.com/r/Showerthoughts/) and displays them on a Waveshare e-paper display. Afterwards it puts the ESP to deep sleep mode. All components run on battery power without annoying cables.
![Front](img/01_Front.jpg)
![Front](img/02_Back.jpg)
![Back](img/02_Back.jpg)
#### Used Hardware
+ [Waveshare 7.5" e-paper display](https://www.waveshare.com/7.5inch-e-paper.htm)

View File

@@ -1,8 +0,0 @@
// WIFI
const char* ssid = "";
const char* password = "";
// REDDIT
const char* host = "www.reddit.com";
const int port = 443;
const char fingerprint[] = "77:C7:6C:11:70:33:25:EE:F0:6C:3B:E3:0F:15:C2:CB:2A:73:7A:56:F3:40:FD:76:29:1E:06:CB:0D:45:48:2C";

BIN
img/original_logo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

2
logo.h
View File

@@ -11,7 +11,7 @@
// * Output: Arduino Code
// * Draw Mode: Horizontal - 1 bit per pixel
const unsigned char logo [] PROGMEM = {
const unsigned char logo_225x225 [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,