Skip to content

Commit

Permalink
Fixed bug in aht20 driver
Browse files Browse the repository at this point in the history
  • Loading branch information
Triston Whetten authored and deadprogram committed Jan 18, 2025
1 parent 17f2732 commit 00578a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions aht20/aht20.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func New(bus drivers.I2C) Device {
func (d *Device) Configure() {
// Check initialization state
status := d.Status()
if status&0x08 == 1 {
if status&STATUS_CALIBRATED == 1 {
// Device is initialized
return
}
Expand Down Expand Up @@ -69,7 +69,7 @@ func (d *Device) Read() error {
}

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

0 comments on commit 00578a3

Please sign in to comment.