Merge remote-tracking branch 'origin/master' into mueller/fmt-log
This commit is contained in:
@ -1,4 +1 @@
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
utility.cpp
|
||||
TmFunnel.cpp
|
||||
)
|
||||
target_sources(${TARGET_NAME} PRIVATE utility.cpp TmFunnel.cpp)
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define MISSION_UTILITY_PUSPACKETCREATOR_H_
|
||||
|
||||
class PusPacketCreator {
|
||||
public:
|
||||
public:
|
||||
static void createPusPacketAndPrint();
|
||||
};
|
||||
|
||||
|
@ -10,6 +10,6 @@ void printInitError(const char* objName, object_id_t objectId) {
|
||||
FSFW_LOGW("InitMission: Adding object {} ({:#010x}) failed\n", objName, objectId);
|
||||
}
|
||||
|
||||
} // namespace task
|
||||
} // namespace task
|
||||
|
||||
#endif /* MISSION_UTILITY_TASKCREATION_H_ */
|
||||
|
@ -10,8 +10,8 @@ object_id_t TmFunnel::storageDestination = objects::NO_OBJECT;
|
||||
|
||||
TmFunnel::TmFunnel(object_id_t objectId, uint32_t messageDepth)
|
||||
: SystemObject(objectId), messageDepth(messageDepth) {
|
||||
tmQueue = QueueFactory::instance()->createMessageQueue(messageDepth,
|
||||
MessageQueueMessage::MAX_MESSAGE_SIZE);
|
||||
tmQueue = QueueFactory::instance()->createMessageQueue(
|
||||
messageDepth, MessageQueueMessage::MAX_MESSAGE_SIZE);
|
||||
storageQueue = QueueFactory::instance()->createMessageQueue(
|
||||
messageDepth, MessageQueueMessage::MAX_MESSAGE_SIZE);
|
||||
}
|
||||
@ -40,23 +40,25 @@ ReturnValue_t TmFunnel::performOperation(uint8_t operationCode) {
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t TmFunnel::handlePacket(TmTcMessage* message) {
|
||||
uint8_t* packetData = nullptr;
|
||||
ReturnValue_t TmFunnel::handlePacket(TmTcMessage *message) {
|
||||
uint8_t *packetData = nullptr;
|
||||
size_t size = 0;
|
||||
ReturnValue_t result = tmPool->modifyData(message->getStorageId(), &packetData, &size);
|
||||
ReturnValue_t result =
|
||||
tmPool->modifyData(message->getStorageId(), &packetData, &size);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
TmPacketPusC packet(packetData);
|
||||
packet.setPacketSequenceCount(this->sourceSequenceCount);
|
||||
sourceSequenceCount++;
|
||||
sourceSequenceCount = sourceSequenceCount % SpacePacketBase::LIMIT_SEQUENCE_COUNT;
|
||||
sourceSequenceCount =
|
||||
sourceSequenceCount % SpacePacketBase::LIMIT_SEQUENCE_COUNT;
|
||||
packet.setErrorControl();
|
||||
|
||||
result = tmQueue->sendToDefault(message);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
tmPool->deleteData(message->getStorageId());
|
||||
FSFW_LOGET("{}", "handlePacket: Error sending to downlink handler\n");
|
||||
FSFW_LOGET("handlePacket: Error sending to downlink handler\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -64,7 +66,7 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage* message) {
|
||||
result = storageQueue->sendToDefault(message);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
tmPool->deleteData(message->getStorageId());
|
||||
FSFW_LOGET("{}", "handlePacket: Error sending to storage handler\n");
|
||||
FSFW_LOGET("handlePacket: Error sending to storage handler\n");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -96,10 +98,11 @@ ReturnValue_t TmFunnel::initialize() {
|
||||
return SystemObject::initialize();
|
||||
}
|
||||
|
||||
AcceptsTelemetryIF* storageTarget =
|
||||
AcceptsTelemetryIF *storageTarget =
|
||||
ObjectManager::instance()->get<AcceptsTelemetryIF>(storageDestination);
|
||||
if (storageTarget != nullptr) {
|
||||
storageQueue->setDefaultDestination(storageTarget->getReportReceptionQueue());
|
||||
storageQueue->setDefaultDestination(
|
||||
storageTarget->getReportReceptionQueue());
|
||||
}
|
||||
|
||||
return SystemObject::initialize();
|
||||
|
@ -19,30 +19,33 @@ void setStaticFrameworkObjectIds();
|
||||
* @ingroup utility
|
||||
* @author J. Meier
|
||||
*/
|
||||
class TmFunnel : public AcceptsTelemetryIF, public ExecutableObjectIF, public SystemObject {
|
||||
class TmFunnel : public AcceptsTelemetryIF,
|
||||
public ExecutableObjectIF,
|
||||
public SystemObject {
|
||||
friend void(Factory::setStaticFrameworkObjectIds)();
|
||||
|
||||
public:
|
||||
public:
|
||||
TmFunnel(object_id_t objectId, uint32_t messageDepth = 20);
|
||||
virtual ~TmFunnel();
|
||||
|
||||
virtual MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel = 0) override;
|
||||
virtual MessageQueueId_t
|
||||
getReportReceptionQueue(uint8_t virtualChannel = 0) override;
|
||||
virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||
virtual ReturnValue_t initialize() override;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
static object_id_t downlinkDestination;
|
||||
static object_id_t storageDestination;
|
||||
|
||||
private:
|
||||
private:
|
||||
uint16_t sourceSequenceCount = 0;
|
||||
MessageQueueIF* tmQueue = nullptr;
|
||||
MessageQueueIF* storageQueue = nullptr;
|
||||
MessageQueueIF *tmQueue = nullptr;
|
||||
MessageQueueIF *storageQueue = nullptr;
|
||||
|
||||
StorageManagerIF* tmPool = nullptr;
|
||||
StorageManagerIF *tmPool = nullptr;
|
||||
uint32_t messageDepth = 0;
|
||||
|
||||
ReturnValue_t handlePacket(TmTcMessage* message);
|
||||
ReturnValue_t handlePacket(TmTcMessage *message);
|
||||
};
|
||||
|
||||
#endif /* MISSION_UTILITY_TMFUNNEL_H_ */
|
||||
|
@ -13,11 +13,13 @@
|
||||
*
|
||||
* Assembled by Jean Rabault
|
||||
*
|
||||
* UNIX_TIMESTAMP gives the UNIX timestamp (unsigned long integer of seconds since 1st Jan 1970) of
|
||||
* compilation from macros using the compiler defined __TIME__ macro. This should include Gregorian
|
||||
* calendar leap days, in particular the 29ths of February, 100 and 400 years modulo leaps.
|
||||
* UNIX_TIMESTAMP gives the UNIX timestamp (unsigned long integer of seconds
|
||||
* since 1st Jan 1970) of compilation from macros using the compiler defined
|
||||
* __TIME__ macro. This should include Gregorian calendar leap days, in
|
||||
* particular the 29ths of February, 100 and 400 years modulo leaps.
|
||||
*
|
||||
* Careful: __TIME__ is the local time of the computer, NOT the UTC time in general!
|
||||
* Careful: __TIME__ is the local time of the computer, NOT the UTC time in
|
||||
* general!
|
||||
*
|
||||
*/
|
||||
|
||||
@ -37,19 +39,19 @@
|
||||
#define CONV_STR2DEC_4(str, i) (CONV_STR2DEC_3(str, i) * 10 + str[i + 3] - '0')
|
||||
|
||||
// Custom "glue logic" to convert the month name to a usable number
|
||||
#define GET_MONTH(str, i) \
|
||||
(str[i] == 'J' && str[i + 1] == 'a' && str[i + 2] == 'n' ? 1 \
|
||||
: str[i] == 'F' && str[i + 1] == 'e' && str[i + 2] == 'b' ? 2 \
|
||||
: str[i] == 'M' && str[i + 1] == 'a' && str[i + 2] == 'r' ? 3 \
|
||||
: str[i] == 'A' && str[i + 1] == 'p' && str[i + 2] == 'r' ? 4 \
|
||||
: str[i] == 'M' && str[i + 1] == 'a' && str[i + 2] == 'y' ? 5 \
|
||||
: str[i] == 'J' && str[i + 1] == 'u' && str[i + 2] == 'n' ? 6 \
|
||||
: str[i] == 'J' && str[i + 1] == 'u' && str[i + 2] == 'l' ? 7 \
|
||||
: str[i] == 'A' && str[i + 1] == 'u' && str[i + 2] == 'g' ? 8 \
|
||||
: str[i] == 'S' && str[i + 1] == 'e' && str[i + 2] == 'p' ? 9 \
|
||||
: str[i] == 'O' && str[i + 1] == 'c' && str[i + 2] == 't' ? 10 \
|
||||
: str[i] == 'N' && str[i + 1] == 'o' && str[i + 2] == 'v' ? 11 \
|
||||
: str[i] == 'D' && str[i + 1] == 'e' && str[i + 2] == 'c' ? 12 \
|
||||
#define GET_MONTH(str, i) \
|
||||
(str[i] == 'J' && str[i + 1] == 'a' && str[i + 2] == 'n' ? 1 \
|
||||
: str[i] == 'F' && str[i + 1] == 'e' && str[i + 2] == 'b' ? 2 \
|
||||
: str[i] == 'M' && str[i + 1] == 'a' && str[i + 2] == 'r' ? 3 \
|
||||
: str[i] == 'A' && str[i + 1] == 'p' && str[i + 2] == 'r' ? 4 \
|
||||
: str[i] == 'M' && str[i + 1] == 'a' && str[i + 2] == 'y' ? 5 \
|
||||
: str[i] == 'J' && str[i + 1] == 'u' && str[i + 2] == 'n' ? 6 \
|
||||
: str[i] == 'J' && str[i + 1] == 'u' && str[i + 2] == 'l' ? 7 \
|
||||
: str[i] == 'A' && str[i + 1] == 'u' && str[i + 2] == 'g' ? 8 \
|
||||
: str[i] == 'S' && str[i + 1] == 'e' && str[i + 2] == 'p' ? 9 \
|
||||
: str[i] == 'O' && str[i + 1] == 'c' && str[i + 2] == 't' ? 10 \
|
||||
: str[i] == 'N' && str[i + 1] == 'o' && str[i + 2] == 'v' ? 11 \
|
||||
: str[i] == 'D' && str[i + 1] == 'e' && str[i + 2] == 'c' ? 12 \
|
||||
: 0)
|
||||
|
||||
// extract the information from the time string given by __TIME__ and __DATE__
|
||||
@ -61,30 +63,37 @@
|
||||
#define __TIME_YEARS__ CONV_STR2DEC_4(__DATE__, 7)
|
||||
|
||||
// Days in February
|
||||
#define _UNIX_TIMESTAMP_FDAY(year) \
|
||||
(((year) % 400) == 0UL ? 29UL \
|
||||
: (((year) % 100) == 0UL ? 28UL : (((year) % 4) == 0UL ? 29UL : 28UL)))
|
||||
#define _UNIX_TIMESTAMP_FDAY(year) \
|
||||
(((year) % 400) == 0UL \
|
||||
? 29UL \
|
||||
: (((year) % 100) == 0UL ? 28UL : (((year) % 4) == 0UL ? 29UL : 28UL)))
|
||||
|
||||
// Days in the year
|
||||
#define _UNIX_TIMESTAMP_YDAY(year, month, day) \
|
||||
(/* January */ day /* February */ + (month >= 2 ? 31UL : 0UL) /* March */ + \
|
||||
(month >= 3 ? _UNIX_TIMESTAMP_FDAY(year) : 0UL) /* April */ + \
|
||||
(month >= 4 ? 31UL : 0UL) /* May */ + (month >= 5 ? 30UL : 0UL) /* June */ + \
|
||||
(month >= 6 ? 31UL : 0UL) /* July */ + (month >= 7 ? 30UL : 0UL) /* August */ + \
|
||||
(month >= 8 ? 31UL : 0UL) /* September */ + (month >= 9 ? 31UL : 0UL) /* October */ + \
|
||||
(month >= 10 ? 30UL : 0UL) /* November */ + (month >= 11 ? 31UL : 0UL) /* December */ + \
|
||||
(month >= 12 ? 30UL : 0UL))
|
||||
#define _UNIX_TIMESTAMP_YDAY(year, month, day) \
|
||||
(/* January */ day /* February */ + (month >= 2 ? 31UL : 0UL) /* March */ + \
|
||||
(month >= 3 ? _UNIX_TIMESTAMP_FDAY(year) : 0UL) /* April */ + \
|
||||
(month >= 4 ? 31UL : 0UL) /* May */ + \
|
||||
(month >= 5 ? 30UL : 0UL) /* June */ + \
|
||||
(month >= 6 ? 31UL : 0UL) /* July */ + \
|
||||
(month >= 7 ? 30UL : 0UL) /* August */ + \
|
||||
(month >= 8 ? 31UL : 0UL) /* September */ + \
|
||||
(month >= 9 ? 31UL : 0UL) /* October */ + \
|
||||
(month >= 10 ? 30UL : 0UL) /* November */ + \
|
||||
(month >= 11 ? 31UL : 0UL) /* December */ + (month >= 12 ? 30UL : 0UL))
|
||||
|
||||
// get the UNIX timestamp from a digits representation
|
||||
#define _UNIX_TIMESTAMP(year, month, day, hour, minute, second) \
|
||||
(/* time */ second + minute * SEC_PER_MIN + hour * SEC_PER_HOUR + \
|
||||
/* year day (month + day) */ (_UNIX_TIMESTAMP_YDAY(year, month, day) - 1) * SEC_PER_DAY + \
|
||||
/* year */ (year - 1970UL) * SEC_PER_YEAR + ((year - 1969UL) / 4UL) * SEC_PER_DAY - \
|
||||
((year - 1901UL) / 100UL) * SEC_PER_DAY + ((year - 1601UL) / 400UL) * SEC_PER_DAY)
|
||||
#define _UNIX_TIMESTAMP(year, month, day, hour, minute, second) \
|
||||
(/* time */ second + minute * SEC_PER_MIN + hour * SEC_PER_HOUR + \
|
||||
/* year day (month + day) */ (_UNIX_TIMESTAMP_YDAY(year, month, day) - 1) * \
|
||||
SEC_PER_DAY + \
|
||||
/* year */ (year - 1970UL) * SEC_PER_YEAR + \
|
||||
((year - 1969UL) / 4UL) * SEC_PER_DAY - \
|
||||
((year - 1901UL) / 100UL) * SEC_PER_DAY + \
|
||||
((year - 1601UL) / 400UL) * SEC_PER_DAY)
|
||||
|
||||
// the UNIX timestamp
|
||||
#define UNIX_TIMESTAMP \
|
||||
(_UNIX_TIMESTAMP(__TIME_YEARS__, __TIME_MONTH__, __TIME_DAYS__, __TIME_HOURS__, \
|
||||
__TIME_MINUTES__, __TIME_SECONDS__))
|
||||
#define UNIX_TIMESTAMP \
|
||||
(_UNIX_TIMESTAMP(__TIME_YEARS__, __TIME_MONTH__, __TIME_DAYS__, \
|
||||
__TIME_HOURS__, __TIME_MINUTES__, __TIME_SECONDS__))
|
||||
|
||||
#endif
|
||||
|
@ -4,13 +4,29 @@
|
||||
|
||||
#include "fsfw/serviceinterface.h"
|
||||
|
||||
void utility::commonInitPrint(const char* const os, const char* const board) {
|
||||
void utility::commonInitPrint(const char *const os, const char *const board) {
|
||||
if (os == nullptr or board == nullptr) {
|
||||
return;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
fmt::print("-- FSFW Example ({}) v{}.{}.{} --\n", os, FSFW_EXAMPLE_VERSION,
|
||||
FSFW_EXAMPLE_SUBVERSION, FSFW_EXAMPLE_REVISION);
|
||||
fmt::print("-- Compiled for {}\n", board);
|
||||
fmt::print("-- Compiled on {} {}\n", __DATE__, __TIME__);
|
||||
sif::initialize();
|
||||
=======
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
std::cout << "-- FSFW Example (" << os << ") v" << FSFW_EXAMPLE_VERSION << "."
|
||||
<< FSFW_EXAMPLE_SUBVERSION << "." << FSFW_EXAMPLE_REVISION << " --"
|
||||
<< std::endl;
|
||||
std::cout << "-- Compiled for " << board << " --" << std::endl;
|
||||
std::cout << "-- Compiled on " << __DATE__ << " " << __TIME__ << " --"
|
||||
<< std::endl;
|
||||
#else
|
||||
printf("\n\r-- FSFW Example (%s) v%d.%d.%d --\n", os, FSFW_EXAMPLE_VERSION,
|
||||
FSFW_EXAMPLE_SUBVERSION, FSFW_EXAMPLE_REVISION);
|
||||
printf("-- Compiled for %s --\n", board);
|
||||
printf("-- Compiled on %s %s --\n", __DATE__, __TIME__);
|
||||
#endif
|
||||
>>>>>>> origin/master
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
namespace utility {
|
||||
|
||||
void commonInitPrint(const char* const os, const char* const board);
|
||||
void commonInitPrint(const char *const os, const char *const board);
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user