Smaller fixes and improvements #317

Merged
muellerr merged 2 commits from mueller/smaller_fixes_improvements into develop 2022-11-09 15:00:30 +01:00
7 changed files with 33 additions and 19 deletions

View File

@ -47,10 +47,7 @@ CoreController::CoreController(object_id_t objectId)
sdcMan->setBlocking(false);
}
result = initBootCopy();
if (result != returnvalue::OK) {
sif::warning << "CoreController::CoreController: Boot copy init" << std::endl;
}
getCurrentBootCopy(CURRENT_CHIP, CURRENT_COPY);
} catch (const std::filesystem::filesystem_error &e) {
sif::error << "CoreController::CoreController: Failed with exception " << e.what() << std::endl;
}
@ -95,9 +92,9 @@ void CoreController::performControlOperation() {
ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(core::TEMPERATURE, new PoolEntry<float>({0}));
localDataPoolMap.emplace(core::PS_VOLTAGE, new PoolEntry<float>({0}));
localDataPoolMap.emplace(core::PL_VOLTAGE, new PoolEntry<float>({0}));
localDataPoolMap.emplace(core::TEMPERATURE, &tempPoolEntry);
localDataPoolMap.emplace(core::PS_VOLTAGE, &psVoltageEntry);
localDataPoolMap.emplace(core::PL_VOLTAGE, &plVoltageEntry);
poolManager.subscribeForRegularPeriodicPacket({hkSet.getSid(), false, 10.0});
return returnvalue::OK;
}
@ -175,8 +172,7 @@ ReturnValue_t CoreController::initializeAfterTaskCreation() {
setenv("PATH", updatedEnvPath.c_str(), true);
updateProtInfo();
initPrint();
ExtendedControllerBase::initializeAfterTaskCreation();
return result;
return ExtendedControllerBase::initializeAfterTaskCreation();
}
ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
@ -797,7 +793,7 @@ ReturnValue_t CoreController::actionListDirectoryIntoFile(ActionId_t actionId,
return returnvalue::OK;
}
ReturnValue_t CoreController::initBootCopy() {
ReturnValue_t CoreController::initBootCopyFile() {
if (not std::filesystem::exists(CURR_COPY_FILE)) {
// This file is created by the systemd service eive-early-config so this should
// not happen normally
@ -807,8 +803,6 @@ ReturnValue_t CoreController::initBootCopy() {
utility::handleSystemError(result, "CoreController::initBootCopy");
}
}
getCurrentBootCopy(CURRENT_CHIP, CURRENT_COPY);
return returnvalue::OK;
}
@ -1244,6 +1238,10 @@ void CoreController::performMountedSdCardOperations() {
std::filesystem::create_directory(path.str());
}
initVersionFile();
ReturnValue_t result = initBootCopyFile();
if (result != returnvalue::OK) {
sif::warning << "CoreController::CoreController: Boot copy init" << std::endl;
}
initClockFromTimeFile();
performRebootFileHandling(false);
}

View File

