Only count rotations on falling edges

This commit is contained in:
Kai Lauterbach 2023-04-04 12:51:24 +02:00
parent ebd964e923
commit d3294e2511
1 changed files with 2 additions and 1 deletions

View File

@ -76,8 +76,9 @@ boolean check_measure_wind_done()
previous_pin_state = tmp_pin_state;
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++;
#ifdef DEBUG
Serial.print("*");