Merge remote-tracking branch 'origin/develop' into irini
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
2022-05-26 12:08:07 +02:00
271 changed files with 11845 additions and 6684 deletions

View File

@ -1,10 +1,2 @@
target_sources(${OBSW_NAME} PRIVATE
LibgpiodTest.cpp
I2cTestClass.cpp
SpiTestClass.cpp
UartTestClass.cpp
)
target_sources(${OBSW_NAME} PRIVATE LibgpiodTest.cpp I2cTestClass.cpp
SpiTestClass.cpp UartTestClass.cpp)

View File

@ -19,18 +19,18 @@ LibgpiodTest::LibgpiodTest(object_id_t objectId, object_id_t gpioIfobjectId, Gpi
LibgpiodTest::~LibgpiodTest() {}
ReturnValue_t LibgpiodTest::performPeriodicAction() {
int gpioState;
gpio::Levels gpioState;
ReturnValue_t result;
switch (testCase) {
case (TestCases::READ): {
result = gpioInterface->readGpio(gpioIds::TEST_ID_0, &gpioState);
result = gpioInterface->readGpio(gpioIds::TEST_ID_0, gpioState);
if (result != RETURN_OK) {
sif::warning << "LibgpiodTest::performPeriodicAction: Failed to read gpio " << std::endl;
return RETURN_FAILED;
} else {
sif::debug << "LibgpiodTest::performPeriodicAction: MIO 0 state = " << gpioState
<< std::endl;
sif::debug << "LibgpiodTest::performPeriodicAction: MIO 0 state = "
<< static_cast<int>(gpioState) << std::endl;
}
break;
}
@ -38,19 +38,19 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
break;
}
case (TestCases::BLINK): {
result = gpioInterface->readGpio(gpioIds::TEST_ID_0, &gpioState);
result = gpioInterface->readGpio(gpioIds::TEST_ID_0, gpioState);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "LibgpiodTest::performPeriodicAction: Failed to read gpio " << std::endl;
return RETURN_FAILED;
}
if (gpioState == 1) {
if (gpioState == gpio::Levels::HIGH) {
result = gpioInterface->pullLow(gpioIds::TEST_ID_0);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "LibgpiodTest::performPeriodicAction: Could not pull GPIO low!"
<< std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
} else if (gpioState == 0) {
} else if (gpioState == gpio::Levels::LOW) {
result = gpioInterface->pullHigh(gpioIds::TEST_ID_0);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "LibgpiodTest::performPeriodicAction: Could not pull GPIO high!"
@ -72,7 +72,7 @@ ReturnValue_t LibgpiodTest::performPeriodicAction() {
}
ReturnValue_t LibgpiodTest::performOneShotAction() {
int gpioState;
gpio::Levels gpioState;
ReturnValue_t result;
switch (testCase) {
@ -93,8 +93,8 @@ ReturnValue_t LibgpiodTest::performOneShotAction() {
<< std::endl;
return HasReturnvaluesIF::RETURN_OK;
}
result = gpioInterface->readGpio(gpioIds::TEST_ID_1, &gpioState);
if (result == HasReturnvaluesIF::RETURN_OK and gpioState == 1) {
result = gpioInterface->readGpio(gpioIds::TEST_ID_1, gpioState);
if (result == HasReturnvaluesIF::RETURN_OK and gpioState == gpio::Levels::HIGH) {
sif::info << "LibgpiodTest::performOneShotAction: "
"GPIO state read successfully and is high"
<< std::endl;
@ -110,8 +110,8 @@ ReturnValue_t LibgpiodTest::performOneShotAction() {
"GPIO pulled low successfully for loopback test"
<< std::endl;
}
result = gpioInterface->readGpio(gpioIds::TEST_ID_1, &gpioState);
if (result == HasReturnvaluesIF::RETURN_OK and gpioState == 0) {
result = gpioInterface->readGpio(gpioIds::TEST_ID_1, gpioState);
if (result == HasReturnvaluesIF::RETURN_OK and gpioState == gpio::Levels::LOW) {
sif::info << "LibgpiodTest::performOneShotAction: "
"GPIO state read successfully and is low"
<< std::endl;

View File

@ -70,8 +70,8 @@ void UartTestClass::gpsInit() {
/* Get file descriptor */
serialPort = open("/dev/serial0", O_RDWR);
if (serialPort < 0) {
sif::warning << "UartTestClass::gpsInit: open call failed with error [" << errno << ", " << strerror(errno)
<< std::endl;
sif::warning << "UartTestClass::gpsInit: open call failed with error [" << errno << ", "
<< strerror(errno) << std::endl;
}
/* Setting up UART parameters */
tty.c_cflag &= ~PARENB; // Clear parity bit
@ -99,8 +99,8 @@ void UartTestClass::gpsInit() {
cfsetispeed(&tty, B9600);
cfsetospeed(&tty, B9600);
if (tcsetattr(serialPort, TCSANOW, &tty) != 0) {
sif::warning << "UartTestClass::gpsInit: tcsetattr call failed with error [" << errno << ", " << strerror(errno)
<< std::endl;
sif::warning << "UartTestClass::gpsInit: tcsetattr call failed with error [" << errno << ", "
<< strerror(errno) << std::endl;
;
}
// Flush received and unread data. Those are old NMEA strings which are not relevant anymore
@ -115,8 +115,8 @@ void UartTestClass::gpsPeriodic() {
bytesRead = read(serialPort, reinterpret_cast<void*>(recBuf.data()),
static_cast<unsigned int>(recBuf.size()));
if (bytesRead < 0) {
sif::warning << "UartTestClass::gpsPeriodic: read call failed with error [" << errno
<< ", " << strerror(errno) << "]" << std::endl;
sif::warning << "UartTestClass::gpsPeriodic: read call failed with error [" << errno << ", "
<< strerror(errno) << "]" << std::endl;
break;
} else if (bytesRead >= static_cast<int>(recBuf.size())) {
sif::debug << "UartTestClass::gpsPeriodic: "
@ -268,8 +268,8 @@ void UartTestClass::scexSimpleInit() {
/* Get file descriptor */
serialPort = open(devname.c_str(), O_RDWR);
if (serialPort < 0) {
sif::warning << "UartTestClass::scexSimpleInit: Open call failed with error [" << errno << ", " << strerror(errno)
<< std::endl;
sif::warning << "UartTestClass::scexSimpleInit: Open call failed with error [" << errno << ", "
<< strerror(errno) << std::endl;
return;
}
// Setting up UART parameters
@ -296,8 +296,8 @@ void UartTestClass::scexSimpleInit() {
#endif
if (tcsetattr(serialPort, TCSANOW, &tty) != 0) {
sif::warning << "UartTestClass::scexSimpleInit: tcsetattr call failed with error [" << errno << ", " << strerror(errno)
<< std::endl;
sif::warning << "UartTestClass::scexSimpleInit: tcsetattr call failed with error [" << errno
<< ", " << strerror(errno) << std::endl;
}
// Flush received and unread data
tcflush(serialPort, TCIOFLUSH);
@ -323,7 +323,9 @@ void UartTestClass::scexSimplePeriodic() {
};
size_t bytesWritten = write(serialPort, cmdBuf.data(), encodedLen);
if (bytesWritten != encodedLen) {
sif::warning << "UartTestClass::scexSimplePeriodic: Sending command to solar experiment failed" << std::endl;
sif::warning
<< "UartTestClass::scexSimplePeriodic: Sending command to solar experiment failed"
<< std::endl;
}
cmdSent = true;
cmdDone = false;
@ -335,10 +337,11 @@ void UartTestClass::scexSimplePeriodic() {
bytesRead = read(serialPort, reinterpret_cast<void*>(recBuf.data()),
static_cast<unsigned int>(recBuf.size()));
if (bytesRead == 0) {
sif::warning << "UartTestClass::scexSimplePeriodic: Reading SCEX: Timeout or no bytes read" << std::endl;
sif::warning << "UartTestClass::scexSimplePeriodic: Reading SCEX: Timeout or no bytes read"
<< std::endl;
} else if (bytesRead < 0) {
sif::warning << "UartTestClass::scexSimplePeriodic: read call failed with error ["
<< errno << ", " << strerror(errno) << "]" << std::endl;
sif::warning << "UartTestClass::scexSimplePeriodic: read call failed with error [" << errno
<< ", " << strerror(errno) << "]" << std::endl;
break;
} else if (bytesRead >= static_cast<int>(recBuf.size())) {
sif::debug << "UartTestClass::scexSimplePeriodic: recv buffer might not be large "
@ -383,7 +386,8 @@ void UartTestClass::foundDlePacketHandler(const DleParser::Context& ctx) {
}
void UartTestClass::handleFoundDlePacket(uint8_t* packet, size_t len) {
sif::info << "UartTestClass::handleFoundDlePacket: Detected DLE encoded packet with decoded size " << len << std::endl;
sif::info << "UartTestClass::handleFoundDlePacket: Detected DLE encoded packet with decoded size "
<< len << std::endl;
}
std::string UartTestClass::random_string(std::string::size_type length) {