Skip to content

Commit b412af4

Browse files
committed
Fixed major pressure calculation bug
I missed the exponents in the datasheet during my initial implementation, and thus 2nd through 4th-order terms were all treated as 1st-order terms when calculating compensated pressure. This significantly skewed the pressure measurements (by over +5.5kPa, or about 5% error, in my conditions). Revised equation fixes this.
1 parent 54db59f commit b412af4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/SPL07-003.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,9 @@ double SPL07_003::readPressure() {
367367
double tRawSC = tRaw / (double)kT;
368368

369369
// Calculate compensated measurement result
370-
double pComp = _c00 + _c10*pRawSC + _c20*pRawSC + _c30*pRawSC + _c40*pRawSC
371-
+ tRawSC*( _c01 + _c11*pRawSC + _c21*pRawSC + _c31*pRawSC)
372-
+ _presOffset;
370+
double pComp = _c00 + pRawSC*(_c10 + pRawSC*(_c20 + pRawSC*(_c30 + _c40*pRawSC)))
371+
+ tRawSC*(_c01 + pRawSC*(_c11 + pRawSC*(_c21 + _c31*pRawSC)))
372+
+ _presOffset;
373373
return pComp;
374374
}//readPressure()
375375

0 commit comments

Comments
 (0)