Merge remote-tracking branch 'origin/master' into mueller/fmt-log
This commit is contained in:
@ -1,3 +1 @@
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
FsfwTestController.cpp
|
||||
)
|
||||
target_sources(${TARGET_NAME} PRIVATE FsfwTestController.cpp)
|
||||
|
@ -2,22 +2,21 @@
|
||||
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
|
||||
FsfwTestController::FsfwTestController(object_id_t objectId, object_id_t device0,
|
||||
object_id_t device1, uint8_t verboseLevel)
|
||||
: TestController(objectId, objects::NO_OBJECT, 5),
|
||||
device0Id(device0),
|
||||
device1Id(device1),
|
||||
deviceDataset0(device0),
|
||||
deviceDataset1(device1) {}
|
||||
FsfwTestController::FsfwTestController(object_id_t objectId,
|
||||
object_id_t device0, object_id_t device1,
|
||||
uint8_t verboseLevel)
|
||||
: TestController(objectId, objects::NO_OBJECT, 5), device0Id(device0),
|
||||
device1Id(device1), deviceDataset0(device0), deviceDataset1(device1) {}
|
||||
|
||||
FsfwTestController::~FsfwTestController() {}
|
||||
|
||||
ReturnValue_t FsfwTestController::handleCommandMessage(CommandMessage* message) {
|
||||
ReturnValue_t
|
||||
FsfwTestController::handleCommandMessage(CommandMessage *message) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t FsfwTestController::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) {
|
||||
ReturnValue_t FsfwTestController::initializeLocalDataPool(
|
||||
localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
@ -64,13 +63,14 @@ ReturnValue_t FsfwTestController::initializeAfterTaskCreation() {
|
||||
FSFW_LOGW("initializeAfterTaskCreation: Test device handler 0 handle invalid\n");
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
ProvidesDataPoolSubscriptionIF* subscriptionIF = device0->getSubscriptionInterface();
|
||||
ProvidesDataPoolSubscriptionIF *subscriptionIF =
|
||||
device0->getSubscriptionInterface();
|
||||
if (subscriptionIF != nullptr) {
|
||||
/* For DEVICE_0, we only subscribe for notifications */
|
||||
subscriptionIF->subscribeForSetUpdateMessage(td::TEST_SET_ID, getObjectId(), getCommandQueue(),
|
||||
false);
|
||||
subscriptionIF->subscribeForVariableUpdateMessage(td::PoolIds::TEST_UINT8_ID, getObjectId(),
|
||||
getCommandQueue(), false);
|
||||
subscriptionIF->subscribeForSetUpdateMessage(td::TEST_SET_ID, getObjectId(),
|
||||
getCommandQueue(), false);
|
||||
subscriptionIF->subscribeForVariableUpdateMessage(
|
||||
td::PoolIds::TEST_UINT8_ID, getObjectId(), getCommandQueue(), false);
|
||||
}
|
||||
|
||||
auto* device1 =
|
||||
@ -82,27 +82,31 @@ ReturnValue_t FsfwTestController::initializeAfterTaskCreation() {
|
||||
subscriptionIF = device1->getSubscriptionInterface();
|
||||
if (subscriptionIF != nullptr) {
|
||||
/* For DEVICE_1, we will subscribe for snapshots */
|
||||
subscriptionIF->subscribeForSetUpdateMessage(td::TEST_SET_ID, getObjectId(), getCommandQueue(),
|
||||
true);
|
||||
subscriptionIF->subscribeForVariableUpdateMessage(td::PoolIds::TEST_UINT8_ID, getObjectId(),
|
||||
getCommandQueue(), true);
|
||||
subscriptionIF->subscribeForSetUpdateMessage(td::TEST_SET_ID, getObjectId(),
|
||||
getCommandQueue(), true);
|
||||
subscriptionIF->subscribeForVariableUpdateMessage(
|
||||
td::PoolIds::TEST_UINT8_ID, getObjectId(), getCommandQueue(), true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
LocalPoolDataSetBase* FsfwTestController::getDataSetHandle(sid_t sid) { return nullptr; }
|
||||
LocalPoolDataSetBase *FsfwTestController::getDataSetHandle(sid_t sid) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ReturnValue_t FsfwTestController::checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
uint32_t* msToReachTheMode) {
|
||||
ReturnValue_t FsfwTestController::checkModeCommand(Mode_t mode,
|
||||
Submode_t submode,
|
||||
uint32_t *msToReachTheMode) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void FsfwTestController::handleChangedDataset(sid_t sid, store_address_t storeId,
|
||||
bool* clearMessage) {
|
||||
void FsfwTestController::handleChangedDataset(sid_t sid,
|
||||
store_address_t storeId,
|
||||
bool *clearMessage) {
|
||||
using namespace std;
|
||||
|
||||
if (verboseLevel >= 1) {
|
||||
char const* printout = nullptr;
|
||||
char const *printout = nullptr;
|
||||
if (storeId == storeId::INVALID_STORE_ADDRESS) {
|
||||
printout = "Notification";
|
||||
} else {
|
||||
@ -132,12 +136,13 @@ void FsfwTestController::handleChangedDataset(sid_t sid, store_address_t storeId
|
||||
}
|
||||
}
|
||||
|
||||
void FsfwTestController::handleChangedPoolVariable(gp_id_t globPoolId, store_address_t storeId,
|
||||
bool* clearMessage) {
|
||||
void FsfwTestController::handleChangedPoolVariable(gp_id_t globPoolId,
|
||||
store_address_t storeId,
|
||||
bool *clearMessage) {
|
||||
using namespace std;
|
||||
|
||||
if (verboseLevel >= 1) {
|
||||
char const* printout = nullptr;
|
||||
char const *printout = nullptr;
|
||||
if (storeId == storeId::INVALID_STORE_ADDRESS) {
|
||||
printout = "Notification";
|
||||
} else {
|
||||
|
@ -5,18 +5,18 @@
|
||||
#include "fsfw_tests/integration/controller/TestController.h"
|
||||
|
||||
class FsfwTestController : public TestController {
|
||||
public:
|
||||
FsfwTestController(object_id_t objectId, object_id_t device0, object_id_t device1,
|
||||
uint8_t verboseLevel = 0);
|
||||
public:
|
||||
FsfwTestController(object_id_t objectId, object_id_t device0,
|
||||
object_id_t device1, uint8_t verboseLevel = 0);
|
||||
virtual ~FsfwTestController();
|
||||
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
||||
ReturnValue_t handleCommandMessage(CommandMessage *message) override;
|
||||
|
||||
/**
|
||||
* Periodic helper from ControllerBase, implemented by child class.
|
||||
*/
|
||||
void performControlOperation() override;
|
||||
|
||||
private:
|
||||
private:
|
||||
object_id_t device0Id;
|
||||
object_id_t device1Id;
|
||||
testdevice::TestDataSet deviceDataset0;
|
||||
@ -31,14 +31,16 @@ class FsfwTestController : public TestController {
|
||||
TraceTypes currentTraceType = TraceTypes::NONE;
|
||||
|
||||
ReturnValue_t initializeAfterTaskCreation() override;
|
||||
void handleChangedDataset(sid_t sid, store_address_t storeId, bool* clearMessage) override;
|
||||
void handleChangedDataset(sid_t sid, store_address_t storeId,
|
||||
bool *clearMessage) override;
|
||||
void handleChangedPoolVariable(gp_id_t globPoolId, store_address_t storeId,
|
||||
bool* clearMessage) override;
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||
bool *clearMessage) override;
|
||||
ReturnValue_t
|
||||
initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||
LocalDataPoolManager &poolManager) override;
|
||||
LocalPoolDataSetBase *getDataSetHandle(sid_t sid) override;
|
||||
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
uint32_t* msToReachTheMode) override;
|
||||
uint32_t *msToReachTheMode) override;
|
||||
};
|
||||
|
||||
#endif /* EXAMPLE_COMMON_EXAMPLE_CONTROLLER_FSFWTESTCONTROLLER_H_ */
|
||||
|
@ -1,3 +1 @@
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
GenericFactory.cpp
|
||||
)
|
||||
target_sources(${TARGET_NAME} PRIVATE GenericFactory.cpp)
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "GenericFactory.h"
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "common/definitions.h"
|
||||
#include "example/test/FsfwExampleTask.h"
|
||||
#include "example/test/FsfwReaderTask.h"
|
||||
#include "example/utility/TmFunnel.h"
|
||||
@ -10,6 +11,7 @@
|
||||
#include "fsfw/health/HealthTable.h"
|
||||
#include "fsfw/internalerror/InternalErrorReporter.h"
|
||||
#include "fsfw/pus/CService200ModeCommanding.h"
|
||||
#include "fsfw/pus/Service11TelecommandScheduling.h"
|
||||
#include "fsfw/pus/Service17Test.h"
|
||||
#include "fsfw/pus/Service1TelecommandVerification.h"
|
||||
#include "fsfw/pus/Service20ParameterManagement.h"
|
||||
@ -30,7 +32,6 @@
|
||||
#include "fsfw_tests/internal/InternalUnitTester.h"
|
||||
#include "objects/systemObjectList.h"
|
||||
#include "tmtc/apid.h"
|
||||
#include "tmtc/pusIds.h"
|
||||
|
||||
void ObjectFactory::produceGenericObjects() {
|
||||
#if OBSW_ADD_CORE_COMPONENTS == 1
|
||||
@ -39,26 +40,37 @@ void ObjectFactory::produceGenericObjects() {
|
||||
new HealthTable(objects::HEALTH_TABLE);
|
||||
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
|
||||
new TimeStamper(objects::TIME_STAMPER);
|
||||
new CCSDSDistributor(apid::APID, objects::CCSDS_DISTRIBUTOR);
|
||||
new PUSDistributor(apid::APID, objects::PUS_DISTRIBUTOR, objects::CCSDS_DISTRIBUTOR);
|
||||
auto *ccsdsDistrib =
|
||||
new CCSDSDistributor(apid::APID, objects::CCSDS_DISTRIBUTOR);
|
||||
new PUSDistributor(apid::APID, objects::PUS_DISTRIBUTOR,
|
||||
objects::CCSDS_DISTRIBUTOR);
|
||||
new TmFunnel(objects::TM_FUNNEL);
|
||||
#endif /* OBSW_ADD_CORE_COMPONENTS == 1 */
|
||||
|
||||
/* PUS stack */
|
||||
#if OBSW_ADD_PUS_STACK == 1
|
||||
new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, apid::APID,
|
||||
pus::PUS_SERVICE_1, objects::TM_FUNNEL, 5);
|
||||
new Service2DeviceAccess(objects::PUS_SERVICE_2_DEVICE_ACCESS, apid::APID, pus::PUS_SERVICE_2, 3,
|
||||
10);
|
||||
new Service3Housekeeping(objects::PUS_SERVICE_3_HOUSEKEEPING, apid::APID, pus::PUS_SERVICE_3);
|
||||
new Service5EventReporting(objects::PUS_SERVICE_5_EVENT_REPORTING, apid::APID, pus::PUS_SERVICE_5,
|
||||
50);
|
||||
new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT, apid::APID,
|
||||
pus::PUS_SERVICE_8, 3, 10);
|
||||
new Service9TimeManagement(objects::PUS_SERVICE_9_TIME_MGMT, apid::APID, pus::PUS_SERVICE_9);
|
||||
new Service17Test(objects::PUS_SERVICE_17_TEST, apid::APID, pus::PUS_SERVICE_17);
|
||||
new Service20ParameterManagement(objects::PUS_SERVICE_20_PARAMETERS, apid::APID,
|
||||
pus::PUS_SERVICE_20);
|
||||
new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION,
|
||||
apid::APID, pus::PUS_SERVICE_1,
|
||||
objects::TM_FUNNEL, 5);
|
||||
new Service2DeviceAccess(objects::PUS_SERVICE_2_DEVICE_ACCESS, apid::APID,
|
||||
pus::PUS_SERVICE_2, 3, 10);
|
||||
new Service3Housekeeping(objects::PUS_SERVICE_3_HOUSEKEEPING, apid::APID,
|
||||
pus::PUS_SERVICE_3);
|
||||
new Service5EventReporting(objects::PUS_SERVICE_5_EVENT_REPORTING, apid::APID,
|
||||
pus::PUS_SERVICE_5, 50);
|
||||
new Service8FunctionManagement(objects::PUS_SERVICE_8_FUNCTION_MGMT,
|
||||
apid::APID, pus::PUS_SERVICE_8, 3, 10);
|
||||
new Service9TimeManagement(objects::PUS_SERVICE_9_TIME_MGMT, apid::APID,
|
||||
pus::PUS_SERVICE_9);
|
||||
new Service17Test(objects::PUS_SERVICE_17_TEST, apid::APID,
|
||||
pus::PUS_SERVICE_17);
|
||||
new Service20ParameterManagement(objects::PUS_SERVICE_20_PARAMETERS,
|
||||
apid::APID, pus::PUS_SERVICE_20);
|
||||
#if OBSW_ADD_CORE_COMPONENTS == 1
|
||||
new Service11TelecommandScheduling<cfg::OBSW_MAX_SCHEDULED_TCS>(
|
||||
objects::PUS_SERVICE_11_TC_SCHEDULER, apid::APID, pus::PUS_SERVICE_11,
|
||||
ccsdsDistrib);
|
||||
#endif
|
||||
new CService200ModeCommanding(objects::PUS_SERVICE_200_MODE_MGMT, apid::APID,
|
||||
pus::PUS_SERVICE_200);
|
||||
#endif /* OBSW_ADD_PUS_STACK == 1 */
|
||||
@ -86,17 +98,22 @@ void ObjectFactory::produceGenericObjects() {
|
||||
|
||||
/* Demo device handler object */
|
||||
size_t expectedMaxReplyLen = 64;
|
||||
CookieIF* testCookie = new TestCookie(static_cast<address_t>(testdevice::DeviceIndex::DEVICE_0),
|
||||
expectedMaxReplyLen);
|
||||
CookieIF *testCookie =
|
||||
new TestCookie(static_cast<address_t>(testdevice::DeviceIndex::DEVICE_0),
|
||||
expectedMaxReplyLen);
|
||||
new TestEchoComIF(objects::TEST_ECHO_COM_IF);
|
||||
new TestDevice(objects::TEST_DEVICE_HANDLER_0, objects::TEST_ECHO_COM_IF, testCookie,
|
||||
testdevice::DeviceIndex::DEVICE_0, enableInfoPrintout);
|
||||
testCookie = new TestCookie(static_cast<address_t>(testdevice::DeviceIndex::DEVICE_1),
|
||||
expectedMaxReplyLen);
|
||||
new TestDevice(objects::TEST_DEVICE_HANDLER_1, objects::TEST_ECHO_COM_IF, testCookie,
|
||||
testdevice::DeviceIndex::DEVICE_1, enableInfoPrintout);
|
||||
new TestDevice(objects::TEST_DEVICE_HANDLER_0, objects::TEST_ECHO_COM_IF,
|
||||
testCookie, testdevice::DeviceIndex::DEVICE_0,
|
||||
enableInfoPrintout);
|
||||
testCookie =
|
||||
new TestCookie(static_cast<address_t>(testdevice::DeviceIndex::DEVICE_1),
|
||||
expectedMaxReplyLen);
|
||||
new TestDevice(objects::TEST_DEVICE_HANDLER_1, objects::TEST_ECHO_COM_IF,
|
||||
testCookie, testdevice::DeviceIndex::DEVICE_1,
|
||||
enableInfoPrintout);
|
||||
|
||||
new TestAssembly(objects::TEST_ASSEMBLY, objects::NO_OBJECT, objects::TEST_DEVICE_HANDLER_0,
|
||||
new TestAssembly(objects::TEST_ASSEMBLY, objects::NO_OBJECT,
|
||||
objects::TEST_DEVICE_HANDLER_0,
|
||||
objects::TEST_DEVICE_HANDLER_1);
|
||||
|
||||
#endif /* OBSW_ADD_DEVICE_HANDLER_DEMO == 1 */
|
||||
|
@ -11,6 +11,6 @@ namespace ObjectFactory {
|
||||
*/
|
||||
void produceGenericObjects();
|
||||
|
||||
} // namespace ObjectFactory
|
||||
} // namespace ObjectFactory
|
||||
|
||||
#endif /* MISSION_CORE_GENERICFACTORY_H_ */
|
||||
|
@ -0,0 +1 @@
|
||||
|
||||
|
@ -1,9 +1,5 @@
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
FsfwReaderTask.cpp
|
||||
FsfwExampleTask.cpp
|
||||
MutexExample.cpp
|
||||
FsfwTestTask.cpp
|
||||
)
|
||||
target_sources(${TARGET_NAME} PRIVATE FsfwReaderTask.cpp FsfwExampleTask.cpp
|
||||
MutexExample.cpp FsfwTestTask.cpp)
|
||||
|
||||
if(OBSW_ADD_FMT_TESTS)
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
|
@ -7,15 +7,15 @@
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "commonSystemObjects.h"
|
||||
#include "commonObjects.h"
|
||||
#include "objects/systemObjectList.h"
|
||||
|
||||
FsfwExampleTask::FsfwExampleTask(object_id_t objectId)
|
||||
: SystemObject(objectId),
|
||||
poolManager(this, nullptr),
|
||||
demoSet(this),
|
||||
monitor(objectId, MONITOR_ID, gp_id_t(objectId, FsfwDemoSet::VARIABLE_LIMIT), 30, 10) {
|
||||
commandQueue = QueueFactory::instance()->createMessageQueue(10, CommandMessage::MAX_MESSAGE_SIZE);
|
||||
: SystemObject(objectId), poolManager(this, nullptr), demoSet(this),
|
||||
monitor(objectId, MONITOR_ID,
|
||||
gp_id_t(objectId, FsfwDemoSet::VARIABLE_LIMIT), 30, 10) {
|
||||
commandQueue = QueueFactory::instance()->createMessageQueue(
|
||||
10, CommandMessage::MAX_MESSAGE_SIZE);
|
||||
}
|
||||
|
||||
FsfwExampleTask::~FsfwExampleTask() {}
|
||||
@ -47,33 +47,33 @@ ReturnValue_t FsfwExampleTask::performOperation(uint8_t operationCode) {
|
||||
|
||||
object_id_t FsfwExampleTask::getNextRecipient() {
|
||||
switch (this->getObjectId()) {
|
||||
case (objects::TEST_DUMMY_1): {
|
||||
return objects::TEST_DUMMY_2;
|
||||
}
|
||||
case (objects::TEST_DUMMY_2): {
|
||||
return objects::TEST_DUMMY_3;
|
||||
}
|
||||
case (objects::TEST_DUMMY_3): {
|
||||
return objects::TEST_DUMMY_1;
|
||||
}
|
||||
default:
|
||||
return objects::TEST_DUMMY_1;
|
||||
case (objects::TEST_DUMMY_1): {
|
||||
return objects::TEST_DUMMY_2;
|
||||
}
|
||||
case (objects::TEST_DUMMY_2): {
|
||||
return objects::TEST_DUMMY_3;
|
||||
}
|
||||
case (objects::TEST_DUMMY_3): {
|
||||
return objects::TEST_DUMMY_1;
|
||||
}
|
||||
default:
|
||||
return objects::TEST_DUMMY_1;
|
||||
}
|
||||
}
|
||||
|
||||
object_id_t FsfwExampleTask::getSender() {
|
||||
switch (this->getObjectId()) {
|
||||
case (objects::TEST_DUMMY_1): {
|
||||
return objects::TEST_DUMMY_3;
|
||||
}
|
||||
case (objects::TEST_DUMMY_2): {
|
||||
return objects::TEST_DUMMY_1;
|
||||
}
|
||||
case (objects::TEST_DUMMY_3): {
|
||||
return objects::TEST_DUMMY_2;
|
||||
}
|
||||
default:
|
||||
return objects::TEST_DUMMY_1;
|
||||
case (objects::TEST_DUMMY_1): {
|
||||
return objects::TEST_DUMMY_3;
|
||||
}
|
||||
case (objects::TEST_DUMMY_2): {
|
||||
return objects::TEST_DUMMY_1;
|
||||
}
|
||||
case (objects::TEST_DUMMY_3): {
|
||||
return objects::TEST_DUMMY_2;
|
||||
}
|
||||
default:
|
||||
return objects::TEST_DUMMY_1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,7 +86,8 @@ ReturnValue_t FsfwExampleTask::initialize() {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
// we need a private copy of the previous dataset.. or we use the shared dataset.
|
||||
// we need a private copy of the previous dataset.. or we use the shared
|
||||
// dataset.
|
||||
senderSet = new FsfwDemoSet(senderIF);
|
||||
if (senderSet == nullptr) {
|
||||
FSFW_LOGE("initialize: Sender dataset invalid\n");
|
||||
@ -99,25 +100,37 @@ ReturnValue_t FsfwExampleTask::initializeAfterTaskCreation() {
|
||||
return poolManager.initializeAfterTaskCreation();
|
||||
}
|
||||
|
||||
object_id_t FsfwExampleTask::getObjectId() const { return SystemObject::getObjectId(); }
|
||||
object_id_t FsfwExampleTask::getObjectId() const {
|
||||
return SystemObject::getObjectId();
|
||||
}
|
||||
|
||||
MessageQueueId_t FsfwExampleTask::getMessageQueueId() { return commandQueue->getId(); }
|
||||
MessageQueueId_t FsfwExampleTask::getMessageQueueId() {
|
||||
return commandQueue->getId();
|
||||
}
|
||||
|
||||
void FsfwExampleTask::setTaskIF(PeriodicTaskIF* task) { this->task = task; }
|
||||
void FsfwExampleTask::setTaskIF(PeriodicTaskIF *task) { this->task = task; }
|
||||
|
||||
LocalPoolDataSetBase* FsfwExampleTask::getDataSetHandle(sid_t sid) { return &demoSet; }
|
||||
LocalPoolDataSetBase *FsfwExampleTask::getDataSetHandle(sid_t sid) {
|
||||
return &demoSet;
|
||||
}
|
||||
|
||||
uint32_t FsfwExampleTask::getPeriodicOperationFrequency() const { return task->getPeriodMs(); }
|
||||
uint32_t FsfwExampleTask::getPeriodicOperationFrequency() const {
|
||||
return task->getPeriodMs();
|
||||
}
|
||||
|
||||
ReturnValue_t FsfwExampleTask::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) {
|
||||
localDataPoolMap.emplace(FsfwDemoSet::PoolIds::VARIABLE, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(FsfwDemoSet::PoolIds::VARIABLE_LIMIT, new PoolEntry<uint16_t>({0}));
|
||||
ReturnValue_t
|
||||
FsfwExampleTask::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||
LocalDataPoolManager &poolManager) {
|
||||
localDataPoolMap.emplace(FsfwDemoSet::PoolIds::VARIABLE,
|
||||
new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(FsfwDemoSet::PoolIds::VARIABLE_LIMIT,
|
||||
new PoolEntry<uint16_t>({0}));
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t FsfwExampleTask::performMonitoringDemo() {
|
||||
ReturnValue_t result = demoSet.variableLimit.read(MutexIF::TimeoutType::WAITING, 20);
|
||||
ReturnValue_t result =
|
||||
demoSet.variableLimit.read(MutexIF::TimeoutType::WAITING, 20);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
/* Configuration error */
|
||||
FSFW_LOGE("DummyObject::performOperation: Could not read variableLimit\n");
|
||||
@ -180,8 +193,9 @@ ReturnValue_t FsfwExampleTask::performReceiveOperation() {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
#if OBSW_VERBOSE_LEVEL >= 2
|
||||
sif::debug << "Message Received by " << getObjectId() << " from Queue "
|
||||
<< receivedMessage.getSender() << " ObjectId " << receivedMessage.getParameter()
|
||||
<< " Queue " << receivedMessage.getParameter2() << std::endl;
|
||||
<< receivedMessage.getSender() << " ObjectId "
|
||||
<< receivedMessage.getParameter() << " Queue "
|
||||
<< receivedMessage.getParameter2() << std::endl;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -204,6 +218,10 @@ ReturnValue_t FsfwExampleTask::performReceiveOperation() {
|
||||
return result;
|
||||
}
|
||||
|
||||
MessageQueueId_t FsfwExampleTask::getCommandQueue() const { return commandQueue->getId(); }
|
||||
MessageQueueId_t FsfwExampleTask::getCommandQueue() const {
|
||||
return commandQueue->getId();
|
||||
}
|
||||
|
||||
LocalDataPoolManager* FsfwExampleTask::getHkManagerHandle() { return &poolManager; }
|
||||
LocalDataPoolManager *FsfwExampleTask::getHkManagerHandle() {
|
||||
return &poolManager;
|
||||
}
|
||||
|
@ -24,8 +24,10 @@ class PeriodicTaskIF;
|
||||
* value directly from the sender via the local data pool interface.
|
||||
* If the timing is set up correctly, the values will always be the same.
|
||||
*/
|
||||
class FsfwExampleTask : public ExecutableObjectIF, public SystemObject, public HasLocalDataPoolIF {
|
||||
public:
|
||||
class FsfwExampleTask : public ExecutableObjectIF,
|
||||
public SystemObject,
|
||||
public HasLocalDataPoolIF {
|
||||
public:
|
||||
enum OpCodes { SEND_RAND_NUM, RECEIVE_RAND_NUM, DELAY_SHORT };
|
||||
|
||||
static constexpr uint8_t MONITOR_ID = 2;
|
||||
@ -72,27 +74,28 @@ class FsfwExampleTask : public ExecutableObjectIF, public SystemObject, public H
|
||||
* task interface handle can be cached to access task specific properties.
|
||||
* @param task
|
||||
*/
|
||||
void setTaskIF(PeriodicTaskIF* task) override;
|
||||
void setTaskIF(PeriodicTaskIF *task) override;
|
||||
|
||||
object_id_t getObjectId() const override;
|
||||
|
||||
MessageQueueId_t getMessageQueueId();
|
||||
|
||||
private:
|
||||
private:
|
||||
LocalDataPoolManager poolManager;
|
||||
FsfwDemoSet* senderSet = nullptr;
|
||||
FsfwDemoSet *senderSet = nullptr;
|
||||
FsfwDemoSet demoSet;
|
||||
AbsLimitMonitor<int32_t> monitor;
|
||||
PeriodicTaskIF* task = nullptr;
|
||||
MessageQueueIF* commandQueue = nullptr;
|
||||
PeriodicTaskIF *task = nullptr;
|
||||
MessageQueueIF *commandQueue = nullptr;
|
||||
|
||||
/* HasLocalDatapoolIF overrides */
|
||||
MessageQueueId_t getCommandQueue() const override;
|
||||
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||
LocalPoolDataSetBase *getDataSetHandle(sid_t sid) override;
|
||||
uint32_t getPeriodicOperationFrequency() const override;
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
LocalDataPoolManager* getHkManagerHandle() override;
|
||||
ReturnValue_t
|
||||
initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||
LocalDataPoolManager &poolManager) override;
|
||||
LocalDataPoolManager *getHkManagerHandle() override;
|
||||
|
||||
object_id_t getNextRecipient();
|
||||
object_id_t getSender();
|
||||
|
@ -7,13 +7,13 @@
|
||||
#include <fsfw/timemanager/Stopwatch.h>
|
||||
|
||||
FsfwReaderTask::FsfwReaderTask(object_id_t objectId, bool enablePrintout)
|
||||
: SystemObject(objectId),
|
||||
printoutEnabled(enablePrintout),
|
||||
opDivider(10),
|
||||
readSet(this->getObjectId(), gp_id_t(objects::TEST_DUMMY_1, FsfwDemoSet::PoolIds::VARIABLE),
|
||||
: SystemObject(objectId), printoutEnabled(enablePrintout), opDivider(10),
|
||||
readSet(this->getObjectId(),
|
||||
gp_id_t(objects::TEST_DUMMY_1, FsfwDemoSet::PoolIds::VARIABLE),
|
||||
gp_id_t(objects::TEST_DUMMY_2, FsfwDemoSet::PoolIds::VARIABLE),
|
||||
gp_id_t(objects::TEST_DUMMY_3, FsfwDemoSet::PoolIds::VARIABLE)) {
|
||||
/* Special protection for set reading because each variable is read from a different pool */
|
||||
/* Special protection for set reading because each variable is read from a
|
||||
* different pool */
|
||||
readSet.setReadCommitProtectionBehaviour(true);
|
||||
}
|
||||
|
||||
|
@ -8,14 +8,14 @@
|
||||
#include "testdefinitions/demoDefinitions.h"
|
||||
|
||||
class FsfwReaderTask : public ExecutableObjectIF, public SystemObject {
|
||||
public:
|
||||
public:
|
||||
FsfwReaderTask(object_id_t objectId, bool enablePrintout);
|
||||
~FsfwReaderTask() override;
|
||||
|
||||
ReturnValue_t initializeAfterTaskCreation() override;
|
||||
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
bool printoutEnabled = false;
|
||||
PeriodicOperationDivider opDivider;
|
||||
CompleteDemoReadSet readSet;
|
||||
|
@ -6,15 +6,16 @@
|
||||
#include "fsfw_tests/integration/task/TestTask.h"
|
||||
|
||||
class FsfwTestTask : public TestTask {
|
||||
public:
|
||||
public:
|
||||
FsfwTestTask(object_id_t objectId, bool periodicEvent);
|
||||
|
||||
ReturnValue_t performPeriodicAction() override;
|
||||
|
||||
private:
|
||||
private:
|
||||
bool periodicEvent = false;
|
||||
static constexpr uint8_t subsystemId = SUBSYSTEM_ID::TEST_TASK_ID;
|
||||
static constexpr Event TEST_EVENT = event::makeEvent(subsystemId, 0, severity::INFO);
|
||||
static constexpr Event TEST_EVENT =
|
||||
event::makeEvent(subsystemId, 0, severity::INFO);
|
||||
};
|
||||
|
||||
#endif /* EXAMPLE_COMMON_EXAMPLE_TEST_FSFWTESTTASK_H_ */
|
||||
|
@ -4,10 +4,11 @@
|
||||
#include <fsfw/serviceinterface.h>
|
||||
|
||||
void MutexExample::example() {
|
||||
MutexIF* mutex = MutexFactory::instance()->createMutex();
|
||||
MutexIF* mutex2 = MutexFactory::instance()->createMutex();
|
||||
MutexIF *mutex = MutexFactory::instance()->createMutex();
|
||||
MutexIF *mutex2 = MutexFactory::instance()->createMutex();
|
||||
|
||||
ReturnValue_t result = mutex->lockMutex(MutexIF::TimeoutType::WAITING, 2 * 60 * 1000);
|
||||
ReturnValue_t result =
|
||||
mutex->lockMutex(MutexIF::TimeoutType::WAITING, 2 * 60 * 1000);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
FSFW_LOGET("MutexExample::example: Lock Failed with {}\n", result);
|
||||
}
|
||||
|
@ -12,21 +12,22 @@
|
||||
* pool variables (for read and write access respectively).
|
||||
*/
|
||||
class FsfwDemoSet : public StaticLocalDataSet<3> {
|
||||
public:
|
||||
public:
|
||||
static constexpr uint32_t DEMO_SET_ID = 0;
|
||||
|
||||
enum PoolIds { VARIABLE, VARIABLE_LIMIT };
|
||||
|
||||
FsfwDemoSet(HasLocalDataPoolIF* hkOwner) : StaticLocalDataSet(hkOwner, DEMO_SET_ID) {}
|
||||
FsfwDemoSet(HasLocalDataPoolIF *hkOwner)
|
||||
: StaticLocalDataSet(hkOwner, DEMO_SET_ID) {}
|
||||
|
||||
lp_var_t<uint32_t> variableRead =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::VARIABLE, this, pool_rwm_t::VAR_READ);
|
||||
lp_var_t<uint32_t> variableWrite =
|
||||
lp_var_t<uint32_t>(sid.objectId, PoolIds::VARIABLE, this, pool_rwm_t::VAR_WRITE);
|
||||
lp_var_t<uint32_t> variableRead = lp_var_t<uint32_t>(
|
||||
sid.objectId, PoolIds::VARIABLE, this, pool_rwm_t::VAR_READ);
|
||||
lp_var_t<uint32_t> variableWrite = lp_var_t<uint32_t>(
|
||||
sid.objectId, PoolIds::VARIABLE, this, pool_rwm_t::VAR_WRITE);
|
||||
lp_var_t<uint16_t> variableLimit =
|
||||
lp_var_t<uint16_t>(sid.objectId, PoolIds::VARIABLE_LIMIT, this);
|
||||
|
||||
private:
|
||||
private:
|
||||
};
|
||||
|
||||
/**
|
||||
@ -35,10 +36,11 @@ class FsfwDemoSet : public StaticLocalDataSet<3> {
|
||||
* which reads multiple sensor values at once.
|
||||
*/
|
||||
class CompleteDemoReadSet : public StaticLocalDataSet<3> {
|
||||
public:
|
||||
public:
|
||||
static constexpr uint32_t DEMO_SET_ID = 0;
|
||||
|
||||
CompleteDemoReadSet(object_id_t owner, gp_id_t variable1, gp_id_t variable2, gp_id_t variable3)
|
||||
CompleteDemoReadSet(object_id_t owner, gp_id_t variable1, gp_id_t variable2,
|
||||
gp_id_t variable3)
|
||||
: StaticLocalDataSet(sid_t(owner, DEMO_SET_ID)),
|
||||
variable1(variable1, this, pool_rwm_t::VAR_READ),
|
||||
variable2(variable2, this, pool_rwm_t::VAR_READ),
|
||||
@ -48,7 +50,7 @@ class CompleteDemoReadSet : public StaticLocalDataSet<3> {
|
||||
lp_var_t<uint32_t> variable2;
|
||||
lp_var_t<uint32_t> variable3;
|
||||
|
||||
private:
|
||||
private:
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEMO_DEMODEFINITIONS_H_ */
|
||||
|
@ -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