From 193c45ee33d2ba087bf1674aab165ae40edba1d4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 15 Nov 2023 08:48:31 +0100 Subject: [PATCH] another small fix --- linux/payload/FreshSupvHandler.cpp | 4 ++-- linux/payload/FreshSupvHandler.h | 2 +- linux/payload/PlocMpsocHandler.cpp | 4 ++-- linux/payload/PlocSupvUartMan.cpp | 6 +++++- tmtc | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/linux/payload/FreshSupvHandler.cpp b/linux/payload/FreshSupvHandler.cpp index 36195152..4feaa1a2 100644 --- a/linux/payload/FreshSupvHandler.cpp +++ b/linux/payload/FreshSupvHandler.cpp @@ -74,6 +74,7 @@ void FreshSupvHandler::performDeviceOperation(uint8_t opCode) { auto cmdIter = activeActionCmds.find( buildActiveCmdKey(Apid::HK, static_cast(tc::HkId::GET_REPORT))); if (cmdIter == activeActionCmds.end() or not cmdIter->second.isPending) { + spParams.buf = commandBuffer.data(); sendEmptyCmd(Apid::HK, static_cast(tc::HkId::GET_REPORT), true); } } @@ -192,8 +193,6 @@ ReturnValue_t FreshSupvHandler::initializeLocalDataPool(localpool::DataPool& loc ReturnValue_t FreshSupvHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t* data, size_t size) { - // TODO: Handle all commands here. Need to add them to some command map. Send command immediately - // then. using namespace supv; ReturnValue_t result; if (uartManager.longerRequestActive()) { @@ -478,6 +477,7 @@ void FreshSupvHandler::handleTransitionToOn() { } } if (startupState == StartupState::SET_TIME) { + spParams.buf = commandBuffer.data(); ReturnValue_t result = prepareSetTimeRefCmd(); if (result != returnvalue::OK) { sif::error << "FreshSupvHandler: Setting time command prepration failed" << std::endl; diff --git a/linux/payload/FreshSupvHandler.h b/linux/payload/FreshSupvHandler.h index 0cf56487..9a960a60 100644 --- a/linux/payload/FreshSupvHandler.h +++ b/linux/payload/FreshSupvHandler.h @@ -116,7 +116,7 @@ class FreshSupvHandler : public FreshDeviceHandlerBase { struct ActiveCmdInfo { ActiveCmdInfo(uint32_t cmdCountdownMs) : cmdCountdown(cmdCountdownMs) {} - DeviceCommandId_t commandId; + DeviceCommandId_t commandId = DeviceHandlerIF::NO_COMMAND_ID; bool isPending = false; bool ackRecv = false; bool ackExeRecv = false; diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index 34053c70..b5bcb78c 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -20,9 +20,9 @@ PlocMpsocHandler::PlocMpsocHandler(object_id_t objectId, object_id_t uartComIFid if (comCookie == nullptr) { sif::error << "PlocMPSoCHandler: Invalid communication cookie" << std::endl; } - eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5); + eventQueue = QueueFactory::instance()->createMessageQueue(10); commandActionHelperQueue = - QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5); + QueueFactory::instance()->createMessageQueue(10); spParams.maxSize = sizeof(commandBuffer); spParams.buf = commandBuffer; } diff --git a/linux/payload/PlocSupvUartMan.cpp b/linux/payload/PlocSupvUartMan.cpp index b0f61713..475e611b 100644 --- a/linux/payload/PlocSupvUartMan.cpp +++ b/linux/payload/PlocSupvUartMan.cpp @@ -80,6 +80,7 @@ ReturnValue_t PlocSupvUartManager::initializeInterface(CookieIF* cookie) { } // Flush received and unread data tcflush(serialPort, TCIOFLUSH); + sif::debug << "serial port: " << serialPort << std::endl; return OK; } @@ -140,7 +141,8 @@ ReturnValue_t PlocSupvUartManager::handleUartReception() { ReturnValue_t result = OK; ReturnValue_t status = OK; sif::debug << "reading port " << serialPort << std::endl; - ssize_t bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), + TaskFactory::delayTask(100); + ssize_t bytesRead = read(302, reinterpret_cast(recBuf.data()), static_cast(recBuf.size())); if (bytesRead == 0) { while (result != NO_PACKET_FOUND) { @@ -968,6 +970,8 @@ ReturnValue_t PlocSupvUartManager::encodeAndSendPacket(const uint8_t* sendData, sif::debug << "Sending TC" << std::endl; arrayprinter::print(encodedSendBuf.data(), encodedLen); } + sif::debug << "writing to serial port: " << serialPort << std::endl; + TaskFactory::delayTask(50); size_t bytesWritten = write(serialPort, encodedSendBuf.data(), encodedLen); if (bytesWritten != encodedLen) { sif::warning diff --git a/tmtc b/tmtc index c4bd3551..07b13c15 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit c4bd355146a2f5894a93a30f0c7f61aeef43e764 +Subproject commit 07b13c153dab03c35ea3c7921f68c6ba77049d1e