X-Git-Url: http://git.smho.de/gw/?p=owSlave2.git;a=blobdiff_plain;f=common%2Fcalibr.c;fp=common%2Fcalibr.c;h=e08d37340c87aec2a97b08c4270b87f20fd704cf;hp=2f2e68adfd8309cfdeab6b004b098119a8c39222;hb=a6a04f58e4afd20f206fdf4a8a7b3ce4062f1b67;hpb=cd92472e6fd63693741f8e168123a4182802651b diff --git a/common/calibr.c b/common/calibr.c index 2f2e68a..e08d373 100644 --- a/common/calibr.c +++ b/common/calibr.c @@ -1,23 +1,23 @@ -#include "calibr.h" -#include -#include - - - -//const uint8_t cor[] PROGMEM= {0, 3, 6, 10, 13, 17, 20, 24, 27, 30, 34, 37, 41, 44, 47, 51, 54, 58, 61, 64, 68, 71, 75, 78, 81, 85, 88, 91, 95, 98, 101, 105, 108, 111, 115, 118, 121, 125, 128, 131, 135, 138, 141, 144, 148, 151, 154, 158, 161, 164, 167, 171, 174, 177, 180, 184, 187, 190, 193, 197, 200, 203, 206, 209, 213, 216, 219, 222, 225, 229, 232, 235, 238, 241, 245, 248, 251, 254, 255, 255}; - -#define a 7.5 -#define b 237.3 - -inline double SDDD(double t,double x) { - //volatile double p=((a*t/(b+t)-(a*t+a*x)/(b+t+x)))*2000.0; - //return ((p*3.3)/3000.0)+1; - //return ((3.5*((a*t/(b+t)-(a*t+a*x)/(b+t+x)))*2000.0)/3000.0+1); - return 1 - (2.33333 *a* b* x)/((b + t)* (b + t + x)); -} - -double calibr_hum(double temp,double tempdiv,double hum) { - double r=hum*(SDDD(temp,tempdiv)*(tempdiv/(temp+273.15)+1)); - if (r>100) return 100.0; - return r; +#include "calibr.h" +#include +#include + + + +//const uint8_t cor[] PROGMEM= {0, 3, 6, 10, 13, 17, 20, 24, 27, 30, 34, 37, 41, 44, 47, 51, 54, 58, 61, 64, 68, 71, 75, 78, 81, 85, 88, 91, 95, 98, 101, 105, 108, 111, 115, 118, 121, 125, 128, 131, 135, 138, 141, 144, 148, 151, 154, 158, 161, 164, 167, 171, 174, 177, 180, 184, 187, 190, 193, 197, 200, 203, 206, 209, 213, 216, 219, 222, 225, 229, 232, 235, 238, 241, 245, 248, 251, 254, 255, 255}; + +#define a 7.5 +#define b 237.3 + +inline double SDDD(double t,double x) { + //volatile double p=((a*t/(b+t)-(a*t+a*x)/(b+t+x)))*2000.0; + //return ((p*3.3)/3000.0)+1; + //return ((3.5*((a*t/(b+t)-(a*t+a*x)/(b+t+x)))*2000.0)/3000.0+1); + return 1 - (2.33333 *a* b* x)/((b + t)* (b + t + x)); +} + +double calibr_hum(double temp,double tempdiv,double hum) { + double r=hum*(SDDD(temp,tempdiv)*(tempdiv/(temp+273.15)+1)); + if (r>100) return 100.0; + return r; } \ No newline at end of file