PDEC Config Persistent #398

Merged
muellerr merged 21 commits from meier/pdec-config-persistent into develop 2023-02-27 18:33:52 +01:00
15 changed files with 212 additions and 219 deletions
Showing only changes of commit 5db1f71854 - Show all commits

View File

@ -40,6 +40,7 @@
#include "linux/ipcore/PdecHandler.h" #include "linux/ipcore/PdecHandler.h"
#include "linux/ipcore/Ptme.h" #include "linux/ipcore/Ptme.h"
#include "linux/ipcore/PtmeConfig.h" #include "linux/ipcore/PtmeConfig.h"
#include "mission/config/configfile.h"
#include "mission/csp/CspCookie.h" #include "mission/csp/CspCookie.h"
#include "mission/system/fdir/AcsBoardFdir.h" #include "mission/system/fdir/AcsBoardFdir.h"
#include "mission/system/fdir/GomspacePowerFdir.h" #include "mission/system/fdir/GomspacePowerFdir.h"
@ -54,7 +55,6 @@
#include "mission/system/tree/payloadModeTree.h" #include "mission/system/tree/payloadModeTree.h"
#include "mission/system/tree/tcsModeTree.h" #include "mission/system/tree/tcsModeTree.h"
#include "mission/utility/GlobalConfigHandler.h" #include "mission/utility/GlobalConfigHandler.h"
#include "mission/config/configfile.h"
#include "tmtc/pusIds.h" #include "tmtc/pusIds.h"
#if OBSW_TEST_LIBGPIOD == 1 #if OBSW_TEST_LIBGPIOD == 1
#include "linux/boardtest/LibgpiodTest.h" #include "linux/boardtest/LibgpiodTest.h"

View File

