From 2226826beb3cc02eb7b19d98d6ae13f81761d129 Mon Sep 17 00:00:00 2001 From: Klaus Date: Mon, 21 Oct 2019 19:21:29 +0200 Subject: [PATCH 1/3] Fix mac cmd size retrieval --- src/lmic/lmic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lmic/lmic.c b/src/lmic/lmic.c index 7a1beecf..d2dd8299 100644 --- a/src/lmic/lmic.c +++ b/src/lmic/lmic.c @@ -711,7 +711,7 @@ static CONST_TABLE(u1_t, macCmdSize)[] = { static u1_t getMacCmdSize(u1_t macCmd) { if (macCmd < 2) return 0; - if (macCmd >= LENOF_TABLE(macCmdSize) - 2) + if ((macCmd - 2) >= LENOF_TABLE(macCmdSize)) return 0; return TABLE_GET_U1(macCmdSize, macCmd - 2); } From 9ed48caaa7ab2da13ae860d16865c4cb8b7c5efd Mon Sep 17 00:00:00 2001 From: Klaus Date: Mon, 21 Oct 2019 19:27:16 +0200 Subject: [PATCH 2/3] Set class B flag if pingable fix #480 --- src/lmic/lmic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lmic/lmic.c b/src/lmic/lmic.c index d2dd8299..cf782fe9 100644 --- a/src/lmic/lmic.c +++ b/src/lmic/lmic.c @@ -1889,6 +1889,9 @@ static bit_t buildDataFrame (void) { LMIC.frame[OFF_DAT_HDR] = HDR_FTYPE_DAUP | HDR_MAJOR_V1; LMIC.frame[OFF_DAT_FCT] = (LMIC.dnConf | LMIC.adrEnabled | (sendAdrAckReq() ? FCT_ADRACKReq : 0) +#if !defined(DISABLE_PING) + | ((LMIC.opmode & OP_PINGABLE) ? FCT_CLASSB : 0) +#endif // ndef DISABLE_PING | (end-OFF_DAT_OPTS)); os_wlsbf4(LMIC.frame+OFF_DAT_ADDR, LMIC.devaddr); From b7bee3f0a7a4eb4bb831f99eacd43e25ce8e9c44 Mon Sep 17 00:00:00 2001 From: sualko Date: Wed, 23 Oct 2019 00:04:17 +0200 Subject: [PATCH 3/3] Fix beacon frequence in europe --- src/lmic/lmic_eu868.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lmic/lmic_eu868.c b/src/lmic/lmic_eu868.c index f8d51d15..d77ab34e 100644 --- a/src/lmic/lmic_eu868.c +++ b/src/lmic/lmic_eu868.c @@ -236,7 +236,7 @@ ostime_t LMICeu868_nextTx(ostime_t now) { #if !defined(DISABLE_BEACONS) void LMICeu868_setBcnRxParams(void) { LMIC.dataLen = 0; - LMIC.freq = LMIC.channelFreq[LMIC.bcnChnl] & ~(u4_t)3; + LMIC.freq = FREQ_BCN; LMIC.rps = setIh(setNocrc(dndr2rps((dr_t)DR_BCN), 1), LEN_BCN); } #endif // !DISABLE_BEACONS