fix BME280 support to actually work (now tested)

This commit is contained in:
Maff 2018-05-31 20:53:30 +01:00
parent ec01ef8f15
commit ec476cc54b
1 changed files with 16 additions and 1 deletions

View File

@ -16,7 +16,22 @@ class BME280(uPySensor):
self.handle = self.bme280.BME280(i2c=self.i2c)
def update_sensor(self):
self.temperature, self.pressure, self.humidity = self.handle.values()
t, p, h = self.handle.values
self.temperature = float(t[:-1])
self.pressure = float(p[:-3])
self.humidity = float(h[:-1])
def read_tempC(self):
self.update_sensor()
return self.temperature
def read_hum(self):
self.update_sensor()
return self.humidity
def read_pressure(self):
self.update_sensor()
return self.pressure
class LM75A(uPySensor):
LM75A_ADDRESS = 0x48