a lot of bugfixes
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
This commit is contained in:
@ -1,10 +1,9 @@
|
||||
#include <etl/crc16_ccitt.h>
|
||||
#include <fcntl.h> // Contains file controls like O_RDWR
|
||||
#include <fsfw/filesystem/HasFileSystemIF.h>
|
||||
#include <fsfw/globalfunctions/arrayprinter.h>
|
||||
#include <fsfw/tasks/SemaphoreFactory.h>
|
||||
#include <linux/devices/ploc/PlocSupvUartMan.h>
|
||||
|
||||
#include <fsfw/globalfunctions/arrayprinter.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cmath>
|
||||
@ -293,8 +292,8 @@ ReturnValue_t PlocSupvUartManager::initiateUpdateContinuation() {
|
||||
|
||||
void PlocSupvUartManager::stop() {
|
||||
MutexGuard mg(lock);
|
||||
if(state == InternalState::SLEEPING or state == InternalState::GO_TO_SLEEP) {
|
||||
return;
|
||||
if (state == InternalState::SLEEPING or state == InternalState::GO_TO_SLEEP) {
|
||||
return;
|
||||
}
|
||||
state = InternalState::GO_TO_SLEEP;
|
||||
}
|
||||
@ -1001,16 +1000,17 @@ ReturnValue_t PlocSupvUartManager::readReceivedMessage(CookieIF* cookie, uint8_t
|
||||
|
||||
ReturnValue_t PlocSupvUartManager::tryHdlcParsing() {
|
||||
size_t bytesRead = 0;
|
||||
ReturnValue_t result = parseRecRingBufForHdlc(bytesRead);
|
||||
size_t decodedLen = 0;
|
||||
ReturnValue_t result = parseRecRingBufForHdlc(bytesRead, decodedLen);
|
||||
if (result == returnvalue::OK) {
|
||||
// Packet found, advance read pointer.
|
||||
if (state == InternalState::DEDICATED_REQUEST) {
|
||||
decodedRingBuf.writeData(decodedBuf.data(), bytesRead);
|
||||
decodedQueue.insert(bytesRead);
|
||||
decodedRingBuf.writeData(decodedBuf.data(), decodedLen);
|
||||
decodedQueue.insert(decodedLen);
|
||||
} else {
|
||||
MutexGuard mg(ipcLock);
|
||||
ipcRingBuf.writeData(decodedBuf.data(), bytesRead);
|
||||
ipcQueue.insert(bytesRead);
|
||||
ipcRingBuf.writeData(decodedBuf.data(), decodedLen);
|
||||
ipcQueue.insert(decodedLen);
|
||||
}
|
||||
recRingBuf.deleteData(bytesRead);
|
||||
} else if (result != NO_PACKET_FOUND) {
|
||||
@ -1023,7 +1023,7 @@ ReturnValue_t PlocSupvUartManager::tryHdlcParsing() {
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupvUartManager::parseRecRingBufForHdlc(size_t& readSize) {
|
||||
ReturnValue_t PlocSupvUartManager::parseRecRingBufForHdlc(size_t& readSize, size_t& decodedLen) {
|
||||
size_t availableData = recRingBuf.getAvailableReadData();
|
||||
if (availableData == 0) {
|
||||
return NO_PACKET_FOUND;
|
||||
@ -1037,7 +1037,6 @@ ReturnValue_t PlocSupvUartManager::parseRecRingBufForHdlc(size_t& readSize) {
|
||||
}
|
||||
bool startMarkerFound = false;
|
||||
size_t startIdx = 0;
|
||||
return returnvalue::OK;
|
||||
for (size_t idx = 0; idx < availableData; idx++) {
|
||||
// handle start marker
|
||||
if (encodedBuf[idx] == HDLC_START_MARKER) {
|
||||
@ -1052,9 +1051,9 @@ ReturnValue_t PlocSupvUartManager::parseRecRingBufForHdlc(size_t& readSize) {
|
||||
if (encodedBuf[idx] == HDLC_END_MARKER) {
|
||||
if (startMarkerFound) {
|
||||
// Probably a packet, so decode it
|
||||
size_t decodedLen = 0;
|
||||
hdlc_remove_framing(encodedBuf.data() + startIdx, idx + 1, decodedBuf.data(), &decodedLen);
|
||||
readSize = decodedLen;
|
||||
hdlc_remove_framing(encodedBuf.data() + startIdx, idx + 1 - startIdx, decodedBuf.data(),
|
||||
&decodedLen);
|
||||
readSize = idx + 1;
|
||||
return returnvalue::OK;
|
||||
} else {
|
||||
readSize = ++idx;
|
||||
|
Reference in New Issue
Block a user