Fixed wind sensor interrupt handling.
This commit is contained in:
parent
0ae44ec987
commit
35f1635a3d
2 changed files with 8 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 "<tr><td>"
|
||||
#define TR_TD_END_STR "</td></tr>"
|
||||
|
|
Loading…
Reference in a new issue