Skip to content

Commit 60028b5

Browse files
committed
Added notes, added mDNS
1 parent b836cf7 commit 60028b5

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

examples/BresserWeatherSensorCanvasGauges/BresserWeatherSensorCanvasGauges.ino

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,26 @@
88
// canvas-gauges (https://github.com/Mikhus/canvas-gauges).
99
//
1010
// The web server serves a simple HTML page with CSS and embedded JavaScript stored in the ESP
11-
// SPIFFS file system to fetch the sensor readings. The readings are updated automatically on
11+
// SPIFFS file system to fetch the sensor readings. The readings are updated automatically on
1212
// the web page using Server-Sent Events (SSE).
1313
// See "ESP32 Web Server: Display Sensor Readings in Gauges" by Rui Santos
1414
// on Random Nerd Tutorials (https://randomnerdtutorials.com/esp32-web-server-gauges/) for details.
1515
//
16+
// Notes:
17+
// - Set your WiFi credentials in "secrets.h"
18+
// - Enable WiFi Access Point mode by uncommenting WIFI_AP_MODE if desired
19+
// - Open http://weatherdashboard.local in your web browser (or the IP address shown in the
20+
// serial monitor) to access the web page
21+
// - Press the on-board button during power-up to reset rain gauge data
22+
//
1623
// https://github.com/matthias-bs/BresserWeatherSensorReceiver
1724
//
1825
// Based on:
1926
// Rui Santos & Sara Santos - Random Nerd Tutorials
2027
// Complete instructions at https://RandomNerdTutorials.com/esp32-web-server-gauges/
2128
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
22-
// and associated documentation files.
23-
// The above copyright notice and this permission notice shall be included in all copies or
29+
// and associated documentation files.
30+
// The above copyright notice and this permission notice shall be included in all copies or
2431
// substantial portions of the Software.
2532
//
2633
//
@@ -61,6 +68,7 @@
6168

6269
#include <Arduino.h>
6370
#include <WiFi.h>
71+
#include <ESPmDNS.h>
6472
#include <AsyncTCP.h> // https://github.com/ESP32Async/AsyncTCP
6573
#include <ESPAsyncWebServer.h> // https://github.com/ESP32Async/ESPAsyncWebServer
6674
#include <time.h>
@@ -80,7 +88,7 @@
8088
// Stop reception when data of all (max_sensors) is complete
8189
#define RX_FLAGS (DATA_COMPLETE | DATA_ALL_SLOTS)
8290

83-
#define WIFI_AP_MODE // Uncomment to enable WiFi Access Point mode
91+
// #define WIFI_AP_MODE // Uncomment to enable WiFi Access Point mode
8492

8593
// Replace network credentials in secrets.h
8694

@@ -204,6 +212,10 @@ void initWiFi()
204212
}
205213
Serial.println();
206214
log_i("Local IP: %s", WiFi.localIP().toString().c_str());
215+
if (!MDNS.begin(hostname))
216+
{
217+
log_e("Error setting up MDNS responder!");
218+
}
207219
#endif
208220
}
209221

0 commit comments

Comments
 (0)