diff options
Diffstat (limited to 'usb-lora/usb-lora.cpp')
-rw-r--r-- | usb-lora/usb-lora.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/usb-lora/usb-lora.cpp b/usb-lora/usb-lora.cpp index d56946f..561f543 100644 --- a/usb-lora/usb-lora.cpp +++ b/usb-lora/usb-lora.cpp @@ -37,8 +37,8 @@ RH_RF95 lora; void recv_lora_msg() { - uint8_t buf[RH_RF95_MAX_MESSAGE_LEN]; - uint8_t len = sizeof(buf); + uint8_t buf[RH_RF95_MAX_MESSAGE_LEN+1]; + uint8_t len = sizeof(buf)-1; led2_on(); if(!lora.recv(buf, &len)) { @@ -46,10 +46,12 @@ void recv_lora_msg() led2_off(); return; } + buf[len] = 0; - printf("lora.recv() got message: SNR = %d, data = ", lora.lastSNR()); - for(uint8_t i = 0; i < len; ++i) printf("%s0x%02X", (i==0) ? "" : " ", buf[i]); - printf("\r\n"); + // printf("lora.recv() got message: SNR = %d, data = ", lora.lastSNR()); + // for(uint8_t i = 0; i < len; ++i) printf("%s0x%02X", (i==0) ? "" : " ", buf[i]); + // printf("\r\n"); + printf("lora.recv() got message: SNR = %d, data = %s\r\n", lora.lastSNR(), buf); led2_off(); } |