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