Compare commits

..

No commits in common. "1e87d26088aa8aa60544ca62bc070fdd89e998de" and "fe29b238ff69332e6eb5ff55b3f16ded766b051e" have entirely different histories.

2 changed files with 3 additions and 93 deletions

View File

@ -17,8 +17,8 @@
#data_dir=data_sensoresp2 #data_dir=data_sensoresp2
#data_dir=data_sensoresp3 #data_dir=data_sensoresp3
#data_dir=data_sensoresp4 #data_dir=data_sensoresp4
data_dir=data_sensoresp5 #data_dir=data_sensoresp5
#data_dir=data_sensoresp3dprinter data_dir=data_sensoresp3dprinter
#Outdoor #Outdoor
@ -237,17 +237,12 @@ build_flags =
-D dataBH1750_minchange=10.0 -D dataBH1750_minchange=10.0
-D dataBH1750_senddelaymax=1000*60*2 -D dataBH1750_senddelaymax=1000*60*2
-D SENSOR_VL53L1X
-D dataBH1750_minchange=10.0
-D dataBH1750_senddelaymax=1000*60*2
lib_deps = lib_deps =
adafruit/DHT sensor library@1.3.10 adafruit/DHT sensor library@1.3.10
claws/BH1750@1.1.4 claws/BH1750@1.1.4
ArduinoJson@6.16.1 #dependency of homie. using older version because of "ambiguous overload for operator|" error ArduinoJson@6.16.1 #dependency of homie. using older version because of "ambiguous overload for operator|" error
Homie@3.0.0 Homie@3.0.0
pololu/VL53L1X @ ^1.3.0
@ -263,7 +258,7 @@ monitor_speed = 115200
build_flags = build_flags =
-D SENSOR_HTU21D -D SENSOR_HTU21D
-D dataHTU21D_temperature_minchange=0.2 -D dataHTU21D_temperature_minchange=0.2
-D dataHTU21D_temperature_senddelaymax=1000*60*20 -D dataHTU21D_temperature_senddelaymax=1000*60*10
-D dataHTU21D_humidity_minchange=1.0 -D dataHTU21D_humidity_minchange=1.0
-D dataHTU21D_humidity_senddelaymax=1000*60*10 -D dataHTU21D_humidity_senddelaymax=1000*60*10

View File

@ -228,22 +228,6 @@ struct sensordata
#endif #endif
#endif #endif
#ifdef SENSOR_VL53L1X
#ifndef WIRE_H
#include <Wire.h>
#define WIRE_H
#endif
#include <VL53L1X.h>
VL53L1X vl53l1x;
bool vl53l1xinit_ok=false;
struct sensordata dataVL53L1X_range;
struct sensordata dataVL53L1X_peak_signal_count_rate;
struct sensordata dataVL53L1X_ambient_count_rate;
uint16_t value_vl53l1x_range;
unsigned long lastread_vl53l1x=0;
#endif
#ifdef SENSOR_ANEMOMETER #ifdef SENSOR_ANEMOMETER
//uses ATS177 Latched hall sensor for rotation sensing //uses ATS177 Latched hall sensor for rotation sensing
sensordata dataAnemometer; sensordata dataAnemometer;
@ -478,23 +462,6 @@ void setup() {
#endif #endif
#endif #endif
#ifdef SENSOR_VL53L1X
Serial.println("initializing vl53l1x");
vl53l1x.setTimeout(500);
if (!vl53l1x.init()) {
Serial.println("No vl53l1x found!");
}else{
vl53l1xinit_ok=true;
vl53l1x.setDistanceMode(VL53L1X::Long);
vl53l1x.setMeasurementTimingBudget(50000);
vl53l1x.startContinuous(50); //This period should be at least as long as the timing budget.
}
#ifdef dataVL53L1X_range_minchange
dataVL53L1X_range.minchange=dataVL53L1X_range_minchange;
#endif
#endif
#ifdef SENSOR_ANEMOMETER #ifdef SENSOR_ANEMOMETER
pinMode(ANEMOMETERPIN,INPUT_PULLUP); pinMode(ANEMOMETERPIN,INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(ANEMOMETERPIN),interrupt_anemometer,CHANGE); //anemometer interrupt attachInterrupt(digitalPinToInterrupt(ANEMOMETERPIN),interrupt_anemometer,CHANGE); //anemometer interrupt
@ -607,10 +574,6 @@ void setup() {
sensorNode.advertise("colortemp"); sensorNode.advertise("colortemp");
#endif #endif
#ifdef SENSOR_VL53L1X
sensorNode.advertise("range");
#endif
#ifdef SENSOR_ANEMOMETER #ifdef SENSOR_ANEMOMETER
sensorNode.advertise("windspeed"); sensorNode.advertise("windspeed");
#endif #endif
@ -1197,54 +1160,6 @@ void loop_TCS34725_colortemp()
} }
#endif #endif
#ifdef SENSOR_VL53L1X
void loop_VL53L1X_range()
{
sensordata &d=dataVL53L1X_range;
bool _changed=false;
if (millis() >= (d.lastreadtime+d.readdelay)) {
if (millis() >= (lastread_vl53l1x+d.readdelay)) { //avoid reading sensor twice in a short time
//tcs.getRawData(&value_tcs_r, &value_tcs_g, &value_tcs_b, &value_tcs_c);
vl53l1x.read();
lastread_vl53l1x=millis();
}
value_vl53l1x_range=vl53l1x.ranging_data.range_mm;
Serial.print("range: ");
Serial.print(vl53l1x.ranging_data.range_mm);
Serial.print("\tstatus: ");
Serial.print(VL53L1X::rangeStatusToString(vl53l1x.ranging_data.range_status));
Serial.print("\tpeak signal: ");
Serial.print(vl53l1x.ranging_data.peak_signal_count_rate_MCPS);
Serial.print("\tambient: ");
Serial.print(vl53l1x.ranging_data.ambient_count_rate_MCPS);
if (abs((int)d.lastsentvalue-value_vl53l1x_range)>=d.minchange){ //int abs
_changed=true;
}
d.lastreadtime=millis();
}
if (_changed || millis() >= (d.lastsent+d.senddelaymax)) {
Serial.print("Sending VL53L1X range. reason=");
if (_changed) Serial.println("change"); else Serial.println("time");
checkESPStatus();
Homie.getLogger() << "range vl53l1x " << ": " << value_vl53l1x_range << endl;
sensorNode.setProperty("range").send(String(value_vl53l1x_range));
d.lastsentvalue=value_vl53l1x_range;
d.lastsent=millis();
}
}
#endif
#ifdef SENSOR_ANEMOMETER #ifdef SENSOR_ANEMOMETER
void loop_anemometer() void loop_anemometer()
{ {