Skip to content

Commit 8a65232

Browse files
committed
2 parents 9dfb759 + 7871495 commit 8a65232

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

libraries/Dragino/examples/LoRa/LoRaWAN/single_pkt_fwd_v004/Single_pkt_fwd_v004.ino

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ static long BW, preLen;
1111
static long old_time = millis();
1212
static long new_time;
1313
static unsigned long newtime;
14-
const long sendpkt_interval = 10000; // 10 seconds for replay.
14+
const long sendpkt_interval = 15000; // 15 seconds for replay.
1515
const long interval = 60000; //1min for feeddog.
1616
unsigned long previousMillis = millis();
17-
17+
unsigned long previousMillis_1 = millis();
1818

1919
void getRadioConf();//Get LoRa Radio Configure from LG01
2020
void setLoRaRadio();//Set LoRa Radio
@@ -229,12 +229,13 @@ void receivepacket() {
229229
// try to parse packet
230230
LoRa.setSpreadingFactor(SF);
231231
LoRa.receive(0);
232-
//old_time = millis();
233-
234-
while (new_time - old_time < sendpkt_interval) {
235-
new_time = millis();
232+
233+
unsigned long currentMillis_1 = millis();
234+
if ((currentMillis_1 - previousMillis_1 ) >= sendpkt_interval ){
235+
236+
previousMillis_1 = currentMillis_1;
236237
packetSize = LoRa.parsePacket();
237-
238+
238239
if (packetSize) { // Received a packet
239240
if ( debug > 0 ) {
240241
Console.println();

0 commit comments

Comments
 (0)