make system components work for EM
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
2023-03-13 18:29:22 +01:00
parent 090ef88030
commit e7811ebd0c
11 changed files with 46 additions and 30 deletions

View File

@ -32,8 +32,13 @@ xsc::Chip CoreController::CURRENT_CHIP = xsc::Chip::NO_CHIP;
xsc::Copy CoreController::CURRENT_COPY = xsc::Copy::NO_COPY;
CoreController::CoreController(object_id_t objectId)
: ExtendedControllerBase(objectId, 5), cmdExecutor(4096), cmdReplyBuf(4096, true), cmdRepliesSizes(128),
opDivider5(5), opDivider10(10), hkSet(this) {
: ExtendedControllerBase(objectId, 5),
cmdExecutor(4096),
cmdReplyBuf(4096, true),
cmdRepliesSizes(128),
opDivider5(5),
opDivider10(10),
hkSet(this) {
cmdExecutor.setRingBuffer(&cmdReplyBuf, &cmdRepliesSizes);
try {
sdcMan = SdCardManager::instance();
@ -102,14 +107,14 @@ void CoreController::performControlOperation() {
sdStateMachine();
performMountedSdCardOperations();
readHkData();
if(shellCmdIsExecuting) {
if (shellCmdIsExecuting) {
bool replyReceived = false;
// TODO: We could read the data in the ring buffer and send it as an action data reply.
if(cmdExecutor.check(replyReceived) == CommandExecutor::EXECUTION_FINISHED) {
if (cmdExecutor.check(replyReceived) == CommandExecutor::EXECUTION_FINISHED) {
actionHelper.finish(true, successRecipient, EXECUTE_SHELL_CMD);
shellCmdIsExecuting = false;
cmdReplyBuf.clear();
while(not cmdRepliesSizes.empty()) {
while (not cmdRepliesSizes.empty()) {
cmdRepliesSizes.pop();
}
successRecipient = MessageQueueIF::NO_QUEUE;
@ -316,14 +321,15 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
// Warning: This function will never return, because it reboots the system
return actionReboot(data, size);
}
case(EXECUTE_SHELL_CMD): {
case (EXECUTE_SHELL_CMD): {
std::string cmd = std::string(cmd, size);
if(cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING or shellCmdIsExecuting) {
if (cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING or
shellCmdIsExecuting) {
return HasActionsIF::IS_BUSY;
}
cmdExecutor.load(cmd, false, false);
ReturnValue_t result = cmdExecutor.execute();
if(result != returnvalue::OK) {
if (result != returnvalue::OK) {
return result;
}
shellCmdIsExecuting = true;