Skip to content

Commit 20adae7

Browse files
committed
minor fixes
1 parent b555eef commit 20adae7

File tree

5 files changed

+12
-15
lines changed

5 files changed

+12
-15
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
.gcc-flags.json
44
.#*
55
node_modules
6+
.piolibdeps

src/app.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <FastLED.h>
1010
#include "DHT.h"
1111

12-
const String SENSOR_ID = "estacion_floresta";
12+
const String SENSOR_ID = "florida_nueva";
1313

1414
const String STR_COMMA = ",";
1515
const String STR_SLASH = "/";

src/http.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ int postCsvFile(String url, String filename) {
7676
Serial.println(content_length);
7777

7878
String data = "";
79-
char *_data;
79+
char *_data;
8080
Serial.println("Reading file ...");
8181
while(file.available()) {
8282
Serial.print(".");
@@ -131,13 +131,13 @@ int post2Influx(String url, String load) {
131131
if(httpCode > 0) {
132132
String payload = http.getString();
133133
Serial.println(payload);
134-
Serial.println("load sent successfully!");
134+
Serial.println("load sent successfully!");
135135
} else {
136136
Serial.print("[HTTP] failed, error;;;: ");
137137
Serial.println(http.errorToString(httpCode).c_str());
138138
}
139-
139+
140140
http.end();
141141
return httpCode;
142-
142+
143143
}

src/main.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ const int SEND_RECORD = 1;
1010
GPSData gps;
1111
DHT11Data dht11;
1212
PlantowerData plantower;
13-
PlantowerData plantowerData;
1413

1514
#include <DoubleResetDetector.h>
1615

17-
// Number of seconds after reset during which a
16+
// Number of seconds after reset during which a
1817
// subseqent reset will be considered a double reset.
1918
#define DRD_TIMEOUT 100
2019

@@ -87,7 +86,7 @@ void setup() {
8786
setupGPS();
8887
setupPlantower();
8988
setupDHT11();
90-
89+
9190
if (drd.detectDoubleReset()) {
9291
Serial.println("Connecting to network ...");
9392
setupWifi();
@@ -103,12 +102,9 @@ void loop() {
103102
plantower = getPlantowerData();
104103

105104
if(plantower.ready) {
106-
plantowerData = plantower;
107-
}
108-
109-
if(plantowerData.ready) {
110105
save();
111-
ledParticulateQuality(plantowerData);
106+
ledParticulateQuality(plantower);
107+
112108
String frame = influxFrame();
113109
post2Influx("http://aqa.unloquer.org:8086/write?db=aqa", frame);
114110
}
@@ -172,6 +168,7 @@ String csvFrame() {
172168

173169
return frame;
174170
}
171+
175172
String influxFrame() {
176173
/* CSV is ordered as:
177174
"id","lat","lng","date","time","altitude","course","speed","humidity",

src/plantower.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ PlantowerData readPlantower(unsigned long ms) {
9090
Serial.print(PM10Value);
9191
Serial.println(" ug/m3");
9292
Serial.println();
93-
94-
93+
9594
return data;
9695
}
9796

0 commit comments

Comments
 (0)