2025-11-1002
This commit is contained in:
82
include/mess_BME280.h
Normal file
82
include/mess_BME280.h
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
#include "Wire.h"
|
||||||
|
|
||||||
|
#define Anzahl_Sensoren_BME280 2 // Mögliche Werte: '0','1','2'
|
||||||
|
//#define Korrektur_Luftdruck KorrekturLuftdruck // Korrekturwert um Abweichungen zu offiziellen Wetterstationen auszugleichen
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
// Konfiguration BME280 - Temperatur und Luftfeuchte
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
#include "Adafruit_Sensor.h"
|
||||||
|
#include "Adafruit_BME280.h"
|
||||||
|
uint8_t BME280_adresse[2] = {0x76, 0x77};
|
||||||
|
#define I2C_SDA 33
|
||||||
|
#define I2C_SCL 32
|
||||||
|
#define SEALEVELPRESSURE_HPA (1013.25f)
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
const float No_Val = 999.99;
|
||||||
|
float Temp[2] = {No_Val, No_Val};
|
||||||
|
float Feuchte[2] = {No_Val, No_Val};
|
||||||
|
float L_Druck[2] = {No_Val, No_Val};
|
||||||
|
|
||||||
|
struct {
|
||||||
|
char temperature[15] = {0};
|
||||||
|
char pressure[15] = {0};
|
||||||
|
char approx_altitud[15] = {0};
|
||||||
|
char humity[15] = {0};
|
||||||
|
} BME280Data;
|
||||||
|
|
||||||
|
TwoWire I2CBME = TwoWire(0);
|
||||||
|
Adafruit_BME280 my_bme;
|
||||||
|
|
||||||
|
void Sensor_BME280() {
|
||||||
|
if (Anzahl_Sensoren_BME280 > 0) {
|
||||||
|
float Temperatur_BME;
|
||||||
|
float Luftfeuchte_BME;
|
||||||
|
float Luftdruck_BME;
|
||||||
|
boolean check;
|
||||||
|
|
||||||
|
I2CBME.begin(I2C_SDA, I2C_SCL, 100000);
|
||||||
|
|
||||||
|
for (byte i = 0; i < Anzahl_Sensoren_BME280; i++) {
|
||||||
|
Serial.println(BME280_adresse[i]);
|
||||||
|
delay(5000);
|
||||||
|
check = my_bme.begin(BME280_adresse[i], &I2CBME); // I2C Adresse
|
||||||
|
delay (100); // time to get system ready
|
||||||
|
if (check) { // if bme ok
|
||||||
|
Temperatur_BME = my_bme.readTemperature();
|
||||||
|
Luftfeuchte_BME = my_bme.readHumidity();
|
||||||
|
Luftdruck_BME = my_bme.readPressure();
|
||||||
|
Luftdruck_BME = (Luftdruck_BME/100) + KorrekturLuftdruck;
|
||||||
|
//Luftdruck_BME = 220;
|
||||||
|
Serial.print("Temperature (BME280):\t\t");
|
||||||
|
Serial.print(Temperatur_BME);
|
||||||
|
Serial.println(" °C");
|
||||||
|
Serial.print("Luftfeuchtigkeit (BME280):\t");
|
||||||
|
Serial.print(Luftfeuchte_BME);
|
||||||
|
Serial.println(" %");
|
||||||
|
Serial.print("Luftdruck (BME280):\t\t");
|
||||||
|
Serial.print(Luftdruck_BME);
|
||||||
|
Serial.println(" hPa");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Temperatur_BME = No_Val;
|
||||||
|
Luftfeuchte_BME = No_Val;
|
||||||
|
Luftdruck_BME = No_Val;
|
||||||
|
Serial.println(" KEIN BME 280 Gefunden !!!!");
|
||||||
|
}
|
||||||
|
if (i == 0) { // erster BME
|
||||||
|
Temp[0] = Temperatur_BME; // Hier kann die Zuordnung der Sensoren geändert werden
|
||||||
|
Feuchte[0] = Luftfeuchte_BME; // Hier kann die Zuordnung der Sensoren geändert werden
|
||||||
|
L_Druck[0] = Luftdruck_BME;
|
||||||
|
}
|
||||||
|
if (i == 1) { // zweiter BME
|
||||||
|
Temp[1] = Temperatur_BME; // Hier kann die Zuordnung der Sensoren geändert werden
|
||||||
|
Feuchte[1] = Luftfeuchte_BME; // Hier kann die Zuordnung der Sensoren geändert werden
|
||||||
|
L_Druck[1] = Luftdruck_BME;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,11 +22,11 @@ void read_HTU21D() {
|
|||||||
dtostrf(h,8,2,htuData.humity);
|
dtostrf(h,8,2,htuData.humity);
|
||||||
}
|
}
|
||||||
|
|
||||||
void M2M_HTU21D(long deviceId = 4711) {
|
/* void M2M_HTU21D(long deviceId = 4711) {
|
||||||
char topic[100];
|
char topic[100];
|
||||||
sprintf(topic, "%s%ld%s", "hjk/devices/", deviceId, "/telemetry/temperature_Htu_21" );
|
sprintf(topic, "%s%ld%s", "hjk/devices/", deviceId, "/telemetry/temperature_Htu_21" );
|
||||||
client.publish(topic, htuData.temperature, true);
|
client.publish(topic, htuData.temperature, true);
|
||||||
sprintf(topic, "%s%ld%s", "hjk/devices/", deviceId, "/telemetry/humity" );
|
sprintf(topic, "%s%ld%s", "hjk/devices/", deviceId, "/telemetry/humity" );
|
||||||
client.publish(topic, htuData.humity, true);
|
client.publish(topic, htuData.humity, true);
|
||||||
Serial.printf("HTU21:\t\t %s °C\n", htuData.temperature);
|
Serial.printf("HTU21:\t\t %s °C\n", htuData.temperature);
|
||||||
Serial.printf("HTU21:\t\t %s %% \n", htuData.humity);
|
Serial.printf("HTU21:\t\t %s %% \n", htuData.humity); */
|
||||||
@@ -22,7 +22,7 @@ build_flags =
|
|||||||
-DHELLIGKEIT
|
-DHELLIGKEIT
|
||||||
-DNoDebugCO2
|
-DNoDebugCO2
|
||||||
-DHTU_Korrectur=-3.15
|
-DHTU_Korrectur=-3.15
|
||||||
|
-DKorrekturLuftdruck=0.00
|
||||||
lib_deps =
|
lib_deps =
|
||||||
knolleary/PubSubClient @ 2.8
|
knolleary/PubSubClient @ 2.8
|
||||||
;adafruit/Adafruit GFX Library @ 1.10.4
|
;adafruit/Adafruit GFX Library @ 1.10.4
|
||||||
@@ -30,7 +30,10 @@ lib_deps =
|
|||||||
2dom/PxMatrix LED MATRIX library @ 1.8.2
|
2dom/PxMatrix LED MATRIX library @ 1.8.2
|
||||||
;adafruit/Adafruit BusIO @ 1.7.2
|
;adafruit/Adafruit BusIO @ 1.7.2
|
||||||
adafruit/Adafruit BusIO @ 1.16.1
|
adafruit/Adafruit BusIO @ 1.16.1
|
||||||
adafruit/Adafruit HTU21DF Library @ 1.0.5
|
;adafruit/Adafruit HTU21DF Library @ 1.0.5
|
||||||
|
adafruit/Adafruit BME280 Library @ 2.2.4
|
||||||
|
adafruit/Adafruit Unified Sensor @ 1.1.14
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
96
src/main.cpp
96
src/main.cpp
@@ -17,14 +17,10 @@
|
|||||||
#include <Fonts/Picopixel.h>
|
#include <Fonts/Picopixel.h>
|
||||||
|
|
||||||
#include <PxMatrix.h>
|
#include <PxMatrix.h>
|
||||||
#include <Adafruit_HTU21DF.h>
|
|
||||||
|
|
||||||
|
#include <mess_BME280.h>
|
||||||
#include <CO2.h>
|
#include <CO2.h>
|
||||||
|
|
||||||
#define I2C_SDA 17
|
|
||||||
#define I2C_SCL 2
|
|
||||||
|
|
||||||
|
|
||||||
// Pins for LED MATRIX
|
// Pins for LED MATRIX
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
|
|
||||||
@@ -55,10 +51,6 @@ Ticker display_ticker;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* #define SDA 21
|
|
||||||
#define SCL 22
|
|
||||||
#define RX1 9
|
|
||||||
#define TX1 10 */
|
|
||||||
|
|
||||||
#define MaxErrCount 30
|
#define MaxErrCount 30
|
||||||
unsigned long startTime;
|
unsigned long startTime;
|
||||||
@@ -69,8 +61,6 @@ unsigned long endTime;
|
|||||||
#define mqtt_port 61883
|
#define mqtt_port 61883
|
||||||
WiFiClient espClient;
|
WiFiClient espClient;
|
||||||
PubSubClient client(espClient);
|
PubSubClient client(espClient);
|
||||||
Adafruit_HTU21DF htu = Adafruit_HTU21DF();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define matrix_width 64
|
#define matrix_width 64
|
||||||
@@ -78,7 +68,7 @@ Adafruit_HTU21DF htu = Adafruit_HTU21DF();
|
|||||||
|
|
||||||
// This defines the 'on' time of the display is us. The larger this number,
|
// This defines the 'on' time of the display is us. The larger this number,
|
||||||
// the brighter the display. If too large the ESP will crash
|
// the brighter the display. If too large the ESP will crash
|
||||||
uint8_t display_draw_time = 35; //30-70 is usually fine
|
uint8_t display_draw_time=10; //30-70 is usually fine
|
||||||
|
|
||||||
//PxMATRIX display(32,16,P_LAT, P_OE,P_A,P_B,P_C);
|
//PxMATRIX display(32,16,P_LAT, P_OE,P_A,P_B,P_C);
|
||||||
PxMATRIX display(64,32,P_LAT, P_OE,P_A,P_B,P_C,P_D);
|
PxMATRIX display(64,32,P_LAT, P_OE,P_A,P_B,P_C,P_D);
|
||||||
@@ -101,10 +91,17 @@ uint16_t myHimmelblau = display.color565(0, 191, 255);
|
|||||||
|
|
||||||
uint16_t myCOLORS[8]={myRED,myGREEN,myBLUE,myWHITE,myYELLOW,myCYAN,myMAGENTA,myBLACK};
|
uint16_t myCOLORS[8]={myRED,myGREEN,myBLUE,myWHITE,myYELLOW,myCYAN,myMAGENTA,myBLACK};
|
||||||
|
|
||||||
|
//------- Helligkeit des Display -------
|
||||||
|
uint8_t dunkel = 25;
|
||||||
|
uint8_t hell = 255;
|
||||||
|
//---- Zeitsteuerung der Helligkeit ----
|
||||||
|
u_int16_t StartderAbdunklung = 20;
|
||||||
|
u_int16_t EndederAbdunklung = 7;
|
||||||
|
|
||||||
// Wifi
|
// Wifi
|
||||||
char ssid[] = "MagentaWLAN-RGDO"; // your network SSID (name)
|
char ssid[] = "MagentaWLAN-RGDO"; // your network SSID (name)
|
||||||
char pass[] = "93329248424922704583"; // your network password
|
char pass[] = "93329248424922704583"; // your network password
|
||||||
IPAddress ip( 192, 168, 127, 52);
|
IPAddress ip( 192, 168, 127, 53);
|
||||||
IPAddress gateway( 192, 168, 127, 1 );
|
IPAddress gateway( 192, 168, 127, 1 );
|
||||||
IPAddress subnet( 255, 255, 255, 0 );
|
IPAddress subnet( 255, 255, 255, 0 );
|
||||||
IPAddress dns1(192, 168, 127, 1); // DNS-Server 1
|
IPAddress dns1(192, 168, 127, 1); // DNS-Server 1
|
||||||
@@ -161,6 +158,15 @@ const char* mqtt_server = "hjkmqtt.dedyn.io";
|
|||||||
char topic_0[50];
|
char topic_0[50];
|
||||||
char msg[20];
|
char msg[20];
|
||||||
char clientName[30];
|
char clientName[30];
|
||||||
|
/* const char* topic_1 = "hjk/devices/WETTERSTATIONMARCEL/telemetry/temperature"; // Wohnzimmer 3933178
|
||||||
|
const char* topic_Flur = "hjk/devices/267014/telemetry/temperature"; // Flur
|
||||||
|
const char* topic_3 = "hjk/devices/11277819/telemetry/temperature"; // Büro 11277819 */
|
||||||
|
/* const char* topic_ZeitStart = "hjk/devices/DisplayMarcel/telemetry/Start";
|
||||||
|
const char* topic_ZeitEnde = "hjk/devices/DisplayMarcel/telemetry/Ende";
|
||||||
|
const char* topic_Hell = "hjk/devices/DisplayMarcel/telemetry/Hell";
|
||||||
|
const char* topic_Dunkel = "hjk/devices/DisplayMarcel/telemetry/Dunkel"; */
|
||||||
|
//const char* topic_Co2 = "hjk/devices/257923/telemetry/co2"; // Co2 Sensor
|
||||||
|
const char* topic_Hell = "hjk/devices/DisplayMarcel/telemetry/Lux";
|
||||||
const char* topic_Covid = "hjk/devices/Covid19/telemetry/Covid19";
|
const char* topic_Covid = "hjk/devices/Covid19/telemetry/Covid19";
|
||||||
const char* topic_Wetter = "hjk/devices/WETTERSTATIONMARCEL/telemetry/temperature_Htu_21";
|
const char* topic_Wetter = "hjk/devices/WETTERSTATIONMARCEL/telemetry/temperature_Htu_21";
|
||||||
const char* topic_Pressure = "hjk/devices/WETTERSTATIONMARCEL/telemetry/pressure";
|
const char* topic_Pressure = "hjk/devices/WETTERSTATIONMARCEL/telemetry/pressure";
|
||||||
@@ -170,6 +176,7 @@ const char* topic_Akku = "hjk/devices/WETTERSTATIONMARCEL/telemetry/battery";
|
|||||||
const char* topic_Helligkeit = "hjk/devices/DisplayMarcel/telemetry/Lux";
|
const char* topic_Helligkeit = "hjk/devices/DisplayMarcel/telemetry/Lux";
|
||||||
|
|
||||||
void callback(char* topic1, byte* payload, unsigned int length);
|
void callback(char* topic1, byte* payload, unsigned int length);
|
||||||
|
//void ZeigeZeit(int xPos);
|
||||||
void scroll_text(uint8_t ypos, unsigned long scroll_delay, String text, uint8_t colorR, uint8_t colorG, uint8_t colorB, boolean blink);
|
void scroll_text(uint8_t ypos, unsigned long scroll_delay, String text, uint8_t colorR, uint8_t colorG, uint8_t colorB, boolean blink);
|
||||||
void scroll_text2(uint8_t ypos, unsigned long scroll_delay, String text, uint8_t colorR, uint8_t colorG, uint8_t colorB, boolean blink);
|
void scroll_text2(uint8_t ypos, unsigned long scroll_delay, String text, uint8_t colorR, uint8_t colorG, uint8_t colorB, boolean blink);
|
||||||
void scroll_Grad(uint8_t ypos, unsigned long scroll_delay, String text, uint8_t colorR, uint8_t colorG, uint8_t colorB, boolean blink);
|
void scroll_Grad(uint8_t ypos, unsigned long scroll_delay, String text, uint8_t colorR, uint8_t colorG, uint8_t colorB, boolean blink);
|
||||||
@@ -220,6 +227,7 @@ void print_wifi_status() {
|
|||||||
Serial.println(" dBm");
|
Serial.println(" dBm");
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
scroll_text(32-16,40,"IP Adress: " + WiFi.localIP().toString()+ " signal strength (RSSI): " + String(rssi, DEC) + " dBm", 96,96,0, false);
|
scroll_text(32-16,40,"IP Adress: " + WiFi.localIP().toString()+ " signal strength (RSSI): " + String(rssi, DEC) + " dBm", 96,96,0, false);
|
||||||
|
//delay(2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void display_update_enable(bool is_enable)
|
void display_update_enable(bool is_enable)
|
||||||
@@ -317,11 +325,15 @@ void reconnect() {
|
|||||||
if (client.connect(clientName)) {
|
if (client.connect(clientName)) {
|
||||||
/* MQTTStatus.setPic(3); */
|
/* MQTTStatus.setPic(3); */
|
||||||
Serial.println("connected");
|
Serial.println("connected");
|
||||||
|
/* client.subscribe(topic_Co2); */
|
||||||
client.subscribe(topic_Covid);
|
client.subscribe(topic_Covid);
|
||||||
client.subscribe(topic_Wetter);
|
client.subscribe(topic_Wetter);
|
||||||
client.subscribe(topic_Pressure);
|
client.subscribe(topic_Pressure);
|
||||||
client.subscribe(topic_Luftfeuchtigkeit);
|
client.subscribe(topic_Luftfeuchtigkeit);
|
||||||
client.subscribe(topic_Helligkeit);
|
client.subscribe(topic_Helligkeit);
|
||||||
|
/* client.subscribe(topic_Dunkel);
|
||||||
|
client.subscribe(topic_ZeitEnde);
|
||||||
|
client.subscribe(topic_ZeitStart); */
|
||||||
client.subscribe(topic_Akku);
|
client.subscribe(topic_Akku);
|
||||||
} else {
|
} else {
|
||||||
Serial.print("failed, rc=");
|
Serial.print("failed, rc=");
|
||||||
@@ -337,6 +349,7 @@ void ZeigeZeit(tm localTime, int xPos = 2, int yPos = 8)
|
|||||||
{
|
{
|
||||||
if (xPos < 4) xPos = 4;
|
if (xPos < 4) xPos = 4;
|
||||||
if (yPos < 4) yPos = 4;
|
if (yPos < 4) yPos = 4;
|
||||||
|
//Serial.print(timeClient.getFormattedTime()); Serial.println();
|
||||||
char szTime[4];
|
char szTime[4];
|
||||||
sprintf(szTime, "%02d", localTime.tm_hour);
|
sprintf(szTime, "%02d", localTime.tm_hour);
|
||||||
display.setCursor(xPos-1, yPos);
|
display.setCursor(xPos-1, yPos);
|
||||||
@@ -351,6 +364,8 @@ void ZeigeZeit(tm localTime, int xPos = 2, int yPos = 8)
|
|||||||
display.fillRect(xPos + 27, yPos - 3, 2, 2, myWHITE);
|
display.fillRect(xPos + 27, yPos - 3, 2, 2, myWHITE);
|
||||||
display.fillRect(xPos + 27, yPos + 1, 2, 2, myWHITE);
|
display.fillRect(xPos + 27, yPos + 1, 2, 2, myWHITE);
|
||||||
}
|
}
|
||||||
|
/* display.fillRect(xPos + 27, yPos - 3, 2, 2, myMAGENTA);
|
||||||
|
display.fillRect(xPos + 27, yPos + 1, 2, 2, myMAGENTA); */
|
||||||
sprintf(szTime, "%02d", localTime.tm_min);
|
sprintf(szTime, "%02d", localTime.tm_min);
|
||||||
display.setCursor(xPos + 29, yPos);
|
display.setCursor(xPos + 29, yPos);
|
||||||
display.setFont(&FreeMonoBold12pt7b);
|
display.setFont(&FreeMonoBold12pt7b);
|
||||||
@@ -406,6 +421,7 @@ void ZeigeCO(int xPos = 1, int yPos = 19)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//display.setTextColor(myGREEN);
|
||||||
display.fillRect(xPos, yPos-2, 64-xPos, 8+2, (myBLACK));
|
display.fillRect(xPos, yPos-2, 64-xPos, 8+2, (myBLACK));
|
||||||
display.print("CO :");
|
display.print("CO :");
|
||||||
display.print(szCO);
|
display.print(szCO);
|
||||||
@@ -430,6 +446,7 @@ void ZeigeDatum(tm localTime, int xPos = 2, int yPos = 1)
|
|||||||
(localTime.tm_year+1900)-2000);
|
(localTime.tm_year+1900)-2000);
|
||||||
display.setCursor(xPos, yPos);
|
display.setCursor(xPos, yPos);
|
||||||
display.fillRect(xPos, yPos-2, 64-xPos, 8+2, (myBLACK));
|
display.fillRect(xPos, yPos-2, 64-xPos, 8+2, (myBLACK));
|
||||||
|
// display.setFont(&Picopixel);
|
||||||
display.setTextColor(myDATUM);
|
display.setTextColor(myDATUM);
|
||||||
display.print(szDATUM);
|
display.print(szDATUM);
|
||||||
display.setFont();
|
display.setFont();
|
||||||
@@ -537,6 +554,10 @@ void ZeigeInnenCO(int Co2){
|
|||||||
display.setTextColor(myRED);
|
display.setTextColor(myRED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* case CO2_WARN_4 ... CO2_WARN_5 -1: {
|
||||||
|
display.setTextColor(myRED);
|
||||||
|
break;
|
||||||
|
} */
|
||||||
default: {
|
default: {
|
||||||
display.setTextColor(myMAGENTA);
|
display.setTextColor(myMAGENTA);
|
||||||
break;
|
break;
|
||||||
@@ -612,7 +633,7 @@ void BlinkSec(bool blink){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void readHtu(){
|
/* void readHtu(){
|
||||||
if (!NOHTU){
|
if (!NOHTU){
|
||||||
FeuchteInnen = htu.readHumidity();
|
FeuchteInnen = htu.readHumidity();
|
||||||
TemparaturInnen = htu.readTemperature();
|
TemparaturInnen = htu.readTemperature();
|
||||||
@@ -622,7 +643,7 @@ void readHtu(){
|
|||||||
FeuchteInnen = 20.00;
|
FeuchteInnen = 20.00;
|
||||||
TemparaturInnen = 30.00;
|
TemparaturInnen = 30.00;
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
void Test()
|
void Test()
|
||||||
{
|
{
|
||||||
@@ -636,15 +657,14 @@ void Test()
|
|||||||
void setup() {
|
void setup() {
|
||||||
startTime = millis();
|
startTime = millis();
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
//Wire.begin(I2C_SDA, I2C_SCL);
|
|
||||||
beginC02();
|
|
||||||
if (!htu.begin()){
|
|
||||||
Serial.println("Couldn't find sensor!");
|
|
||||||
NOHTU = true;
|
|
||||||
delay(5000);
|
|
||||||
|
|
||||||
}
|
Sensor_BME280();
|
||||||
readHtu();
|
;
|
||||||
|
Serial.println(Temp[0]);
|
||||||
|
|
||||||
|
|
||||||
|
delay(10000);
|
||||||
|
beginC02();
|
||||||
WiFi.mode( WIFI_OFF );
|
WiFi.mode( WIFI_OFF );
|
||||||
// WiFi.forceSleepBegin();
|
// WiFi.forceSleepBegin();
|
||||||
delay( 10 );
|
delay( 10 );
|
||||||
@@ -657,17 +677,21 @@ void setup() {
|
|||||||
|
|
||||||
// Set the color order {RRGGBB, RRBBGG, GGRRBB, GGBBRR, BBRRGG, BBGGRR} (default is RRGGBB)
|
// Set the color order {RRGGBB, RRBBGG, GGRRBB, GGBBRR, BBRRGG, BBGGRR} (default is RRGGBB)
|
||||||
display.setColorOrder(RRBBGG);
|
display.setColorOrder(RRBBGG);
|
||||||
|
// Set the brightness of the panels (default is 255)
|
||||||
|
|
||||||
display.setBrightness(255);
|
display.setBrightness(255);
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
display.setTextColor(myRED);
|
|
||||||
|
/* display.setTextColor(myRED);
|
||||||
display.setCursor(0,0);
|
display.setCursor(0,0);
|
||||||
display.print("Pixel");
|
display.print("Pixel");
|
||||||
display.setTextColor(myGREEN);
|
display.setTextColor(myGREEN);
|
||||||
display.setCursor(30,0);
|
display.setCursor(30,0);
|
||||||
display.print("Time");
|
display.print("Time"); */
|
||||||
display_update_enable(true);
|
display_update_enable(true);
|
||||||
|
delay(5000);
|
||||||
|
//--------------------------------------------------
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
print_wifi_status();
|
print_wifi_status();
|
||||||
configTime(0, 0, NTP_SERVER);
|
configTime(0, 0, NTP_SERVER);
|
||||||
@@ -874,7 +898,7 @@ void loop() {
|
|||||||
readCo2Flag = true;
|
readCo2Flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((timeinfo.tm_min % 2) == 0)
|
/* if ((timeinfo.tm_min % 2) == 0)
|
||||||
{
|
{
|
||||||
if (readHtuFlag == true)
|
if (readHtuFlag == true)
|
||||||
{
|
{
|
||||||
@@ -883,12 +907,12 @@ void loop() {
|
|||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
readHtuFlag = true;
|
readHtuFlag = true;
|
||||||
}
|
} */
|
||||||
|
|
||||||
switch (timeinfo.tm_sec)
|
switch (timeinfo.tm_sec)
|
||||||
{
|
{
|
||||||
case 0 ... 14:
|
case 0 ... 14:
|
||||||
{
|
{
|
||||||
|
//ZeigeInnenTemp(TemparaturInnen);
|
||||||
ZeigeTemperatur(TemparaturInnen, myGREEN);
|
ZeigeTemperatur(TemparaturInnen, myGREEN);
|
||||||
ZeigeInnenFeuchtigkeit(FeuchteInnen);
|
ZeigeInnenFeuchtigkeit(FeuchteInnen);
|
||||||
ZeigeInnenCO(CO2Wert);
|
ZeigeInnenCO(CO2Wert);
|
||||||
@@ -896,6 +920,7 @@ void loop() {
|
|||||||
}
|
}
|
||||||
case 15 ... 29:
|
case 15 ... 29:
|
||||||
{
|
{
|
||||||
|
//ZeigeAussenTemp(Aussentemp);
|
||||||
ZeigeTemperatur(Aussentemp, myHimmelblau);
|
ZeigeTemperatur(Aussentemp, myHimmelblau);
|
||||||
ZeigeAussenFeuchtigkeit(Luftfeuchtigkeit);
|
ZeigeAussenFeuchtigkeit(Luftfeuchtigkeit);
|
||||||
ZeigeLuftdruck(Pressure);
|
ZeigeLuftdruck(Pressure);
|
||||||
@@ -903,6 +928,7 @@ void loop() {
|
|||||||
}
|
}
|
||||||
case 30 ... 44:
|
case 30 ... 44:
|
||||||
{
|
{
|
||||||
|
//ZeigeInnenTemp(TemparaturInnen);
|
||||||
ZeigeTemperatur(TemparaturInnen, myGREEN);
|
ZeigeTemperatur(TemparaturInnen, myGREEN);
|
||||||
ZeigeInnenFeuchtigkeit(FeuchteInnen);
|
ZeigeInnenFeuchtigkeit(FeuchteInnen);
|
||||||
ZeigeInnenCO(CO2Wert);
|
ZeigeInnenCO(CO2Wert);
|
||||||
@@ -910,6 +936,7 @@ void loop() {
|
|||||||
}
|
}
|
||||||
case 45 ... 59:
|
case 45 ... 59:
|
||||||
{
|
{
|
||||||
|
//ZeigeAussenTemp(Aussentemp);
|
||||||
ZeigeTemperatur(Aussentemp, myHimmelblau);
|
ZeigeTemperatur(Aussentemp, myHimmelblau);
|
||||||
ZeigeAussenFeuchtigkeit(Luftfeuchtigkeit);
|
ZeigeAussenFeuchtigkeit(Luftfeuchtigkeit);
|
||||||
ZeigeLuftdruck(Pressure);
|
ZeigeLuftdruck(Pressure);
|
||||||
@@ -917,12 +944,11 @@ void loop() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
client.loop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getNTPtime(int sec) {
|
bool getNTPtime(int sec) {
|
||||||
|
|
||||||
{
|
|
||||||
uint32_t start = millis();
|
uint32_t start = millis();
|
||||||
do {
|
do {
|
||||||
time(&now);
|
time(&now);
|
||||||
@@ -931,12 +957,6 @@ bool getNTPtime(int sec) {
|
|||||||
delay(10);
|
delay(10);
|
||||||
} while (((millis() - start) <= (1000 * sec)) && (timeinfo.tm_year < (2016 - 1900)));
|
} while (((millis() - start) <= (1000 * sec)) && (timeinfo.tm_year < (2016 - 1900)));
|
||||||
if (timeinfo.tm_year <= (2016 - 1900)) return false; // the NTP call was not successful
|
if (timeinfo.tm_year <= (2016 - 1900)) return false; // the NTP call was not successful
|
||||||
//Serial.print("now "); Serial.println(now);
|
|
||||||
/* char time_output[30];
|
|
||||||
strftime(time_output, 30, "%a %d-%m-%y %T", localtime(&now));
|
|
||||||
Serial.println(time_output);
|
|
||||||
Serial.println(); */
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user