|
|
@ -180,8 +180,6 @@ void wifiConnect() { |
|
|
|
IPAddress subnet = IPAddress(network.subnet); |
|
|
|
IPAddress gateway = IPAddress(network.gateway); |
|
|
|
|
|
|
|
Serial.println("millis(): " + String(millis())); |
|
|
|
|
|
|
|
ESP_LOGD(TAG, "previous dhcp: %lu s ago", getTimestamp() - network.last_dhcp); |
|
|
|
|
|
|
|
if ( ip != INADDR_NONE && dns != INADDR_NONE && gateway != INADDR_NONE && subnet != INADDR_NONE |
|
|
@ -214,8 +212,6 @@ void wifiConnect() { |
|
|
|
network.last_dhcp = getTimestamp(); |
|
|
|
} |
|
|
|
|
|
|
|
Serial.println("millis(): " + String(millis())); |
|
|
|
|
|
|
|
if(WiFi.status() == WL_CONNECTED) { |
|
|
|
ESP_LOGD("WiFi", "connected"); |
|
|
|
//ESP_LOGD("WiFi", (WiFi.localIP().toString().c_str()));
|
|
|
@ -673,7 +669,6 @@ void setup() |
|
|
|
esp_sleep_wakeup_cause_t wakeup_reason = esp_sleep_get_wakeup_cause(); |
|
|
|
++bootCount; |
|
|
|
ESP_LOGI(TAG, "Boot number: %d", bootCount); |
|
|
|
Serial.println("millis(): " + String(millis())); |
|
|
|
|
|
|
|
ESP_LOGD(TAG, "setup hardware and sensors"); |
|
|
|
|
|
|
@ -687,8 +682,6 @@ void setup() |
|
|
|
adcAttachPin(_VBAT); |
|
|
|
adcStart(_VBAT); |
|
|
|
|
|
|
|
Serial.println("millis(): " + String(millis())); |
|
|
|
|
|
|
|
#define BME_SDA 21 |
|
|
|
#define BME_SCL 22 |
|
|
|
Wire.begin(BME_SDA, BME_SCL); |
|
|
@ -698,8 +691,6 @@ void setup() |
|
|
|
ESP_LOGE(TAG, "Could not find a valid BME280 sensor, check wiring!"); |
|
|
|
} |
|
|
|
|
|
|
|
Serial.println("millis(): " + String(millis())); |
|
|
|
|
|
|
|
if (bme680.begin()) { |
|
|
|
sensors_active.bme680 = true; |
|
|
|
|
|
|
@ -714,8 +705,6 @@ void setup() |
|
|
|
ESP_LOGE(TAG, "Could not find a valid BME680 sensor, check wiring!"); |
|
|
|
} |
|
|
|
|
|
|
|
Serial.println("millis(): " + String(millis())); |
|
|
|
|
|
|
|
if (uv.begin()) { |
|
|
|
sensors_active.uv = true; |
|
|
|
|
|
|
@ -730,8 +719,6 @@ void setup() |
|
|
|
ESP_LOGW(TAG, "Failed to communicate with VEML6075 sensor, check wiring?"); |
|
|
|
} |
|
|
|
|
|
|
|
Serial.println("millis(): " + String(millis())); |
|
|
|
|
|
|
|
if (lightMeter.begin()) { |
|
|
|
sensors_active.light = true; |
|
|
|
lightMeter.setMTreg((byte) BH1750_DEFAULT_MTREG); |
|
|
@ -739,12 +726,8 @@ void setup() |
|
|
|
ESP_LOGW(TAG, "Failed to communicate with BH1750 sensor, check wiring?"); |
|
|
|
} |
|
|
|
|
|
|
|
Serial.println("millis(): " + String(millis())); |
|
|
|
|
|
|
|
//sds.begin(); // don't call begin, only messes with Serial
|
|
|
|
|
|
|
|
Serial.println("millis(): " + String(millis())); |
|
|
|
|
|
|
|
if (wakeup_reason == ESP_SLEEP_WAKEUP_UNDEFINED || bootCount == 1) { |
|
|
|
FirmwareVersionResult sds_fw = sds.queryFirmwareVersion(); |
|
|
|
if (sds_fw.isOk()) { |
|
|
@ -757,15 +740,11 @@ void setup() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Serial.println("millis(): " + String(millis())); |
|
|
|
|
|
|
|
// initialize e-paper display
|
|
|
|
SPI.begin(18, 19, 23, TFT_CS); // MISO is not connected to TFT_MISO!
|
|
|
|
display.init(0, false, false); |
|
|
|
display.setRotation(1); |
|
|
|
|
|
|
|
Serial.println("millis(): " + String(millis())); |
|
|
|
|
|
|
|
if (wakeup_reason == ESP_SLEEP_WAKEUP_UNDEFINED || bootCount == 1) { |
|
|
|
// wakeup not caused by deep sleep
|
|
|
|
display.clearScreen(); |
|
|
@ -779,7 +758,6 @@ void setup() |
|
|
|
} |
|
|
|
|
|
|
|
ESP_LOGD(TAG, "connecting to WiFi"); |
|
|
|
Serial.println("millis(): " + String(millis())); |
|
|
|
|
|
|
|
wifiConnect(); |
|
|
|
|
|
|
|