move most of cpp and header files

This commit is contained in:
interfisch 2023-02-01 20:04:46 +01:00
parent 02c39822bc
commit 46ab4f7dbb
23 changed files with 93 additions and 34 deletions

View File

@ -1,4 +1,4 @@
#ifdef SENSOR_ANEMOMETER
#include "sensor_anemometer.h"
//uses ATS177 Latched hall sensor for rotation sensing
@ -66,3 +66,5 @@ void Sensor_Anemometer::sensorloop()
}
#endif

View File

@ -1,3 +1,4 @@
#ifndef SENSOR_LDR_H
#define SENSOR_LDR_H
@ -40,3 +41,4 @@ public:
#endif

View File

@ -1,3 +1,4 @@
#ifdef SENSOR_MHZ19B
#include "sensor_mhz19b.h"
@ -153,4 +154,6 @@ int Sensor_MHZ19B::mhz19_readValue_reimplemented(Stream *_streamRef, MHZ19 *_mhz
void Sensor_MHZ19B::calibrateZero() {
mhz19->calibrateZero();
}
}
#endif

View File

@ -31,7 +31,6 @@ private:
SoftwareSerial *mhz19_swSerial;
#define BAUD_RATE_MHZ19 9600
#define MHZ19CALIBRATIONTOPIC

View File

@ -1,4 +1,4 @@
#ifdef SENSOR_RAINGAUGE
#include "sensor_raingauge.h"
//uses ATS177 Latched hall sensor for rotation sensing
@ -79,3 +79,5 @@ void Sensor_Raingauge::sensorloop()
}
#endif

View File

@ -1,5 +1,4 @@
//copied from example code: https://github.com/adafruit/Adafruit_TCS34725/blob/master/examples/tcs34725autorange/tcs34725autorange.ino
#ifdef SENSOR_TCS34725
#ifndef _TCS34725_AGC_H_
#define _TCS34725_AGC_H_
@ -47,5 +46,3 @@ public:
};
#endif
#endif

View File

@ -376,7 +376,15 @@ build_flags =
-D dataHTU21D_humidity_minchange=1.0
-D dataHTU21D_humidity_senddelaymax=1000*60*30
-D SENSOR_TCS34725
-D SENSOR_TCS34725_LUX_minchange=500
-D SENSOR_TCS34725_LUX_senddelaymax=1000*60*1
-D SENSOR_TCS34725_COLORTEMP_minchange=100
-D SENSOR_TCS34725_LUXFACTOR=0.3 #measured with luxmeter. with half tennis ball was 1.7ev less. 1/2^1.7=0,3078
lib_deps =
ArduinoJson@6.16.1 #dependency of homie. using older version because of "ambiguous overload for operator|" error
Homie@3.0.0
adafruit/Adafruit HTU21DF Library @ ^1.0.5
adafruit/Adafruit HTU21DF Library @ ^1.0.5
https://github.com/adafruit/Adafruit_TCS34725#1.3.5

View File