@ -1,11 +1,11 @@
#include "LocalParameterHandler.h" #include "LocalParameterHandler.h"
#include <fsfw/serviceinterface/ServiceInterface.h> #include <fsfw/serviceinterface/ServiceInterface.h>
LocalParameterHandler::LocalParameterHandler(std::string sdRelativeName, SdCardMountedIF* sdcMan) LocalParameterHandler::LocalParameterHandler(std::string sdRelativeName, SdCardMountedIF* sdcMan)
: NVMParameterBase(), sdRelativeName(sdRelativeName), sdcMan(sdcMan) {} : NVMParameterBase(), sdRelativeName(sdRelativeName), sdcMan(sdcMan) {}
LocalParameterHandler::~LocalParameterHandler() { LocalParameterHandler::~LocalParameterHandler() {}
}
ReturnValue_t LocalParameterHandler::initialize() { ReturnValue_t LocalParameterHandler::initialize() {
ReturnValue_t result = updateFullName(); ReturnValue_t result = updateFullName();
@ -39,4 +39,3 @@ ReturnValue_t LocalParameterHandler::updateFullName() {
NVMParameterBase::setFullName(fullname); NVMParameterBase::setFullName(fullname);
return returnvalue::OK; return returnvalue::OK;
} }

View File

@ -1,11 +1,11 @@
#ifndef BSP_Q7S_MEMORY_LOCALPARAMETERHANDLER_H_ #ifndef BSP_Q7S_MEMORY_LOCALPARAMETERHANDLER_H_
#define BSP_Q7S_MEMORY_LOCALPARAMETERHANDLER_H_ #define BSP_Q7S_MEMORY_LOCALPARAMETERHANDLER_H_
#include <string>
#include <mission/memory/NVMParameterBase.h> #include <mission/memory/NVMParameterBase.h>
#include <mission/memory/SdCardMountedIF.h> #include <mission/memory/SdCardMountedIF.h>
#include <string>
/** /**
* @brief Class to handle persistent parameters * @brief Class to handle persistent parameters
* *
@ -13,7 +13,6 @@
*/ */
class LocalParameterHandler : public NVMParameterBase { class LocalParameterHandler : public NVMParameterBase {
public: public:
static constexpr uint8_t INTERFACE_ID = CLASS_ID::LOCAL_PARAM_HANDLER; static constexpr uint8_t INTERFACE_ID = CLASS_ID::LOCAL_PARAM_HANDLER;
static constexpr ReturnValue_t SD_NOT_READY = returnvalue::makeCode(INTERFACE_ID, 0); static constexpr ReturnValue_t SD_NOT_READY = returnvalue::makeCode(INTERFACE_ID, 0);
@ -21,7 +20,8 @@ class LocalParameterHandler : public NVMParameterBase {
* @brief Constructor * @brief Constructor
* *
* @param sdRelativeName Absolute name of json file relative to mount * @param sdRelativeName Absolute name of json file relative to mount
* directory of SD card. E.g. conf/example.json * directory of SD card.
* E.g. conf/example.json
* @param sdcMan Pointer to SD card manager * @param sdcMan Pointer to SD card manager
*/ */
LocalParameterHandler(std::string sdRelativeName, SdCardMountedIF* sdcMan); LocalParameterHandler(std::string sdRelativeName, SdCardMountedIF* sdcMan);
@ -46,7 +46,8 @@ class LocalParameterHandler : public NVMParameterBase {
* @details The function will add the parameter only if it is not already * @details The function will add the parameter only if it is not already
* present in the json file * present in the json file
*/ */
template<typename T> ReturnValue_t addParameter(std::string key, T value); template <typename T>
ReturnValue_t addParameter(std::string key, T value);
/** /**
* @brief Function will update a parameter which already exists in the json * @brief Function will update a parameter which already exists in the json
@ -57,10 +58,10 @@ class LocalParameterHandler : public NVMParameterBase {
* *
* @return OK if successful, otherwise error return value * @return OK if successful, otherwise error return value
*/ */
template<typename T> ReturnValue_t updateParameter(std::string key, T value); template <typename T>
ReturnValue_t updateParameter(std::string key, T value);
private: private:
// Name relative to mount point of SD card where parameters will be stored // Name relative to mount point of SD card where parameters will be stored
std::string sdRelativeName; std::string sdRelativeName;
@ -77,7 +78,8 @@ class LocalParameterHandler : public NVMParameterBase {
ReturnValue_t updateFullName(); ReturnValue_t updateFullName();
}; };
template<typename T> inline ReturnValue_t LocalParameterHandler::addParameter(std::string key, T value) { template <typename T>
inline ReturnValue_t LocalParameterHandler::addParameter(std::string key, T value) {
ReturnValue_t result = insertValue(key, value); ReturnValue_t result = insertValue(key, value);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
@ -89,7 +91,8 @@ template<typename T> inline ReturnValue_t LocalParameterHandler::addParameter(st
return returnvalue::OK; return returnvalue::OK;
} }
template<typename T> inline ReturnValue_t LocalParameterHandler::updateParameter(std::string key, T value) { template <typename T>
inline ReturnValue_t LocalParameterHandler::updateParameter(std::string key, T value) {
ReturnValue_t result = setValue(key, value); ReturnValue_t result = setValue(key, value);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;

View File

@ -4,7 +4,8 @@
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
#include "pdecconfigdefs.h" #include "pdecconfigdefs.h"
PdecConfig::PdecConfig() : localParameterHandler("conf/pdecconfig.json", SdCardManager::instance()) {} PdecConfig::PdecConfig()
: localParameterHandler("conf/pdecconfig.json", SdCardManager::instance()) {}
PdecConfig::~PdecConfig() {} PdecConfig::~PdecConfig() {}
@ -51,8 +52,8 @@ ReturnValue_t PdecConfig::createPersistentConfig() {
sif::error << "PdecConfig::createPersistentConfig: Failed to set positive window" << std::endl; sif::error << "PdecConfig::createPersistentConfig: Failed to set positive window" << std::endl;
return result; return result;
} }
result = localParameterHandler.addParameter( result = localParameterHandler.addParameter(pdecconfigdefs::paramkeys::NEGATIVE_WINDOW,
pdecconfigdefs::paramkeys::NEGATIVE_WINDOW, pdecconfigdefs::defaultvalue::negativeWindow); pdecconfigdefs::defaultvalue::negativeWindow);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
sif::error << "PdecConfig::createPersistentConfig: Failed to set negative window" << std::endl; sif::error << "PdecConfig::createPersistentConfig: Failed to set negative window" << std::endl;
return result; return result;

View File

@ -3,8 +3,8 @@
#include <string> #include <string>
#include "bsp_q7s/memory/LocalParameterHandler.h"
#include "bsp_q7s/fs/SdCardManager.h" #include "bsp_q7s/fs/SdCardManager.h"
#include "bsp_q7s/memory/LocalParameterHandler.h"
#include "fsfw/returnvalues/returnvalue.h" #include "fsfw/returnvalues/returnvalue.h"
#include "pdec.h" #include "pdec.h"
@ -49,7 +49,6 @@ class PdecConfig {
ReturnValue_t getNegativeWindow(uint8_t& negativeWindow); ReturnValue_t getNegativeWindow(uint8_t& negativeWindow);
private: private:
// TC transfer frame configuration parameters // TC transfer frame configuration parameters
static const uint8_t VERSION_ID = 0; static const uint8_t VERSION_ID = 0;
// BD Frames // BD Frames

View File

@ -422,7 +422,8 @@ ReturnValue_t PdecHandler::pdecToReset() {
result = gpioComIF->pullLow(pdecReset); result = gpioComIF->pullLow(pdecReset);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
sif::error << "PdecHandler::pdecToReset: Failed to pull PDEC reset line" sif::error << "PdecHandler::pdecToReset: Failed to pull PDEC reset line"
" to low" << std::endl; " to low"
<< std::endl;
} }
return result; return result;
} }

View File

@ -8,9 +8,9 @@
#include "eive/definitions.h" #include "eive/definitions.h"
#include "fsfw/action/ActionHelper.h" #include "fsfw/action/ActionHelper.h"
#include "fsfw/action/HasActionsIF.h" #include "fsfw/action/HasActionsIF.h"
#include "fsfw/parameters/ReceivesParameterMessagesIF.h"
#include "fsfw/parameters/ParameterHelper.h"
#include "fsfw/objectmanager/SystemObject.h" #include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/parameters/ParameterHelper.h"
#include "fsfw/parameters/ReceivesParameterMessagesIF.h"
#include "fsfw/returnvalues/returnvalue.h" #include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/storagemanager/StorageManagerIF.h" #include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/tasks/ExecutableObjectIF.h" #include "fsfw/tasks/ExecutableObjectIF.h"
@ -103,8 +103,7 @@ class PdecHandler : public SystemObject,
static constexpr Event WRITE_SYSCALL_ERROR_PDEC = static constexpr Event WRITE_SYSCALL_ERROR_PDEC =
event::makeEvent(SUBSYSTEM_ID, 9, severity::MEDIUM); event::makeEvent(SUBSYSTEM_ID, 9, severity::MEDIUM);
//! [EXPORT] : [COMMENT] Failed to pull PDEC reset to low //! [EXPORT] : [COMMENT] Failed to pull PDEC reset to low
static constexpr Event PDEC_RESET_FAILED = static constexpr Event PDEC_RESET_FAILED = event::makeEvent(SUBSYSTEM_ID, 10, severity::HIGH);
event::makeEvent(SUBSYSTEM_ID, 10, severity::HIGH);
private: private:
static const uint8_t INTERFACE_ID = CLASS_ID::PDEC_HANDLER; static const uint8_t INTERFACE_ID = CLASS_ID::PDEC_HANDLER;
@ -377,7 +376,6 @@ class PdecHandler : public SystemObject,
*/ */
uint8_t calcMapAddrEntry(uint8_t moduleId); uint8_t calcMapAddrEntry(uint8_t moduleId);
/** /**
* brief Returns the 32-bit wide communication link control word (CLCW) * brief Returns the 32-bit wide communication link control word (CLCW)
*/ */

View File

@ -8,13 +8,13 @@ namespace pdecconfigdefs {
namespace paramkeys { namespace paramkeys {
static const std::string POSITIVE_WINDOW = "positive_window"; static const std::string POSITIVE_WINDOW = "positive_window";
static const std::string NEGATIVE_WINDOW = "negattive_window"; static const std::string NEGATIVE_WINDOW = "negattive_window";
} } // namespace paramkeys
namespace defaultvalue { namespace defaultvalue {
static const uint8_t positiveWindow = 10; static const uint8_t positiveWindow = 10;
static const uint8_t negativeWindow = 151; static const uint8_t negativeWindow = 151;
} } // namespace defaultvalue
} } // namespace pdecconfigdefs
#endif /* LINUX_IPCORE_PDECCONFIGDEFS_H_ */ #endif /* LINUX_IPCORE_PDECCONFIGDEFS_H_ */

View File

@ -4,6 +4,6 @@
namespace configfile { namespace configfile {
// Name of global config file relative to currently mounted SD card // Name of global config file relative to currently mounted SD card
static const char sdrelative[] = "config/global_config.json"; static const char sdrelative[] = "config/global_config.json";
} } // namespace configfile
#endif /* MISSION_CONFIG_CONFIGFILE_H_ */ #endif /* MISSION_CONFIG_CONFIGFILE_H_ */

View File

@ -111,8 +111,7 @@ void Guidance::targetQuatPtgSingleAxis(timeval now, double posSatE[3], double ve
if (sightAngleSun < critSightAngle) { if (sightAngleSun < critSightAngle) {
strBlindAvoidFlag = true; strBlindAvoidFlag = true;
} }
} } else {
else {
if (sightAngleSun < blindEnd * exclAngle) { if (sightAngleSun < blindEnd * exclAngle) {
double normBlindRefRate = acsParameters.targetModeControllerParameters.blindRotRate; double normBlindRefRate = acsParameters.targetModeControllerParameters.blindRotRate;
double blindRefRate[3] = {0, 0, 0}; double blindRefRate[3] = {0, 0, 0};

View File

@ -1114,9 +1114,8 @@ void MultiplicativeKalmanFilter::updateDataSetWithoutData(acsctrl::MekfData *mek
} }
} }
void MultiplicativeKalmanFilter::updateDataSet(acsctrl::MekfData *mekfData, void MultiplicativeKalmanFilter::updateDataSet(acsctrl::MekfData *mekfData, MekfStatus mekfStatus,
MekfStatus mekfStatus, double quat[4], double quat[4], double satRotRate[3]) {
double satRotRate[3]) {
{ {
PoolReadGuard pg(mekfData); PoolReadGuard pg(mekfData);
if (pg.getReadResult() == returnvalue::OK) { if (pg.getReadResult() == returnvalue::OK) {

View File

@ -17,8 +17,8 @@ class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF {
* @param maxNumberOfSequences * @param maxNumberOfSequences
* @param maxNumberOfTables * @param maxNumberOfTables
* @param transmitterTimeout Maximum time the transmitter of the syrlinks * @param transmitterTimeout Maximum time the transmitter of the syrlinks
* will be * will
* enabled * be enabled
*/ */
ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables, ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables,
uint32_t transmitterTimeout); uint32_t transmitterTimeout);

View File

@ -11,12 +11,6 @@
static constexpr double PARAM0_DEFAULT = 5.0; static constexpr double PARAM0_DEFAULT = 5.0;
static constexpr int PARAM1_DEFAULT = 905; static constexpr int PARAM1_DEFAULT = 905;
enum ParamIds : uint8_t { enum ParamIds : uint8_t { PARAM0 = 0, PARAM1 = 1, PARAM2 = 2, PDEC_PW = 3, PDEC_NW = 4 };
PARAM0 = 0,
PARAM1 = 1,
PARAM2 = 2,
PDEC_PW = 3,
PDEC_NW = 4
};
#endif /* MISSION_UTILITY_GLOBALCONFIGFILEDEFINITIONS_H_ */ #endif /* MISSION_UTILITY_GLOBALCONFIGFILEDEFINITIONS_H_ */