add printf support

This commit is contained in:
Robin Müller 2023-05-26 17:03:27 +02:00
parent f42a16748d
commit cb6eed134b
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 11 additions and 3 deletions

View File

@ -109,13 +109,15 @@ void ObjectManager::initialize() {
for (auto const& it : objectList) {
result = it.second->initialize();
if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
object_id_t var = it.first;
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "ObjectManager::initialize: Object 0x" << std::hex << std::setw(8)
<< std::setfill('0') << var
<< " failed to "
"initialize with code 0x"
<< result << std::dec << std::setfill(' ') << std::endl;
#else
sif::printError("ObjectManager::initialize: Object 0x%08x failed to initialize with code 0x%04x\n", var, result);
#endif
errorCount++;
}
@ -124,6 +126,8 @@ void ObjectManager::initialize() {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "ObjectManager::ObjectManager: Counted " << errorCount
<< " failed initializations." << std::endl;
#else
sif::printError("ObjectManager: Counted %d\n", errorCount);
#endif
}
// Init was successful. Now check successful interconnections.

View File

@ -6,7 +6,7 @@
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
#define CCSDS_DISTRIBUTOR_DEBUGGING 0
#define CCSDS_DISTRIBUTOR_DEBUGGING 1
CcsdsDistributor::CcsdsDistributor(uint16_t setDefaultApid, object_id_t setObjectId,
StorageManagerIF* tcStore, MessageQueueIF* queue,
@ -68,9 +68,13 @@ ReturnValue_t CcsdsDistributor::selectDestination(MessageQueueId_t& destId) {
handlePacketCheckFailure(result);
return result;
}
#if FSFW_CPP_OSTREAM_ENABLED == 1 && CCSDS_DISTRIBUTOR_DEBUGGING == 1
#if CCSDS_DISTRIBUTOR_DEBUGGING == 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "CCSDSDistributor::selectDestination has packet with APID 0x" << std::hex
<< currentPacket.getApid() << std::dec << std::endl;
#else
sif::printDebug("CCSDS Distributor: Packet with APID 0x%04x detected\n", currentPacket.getApid());
#endif
#endif
auto iter = receiverMap.find(currentPacket.getApid());
if (iter != receiverMap.end()) {