kopia lustrzana https://github.com/rpp0/gr-lora
Print characters in ASCII range when decoding
rodzic
0bbd2324c4
commit
77822182a0
|
@ -24,6 +24,7 @@
|
|||
#include <cstdint>
|
||||
#include <string.h>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
#define MAC_CRC_SIZE 2u
|
||||
#define MAX_PWR_QUEUE_SIZE 4
|
||||
|
@ -348,11 +349,18 @@ namespace gr {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
inline void print_vector_hex(std::ostream& out, const T* v, const uint32_t size, bool endline) {
|
||||
inline void print_vector_hex(std::ostream& out, const T* v, const uint32_t size, bool endline, bool print_ascii) {
|
||||
std::stringstream ss;
|
||||
|
||||
for (uint32_t i = 0u; i < size; i++) {
|
||||
out << " " << std::hex << std::setw(2) << std::setfill('0') << (int)v[i];
|
||||
if (v[i] >= ' ' && v[i] <= '~')
|
||||
ss << v[i];
|
||||
}
|
||||
|
||||
if (print_ascii)
|
||||
out << " (" << ss.str() << ")";
|
||||
|
||||
if(endline)
|
||||
out << std::endl;
|
||||
|
||||
|
|
|
@ -840,7 +840,7 @@ namespace gr {
|
|||
|
||||
if (demodulate(input, true)) {
|
||||
decode(true);
|
||||
gr::lora::print_vector_hex(std::cout, &d_decoded[0], d_decoded.size(), false);
|
||||
gr::lora::print_vector_hex(std::cout, &d_decoded[0], d_decoded.size(), false, false);
|
||||
memcpy(&d_phdr, &d_decoded[0], sizeof(loraphy_header_t));
|
||||
if (d_phdr.cr > 4)
|
||||
d_phdr.cr = 4;
|
||||
|
@ -880,7 +880,7 @@ namespace gr {
|
|||
|
||||
if (d_payload_symbols <= 0) {
|
||||
decode(false);
|
||||
gr::lora::print_vector_hex(std::cout, &d_decoded[0], d_payload_length, true);
|
||||
gr::lora::print_vector_hex(std::cout, &d_decoded[0], d_payload_length, true, true);
|
||||
msg_lora_frame();
|
||||
|
||||
d_state = gr::lora::DecoderState::DETECT;
|
||||
|
|
Ładowanie…
Reference in New Issue