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-10secs by
Diff: lmic.cpp
- Revision:
- 4:663db54d46eb
- Parent:
- 3:1079dc4b4c59
- Child:
- 5:74acff269a3d
diff -r 1079dc4b4c59 -r 663db54d46eb lmic.cpp
--- 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;
