Browse Source

documentation

ir
Hendrik Langer 5 years ago
parent
commit
22122d1978
  1. 37
      src/main.cpp
  2. 10
      src/network/XD0MQTT.h
  3. 10
      src/network/XD0OTA.h

37
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();

10
src/network/XD0MQTT.h

@ -1,3 +1,13 @@
/**
* @file XD0MQTT.h
*
* @brief MQTT via xd0.de broker
*
* @author Hendrik Langer <hendrik+dev@xd0.de>
* @version 0.2
*
*/
#ifndef _XD0MQTT_H
#define _XD0MQTT_H

10
src/network/XD0OTA.h

@ -1,3 +1,13 @@
/**
* @file XD0OTA.h
*
* @brief https Over-the-Air updates via xd0.de
*
* @author Hendrik Langer <hendrik+dev@xd0.de>
* @version 0.2
*
*/
#ifndef _XD0OTA_H
#define _XD0OTA_H

Loading…
Cancel
Save