@@ -399,20 +399,19 @@ def __init__(self, i2c_bus: I2C, address: int = SPA06_003_DEFAULT_ADDR):
399399
400400 while not self .sensor_ready or not self .coeff_ready :
401401 time .sleep (0.01 )
402- print ("Sensor and Coefficients ready." )
403402
404403 # Coefficient values do not change, so just read them once
405- self .coeff_c0 = self ._coeff_c0
406- self .coeff_c1 = self ._coeff_c1
407- self .coeff_c00 = self ._coeff_c00
408- self .coeff_c10 = self ._coeff_c10
409- self .coeff_c01 = self ._coeff_c01
410- self .coeff_c11 = self ._coeff_c11
411- self .coeff_c20 = self ._coeff_c20
412- self .coeff_c21 = self ._coeff_c21
413- self .coeff_c30 = self ._coeff_c30
414- self .coeff_c31 = self ._coeff_c31
415- self .coeff_c40 = self ._coeff_c40
404+ self .coeff_c0 = float ( self ._coeff_c0 )
405+ self .coeff_c1 = float ( self ._coeff_c1 )
406+ self .coeff_c00 = float ( self ._coeff_c00 )
407+ self .coeff_c10 = float ( self ._coeff_c10 )
408+ self .coeff_c01 = float ( self ._coeff_c01 )
409+ self .coeff_c11 = float ( self ._coeff_c11 )
410+ self .coeff_c20 = float ( self ._coeff_c20 )
411+ self .coeff_c21 = float ( self ._coeff_c21 )
412+ self .coeff_c30 = float ( self ._coeff_c30 )
413+ self .coeff_c31 = float ( self ._coeff_c31 )
414+ self .coeff_c40 = float ( self ._coeff_c40 )
416415
417416 # Configure for highest precision and sample rate
418417 # Set pressure to highest oversampling (128x) and highest rate (200 Hz)
@@ -437,7 +436,7 @@ def temperature(self):
437436 temp_raw_signed = self ._temperature_bits
438437 kT = SPA06_003_SCALING_FACTORS_LUT .get (self .temperature_oversampling , 524288 )
439438 temp_raw_sc = float (temp_raw_signed ) / kT
440- temp_comp = float ( self .coeff_c0 ) * 0.5 + float ( self .coeff_c1 ) * temp_raw_sc
439+ temp_comp = self .coeff_c0 * 0.5 + self .coeff_c1 * temp_raw_sc
441440
442441 return temp_comp
443442
@@ -465,17 +464,17 @@ def pressure(self):
465464 # Pcomp = c00 + c10*Praw_sc + c20*Praw_sc^2 + c30*Praw_sc^3 + c40*Praw_sc^4 +
466465 # Traw_sc*(c01 + c11*Praw_sc + c21*Praw_sc^2 + c31*Praw_sc^3)
467466 pres_comp = (
468- float ( self .coeff_c00 )
469- + float ( self .coeff_c10 ) * pres_raw_sc
470- + float ( self .coeff_c20 ) * pres_raw_sc_2
471- + float ( self .coeff_c30 ) * pres_raw_sc_3
472- + float ( self .coeff_c40 ) * pres_raw_sc_4
467+ self .coeff_c00
468+ + self .coeff_c10 * pres_raw_sc
469+ + self .coeff_c20 * pres_raw_sc_2
470+ + self .coeff_c30 * pres_raw_sc_3
471+ + self .coeff_c40 * pres_raw_sc_4
473472 + temp_raw_sc
474473 * (
475- float ( self .coeff_c01 )
476- + float ( self .coeff_c11 ) * pres_raw_sc
477- + float ( self .coeff_c21 ) * pres_raw_sc_2
478- + float ( self .coeff_c31 ) * pres_raw_sc_3
474+ self .coeff_c01
475+ + self .coeff_c11 * pres_raw_sc
476+ + self .coeff_c21 * pres_raw_sc_2
477+ + self .coeff_c31 * pres_raw_sc_3
479478 )
480479 )
481480
0 commit comments