Set preferred SD card as parameter #593
@ -25,6 +25,9 @@ will consitute of a breaking change warranting a new major release:
|
|||||||
## Added
|
## Added
|
||||||
|
|
||||||
- Add a way for the MAX31865 RTD handlers to recognize faulty/broken/off sensor devices.
|
- 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
|
# [v1.44.1] 2023-04-12
|
||||||
|
|
||||||
|
@ -40,7 +40,8 @@ CoreController::CoreController(object_id_t objectId, bool enableHkSet)
|
|||||||
cmdRepliesSizes(128),
|
cmdRepliesSizes(128),
|
||||||
opDivider5(5),
|
opDivider5(5),
|
||||||
opDivider10(10),
|
opDivider10(10),
|
||||||
hkSet(this) {
|
hkSet(this),
|
||||||
|
paramHelper(this) {
|
||||||
cmdExecutor.setRingBuffer(&cmdReplyBuf, &cmdRepliesSizes);
|
cmdExecutor.setRingBuffer(&cmdReplyBuf, &cmdRepliesSizes);
|
||||||
try {
|
try {
|
||||||
sdcMan = SdCardManager::instance();
|
sdcMan = SdCardManager::instance();
|
||||||
@ -88,6 +89,10 @@ CoreController::CoreController(object_id_t objectId, bool enableHkSet)
|
|||||||
CoreController::~CoreController() {}
|
CoreController::~CoreController() {}
|
||||||
|
|
||||||
ReturnValue_t CoreController::handleCommandMessage(CommandMessage *message) {
|
ReturnValue_t CoreController::handleCommandMessage(CommandMessage *message) {
|
||||||
|
ReturnValue_t result = paramHelper.handleParameterMessage(message);
|
||||||
|
if (result == returnvalue::OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
return ExtendedControllerBase::handleCommandMessage(message);
|
return ExtendedControllerBase::handleCommandMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,6 +159,11 @@ ReturnValue_t CoreController::initialize() {
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result = paramHelper.initialize();
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
sdStateMachine();
|
sdStateMachine();
|
||||||
|
|
||||||
triggerEvent(core::REBOOT_SW, CURRENT_CHIP, CURRENT_COPY);
|
triggerEvent(core::REBOOT_SW, CURRENT_CHIP, CURRENT_COPY);
|
||||||
@ -2124,7 +2134,38 @@ void CoreController::announceBootCounts() {
|
|||||||
totalBootCount & 0xffffffff);
|
totalBootCount & 0xffffffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageQueueId_t CoreController::getCommandQueue() const {
|
||||||
|
return ExtendedControllerBase::getCommandQueue();
|
||||||
|
}
|
||||||
|
|
||||||
bool CoreController::isNumber(const std::string &s) {
|
bool CoreController::isNumber(const std::string &s) {
|
||||||
return !s.empty() && std::find_if(s.begin(), s.end(),
|
return !s.empty() && std::find_if(s.begin(), s.end(),
|
||||||
[](unsigned char c) { return !std::isdigit(c); }) == 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;
|
||||||
|
}
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#include <fsfw/container/DynamicFIFO.h>
|
#include <fsfw/container/DynamicFIFO.h>
|
||||||
#include <fsfw/container/SimpleRingBuffer.h>
|
#include <fsfw/container/SimpleRingBuffer.h>
|
||||||
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||||
|
#include <fsfw/parameters/ParameterHelper.h>
|
||||||
|
#include <fsfw/parameters/ReceivesParameterMessagesIF.h>
|
||||||
#include <libxiphos.h>
|
#include <libxiphos.h>
|
||||||
#include <mission/acs/archive/GPSDefinitions.h>
|
#include <mission/acs/archive/GPSDefinitions.h>
|
||||||
#include <mission/utility/trace.h>
|
#include <mission/utility/trace.h>
|
||||||
@ -48,8 +50,10 @@ 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:
|
public:
|
||||||
|
enum ParamId : uint8_t { 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;
|
||||||
|
|
||||||
@ -152,6 +156,7 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
SdCardManager* sdcMan = nullptr;
|
SdCardManager* sdcMan = nullptr;
|
||||||
MessageQueueIF* eventQueue = nullptr;
|
MessageQueueIF* eventQueue = nullptr;
|
||||||
|
|
||||||
|
uint8_t prefSdRaw = sd::SdCard::SLOT_0;
|
||||||
SdStates sdFsmState = SdStates::START;
|
SdStates sdFsmState = SdStates::START;
|
||||||
SdStates fsmStateAfterDelay = SdStates::IDLE;
|
SdStates fsmStateAfterDelay = SdStates::IDLE;
|
||||||
enum SdCfgMode { PASSIVE, COLD_REDUNDANT, HOT_REDUNDANT };
|
enum SdCfgMode { PASSIVE, COLD_REDUNDANT, HOT_REDUNDANT };
|
||||||
@ -216,10 +221,16 @@ class CoreController : public ExtendedControllerBase {
|
|||||||
|
|
||||||
core::HkSet hkSet;
|
core::HkSet hkSet;
|
||||||
|
|
||||||
|
ParameterHelper paramHelper;
|
||||||
|
|
||||||
#if OBSW_SD_CARD_MUST_BE_ON == 1
|
#if OBSW_SD_CARD_MUST_BE_ON == 1
|
||||||
bool remountAttemptFlag = true;
|
bool remountAttemptFlag = true;
|
||||||
#endif
|
#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,
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) override;
|
LocalDataPoolManager& poolManager) override;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user