fixing things?

pull/121/head
Timm Bogner 2 years ago
parent 1aa5a6b2df
commit 83c073f3ba

@ -2,7 +2,7 @@
// //
// Irrigation Controller // Irrigation Controller
// //
// Developed by Timm Bogner (bogner1@gmail.com) in Urbana, Illinois, USA. // Developed by Timm Bogner (timmbogner@gmail.com) in Urbana, Illinois, USA.
// //
// //
#include "fdrs_sensor_config.h" #include "fdrs_sensor_config.h"

@ -20,17 +20,18 @@
#include <Adafruit_BME280.h> #include <Adafruit_BME280.h>
BH1750 lightMeter(0x23); //0x23 BH1750 lightMeter(0x23); //0x23
Adafruit_BME280 bmp; //0x77 Adafruit_BME280 bme; //0x77
RTC_DATA_ATTR int the_count = 0; RTC_DATA_ATTR int the_count = 0;
void setup() { void setup() {
beginFDRS();
//Init Sensors //Init Sensors
Wire.begin(I2C_SDA, I2C_SCL); Wire.begin(I2C_SDA, I2C_SCL);
while (!bmp.begin()) { // while (!bme.begin()) {
//Serial.println("bmp"); // Serial.println("bme");
delay(10); // delay(10);
} // }
if (lightMeter.begin(BH1750::CONTINUOUS_HIGH_RES_MODE)) { if (lightMeter.begin(BH1750::CONTINUOUS_HIGH_RES_MODE)) {
Serial.println(F("BH1750 Advanced begin")); Serial.println(F("BH1750 Advanced begin"));
@ -42,10 +43,10 @@ void setup() {
void loadData() { void loadData() {
float s_battery = readBattery(); float s_battery = readBattery();
float bme_temp = bmp.readTemperature(); // float bme_temp = bme.readTemperature();
float bme_pressure = (bmp.readPressure() / 100.0F); // float bme_pressure = (bme.readPressure() / 100.0F);
//float bme_altitude = bmp.readAltitude(1013.25); //float bme_altitude = bme.readAltitude(1013.25);
float bme_humidity = bmp.readHumidity(); // float bme_humidity = bme.readHumidity();
float s_soil = readSoil(); float s_soil = readSoil();
float s_salt = readSalt(); float s_salt = readSalt();
while (! lightMeter.measurementReady()) { while (! lightMeter.measurementReady()) {
@ -55,22 +56,22 @@ void loadData() {
the_count++; the_count++;
Serial.println(); Serial.println();
Serial.println("Temp: " + String(bme_temp)); // Serial.println("Temp: " + String(bme_temp));
Serial.println("Humidity: " + String(bme_humidity)); // Serial.println("Humidity: " + String(bme_humidity));
Serial.println("Light: " + String(lux)); Serial.println("Light: " + String(lux));
Serial.println("Pressure: " + String(bme_pressure)); // Serial.println("Pressure: " + String(bme_pressure));
Serial.println("Salt: " + String(s_salt)); Serial.println("Salt: " + String(s_salt));
Serial.println("Soil: " + String(s_soil)); Serial.println("Soil: " + String(s_soil));
Serial.println("Voltage: " + String(s_battery)); Serial.println("Voltage: " + String(s_battery));
Serial.println("Count: " + String(the_count)); Serial.println("Count: " + String(the_count));
loadFDRS(bme_temp, TEMP_T); // loadFDRS(bme_temp, TEMP_T);
loadFDRS(bme_humidity, HUMIDITY_T); // loadFDRS(bme_humidity, HUMIDITY_T);
loadFDRS(lux, LIGHT_T); loadFDRS(lux, LIGHT_T);
loadFDRS(bme_pressure, PRESSURE_T); // loadFDRS(bme_pressure, PRESSURE_T);
loadFDRS(s_salt, SOILR_T); loadFDRS(s_salt, SOILR_T);
loadFDRS(s_soil, SOIL_T); loadFDRS(s_soil, SOIL_T);
loadFDRS(s_battery, VOLTAGE_T); loadFDRS(s_battery, VOLTAGE_T);
@ -96,10 +97,10 @@ uint32_t readSalt() //Soil Electrodes: This code came from the LilyGo documentat
return humi; return humi;
} }
uint16_t readSoil() //Soil Capacitance: This code came from the LilyGo documentation. uint16_t readSoil() //Soil Capacitance
{ {
uint16_t soil = analogRead(SOIL_PIN); uint16_t soil = analogRead(SOIL_PIN);
return map(soil, 0, 4095, 100, 0); return soil;
} }
float readBattery() //Battery Voltage: This code came from the LilyGo documentation. float readBattery() //Battery Voltage: This code came from the LilyGo documentation.
@ -110,4 +111,7 @@ float readBattery() //Battery Voltage: This code came from the LilyGo documentat
return battery_voltage; return battery_voltage;
} }
void loop() { void loop() {
loadData();
sendFDRS();
sleepFDRS(30);
} }

Loading…
Cancel
Save