something is still wrong
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
parent
b930af52b0
commit
a44141c476
2
fsfw
2
fsfw
@ -1 +1 @@
|
||||
Subproject commit 49747fc8a49e85e7b3d442eabe668d34e44bad32
|
||||
Subproject commit d1630cdc4c3fc801934f1e394efa80e898f8031b
|
@ -35,7 +35,7 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) {
|
||||
while (true) {
|
||||
semaphore->acquire();
|
||||
int bytesRead = 0;
|
||||
// debugMode = true;
|
||||
debugMode = true;
|
||||
while (true) {
|
||||
bytesRead = read(serialPort, reinterpret_cast<void *>(recBuf.data()),
|
||||
static_cast<unsigned int>(recBuf.size()));
|
||||
@ -43,6 +43,9 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) {
|
||||
{
|
||||
MutexGuard mg(lock);
|
||||
if (state == States::FINISH) {
|
||||
dleParser.reset();
|
||||
// Flush received and unread data
|
||||
tcflush(serialPort, TCIOFLUSH);
|
||||
state = States::IDLE;
|
||||
break;
|
||||
}
|
||||
@ -52,6 +55,7 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) {
|
||||
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;
|
||||
handleFoundDlePacket(decodedPacket.first, decodedPacket.second);
|
||||
@ -142,14 +146,12 @@ ReturnValue_t ScexUartReader::sendMessage(CookieIF *cookie, const uint8_t *sendD
|
||||
lock->unlockMutex();
|
||||
return FAILED;
|
||||
}
|
||||
tcflush(serialPort, TCIOFLUSH);
|
||||
state = States::RUNNING;
|
||||
lock->unlockMutex();
|
||||
ReturnValue_t result = semaphore->release();
|
||||
if (result != OK) {
|
||||
std::cout << "ScexUartReader::sendMessage: Releasing semaphore failed" << std::endl;
|
||||
}
|
||||
|
||||
size_t encodedLen = 0;
|
||||
result =
|
||||
ReturnValue_t result =
|
||||
dleEncoder.encode(sendData, sendLen, cmdbuf.data(), cmdbuf.size(), &encodedLen, true);
|
||||
if (result != OK) {
|
||||
sif::warning << "ScexUartReader::sendMessage: Encoding failed" << std::endl;
|
||||
@ -161,6 +163,10 @@ ReturnValue_t ScexUartReader::sendMessage(CookieIF *cookie, const uint8_t *sendD
|
||||
<< std::endl;
|
||||
return FAILED;
|
||||
}
|
||||
result = semaphore->release();
|
||||
if (result != OK) {
|
||||
std::cout << "ScexUartReader::sendMessage: Releasing semaphore failed" << std::endl;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user