Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of LMiC by
Revision 4:663db54d46eb, committed 2015-12-14
- Comitter:
- pnysten
- Date:
- Mon Dec 14 10:46:06 2015 +0000
- Parent:
- 3:1079dc4b4c59
- Commit message:
- LORA ALU motive version
Changed in this revision
--- a/lmic.cpp Mon Nov 23 09:53:54 2015 +0000
+++ b/lmic.cpp Mon Dec 14 10:46:06 2015 +0000
@@ -967,8 +967,8 @@
static bit_t decodeFrame (void) {
- debug_str("decodeFrame: ");
- debug_buf(LMIC.frame, LMIC.dataLen);
+ //debug_str("decodeFrame: ");
+ //debug_buf(LMIC.frame, LMIC.dataLen);
xref2u1_t d = LMIC.frame;
u1_t hdr = d[0];
u1_t ftype = hdr & HDR_FTYPE;
@@ -995,8 +995,8 @@
int poff = OFF_DAT_OPTS+olen;
int pend = dlen-4; // MIC
- debug_val("fct: ", fct);
- debug_val("olen: ", olen);
+ //debug_val("fct: ", fct);
+ //debug_val("olen: ", olen);
if( addr != LMIC.devaddr ) {
EV(specCond, WARN, (e_.reason = EV::specCond_t::ALIEN_ADDRESS,
@@ -1073,7 +1073,7 @@
xref2u1_t opts = &d[OFF_DAT_OPTS];
int oidx = 0;
- debug_val("Port: ", port);
+ //debug_val("Port: ", port);
while( oidx < olen ) {
// debug_str("Port: ");
debug_str("Process OPTS...");
@@ -1114,8 +1114,8 @@
}
LMIC.adrChanged = 1; // Trigger an ACK to NWK
- debug_str("decodeFrame: ");
- debug_buf(LMIC.frame, LMIC.dataLen);
+ //debug_str("decodeFrame: ");
+ //debug_buf(LMIC.frame, LMIC.dataLen);
continue;
}
@@ -1233,7 +1233,7 @@
if( port == 0 && pend-poff > 0 )
{
- debug_str("Payload decrypting...\r\n");
+ //debug_str("Payload decrypting...\r\n");
aes_cipher(port <= 0 ? LMIC.nwkKey : LMIC.artKey, LMIC.devaddr, seqno, /*dn*/1, d+poff, pend-poff);
}
@@ -1279,18 +1279,18 @@
LMIC.dataBeg = poff;
LMIC.dataLen = pend-poff;
}
- debug_str("decodeFrame End: ");
- debug_buf(LMIC.frame, LMIC.dataLen);
+ //debug_str("decodeFrame End: ");
+ //debug_buf(LMIC.frame, LMIC.dataLen);
// PANY
if ((port == 0) && (olen == 0))
{
oidx = 0;
olen = LMIC.dataLen;
- debug_str("Port 0!!!\r\n");
+ //debug_str("Port 0!!!\r\n");
opts = LMIC.frame + LMIC.dataBeg;
- debug_val("Data Len: ", LMIC.dataLen);
+ //debug_val("Data Len: ", LMIC.dataLen);
while( oidx < olen ) {
// debug_str("Port: ");
debug_str("Process OPTS...");
@@ -1331,8 +1331,8 @@
}
LMIC.adrChanged = 1; // Trigger an ACK to NWK
- debug_str("decodeFrame: ");
- debug_buf(LMIC.frame, LMIC.dataLen);
+ //debug_str("decodeFrame: ");
+ //debug_buf(LMIC.frame, LMIC.dataLen);
continue;
}
@@ -1680,7 +1680,7 @@
static void buildDataFrame (void) {
- debug_str("buildDataFrame\r\n");
+ //debug_str("buildDataFrame\r\n");
bit_t txdata = ((LMIC.opmode & (OP_TXDATA|OP_POLL)) != OP_POLL);
u1_t dlen = txdata ? LMIC.pendTxLen : 0;
@@ -2075,6 +2075,8 @@
// Decide what to do next for the MAC layer of a device
static void engineUpdate (void) {
+
+// debug_str("Engine Update\r\n");
// Check for ongoing state: scan or TX/RX transaction
if( (LMIC.opmode & (OP_SCAN|OP_TXRXPEND|OP_SHUTDOWN)) != 0 )
return;
@@ -2286,17 +2288,24 @@
void LMIC_setTxData (void) {
LMIC.opmode |= OP_TXDATA;
if( (LMIC.opmode & OP_JOINING) == 0 )
+ {
LMIC.txCnt = 0; // cancel any ongoing TX/RX retries
+ }
engineUpdate();
}
//
int LMIC_setTxData2 (u1_t port, xref2u1_t data, u1_t dlen, u1_t confirmed) {
+/* debug_val("Data Length: ", dlen);
+ debug_val("Data Length: ", SIZEOFEXPR(LMIC.pendTxData));*/
if( dlen > SIZEOFEXPR(LMIC.pendTxData) )
return -2;
if( data != (xref2u1_t)0 )
+ {
os_copyMem(LMIC.pendTxData, data, dlen);
+ }
+ //debug_str("Send Data\r\n");
LMIC.pendTxConf = confirmed;
LMIC.pendTxPort = port;
LMIC.pendTxLen = dlen;
--- a/lmic.h Mon Nov 23 09:53:54 2015 +0000
+++ b/lmic.h Mon Dec 14 10:46:06 2015 +0000
@@ -34,6 +34,7 @@
#define LMIC_VERSION_BUILD 1426605786
enum { MAX_FRAME_LEN = 64 }; //!< Library cap on max frame length
+//enum { MAX_FRAME_LEN = 96 }; //!< Library cap on max frame length
enum { TXCONF_ATTEMPTS = 8 }; //!< Transmit attempts for confirmed frames
enum { MAX_MISSED_BCNS = 20 }; // threshold for triggering rejoin requests
enum { MAX_RXSYMS = 100 }; // stop tracking beacon beyond this
--- a/lorabase.h Mon Nov 23 09:53:54 2015 +0000
+++ b/lorabase.h Mon Dec 14 10:46:06 2015 +0000
@@ -33,7 +33,8 @@
// Global maximum frame length
enum { STD_PREAMBLE_LEN = 8 };
-enum { MAX_LEN_FRAME = 64 };
+//enum { MAX_LEN_FRAME = 96 };
+enum { MAX_LEN_FRAME = 64 };
enum { LEN_DEVNONCE = 2 };
enum { LEN_ARTNONCE = 3 };
enum { LEN_NETID = 3 };
