Merge branch 'development' into gaisser_compiler_flags

This commit is contained in:
Steffen Gaisser 2022-03-07 14:39:01 +01:00
commit 7db11588b4
10 changed files with 82 additions and 88 deletions

View File

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## Changes ## Changes
- HAL Devicehandlers: Periodic printout is run-time configurable now
- `oneShotAction` flag in the `TestTask` class is not static anymore - `oneShotAction` flag in the `TestTask` class is not static anymore
## Removed ## Removed

View File

@ -8,11 +8,7 @@ GyroHandlerL3GD20H::GyroHandlerL3GD20H(object_id_t objectId, object_id_t deviceC
CookieIF *comCookie, uint32_t transitionDelayMs) CookieIF *comCookie, uint32_t transitionDelayMs)
: DeviceHandlerBase(objectId, deviceCommunication, comCookie), : DeviceHandlerBase(objectId, deviceCommunication, comCookie),
transitionDelayMs(transitionDelayMs), transitionDelayMs(transitionDelayMs),
dataset(this) { dataset(this) {}
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1
debugDivider = new PeriodicOperationDivider(3);
#endif
}
GyroHandlerL3GD20H::~GyroHandlerL3GD20H() {} GyroHandlerL3GD20H::~GyroHandlerL3GD20H() {}
@ -193,8 +189,8 @@ ReturnValue_t GyroHandlerL3GD20H::interpretDeviceReply(DeviceCommandId_t id,
int8_t temperaturOffset = (-1) * packet[L3GD20H::TEMPERATURE_IDX]; int8_t temperaturOffset = (-1) * packet[L3GD20H::TEMPERATURE_IDX];
float temperature = 25.0 + temperaturOffset; float temperature = 25.0 + temperaturOffset;
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 if (periodicPrintout) {
if (debugDivider->checkAndIncrement()) { if (debugDivider.checkAndIncrement()) {
/* Set terminal to utf-8 if there is an issue with micro printout. */ /* Set terminal to utf-8 if there is an issue with micro printout. */
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "GyroHandlerL3GD20H: Angular velocities (deg/s):" << std::endl; sif::info << "GyroHandlerL3GD20H: Angular velocities (deg/s):" << std::endl;
@ -208,7 +204,7 @@ ReturnValue_t GyroHandlerL3GD20H::interpretDeviceReply(DeviceCommandId_t id,
sif::printInfo("Z: %f\n", angVelocZ); sif::printInfo("Z: %f\n", angVelocZ);
#endif #endif
} }
#endif }
PoolReadGuard readSet(&dataset); PoolReadGuard readSet(&dataset);
if (readSet.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if (readSet.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
@ -272,3 +268,8 @@ void GyroHandlerL3GD20H::setAbsoluteLimits(float limitX, float limitY, float lim
this->absLimitY = limitY; this->absLimitY = limitY;
this->absLimitZ = limitZ; this->absLimitZ = limitZ;
} }
void GyroHandlerL3GD20H::enablePeriodicPrintouts(bool enable, uint8_t divider) {
periodicPrintout = enable;
debugDivider.setDivider(divider);
}

View File

@ -5,7 +5,6 @@
#include <fsfw/globalfunctions/PeriodicOperationDivider.h> #include <fsfw/globalfunctions/PeriodicOperationDivider.h>
#include "devicedefinitions/GyroL3GD20Definitions.h" #include "devicedefinitions/GyroL3GD20Definitions.h"
#include "fsfw/FSFW.h"
/** /**
* @brief Device Handler for the L3GD20H gyroscope sensor * @brief Device Handler for the L3GD20H gyroscope sensor
@ -22,6 +21,8 @@ class GyroHandlerL3GD20H : public DeviceHandlerBase {
uint32_t transitionDelayMs); uint32_t transitionDelayMs);
virtual ~GyroHandlerL3GD20H(); virtual ~GyroHandlerL3GD20H();
void enablePeriodicPrintouts(bool enable, uint8_t divider);
/** /**
* Set the absolute limit for the values on the axis in degrees per second. * Set the absolute limit for the values on the axis in degrees per second.
* The dataset values will be marked as invalid if that limit is exceeded * The dataset values will be marked as invalid if that limit is exceeded
@ -80,9 +81,8 @@ class GyroHandlerL3GD20H : public DeviceHandlerBase {
// Set default value // Set default value
float sensitivity = L3GD20H::SENSITIVITY_00; float sensitivity = L3GD20H::SENSITIVITY_00;
#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 bool periodicPrintout = false;
PeriodicOperationDivider *debugDivider = nullptr; PeriodicOperationDivider debugDivider = PeriodicOperationDivider(3);
#endif
}; };
#endif /* MISSION_DEVICES_GYROL3GD20HANDLER_H_ */ #endif /* MISSION_DEVICES_GYROL3GD20HANDLER_H_ */

View File

@ -12,9 +12,6 @@ MgmLIS3MDLHandler::MgmLIS3MDLHandler(object_id_t objectId, object_id_t deviceCom
: DeviceHandlerBase(objectId, deviceCommunication, comCookie), : DeviceHandlerBase(objectId, deviceCommunication, comCookie),
dataset(this), dataset(this),
transitionDelay(transitionDelay) { transitionDelay(transitionDelay) {
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1
debugDivider = new PeriodicOperationDivider(3);
#endif
// Set to default values right away // Set to default values right away
registers[0] = MGMLIS3MDL::CTRL_REG1_DEFAULT; registers[0] = MGMLIS3MDL::CTRL_REG1_DEFAULT;
registers[1] = MGMLIS3MDL::CTRL_REG2_DEFAULT; registers[1] = MGMLIS3MDL::CTRL_REG2_DEFAULT;
@ -264,7 +261,7 @@ ReturnValue_t MgmLIS3MDLHandler::interpretDeviceReply(DeviceCommandId_t id, cons
int16_t mgmMeasurementRawZ = int16_t mgmMeasurementRawZ =
packet[MGMLIS3MDL::Z_HIGHBYTE_IDX] << 8 | packet[MGMLIS3MDL::Z_LOWBYTE_IDX]; packet[MGMLIS3MDL::Z_HIGHBYTE_IDX] << 8 | packet[MGMLIS3MDL::Z_LOWBYTE_IDX];
/* Target value in microtesla */ // Target value in microtesla
float mgmX = static_cast<float>(mgmMeasurementRawX) * sensitivityFactor * float mgmX = static_cast<float>(mgmMeasurementRawX) * sensitivityFactor *
MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR; MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR;
float mgmY = static_cast<float>(mgmMeasurementRawY) * sensitivityFactor * float mgmY = static_cast<float>(mgmMeasurementRawY) * sensitivityFactor *
@ -272,8 +269,8 @@ ReturnValue_t MgmLIS3MDLHandler::interpretDeviceReply(DeviceCommandId_t id, cons
float mgmZ = static_cast<float>(mgmMeasurementRawZ) * sensitivityFactor * float mgmZ = static_cast<float>(mgmMeasurementRawZ) * sensitivityFactor *
MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR; MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR;
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 if (periodicPrintout) {
if (debugDivider->checkAndIncrement()) { if (debugDivider.checkAndIncrement()) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "MGMHandlerLIS3: Magnetic field strength in" sif::info << "MGMHandlerLIS3: Magnetic field strength in"
" microtesla:" " microtesla:"
@ -288,7 +285,8 @@ ReturnValue_t MgmLIS3MDLHandler::interpretDeviceReply(DeviceCommandId_t id, cons
sif::printInfo("Z: %f uT\n", mgmZ); sif::printInfo("Z: %f uT\n", mgmZ);
#endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */ #endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */
} }
#endif /* OBSW_VERBOSE_LEVEL >= 1 */ }
PoolReadGuard readHelper(&dataset); PoolReadGuard readHelper(&dataset);
if (readHelper.getReadResult() == HasReturnvaluesIF::RETURN_OK) { if (readHelper.getReadResult() == HasReturnvaluesIF::RETURN_OK) {
if (std::abs(mgmX) < absLimitX) { if (std::abs(mgmX) < absLimitX) {
@ -318,15 +316,16 @@ ReturnValue_t MgmLIS3MDLHandler::interpretDeviceReply(DeviceCommandId_t id, cons
case MGMLIS3MDL::READ_TEMPERATURE: { case MGMLIS3MDL::READ_TEMPERATURE: {
int16_t tempValueRaw = packet[2] << 8 | packet[1]; int16_t tempValueRaw = packet[2] << 8 | packet[1];
float tempValue = 25.0 + ((static_cast<float>(tempValueRaw)) / 8.0); float tempValue = 25.0 + ((static_cast<float>(tempValueRaw)) / 8.0);
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 if (periodicPrintout) {
if (debugDivider->check()) { if (debugDivider.check()) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "MGMHandlerLIS3: Temperature: " << tempValue << " C" << std::endl; sif::info << "MGMHandlerLIS3: Temperature: " << tempValue << " C" << std::endl;
#else #else
sif::printInfo("MGMHandlerLIS3: Temperature: %f C\n"); sif::printInfo("MGMHandlerLIS3: Temperature: %f C\n");
#endif #endif
} }
#endif }
ReturnValue_t result = dataset.read(); ReturnValue_t result = dataset.read();
if (result == HasReturnvaluesIF::RETURN_OK) { if (result == HasReturnvaluesIF::RETURN_OK) {
dataset.temperature = tempValue; dataset.temperature = tempValue;
@ -462,7 +461,9 @@ ReturnValue_t MgmLIS3MDLHandler::prepareCtrlRegisterWrite() {
return RETURN_OK; return RETURN_OK;
} }
void MgmLIS3MDLHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {} void MgmLIS3MDLHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
DeviceHandlerBase::doTransition(modeFrom, subModeFrom);
}
uint32_t MgmLIS3MDLHandler::getTransitionDelayMs(Mode_t from, Mode_t to) { return transitionDelay; } uint32_t MgmLIS3MDLHandler::getTransitionDelayMs(Mode_t from, Mode_t to) { return transitionDelay; }
@ -482,3 +483,8 @@ void MgmLIS3MDLHandler::setAbsoluteLimits(float xLimit, float yLimit, float zLim
this->absLimitY = yLimit; this->absLimitY = yLimit;
this->absLimitZ = zLimit; this->absLimitZ = zLimit;
} }
void MgmLIS3MDLHandler::enablePeriodicPrintouts(bool enable, uint8_t divider) {
periodicPrintout = enable;
debugDivider.setDivider(divider);
}

View File

@ -3,8 +3,8 @@
#include "devicedefinitions/MgmLIS3HandlerDefs.h" #include "devicedefinitions/MgmLIS3HandlerDefs.h"
#include "events/subsystemIdRanges.h" #include "events/subsystemIdRanges.h"
#include "fsfw/FSFW.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h"
#include "fsfw/globalfunctions/PeriodicOperationDivider.h"
class PeriodicOperationDivider; class PeriodicOperationDivider;
@ -30,6 +30,7 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
uint32_t transitionDelay); uint32_t transitionDelay);
virtual ~MgmLIS3MDLHandler(); virtual ~MgmLIS3MDLHandler();
void enablePeriodicPrintouts(bool enable, uint8_t divider);
/** /**
* Set the absolute limit for the values on the axis in microtesla. The dataset values will * Set the absolute limit for the values on the axis in microtesla. The dataset values will
* be marked as invalid if that limit is exceeded * be marked as invalid if that limit is exceeded
@ -167,9 +168,8 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
*/ */
ReturnValue_t prepareCtrlRegisterWrite(); ReturnValue_t prepareCtrlRegisterWrite();
#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 bool periodicPrintout = false;
PeriodicOperationDivider *debugDivider; PeriodicOperationDivider debugDivider = PeriodicOperationDivider(3);
#endif
}; };
#endif /* MISSION_DEVICES_MGMLIS3MDLHANDLER_H_ */ #endif /* MISSION_DEVICES_MGMLIS3MDLHANDLER_H_ */

View File

@ -10,11 +10,7 @@ MgmRM3100Handler::MgmRM3100Handler(object_id_t objectId, object_id_t deviceCommu
CookieIF *comCookie, uint32_t transitionDelay) CookieIF *comCookie, uint32_t transitionDelay)
: DeviceHandlerBase(objectId, deviceCommunication, comCookie), : DeviceHandlerBase(objectId, deviceCommunication, comCookie),
primaryDataset(this), primaryDataset(this),
transitionDelay(transitionDelay) { transitionDelay(transitionDelay) {}
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
debugDivider = new PeriodicOperationDivider(3);
#endif
}
MgmRM3100Handler::~MgmRM3100Handler() {} MgmRM3100Handler::~MgmRM3100Handler() {}
@ -337,8 +333,8 @@ ReturnValue_t MgmRM3100Handler::handleDataReadout(const uint8_t *packet) {
float fieldStrengthY = fieldStrengthRawY * scaleFactorX; float fieldStrengthY = fieldStrengthRawY * scaleFactorX;
float fieldStrengthZ = fieldStrengthRawZ * scaleFactorX; float fieldStrengthZ = fieldStrengthRawZ * scaleFactorX;
#if FSFW_HAL_RM3100_MGM_DEBUG == 1 if (periodicPrintout) {
if (debugDivider->checkAndIncrement()) { if (debugDivider.checkAndIncrement()) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "MgmRM3100Handler: Magnetic field strength in" sif::info << "MgmRM3100Handler: Magnetic field strength in"
" microtesla:" " microtesla:"
@ -353,7 +349,7 @@ ReturnValue_t MgmRM3100Handler::handleDataReadout(const uint8_t *packet) {
sif::printInfo("Z: %f uT\n", fieldStrengthZ); sif::printInfo("Z: %f uT\n", fieldStrengthZ);
#endif #endif
} }
#endif }
// TODO: Sanity check on values? // TODO: Sanity check on values?
PoolReadGuard readGuard(&primaryDataset); PoolReadGuard readGuard(&primaryDataset);
@ -365,3 +361,8 @@ ReturnValue_t MgmRM3100Handler::handleDataReadout(const uint8_t *packet) {
} }
return RETURN_OK; return RETURN_OK;
} }
void MgmRM3100Handler::enablePeriodicPrintouts(bool enable, uint8_t divider) {
periodicPrintout = enable;
debugDivider.setDivider(divider);
}

View File

@ -2,12 +2,8 @@
#define MISSION_DEVICES_MGMRM3100HANDLER_H_ #define MISSION_DEVICES_MGMRM3100HANDLER_H_
#include "devicedefinitions/MgmRM3100HandlerDefs.h" #include "devicedefinitions/MgmRM3100HandlerDefs.h"
#include "fsfw/FSFW.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h"
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
#include "fsfw/globalfunctions/PeriodicOperationDivider.h" #include "fsfw/globalfunctions/PeriodicOperationDivider.h"
#endif
/** /**
* @brief Device Handler for the RM3100 geomagnetic magnetometer sensor * @brief Device Handler for the RM3100 geomagnetic magnetometer sensor
@ -33,6 +29,7 @@ class MgmRM3100Handler : public DeviceHandlerBase {
uint32_t transitionDelay); uint32_t transitionDelay);
virtual ~MgmRM3100Handler(); virtual ~MgmRM3100Handler();
void enablePeriodicPrintouts(bool enable, uint8_t divider);
/** /**
* Configure device handler to go to normal mode after startup immediately * Configure device handler to go to normal mode after startup immediately
* @param enable * @param enable
@ -98,9 +95,9 @@ class MgmRM3100Handler : public DeviceHandlerBase {
size_t commandDataLen); size_t commandDataLen);
ReturnValue_t handleDataReadout(const uint8_t *packet); ReturnValue_t handleDataReadout(const uint8_t *packet);
#if FSFW_HAL_RM3100_MGM_DEBUG == 1
PeriodicOperationDivider *debugDivider; bool periodicPrintout = false;
#endif PeriodicOperationDivider debugDivider = PeriodicOperationDivider(3);
}; };
#endif /* MISSION_DEVICEHANDLING_MGMRM3100HANDLER_H_ */ #endif /* MISSION_DEVICEHANDLING_MGMRM3100HANDLER_H_ */

View File

@ -57,18 +57,6 @@
#define FSFW_HAL_SPI_WIRETAPPING 0 #define FSFW_HAL_SPI_WIRETAPPING 0
#endif #endif
#ifndef FSFW_HAL_L3GD20_GYRO_DEBUG
#define FSFW_HAL_L3GD20_GYRO_DEBUG 0
#endif /* FSFW_HAL_L3GD20_GYRO_DEBUG */
#ifndef FSFW_HAL_RM3100_MGM_DEBUG
#define FSFW_HAL_RM3100_MGM_DEBUG 0
#endif /* FSFW_HAL_RM3100_MGM_DEBUG */
#ifndef FSFW_HAL_LIS3MDL_MGM_DEBUG
#define FSFW_HAL_LIS3MDL_MGM_DEBUG 0
#endif /* FSFW_HAL_LIS3MDL_MGM_DEBUG */
// Can be used for low-level debugging of the I2C bus // Can be used for low-level debugging of the I2C bus
#ifndef FSFW_HAL_I2C_WIRETAPPING #ifndef FSFW_HAL_I2C_WIRETAPPING
#define FSFW_HAL_I2C_WIRETAPPING 0 #define FSFW_HAL_I2C_WIRETAPPING 0

View File

@ -824,7 +824,7 @@ void DeviceHandlerBase::handleReply(const uint8_t* receivedData, DeviceCommandId
} }
ReturnValue_t DeviceHandlerBase::getStorageData(store_address_t storageAddress, uint8_t** data, ReturnValue_t DeviceHandlerBase::getStorageData(store_address_t storageAddress, uint8_t** data,
uint32_t* len) { size_t* len) {
size_t lenTmp; size_t lenTmp;
if (IPCStore == nullptr) { if (IPCStore == nullptr) {

View File

@ -673,7 +673,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
//! Pointer to the raw packet that will be sent. //! Pointer to the raw packet that will be sent.
uint8_t *rawPacket = nullptr; uint8_t *rawPacket = nullptr;
//! Size of the #rawPacket. //! Size of the #rawPacket.
uint32_t rawPacketLen = 0; size_t rawPacketLen = 0;
/** /**
* The mode the device handler is currently in. * The mode the device handler is currently in.
@ -1250,7 +1250,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* - @c RETURN_FAILED IPCStore is nullptr * - @c RETURN_FAILED IPCStore is nullptr
* - the return value from the IPCStore if it was not @c RETURN_OK * - the return value from the IPCStore if it was not @c RETURN_OK
*/ */
ReturnValue_t getStorageData(store_address_t storageAddress, uint8_t **data, uint32_t *len); ReturnValue_t getStorageData(store_address_t storageAddress, uint8_t **data, size_t *len);
/** /**
* @param modeTo either @c MODE_ON, MODE_NORMAL or MODE_RAW, nothing else! * @param modeTo either @c MODE_ON, MODE_NORMAL or MODE_RAW, nothing else!