retval replacements
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
2022-08-29 16:05:05 +02:00
parent aa0da618ca
commit 86337d8f47
7 changed files with 57 additions and 58 deletions

View File

@ -25,6 +25,8 @@
#define RPI_TEST_GPS_HANDLER 0
#endif
using namespace returnvalue;
UartTestClass::UartTestClass(object_id_t objectId, ScexUartReader* reader)
: TestTask(objectId), reader(reader) {
mode = TestModes::SCEX;
@ -163,7 +165,7 @@ void UartTestClass::scexInit() {
uartCookie = new UartCookie(this->getObjectId(), devname, UartBaudRate::RATE_57600, 4096);
reader->setDebugMode(false);
ReturnValue_t result = reader->initializeInterface(uartCookie);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != OK) {
sif::warning << "UartTestClass::scexInit: Initializing SCEX reader "
"UART IF failed"
<< std::endl;
@ -306,7 +308,7 @@ void UartTestClass::scexSimpleInit() {
void UartTestClass::scexSimplePeriodic() {
using namespace scex;
ReturnValue_t result = RETURN_OK;
ReturnValue_t result = OK;
if (not cmdSent) {
// Flush received and unread data
tcflush(serialPort, TCIFLUSH);
@ -315,7 +317,7 @@ void UartTestClass::scexSimplePeriodic() {
sif::info << "UartTestClass::scexSimplePeriodic: Sending command to SCEX" << std::endl;
prepareScexCmd(currCmd, false, tmpCmdBuf, &len);
result = dleEncoder.encode(tmpCmdBuf, len, cmdBuf.data(), cmdBuf.size(), &encodedLen, true);
if (result != HasReturnvaluesIF::RETURN_OK) {
if (result != OK) {
sif::warning << "UartTestClass::scexSimplePeriodic: Encoding failed" << std::endl;
return;
}
@ -368,17 +370,11 @@ int UartTestClass::prepareScexCmd(scex::Cmds cmd, bool tempCheck, uint8_t* cmdBu
cmdBuf[1] = 1;
cmdBuf[2] = 1;
uint16_t userDataLen = 0;
tmpCmdBuf[3] = (userDataLen >> 8) & 0xff;
tmpCmdBuf[4] = userDataLen & 0xff;
uint16_t crc = CRC::crc16ccitt(tmpCmdBuf.data(), 5);
tmpCmdBuf[5] = (crc >> 8) & 0xff;
tmpCmdBuf[6] = crc & 0xff;
ReturnValue_t result =
dleEncoder.encode(tmpCmdBuf.data(), 7, cmdBuf.data(), cmdBuf.size(), &encodedLen, true);
if (result != returnvalue::OK) {
sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl;
return -1;
}
cmdBuf[3] = (userDataLen >> 8) & 0xff;
cmdBuf[4] = userDataLen & 0xff;
uint16_t crc = CRC::crc16ccitt(cmdBuf, 5);
cmdBuf[5] = (crc >> 8) & 0xff;
cmdBuf[6] = crc & 0xff;
return 0;
}