Skip to content

Commit 425b929

Browse files
committed
adjust times for XBee process and connection checks for better operation of the system; updates of the verbose packet data output
1 parent 2fcfe6d commit 425b929

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

sfeIoTNodeLoRaWAN/flxLoRaWANDigi.cpp

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@
2626
#define kMaxConnectionTries 3
2727

2828
// How often is the connection status checked ... in MS
29-
const uint16_t kLoRaWANUpdateHandlerTimeMS = 15000;
29+
const uint32_t kLoRaWANUpdateHandlerTimeMS = 120000;
3030

3131
// Define times (in ms) for the reconnected job
3232
const uint32_t kReconnectInitialTime = 30000;
3333
// 1 hour
3434
const uint32_t kReconnectMaxTime = 3600000;
3535

3636
// For the process messages job - in ms.
37-
const uint32_t kProcessMessagesTime = 2000;
37+
const uint32_t kProcessMessagesTime = 4000;
3838
//----------------------------------------------------------------
3939
// Callbacks for the XBee LR module - these are static functions
4040
//
@@ -74,22 +74,31 @@ static void OnSendCallback(void *data)
7474
{
7575
if (packet->status == 0)
7676
{
77-
flxLog_V_(F("[LoRaWAN][OnSendCallback] "));
78-
77+
// this is a continuation from the send verbose message
78+
flxLog_N_("[");
79+
flxSerial.textToGreen();
80+
flxLog_N_(F("sent"));
81+
flxSerial.textToNormal();
82+
flxLog_N_(F("] Frame ID: 0x%X "), packet->frameId);
7983
if (packet->payloadSize > 0)
8084
{
81-
flxLog_N_(F("Packet: {"));
85+
flxLog_N_("{");
86+
8287
for (int i = 0; i < packet->payloadSize; i++)
8388
flxLog_N_(F("0x%02X "), packet->payload[i]);
84-
flxLog_N_(F("}"));
85-
}
8689

87-
flxLog_N(F("Ack: %u Port: %u RSSI: %d SNR: %d Downlink Counter: %u"), packet->ack, packet->port,
88-
packet->rssi, packet->snr, packet->counter);
90+
flxLog_N_(F(" } Ack: %u Port: %u RSSI: %d SNR: %d Downlink Counter: %u"), packet->ack, packet->port,
91+
packet->rssi, packet->snr, packet->counter);
92+
}
93+
flxLog_N(F(""));
8994
}
9095
else
9196
{
92-
flxLog_W_(F("[LoRaWAN] Data send failed. Frame ID: 0x%X Reason: "), packet->frameId);
97+
flxLog_N_("[");
98+
flxSerial.textToRed();
99+
flxLog_N_(F("failed"));
100+
flxSerial.textToNormal();
101+
flxLog_N_(F("] Frame ID: 0x%X Reason: "), packet->frameId);
93102

94103
switch (packet->status)
95104
{
@@ -100,7 +109,7 @@ static void OnSendCallback(void *data)
100109
flxLog_N(F("Not Connected"));
101110
break;
102111
default:
103-
flxLog_N_(F("code 0x%X"), packet->status);
112+
flxLog_N(F("code 0x%X"), packet->status);
104113
break;
105114
}
106115
}
@@ -589,7 +598,7 @@ bool flxLoRaWANDigi::sendPayload(const uint8_t *payload, size_t len)
589598
{
590599
flxLog_N_(F("%02X"), payload[i]);
591600
}
592-
flxLog_N("");
601+
flxLog_N_(" - ");
593602
}
594603
XBeeLRPacket_t packet;
595604
packet.payload = (uint8_t *)payload;

0 commit comments

Comments
 (0)