|
@ -27,14 +27,13 @@ extern "C" { |
|
|
|
|
|
|
|
|
#include <XD0OTA.h> |
|
|
#include <XD0OTA.h> |
|
|
#include "main.h" |
|
|
#include "main.h" |
|
|
#include "passwords.h" |
|
|
|
|
|
|
|
|
|
|
|
const char* server PROGMEM = "ingress.opensensemap.org"; |
|
|
const char* server PROGMEM = "ingress.opensensemap.org"; |
|
|
|
|
|
|
|
|
#define MQTT_MAX_PACKET_SIZE 512 |
|
|
#define MQTT_MAX_PACKET_SIZE 512 |
|
|
const char* mqttserver PROGMEM = "home.xd0.de"; |
|
|
const char* mqttserver PROGMEM = "home.xd0.de"; |
|
|
const char* mqttusername PROGMEM = "esp-weatherstation"; |
|
|
//const char* mqttusername PROGMEM = "esp-weatherstation";
|
|
|
const char* mqttpassword PROGMEM = PWD_MQTT; |
|
|
//const char* mqttpassword PROGMEM = MQTT_PASSWORD;
|
|
|
|
|
|
|
|
|
constexpr unsigned int postingInterval = 60000; //Uploadintervall in Millisekunden
|
|
|
constexpr unsigned int postingInterval = 60000; //Uploadintervall in Millisekunden
|
|
|
constexpr unsigned int dhcp_interval = 60*60*1000; |
|
|
constexpr unsigned int dhcp_interval = 60*60*1000; |
|
@ -386,7 +385,7 @@ void ICACHE_FLASH_ATTR sendValues() { |
|
|
#endif |
|
|
#endif |
|
|
mqttclient.begin(mqttserver, 8883, net); |
|
|
mqttclient.begin(mqttserver, 8883, net); |
|
|
constexpr unsigned int retry_delay = 500; |
|
|
constexpr unsigned int retry_delay = 500; |
|
|
for (int tries=0; tries<5 && !mqttclient.connect(mqttusername, mqttusername, mqttpassword); tries++ ) { |
|
|
for (int tries=0; tries<5 && !mqttclient.connect(MQTT_USERNAME, MQTT_USERNAME, MQTT_PASSWORD); tries++ ) { |
|
|
DEBUG_MSG("."); |
|
|
DEBUG_MSG("."); |
|
|
delay(retry_delay); |
|
|
delay(retry_delay); |
|
|
} |
|
|
} |
|
@ -453,10 +452,9 @@ void setup() { |
|
|
|
|
|
|
|
|
WiFi.persistent(false); // don't load and save credentials to flash
|
|
|
WiFi.persistent(false); // don't load and save credentials to flash
|
|
|
WiFi.mode(WIFI_STA); |
|
|
WiFi.mode(WIFI_STA); |
|
|
wifiMulti.addAP("nether.net", PWD_NETHERNET); |
|
|
wifiMulti.addAP(WIFI_SSID, WIFI_PASSWD); |
|
|
wifiMulti.addAP("LNet", PWD_LNET); |
|
|
wifiMulti.addAP(WIFI_SSID2, WIFI_PASSWD2); |
|
|
wifiMulti.addAP("hw1_gast", PWD_HW1); |
|
|
wifiMulti.addAP(WIFI_SSID3, WIFI_PASSWD3); |
|
|
wifiMulti.addAP("Freifunk", ""); |
|
|
|
|
|
|
|
|
|
|
|
previousMillis = rtcMillis(); |
|
|
previousMillis = rtcMillis(); |
|
|
DEBUG_MSG("[DEBUG] ready.\n"); //Serial.flush();
|
|
|
DEBUG_MSG("[DEBUG] ready.\n"); //Serial.flush();
|
|
|