diff --git a/firmware/sensor_wind.ino b/firmware/sensor_wind.ino index 5462a63..4b366e0 100644 --- a/firmware/sensor_wind.ino +++ b/firmware/sensor_wind.ino @@ -2,15 +2,16 @@ #include "config_user.h" #include "config.h" -unsigned int anemometerRotations = 0; +volatile unsigned int anemometerRotations = 0; uint32_t start_meas_wind_time = 0; int interruptNumber; -ICACHE_RAM_ATTR void _anemometerInterrupt() +void ICACHE_RAM_ATTR _anemometerInterrupt() { anemometerRotations++; #ifdef DEBUG Serial.print("*"); + debug("*"); #endif } @@ -28,6 +29,7 @@ void start_measure_wind() start_meas_wind_time = millis(); anemometerRotations = 0; interruptNumber = digitalPinToInterrupt(ANEMOMETER_PIN); + attachInterrupt(interruptNumber, _anemometerInterrupt, FALLING); } boolean check_measure_wind_done() @@ -43,5 +45,8 @@ boolean check_measure_wind_done() float measure_wind_result() { start_meas_wind_time = 0; +#ifdef DEBUG + debug("rotations = " + String((float)anemometerRotations)); +#endif return (float)anemometerRotations * WINDSPEED_FACTOR; } diff --git a/firmware/webUpdater.ino b/firmware/webUpdater.ino index 02ea993..40d4d84 100644 --- a/firmware/webUpdater.ino +++ b/firmware/webUpdater.ino @@ -24,9 +24,7 @@ ESP8266HTTPUpdateServer httpUpdater; String _webUpdater_ip = "127.0.0.1"; String _webUpdater_dev = "unknown"; -#ifdef SHOW_SENSOR_DATA_ON_WEBUPDATER_MAIN_PAGE -float _webUpdater_sensValues[VALUES]; -#endif +float _webUpdater_sensValues[VALUES]; #define TR_TD_START_STR "