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

View File

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

View File

@ -1,11 +1,11 @@
#ifndef BSP_Q7S_MEMORY_LOCALPARAMETERHANDLER_H_
#define BSP_Q7S_MEMORY_LOCALPARAMETERHANDLER_H_
#include <string>
#include <mission/memory/NVMParameterBase.h>
#include <mission/memory/SdCardMountedIF.h>
#include <string>
/**
* @brief Class to handle persistent parameters
*
@ -13,7 +13,6 @@
*/
class LocalParameterHandler : public NVMParameterBase {
public:
static constexpr uint8_t INTERFACE_ID = CLASS_ID::LOCAL_PARAM_HANDLER;
static constexpr ReturnValue_t SD_NOT_READY = returnvalue::makeCode(INTERFACE_ID, 0);
@ -21,7 +20,8 @@ class LocalParameterHandler : public NVMParameterBase {
* @brief Constructor
*
* @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
*/
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
* 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
@ -57,10 +58,10 @@ class LocalParameterHandler : public NVMParameterBase {
*
* @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:
// Name relative to mount point of SD card where parameters will be stored
std::string sdRelativeName;
@ -77,7 +78,8 @@ class LocalParameterHandler : public NVMParameterBase {
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);
if (result != returnvalue::OK) {
return result;
@ -89,7 +91,8 @@ template<typename T> inline ReturnValue_t LocalParameterHandler::addParameter(st
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);
if (result != returnvalue::OK) {
return result;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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