Fixed an missing include
This commit is contained in:
parent
32381a7872
commit
1ef3dae72e
@ -7,6 +7,7 @@
|
|||||||
#include <fsfw/cfdp/tlv/Tlv.h>
|
#include <fsfw/cfdp/tlv/Tlv.h>
|
||||||
#include <fsfw/cfdp/tlv/TlvIF.h>
|
#include <fsfw/cfdp/tlv/TlvIF.h>
|
||||||
#include <fsfw/serialize/SerializeIF.h>
|
#include <fsfw/serialize/SerializeIF.h>
|
||||||
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "fsfw/globalfunctions/arrayprinter.h"
|
#include "fsfw/globalfunctions/arrayprinter.h"
|
||||||
|
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ void arrayprinter::printHex(const uint8_t *data, size_t size, size_t maxCharPerL
|
|||||||
currentPos += snprintf(printBuffer + currentPos, 6, "%02x", data[i]);
|
currentPos += snprintf(printBuffer + currentPos, 6, "%02x", data[i]);
|
||||||
if (i < size - 1) {
|
if (i < size - 1) {
|
||||||
currentPos += sprintf(printBuffer + currentPos, ",");
|
currentPos += sprintf(printBuffer + currentPos, ",");
|
||||||
if (i > 0 and (i + 1) % maxCharPerLine == 0) {
|
if ((i + 1) % maxCharPerLine == 0) {
|
||||||
currentPos += sprintf(printBuffer + currentPos, "\n");
|
currentPos += sprintf(printBuffer + currentPos, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,20 +98,21 @@ void arrayprinter::printDec(const uint8_t *data, size_t size, size_t maxCharPerL
|
|||||||
}
|
}
|
||||||
std::cout << "]" << std::endl;
|
std::cout << "]" << std::endl;
|
||||||
#else
|
#else
|
||||||
// General format: 32, 243, -12 so it is number of chars times 5
|
// General format: 32,243,-12 so it is number of chars times 4
|
||||||
// plus line break plus small safety margin.
|
// plus line break plus small safety margin.
|
||||||
char printBuffer[(size + 1) * 5 + 1] = {};
|
uint16_t expectedLines = ceil((double)size / maxCharPerLine);
|
||||||
|
char printBuffer[size * 4 + 1 + expectedLines] = {};
|
||||||
size_t currentPos = 0;
|
size_t currentPos = 0;
|
||||||
for (size_t i = 0; i < size; i++) {
|
for (size_t i = 0; i < size; i++) {
|
||||||
// To avoid buffer overflows.
|
// To avoid buffer overflows.
|
||||||
if (sizeof(printBuffer) - currentPos <= 5) {
|
if (sizeof(printBuffer) - currentPos <= 4) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentPos += snprintf(printBuffer + currentPos, 4, "%d", data[i]);
|
currentPos += snprintf(printBuffer + currentPos, 4, "%d", data[i]);
|
||||||
if (i < size - 1) {
|
if (i < size - 1) {
|
||||||
currentPos += sprintf(printBuffer + currentPos, ",");
|
currentPos += sprintf(printBuffer + currentPos, ",");
|
||||||
if (i > 0 and (i + 1) % maxCharPerLine == 0) {
|
if ((i + 1) % maxCharPerLine == 0) {
|
||||||
currentPos += sprintf(printBuffer + currentPos, "\n");
|
currentPos += sprintf(printBuffer + currentPos, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user