Changed the hysteresis algorithm to make 'on' be 20 out of 100 samples