Skip to content

Commit 00578a3

Browse files
Triston Whettendeadprogram
authored andcommitted
Fixed bug in aht20 driver
1 parent 17f2732 commit 00578a3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

aht20/aht20.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func New(bus drivers.I2C) Device {
2929
func (d *Device) Configure() {
3030
// Check initialization state
3131
status := d.Status()
32-
if status&0x08 == 1 {
32+
if status&STATUS_CALIBRATED == 1 {
3333
// Device is initialized
3434
return
3535
}
@@ -69,7 +69,7 @@ func (d *Device) Read() error {
6969
}
7070

7171
// If measurement complete, store values
72-
if data[0]&0x04 != 0 && data[0]&0x80 == 0 {
72+
if data[0]&STATUS_CALIBRATED != 0 && data[0]&STATUS_BUSY == 0 {
7373
d.humidity = uint32(data[1])<<12 | uint32(data[2])<<4 | uint32(data[3])>>4
7474
d.temp = (uint32(data[3])&0xF)<<16 | uint32(data[4])<<8 | uint32(data[5])
7575
return nil

0 commit comments

Comments
 (0)