@ -32,7 +32,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
#ifdef SENSOR_DHT22
#include "sensor_dht22.cpp"
#include "sensor_dht22.h"
Sensor_DHT22 sensor_dht22(SENSOR_DHT22_PIN);
#ifndef SENSOR_DHT22_temperature_minchange
@ -58,7 +58,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
#ifdef SENSOR_BMP180
#include "sensor_bmp180.cpp"
#include "sensor_bmp180.h"
Sensor_BMP180 sensor_bmp180;
#ifndef SENSOR_BMP180_temperature_minchange
@ -83,7 +83,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
#endif
#ifdef SENSOR_HTU21D
#include "sensor_htu21d.cpp"
#include "sensor_htu21d.h"
Sensor_HTU21D sensor_htu21d;
#ifndef SENSOR_HTU21D_temperature_minchange
@ -110,7 +110,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
#ifdef SENSOR_SHT31
#include "sensor_sht31.cpp"
#include "sensor_sht31.h"
Sensor_SHT31 sensor_sht31;
#ifndef SENSOR_SHT31_temperature_minchange
@ -136,7 +136,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
#endif
#ifdef SENSOR_HS1101
#include "sensor_hs1101.cpp"
#include "sensor_hs1101.h"
Sensor_HS1101 sensor_hs1101(SENSOR_HS1101_PIN);
#ifndef SENSOR_HS1101_humidity_minchange
@ -152,7 +152,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
#endif
#ifdef SENSOR_BH1750
#include "sensor_bh1750.cpp"
#include "sensor_bh1750.h"
Sensor_BH1750 sensor_bh1750;
#ifndef SENSOR_BH1750_light_minchange
@ -167,7 +167,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
#endif
#ifdef SENSOR_ML8511
#include "sensor_ml8511.cpp"
#include "sensor_ml8511.h"
Sensor_ML8511 sensor_ml8511(SENSOR_ML8511_PIN);
#ifndef SENSOR_ML8511_minchange
@ -183,7 +183,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
#ifdef SENSOR_HCSR501
#include "sensor_hcsr501.cpp"
#include "sensor_hcsr501.h"
Sensor_HCSR501 sensor_hcsr501(SENSOR_HCSR501_PIN);
#ifndef SENSOR_HCSR501_senddelaymax
@ -195,7 +195,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
#endif
#ifdef SENSOR_RADAR
#include "sensor_radar.cpp"
#include "sensor_radar.h"
Sensor_Radar sensor_radar(SENSOR_RADAR_PIN);
#ifndef SENSOR_RADAR_senddelaymax
@ -207,7 +207,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
#endif
#ifdef SENSOR_LDR
#include "sensor_ldr.cpp"
#include "sensor_ldr.h"
Sensor_LDR sensor_ldr(SENSOR_LDR_PIN);
#ifndef SENSOR_LDR_minchange
@ -259,7 +259,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
#ifdef SENSOR_SDS018
#include "sensor_sds018.cpp"
#include "sensor_sds018.h"
Sensor_SDS018 sensor_sds018(SENSOR_SDS018_SERIAL_RX,SENSOR_SDS018_SERIAL_TX);
#ifndef SENSOR_SDS018_PM10_minchange
#define SENSOR_SDS018_PM10_minchange 10.0
@ -282,7 +282,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
#endif
#ifdef SENSOR_TCS34725
#include "sensor_tcs34725.cpp"
#include "sensor_tcs34725.h"
Sensor_TCS34725 sensor_tcs34725;
#ifndef SENSOR_TCS34725_LUX_minchange
#define SENSOR_TCS34725_LUX_minchange 500
@ -305,7 +305,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
#endif
#ifdef SENSOR_VL53L1X
#include "sensor_vl53l1x.cpp"
#include "sensor_vl53l1x.h"
Sensor_VL53L1X sensor_vl53l1x;
#ifndef SENSOR_VL53L1X_minchange
#define SENSOR_VL53L1X_minchange 100
@ -321,10 +321,11 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
#ifdef SENSOR_ANEMOMETER
void ICACHE_RAM_ATTR interrupt_anemometer();
#include "sensor_anemometer.cpp"
//Sensor_Anemometer_Instance = new Sensor_Anemometer(SENSOR_Anemometer_PIN);
Sensor_Anemometer sensor_anemometer(SENSOR_Anemometer_PIN);
void ICACHE_RAM_ATTR interrupt_anemometer()
{
if (millis() - sensor_anemometer.anemometer_lastpulse_fordebounce >= ANEMOMETER_DEBOUNCETIME) { //ignore if pulse came too fast
@ -333,6 +334,9 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
}
}
#ifndef SENSOR_Anemometer_minchange
#define SENSOR_Anemometer_minchange 0.25
#endif
@ -345,12 +349,14 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
#endif
#ifdef SENSOR_RAINGAUGE
//uses ATS177 Latched Hall Sensor for rauge flip sensing
void ICACHE_RAM_ATTR interrupt_raingauge();
#include "sensor_raingauge.cpp"
Sensor_Raingauge sensor_raingauge(SENSOR_Raingauge_PIN);
void ICACHE_RAM_ATTR interrupt_raingauge()
{
if (millis() - sensor_raingauge.raingauge_lastpulse_fordebounce >= RAINGAUGE_DEBOUNCETIME) { //ignore if pulse came too fast
@ -374,7 +380,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
#ifdef SENSOR_MULTICHANNELGASGMXXX
#include "sensor_multichannelgasgmxxx.cpp"
#include "sensor_multichannelgasgmxxx.h"
Sensor_MULTICHANNELGASGMXXX sensor_multichannelgasgmxxx;
#ifndef SENSOR_MULTICHANNELGASGMXXX_no2_minchange

View File

@ -1,3 +1,4 @@
#ifdef SENSOR_BH1750
//Connect SCL to D1, SDA to D2, GND and 3v3
#include "sensor_bh1750.h"
@ -63,3 +64,5 @@ void Sensor_BH1750::sensorloop()
}
}
}
#endif

View File

@ -1,3 +1,4 @@
#ifdef SENSOR_BMP180
//Connect SCL to D1, SDA to D2, GND and 3v3
#include "sensor_bmp180.h"
@ -103,3 +104,6 @@ void Sensor_BMP180::loop_BMP180_pressure()
d.lastsent=millis();
}
}
#endif

View File

@ -1,3 +1,4 @@
#ifdef SENSOR_DHT22
// Digital pin connected to the DHT sensor. // dht pins: 1=power, 2=data, 3=NC, 4=GND. 10k from data to power needed
#include "sensor_dht22.h"
@ -108,3 +109,5 @@ void Sensor_DHT22::loop_DHT22_humidity()
}
}
#endif

View File

