Skip to content

rk_sendBytes() delivers a payload that ends with a random number of extra characters  #12

@pedbry

Description

@pedbry

I'm using the RAK811 library (downloaded in may 2021) in my devices (Arduino Uno with a RAK811-shield) and I have had no problem sending simple payloads to my application in The Things Network. They are picked up by my two local TTIG:s and I can check them in the TTN-Console (V2).

But I did get a little problem when I wanted to read from a set of DS18B20 temperature-sensors with CayenneLPP and then send the resulting lpp.buffer to my application with the rk_sendBytes() function in the RAK811 library. When I checked in my TTN-Console the payloads were not decoded to temperature-fields etc. The payload seemed to end with a random number of extra characters.

Example

  • 016700E4026700E4036700E5 -> Correct string
  • 016700E4026700E4036700E500294A4 -> Delivered by rk_sendBytes()

When I saw the result and had a closer look at the code I realized that the problem might be that the function that converts the lpp.buffer to a string doesn't add a finishing zero.

I have now added the extra line indicated in the code below to my RAK811.cpp:

image

I have tested my solution and it seems to be stable.

Might this be something that @rbricheno can fix?

I have also made a comment about this here: #6 (comment)

Pedbry

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions