Skip to content

Commit 78fd21e

Browse files
authored
add currWireError to I2C sensor
1 parent 05954cb commit 78fd21e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/sensors/MagneticSensorI2C.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ int MagneticSensorI2C::read(uint8_t angle_reg_msb) {
9595
// notify the device that is aboout to be read
9696
wire->beginTransmission(chip_address);
9797
wire->write(angle_reg_msb);
98-
wire->endTransmission(false);
98+
currWireError = wire->endTransmission(false);
9999

100100
// read the data msb and lsb
101101
wire->requestFrom(chip_address, (uint8_t)2);

src/sensors/MagneticSensorI2C.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ class MagneticSensorI2C: public Sensor{
5151
/** experimental function to check and fix SDA locked LOW issues */
5252
int checkBus(byte sda_pin , byte scl_pin );
5353

54+
/** current error code from Wire endTransmission() call **/
55+
uint8_t currWireError = 0;
56+
5457
private:
5558
float cpr; //!< Maximum range of the magnetic sensor
5659
uint16_t lsb_used; //!< Number of bits used in LSB register

0 commit comments

Comments
 (0)