fifo renamed

This commit is contained in:
Robin Müller 2020-04-23 12:47:59 +02:00
parent d546317e6a
commit ee2ee745c7
2 changed files with 13 additions and 10 deletions

View File

@ -126,14 +126,14 @@ ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage *message) {
// "Saving packet ID to be sent later\r\n" << std::flush; // "Saving packet ID to be sent later\r\n" << std::flush;
store_address_t storeId = 0; store_address_t storeId = 0;
if(fifo.full()) { if(tmFifo.full()) {
error << "TMTC Bridge: TM downlink max. number of stored packet IDs " error << "TMTC Bridge: TM downlink max. number of stored packet IDs "
"reached! Overwriting old data" << std::endl; "reached! Overwriting old data" << std::endl;
fifo.retrieve(&storeId); tmFifo.retrieve(&storeId);
tmStore->deleteData(storeId); tmStore->deleteData(storeId);
} }
storeId = message->getStorageId(); storeId = message->getStorageId();
fifo.insert(storeId); tmFifo.insert(storeId);
tmStored = true; tmStored = true;
return RETURN_OK; return RETURN_OK;
} }
@ -141,13 +141,13 @@ ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage *message) {
ReturnValue_t TmTcBridge::handleStoredTm() { ReturnValue_t TmTcBridge::handleStoredTm() {
uint8_t counter = 0; uint8_t counter = 0;
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
while(not fifo.empty() && counter < sentPacketsPerCycle) { while(not tmFifo.empty() && counter < sentPacketsPerCycle) {
//info << "TMTC Bridge: Sending stored TM data. There are " //info << "TMTC Bridge: Sending stored TM data. There are "
// << (int) fifo.size() << " left to send\r\n" << std::flush; // << (int) fifo.size() << " left to send\r\n" << std::flush;
store_address_t storeId; store_address_t storeId;
const uint8_t* data = NULL; const uint8_t* data = NULL;
size_t size = 0; size_t size = 0;
fifo.retrieve(&storeId); tmFifo.retrieve(&storeId);
result = tmStore->getData(storeId, &data, &size); result = tmStore->getData(storeId, &data, &size);
sendTm(data,size); sendTm(data,size);
@ -159,7 +159,7 @@ ReturnValue_t TmTcBridge::handleStoredTm() {
} }
counter ++; counter ++;
if(fifo.empty()) { if(tmFifo.empty()) {
tmStored = false; tmStored = false;
} }
tmStore->deleteData(storeId); tmStore->deleteData(storeId);

View File

@ -138,8 +138,11 @@ protected:
*/ */
void printData(uint8_t * data, size_t dataLen); void printData(uint8_t * data, size_t dataLen);
private: /**
FIFO<store_address_t, LIMIT_DOWNLINK_PACKETS_STORED> fifo; * This fifo can be used to store downlink data
* which can not be sent at the moment.
*/
FIFO<store_address_t, LIMIT_DOWNLINK_PACKETS_STORED> tmFifo;
uint8_t sentPacketsPerCycle = DEFAULT_STORED_DATA_SENT_PER_CYCLE; uint8_t sentPacketsPerCycle = DEFAULT_STORED_DATA_SENT_PER_CYCLE;
uint8_t maxNumberOfPacketsStored = DEFAULT_DOWNLINK_PACKETS_STORED; uint8_t maxNumberOfPacketsStored = DEFAULT_DOWNLINK_PACKETS_STORED;
}; };