Piezo sensor: use low and high thresholds instead of a timeout

If the sensor is not plugged in, the analog value stays "somewhere in the
middle", which triggered continuous beats with the old system. Now we only
allow a new beat if the value went below min_threshold since the last beat,
which works all right in the general case (sensor plugged in), and avoids
parasitic beats when it's unplugged.