Compare commits
No commits in common. "a8f9b3896760b6b3842882e3dbb345cf5cde1236" and "62ec97532969c714c08b8502b606595f24927381" have entirely different histories.
a8f9b38967
...
62ec975329
|
@ -1,9 +1,9 @@
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
ADC_MODE(ADC_VDD);
|
ADC_MODE(ADC_);
|
||||||
|
|
||||||
const float MinimalSpannung = 2.85;
|
const float MinimalSpannung = 2.85;
|
||||||
float korectur = 0.000954598;
|
float korectur = 9.2800899887514060742407199100112e-4;
|
||||||
char floatString[15] = {0};
|
char floatString[15] = {0};
|
||||||
float AKKU;
|
float AKKU;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
const float MinimalSpannung = 2.85;
|
const float MinimalSpannung = 2.85;
|
||||||
float koa = 0.984326019;
|
float korectur = 1.02910;
|
||||||
char floatString[15] = {0};
|
char floatString[15] = {0};
|
||||||
float AKKU;
|
float AKKU;
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ build_flags =
|
||||||
-DTEMPTEST33=1
|
-DTEMPTEST33=1
|
||||||
-DNOBATT=0
|
-DNOBATT=0
|
||||||
-DMaxErrCount=20
|
-DMaxErrCount=20
|
||||||
|
-DMQTT=0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
35
src/main.cpp
35
src/main.cpp
|
@ -27,7 +27,7 @@ PubSubClient client(espClient);
|
||||||
|
|
||||||
#include <mess_BMP280.h>
|
#include <mess_BMP280.h>
|
||||||
|
|
||||||
#include <mess_Ub.h>
|
#include <mess_Ub_old.h>
|
||||||
|
|
||||||
#include <messADS1115.h>
|
#include <messADS1115.h>
|
||||||
|
|
||||||
|
@ -66,7 +66,6 @@ char topic[100];
|
||||||
char topic_1[50];
|
char topic_1[50];
|
||||||
char topicWert[20];
|
char topicWert[20];
|
||||||
char msg[20];
|
char msg[20];
|
||||||
long int Feldstaerke;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,13 +90,8 @@ void setup() {
|
||||||
init_MCP9808();
|
init_MCP9808();
|
||||||
initADS();
|
initADS();
|
||||||
#endif
|
#endif
|
||||||
if (!F_ADS1115 == true){
|
valTemp = getTemperature_MCP9808();
|
||||||
AKKU = getBattery(); // ca. 170 ms
|
AKKU = getBattery(korectur); // ca. 170 ms
|
||||||
}
|
|
||||||
else{
|
|
||||||
MessungADS();
|
|
||||||
AKKU = readChannel(ADS1115_COMP_0_GND);
|
|
||||||
}
|
|
||||||
// ca. 280 ms
|
// ca. 280 ms
|
||||||
if (F_HTU_21D == true){
|
if (F_HTU_21D == true){
|
||||||
read_HTU21D();
|
read_HTU21D();
|
||||||
|
@ -133,23 +127,21 @@ void loop() {
|
||||||
int currentMillis = millis();
|
int currentMillis = millis();
|
||||||
if (currentMillis - previousMillis >= 10000) {
|
if (currentMillis - previousMillis >= 10000) {
|
||||||
previousMillis = currentMillis;
|
previousMillis = currentMillis;
|
||||||
|
/* read_HTU21D();
|
||||||
|
read_BMP_280();
|
||||||
|
valTemp = getTemperature_MCP9808(); */
|
||||||
dtostrf(AKKU,8,2,ADSData.Akku);
|
dtostrf(AKKU,8,2,ADSData.Akku);
|
||||||
sprintf(topic, "%s%s%s", "hjk/devices/", hostname.c_str(), "/telemetry/battery" );
|
sprintf(topic, "%s%s%s", "hjk/devices/", hostname.c_str(), "/telemetry/battery" );
|
||||||
client.publish(topic, ADSData.Akku, true);
|
client.publish(topic, ADSData.Akku, true);
|
||||||
if (F_ADS1115 == true){
|
#if(MQTT == 0)
|
||||||
sprintf(topic, "%s%s%s", "hjk/devices/", hostname.c_str(), "/telemetry/Solar" );
|
M2M_HTU21D(hostname.c_str());
|
||||||
client.publish(topic, ADSData.Solar, true);
|
M2M_BMP280(hostname.c_str());
|
||||||
}
|
M2M_Temperatur_MCP9808(hostname.c_str());
|
||||||
|
#endif
|
||||||
if (F_HTU_21D) M2M_HTU21D(hostname.c_str());
|
long int Feldstaerke = WiFi.RSSI();
|
||||||
if (F_BMP280) M2M_BMP280(hostname.c_str());
|
|
||||||
if (F_MCP9808) M2M_Temperatur_MCP9808(hostname.c_str());
|
|
||||||
sprintf(msg,"%ld", Feldstaerke);
|
sprintf(msg,"%ld", Feldstaerke);
|
||||||
sprintf(topic, "%s%s%s", "hjk/devices/", hostname.c_str(), "/telemetry/RSSI" );
|
sprintf(topic, "%s%s%s", "hjk/devices/", hostname.c_str(), "/telemetry/RSSI" );
|
||||||
client.publish(topic, msg, true);
|
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();
|
client.loop();
|
||||||
delay(500);
|
delay(500);
|
||||||
digitalWrite(BUILTIN_LED, HIGH);
|
digitalWrite(BUILTIN_LED, HIGH);
|
||||||
|
@ -237,8 +229,7 @@ void setup_wifi() {
|
||||||
}
|
}
|
||||||
Serial.println(" WiFi connected");
|
Serial.println(" WiFi connected");
|
||||||
Serial.print("IP address: \t");
|
Serial.print("IP address: \t");
|
||||||
Feldstaerke = WiFi.RSSI();
|
Serial.print(WiFi.localIP()); Serial.print("\tRESSI: "); Serial.println(WiFi.RSSI());
|
||||||
Serial.print(WiFi.localIP()); Serial.print("\tRESSI: "); Serial.println(Feldstaerke);
|
|
||||||
/* delay(2000);
|
/* delay(2000);
|
||||||
ESP.deepSleep(2e6, WAKE_RF_DEFAULT);
|
ESP.deepSleep(2e6, WAKE_RF_DEFAULT);
|
||||||
delay(100); */
|
delay(100); */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user