Skip to content

Commit

Permalink
fixed defaultConfig.h file
Browse files Browse the repository at this point in the history
  • Loading branch information
bfaliszek committed Feb 6, 2020
1 parent 98fe949 commit 2e4b803
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 75 deletions.
67 changes: 2 additions & 65 deletions Smogomierz.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
//#define ASYNC_WEBSERVER_ON // - EXPERIMENTAL - FOR ESP32 ONLY!
#endif


/*
ESP8266
Expand All @@ -37,6 +36,7 @@
SDS011/21: VIN - 5V; GND - G; TX - D1; RX - D2
Sensirion SPS30: VIN - 5V; GND - G; TX - D1; RX - D2
ESP32
Podłączenie czujnikow dla ESP32:
Expand Down Expand Up @@ -144,22 +144,19 @@
#endif
#include <ESP8266mDNS.h>
#ifndef ASYNC_WEBSERVER_ON

#include <ESP8266HTTPUpdateServer.h>
#endif
#include <SoftwareSerial.h>
#elif defined ARDUINO_ARCH_ESP32 // Arduino core for the ESP32 - 1.0.4-rc1 or later // at 1.0.3 autoupdate doesn't work !!!
#include <WiFi.h>
#include <WiFiClient.h>
#include <ESPmDNS.h>

#ifdef ASYNC_WEBSERVER_ON
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
#else
#include <WebServer.h>
#endif

#include <Update.h>
#include <HTTPClient.h>
#include <HTTPUpdate.h>
Expand Down Expand Up @@ -307,9 +304,7 @@ AsyncWebServer server(80);
#else
#ifdef ARDUINO_ARCH_ESP8266
ESP8266WebServer WebServer(80);
#ifndef DUSTSENSOR_SPS30
ESP8266HTTPUpdateServer httpUpdater;
#endif
#elif defined ARDUINO_ARCH_ESP32
WebServer WebServer(80);
#endif
Expand Down Expand Up @@ -522,7 +517,6 @@ void setup() {
#elif defined DUSTSENSOR_SPS30
if (!strcmp(DUST_MODEL, "SPS30")) {
Serial.println(F("Trying to connect to SPS30..."));

// set driver debug level
sps30.EnableDebugging(SPS30_DEBUG);

Expand Down Expand Up @@ -743,9 +737,7 @@ void setup() {
WebServer.onNotFound(handle_root);

#ifdef ARDUINO_ARCH_ESP8266
#ifndef DUSTSENSOR_SPS30
httpUpdater.setup(&WebServer, "/update");
#endif
#elif defined ARDUINO_ARCH_ESP32
/*handling uploading firmware file */
WebServer.on("/update", HTTP_POST, []() {
Expand Down Expand Up @@ -821,7 +813,6 @@ void loop() {
}
#endif
// DUST SENSOR refresh data - END

//yield();

#ifndef ASYNC_WEBSERVER_ON
Expand Down Expand Up @@ -881,7 +872,6 @@ void loop() {
#ifndef ASYNC_WEBSERVER_ON
WebServer.handleClient();
#endif

previous_2sec_Millis = millis();
}
if (LUFTDATEN_ON or AQI_ECO_ON or AIRMONITOR_ON or SMOGLIST_ON) {
Expand Down Expand Up @@ -1356,56 +1346,6 @@ void takeNormalnPMMeasurements() {
#elif defined DUSTSENSOR_SPS30
read_sps30_data();

pmMeasurements[iPM][0] = int(calib * SPS30_PM1);
pmMeasurements[iPM][1] = int(calib * SPS30_PM25);
pmMeasurements[iPM][2] = int(calib * SPS30_PM10);
pmMeasurements[iPM][3] = int(calib * SPS30_PM4);
#else // If no dust sensor has been defined - use DUSTSENSOR_PMS5003_7003_BME280_0x76
pmMeasurements[iPM][0] = int(calib * data.PM_AE_UG_1_0);
pmMeasurements[iPM][1] = int(calib * data.PM_AE_UG_2_5);
pmMeasurements[iPM][2] = int(calib * data.PM_AE_UG_10_0);
=======
pmMeasurements[iPM][0] = int(calib * data.PM_AE_UG_1_0);
pmMeasurements[iPM][1] = int(calib * data.PM_AE_UG_2_5);
pmMeasurements[iPM][2] = int(calib * data.PM_AE_UG_10_0);
#elif defined DUSTSENSOR_SDS011_21
#ifdef ARDUINO_ARCH_ESP8266
PmResult SDSdata = sds.queryPm();
delay(1000);
if (SDSdata.isOk()) {
pmMeasurements[iPM][0] = int(calib * 0);
pmMeasurements[iPM][1] = int(calib * SDSdata.pm25);
pmMeasurements[iPM][2] = int(calib * SDSdata.pm10);
} else {
Serial.println("\nCould not read values from SDS sensor :( ");
}
#elif defined ARDUINO_ARCH_ESP32
err = my_sds.read(&SDSpm25, &SDSpm10);
if (!err) {
pmMeasurements[iPM][0] = int(calib * 0);
pmMeasurements[iPM][1] = int(calib * SDSpm25);
pmMeasurements[iPM][2] = int(calib * SDSpm10);
} else {
Serial.println("\nCould not read values from SDS sensor :( ");
}
#endif
#elif defined DUSTSENSOR_HPMA115S0
if (hpma115S0.ReadParticleMeasurement(&hpma115S0_pm25, &hpma115S0_pm10)) {
if (hpma115S0_pm25 == 0 and hpma115S0_pm10 == 0) {
delay(100);
hpma115S0.ReadParticleMeasurement(&hpma115S0_pm25, &hpma115S0_pm10);
pmMeasurements[iPM][0] = int(calib * 0);
pmMeasurements[iPM][1] = int(calib * hpma115S0_pm25);
pmMeasurements[iPM][2] = int(calib * hpma115S0_pm10);
} else {
pmMeasurements[iPM][0] = int(calib * 0);
pmMeasurements[iPM][1] = int(calib * hpma115S0_pm25);
pmMeasurements[iPM][2] = int(calib * hpma115S0_pm10);
}
}
#elif defined DUSTSENSOR_SPS30
read_sps30_data();

pmMeasurements[iPM][0] = int(calib * SPS30_PM1);
pmMeasurements[iPM][1] = int(calib * SPS30_PM25);
pmMeasurements[iPM][2] = int(calib * SPS30_PM10);
Expand Down Expand Up @@ -1450,7 +1390,6 @@ void takeSleepPMMeasurements() {
#ifndef ASYNC_WEBSERVER_ON
WebServer.handleClient();
#endif

previous_2sec_Millis = millis();
}
previous_2sec_Millis = 0;
Expand All @@ -1466,6 +1405,7 @@ void takeSleepPMMeasurements() {
takeNormalnPMMeasurements();
counterNM1++;
}

previous_2sec_Millis = millis();
}
#ifndef ASYNC_WEBSERVER_ON
Expand Down Expand Up @@ -1544,7 +1484,6 @@ void takeSleepPMMeasurements() {
unsigned long current_2sec_Millis = millis();
previous_2sec_Millis = millis();
while (previous_2sec_Millis - current_2sec_Millis <= TwoSec_interval * 8) {

#ifndef ASYNC_WEBSERVER_ON
WebServer.handleClient();
#endif
Expand All @@ -1564,7 +1503,6 @@ void takeSleepPMMeasurements() {
}
previous_2sec_Millis = millis();
}

#ifndef ASYNC_WEBSERVER_ON
WebServer.handleClient();
#endif
Expand All @@ -1588,7 +1526,6 @@ void takeSleepPMMeasurements() {
unsigned long current_2sec_Millis = millis();
previous_2sec_Millis = millis();
while (previous_2sec_Millis - current_2sec_Millis <= TwoSec_interval * 8) {

#ifndef ASYNC_WEBSERVER_ON
WebServer.handleClient();
#endif
Expand Down
6 changes: 1 addition & 5 deletions defaultConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int THINGSPEAK_CHANNEL_ID = 0;
char THINGSPEAK_READ_API_KEY[32] = "READ_API_KEY";

bool INFLUXDB_ON = false;
char INFLUXDB_VERSION[16] = "1"; // 1 (for 1.x version) or 2 for 2.0 or later
char INFLUXDB_VERSION[16] = "1"; // 1 (for 1.x version) or 2 for 2.0 or later
char INFLUXDB_HOST[128] = "INFLUXDB_ADRESS";
uint16_t INFLUXDB_PORT = 8086;
char INFLUXDB_DATABASE[64] = "mydb";
Expand Down Expand Up @@ -60,10 +60,6 @@ bool AQI_ECO_ON = false;
char AQI_ECO_HOST[128] = "???.aqi.eco";
char AQI_ECO_PATH[64] = "/u/???";

bool AQI_ECO_ON = false;
char AQI_ECO_HOST[255] = "???.aqi.eco";
char AQI_ECO_PATH[255] = "/u/???";

int SENDING_FREQUENCY = 3;
int SENDING_DB_FREQUENCY = 3;
bool DEEPSLEEP_ON = false;
Expand Down
5 changes: 0 additions & 5 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ extern bool AQI_ECO_ON;
extern char AQI_ECO_HOST[128];
extern char AQI_ECO_PATH[64];

extern bool AQI_ECO_ON;
extern char AQI_ECO_HOST[255];
extern char AQI_ECO_PATH[255];

extern int SENDING_FREQUENCY;
extern int SENDING_DB_FREQUENCY;
extern bool DEEPSLEEP_ON;
Expand Down Expand Up @@ -97,5 +93,4 @@ const char HARDWAREVERSION[] = "1.0 - ESP8266";
#elif defined(ARDUINO_ARCH_ESP32)
const char SOFTWAREVERSION[] = "2.7.5 build " __TIME__ " " __DATE__;
const char HARDWAREVERSION[] = "2.0 - ESP32";

#endif

0 comments on commit 2e4b803

Please sign in to comment.