Compare commits

..

No commits in common. "747724c2edf9b3369de8a29f204c571da82a57d3" and "e13d72fa2cb310d3b631e27e6a35f3f5376fd565" have entirely different histories.

4 changed files with 6 additions and 17 deletions

View file

@ -27,7 +27,7 @@
#define WIFI_MINIMUM_SIGNAL_QUALITY 10 // percent #define WIFI_MINIMUM_SIGNAL_QUALITY 10 // percent
#define RESET_ESP_TIME_INTERVAL_MS 3600000 #define RESET_ESP_TIME_INTERVAL_MS 3600000
#define ROTOR_LENGTH_KM 0.000115 #define ROTOR_LENGTH_KM 0.000105
#define WIND_SENSOR_MEAS_TIME_S 5.0 #define WIND_SENSOR_MEAS_TIME_S 5.0
#define SEC_TO_HOUR_FACTOR (60.0 * 60.0) #define SEC_TO_HOUR_FACTOR (60.0 * 60.0)
#define COUNT_TO_KMH ((TWO_PI * ROTOR_LENGTH_KM / WIND_SENSOR_MEAS_TIME_S) * SEC_TO_HOUR_FACTOR) #define COUNT_TO_KMH ((TWO_PI * ROTOR_LENGTH_KM / WIND_SENSOR_MEAS_TIME_S) * SEC_TO_HOUR_FACTOR)

View file

@ -68,11 +68,9 @@ void setup()
wifiManager.setTimeout(WIFI_CONFIG_PORTAL_TIMEOUT_S); wifiManager.setTimeout(WIFI_CONFIG_PORTAL_TIMEOUT_S);
#ifndef SLEEP_IF_NO_WLAN_CONNECTION #ifndef SLEEP_IF_NO_WLAN_CONNECTION
// do not sleep, repeat connecting
while while
#endif #endif
#ifdef def SLEEP_IF_NO_WLAN_CONNECTION #ifdef def SLEEP_IF_NO_WLAN_CONNECTION
// stop connecting after fail to connect to wifi
if if
#endif #endif
(!wifiManager.autoConnect(wifiName.c_str(), "DEADBEEF")) (!wifiManager.autoConnect(wifiName.c_str(), "DEADBEEF"))
@ -84,7 +82,6 @@ void setup()
delay(100); delay(100);
#endif #endif
#ifndef SLEEP_IF_NO_WLAN_CONNECTION #ifndef SLEEP_IF_NO_WLAN_CONNECTION
// sleep a few seconds and go on trying to connect
delay(5000); delay(5000);
#endif #endif
} }

View file

@ -12,8 +12,7 @@ ICACHE_RAM_ATTR void _anemometerInterrupt()
#endif #endif
} }
float wind_speed() float wind_speed() {
{
anemometerRotations = 0; anemometerRotations = 0;
int interruptNumber = digitalPinToInterrupt(ANEMOMETER_PIN); int interruptNumber = digitalPinToInterrupt(ANEMOMETER_PIN);
@ -22,13 +21,6 @@ float wind_speed()
delay(1000 * WIND_SENSOR_MEAS_TIME_S); // time to measure delay(1000 * WIND_SENSOR_MEAS_TIME_S); // time to measure
detachInterrupt(interruptNumber); detachInterrupt(interruptNumber);
// calculate the speed as km/h return (float)anemometerRotations * COUNT_TO_KMH;
float tmp_speed = (float)anemometerRotations * COUNT_TO_KMH;
#ifdef DEBUG
Serial.print("Windspeed: " + String(tmp_speed));
#endif
return tmp_speed;
} }

View file

@ -26,7 +26,7 @@ float _webUpdater_sensValues[VALUES];
String hb_ws_msg_start = "{"; String hb_ws_msg_start = "{";
String hb_ws_msg_temp = "\"temperature\": "; String hb_ws_msg_temp = "\"temperature\": ";
String hb_ws_msg_humi = "\"humidity\": "; String hb_ws_msg_humi = "\"humidity\": ";
String hb_ws_msg_light = "\"lightlevel\": "; String hb_ws_msg_light = "\"light\": ";
String hb_ws_msg_windspeed = "\"windspeed\": "; String hb_ws_msg_windspeed = "\"windspeed\": ";
String hb_ws_msg_end = "}"; String hb_ws_msg_end = "}";
@ -87,9 +87,9 @@ void hb_webstat_send(void)
hb_ws_msg_temp + hb_ws_msg_temp +
String(_webUpdater_sensValues[SENSOR_TEMPERATURE], 2) + ", " + String(_webUpdater_sensValues[SENSOR_TEMPERATURE], 2) + ", " +
hb_ws_msg_humi + hb_ws_msg_humi +
String(int(_webUpdater_sensValues[SENSOR_HUMIDITY]), 2) + ", " + String(_webUpdater_sensValues[SENSOR_HUMIDITY], 2) + ", " +
hb_ws_msg_light + hb_ws_msg_light +
String(int(_webUpdater_sensValues[SENSOR_LIGHT]), 2) + ", " + String(_webUpdater_sensValues[SENSOR_LIGHT], 2) + ", " +
hb_ws_msg_windspeed + hb_ws_msg_windspeed +
String(_webUpdater_sensValues[SENSOR_WINDSPEED], 2) + String(_webUpdater_sensValues[SENSOR_WINDSPEED], 2) +
hb_ws_msg_end); hb_ws_msg_end);