diff --git a/src/protocols/PhysicalLayer/PhysicalLayer.cpp b/src/protocols/PhysicalLayer/PhysicalLayer.cpp index d6aec9f0..58bb9231 100644 --- a/src/protocols/PhysicalLayer/PhysicalLayer.cpp +++ b/src/protocols/PhysicalLayer/PhysicalLayer.cpp @@ -103,11 +103,6 @@ int16_t PhysicalLayer::receive(String& str, size_t len) { // user can override the length of data to read size_t length = len; - if(len == 0) { - // unknown packet length, set to maximum - length = _maxPacketLength; - } - // build a temporary buffer #if defined(RADIOLIB_STATIC_ONLY) uint8_t data[RADIOLIB_STATIC_ARRAY_SIZE + 1]; diff --git a/src/protocols/PhysicalLayer/PhysicalLayer.h b/src/protocols/PhysicalLayer/PhysicalLayer.h index 0245b8f4..425dddc7 100644 --- a/src/protocols/PhysicalLayer/PhysicalLayer.h +++ b/src/protocols/PhysicalLayer/PhysicalLayer.h @@ -144,7 +144,8 @@ class PhysicalLayer { \param str Address of Arduino String to save the received data. - \param len Expected number of characters in the message. + \param len Expected number of characters in the message. When set to 0, the packet length will be retreived automatically. + When more bytes than received are requested, only the number of bytes requested will be returned. \returns \ref status_codes */ @@ -155,7 +156,8 @@ class PhysicalLayer { \param data Pointer to array to save the received binary data. - \param len Number of bytes that will be received. Must be known in advance for binary transmissions. + \param len Number of bytes that will be read. When set to 0, the packet length will be retreived automatically. + When more bytes than received are requested, only the number of bytes requested will be returned. \returns \ref status_codes */