printers continued,
possible bugfix in tc packet base
This commit is contained in:
parent
237dd4a256
commit
6e1bb16d4e
@ -1,13 +1,34 @@
|
||||
#include <framework/globalfunctions/printer.h>
|
||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||
|
||||
void printer::print(uint8_t *data, size_t size) {
|
||||
void printer::print(uint8_t *data, size_t size, OutputType type) {
|
||||
sif::info << "StorageAccessor: Printing data: [";
|
||||
if(type == OutputType::HEX) {
|
||||
printer::printHex(data, size);
|
||||
}
|
||||
else {
|
||||
printer::printDec(data, size);
|
||||
}
|
||||
}
|
||||
|
||||
void printer::printHex(uint8_t *data, size_t size) {
|
||||
sif::info << std::hex;
|
||||
for(size_t i = 0; i < size; i++) {
|
||||
sif::info << std::hex << (int)data[i];
|
||||
sif::info << "0x" << static_cast<int>(data[i]);
|
||||
if(i < size - 1){
|
||||
sif::info << " , ";
|
||||
}
|
||||
}
|
||||
sif::info << std::dec;
|
||||
sif::info << " ] " << std::endl;
|
||||
}
|
||||
|
||||
void printer::printDec(uint8_t *data, size_t size) {
|
||||
for(size_t i = 0; i < size; i++) {
|
||||
sif::info << "0x" << static_cast<int>(data[i]);
|
||||
if(i < size - 1){
|
||||
sif::info << " , ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,9 +4,15 @@
|
||||
#include <cstddef>
|
||||
|
||||
namespace printer {
|
||||
void print(uint8_t *data, size_t size);
|
||||
|
||||
enum class OutputType {
|
||||
DEC,
|
||||
HEX
|
||||
};
|
||||
|
||||
void print(uint8_t* data, size_t size, OutputType type = OutputType::HEX);
|
||||
void printHex(uint8_t* data, size_t size);
|
||||
void printDec(uint8_t* data, size_t size);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* FRAMEWORK_GLOBALFUNCTIONS_PRINTER_H_ */
|
||||
|
@ -79,7 +79,7 @@ void TcPacketBase::initializeTcPacket(uint16_t apid, uint16_t sequenceCount,
|
||||
uint8_t ack, uint8_t service, uint8_t subservice) {
|
||||
initSpacePacketHeader(true, true, apid, sequenceCount);
|
||||
memset(&tcData->data_field, 0, sizeof(tcData->data_field));
|
||||
setPacketDataLength(sizeof(tcData->data_field) + CRC_SIZE);
|
||||
setPacketDataLength(sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1);
|
||||
//Data Field Header:
|
||||
//Set CCSDS_secondary_header_flag to 0, version number to 001 and ack to 0000
|
||||
tcData->data_field.version_type_ack = 0b00010000;
|
||||
|
Loading…
Reference in New Issue
Block a user