@@ -235,9 +235,11 @@ float kr= ((float)P1*1000)/RES; //Constante de conversion a resistencia de p
235235 #if DataRaw
236236 lastTemperature = sckReadSHT21 (0xE3 ); // Datos en RAW para conversion por plataforma
237237 lastHumidity = sckReadSHT21 (0xE5 ); // Datos en RAW para conversion por plataforma
238- #else
239- lastTemperature = (-46.85 + 175.72 / 65536.0 * (float )(sckReadSHT21 (0xE3 )))*10 ; // formula original
240- lastHumidity = (-6.0 + 125.0 / 65536.0 * (float )(sckReadSHT21 (0xE5 )))*10 ; // formula orginal
238+ #else
239+ // T = -53 + 175.72 / 65536.0 * ( Traw * 10 )
240+ lastTemperature = (-50 + 175.72 / 65536.0 * ( sckReadSHT21 (0xE3 ))) * 10 ;
241+ // H = 7 + 125.0 / 65536.0 * ( Hraw * 10 )
242+ lastHumidity = (4 + 125.0 / 65536.0 * ( sckReadSHT21 (0xE5 ))) * 10 ;
241243 #endif
242244
243245 #if debuggSCK
@@ -482,7 +484,24 @@ float kr= ((float)P1*1000)/RES; //Constante de conversion a resistencia de p
482484
483485 #if F_CPU == 8000000
484486 #if DataRaw==false
485- dB = 0.0222 *mVRaw + 58.006 ;
487+ // dB = 0.0222*mVRaw + 58.006;
488+ // aplicar aqui conversion
489+ if (mVRaw <=5 ){
490+ dB = (5 +44 *mVRaw )/5 ;
491+ }else if (mVRaw <=15 ){
492+ dB = (195 + 8 *mVRaw )/5 ;
493+ }else if (mVRaw <=40 ){
494+ dB = (1220 + 4 *mVRaw )/20 ;
495+ }else if (mVRaw <= 300 ){
496+ // y=69.242283950617+0.038618827160494x
497+ dB = (69.242283950617 + 0.038618827160494 *mVRaw );
498+ }else if (mVRaw <= 950 ){
499+ // y=76.744423542059+0.013363343187315x
500+ dB = (76.744423542059 +0.013363343187315 *mVRaw );
501+ } else {
502+ // y=80.167357356927+0.0085240259833374x
503+ dB = (80.167357356927 +0.0085240259833374 *mVRaw );
504+ }
486505 #endif
487506 #else
488507 #if DataRaw==false
0 commit comments