Skip to content

Commit

Permalink
Merge branch '#12-air-quality-monitor-drift-' of https://github.com/c…
Browse files Browse the repository at this point in the history
…oderbunker/energy-monitor into #12-air-quality-monitor-drift-
  • Loading branch information
Olivia8963 committed Oct 17, 2019
2 parents e7bab63 + 13cb7fc commit 3ac7679
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions source/Writing_Database/Writing_Database.ino
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,8 @@ int Timer = 0;
bool tickOccured = false;

void timerCallback() {
if (Timer >= 50) {
tickOccured = true;
Timer = 0;
}
else {
Timer++;
}
}
}
//Ticker stuff -- UDP ---------------------------------------------------------

Adafruit_ADS1115 ADC_1(0x49);//Create ADS1115 object
Expand Down Expand Up @@ -127,6 +121,7 @@ float TVOCOLD = 0;
float LongRST = 0;

int writeflag = 0;
int Powerflag =0;

String line;
String PowerAsString;
Expand Down Expand Up @@ -208,6 +203,7 @@ void setup(void)
isPowerType = 1;
isQualityType = 0;
Serial.println("power");
Powerflag =1;

dataPower.addTag("location", nameLocation);
dataPower.addTag("room", nameRoom);
Expand Down Expand Up @@ -274,12 +270,13 @@ void loop(void)
{
reconnectWifi();
}

if ((tickOccured == true) && (writeflag == 1))
Serial.println("0");
if ((tickOccured == true) && (writeflag == 1) || (tickOccured == true)&&(Powerflag == 1))
{
writeflag = 0;
tickOccured = false;
if (isQualityType)
Serial.println("1");
{
dataAirQuality.clear(InfluxDB_Data::FIELD);
dataAirQuality.addField("temperature_c", String(temperature));
Expand All @@ -290,6 +287,9 @@ void loop(void)
}
if (isPowerType)
{
Serial.println(power_1);
Serial.println(power_3);
Serial.println(power_2);
dataPower.clear(InfluxDB_Data::FIELD);
dataPower.addField("power1_W", String(power_1));
dataPower.addField("power2_W", String(power_2));
Expand Down

0 comments on commit 3ac7679

Please sign in to comment.