Added windspeed measurement web functionality.

This commit is contained in:
Kai Lauterbach 2022-05-24 11:03:52 +02:00
parent 2ae1d7a365
commit 06f080bd29

View file

@ -45,6 +45,9 @@ void setupWebUpdater(String device, String ip)
#ifdef HOMEBRIDGE_WEBSTAT #ifdef HOMEBRIDGE_WEBSTAT
httpServer.on("/hbWebstat", hb_webstat_send); httpServer.on("/hbWebstat", hb_webstat_send);
#endif #endif
#ifdef DEBUG_WINDSPEED_MEASUREMENT
httpServer.on("/measWind", measureWindspeed);
#endif
httpServer.begin(); httpServer.begin();
@ -134,3 +137,21 @@ void resetWifiManager()
// manual reset after restart is required // manual reset after restart is required
ESP.restart(); ESP.restart();
} }
void measureWindspeed()
{
// read from windspeed sensorSTATUS_LED_PIN
digitalWrite(STATUS_LED_PIN, HIGH);
debug("Starting windspeed measurement");
float tmp_windspeed = wind_speed();
digitalWrite(STATUS_LED_PIN, LOW);
String message = "<html><head><title>OKO Weatherstation - " + String(_webUpdater_dev) + "</title>"
"</head><body>"
"Wind sensor measurement results: " + String(tmp_windspeed) + "<br>"
"</body></html>";
httpServer.send(200, "text/html", message);
}