Skip to content

Implement error handling/timeout on readLine from LoRa module #242

Open
@savnik

Description

@savnik

I sometimes experience that the LoRa module(RN2483) does not send anything back after a sendBytes. The current implementation will wait forever until a return signal is send. This will result in deadlock unless a WDT is externally used. On many MCU's the WDT will have less than 8s count which is not always enough for a message to send.

size_t TheThingsNetwork::readLine(char *buffer, size_t size)
{
size_t read = 0;
while (read == 0)
{
read = modemStream->readBytesUntil('\n', buffer, size);
}
buffer[read - 1] = '\0'; // set \r to \0
return read;
}

I propose that a timeout is implemented to handle if there is no response from RN2483 within reasonable time.

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