working without light sensor
This commit is contained in:
parent
b0ec86890d
commit
449654c250
2 changed files with 14 additions and 6 deletions
|
@ -63,6 +63,8 @@ Influxdb influxdb(INFLUXDB_HOST, INFLUXDB_PORT);
|
||||||
Adafruit_APDS9960 apds;
|
Adafruit_APDS9960 apds;
|
||||||
Adafruit_BME280 bme;
|
Adafruit_BME280 bme;
|
||||||
|
|
||||||
|
bool apds_connected = false;
|
||||||
|
|
||||||
#ifdef WEBUPDATER_FEATURE
|
#ifdef WEBUPDATER_FEATURE
|
||||||
String localIP = "127.0.0.1";
|
String localIP = "127.0.0.1";
|
||||||
#endif
|
#endif
|
||||||
|
@ -116,9 +118,13 @@ void setup() {
|
||||||
|
|
||||||
// Initialize and configure the sensors
|
// Initialize and configure the sensors
|
||||||
//Light Sensor
|
//Light Sensor
|
||||||
apds.begin();
|
if (apds.begin()) {
|
||||||
|
apds_connected = true;
|
||||||
apds.enableColor(true);
|
apds.enableColor(true);
|
||||||
|
}
|
||||||
|
#ifdef DEBUG2
|
||||||
|
Serial.println("Connected!");
|
||||||
|
#endif
|
||||||
//Temperature + pressure
|
//Temperature + pressure
|
||||||
bool status = bme.begin(BME_ADDRESS);
|
bool status = bme.begin(BME_ADDRESS);
|
||||||
if (!status) {
|
if (!status) {
|
||||||
|
@ -229,7 +235,9 @@ void _loop() {
|
||||||
#endif
|
#endif
|
||||||
currentSensorData[SENSOR_TEMPERATURE] = fetchTemperature();
|
currentSensorData[SENSOR_TEMPERATURE] = fetchTemperature();
|
||||||
currentSensorData[SENSOR_HUMIDITY] = fetchHumidity();
|
currentSensorData[SENSOR_HUMIDITY] = fetchHumidity();
|
||||||
|
if (apds_connected) {
|
||||||
currentSensorData[SENSOR_LIGHT] = fetchLight();
|
currentSensorData[SENSOR_LIGHT] = fetchLight();
|
||||||
|
}
|
||||||
currentSensorData[SENSOR_PRESSURE] = fetchPressure();
|
currentSensorData[SENSOR_PRESSURE] = fetchPressure();
|
||||||
#ifdef BATTERY_POWERED
|
#ifdef BATTERY_POWERED
|
||||||
currentSensorData[SENSOR_BAT_VOLTAGE] = getBatteryVoltage();
|
currentSensorData[SENSOR_BAT_VOLTAGE] = getBatteryVoltage();
|
||||||
|
|
Loading…
Reference in a new issue