Skip to content

Commit 9c3d525

Browse files
committed
Remove unused ctor in drvBase, remove code in ctor body for drvers
1 parent 6485e4d commit 9c3d525

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+45
-248
lines changed

src/components/i2c/drivers/drvAdt7410.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@ class drvAdt7410 : public drvBase {
4141
drvAdt7410(TwoWire *i2c, uint16_t sensorAddress, uint32_t mux_channel,
4242
const char *driver_name)
4343
: drvBase(i2c, sensorAddress, mux_channel, driver_name) {
44-
_i2c = i2c;
45-
_address = sensorAddress;
46-
_i2c_mux_channel = mux_channel;
47-
strncpy(_name, driver_name, sizeof(_name) - 1);
48-
_name[sizeof(_name) - 1] = '\0';
44+
// Initialization handled by drvBase constructor
4945
}
5046

5147
/*******************************************************************************/

src/components/i2c/drivers/drvAhtx0.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,7 @@ class drvAhtx0 : public drvBase {
4444
drvAhtx0(TwoWire *i2c, uint16_t sensorAddress, uint32_t mux_channel,
4545
const char *driver_name)
4646
: drvBase(i2c, sensorAddress, mux_channel, driver_name) {
47-
_i2c = i2c;
48-
_address = sensorAddress;
49-
_i2c_mux_channel = mux_channel;
50-
strncpy(_name, driver_name, sizeof(_name) - 1);
51-
_name[sizeof(_name) - 1] = '\0';
47+
// Initialization handled by drvBase constructor
5248
}
5349

5450
/*******************************************************************************/

src/components/i2c/drivers/drvBase.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,29 +29,6 @@
2929
class drvBase {
3030

3131
public:
32-
/*******************************************************************************/
33-
/*!
34-
@brief Instanciates an I2C sensor.
35-
@param i2c
36-
The I2C hardware interface, default is Wire.
37-
@param address
38-
The I2C sensor's unique address.
39-
@param driver_name
40-
The name of the driver.
41-
*/
42-
/*******************************************************************************/
43-
drvBase(TwoWire *i2c, uint16_t address, const char *driver_name) {
44-
_i2c = i2c;
45-
_address = address;
46-
_i2c_mux_addr = 0x0;
47-
_i2c_mux_channel = NO_MUX_CH;
48-
strncpy(_name, driver_name, sizeof(_name) - 1);
49-
_name[sizeof(_name) - 1] = '\0';
50-
_has_alt_i2c_bus = false;
51-
strcpy(_pin_scl, "default");
52-
strcpy(_pin_sda, "default");
53-
}
54-
5532
/*******************************************************************************/
5633
/*!
5734
@brief Instanciates an I2C sensor.

src/components/i2c/drivers/drvBh1750.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ class drvBh1750 : public drvBase {
4949
drvBh1750(TwoWire *i2c, uint16_t sensorAddress, uint32_t mux_channel,
5050
const char *driver_name)
5151
: drvBase(i2c, sensorAddress, mux_channel, driver_name) {
52-
_i2c = i2c;
53-
_address = sensorAddress;
54-
_i2c_mux_channel = mux_channel;
55-
strncpy(_name, driver_name, sizeof(_name) - 1);
56-
_name[sizeof(_name) - 1] = '\0';
52+
// Initialization handled by drvBase constructor
5753
}
5854

5955
/*******************************************************************************/

src/components/i2c/drivers/drvBme280.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,7 @@ class drvBme280 : public drvBase {
4646
drvBme280(TwoWire *i2c, uint16_t sensorAddress, uint32_t mux_channel,
4747
const char *driver_name)
4848
: drvBase(i2c, sensorAddress, mux_channel, driver_name) {
49-
_i2c = i2c;
50-
_address = sensorAddress;
51-
_i2c_mux_channel = mux_channel;
52-
strncpy(_name, driver_name, sizeof(_name) - 1);
53-
_name[sizeof(_name) - 1] = '\0';
49+
// Initialization handled by drvBase constructor
5450
}
5551

5652
/*******************************************************************************/

src/components/i2c/drivers/drvBme680.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,7 @@ class drvBme680 : public drvBase {
4646
drvBme680(TwoWire *i2c, uint16_t sensorAddress, uint32_t mux_channel,
4747
const char *driver_name)
4848
: drvBase(i2c, sensorAddress, mux_channel, driver_name) {
49-
_i2c = i2c;
50-
_address = sensorAddress;
51-
_i2c_mux_channel = mux_channel;
52-
strncpy(_name, driver_name, sizeof(_name) - 1);
53-
_name[sizeof(_name) - 1] = '\0';
49+
// Initialization handled by drvBase constructor
5450
}
5551

5652
/*******************************************************************************/

src/components/i2c/drivers/drvBmp280.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,7 @@ class drvBmp280 : public drvBase {
4646
drvBmp280(TwoWire *i2c, uint16_t sensorAddress, uint32_t mux_channel,
4747
const char *driver_name)
4848
: drvBase(i2c, sensorAddress, mux_channel, driver_name) {
49-
_i2c = i2c;
50-
_address = sensorAddress;
51-
_i2c_mux_channel = mux_channel;
52-
strncpy(_name, driver_name, sizeof(_name) - 1);
53-
_name[sizeof(_name) - 1] = '\0';
49+
// Initialization handled by drvBase constructor
5450
}
5551

5652
/*******************************************************************************/

src/components/i2c/drivers/drvBmp3xx.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@ class drvBmp3xx : public drvBase {
4545
drvBmp3xx(TwoWire *i2c, uint16_t sensorAddress, uint32_t mux_channel,
4646
const char *driver_name)
4747
: drvBase(i2c, sensorAddress, mux_channel, driver_name) {
48-
_i2c = i2c;
49-
_address = sensorAddress;
50-
_i2c_mux_channel = mux_channel;
51-
strncpy(_name, driver_name, sizeof(_name) - 1);
52-
_name[sizeof(_name) - 1] = '\0';
48+
// Initialization handled by drvBase constructor
5349
}
5450

5551
/*******************************************************************************/

src/components/i2c/drivers/drvDs2484.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ class drvDs2484 : public drvBase {
4949
drvDs2484(TwoWire *i2c, uint16_t sensorAddress, uint32_t mux_channel,
5050
const char *driver_name)
5151
: drvBase(i2c, sensorAddress, mux_channel, driver_name) {
52-
_i2c = i2c;
53-
_address = sensorAddress;
54-
_i2c_mux_channel = mux_channel;
55-
strncpy(_name, driver_name, sizeof(_name) - 1);
56-
_name[sizeof(_name) - 1] = '\0';
52+
// Initialization handled by drvBase constructor
5753
}
5854

5955
/*******************************************************************************/

src/components/i2c/drivers/drvEns160.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,7 @@ class drvEns160 : public drvBase {
4646
drvEns160(TwoWire *i2c, uint16_t sensorAddress, uint32_t mux_channel,
4747
const char *driver_name)
4848
: drvBase(i2c, sensorAddress, mux_channel, driver_name) {
49-
_i2c = i2c;
50-
_address = sensorAddress;
51-
_i2c_mux_channel = mux_channel;
52-
strncpy(_name, driver_name, sizeof(_name) - 1);
53-
_name[sizeof(_name) - 1] = '\0';
49+
// Initialization handled by drvBase constructor
5450
}
5551

5652
/*******************************************************************************/

0 commit comments

Comments
 (0)