diff --git a/tlv493d/tlv493d.go b/tlv493d/tlv493d.go index 34aad9c..f931e27 100644 --- a/tlv493d/tlv493d.go +++ b/tlv493d/tlv493d.go @@ -194,7 +194,7 @@ func New(i i2c.Bus, opts *Opts) (*Dev, error) { // String implements conn.Resource. func (d *Dev) String() string { - return "TLV493D" + return fmt.Sprintf("TLV493D{i2c:0x%x}", d.i2c.Addr) } // Halt implements conn.Resource. @@ -407,9 +407,9 @@ func (d *Dev) ReadContinuous(frequency physic.Frequency, precision Precision) (< // Try resetting the sensor to recover from errors if err := d.initialize(true); err == nil { if err := d.SetMode(newMode); err != nil { - log.Println("Unable to reset TLV493D mode:", err) + log.Printf("%s: unable to reset tlv493d mode: %v", d, err) } else { - log.Println("Sensor reset successfully") + log.Printf("%s: sensor reset successfully", d) } } continue diff --git a/tlv493d/tlv493d_test.go b/tlv493d/tlv493d_test.go index a445bc2..00d4002 100644 --- a/tlv493d/tlv493d_test.go +++ b/tlv493d/tlv493d_test.go @@ -52,7 +52,7 @@ func TestDev_String(t *testing.T) { if err != nil { t.Fatal(err) } - if s := d.String(); s != "TLV493D" { + if s := d.String(); s != "TLV493D{i2c:0x5e}" { t.Fatal(s) } if err := d.Halt(); err != nil {