The reference to IBM in the library name is, by now, confusing. Better
start with the primary name, "LMIC" and add "Arduino" to indicate this
is an arduino-specific port.
I added a variable to assist in printing the deadline for scheduled
jobs, but then decided to leave out the variable. Apparently, I left one
use of this variable in, breaking the build. Looking at it again, it's
probably best to keep the variable, though it's now renamed to be a bit
more logical.
This fixes#114.
This adds a lmic_printf macro that adds PSTR() around the format string
argument to put it into flash, and calls printf_P() instead of printf()
to get the format string from flash while printing. This greatly reduces
the RAM usage when LMIC_DEBUG_LEVEL is > 0 (and does not affect the
generated code otherwise).
The original LMIC AES implementation uses this variable to store
10x16 bytes of round keys, but for the other implementations (only
IDEETRON right now) this is only used to store the main key. In the
latter case, this variable only needs to be 16 bytes long, saving 160
bytes of RAM.
Before, when no packet was received in RX2, there would be a 3-5 second
delay (for EU868) before calling `processDnData()` and emitting
EV_TXCOMPLETE. This was the `DNW2_SAFETY_ZONE` to prevent a subsequent
TX to collide with a downlink packet that was ongoing but not locked on
to.
With this change, `txDelay()` is used to still delay the subsequent TX,
without delaying the `EV_TXCOMPLETE` event, which allows battery-powered
devices that wait for this event before sleeping to get an extra 3-5
seconds of sleep for each transmitted packet, improving battery life.
Closes: #16
The ESP core uses these same typedefs, but for 8-bit values instead of
8-byte values, so this prevents compilation on the ESP core. Ideally,
all of these custom LMIC typedefs should be replaced by the standard
types, but this is a change better made upstream. For now, only u8_t
and s8_t are replaced by their standard equivalent, to make things work
on ESP.
Previously, the raw data was printed, but since that is likely binary
data, this just prints the length. This should be sufficient to let
people know there is data and then write proper decoding for it.
Printing in hex would be useful, but printing an array of bytes in hex
is a bit cumbersome in Arduino.
`pendTxConf` is used to track whether the current TX data packet should
request confirmation. It is set by `LMIC_setTxData2()` and only used by
`buildDataFrame()`, so it plays no role during a join. When an automatic
join was started after queueing a confirmed uplink, clearing
`pendTxConf` causes the uplink to be send unconfirmed after the join is
complete, which does not seem like the intended behaviour.
Simply not touching `pendTxConf` in `LMIC_startJoining()` should
preserve the confirmed status properly throughout the join procedure.
During joining, LMIC.txCnt is used to keep track of retransmissions.
Normally, it is cleared in `LMIC_startJoining()` or `LMIC_setTxData()`
so it is 0 for each new packet. However, when an automatic joining
attempt is started when data is queued, txCnt would not be reset between
the join and the actual datapacket. If more than one join attempt was
needed, txCnt is non-zero and the data packet will be retried multiple
times. Since LMIC.pendTxConf is not set, the packets will not request an
ack, so the full number of retries is always used.
This is fixed by clearing txCnt after the join completes.
In 03ec06b (Reduce the default channel list), the list of join channels
was reduced. However, in `initJoinLoop()`, a random channel was selected
for the first join attempt, using a hardcoded amount of join channels,
which still had the old value.
This means that half of the join attempts would use an invalid channel,
configuring a frequency of 0Mhz into the radio, preventing the join
request from being received. Each subsequent join uses a next channel,
so after at most three join requests valid channels are used again.
Eventually a join would complete, but this bug might cause extra delays
in joining.
The original LMIC AES implementation is optimized for fast execution on
32bit processors, but it ends up taking a lot of flash space on 8-bit
AVR processors. This commit adds an alternative AES implementation
written by Ideetron, which is a lot smaller, but also about twice as
slow as the original imlementation. This new implementation is selected
by default, but the original can be used by modifying config.h.
When using beacons and ping slots, there is already support for
measuring the actual clock drift and compensating for it. However, class
A nodes have no beacons to measure their drift, so this commit allows
them to configure the maximum clock error (e.g. +/- 1%) and increases
the receive windows to ensure that even with the worst-case clock
values, messages will be received.
Note that because the receive window is measures in symbols, with a high
drift rate and/or high datarate the resulting receive window might be
smaller than it should be. This could be slightly improved by using all
10 bits available in the hardware register (currently only 8 bits are
used).
Also note that this moves the calculation of rxsyms into schedRx12,
since the receive window length can be different between RX1 and RX2
(previously it was set only for RX1 and kept around). As a side effect,
this probably breaks FSK reception, since txDone checks rxsyms to see if
it is DR_FSK and sets the length differently. With the current code,
schedRx12 will override that rxsyms value for RX2. However, I could not
find where rxsyms is ever set to DR_FSK (and it does not seem sane to
use that variable like that), so I wonder if FSK reception will work at
all.
It seems I miscalculated the symbol time used in an example. Also, this
commit adds a note about the fastest datarate used in LoRaWAN
(previously only the LoRa maximum was mentioned).
This reduces some code duplication, and prepares for an upcoming change
that makes the scheduling a bit more complex.
To reflect the more generic usage of this function, it is renamed to
schedRx12.
This previously referred to SX1272 pins that are used as regulator
outputs, so powering those would actually be harmful. This resulted from
the fact that the SX1272 evaluation board has multiple power pins, but
it turns out these do not correspond to the SX1272 pins as I had
previously assumed.
The documentation now explicitely mentions the evaluation board pin
names, which should be more clear.
Before, enabling printf was needed for assertion failures to be printed.
However, printf support has more overhead than simply printing failures,
and the current implementation only works on AVR. Separating these
allows disabling printf support by default (in the next commit), without
also disabling failure printing.
The upstream version is 1.5, the .0 is added to comply with Arduino
semantic versioning requirements. And additional +arduino-0 version
number is added, which will be used to track changes in the
arduino-specific part of this library.