From a5023c7519925301e3757ae03d1a7f43e4df7216 Mon Sep 17 00:00:00 2001 From: Terry Moore Date: Mon, 18 Feb 2019 04:56:36 -0500 Subject: [PATCH] Fix #81: add additional paramter for port nubmer --- src/Arduino_LoRaWAN.h | 3 ++- src/lib/SendBuffer.cpp | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Arduino_LoRaWAN.h b/src/Arduino_LoRaWAN.h index 67651a2..c7fbdcb 100644 --- a/src/Arduino_LoRaWAN.h +++ b/src/Arduino_LoRaWAN.h @@ -395,7 +395,8 @@ class Arduino_LoRaWAN size_t nBuffer, SendBufferCbFn *pDoneFn = nullptr, void *pCtx = nullptr, - bool fConfirmed = false + bool fConfirmed = false, + uint8_t port = 1 ); typedef void ReceivePortBufferCbFn( diff --git a/src/lib/SendBuffer.cpp b/src/lib/SendBuffer.cpp index 65d7c3f..5031943 100644 --- a/src/lib/SendBuffer.cpp +++ b/src/lib/SendBuffer.cpp @@ -74,7 +74,8 @@ bool Arduino_LoRaWAN::SendBuffer( size_t nBuffer, SendBufferCbFn *pDoneFn, void *pDoneCtx, - bool fConfirmed + bool fConfirmed, + uint8_t port ) { if (this->m_fTxPending || LMIC.opmode & OP_TXRXPEND) @@ -85,7 +86,7 @@ bool Arduino_LoRaWAN::SendBuffer( } const int iResult = LMIC_setTxData2( - /* port: */ 1, + /* port: */ port != 0 ? port : 1, const_cast(pBuffer), nBuffer, /* confirmed? */ fConfirmed