Skip to content

Commit 59fa5dc

Browse files
committed
Fix stupid bug in requestFrom
1 parent 593c8e1 commit 59fa5dc

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

Wire.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,7 @@ class WireClassDispatcher : public HardwareI2C {
7373
uint8_t endTransmission(bool stopBit) {
7474
uint8_t res = wire.endTransmission(stopBit);
7575
if (stopBit) {
76-
osStatus ret = sem->release();
77-
if (ret != osOK) {
78-
Serial.println("could not release semaphore");
79-
}
76+
sem->release();
8077
*transactionInProgress(rtos::ThisThread::get_id()) = false;
8178
} else {
8279
*transactionInProgress(rtos::ThisThread::get_id()) = true;
@@ -89,7 +86,7 @@ class WireClassDispatcher : public HardwareI2C {
8986
}
9087

9188
uint8_t requestFrom(uint8_t address, size_t len, bool stopBit) {
92-
if (!transactionInProgress(rtos::ThisThread::get_id())) {
89+
if (!*transactionInProgress(rtos::ThisThread::get_id())) {
9390
sem->acquire();
9491
}
9592
uint8_t ret = wire.requestFrom(address, len, stopBit);
@@ -99,11 +96,8 @@ class WireClassDispatcher : public HardwareI2C {
9996
}
10097
}
10198
if (stopBit) {
102-
osStatus ret = sem->release();
103-
if (ret != osOK) {
104-
Serial.println("could not release semaphore");
105-
}
10699
*transactionInProgress(rtos::ThisThread::get_id()) = false;
100+
sem->release();
107101
} else {
108102
*transactionInProgress(rtos::ThisThread::get_id()) = true;
109103
}

0 commit comments

Comments
 (0)