Merge remote-tracking branch 'origin/develop' into feature_i2c_fatal_error_counter
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
2023-03-20 11:41:11 +01:00
85 changed files with 2023 additions and 1233 deletions

View File

@ -32,8 +32,15 @@ xsc::Chip CoreController::CURRENT_CHIP = xsc::Chip::NO_CHIP;
xsc::Copy CoreController::CURRENT_COPY = xsc::Copy::NO_COPY;
CoreController::CoreController(object_id_t objectId, const std::atomic_uint16_t& i2cErrors)
: ExtendedControllerBase(objectId, 5), opDivider5(5), opDivider10(10), hkSet(this),
: ExtendedControllerBase(objectId, 5),
cmdExecutor(4096),
cmdReplyBuf(4096, true),
cmdRepliesSizes(128),
opDivider5(5),
opDivider10(10),
hkSet(this),
i2cErrors(i2cErrors) {
cmdExecutor.setRingBuffer(&cmdReplyBuf, &cmdRepliesSizes);
try {
sdcMan = SdCardManager::instance();
if (sdcMan == nullptr) {
@ -101,11 +108,26 @@ void CoreController::performControlOperation() {
sdStateMachine();
performMountedSdCardOperations();
readHkData();
<<<<<<< HEAD
if(i2cErrors >= 5) {
bool protOpPerformed = false;
triggerEvent(I2C_UNAVAILABLE_REBOOT);
gracefulShutdownTasks(CURRENT_CHIP, CURRENT_COPY, protOpPerformed);
std::system("xsc_boot_copy -r");
=======
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) {
actionHelper.finish(true, successRecipient, EXECUTE_SHELL_CMD);
shellCmdIsExecuting = false;
cmdReplyBuf.clear();
while (not cmdRepliesSizes.empty()) {
cmdRepliesSizes.pop();
}
successRecipient = MessageQueueIF::NO_QUEUE;
}
>>>>>>> origin/develop
}
opDivider5.checkAndIncrement();
opDivider10.checkAndIncrement();
@ -308,6 +330,21 @@ 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): {
std::string cmd = std::string(cmd, size);
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) {
return result;
}
shellCmdIsExecuting = true;
successRecipient = commandedBy;
return returnvalue::OK;
}
default: {
return HasActionsIF::INVALID_ACTION_ID;
}