Merge branch 'develop' into continue_tcs_tests
Some checks are pending
EIVE/eive-obsw/pipeline/pr-develop Build queued...

This commit is contained in:
Robin Müller 2023-04-13 18:10:24 +02:00
commit f14677ec4e
3 changed files with 57 additions and 2 deletions

View File

@ -25,6 +25,9 @@ will consitute of a breaking change warranting a new major release:
## Added
- Add a way for the MAX31865 RTD handlers to recognize faulty/broken/off sensor devices.
- Add parameter interface for core controller
- Allow setting the preferred SD card via the new parameter interface of the core controller
with domain ID 0 and unque ID 0.
# [v1.44.1] 2023-04-12

View File

@ -40,7 +40,8 @@ CoreController::CoreController(object_id_t objectId, bool enableHkSet)
cmdRepliesSizes(128),
opDivider5(5),
opDivider10(10),
hkSet(this) {
hkSet(this),
paramHelper(this) {
cmdExecutor.setRingBuffer(&cmdReplyBuf, &cmdRepliesSizes);
try {
sdcMan = SdCardManager::instance();
@ -88,6 +89,10 @@ CoreController::CoreController(object_id_t objectId, bool enableHkSet)
CoreController::~CoreController() {}
ReturnValue_t CoreController::handleCommandMessage(CommandMessage *message) {
ReturnValue_t result = paramHelper.handleParameterMessage(message);
if (result == returnvalue::OK) {
return result;
}
return ExtendedControllerBase::handleCommandMessage(message);
}
@ -154,6 +159,11 @@ ReturnValue_t CoreController::initialize() {
<< std::endl;
}
result = paramHelper.initialize();
if (result != returnvalue::OK) {
return result;
}
sdStateMachine();
triggerEvent(core::REBOOT_SW, CURRENT_CHIP, CURRENT_COPY);
@ -2124,7 +2134,38 @@ void CoreController::announceBootCounts() {
totalBootCount & 0xffffffff);
}
MessageQueueId_t CoreController::getCommandQueue() const {
return ExtendedControllerBase::getCommandQueue();
}
bool CoreController::isNumber(const std::string &s) {
return !s.empty() && std::find_if(s.begin(), s.end(),
[](unsigned char c) { return !std::isdigit(c); }) == s.end();
}
ReturnValue_t CoreController::getParameter(uint8_t domainId, uint8_t uniqueIdentifier,
ParameterWrapper *parameterWrapper,
const ParameterWrapper *newValues,
uint16_t startAtIndex) {
if (domainId != 0) {
return HasParametersIF::INVALID_DOMAIN_ID;
}
if (uniqueIdentifier >= ParamId::NUM_IDS) {
return HasParametersIF::INVALID_IDENTIFIER_ID;
}
uint8_t newPrefSd;
ReturnValue_t result = newValues->getElement(&newPrefSd);
if (result != returnvalue::OK) {
return result;
}
// Only SD card 0 (0) and 1 (1) are allowed values.
if (newPrefSd > 1) {
return HasParametersIF::INVALID_VALUE;
}
result = sdcMan->setPreferredSdCard(static_cast<sd::SdCard>(newPrefSd));
if (result != returnvalue::OK) {
return returnvalue::FAILED;
}
parameterWrapper->set(prefSdRaw);
return returnvalue::OK;
}

View File

@ -4,6 +4,8 @@
#include <fsfw/container/DynamicFIFO.h>
#include <fsfw/container/SimpleRingBuffer.h>
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
#include <fsfw/parameters/ParameterHelper.h>
#include <fsfw/parameters/ReceivesParameterMessagesIF.h>
#include <libxiphos.h>
#include <mission/acs/archive/GPSDefinitions.h>
#include <mission/utility/trace.h>
@ -48,8 +50,10 @@ struct RebootFile {
xsc::Copy mechanismNextCopy = xsc::Copy::NO_COPY;
};
class CoreController : public ExtendedControllerBase {
class CoreController : public ExtendedControllerBase, public ReceivesParameterMessagesIF {
public:
enum ParamId : uint8_t { PREF_SD = 0, NUM_IDS };
static xsc::Chip CURRENT_CHIP;
static xsc::Copy CURRENT_COPY;
@ -152,6 +156,7 @@ class CoreController : public ExtendedControllerBase {
SdCardManager* sdcMan = nullptr;
MessageQueueIF* eventQueue = nullptr;
uint8_t prefSdRaw = sd::SdCard::SLOT_0;
SdStates sdFsmState = SdStates::START;
SdStates fsmStateAfterDelay = SdStates::IDLE;
enum SdCfgMode { PASSIVE, COLD_REDUNDANT, HOT_REDUNDANT };
@ -216,10 +221,16 @@ class CoreController : public ExtendedControllerBase {
core::HkSet hkSet;
ParameterHelper paramHelper;
#if OBSW_SD_CARD_MUST_BE_ON == 1
bool remountAttemptFlag = true;
#endif
MessageQueueId_t getCommandQueue() const override;
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueIdentifier,
ParameterWrapper* parameterWrapper, const ParameterWrapper* newValues,
uint16_t startAtIndex) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override;