From f0cf258ebd8ee75a3cebb635a13bfff9ec4770ed Mon Sep 17 00:00:00 2001 From: sqozz Date: Sat, 17 Nov 2018 21:59:00 +0100 Subject: [PATCH] Fix mostly comments --- ota_test.ino | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ota_test.ino b/ota_test.ino index ba41c75..1e7deb4 100644 --- a/ota_test.ino +++ b/ota_test.ino @@ -9,6 +9,9 @@ #include #include + +// TODO: figure out how these freakin summertime works +// best would be some kind of automatic change #define DEVICE_NAME "OTA TEST DEVICE" #define TZ 1 // (utc+) TZ in hours #define DST_MN 0 // use 60mn for summer time in some countries @@ -21,6 +24,7 @@ BearSSL::CertStore certStore; WiFiManager wifiManager; String config_password; +// Copy&Pasted code from the esp core example based on BeadSSL class SPIFFSCertStoreFile : public BearSSL::CertStoreFile { public: SPIFFSCertStoreFile(const char *name) { @@ -94,8 +98,7 @@ void setup() { int numCerts = certStore.initCertStore(&certs_idx, &certs_ar); Serial.print(F("Number of CA certs read: ")); Serial.println(numCerts); if (numCerts == 0) { - Serial.println(F("No certs found. Did you run certs-from-mozill.py and upload the SPIFFS directory before running?")); - // TODO: bailout? + Serial.println(F("No certs found. HTTPS requests will most likely fail.")); } if (SPIFFS.exists("/config_password.txt")) { @@ -108,13 +111,12 @@ void setup() { } wifiManager.autoConnect(DEVICE_NAME, config_password.c_str()); } else { - Serial.println(F("Failed to find file. Upload config_password.txt with the configuration password included")); - // TODO: bailout? + Serial.println(F("Failed to find AP password file in SPIFFS. Refusing to set up the wifi manager in an usecure way. Upload config_password.txt with the configuration password included")); } } void loop() { - checkUpdate(); + checkUpdate(); // Checks for updates and applies it if available delay(10000); } @@ -140,9 +142,6 @@ void checkUpdate() { ESPhttpUpdate.setLedPin(LED_BUILTIN, LOW); t_httpUpdate_return ret = ESPhttpUpdate.update(client, "https://iotupdates.companioncu.be/update"); - // Or: - //t_httpUpdate_return ret = ESPhttpUpdate.update(client, "server", 443, "file.bin"); - switch (ret) { case HTTP_UPDATE_FAILED: