Compare commits

...

3 Commits

5 changed files with 33 additions and 23 deletions

View File

@ -32,10 +32,10 @@ public:
void setSettings_voc(float minchange, unsigned long senddelaymax, unsigned long readdelay);
void setSettings_co(float minchange, unsigned long senddelaymax, unsigned long readdelay);
void advertise(HomieNode& p_sensorNode);
void sensorloop_no2();
void sensorloop_c2h5oh();
void sensorloop_voc();
void sensorloop_co();
void sensorloop_no2(); // GM-102B Nitrogen Dioxide
void sensorloop_c2h5oh(); //GM-302B Ethyl Alcohol
void sensorloop_voc(); // GM-502B Volatile Organic Compounds
void sensorloop_co(); // GM-702B Carbon Monoxide
};

View File

@ -11,7 +11,7 @@ Sensor_Radar::Sensor_Radar(int pin)
void Sensor_Radar::init() //Things to be done during setup()
{
Serial.println("initializing Radar");
pinMode(radarpin, INPUT_PULLUP);
pinMode(radarpin, INPUT);
init_ok=true;
}
@ -49,7 +49,7 @@ void Sensor_Radar::sensorloop()
sensorNode->setProperty("radar").send(String("true"));
d.value=true;
}else{
Homie.getLogger() << "motion " << ": " << "false" << endl;
Homie.getLogger() << "radar " << ": " << "false" << endl;
sensorNode->setProperty("radar").send(String("false"));
d.value=false;
}

View File

@ -67,13 +67,15 @@ void Sensor_VL53L1X::sensorloop()
Serial.print(vl53l1x.ranging_data.ambient_count_rate_MCPS);
Serial.println();
*/
if (abs((int)d.lastsentvalue-d.value)>=d.minchange){ //int abs
_changed=true;
//&& VL53L1X::rangeStatusToString(vl53l1x->ranging_data.range_status)=="range valid"
if (abs((int)d.lastsentvalue-d.value)>=d.minchange ){ //int abs
if (vl53l1x->ranging_data.range_status==0) { // "0 is range valid"
_changed=true;
}
}
if (lastsentvalue_vl53l1x_status!=vl53l1x->ranging_data.range_status) { //sensor status changed
/*if (lastsentvalue_vl53l1x_status!=vl53l1x->ranging_data.range_status) { //sensor status changed
_changed=true;
}
}*/
d.lastreadtime=millis();
}

View File

@ -274,7 +274,7 @@ lib_deps =
pololu/VL53L1X @ ^1.3.0
#Flur Gas, motion
#Flur Gas, motion, etc
[env:sensoresp6]
platform = espressif8266 @ 2.5.0
board = d1_mini
@ -285,26 +285,34 @@ monitor_speed = 115200
build_flags =
-D SENSOR_MULTICHANNELGASGMXXX
-D SENSOR_MULTICHANNELGASGMXXX_no2_minchange=0.1
-D SENSOR_MULTICHANNELGASGMXXX_c2h5oh_minchange=0.1
-D SENSOR_MULTICHANNELGASGMXXX_voc_minchange=0.1
-D SENSOR_MULTICHANNELGASGMXXX_co_minchange=0.1
-D SENSOR_MULTICHANNELGASGMXXX_no2_senddelaymax=600000
-D SENSOR_MULTICHANNELGASGMXXX_c2h5oh_senddelaymax=600000
-D SENSOR_MULTICHANNELGASGMXXX_voc_senddelaymax=600000
-D SENSOR_MULTICHANNELGASGMXXX_co_senddelaymax=600000
-D SENSOR_MULTICHANNELGASGMXXX_no2_minchange=0.3
-D SENSOR_MULTICHANNELGASGMXXX_c2h5oh_minchange=0.3
-D SENSOR_MULTICHANNELGASGMXXX_voc_minchange=0.3
-D SENSOR_MULTICHANNELGASGMXXX_co_minchange=0.3
-D SENSOR_MULTICHANNELGASGMXXX_no2_senddelaymax=1000*60*60
-D SENSOR_MULTICHANNELGASGMXXX_c2h5oh_senddelaymax=1000*60*60
-D SENSOR_MULTICHANNELGASGMXXX_voc_senddelaymax=1000*60*60
-D SENSOR_MULTICHANNELGASGMXXX_co_senddelaymax=1000*60*60
-D SENSOR_HTU21D
-D dataHTU21D_temperature_minchange=0.2
-D dataHTU21D_temperature_minchange=0.3
-D dataHTU21D_temperature_senddelaymax=1000*60*60
-D dataHTU21D_humidity_minchange=1.0
-D dataHTU21D_humidity_senddelaymax=1000*60*60
-D SENSOR_HCSR501
-D SENSOR_HCSR501_PIN=D6
-D SENSOR_BH1750
-D dataBH1750_minchange=10.0
-D dataBH1750_senddelaymax=1000*60*5
lib_deps =
https://github.com/Seeed-Studio/Seeed_Arduino_MultiGas
adafruit/Adafruit HTU21DF Library @ ^1.0.5
ArduinoJson@6.16.1 #dependency of homie. using older version because of "ambiguous overload for operator|" error
Homie@3.0.0
claws/BH1750@1.1.4
#3D Printer
[env:sensoresp3dprinter]

View File

@ -162,7 +162,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
#ifndef SENSOR_HCSR501_senddelaymax
#define SENSOR_HCSR501_senddelaymax 1000*60*10
#endif
#ifndef SENSOR_HCSR501_readdelayML8511
#ifndef SENSOR_HCSR501_readdelay
#define SENSOR_HCSR501_readdelay 100
#endif
#endif
@ -174,7 +174,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
#ifndef SENSOR_RADAR_senddelaymax
#define SENSOR_RADAR_senddelaymax 1000*60*10
#endif
#ifndef SENSOR_RADAR_readdelayML8511
#ifndef SENSOR_RADAR_readdelay
#define SENSOR_RADAR_readdelay 100
#endif
#endif