EIVE upstream #29
@ -109,14 +109,17 @@ ReturnValue_t I2cComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (write(fd, sendData, sendLen) != static_cast<int>(sendLen)) {
|
if (write(fd, sendData, sendLen) != static_cast<int>(sendLen)) {
|
||||||
|
i2cCookie->errorCounter++;
|
||||||
|
if (i2cCookie->errorCounter < 3) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "I2cComIF::sendMessage: Failed to send data to I2C "
|
sif::error << "I2cComIF::sendMessage: Failed to send data to I2C "
|
||||||
"device with error code "
|
"device with error code "
|
||||||
<< errno << ". Error description: " << strerror(errno) << std::endl;
|
<< errno << ". Error description: " << strerror(errno) << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
i2cCookie->errorCounter = 0;
|
||||||
#if FSFW_HAL_I2C_WIRETAPPING == 1
|
#if FSFW_HAL_I2C_WIRETAPPING == 1
|
||||||
sif::info << "Sent I2C data to bus " << deviceFile << ":" << std::endl;
|
sif::info << "Sent I2C data to bus " << deviceFile << ":" << std::endl;
|
||||||
arrayprinter::print(sendData, sendLen);
|
arrayprinter::print(sendData, sendLen);
|
||||||
|
@ -27,6 +27,8 @@ class I2cCookie : public CookieIF {
|
|||||||
size_t getMaxReplyLen() const;
|
size_t getMaxReplyLen() const;
|
||||||
std::string getDeviceFile() const;
|
std::string getDeviceFile() const;
|
||||||
|
|
||||||
|
uint8_t errorCounter = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
address_t i2cAddress = 0;
|
address_t i2cAddress = 0;
|
||||||
size_t maxReplyLen = 0;
|
size_t maxReplyLen = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user