Only count rotations on falling edges
This commit is contained in:
parent
ebd964e923
commit
d3294e2511
1 changed files with 2 additions and 1 deletions
|
@ -76,8 +76,9 @@ boolean check_measure_wind_done()
|
||||||
previous_pin_state = tmp_pin_state;
|
previous_pin_state = tmp_pin_state;
|
||||||
tmp_pin_state = digitalRead(ANEMOMETER_PIN);
|
tmp_pin_state = digitalRead(ANEMOMETER_PIN);
|
||||||
|
|
||||||
if (previous_pin_state != tmp_pin_state && previous_pin_state != WIND_DEFAULT_MEAS_INIT)
|
if (previous_pin_state != tmp_pin_state && tmp_pin_state == 0 && previous_pin_state != WIND_DEFAULT_MEAS_INIT)
|
||||||
{
|
{
|
||||||
|
// only count rotations on falling edges
|
||||||
anemometerRotations++;
|
anemometerRotations++;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Serial.print("*");
|
Serial.print("*");
|
||||||
|
|
Loading…
Reference in a new issue