2024-07-03
This commit is contained in:
parent
881f501dd0
commit
94d3c9f64e
|
@ -20,9 +20,11 @@ upload_port = /dev/ttyUSB0
|
|||
lib_deps =
|
||||
knolleary/PubSubClient @ 2.8
|
||||
adafruit/Adafruit HTU21DF Library @ 1.0.5
|
||||
adafruit/Adafruit BMP280 Library @ 2.6.6
|
||||
wollewald/ADS1115_WE @ 1.4.3
|
||||
adafruit/Adafruit MCP9808 Library @ 2.0.0
|
||||
adafruit/Adafruit BusIO @ 1.16.1
|
||||
adafruit/Adafruit BME280 Library @ 2.2.4
|
||||
adafruit/Adafruit Unified Sensor @ 1.1.14
|
||||
|
||||
build_flags =
|
||||
-DTEMPTEST33=1
|
||||
|
@ -35,17 +37,18 @@ build_flags =
|
|||
build_flags = ${env.build_flags}
|
||||
-DDEBUG=0
|
||||
-DNOADS=0
|
||||
-DNAME=\"WETTERSTATIONBORIS\"
|
||||
-DSTASSID=\"St.-Peters-Gasse\"
|
||||
-DSTAPSK=\"1952994784599317\"
|
||||
-DNAME=\"WETTERSTATION\"
|
||||
-DSTASSID=\"MagentaWLAN-RGDO\"
|
||||
-DSTAPSK=\"93329248424922704583\"
|
||||
-DGATEWAY=\"192.168.127.1\"
|
||||
-DDNS=\"192.168.127.1\"
|
||||
-DKMYIP=\"192.168.127.49\"
|
||||
-DKMYIP=\"192.168.127.40\"
|
||||
-Dmqtt_server=\"hjkmqtt.dedyn.io\"
|
||||
-Dmqtt_port=61883
|
||||
-DTERROR=5
|
||||
-DTLOWBATT=60
|
||||
-DTINTERVAL=1
|
||||
-DKorrekturLuftdruck=0.0
|
||||
|
||||
[env:marcel] ; Produktivsystem:
|
||||
build_flags = ${env.build_flags}
|
||||
|
@ -62,6 +65,7 @@ build_flags = ${env.build_flags}
|
|||
-DTERROR=20
|
||||
-DTLOWBATT=60
|
||||
-DTINTERVAL=10
|
||||
-DKorrekturLuftdruck=0.0
|
||||
|
||||
[env:boris] ; Produktivsystem:
|
||||
build_flags = ${env.build_flags}
|
||||
|
@ -78,3 +82,39 @@ build_flags = ${env.build_flags}
|
|||
-DTERROR=20
|
||||
-DTLOWBATT=60
|
||||
-DTINTERVAL=5
|
||||
-DKorrekturLuftdruck=0.0
|
||||
|
||||
[env:hjk]
|
||||
build_flags = ${env.build_flags}
|
||||
-DDEBUG=0
|
||||
-DNOADS=0
|
||||
-DNAME=\"WETTERSTATION\"
|
||||
-DSTASSID=\"MagentaWLAN-RGDO\"
|
||||
-DSTAPSK=\"93329248424922704583\"
|
||||
-DGATEWAY=\"192.168.127.1\"
|
||||
-DDNS=\"192.168.127.1\"
|
||||
-DKMYIP=\"192.168.127.41\"
|
||||
-Dmqtt_server=\"hjkmqtt.dedyn.io\"
|
||||
-Dmqtt_port=61883
|
||||
-DTERROR=5
|
||||
-DTLOWBATT=60
|
||||
-DTINTERVAL=10
|
||||
-DKorrekturLuftdruck=23.6
|
||||
|
||||
[env:filamentbox]
|
||||
build_flags = ${env.build_flags}
|
||||
-DDEBUG=0
|
||||
-DNOADS=0
|
||||
-DNAME=\"filamenbox\"
|
||||
-DSTASSID=\"MagentaWLAN-RGDO\"
|
||||
-DSTAPSK=\"93329248424922704583\"
|
||||
-DGATEWAY=\"192.168.127.1\"
|
||||
-DDNS=\"192.168.127.1\"
|
||||
-DKMYIP=\"192.168.127.42\"
|
||||
-Dmqtt_server=\"hjkmqtt.dedyn.io\"
|
||||
-Dmqtt_port=61883
|
||||
-DTERROR=5
|
||||
-DTLOWBATT=60
|
||||
-DTINTERVAL=15
|
||||
-DKorrekturLuftdruck=0.0
|
||||
|
||||
|
|
29
src/main.cpp
29
src/main.cpp
|
@ -5,7 +5,7 @@
|
|||
#include <PubSubClient.h>
|
||||
#include <Ticker.h>
|
||||
|
||||
#define BUILTIN_LED D15
|
||||
// #define BUILTIN_LED D2
|
||||
#define TRIGGER_PIN D7
|
||||
#define START_STOP_PIN D6
|
||||
|
||||
|
@ -25,7 +25,8 @@ PubSubClient client(espClient);
|
|||
|
||||
#include<mess_htu21.h>
|
||||
|
||||
#include <mess_BMP280.h>
|
||||
//#include <mess_BMP280.h>
|
||||
#include <mess_BME280.h>
|
||||
|
||||
#include <mess_Ub.h>
|
||||
|
||||
|
@ -72,6 +73,10 @@ long int Feldstaerke;
|
|||
|
||||
void setup() {
|
||||
startTime = millis();
|
||||
/* pinMode(BUILTIN_LED, OUTPUT);
|
||||
digitalWrite(BUILTIN_LED, LOW);
|
||||
delay(5000);
|
||||
digitalWrite(BUILTIN_LED, HIGH); */
|
||||
Serial.begin(74880);
|
||||
while ( !Serial ) delay(100); // wait for native usb
|
||||
WiFi.mode( WIFI_OFF );
|
||||
|
@ -84,15 +89,19 @@ void setup() {
|
|||
readSystemStatus();
|
||||
Serial.printf("Systemstatus : 0x%02x \n", SystemStatus);
|
||||
SystemStatus = 0x00;
|
||||
writeSystemStatus();
|
||||
delay(500);
|
||||
#if (MQTT == 0)
|
||||
init_HTU21();
|
||||
Init_BMP280();
|
||||
//Init_BMP280();
|
||||
Sensor_BME280();
|
||||
|
||||
init_MCP9808();
|
||||
initADS();
|
||||
#endif
|
||||
if (!F_ADS1115 == true){
|
||||
AKKU = getBattery(); // ca. 170 ms
|
||||
Serial.println("ALTE UB MESSUNG:");
|
||||
}
|
||||
else{
|
||||
MessungADS();
|
||||
|
@ -105,9 +114,9 @@ void setup() {
|
|||
if (F_ADS1115 == true){
|
||||
MessungADS();
|
||||
}
|
||||
if (F_BMP280 == true){
|
||||
/* if (F_BMP280 == true){
|
||||
read_BMP_280();
|
||||
}
|
||||
}*/
|
||||
if (F_MCP9808 == true){
|
||||
valTemp = getTemperature_MCP9808();
|
||||
}
|
||||
|
@ -142,7 +151,7 @@ void loop() {
|
|||
}
|
||||
|
||||
if (F_HTU_21D) M2M_HTU21D(hostname.c_str());
|
||||
if (F_BMP280) M2M_BMP280(hostname.c_str());
|
||||
M2M_BME280(hostname.c_str());
|
||||
if (F_MCP9808) M2M_Temperatur_MCP9808(hostname.c_str());
|
||||
sprintf(msg,"%ld", Feldstaerke);
|
||||
sprintf(topic, "%s%s%s", "hjk/devices/", hostname.c_str(), "/telemetry/RSSI" );
|
||||
|
@ -152,7 +161,7 @@ void loop() {
|
|||
client.publish(topic, msg, true);
|
||||
client.loop();
|
||||
delay(500);
|
||||
digitalWrite(BUILTIN_LED, HIGH);
|
||||
//digitalWrite(BUILTIN_LED, HIGH);
|
||||
/* ESP.deepSleep(5e6);
|
||||
delay(100); */
|
||||
endTime = millis();
|
||||
|
@ -264,7 +273,7 @@ void callback(char* topic1, byte* payload, unsigned int length)
|
|||
|
||||
void reconnect() {
|
||||
// Loop until we're reconnected
|
||||
sprintf(clientName, "%s%s", "ESP8266Client", sID);
|
||||
sprintf(clientName, "%s%s", "ESP8266Wetter", sID);
|
||||
while (!client.connected()) {
|
||||
Serial.print("Attempting MQTT connection...");
|
||||
//verifyFingerprint();
|
||||
|
@ -272,9 +281,9 @@ void reconnect() {
|
|||
if (client.connect(clientName)) {
|
||||
Serial.println("connected");
|
||||
// Once connected, publish an announcement...
|
||||
client.publish("outTopic", "hello world");
|
||||
// client.publish("outTopic", "hello world");
|
||||
// ... and resubscribe
|
||||
client.subscribe("inTopic");
|
||||
// client.subscribe("inTopic");
|
||||
} else {
|
||||
Serial.print("failed, rc=");
|
||||
Serial.print(client.state());
|
||||
|
|
Loading…
Reference in New Issue
Block a user