Skip to content

Commit

Permalink
Merge pull request #497 from mcci-catena/issue495
Browse files Browse the repository at this point in the history
Example sketch updates
  • Loading branch information
terrillmoore authored Nov 28, 2019
2 parents e961979 + 897d5d5 commit 8a62487
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,15 @@ void onEvent (ev_t ev) {
case EV_TXSTART:
Serial.println(F("EV_TXSTART"));
break;
case EV_TXCANCELED:
Serial.println(F("EV_TXCANCELED"));
break;
case EV_RXSTART:
/* do not print anything -- it wrecks timing */
break;
case EV_JOIN_TXCOMPLETE:
Serial.println(F("EV_JOIN_TXCOMPLETE: no JoinAccept"));
break;
default:
Serial.print(F("Unknown event: "));
Serial.println((unsigned) ev);
Expand Down
9 changes: 9 additions & 0 deletions examples/ttn-abp/ttn-abp.ino
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ void onEvent (ev_t ev) {
case EV_TXSTART:
Serial.println(F("EV_TXSTART"));
break;
case EV_TXCANCELED:
Serial.println(F("EV_TXCANCELED"));
break;
case EV_RXSTART:
/* do not print anything -- it wrecks timing */
break;
case EV_JOIN_TXCOMPLETE:
Serial.println(F("EV_JOIN_TXCOMPLETE: no JoinAccept"));
break;
default:
Serial.print(F("Unknown event: "));
Serial.println((unsigned) ev);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ const lmic_pinmap lmic_pins = {
// init. DHT
DHT dht(DHTPIN, DHTTYPE);

void printHex2(unsigned v) {
v &= 0xff;
if (v < 16)
Serial.print('0');
Serial.print(v, HEX);
}

void onEvent (ev_t ev) {
Serial.print(os_getTime());
Serial.print(": ");
Expand Down Expand Up @@ -111,20 +118,20 @@ void onEvent (ev_t ev) {
Serial.println(netid, DEC);
Serial.print("devaddr: ");
Serial.println(devaddr, HEX);
Serial.print("artKey: ");
Serial.print("AppSKey: ");
for (size_t i=0; i<sizeof(artKey); ++i) {
if (i != 0)
Serial.print("-");
Serial.print(artKey[i], HEX);
printHex2(artKey[i]);
}
Serial.println("");
Serial.print("nwkKey: ");
Serial.print("NwkSKey: ");
for (size_t i=0; i<sizeof(nwkKey); ++i) {
if (i != 0)
Serial.print("-");
Serial.print(nwkKey[i], HEX);
printHex2(nwkKey[i]);
}
Serial.println("");
Serial.println();
}
// Disable link check validation (automatically enabled
// during join, but because slow data rates change max TX
Expand Down Expand Up @@ -185,6 +192,16 @@ void onEvent (ev_t ev) {
case EV_TXSTART:
Serial.println(F("EV_TXSTART"));
break;
case EV_TXCANCELED:
Serial.println(F("EV_TXCANCELED"));
break;
case EV_RXSTART:
/* do not print anything -- it wrecks timing */
break;
case EV_JOIN_TXCOMPLETE:
Serial.println(F("EV_JOIN_TXCOMPLETE: no JoinAccept"));
break;

default:
Serial.print(F("Unknown event: "));
Serial.println((unsigned) ev);
Expand Down
27 changes: 22 additions & 5 deletions examples/ttn-otaa-feather-us915/ttn-otaa-feather-us915.ino
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ const lmic_pinmap lmic_pins = {
# error "Unknown target"
#endif

void printHex2(unsigned v) {
v &= 0xff;
if (v < 16)
Serial.print('0');
Serial.print(v, HEX);
}

void onEvent (ev_t ev) {
Serial.print(os_getTime());
Serial.print(": ");
Expand Down Expand Up @@ -153,20 +160,20 @@ void onEvent (ev_t ev) {
Serial.println(netid, DEC);
Serial.print("devaddr: ");
Serial.println(devaddr, HEX);
Serial.print("artKey: ");
Serial.print("AppSKey: ");
for (size_t i=0; i<sizeof(artKey); ++i) {
if (i != 0)
Serial.print("-");
Serial.print(artKey[i], HEX);
printHex2(artKey[i]);
}
Serial.println("");
Serial.print("nwkKey: ");
Serial.print("NwkSKey: ");
for (size_t i=0; i<sizeof(nwkKey); ++i) {
if (i != 0)
Serial.print("-");
Serial.print(nwkKey[i], HEX);
printHex2(nwkKey[i]);
}
Serial.println("");
Serial.println();
}
// Disable link check validation (automatically enabled
// during join, but because slow data rates change max TX
Expand Down Expand Up @@ -227,6 +234,16 @@ void onEvent (ev_t ev) {
case EV_TXSTART:
Serial.println(F("EV_TXSTART"));
break;
case EV_TXCANCELED:
Serial.println(F("EV_TXCANCELED"));
break;
case EV_RXSTART:
/* do not print anything -- it wrecks timing */
break;
case EV_JOIN_TXCOMPLETE:
Serial.println(F("EV_JOIN_TXCOMPLETE: no JoinAccept"));
break;

default:
Serial.print(F("Unknown event: "));
Serial.println((unsigned) ev);
Expand Down
26 changes: 21 additions & 5 deletions examples/ttn-otaa-halconfig-us915/ttn-otaa-halconfig-us915.ino
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ static osjob_t sendjob;
// cycle limitations).
const unsigned TX_INTERVAL = 60;

void printHex2(unsigned v) {
v &= 0xff;
if (v < 16)
Serial.print('0');
Serial.print(v, HEX);
}

void onEvent (ev_t ev) {
Serial.print(os_getTime());
Expand Down Expand Up @@ -107,20 +113,20 @@ void onEvent (ev_t ev) {
Serial.println(netid, DEC);
Serial.print("devaddr: ");
Serial.println(devaddr, HEX);
Serial.print("artKey: ");
Serial.print("AppSKey: ");
for (size_t i=0; i<sizeof(artKey); ++i) {
if (i != 0)
Serial.print("-");
Serial.print(artKey[i], HEX);
printHex2(artKey[i]);
}
Serial.println("");
Serial.print("nwkKey: ");
Serial.print("NwkSKey: ");
for (size_t i=0; i<sizeof(nwkKey); ++i) {
if (i != 0)
Serial.print("-");
Serial.print(nwkKey[i], HEX);
printHex2(nwkKey[i]);
}
Serial.println("");
Serial.println();
}
// Disable link check validation (automatically enabled
// during join, but because slow data rates change max TX
Expand Down Expand Up @@ -181,6 +187,16 @@ void onEvent (ev_t ev) {
case EV_TXSTART:
Serial.println(F("EV_TXSTART"));
break;
case EV_TXCANCELED:
Serial.println(F("EV_TXCANCELED"));
break;
case EV_RXSTART:
/* do not print anything -- it wrecks timing */
break;
case EV_JOIN_TXCOMPLETE:
Serial.println(F("EV_JOIN_TXCOMPLETE: no JoinAccept"));
break;

default:
Serial.print(F("Unknown event: "));
Serial.println((unsigned) ev);
Expand Down
30 changes: 25 additions & 5 deletions examples/ttn-otaa-network-time/ttn-otaa-network-time.ino
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ const lmic_pinmap lmic_pins = {
.dio = {2, 3, 4},
};

void printHex2(unsigned v) {
v &= 0xff;
if (v < 16)
Serial.print('0');
Serial.print(v, HEX);
}

void onEvent (ev_t ev) {
Serial.print(os_getTime());
Serial.print(": ");
Expand Down Expand Up @@ -113,16 +120,20 @@ void onEvent (ev_t ev) {
Serial.println(netid, DEC);
Serial.print("devaddr: ");
Serial.println(devaddr, HEX);
Serial.print("artKey: ");
Serial.print("AppSKey: ");
for (size_t i=0; i<sizeof(artKey); ++i) {
Serial.print(artKey[i], HEX);
if (i != 0)
Serial.print("-");
printHex2(artKey[i]);
}
Serial.println("");
Serial.print("nwkKey: ");
Serial.print("NwkSKey: ");
for (size_t i=0; i<sizeof(nwkKey); ++i) {
Serial.print(nwkKey[i], HEX);
if (i != 0)
Serial.print("-");
printHex2(nwkKey[i]);
}
Serial.println("");
Serial.println();
}
// Disable link check validation (automatically enabled
// during join, but because slow data rates change max TX
Expand Down Expand Up @@ -182,6 +193,15 @@ void onEvent (ev_t ev) {
case EV_TXSTART:
Serial.println(F("EV_TXSTART"));
break;
case EV_TXCANCELED:
Serial.println(F("EV_TXCANCELED"));
break;
case EV_RXSTART:
/* do not print anything -- it wrecks timing */
break;
case EV_JOIN_TXCOMPLETE:
Serial.println(F("EV_JOIN_TXCOMPLETE: no JoinAccept"));
break;
default:
Serial.print(F("Unknown event: "));
Serial.println((unsigned) ev);
Expand Down
21 changes: 16 additions & 5 deletions examples/ttn-otaa/ttn-otaa.ino
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ const lmic_pinmap lmic_pins = {
.dio = {2, 3, 4},
};

void printHex2(unsigned v) {
v &= 0xff;
if (v < 16)
Serial.print('0');
Serial.print(v, HEX);
}

void onEvent (ev_t ev) {
Serial.print(os_getTime());
Serial.print(": ");
Expand Down Expand Up @@ -112,16 +119,20 @@ void onEvent (ev_t ev) {
Serial.println(netid, DEC);
Serial.print("devaddr: ");
Serial.println(devaddr, HEX);
Serial.print("artKey: ");
Serial.print("AppSKey: ");
for (size_t i=0; i<sizeof(artKey); ++i) {
Serial.print(artKey[i], HEX);
if (i != 0)
Serial.print("-");
printHex2(artKey[i]);
}
Serial.println("");
Serial.print("nwkKey: ");
Serial.print("NwkSKey: ");
for (size_t i=0; i<sizeof(nwkKey); ++i) {
Serial.print(nwkKey[i], HEX);
if (i != 0)
Serial.print("-");
printHex2(nwkKey[i]);
}
Serial.println("");
Serial.println();
}
// Disable link check validation (automatically enabled
// during join, but because slow data rates change max TX
Expand Down

0 comments on commit 8a62487

Please sign in to comment.