mirror of
https://github.com/schinken/esp8266-geigercounter.git
synced 2024-11-24 17:40: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 <ESP8266WiFi.h>
|
||||||
#include <PubSubClient.h>
|
#include <PubSubClient.h>
|
||||||
#include <SoftwareSerial.h>
|
#include <SoftwareSerial.h>
|
||||||
#include <ArduinoOTA.h>
|
|
||||||
|
#ifdef OTA_PASSWORD
|
||||||
|
#include <ArduinoOTA.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
|
@ -37,9 +40,11 @@ void setup() {
|
||||||
mqttClient.setClient(wifiClient);
|
mqttClient.setClient(wifiClient);
|
||||||
mqttClient.setServer(MQTT_HOST, 1883);
|
mqttClient.setServer(MQTT_HOST, 1883);
|
||||||
|
|
||||||
|
#ifdef OTA_PASSWORD
|
||||||
ArduinoOTA.setHostname(WIFI_HOSTNAME);
|
ArduinoOTA.setHostname(WIFI_HOSTNAME);
|
||||||
ArduinoOTA.setPassword(OTA_PASSWORD);
|
ArduinoOTA.setPassword(OTA_PASSWORD);
|
||||||
ArduinoOTA.begin();
|
ArduinoOTA.begin();
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,5 +150,7 @@ void loop() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef OTA_PASSWORD
|
||||||
ArduinoOTA.handle();
|
ArduinoOTA.handle();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ const char* WIFI_HOSTNAME = "ESP-GeigerCounter";
|
||||||
const char* WIFI_SSID = "xxxxxxxxxx";
|
const char* WIFI_SSID = "xxxxxxxxxx";
|
||||||
const char* WIFI_PASSWORD = "xxxxxxxxxxx";
|
const char* WIFI_PASSWORD = "xxxxxxxxxxx";
|
||||||
|
|
||||||
const char* OTA_PASSWORD = "foobar";
|
//#define OTA_PASSWORD "foobar"
|
||||||
|
|
||||||
#define MQTT_HOST "mqtt.xxxxxxxxx.org"
|
#define MQTT_HOST "mqtt.xxxxxxxxx.org"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue