Added windspeed measurement web functionality.
This commit is contained in:
parent
2ae1d7a365
commit
06f080bd29
1 changed files with 21 additions and 0 deletions
|
@ -45,6 +45,9 @@ void setupWebUpdater(String device, String ip)
|
|||
#ifdef HOMEBRIDGE_WEBSTAT
|
||||
httpServer.on("/hbWebstat", hb_webstat_send);
|
||||
#endif
|
||||
#ifdef DEBUG_WINDSPEED_MEASUREMENT
|
||||
httpServer.on("/measWind", measureWindspeed);
|
||||
#endif
|
||||
|
||||
httpServer.begin();
|
||||
|
||||
|
@ -134,3 +137,21 @@ void resetWifiManager()
|
|||
// manual reset after restart is required
|
||||
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);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue