Minor adjustments
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user