|
@@ -12,7 +12,6 @@
|
12
|
12
|
*/
|
13
|
13
|
|
14
|
14
|
#include <Arduino.h>
|
15
|
|
-#include <Wire.h>
|
16
|
15
|
#include <Adafruit_BME280.h>
|
17
|
16
|
#include <SHT2x.h>
|
18
|
17
|
|
|
@@ -39,6 +38,7 @@
|
39
|
38
|
|
40
|
39
|
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
41
|
40
|
|
|
41
|
+#include <Wire.h>
|
42
|
42
|
#include "SimpleUpdater.h"
|
43
|
43
|
|
44
|
44
|
#define BUILTIN_LED_PIN 1
|
|
@@ -269,20 +269,20 @@ void handleRoot(WiFiClient &client) {
|
269
|
269
|
message += F("<title>" ESP_PLATFORM_NAME " Environment Sensor</title>");
|
270
|
270
|
message += F("</head><body>");
|
271
|
271
|
message += F("<h1>" ESP_PLATFORM_NAME " Environment Sensor</h1>");
|
272
|
|
- message += F("<p>");
|
|
272
|
+ message += F("\n<p>\n");
|
273
|
273
|
message += F("Version: ");
|
274
|
274
|
message += esp_env_version;
|
275
|
|
- message += F("<br>");
|
|
275
|
+ message += F("\n<br>\n");
|
276
|
276
|
message += F("Location: ");
|
277
|
277
|
message += sensor_location;
|
278
|
278
|
|
279
|
279
|
#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
|
280
|
|
- message += F("<br>");
|
|
280
|
+ message += F("\n<br>\n");
|
281
|
281
|
message += F("MAC: ");
|
282
|
282
|
message += WiFi.macAddress();
|
283
|
283
|
#endif
|
284
|
284
|
|
285
|
|
- message += F("</p>");
|
|
285
|
+ message += F("\n</p>\n");
|
286
|
286
|
|
287
|
287
|
#if defined(ARDUINO_ARCH_AVR)
|
288
|
288
|
do {
|
|
@@ -342,53 +342,53 @@ void handleRoot(WiFiClient &client) {
|
342
|
342
|
|
343
|
343
|
#endif
|
344
|
344
|
|
345
|
|
- message += F("<p>");
|
|
345
|
+ message += F("\n<p>\n");
|
346
|
346
|
if (found_bme1) {
|
347
|
347
|
message += F("BME280 Low:");
|
348
|
|
- message += F("<br>");
|
|
348
|
+ message += F("\n<br>\n");
|
349
|
349
|
message += F("Temperature: ");
|
350
|
350
|
message += String(bme1_temp());
|
351
|
|
- message += F("<br>");
|
|
351
|
+ message += F("\n<br>\n");
|
352
|
352
|
message += F("Humidity: ");
|
353
|
353
|
message += String(bme1_humid());
|
354
|
|
- message += F("<br>");
|
|
354
|
+ message += F("\n<br>\n");
|
355
|
355
|
message += F("Pressure: ");
|
356
|
356
|
message += String(bme1_pressure());
|
357
|
357
|
} else {
|
358
|
358
|
message += F("BME280 (low) not connected!");
|
359
|
359
|
}
|
360
|
|
- message += F("</p>");
|
|
360
|
+ message += F("\n</p>\n");
|
361
|
361
|
|
362
|
|
- message += F("<p>");
|
|
362
|
+ message += F("\n<p>\n");
|
363
|
363
|
if (found_bme2) {
|
364
|
364
|
message += F("BME280 High:");
|
365
|
|
- message += F("<br>");
|
|
365
|
+ message += F("\n<br>\n");
|
366
|
366
|
message += F("Temperature: ");
|
367
|
367
|
message += String(bme2_temp());
|
368
|
|
- message += F("<br>");
|
|
368
|
+ message += F("\n<br>\n");
|
369
|
369
|
message += F("Humidity: ");
|
370
|
370
|
message += String(bme2_humid());
|
371
|
|
- message += F("<br>");
|
|
371
|
+ message += F("\n<br>\n");
|
372
|
372
|
message += F("Pressure: ");
|
373
|
373
|
message += String(bme2_pressure());
|
374
|
374
|
} else {
|
375
|
375
|
message += F("BME280 (high) not connected!");
|
376
|
376
|
}
|
377
|
|
- message += F("</p>");
|
|
377
|
+ message += F("\n</p>\n");
|
378
|
378
|
|
379
|
|
- message += F("<p>");
|
|
379
|
+ message += F("\n<p>\n");
|
380
|
380
|
if (found_sht) {
|
381
|
381
|
message += F("SHT21:");
|
382
|
|
- message += F("<br>");
|
|
382
|
+ message += F("\n<br>\n");
|
383
|
383
|
message += F("Temperature: ");
|
384
|
384
|
message += String(sht_temp());
|
385
|
|
- message += F("<br>");
|
|
385
|
+ message += F("\n<br>\n");
|
386
|
386
|
message += F("Humidity: ");
|
387
|
387
|
message += String(sht_humid());
|
388
|
388
|
} else {
|
389
|
|
- //message += F("SHT21 not connected!");
|
|
389
|
+ message += F("SHT21 not connected!");
|
390
|
390
|
}
|
391
|
|
- message += F("</p>");
|
|
391
|
+ message += F("\n</p>\n");
|
392
|
392
|
|
393
|
393
|
#if defined(ARDUINO_ARCH_AVR)
|
394
|
394
|
do {
|
|
@@ -409,22 +409,22 @@ void handleRoot(WiFiClient &client) {
|
409
|
409
|
for (int i = 0; i < moisture_count(); i++) {
|
410
|
410
|
int moisture = moisture_read(i);
|
411
|
411
|
if (moisture < moisture_max()) {
|
412
|
|
- message += F("<p>");
|
|
412
|
+ message += F("\n<p>\n");
|
413
|
413
|
message += F("Sensor ");
|
414
|
414
|
message += String(i + 1);
|
415
|
|
- message += F(":<br>");
|
|
415
|
+ message += F(":\n<br>\n");
|
416
|
416
|
message += F("Moisture: ");
|
417
|
417
|
message += String(moisture);
|
418
|
418
|
message += F(" / ");
|
419
|
419
|
message += String(moisture_max());
|
420
|
|
- message += F("</p>");
|
|
420
|
+ message += F("\n</p>\n");
|
421
|
421
|
}
|
422
|
422
|
}
|
423
|
423
|
|
424
|
424
|
if (moisture_count() <= 0) {
|
425
|
|
- message += F("<p>");
|
|
425
|
+ message += F("\n<p>\n");
|
426
|
426
|
message += F("No moisture sensors configured!");
|
427
|
|
- message += F("</p>");
|
|
427
|
+ message += F("\n</p>\n");
|
428
|
428
|
}
|
429
|
429
|
|
430
|
430
|
#if ! defined(ARDUINO_ARCH_AVR)
|
|
@@ -502,7 +502,6 @@ void setup() {
|
502
|
502
|
|
503
|
503
|
#elif defined(ARDUINO_ARCH_AVR)
|
504
|
504
|
|
505
|
|
- Wire.begin();
|
506
|
505
|
found_bme1 = (!bme1.begin(BME_I2C_ADDRESS_1, &Wire)) ? false : true;
|
507
|
506
|
found_bme2 = (!bme2.begin(BME_I2C_ADDRESS_2, &Wire)) ? false : true;
|
508
|
507
|
|