multi project
This commit is contained in:
parent
5b01a417c7
commit
8ad5195b94
@ -1,13 +1,38 @@
|
|||||||
[env:Greenhouse]
|
[common]
|
||||||
platform = espressif8266
|
|
||||||
board = esp12e
|
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps = https://github.com/adafruit/Adafruit_TSL2561
|
lib_deps = https://github.com/milesburton/Arduino-Temperature-Control-Library
|
||||||
|
https://github.com/adafruit/Adafruit_TSL2561
|
||||||
https://github.com/knolleary/pubsubclient
|
https://github.com/knolleary/pubsubclient
|
||||||
https://github.com/adafruit/Adafruit_BME680
|
https://github.com/adafruit/Adafruit_BME680
|
||||||
build_flags = -DHOSTNAME=\"Greenhouse\"
|
build_flags =
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
upload_protocol = espota
|
|
||||||
upload_port = 10.0.0.169
|
|
||||||
;upload_port = /dev/ttyUSB0
|
;upload_port = /dev/ttyUSB0
|
||||||
;upload_speed = 460800
|
;upload_speed = 460800
|
||||||
|
|
||||||
|
[esp12e]
|
||||||
|
platform = espressif8266
|
||||||
|
board = esp12e
|
||||||
|
|
||||||
|
[esp32]
|
||||||
|
platform = espressif32
|
||||||
|
board = esp32dev
|
||||||
|
|
||||||
|
[env:GreenhouseUSB]
|
||||||
|
platform = ${esp12e.platform}
|
||||||
|
board = ${esp12e.board}
|
||||||
|
framework = ${common.framework}
|
||||||
|
lib_deps = ${common.lib_deps}
|
||||||
|
build_flags = ${common.build_flags} -DNODE_GREENHOUSE -DHOSTNAME=\"Greenhouse\"
|
||||||
|
monitor_speed = ${common.monitor_speed}
|
||||||
|
upload_port = /dev/ttyUSB0
|
||||||
|
upload_speed = 460800
|
||||||
|
|
||||||
|
[env:GreenhouseOTA]
|
||||||
|
platform = ${esp12e.platform}
|
||||||
|
board = ${esp12e.board}
|
||||||
|
framework = ${common.framework}
|
||||||
|
lib_deps = ${common.lib_deps}
|
||||||
|
build_flags = ${common.build_flags} -DNODE_GREENHOUSE -DHOSTNAME=\"Greenhouse\"
|
||||||
|
monitor_speed = ${common.monitor_speed}
|
||||||
|
upload_protocol = espota
|
||||||
|
upload_port = 10.0.0.169
|
||||||
|
|||||||
24
src/Greenhouse.cpp
Normal file
24
src/Greenhouse.cpp
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#ifdef NODE_GREENHOUSE
|
||||||
|
|
||||||
|
#include "patrix/bme680.h"
|
||||||
|
#include "patrix/tsl2561.h"
|
||||||
|
|
||||||
|
TSL2561 gardenTSL("garden");
|
||||||
|
|
||||||
|
BME680 gardenBME("garden");
|
||||||
|
|
||||||
|
BME680 greenhouseBME("greenhouse");
|
||||||
|
|
||||||
|
void patrixSetup() {
|
||||||
|
gardenTSL.setup();
|
||||||
|
gardenBME.setup();
|
||||||
|
greenhouseBME.setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void patrixLoop() {
|
||||||
|
gardenTSL.loop();
|
||||||
|
gardenBME.loop();
|
||||||
|
greenhouseBME.loop();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
31
src/main.cpp
31
src/main.cpp
@ -1,31 +0,0 @@
|
|||||||
#include <bme680.h>
|
|
||||||
#include "mqtt.h"
|
|
||||||
#include "tsl2561.h"
|
|
||||||
#include "wifi.h"
|
|
||||||
|
|
||||||
TSL2561 gardenTSL("garden");
|
|
||||||
|
|
||||||
BME680 gardenBME("garden");
|
|
||||||
|
|
||||||
BME680 greenhouseBME("greenhouse");
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
delay(500);
|
|
||||||
Log.printf("\n\n\nStartup\n");
|
|
||||||
wifiConnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
wifiLoop();
|
|
||||||
mqttLoop();
|
|
||||||
if (isSetupTimeAfterBootDelay()) {
|
|
||||||
gardenTSL.setup();
|
|
||||||
gardenBME.setup();
|
|
||||||
greenhouseBME.setup();
|
|
||||||
}
|
|
||||||
if (isAfterBootDelay()) {
|
|
||||||
gardenTSL.loop();
|
|
||||||
gardenBME.loop();
|
|
||||||
greenhouseBME.loop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
18
src/patrix/Patrix.cpp
Normal file
18
src/patrix/Patrix.cpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include "Patrix.h"
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
delay(500);
|
||||||
|
Log.printf("\n\n\nStartup\n");
|
||||||
|
wifiConnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
wifiLoop();
|
||||||
|
mqttLoop();
|
||||||
|
if (isSetupTimeAfterBootDelay()) {
|
||||||
|
patrixSetup();
|
||||||
|
}
|
||||||
|
if (isAfterBootDelay()) {
|
||||||
|
patrixLoop();
|
||||||
|
}
|
||||||
|
}
|
||||||
11
src/patrix/Patrix.h
Normal file
11
src/patrix/Patrix.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#ifndef PATRIX_H
|
||||||
|
#define PATRIX_H
|
||||||
|
|
||||||
|
#include "wifi.h"
|
||||||
|
#include "mqtt.h"
|
||||||
|
|
||||||
|
void patrixSetup();
|
||||||
|
|
||||||
|
void patrixLoop();
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -1,8 +1,8 @@
|
|||||||
#ifndef BME680_H
|
#ifndef BME680_H
|
||||||
#define BME680_H
|
#define BME680_H
|
||||||
|
|
||||||
#include <Adafruit_BME680.h>
|
#include "Adafruit_BME680.h"
|
||||||
#include <mqtt.h>
|
#include "mqtt.h"
|
||||||
|
|
||||||
class BME680 {
|
class BME680 {
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ public:
|
|||||||
|
|
||||||
unsigned long intervalMs;
|
unsigned long intervalMs;
|
||||||
|
|
||||||
explicit BME680(const String& name, const unsigned long interval_ms = 5000) : name(name), intervalMs(interval_ms) {
|
explicit BME680(String name, const unsigned long interval_ms = 5000) : name(std::move(name)), intervalMs(interval_ms) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
#include "wifi.h"
|
#include "wifi.h"
|
||||||
|
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <PubSubClient.h>
|
#include "PubSubClient.h"
|
||||||
#include <WiFiClient.h>
|
#include <WiFiClient.h>
|
||||||
|
|
||||||
WiFiClient client;
|
WiFiClient client;
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#ifndef TSL2561_H
|
#ifndef TSL2561_H
|
||||||
#define TSL2561_H
|
#define TSL2561_H
|
||||||
|
|
||||||
#include <Adafruit_TSL2561_U.h>
|
#include "Adafruit_TSL2561_U.h"
|
||||||
|
|
||||||
class TSL2561 {
|
class TSL2561 {
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ public:
|
|||||||
|
|
||||||
unsigned long intervalMs;
|
unsigned long intervalMs;
|
||||||
|
|
||||||
explicit TSL2561(const String& name, const uint8_t address = TSL2561_ADDR_FLOAT, const unsigned long interval_ms = 5000) : tsl(Adafruit_TSL2561_Unified(address)), name(name), intervalMs(interval_ms) {
|
explicit TSL2561(String name, const uint8_t address = TSL2561_ADDR_FLOAT, const unsigned long interval_ms = 5000) : tsl(Adafruit_TSL2561_Unified(address)), name(std::move(name)), intervalMs(interval_ms) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user