afmt
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-04-12 18:11:41 +02:00
parent 2262a15e35
commit dd211cdf54
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 23 additions and 28 deletions

View File

@ -90,7 +90,7 @@ CoreController::~CoreController() {}
ReturnValue_t CoreController::handleCommandMessage(CommandMessage *message) { ReturnValue_t CoreController::handleCommandMessage(CommandMessage *message) {
ReturnValue_t result = paramHelper.handleParameterMessage(message); ReturnValue_t result = paramHelper.handleParameterMessage(message);
if(result == returnvalue::OK) { if (result == returnvalue::OK) {
return result; return result;
} }
return ExtendedControllerBase::handleCommandMessage(message); return ExtendedControllerBase::handleCommandMessage(message);
@ -160,7 +160,7 @@ ReturnValue_t CoreController::initialize() {
} }
result = paramHelper.initialize(); result = paramHelper.initialize();
if(result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
@ -2147,26 +2147,25 @@ ReturnValue_t CoreController::getParameter(uint8_t domainId, uint8_t uniqueIdent
ParameterWrapper *parameterWrapper, ParameterWrapper *parameterWrapper,
const ParameterWrapper *newValues, const ParameterWrapper *newValues,
uint16_t startAtIndex) { uint16_t startAtIndex) {
if(domainId != 0) { if (domainId != 0) {
return HasParametersIF::INVALID_DOMAIN_ID; return HasParametersIF::INVALID_DOMAIN_ID;
} }
if(uniqueIdentifier >= ParamId::NUM_IDS) { if (uniqueIdentifier >= ParamId::NUM_IDS) {
return HasParametersIF::INVALID_IDENTIFIER_ID; return HasParametersIF::INVALID_IDENTIFIER_ID;
} }
uint8_t newPrefSd; uint8_t newPrefSd;
ReturnValue_t result = newValues->getElement(&newPrefSd); ReturnValue_t result = newValues->getElement(&newPrefSd);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
// Only SD card 0 (0) and 1 (1) are allowed values. // Only SD card 0 (0) and 1 (1) are allowed values.
if(newPrefSd > 1) { if (newPrefSd > 1) {
return HasParametersIF::INVALID_VALUE; return HasParametersIF::INVALID_VALUE;
} }
result = sdcMan->setPreferredSdCard(static_cast<sd::SdCard>(newPrefSd)); result = sdcMan->setPreferredSdCard(static_cast<sd::SdCard>(newPrefSd));
if(result != returnvalue::OK) { if (result != returnvalue::OK) {
return returnvalue::FAILED; return returnvalue::FAILED;
} }
parameterWrapper->set(prefSdRaw); parameterWrapper->set(prefSdRaw);
return returnvalue::OK; return returnvalue::OK;
} }

View File

@ -50,13 +50,9 @@ struct RebootFile {
xsc::Copy mechanismNextCopy = xsc::Copy::NO_COPY; xsc::Copy mechanismNextCopy = xsc::Copy::NO_COPY;
}; };
class CoreController : public ExtendedControllerBase, class CoreController : public ExtendedControllerBase, public ReceivesParameterMessagesIF {
public ReceivesParameterMessagesIF {
public: public:
enum ParamId: uint8_t { enum ParamId : uint8_t { PREF_SD = 0, NUM_IDS };
PREF_SD = 0,
NUM_IDS
};
static xsc::Chip CURRENT_CHIP; static xsc::Chip CURRENT_CHIP;
static xsc::Copy CURRENT_COPY; static xsc::Copy CURRENT_COPY;
@ -233,8 +229,8 @@ class CoreController : public ExtendedControllerBase,
MessageQueueId_t getCommandQueue() const override; MessageQueueId_t getCommandQueue() const override;
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueIdentifier, ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueIdentifier,
ParameterWrapper *parameterWrapper, ParameterWrapper* parameterWrapper, const ParameterWrapper* newValues,
const ParameterWrapper *newValues, uint16_t startAtIndex) override; uint16_t startAtIndex) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override; LocalDataPoolManager& poolManager) override;