reboot feature finished
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2021-08-03 11:18:24 +02:00
parent 9edd6fc3be
commit f8f0032d1e
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 30 additions and 3 deletions

View File

@ -159,8 +159,7 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
return actionListDirectoryIntoFile(actionId, commandedBy, data, size);
}
case(REBOOT_OBC): {
return HasReturnvaluesIF::RETURN_OK;
break;
return actionPerformReboot(data, size);
}
default: {
return HasActionsIF::INVALID_ACTION_ID;
@ -457,6 +456,33 @@ void CoreController::initPrint() {
#endif
}
ReturnValue_t CoreController::actionPerformReboot(const uint8_t *data, size_t size) {
if(size < 1) {
return HasActionsIF::INVALID_PARAMETERS;
}
bool rebootSameBootCopy = data[0];
if(rebootSameBootCopy) {
int result = std::system("xsc_boot_copy -r");
if(result != 0) {
utility::handleSystemError(result, "CoreController::executeAction");
return HasReturnvaluesIF::RETURN_FAILED;
}
return HasActionsIF::EXECUTION_FINISHED;
}
if(size < 3) {
return HasActionsIF::INVALID_PARAMETERS;
}
// The second byte in data is the target chip, the third byte is the target copy
std::string cmdString = "xsc_boot_copy " + std::to_string(data[1]) +
std::to_string(data[2]);
int result = std::system(cmdString.c_str());
if(result != 0) {
utility::handleSystemError(result, "CoreController::executeAction");
return HasReturnvaluesIF::RETURN_FAILED;
}
return HasActionsIF::EXECUTION_FINISHED;
}
void CoreController::performWatchdogControlOperation() {
// Only perform each fifth iteration
if(watchdogFifoFd != 0 and opDivider.checkAndIncrement()) {

View File

@ -24,7 +24,7 @@ public:
};
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
static constexpr ActionId_t REBOOT_OBC = 1;
static constexpr ActionId_t REBOOT_OBC = 32;
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CORE;
@ -68,6 +68,7 @@ private:
ReturnValue_t actionListDirectoryIntoFile(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t *data, size_t size);
ReturnValue_t actionPerformReboot(const uint8_t *data, size_t size);
void initPrint();