From 17a7294c9450977d9fced90f670a40d16239bb9a Mon Sep 17 00:00:00 2001 From: 1technophile Date: Wed, 6 Sep 2017 22:14:36 +0200 Subject: [PATCH] moves some parameters to config files --- ZgatewayBT.ino | 1 - ZsensorDHT.ino | 10 ++-------- config_BT.h | 1 + config_DHT.h | 6 ++++++ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ZgatewayBT.ino b/ZgatewayBT.ino index f19ab45..fa7b9ab 100644 --- a/ZgatewayBT.ino +++ b/ZgatewayBT.ino @@ -34,7 +34,6 @@ Thanks to wolass https://github.com/wolass for suggesting me HM 10 and dinosd ht #define RESPONSE_MSG "OK+DISIS" #define RESP_END_MSG "OK+DISCE" #define SETUP_MSG "OK+RESET" -#define TimeBtw_Read 10000 SoftwareSerial softserial(BT_RX, BT_TX); diff --git a/ZsensorDHT.ino b/ZsensorDHT.ino index 78be0cc..c401951 100644 --- a/ZsensorDHT.ino +++ b/ZsensorDHT.ino @@ -30,20 +30,14 @@ #ifdef ZsensorDHT #include #include -#define dht_always true // if false when the current value for temp or hum is the same as previous one don't send it by MQTT -#define TimeBetweenReading 30000 -DHT dht(DHT_RECEIVER_PIN,DHT22); // Defined in User_config.h -/*----------------------------USER PARAMETERS-----------------------------*/ -/*-------------DEFINE YOUR MQTT PARAMETERS BELOW----------------*/ -#define HUM1 "home/DHTtoMQTT/dht1/hum" -#define TEMP1 "home/DHTtoMQTT/dht1/temp" +DHT dht(DHT_RECEIVER_PIN,DHT22); //Time used to wait for an interval before resending temp and hum unsigned long timedht = 0; void MeasureTempAndHum(){ - if (millis() > (timedht + TimeBetweenReading)) {//retriving value of temperature and humidity of the box from DHT every xUL + if (millis() > (timedht + TimeBetweenReadingDHT)) {//retriving value of temperature and humidity of the box from DHT every xUL timedht = millis(); static float persistedh; static float persistedt; diff --git a/config_BT.h b/config_BT.h index 04bdbac..5e9c8fc 100644 --- a/config_BT.h +++ b/config_BT.h @@ -25,6 +25,7 @@ */ /*----------------------BT topics & parameters-------------------------*/ #define subjectBTtoMQTT "home/BTtoMQTT/" +#define TimeBtw_Read 10000 //define the time between 2 scans #define HM-10 //#define HM-11 // uncomment this line if you use HM-11 and comment the line above diff --git a/config_DHT.h b/config_DHT.h index 6e2afc2..4dda0d4 100644 --- a/config_DHT.h +++ b/config_DHT.h @@ -24,6 +24,12 @@ along with this program. If not, see . */ +/*----------------------------USER PARAMETERS-----------------------------*/ +/*-------------DEFINE YOUR MQTT PARAMETERS BELOW----------------*/ +#define HUM1 "home/DHTtoMQTT/dht1/hum" +#define TEMP1 "home/DHTtoMQTT/dht1/temp" +#define dht_always true // if false when the current value for temp or hum is the same as previous one don't send it by MQTT +#define TimeBetweenReadingDHT 30000 // time between 2 DHT readings /*-------------------PIN DEFINITIONS----------------------*/ #ifdef I2C_Wiring // With Support for I2C Modules #define DHT_RECEIVER_PIN 14 //on nodeMCU this is D5 GPIO14