another small fix

This commit is contained in:
Robin Müller 2023-11-15 08:48:31 +01:00
parent 4f6a594707
commit 193c45ee33
Signed by: muellerr
GPG Key ID: A649FB78196E3849
5 changed files with 11 additions and 7 deletions

View File

@ -74,6 +74,7 @@ void FreshSupvHandler::performDeviceOperation(uint8_t opCode) {
auto cmdIter = activeActionCmds.find( auto cmdIter = activeActionCmds.find(
buildActiveCmdKey(Apid::HK, static_cast<uint8_t>(tc::HkId::GET_REPORT))); buildActiveCmdKey(Apid::HK, static_cast<uint8_t>(tc::HkId::GET_REPORT)));
if (cmdIter == activeActionCmds.end() or not cmdIter->second.isPending) { if (cmdIter == activeActionCmds.end() or not cmdIter->second.isPending) {
spParams.buf = commandBuffer.data();
sendEmptyCmd(Apid::HK, static_cast<uint8_t>(tc::HkId::GET_REPORT), true); sendEmptyCmd(Apid::HK, static_cast<uint8_t>(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, ReturnValue_t FreshSupvHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) { 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; using namespace supv;
ReturnValue_t result; ReturnValue_t result;
if (uartManager.longerRequestActive()) { if (uartManager.longerRequestActive()) {
@ -478,6 +477,7 @@ void FreshSupvHandler::handleTransitionToOn() {
} }
} }
if (startupState == StartupState::SET_TIME) { if (startupState == StartupState::SET_TIME) {
spParams.buf = commandBuffer.data();
ReturnValue_t result = prepareSetTimeRefCmd(); ReturnValue_t result = prepareSetTimeRefCmd();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
sif::error << "FreshSupvHandler: Setting time command prepration failed" << std::endl; sif::error << "FreshSupvHandler: Setting time command prepration failed" << std::endl;

View File

@ -116,7 +116,7 @@ class FreshSupvHandler : public FreshDeviceHandlerBase {
struct ActiveCmdInfo { struct ActiveCmdInfo {
ActiveCmdInfo(uint32_t cmdCountdownMs) : cmdCountdown(cmdCountdownMs) {} ActiveCmdInfo(uint32_t cmdCountdownMs) : cmdCountdown(cmdCountdownMs) {}
DeviceCommandId_t commandId; DeviceCommandId_t commandId = DeviceHandlerIF::NO_COMMAND_ID;
bool isPending = false; bool isPending = false;
bool ackRecv = false; bool ackRecv = false;
bool ackExeRecv = false; bool ackExeRecv = false;

View File

@ -20,9 +20,9 @@ PlocMpsocHandler::PlocMpsocHandler(object_id_t objectId, object_id_t uartComIFid
if (comCookie == nullptr) { if (comCookie == nullptr) {
sif::error << "PlocMPSoCHandler: Invalid communication cookie" << std::endl; sif::error << "PlocMPSoCHandler: Invalid communication cookie" << std::endl;
} }
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5); eventQueue = QueueFactory::instance()->createMessageQueue(10);
commandActionHelperQueue = commandActionHelperQueue =
QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5); QueueFactory::instance()->createMessageQueue(10);
spParams.maxSize = sizeof(commandBuffer); spParams.maxSize = sizeof(commandBuffer);
spParams.buf = commandBuffer; spParams.buf = commandBuffer;
} }

View File

@ -80,6 +80,7 @@ ReturnValue_t PlocSupvUartManager::initializeInterface(CookieIF* cookie) {
} }
// Flush received and unread data // Flush received and unread data
tcflush(serialPort, TCIOFLUSH); tcflush(serialPort, TCIOFLUSH);
sif::debug << "serial port: " << serialPort << std::endl;
return OK; return OK;
} }
@ -140,7 +141,8 @@ ReturnValue_t PlocSupvUartManager::handleUartReception() {
ReturnValue_t result = OK; ReturnValue_t result = OK;
ReturnValue_t status = OK; ReturnValue_t status = OK;
sif::debug << "reading port " << serialPort << std::endl; sif::debug << "reading port " << serialPort << std::endl;
ssize_t bytesRead = read(serialPort, reinterpret_cast<void*>(recBuf.data()), TaskFactory::delayTask(100);
ssize_t bytesRead = read(302, reinterpret_cast<void*>(recBuf.data()),
static_cast<unsigned int>(recBuf.size())); static_cast<unsigned int>(recBuf.size()));
if (bytesRead == 0) { if (bytesRead == 0) {
while (result != NO_PACKET_FOUND) { while (result != NO_PACKET_FOUND) {
@ -968,6 +970,8 @@ ReturnValue_t PlocSupvUartManager::encodeAndSendPacket(const uint8_t* sendData,
sif::debug << "Sending TC" << std::endl; sif::debug << "Sending TC" << std::endl;
arrayprinter::print(encodedSendBuf.data(), encodedLen); 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); size_t bytesWritten = write(serialPort, encodedSendBuf.data(), encodedLen);
if (bytesWritten != encodedLen) { if (bytesWritten != encodedLen) {
sif::warning sif::warning

2
tmtc

@ -1 +1 @@
Subproject commit c4bd355146a2f5894a93a30f0c7f61aeef43e764 Subproject commit 07b13c153dab03c35ea3c7921f68c6ba77049d1e