Merge pull request 'Arrayprinter format improvements' (#514) from KSat/fsfw:mueller/arrayprinter-improvements into development
Reviewed-on: fsfw/fsfw#514
This commit is contained in:
commit
0e653378c3
@ -45,9 +45,9 @@ void arrayprinter::printHex(const uint8_t *data, size_t size,
|
||||
std::cout << "\r" << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "[" << std::hex;
|
||||
std::cout << "hex [" << std::setfill('0') << std::hex;
|
||||
for(size_t i = 0; i < size; i++) {
|
||||
std::cout << "0x" << static_cast<int>(data[i]);
|
||||
std::cout << std::setw(2) << static_cast<int>(data[i]);
|
||||
if(i < size - 1) {
|
||||
std::cout << ",";
|
||||
if(i > 0 and (i + 1) % maxCharPerLine == 0) {
|
||||
@ -56,7 +56,7 @@ void arrayprinter::printHex(const uint8_t *data, size_t size,
|
||||
}
|
||||
}
|
||||
}
|
||||
std::cout << std::dec;
|
||||
std::cout << std::dec << std::setfill(' ');
|
||||
std::cout << "]" << std::endl;
|
||||
#else
|
||||
// General format: 0x01, 0x02, 0x03 so it is number of chars times 6
|
||||
@ -69,7 +69,7 @@ void arrayprinter::printHex(const uint8_t *data, size_t size,
|
||||
break;
|
||||
}
|
||||
|
||||
currentPos += snprintf(printBuffer + currentPos, 6, "0x%02x", data[i]);
|
||||
currentPos += snprintf(printBuffer + currentPos, 6, "%02x", data[i]);
|
||||
if(i < size - 1) {
|
||||
currentPos += sprintf(printBuffer + currentPos, ",");
|
||||
if(i > 0 and (i + 1) % maxCharPerLine == 0) {
|
||||
@ -78,7 +78,7 @@ void arrayprinter::printHex(const uint8_t *data, size_t size,
|
||||
}
|
||||
}
|
||||
#if FSFW_DISABLE_PRINTOUT == 0
|
||||
printf("[%s]\n", printBuffer);
|
||||
printf("hex [%s]\n", printBuffer);
|
||||
#endif /* FSFW_DISABLE_PRINTOUT == 0 */
|
||||
#endif
|
||||
}
|
||||
@ -90,7 +90,7 @@ void arrayprinter::printDec(const uint8_t *data, size_t size,
|
||||
std::cout << "\r" << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "[" << std::dec;
|
||||
std::cout << "dec [" << std::dec;
|
||||
for(size_t i = 0; i < size; i++) {
|
||||
std::cout << static_cast<int>(data[i]);
|
||||
if(i < size - 1){
|
||||
@ -121,7 +121,7 @@ void arrayprinter::printDec(const uint8_t *data, size_t size,
|
||||
}
|
||||
}
|
||||
#if FSFW_DISABLE_PRINTOUT == 0
|
||||
printf("[%s]\n", printBuffer);
|
||||
printf("dec [%s]\n", printBuffer);
|
||||
#endif /* FSFW_DISABLE_PRINTOUT == 0 */
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user