From: Bernhard Tittelbach Date: Mon, 8 Mar 2010 20:54:45 +0000 (+0000) Subject: light level update X-Git-Url: https://git.realraum.at/?p=svn42.git;a=commitdiff_plain;h=71ef15151c5b4c155f50b1e78d789bed86f4f437 light level update --- diff --git a/rf433ctl/rf433ctl.pde b/rf433ctl/rf433ctl.pde index f404110..6ead8af 100644 --- a/rf433ctl/rf433ctl.pde +++ b/rf433ctl/rf433ctl.pde @@ -227,7 +227,7 @@ void updateLightLevel(unsigned int pin) return; unsigned int diff = abs(value - light_level_mean_); - if (diff > 250) + if (light_level_mean_ < 6 || diff > 250) light_level_mean_ = value; else light_level_mean_=(unsigned int) ( ((float) light_level_mean_) * 0.98 + ((float)value)*0.02 );