This commit is contained in:
@ -52,12 +52,15 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) {
|
||||
}
|
||||
size_t bytesRead = 0;
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
// Can be used to read frame, parity and overrun errors
|
||||
// serial_icounter_struct icounter{};
|
||||
// uart::readCountersAndErrors(serialPort, icounter);
|
||||
while (result != DleParser::NO_PACKET_FOUND) {
|
||||
result = dleParser.parseRingBuf(bytesRead);
|
||||
if (result == returnvalue::OK) {
|
||||
// sif::info << "Found dle packet, read " << bytesRead << " bytes" << std::endl;
|
||||
// Packet found, advance read pointer.
|
||||
auto& decodedPacket = dleParser.getContext().decodedPacket;
|
||||
auto &decodedPacket = dleParser.getContext().decodedPacket;
|
||||
handleFoundDlePacket(decodedPacket.first, decodedPacket.second);
|
||||
dleParser.confirmBytesRead(bytesRead);
|
||||
} else if (result != DleParser::NO_PACKET_FOUND) {
|
||||
@ -68,18 +71,6 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) {
|
||||
dleParser.confirmBytesRead(bytesRead);
|
||||
}
|
||||
}
|
||||
// TODO: Move this to some FSFW helper function
|
||||
/*
|
||||
serial_icounter_struct uartErrors{};
|
||||
int ioctlres = ioctl(serialPort, TIOCGICOUNT, &uartErrors);
|
||||
if (uartErrors.parity > 0) {
|
||||
sif::warning << "Parity error. Current count: " << uartErrors.parity << std::endl;
|
||||
}
|
||||
if (uartErrors.overrun > 0) {
|
||||
sif::warning << "Overrun error. Current count: " << uartErrors.overrun << std::endl;
|
||||
}
|
||||
*/
|
||||
|
||||
TaskFactory::delayTask(400);
|
||||
} else if (bytesRead < 0) {
|
||||
sif::warning << "ScexUartReader::performOperation: read call failed with error [" << errno
|
||||
@ -118,7 +109,7 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) {
|
||||
return FAILED;
|
||||
}
|
||||
// Setting up UART parameters
|
||||
tty.c_cflag &= ~PARENB; // Clear parity bit
|
||||
tty.c_cflag &= ~PARENB; // Clear parity bit
|
||||
if (uartCookie->getStopBits() == StopBits::TWO_STOP_BITS) {
|
||||
// Use two stop bits
|
||||
tty.c_cflag |= CSTOPB;
|
||||
@ -143,7 +134,7 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) {
|
||||
if (cfsetispeed(&tty, B38400) != 0) {
|
||||
sif::warning << "ScexUartReader::initializeInterface: Setting baud rate failed" << std::endl;
|
||||
}
|
||||
//#endif
|
||||
//#endif
|
||||
if (tcsetattr(serialPort, TCSANOW, &tty) != 0) {
|
||||
sif::warning << "ScexUartReader::initializeInterface: tcsetattr call failed with error ["
|
||||
<< errno << ", " << strerror(errno) << std::endl;
|
||||
|
Reference in New Issue
Block a user