mirror of
https://github.com/schinken/esp8266-geigercounter.git
synced 2024-11-13 04:24:21 +01:00
Make ArduinoOTA optional
This commit is contained in:
parent
9217483abc
commit
b80294291e
2 changed files with 15 additions and 8 deletions
|
@ -1,7 +1,10 @@
|
|||
#include <ESP8266WiFi.h>
|
||||
#include <PubSubClient.h>
|
||||
#include <SoftwareSerial.h>
|
||||
#include <ArduinoOTA.h>
|
||||
|
||||
#ifdef OTA_PASSWORD
|
||||
#include <ArduinoOTA.h>
|
||||
#endif
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
|
@ -36,10 +39,12 @@ void setup() {
|
|||
|
||||
mqttClient.setClient(wifiClient);
|
||||
mqttClient.setServer(MQTT_HOST, 1883);
|
||||
|
||||
ArduinoOTA.setHostname(WIFI_HOSTNAME);
|
||||
ArduinoOTA.setPassword(OTA_PASSWORD);
|
||||
ArduinoOTA.begin();
|
||||
|
||||
#ifdef OTA_PASSWORD
|
||||
ArduinoOTA.setHostname(WIFI_HOSTNAME);
|
||||
ArduinoOTA.setPassword(OTA_PASSWORD);
|
||||
ArduinoOTA.begin();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
@ -144,6 +149,8 @@ void loop() {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
ArduinoOTA.handle();
|
||||
|
||||
#ifdef OTA_PASSWORD
|
||||
ArduinoOTA.handle();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ const char* WIFI_HOSTNAME = "ESP-GeigerCounter";
|
|||
const char* WIFI_SSID = "xxxxxxxxxx";
|
||||
const char* WIFI_PASSWORD = "xxxxxxxxxxx";
|
||||
|
||||
const char* OTA_PASSWORD = "foobar";
|
||||
//#define OTA_PASSWORD "foobar"
|
||||
|
||||
#define MQTT_HOST "mqtt.xxxxxxxxx.org"
|
||||
|
||||
|
|
Loading…
Reference in a new issue