Skip to content

Commit b98111d

Browse files
authored
i2c(bme280): fix default name (hybridgroup#1177)
1 parent ad67d07 commit b98111d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

drivers/i2c/bme280_driver.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"encoding/binary"
66
"errors"
77
"log"
8+
9+
"gobot.io/x/gobot/v2"
810
)
911

1012
const bme280Debug = true
@@ -63,6 +65,7 @@ func NewBME280Driver(c Connector, options ...func(Config)) *BME280Driver {
6365
humCalCoeffs: &bmeHumidityCalibrationCoefficients{},
6466
ctrlHumOversamp: BME280CtrlHumidityOversampling16,
6567
}
68+
d.name = gobot.DefaultName("BME280")
6669
d.afterStart = d.initializationBME280
6770

6871
// this loop is for options of this class, all options of base class BMP280Driver

drivers/i2c/bme280_driver_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func TestNewBME280Driver(t *testing.T) {
2828
require.Fail(t, "NewBME280Driver() should have returned a *BME280Driver")
2929
}
3030
assert.NotNil(t, d.Driver)
31-
assert.True(t, strings.HasPrefix(d.Name(), "BMP280"))
31+
assert.True(t, strings.HasPrefix(d.Name(), "BME280"))
3232
assert.Equal(t, 0x77, d.defaultAddress)
3333
assert.Equal(t, uint8(0x03), d.ctrlPwrMode)
3434
assert.Equal(t, BMP280PressureOversampling(0x05), d.ctrlPressOversamp)

0 commit comments

Comments
 (0)