@ -1,3 +1,4 @@
#ifdef SENSOR_HCSR501
// PIR Sensors HC-SR501
// pir sensor needs 5v through an inductor for filtering. output level is 3.3v
// 100nF capacitor should be soldered between pins 12 and 13 of BISS0001 to stop interference from esp causing false triggers (in some setups). source: https://www.letscontrolit.com/forum/viewtopic.php?t=671
@ -65,3 +66,6 @@ void Sensor_HCSR501::sensorloop()
}
#endif

View File

@ -1,4 +1,4 @@
#ifdef SENSOR_HS1101
#include "sensor_hs1101.h"
@ -101,4 +101,6 @@ int Sensor_HS1101::get_mapped(const unsigned int* _in, const unsigned int* _out,
// interpolate in the right segment for the rest
return map(val, _in[pos-1], _in[pos], _out[pos-1], _out[pos]);
}
}
#endif

View File

@ -1,3 +1,4 @@
#ifdef SENSOR_HTU21D
//Connect SCL to D1, SDA to D2, GND and 3v3
#include "sensor_htu21d.h"
#include <Adafruit_HTU21DF.h>
@ -106,4 +107,6 @@ void Sensor_HTU21D::loop_HTU21D_humidity()
d.lastsent=millis();
}
}
}
#endif

View File

@ -1,3 +1,5 @@
#ifdef SENSOR_LDR
// High/Low Output LDR Sensor
// For example: RCWL-0516 (needs 5v input (gnd, vin), 3.3v output level. high for 2seconds when movement detected)
#include "sensor_ldr.h"
@ -86,4 +88,5 @@ int Sensor_LDR::get_lux(const unsigned int* _in, const unsigned int* _out, byte
// interpolate in the right segment for the rest
return map(val, _in[pos-1], _in[pos], _out[pos-1], _out[pos]);
}
}
#endif

View File

@ -1,3 +1,4 @@
#ifdef SENSOR_ML8511
//ML8511 UV Sensor outputs an analog voltage. ML8511PIN needs to be an ADC pin
//value as uvIntensity (mW/cm^2)
#include "sensor_ml8511.h"
@ -77,4 +78,5 @@ float Sensor_ML8511::getUV_ML8511(int pin) {
float Sensor_ML8511::mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
}
#endif

View File

@ -1,3 +1,4 @@
#ifdef SENSOR_MULTICHANNELGASGMXXX
//Connect SCL to D1, SDA to D2, GND and 3v3
#include "sensor_multichannelgasgmxxx.h"
@ -177,4 +178,6 @@ val = gas.measure_VOC(); Serial.print("VOC: "); Serial.print(val); Serial.print(
Serial.print(gas.calcVol(val)); Serial.println("V");
val = gas.measure_CO(); Serial.print("CO: "); Serial.print(val); Serial.print(" eq ");
Serial.print(gas.calcVol(val)); Serial.println("V");
*/
*/
#endif

View File

@ -1,3 +1,4 @@
#ifdef SENSOR_RADAR
// High/Low Output Radar Sensor
// For example: RCWL-0516 (needs 5v input (gnd, vin), 3.3v output level. high for 2seconds when movement detected)
#include "sensor_radar.h"
@ -59,3 +60,5 @@ void Sensor_Radar::sensorloop()
}
#endif

View File

@ -1,3 +1,4 @@
#ifdef SENSOR_SDS018
#include "sensor_sds018.h"
// SDS018 example: https://github.com/crystaldust/sds018/blob/master/sds018.ino
@ -154,4 +155,5 @@ void Sensor_SDS018::readSDS018()
sds018_swSerial->flush();
}
}
}
#endif

View File

@ -1,3 +1,4 @@
#ifdef SENSOR_SHT31
//Connect SCL to D1, SDA to D2, GND and 3v3
#include "sensor_sht31.h"
@ -127,4 +128,6 @@ void Sensor_SHT31::checkHeater(float humidity) {
last_sent_heaterstatus=heaterstatus;
}
}
}
#endif

View File

@ -1,4 +1,4 @@
#ifdef SENSOR_TCS34725
#include "sensor_tcs34725.h"
//#include "Adafruit_TCS34725.h"
//Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_700MS, TCS34725_GAIN_1X); //initializer from standart class
@ -157,3 +157,5 @@ void Sensor_TCS34725::loop_colortemp()
d.lastsent=millis();
}
}
#endif

View File

@ -1,3 +1,4 @@
#ifdef SENSOR_VL53L1X
//Connect SCL to D1, SDA to D2, GND and 3v3
#include "sensor_vl53l1x.h"
@ -97,3 +98,5 @@ void Sensor_VL53L1X::sensorloop()
}
}
}
#endif

View File

@ -1,5 +1,5 @@
#ifdef SENSOR_TCS34725
#ifdef SENSOR_TCS34725
//#include <Wire.h>
//#include "Adafruit_TCS34725.h"
#include "tcs34725_agc.h"