STR time #611
@ -2,6 +2,7 @@
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <fsfw/filesystem/HasFileSystemIF.h>
|
||||
#include <fsfw/globalfunctions/arrayprinter.h>
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
#include <fsfw/timemanager/Stopwatch.h>
|
||||
#include <mission/acs/str/strHelpers.h>
|
||||
@ -23,6 +24,8 @@ extern "C" {
|
||||
|
||||
using namespace returnvalue;
|
||||
|
||||
static constexpr bool PACKET_WIRETAPPING = false;
|
||||
|
||||
StrComHandler::StrComHandler(object_id_t objectId) : SystemObject(objectId) {
|
||||
lock = MutexFactory::instance()->createMutex();
|
||||
semaphore.acquire();
|
||||
@ -51,7 +54,7 @@ ReturnValue_t StrComHandler::performOperation(uint8_t operationCode) {
|
||||
switch (state) {
|
||||
case InternalState::POLL_ONE_REPLY: {
|
||||
// Stopwatch watch;
|
||||
replyTimeout.setTimeout(200);
|
||||
replyTimeout.setTimeout(400);
|
||||
replyResult = readOneReply(static_cast<uint32_t>(state));
|
||||
{
|
||||
MutexGuard mg(lock);
|
||||
@ -680,6 +683,10 @@ ReturnValue_t StrComHandler::sendMessage(CookieIF* cookie, const uint8_t* sendDa
|
||||
const uint8_t* txFrame;
|
||||
size_t frameLen;
|
||||
datalinkLayer.encodeFrame(sendData, sendLen, &txFrame, frameLen);
|
||||
if(PACKET_WIRETAPPING) {
|
||||
sif::debug << "Sendign STR frame" << std::endl;
|
||||
arrayprinter::print(txFrame, frameLen);
|
||||
}
|
||||
ssize_t bytesWritten = write(serialPort, txFrame, frameLen);
|
||||
if (bytesWritten != static_cast<ssize_t>(frameLen)) {
|
||||
sif::warning << "StrComHandler: Sending packet failed" << std::endl;
|
||||
@ -782,8 +789,10 @@ ReturnValue_t StrComHandler::handleSerialReception() {
|
||||
<< std::endl;
|
||||
return FAILED;
|
||||
} else if (bytesRead > 0) {
|
||||
// sif::info << "Received " << bytesRead << " bytes from the STR" << std::endl;
|
||||
// arrayprinter::print(recBuf.data(), bytesRead);
|
||||
if(PACKET_WIRETAPPING) {
|
||||
sif::info << "Received " << bytesRead << " bytes from the STR" << std::endl;
|
||||
arrayprinter::print(recBuf.data(), bytesRead);
|
||||
}
|
||||
datalinkLayer.feedData(recBuf.data(), bytesRead);
|
||||
}
|
||||
return OK;
|
||||
@ -797,6 +806,10 @@ ReturnValue_t StrComHandler::readOneReply(uint32_t failParameter) {
|
||||
handleSerialReception();
|
||||
result = datalinkLayer.checkRingBufForFrame(&replyPtr, replyLen);
|
||||
if (result == returnvalue::OK) {
|
||||
if(PACKET_WIRETAPPING) {
|
||||
sif::debug << "Received STR reply frame" << std::endl;
|
||||
arrayprinter::print(replyPtr, replyLen);
|
||||
}
|
||||
return returnvalue::OK;
|
||||
} else if (result != ArcsecDatalinkLayer::DEC_IN_PROGRESS) {
|
||||
triggerEvent(STR_HELPER_DEC_ERROR, result, failParameter);
|
||||
|
@ -352,7 +352,7 @@ ReturnValue_t StarTrackerHandler::buildTransitionDeviceCommand(DeviceCommandId_t
|
||||
}
|
||||
case (FwBootState::SET_TIME): {
|
||||
bootState = FwBootState::WAIT_FOR_EXECUTION;
|
||||
*id = startracker::SET_TIME;
|
||||
*id = startracker::SET_TIME_FROM_SYS_TIME;
|
||||
return buildCommandFromCommand(*id, nullptr, 0);
|
||||
}
|
||||
case (FwBootState::LOGLEVEL): {
|
||||
@ -465,7 +465,8 @@ ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t devi
|
||||
preparePingRequest();
|
||||
return returnvalue::OK;
|
||||
}
|
||||
case (startracker::SET_TIME): {
|
||||
case (startracker::SET_TIME_FROM_SYS_TIME): {
|
||||
// Might be buggy, need more answers from arcsec...
|
||||
SetTimeActionRequest setTimeRequest{};
|
||||
timeval tv;
|
||||
Clock::getClock(&tv);
|
||||
@ -674,7 +675,7 @@ void StarTrackerHandler::fillCommandAndReplyMap() {
|
||||
startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||
this->insertInCommandAndReplyMap(startracker::LOGLEVEL, 3, nullptr,
|
||||
startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||
this->insertInCommandAndReplyMap(startracker::SET_TIME, 3, nullptr,
|
||||
this->insertInCommandAndReplyMap(startracker::SET_TIME_FROM_SYS_TIME, 3, nullptr,
|
||||
startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||
this->insertInCommandAndReplyMap(startracker::LOGSUBSCRIPTION, 3, nullptr,
|
||||
startracker::MAX_FRAME_SIZE * 2 + 2);
|
||||
@ -890,7 +891,7 @@ ReturnValue_t StarTrackerHandler::scanForReply(const uint8_t* start, size_t rema
|
||||
switch (startracker::getReplyFrameType(start)) {
|
||||
case TMTC_ACTIONREPLY: {
|
||||
*foundLen = remainingSize;
|
||||
arrayprinter::print(start, remainingSize);
|
||||
// arrayprinter::print(start, remainingSize);
|
||||
return scanForActionReply(startracker::getId(start), foundId);
|
||||
break;
|
||||
}
|
||||
@ -923,7 +924,7 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
|
||||
switch (id) {
|
||||
case (startracker::SET_TIME): {
|
||||
case (startracker::SET_TIME_FROM_SYS_TIME): {
|
||||
result = handleActionReply(packet);
|
||||
break;
|
||||
}
|
||||
@ -1394,7 +1395,7 @@ ReturnValue_t StarTrackerHandler::scanForActionReply(uint8_t replyId, DeviceComm
|
||||
break;
|
||||
}
|
||||
case (ARC_ACTION_REQ_SETTIME_ID): {
|
||||
*foundId = startracker::SET_TIME;
|
||||
*foundId = startracker::SET_TIME_FROM_SYS_TIME;
|
||||
break;
|
||||
}
|
||||
case (startracker::ID::CHECKSUM): {
|
||||
|
@ -326,7 +326,7 @@ static const DeviceCommandId_t DEBUG_CAMERA = 83;
|
||||
static const DeviceCommandId_t FIRMWARE_UPDATE = 84;
|
||||
static const DeviceCommandId_t DISABLE_TIMESTAMP_GENERATION = 85;
|
||||
static const DeviceCommandId_t ENABLE_TIMESTAMP_GENERATION = 86;
|
||||
static constexpr DeviceCommandId_t SET_TIME = 87;
|
||||
static constexpr DeviceCommandId_t SET_TIME_FROM_SYS_TIME = 87;
|
||||
static const DeviceCommandId_t NONE = 0xFFFFFFFF;
|
||||
|
||||
static const uint32_t VERSION_SET_ID = REQ_VERSION;
|
||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit 9be81f1725004b55e937718fbaddc4f4e4e74081
|
||||
Subproject commit 1f2f2aac13b0b32c22f0a75e557743ad32f7dc70
|
Loading…
Reference in New Issue
Block a user