Compare commits

...

2 Commits

Author SHA1 Message Date
hans-jurgen
a8f9b38967 2023-05-58 2023-05-22 14:29:45 +02:00
hans-jurgen
1653c10830 2023-05-19
SystemStatus geändert
2023-05-19 14:19:58 +02:00
4 changed files with 25 additions and 17 deletions

View File

@ -1,9 +1,9 @@
#include <Arduino.h>
ADC_MODE(ADC_);
ADC_MODE(ADC_VDD);
const float MinimalSpannung = 2.85;
float korectur = 9.2800899887514060742407199100112e-4;
float korectur = 0.000954598;
char floatString[15] = {0};
float AKKU;

View File

@ -1,7 +1,7 @@
#include <Arduino.h>
const float MinimalSpannung = 2.85;
float korectur = 1.02910;
float koa = 0.984326019;
char floatString[15] = {0};
float AKKU;

View File

@ -28,7 +28,6 @@ build_flags =
-DTEMPTEST33=1
-DNOBATT=0
-DMaxErrCount=20
-DMQTT=0

View File

@ -27,7 +27,7 @@ PubSubClient client(espClient);
#include <mess_BMP280.h>
#include <mess_Ub_old.h>
#include <mess_Ub.h>
#include <messADS1115.h>
@ -66,6 +66,7 @@ char topic[100];
char topic_1[50];
char topicWert[20];
char msg[20];
long int Feldstaerke;
@ -90,8 +91,13 @@ void setup() {
init_MCP9808();
initADS();
#endif
valTemp = getTemperature_MCP9808();
AKKU = getBattery(korectur); // ca. 170 ms
if (!F_ADS1115 == true){
AKKU = getBattery(); // ca. 170 ms
}
else{
MessungADS();
AKKU = readChannel(ADS1115_COMP_0_GND);
}
// ca. 280 ms
if (F_HTU_21D == true){
read_HTU21D();
@ -127,21 +133,23 @@ void loop() {
int currentMillis = millis();
if (currentMillis - previousMillis >= 10000) {
previousMillis = currentMillis;
/* read_HTU21D();
read_BMP_280();
valTemp = getTemperature_MCP9808(); */
dtostrf(AKKU,8,2,ADSData.Akku);
sprintf(topic, "%s%s%s", "hjk/devices/", hostname.c_str(), "/telemetry/battery" );
client.publish(topic, ADSData.Akku, true);
#if(MQTT == 0)
M2M_HTU21D(hostname.c_str());
M2M_BMP280(hostname.c_str());
M2M_Temperatur_MCP9808(hostname.c_str());
#endif
long int Feldstaerke = WiFi.RSSI();
if (F_ADS1115 == true){
sprintf(topic, "%s%s%s", "hjk/devices/", hostname.c_str(), "/telemetry/Solar" );
client.publish(topic, ADSData.Solar, true);
}
if (F_HTU_21D) M2M_HTU21D(hostname.c_str());
if (F_BMP280) M2M_BMP280(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" );
client.publish(topic, msg, true);
sprintf(msg,"0x%0x", SystemStatus);
sprintf(topic, "%s%s%s", "hjk/devices/", hostname.c_str(), "/telemetry/SystemStatus" );
client.publish(topic, msg, true);
client.loop();
delay(500);
digitalWrite(BUILTIN_LED, HIGH);
@ -229,7 +237,8 @@ void setup_wifi() {
}
Serial.println(" WiFi connected");
Serial.print("IP address: \t");
Serial.print(WiFi.localIP()); Serial.print("\tRESSI: "); Serial.println(WiFi.RSSI());
Feldstaerke = WiFi.RSSI();
Serial.print(WiFi.localIP()); Serial.print("\tRESSI: "); Serial.println(Feldstaerke);
/* delay(2000);
ESP.deepSleep(2e6, WAKE_RF_DEFAULT);
delay(100); */