Compare commits

..

No commits in common. "a8b751f6623aad84e0d904f67576937507624af5" and "be57f730b414ef56391ea3b4f5200ba33dd50710" have entirely different histories.

5 changed files with 19 additions and 13 deletions

View File

@ -40,7 +40,7 @@ void Sensor_LDR::sensorloop()
bool _changed=false; bool _changed=false;
if (millis() >= (d.lastreadtime+d.readdelay)) { if (millis() >= (d.lastreadtime+d.readdelay)) {
d.value = get_lux(in_ldr, out_ldr, SENSOR_LDR_ARRAYSIZE)/10.0; //read light level in lux d.value = get_lux(in_ldr, out_ldr, LDR_ARRAYSIZE)/10.0; //read light level in lux
if (fabs(d.lastsentvalue-d.value)>=d.minchange){ if (fabs(d.lastsentvalue-d.value)>=d.minchange){
_changed=true; _changed=true;
} }

View File

@ -17,15 +17,18 @@ private:
struct sensordata data; //struct values are changed in setup() struct sensordata data; //struct values are changed in setup()
int get_lux(const unsigned int* _in, const unsigned int* _out, byte size); int get_lux(const unsigned int* _in, const unsigned int* _out, byte size);
//wemos d1 mini, black wire of ldr connects to A0 with 10k to gnd. red wire connects with 1k to gnd and 2k2 to 3v3 //wemos d1 mini, black wire of ldr connects to A0 with 10k to gnd. red wire connects with 1k to gnd and 2k2 to 3v3
#ifdef SENSOR_LDR_CALIB_1 #ifdef SENSOR_LDR_CALIB_1
#define SENSOR_LDR_ARRAYSIZE 18 #define LDRARRAYSIZE 18
const unsigned int out_ldr[18] = {0, 30, 50, 60, 130, 170, 250, 420, 780, 1300,2600, 5000, 5350, 7700, 10900, 12000, 17000,20000}; // x10 (i.e. gets later divided by 10) const unsigned int out_ldr[18] = {0, 30, 50, 60, 130, 170, 250, 420, 780, 1300,2600, 5000, 5350, 7700, 10900, 12000, 17000,20000}; // x10 (i.e. gets later divided by 10)
const unsigned int in_ldr[18] = {0, 12, 100, 150, 350, 400, 450, 650, 730, 780, 840, 930, 948 , 970, 993, 1005, 1019, 1023}; // 0 - 1023 const unsigned int in_ldr[18] = {0, 12, 100, 150, 350, 400, 450, 650, 730, 780, 840, 930, 948 , 970, 993, 1005, 1019, 1023}; // 0 - 1023
#endif #endif
bool init_ok; bool init_ok;
public: public:
Sensor_LDR(int p); Sensor_LDR(int p);

View File

@ -29,6 +29,8 @@ private:
unsigned long lastread_sds018=0; //to save last read time for both readings unsigned long lastread_sds018=0; //to save last read time for both readings
void readSDS018();
void loop_pm25(); void loop_pm25();
void loop_pm10(); void loop_pm10();
void readSDS018(); void readSDS018();

View File

@ -174,9 +174,9 @@ monitor_speed = 115200
build_flags = build_flags =
-D SENSOR_DHT22 -D SENSOR_DHT22
-D SENSOR_DHT22_PIN=D7 -D DHTPIN=D7
-D SENSOR_DHT22_temperature_minchange=0.2 -D dataDHT22_temperature_minchange=0.2
-D SENSOR_DHT22_humidity_minchange=1.0 -D dataDHT22_humidity_minchange=1.0
-D SENSOR_HCSR501 -D SENSOR_HCSR501
-D SENSOR_HCSR501_PIN=D6 -D SENSOR_HCSR501_PIN=D6
@ -204,8 +204,8 @@ monitor_speed = 115200
build_flags = build_flags =
-D SENSOR_DHT22 -D SENSOR_DHT22
-D SENSOR_DHT22_PIN=D7 -D SENSOR_DHT22_PIN=D7
-D SENSOR_DHT22_temperature_minchange=0.2 -D dataDHT22_temperature_minchange=0.2
-D SENSOR_DHT22_humidity_minchange=1.0 -D dataDHT22_humidity_minchange=1.0
-D SENSOR_HCSR501 -D SENSOR_HCSR501
-D SENSOR_HCSR501_PIN=D0 -D SENSOR_HCSR501_PIN=D0
@ -241,9 +241,9 @@ monitor_speed = 115200
build_flags = build_flags =
-D SENSOR_DHT22 -D SENSOR_DHT22
-D SENSOR_DHT22_PIN=D7 -D DHTPIN=D7
-D SENSOR_DHT22_temperature_minchange=0.2 -D dataDHT22_temperature_minchange=0.2
-D SENSOR_DHT22_humidity_minchange=1.0 -D dataDHT22_humidity_minchange=1.0
-D SENSOR_HCSR501 -D SENSOR_HCSR501
-D SENSOR_HCSR501_PIN=D6 -D SENSOR_HCSR501_PIN=D6

View File

@ -837,7 +837,8 @@ void loopHandler() {
#endif #endif
#ifdef SENSOR_SDS018 #ifdef SENSOR_SDS018
sensor_sds018.sensorloop(); loop_SDS018_pm25();
loop_SDS018_pm10();
#endif #endif
#ifdef SENSOR_TCS34725 #ifdef SENSOR_TCS34725