v1.14.0 #304

Merged
muellerr merged 366 commits from develop into main 2022-10-10 17:46:38 +02:00
5 changed files with 19 additions and 36 deletions
Showing only changes of commit b930af52b0 - Show all commits

2
fsfw

@ -1 +1 @@
Subproject commit cfc00d02607d22ec306d0540f9f2329774df1cdd
Subproject commit 49747fc8a49e85e7b3d442eabe668d34e44bad32

View File

@ -37,8 +37,9 @@ UartTestClass::UartTestClass(object_id_t objectId) : TestTask(objectId) {
DleParser::BufPair encodingBufPair{encodingBuf->data(), encodingBuf->size()};
auto decodedBuf = new std::array<uint8_t, 4096>;
DleParser::BufPair decodingBufPair{decodedBuf->data(), decodedBuf->size()};
// TODO: Code changes but this test class has not, might not work like this anymore
dleParser = new ScexDleParser(*(new SimpleRingBuffer(4096, true)), dleEncoder, encodingBufPair,
decodingBufPair, &foundDlePacketHandler, this);
decodingBufPair);
} else {
reader = new ScexUartReader(objects::SCEX_UART_READER);
}
@ -380,15 +381,6 @@ int UartTestClass::prepareScexCmd(scex::Cmds cmd, bool tempCheck, uint8_t* cmdBu
return 0;
}
void UartTestClass::foundDlePacketHandler(const DleParser::Context& ctx) {
UartTestClass* obj = reinterpret_cast<UartTestClass*>(ctx.userArgs);
if (ctx.getType() == DleParser::ContextType::PACKET_FOUND) {
obj->handleFoundDlePacket(ctx.decodedPacket.first, ctx.decodedPacket.second);
} else {
DleParser::defaultErrorHandler(ctx.error.first, ctx.error.second);
}
}
void UartTestClass::handleFoundDlePacket(uint8_t* packet, size_t len) {
sif::info << "UartTestClass::handleFoundDlePacket: Detected DLE encoded packet with decoded size "
<< len << std::endl;

View File

@ -1,7 +1,7 @@
#include "ScexDleParser.h"
ScexDleParser::ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder,
BufPair encodedBuf, BufPair decodedBuf, UserHandler handler,
void *args)
: DleParser(decodeRingBuf, decoder, encodedBuf, decodedBuf, handler, args){};
BufPair encodedBuf, BufPair decodedBuf)
: DleParser(decodeRingBuf, decoder, encodedBuf, decodedBuf){};
ScexDleParser::~ScexDleParser(){};

View File

@ -5,11 +5,7 @@
class ScexDleParser : public DleParser {
public:
ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder, BufPair encodedBuf,
BufPair decodedBuf, UserHandler handler, void *args);
// ScexDleParser(SimpleRingBuffer &decodeRingBuf, DleEncoder &decoder,
// BufPair encodedBuf, BufPair decodedBuf, UserHandler handler,
// void *args) : DleParser(decodeRingBuf, decoder, encodedBuf, decodedBuf, handler,
// args){}
BufPair decodedBuf);
virtual ~ScexDleParser();

View File

@ -22,7 +22,7 @@ ScexUartReader::ScexUartReader(object_id_t objectId)
ipcRingBuf(200 * 2048, true),
ipcQueue(200),
dleParser(decodeRingBuf, dleEncoder, {encodedBuf.data(), encodedBuf.size()},
{decodedBuf.data(), decodedBuf.size()}, &foundDlePacketHandler, (void *)this) {
{decodedBuf.data(), decodedBuf.size()}) {
semaphore = SemaphoreFactory::instance()->createBinarySemaphore();
semaphore->acquire();
lock = MutexFactory::instance()->createMutex();
@ -40,10 +40,12 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) {
bytesRead = read(serialPort, reinterpret_cast<void *>(recBuf.data()),
static_cast<unsigned int>(recBuf.size()));
if (bytesRead == 0) {
MutexGuard mg(lock);
if (state == States::FINISH) {
state = States::IDLE;
break;
{
MutexGuard mg(lock);
if (state == States::FINISH) {
state = States::IDLE;
break;
}
}
size_t bytesRead = 0;
ReturnValue_t result = returnvalue::OK;
@ -51,12 +53,14 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) {
result = dleParser.parseRingBuf(bytesRead);
if (result == returnvalue::OK) {
// Packet found, advance read pointer.
// currentBytesRead = 0;
auto& decodedPacket = dleParser.getContext().decodedPacket;
handleFoundDlePacket(decodedPacket.first, decodedPacket.second);
dleParser.confirmBytesRead(bytesRead);
} else if (result == DleParser::POSSIBLE_PACKET_LOSS) {
} else if (result != DleParser::NO_PACKET_FOUND) {
sif::warning << "ScexUartReader::performOperation: Possible packet loss" << std::endl;
// Markers found at wrong place
// which might be a hint for a possibly lost packet.
// currentBytesRead = 0;
dleParser.defaultErrorHandler();
dleParser.confirmBytesRead(bytesRead);
}
}
@ -177,15 +181,6 @@ ReturnValue_t ScexUartReader::finish() {
return OK;
}
void ScexUartReader::foundDlePacketHandler(const ScexDleParser::Context &ctx) {
ScexUartReader *obj = reinterpret_cast<ScexUartReader *>(ctx.userArgs);
if (ctx.getType() == ScexDleParser::ContextType::PACKET_FOUND) {
obj->handleFoundDlePacket(ctx.decodedPacket.first, ctx.decodedPacket.second);
} else {
ScexDleParser::defaultErrorHandler(ctx.error.first, ctx.error.second);
}
}
void ScexUartReader::handleFoundDlePacket(uint8_t *packet, size_t len) {
MutexGuard mg(lock);
ReturnValue_t result = ipcQueue.insert(len);