From 284e3940ea0d784fd62e82871ee519a55ba44bab Mon Sep 17 00:00:00 2001 From: klaute Date: Sat, 9 Dec 2017 19:10:31 +0100 Subject: [PATCH] Bugfix array size --- firmware/firmware.ino | 20 ++++++++++---------- firmware/influxdb.ino | 10 +++++----- firmware/sensors.ino | 12 ++++++------ 3 files changed, 21 insertions(+), 21 deletions(-) mode change 100644 => 100755 firmware/firmware.ino mode change 100644 => 100755 firmware/influxdb.ino mode change 100644 => 100755 firmware/sensors.ino diff --git a/firmware/firmware.ino b/firmware/firmware.ino old mode 100644 new mode 100755 index 5f76ec3..acd755b --- a/firmware/firmware.ino +++ b/firmware/firmware.ino @@ -26,7 +26,7 @@ * - https://github.com/marvinroger/homie-esp8266 */ -float currentSensorData[4] = {0.0, 0.0, 0.0, 0.0}; +float currentSensorData[5] = {0.0, 0.0, 0.0, 0.0, 0.0}; WiFiManager wifiManager; @@ -64,7 +64,7 @@ void setup() { // Initialize and configure the sensors //apds.begin(); //apds.enableColor(true); - //bme.begin(); + bme.begin(0x76); delay(100); } @@ -73,22 +73,22 @@ void loop() { digitalWrite(STATUS_LED_PIN, LOW); currentSensorData[SENSOR_TEMPERATURE] = fetchTemperature(); - //currentSensorData[SENSOR_HUMIDITY] = fetchHumidity(); + currentSensorData[SENSOR_HUMIDITY] = fetchHumidity(); //currentSensorData[SENSOR_LIGHT] = fetchLight(); - //currentSensorData[SENSOR_WINDSPEED] = fetchWindspeed(); - //currentSensorData[SENSOR_PRESSURE] = fetchPressure(); + // currentSensorData[SENSOR_WINDSPEED] = fetchWindspeed(); + currentSensorData[SENSOR_PRESSURE] = fetchPressure(); #ifdef DEBUG Serial.println(""); Serial.println("Current readings:"); Serial.println("Temperature: " + String(currentSensorData[SENSOR_TEMPERATURE]) + " °C"); - //Serial.println("Humidity: " + String(currentSensorData[SENSOR_HUMIDITY]) + "%"); - //Serial.println("Light: " + String(currentSensorData[SENSOR_LIGHT]) + " Lumen"); - //Serial.println("Windspeed: " + String(currentSensorData[SENSOR_WINDSPEED]) + " Km/h"); - //Serial.println("Pressure: " + String(currentSensorData[SENSOR_PRESSURE]) + " hPa"); + Serial.println("Humidity: " + String(currentSensorData[SENSOR_HUMIDITY]) + "%"); + Serial.println("Light: " + String(currentSensorData[SENSOR_LIGHT]) + " Lumen"); + Serial.println("Windspeed: " + String(currentSensorData[SENSOR_WINDSPEED]) + " Km/h"); + Serial.println("Pressure: " + String(currentSensorData[SENSOR_PRESSURE]) + " hPa"); #endif pushToInfluxDB(DEVICE_NAME, currentSensorData); delay(UPDATE_INTERVAL*1000); -} +} diff --git a/firmware/influxdb.ino b/firmware/influxdb.ino old mode 100644 new mode 100755 index d731789..c315b58 --- a/firmware/influxdb.ino +++ b/firmware/influxdb.ino @@ -1,7 +1,7 @@ void pushToInfluxDB(String device, float sensorValues[]) { influxdb.write("weather,device=" + device + " temperature=" + String(sensorValues[SENSOR_TEMPERATURE])); - //influxdb.write("weather,device=" + device + " humidity=" + String(sensorValues[SENSOR_HUMIDITY])); - //influxdb.write("weather,device=" + device + " light=" + String(sensorValues[SENSOR_LIGHT])); - //influxdb.write("weather,device=" + device + " windspeed=" + String(sensorValues[SENSOR_WINDSPEED])); - //influxdb.write("weather,device=" + device + " pressure=" + String(sensorValues[SENSOR_PRESSURE])); -} + influxdb.write("weather,device=" + device + " humidity=" + String(sensorValues[SENSOR_HUMIDITY])); + influxdb.write("weather,device=" + device + " light=" + String(sensorValues[SENSOR_LIGHT])); + influxdb.write("weather,device=" + device + " windspeed=" + String(sensorValues[SENSOR_WINDSPEED])); + influxdb.write("weather,device=" + device + " pressure=" + String(sensorValues[SENSOR_PRESSURE])); +} diff --git a/firmware/sensors.ino b/firmware/sensors.ino old mode 100644 new mode 100755 index 57e008a..e63ca84 --- a/firmware/sensors.ino +++ b/firmware/sensors.ino @@ -2,17 +2,17 @@ int anemometerRotations = 0; unsigned long currentTime = 0; float fetchTemperature() { - return 10; - //return bme.readTemperature(); + //return 10; + return bme.readTemperature(); } float fetchPressure() { - return 10; - //return bme.readPressure() / 100.0F; + //return 10; + return bme.readPressure() / 100.0F; } float fetchHumidity() { - //return bme.readHumidity(); + return bme.readHumidity(); } float fetchLight() { @@ -41,4 +41,4 @@ float fetchWindspeed() { return (float)anemometerRotations / 5.0 * 2.4; } - +