Skip to content
This repository was archived by the owner on Apr 30, 2025. It is now read-only.

Commit 483c82f

Browse files
committed
fix: esp32 #197 Downlink no longer works
1 parent a3c698a commit 483c82f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/arduino-rfm/lorawan-arduino-rfm.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ bool LoRaWANClass::init(void)
112112
LoRa_Settings.Channel_Hopping = 0x00; //0x00 no channel hopping, 0x01 channel hopping
113113

114114
// Set default rx delay and window
115-
LoRa_Settings.Rx1_Delay = 1000; // Thing stack seems to be 5000 ms (so Rx2_delay 6000 ms)
116-
LoRa_Settings.Rx2_Delay = 2000; // Rx2_Delay >= Rx1_Delay + RX1_Window
115+
LoRa_Settings.Rx1_Delay = 5000; // Thing stack seems to be 5000 ms (so Rx2_delay 6000 ms)
116+
LoRa_Settings.Rx2_Delay = 6000; // Rx2_Delay >= Rx1_Delay + RX1_Window
117117
LoRa_Settings.RX1_Window = 1000;
118118
LoRa_Settings.RX2_Window = 1000;
119119

@@ -263,7 +263,10 @@ void LoRaWANClass::setAppSKey(const char *ApskKey_in)
263263

264264
void LoRaWANClass::setDevAddr(const char *devAddr_in)
265265
{
266-
memset(Session_Data.DevAddr, 0x30, sizeof(Session_Data.DevAddr));
266+
//memset(Session_Data.DevAddr, 0x30, sizeof(Session_Data.DevAddr));
267+
268+
size_t devAddrSize = sizeof(Session_Data.DevAddr);
269+
memset(Session_Data.DevAddr, 0x30, devAddrSize);
267270

268271
//Check if it is a set command and there is enough data sent
269272
Address_Tx[0] = ASCII2Hex(devAddr_in[0], devAddr_in[1]);
@@ -340,7 +343,8 @@ void LoRaWANClass::sendACK()
340343
//Set new command for RFM
341344
RFM_Command_Status = NEW_RFM_COMMAND;
342345
upMsg_Type = MSG_ACK;
343-
sprintf(Str, "");
346+
//sprintf(Str, "");
347+
Str[0] = '\0';
344348
memcpy(Buffer_Tx.Data, Str, sizeof(Str));
345349

346350
}
@@ -503,7 +507,8 @@ void LoRaWANClass::update(void)
503507
bool isConfirmed = ((Message_Rx.MAC_Header & 0xE0)>>5) == 5 ? true : false ; // MType
504508
uint8_t fPort = Message_Rx.Frame_Port;
505509
if(lora.messageCallback) lora.messageCallback(&Buffer_Rx, isConfirmed, fPort);
506-
Buffer_Rx.Counter = 0x00; // clear counter for the next cycle
510+
//Buffer_Rx.Counter = 0x00; // clear counter for the next cycle
511+
Rx_Status = NEW_RX;
507512
Serial.println("Data received over RX1");
508513

509514
}

0 commit comments

Comments
 (0)