diff --git a/src/main.cpp b/src/main.cpp index 186d65e..1cf458a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -85,26 +85,23 @@ void printValues() { Serial.println(); } - +/** + * \brief Setup function + * + * is run once on startup + */ void setup() { Serial.begin(115200); + ESP_LOGD(TAG, "setup hardware and sensors"); + // initialize LED digital pin as an output. pinMode(LED_BUILTIN, OUTPUT); - Serial.println("setup"); - // initialize e-paper display SPI.begin(18, 19, 23, TFT_CS); display.init(); - Serial.println("display init done"); Serial.flush(); - - display.clearScreen(); - display.refresh(); - - helloWorld(); - display.powerOff(); #define BME_SDA 21 #define BME_SCL 22 @@ -123,6 +120,15 @@ void setup() sds.begin(); + display.clearScreen(); + display.refresh(); + + ESP_LOGD(TAG, "displaying welcome screen"); + helloWorld(); + display.powerOff(); + + ESP_LOGD(TAG, "starting WiFi"); + WiFi.setHostname("esp32-weatherstation"); wifiMulti.addAP(WIFI_SSID, WIFI_PASSWD); wifiMulti.addAP(WIFI_SSID2, WIFI_PASSWD2); @@ -134,17 +140,24 @@ void setup() Serial.println(WiFi.localIP()); } + ESP_LOGD(TAG, "trying to fetch over-the-air update"); XD0OTA ota("esp32-weatherstation"); ota.update(); + ESP_LOGD(TAG, "connecting to MQTT"); mqtt.begin(); + ESP_LOGD(TAG, "setup done"); } +/** + * \brief Arduino main loop + */ void loop() { - Serial.println("loop"); - + ESP_LOGD(TAG, "loop()"); + + /* Do an e-paper display refresh every 2 minutes */ if (millis() - lastDisplayUpdate >= 2*60*1000) { lastDisplayUpdate = millis(); display.setFullWindow(); diff --git a/src/network/XD0MQTT.h b/src/network/XD0MQTT.h index 18ace64..83be9f5 100644 --- a/src/network/XD0MQTT.h +++ b/src/network/XD0MQTT.h @@ -1,3 +1,13 @@ +/** + * @file XD0MQTT.h + * + * @brief MQTT via xd0.de broker + * + * @author Hendrik Langer + * @version 0.2 + * + */ + #ifndef _XD0MQTT_H #define _XD0MQTT_H diff --git a/src/network/XD0OTA.h b/src/network/XD0OTA.h index c533dc7..b0554af 100644 --- a/src/network/XD0OTA.h +++ b/src/network/XD0OTA.h @@ -1,3 +1,13 @@ +/** + * @file XD0OTA.h + * + * @brief https Over-the-Air updates via xd0.de + * + * @author Hendrik Langer + * @version 0.2 + * + */ + #ifndef _XD0OTA_H #define _XD0OTA_H