Skip to content

Commit c3e32be

Browse files
authored
Merge pull request #748 from mcci-catena/issue677
Bug fixes and doc improvements
2 parents ecfd81e + 11f20d0 commit c3e32be

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
# Arduino-LMIC library
1+
# Arduino-LMIC library ("MCCI LoRaWAN LMIC Library")
22

33
This repository contains the IBM LMIC (LoRaWAN-MAC-in-C) library, slightly
44
modified to run in the Arduino environment, allowing using the SX1272,
55
SX1276 transceivers and compatible modules (such as some HopeRF RFM9x
66
modules and the Murata LoRa modules).
77

8+
> Note on names: the library was originally ported to Arduino by Matthijs Kooijman and Thomas Telkamp, and was named Arduino LMIC. Subsequently, MCCI did a lot of work to support other regions, and ultimately took over maintenance. The Arduino IDE doesn't like two libraries with the same name, so we had to come up with a new name. So in the IDE, it will appear as MCCI LoRaWAN LMIC Library; but all us know it by the primary header file, which is `<arduino_lmic.h>`.
9+
810
Information about the LoRaWAN protocol is summarized in [LoRaWAN-at-a-glance](doc/LoRaWAN-at-a-glance.pdf). Full information is available from the [LoRa Alliance](https://lora-alliance.org).
911

1012
A support forum is available at [forum.mcci.io](https://forum.mcci.io/c/device-software/arduino-lmic/5).
@@ -1247,7 +1249,7 @@ function uflt12f(rawUflt12)
12471249
- Fix Helium link in examples [#715](https://github.com/mcci-catena/arduino-lmic/issues/715), [#718](https://github.com/mcci-catena/arduino-lmic/pulls/718).
12481250
- Remove `XCHANNEL` support from US region [#404](https://github.com/mcci-catena/arduino-lmic/issues/404)
12491251
- Assign channels randomly without replacement [#515](https://github.com/mcci-catena/arduino-lmic/issues/515), [#619](https://github.com/mcci-catena/arduino-lmic/issues/619), [#730](https://github.com/mcci-catena/arduino-lmic/issues/730).
1250-
- Don't allow `LMIC_setupChannel()` to change default channels [#722](https://github.com/mcci-catena/arduino-lmic/issues/722).
1252+
- Don't allow `LMIC_setupChannel()` to change default channels [#722](https://github.com/mcci-catena/arduino-lmic/issues/722). Add `LMIC_queryNumDefaultChannels()` [#700](https://github.com/mcci-catena/arduino-lmic/issues/700).
12511253
- Don't accept out-of-range DRs from MAC downlink messages [#723](https://github.com/mcci-catena/arduino-lmic/issues/723)
12521254
- Adopt semantic versions completely [#726](https://github.com/mcci-catena/arduino-lmic/issues/726).
12531255
- Implement JoinAccept CFList processing for US/AU [#739](https://github.com/mcci-catena/arduino-lmic/issues/739).
@@ -1340,7 +1342,7 @@ This library started from the IBM V1.5 open-source code.
13401342

13411343
- [`@ngraziano`](https://github.com/ngraziano) did extensive testing and contributed numerous ADR-related patches.
13421344

1343-
There are many others, who have contributed code and also participated in discussions, performed testing, reported problems and results. Thanks to all who have participated.
1345+
There are many others, who have contributed code and also participated in discussions, performed testing, reported problems and results. Thanks to all who have participated. We hope to use something like [All Contributors](https://https://allcontributors.org/) to help keep this up to date, but so far the automation isn't working.
13441346

13451347
## Trademark Acknowledgements
13461348

src/lmic/lmic.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2875,7 +2875,11 @@ dr_t LMIC_feasibleDataRateForFrame(dr_t dr, u1_t payloadSize) {
28752875
}
28762876

28772877
static bit_t isTxPathBusy(void) {
2878-
return (LMIC.opmode & (OP_TXDATA|OP_JOINING)) != 0;
2878+
return (LMIC.opmode & (OP_POLL | OP_TXDATA | OP_JOINING | OP_TXRXPEND)) != 0;
2879+
}
2880+
2881+
bit_t LMIC_queryTxReady (void) {
2882+
return ! isTxPathBusy();
28792883
}
28802884

28812885
static bit_t adjustDrForFrameIfNotBusy(u1_t len) {
@@ -2895,6 +2899,10 @@ void LMIC_setTxData (void) {
28952899
}
28962900

28972901
void LMIC_setTxData_strict (void) {
2902+
if (isTxPathBusy()) {
2903+
return;
2904+
}
2905+
28982906
LMICOS_logEventUint32(__func__, ((u4_t)LMIC.pendTxPort << 24u) | ((u4_t)LMIC.pendTxConf << 16u) | (LMIC.pendTxLen << 0u));
28992907
LMIC.opmode |= OP_TXDATA;
29002908
if( (LMIC.opmode & OP_JOINING) == 0 ) {
@@ -2913,7 +2921,7 @@ lmic_tx_error_t LMIC_setTxData2 (u1_t port, xref2u1_t data, u1_t dlen, u1_t conf
29132921

29142922
// send a message w/o callback; do not adjust data rate
29152923
lmic_tx_error_t LMIC_setTxData2_strict (u1_t port, xref2u1_t data, u1_t dlen, u1_t confirmed) {
2916-
if ( LMIC.opmode & OP_TXDATA ) {
2924+
if (isTxPathBusy()) {
29172925
// already have a message queued
29182926
return LMIC_ERROR_TX_BUSY;
29192927
}
@@ -2933,7 +2941,7 @@ lmic_tx_error_t LMIC_setTxData2_strict (u1_t port, xref2u1_t data, u1_t dlen, u1
29332941
return LMIC_ERROR_TX_FAILED;
29342942
}
29352943
}
2936-
return 0;
2944+
return LMIC_ERROR_SUCCESS;
29372945
}
29382946

29392947
// send a message with callback; try to adjust data rate

src/lmic/lmic.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,9 +686,12 @@ bit_t LMIC_enableChannel(u1_t channel);
686686
bit_t LMIC_disableSubBand(u1_t band);
687687
bit_t LMIC_selectSubBand(u1_t band);
688688

689-
//! \brief get the number of (fixed) default channels before the progammable channels.
689+
//! \brief get the number of (fixed) default channels before the programmable channels.
690690
u1_t LMIC_queryNumDefaultChannels(void);
691691

692+
//! \brief check whether the LMIC is ready for a transmit packet
693+
bit_t LMIC_queryTxReady(void);
694+
692695
void LMIC_setDrTxpow (dr_t dr, s1_t txpow); // set default/start DR/txpow
693696
void LMIC_setAdrMode (bit_t enabled); // set ADR mode (if mobile turn off)
694697

0 commit comments

Comments
 (0)