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

View File

@ -226,6 +226,10 @@ class CoreController : public ExtendedControllerBase {
PeriodicOperationDivider opDivider5; PeriodicOperationDivider opDivider5;
PeriodicOperationDivider opDivider10; 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; core::HkSet hkSet;
#if OBSW_SD_CARD_MUST_BE_ON == 1 #if OBSW_SD_CARD_MUST_BE_ON == 1
@ -243,7 +247,7 @@ class CoreController : public ExtendedControllerBase {
ReturnValue_t initClockFromTimeFile(); ReturnValue_t initClockFromTimeFile();
ReturnValue_t performSdCardCheck(); ReturnValue_t performSdCardCheck();
ReturnValue_t timeFileHandler(); ReturnValue_t timeFileHandler();
ReturnValue_t initBootCopy(); ReturnValue_t initBootCopyFile();
ReturnValue_t initWatchdogFifo(); ReturnValue_t initWatchdogFifo();
ReturnValue_t initSdCardBlocking(); ReturnValue_t initSdCardBlocking();
bool startSdStateMachine(sd::SdCard targetActiveSd, SdCfgMode mode, MessageQueueId_t commander, 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(); result = tryDleParsing();
} }
TaskFactory::delayTask(400); TaskFactory::delayTask(150);
} else if (bytesRead < 0) { } else if (bytesRead < 0) {
sif::warning << "ScexUartReader::performOperation: read call failed with error [" << errno sif::warning << "ScexUartReader::performOperation: read call failed with error [" << errno
<< ", " << strerror(errno) << "]" << std::endl; << ", " << strerror(errno) << "]" << std::endl;
@ -213,6 +213,10 @@ ReturnValue_t ScexUartReader::tryDleParsing() {
void ScexUartReader::reset() { void ScexUartReader::reset() {
lock->lockMutex(); lock->lockMutex();
state = States::FINISH; state = States::FINISH;
ipcRingBuf.clear();
while (not ipcQueue.empty()) {
ipcQueue.pop();
}
lock->unlockMutex(); lock->unlockMutex();
} }

View File

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

View File

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

2
tmtc

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