lets see if this fixes the issue
This commit is contained in:
@ -98,16 +98,17 @@ ReturnValue_t I2cComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s
|
||||
}
|
||||
|
||||
const auto& deviceFile = i2cCookie->getDeviceFile();
|
||||
UnixFileGuard fileHelper(deviceFile, &fd, O_RDWR, "I2cComIF::sendMessage");
|
||||
UnixFileGuard fileHelper(deviceFile, fd, O_RDWR, "I2cComIF::sendMessage");
|
||||
if (fileHelper.getOpenResult() != returnvalue::OK) {
|
||||
return fileHelper.getOpenResult();
|
||||
}
|
||||
result = openI2cSlave(deviceFile, i2cAddress, fd);
|
||||
int slaveFd = 0;
|
||||
result = openI2cSlave(deviceFile, i2cAddress, slaveFd);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (write(fd, sendData, sendLen) != static_cast<int>(sendLen)) {
|
||||
if (write(slaveFd, sendData, sendLen) != static_cast<int>(sendLen)) {
|
||||
i2cCookie->errorCounter++;
|
||||
if (i2cCookie->errorCounter < 3) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
@ -130,7 +131,7 @@ ReturnValue_t I2cComIF::getSendSuccess(CookieIF* cookie) { return returnvalue::O
|
||||
|
||||
ReturnValue_t I2cComIF::requestReceiveMessage(CookieIF* cookie, size_t requestLen) {
|
||||
ReturnValue_t result;
|
||||
int fd;
|
||||
int fd = 0;
|
||||
|
||||
if (requestLen == 0) {
|
||||
return returnvalue::OK;
|
||||
@ -156,11 +157,12 @@ ReturnValue_t I2cComIF::requestReceiveMessage(CookieIF* cookie, size_t requestLe
|
||||
i2cDeviceMapIter->second.replyLen = 0;
|
||||
|
||||
auto& deviceFile = i2cCookie->getDeviceFile();
|
||||
UnixFileGuard fileHelper(deviceFile, &fd, O_RDWR, "I2cComIF::requestReceiveMessage");
|
||||
UnixFileGuard fileHelper(deviceFile, fd, O_RDWR, "I2cComIF::requestReceiveMessage");
|
||||
if (fileHelper.getOpenResult() != returnvalue::OK) {
|
||||
return fileHelper.getOpenResult();
|
||||
}
|
||||
result = openI2cSlave(deviceFile, i2cAddress, fd);
|
||||
int slaveFd = 0;
|
||||
result = openI2cSlave(deviceFile, i2cAddress, slaveFd);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
@ -219,7 +221,7 @@ ReturnValue_t I2cComIF::readReceivedMessage(CookieIF* cookie, uint8_t** buffer,
|
||||
}
|
||||
|
||||
ReturnValue_t I2cComIF::openI2cSlave(const std::string& deviceFile, address_t i2cAddress,
|
||||
int fileDescriptor) {
|
||||
int& fileDescriptor) {
|
||||
if (ioctl(fileDescriptor, I2C_SLAVE, i2cAddress) < 0) {
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
|
Reference in New Issue
Block a user