mirror of
https://github.com/schinken/esp8266-geigercounter.git
synced 2024-11-13 04:24:21 +01:00
Use constants instead of static strings
This commit is contained in:
parent
3c78d20461
commit
6f2dd1b703
2 changed files with 6 additions and 7 deletions
|
@ -19,13 +19,12 @@ float lastuSv = 0, currentuSv = 0;
|
|||
|
||||
void setup() {
|
||||
|
||||
WiFi.hostname(WIFI_HOSTNAME);
|
||||
WiFi.mode(WIFI_STA);
|
||||
|
||||
Serial.begin(115200);
|
||||
geigerCounterSerial.begin(BAUD_GEIGERCOUNTER);
|
||||
|
||||
delay(10);
|
||||
|
||||
WiFi.hostname(WIFI_HOSTNAME);
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
|
||||
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
|
@ -34,7 +33,7 @@ void setup() {
|
|||
}
|
||||
|
||||
mqttClient.setClient(wifiClient);
|
||||
mqttClient.setServer(mqttHost, 1883);
|
||||
mqttClient.setServer(MQTT_HOST, 1883);
|
||||
|
||||
ArduinoOTA.setHostname(WIFI_HOSTNAME);
|
||||
ArduinoOTA.setPassword(OTA_PASSWORD);
|
||||
|
@ -69,7 +68,7 @@ void updateRadiationValues() {
|
|||
void connectMqtt() {
|
||||
|
||||
while (!mqttClient.connected()) {
|
||||
if (mqttClient.connect("geigercounter", MQTT_TOPIC_LAST_WILL, 1, true, "disconnected")) {
|
||||
if (mqttClient.connect(WIFI_HOSTNAME, MQTT_TOPIC_LAST_WILL, 1, true, "disconnected")) {
|
||||
mqttClient.publish(MQTT_TOPIC_LAST_WILL, "connected", true);
|
||||
} else {
|
||||
delay(1000);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#define BAUD_GEIGERCOUNTER 9600
|
||||
|
||||
const char* WIFI_HOSTNAME = "ESP-GeigerCounter";
|
||||
const char* HOSTNAME = "ESP-GeigerCounter";
|
||||
const char* WIFI_SSID = "----";
|
||||
const char* WIFI_PASSWORD = "----";
|
||||
|
||||
|
|
Loading…
Reference in a new issue