@ -226,6 +226,10 @@ class CoreController : public ExtendedControllerBase {
PeriodicOperationDivider opDivider5;
PeriodicOperationDivider opDivider10;
PoolEntry<float> tempPoolEntry = PoolEntry<float>(0.0);
PoolEntry<float> psVoltageEntry = PoolEntry<float>(0.0);
PoolEntry<float> plVoltageEntry = PoolEntry<float>(0.0);
core::HkSet hkSet;
#if OBSW_SD_CARD_MUST_BE_ON == 1
@ -243,7 +247,7 @@ class CoreController : public ExtendedControllerBase {
ReturnValue_t initClockFromTimeFile();
ReturnValue_t performSdCardCheck();
ReturnValue_t timeFileHandler();
ReturnValue_t initBootCopy();
ReturnValue_t initBootCopyFile();
ReturnValue_t initWatchdogFifo();
ReturnValue_t initSdCardBlocking();
bool startSdStateMachine(sd::SdCard targetActiveSd, SdCfgMode mode, MessageQueueId_t commander,

2
fsfw

@ -1 +1 @@
Subproject commit 84b9d1ce216c076bdfeeaf1663aa873c7f1c9cff
Subproject commit 0e8f5ddd26d586dd40e69f52aef1a63c0d5a9da6

View File

@ -58,7 +58,7 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) {
result = tryDleParsing();
}
TaskFactory::delayTask(400);
TaskFactory::delayTask(150);
} else if (bytesRead < 0) {
sif::warning << "ScexUartReader::performOperation: read call failed with error [" << errno
<< ", " << strerror(errno) << "]" << std::endl;
@ -213,6 +213,10 @@ ReturnValue_t ScexUartReader::tryDleParsing() {
void ScexUartReader::reset() {
lock->lockMutex();
state = States::FINISH;
ipcRingBuf.clear();
while (not ipcQueue.empty()) {
ipcQueue.pop();
}
lock->unlockMutex();
}

View File

@ -28,6 +28,7 @@ void ScexDeviceHandler::doStartUp() { setMode(MODE_ON); }
void ScexDeviceHandler::doShutDown() {
reader.reset();
commandActive = false;
multiFileFinishOutstanding = false;
setMode(_MODE_POWER_DOWN);
}
@ -96,6 +97,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic
<< remainingMillis << std::endl;
}
multiFileFinishOutstanding = true;
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
{commandData + 1, commandDataLen - 1}, tempCheck);
updatePeriodicReply(true, deviceCommand);
@ -105,6 +107,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic
finishCountdown.setTimeout(LONG_CD);
// countdown starts
finishCountdown.resetTimer();
multiFileFinishOutstanding = true;
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
{commandData + 1, commandDataLen - 1}, tempCheck);
updatePeriodicReply(true, deviceCommand);
@ -114,6 +117,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic
finishCountdown.setTimeout(LONG_CD);
// countdown starts
finishCountdown.resetTimer();
multiFileFinishOutstanding = true;
prepareScexCmd(cmdTyped, {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
{commandData + 1, commandDataLen - 1}, tempCheck);
updatePeriodicReply(true, deviceCommand);
@ -173,17 +177,14 @@ ReturnValue_t ScexDeviceHandler::handleValidReply(size_t remSize, DeviceCommandI
sif::info << "ScexDeviceHandler::handleValidReply: RemMillis: " << remainingMillis
<< std::endl;
}
finishAction(true, helper.getCmd(), OK);
result = APERIODIC_REPLY;
break;
}
case (ONE_CELL): {
finishAction(true, helper.getCmd(), OK);
result = APERIODIC_REPLY;
break;
}
case (ALL_CELLS_CMD): {
finishAction(true, helper.getCmd(), OK);
result = APERIODIC_REPLY;
break;
}
@ -191,6 +192,11 @@ ReturnValue_t ScexDeviceHandler::handleValidReply(size_t remSize, DeviceCommandI
break;
}
}
if (result == APERIODIC_REPLY and multiFileFinishOutstanding) {
finishAction(true, helper.getCmd(), OK);
multiFileFinishOutstanding = false;
}
*foundId = helper.getCmd();
*foundLen = remSize;
return result;
@ -250,6 +256,7 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
}
return OK;
};
id = helper.getCmd();
switch (id) {
case (PING): {
status = oneFileHandler("ping_");

View File

@ -28,6 +28,7 @@ class ScexDeviceHandler : public DeviceHandlerBase {
std::string fileName = "";
bool fileNameSet = false;
bool commandActive = false;
bool multiFileFinishOutstanding = false;
bool debugMode = false;
scex::Cmds currCmd = scex::Cmds::PING;

2
tmtc

@ -1 +1 @@
Subproject commit f62c67a11e54b99fdb60dab13e55456f16450951
Subproject commit b6490a05ec3ed8fca30719bc657ed9e13d5a32ad