Commit graph

45 commits

Author SHA1 Message Date
StevenCellist
298a612699
[LoRaWAN] Change session activation (#1093)
* [LoRaWAN] Improve session restoration/activation behaviour

* [LoRaWAN] Custom return codes for session begin

* [LoRaWAN] Separate begin() and activate()

* [LoRaWAN] Fix activateABP()

* [LoRaWAN] Additional error-code

* [LoRaWAN] Fix rejoining during active session

* [LoRaWAN] Expose clearSession, drop `force`

* Update keywords...
2024-05-21 12:03:49 +02:00
StevenCellist
bb7fffe95d [LoRaWAN] Improve readability to better match documentation 2024-05-04 23:26:59 +02:00
StevenCellist
163a4020d2 [LoRaWAN] Consistent fCnt/fPort casing to match documents 2024-05-04 23:18:36 +02:00
StevenCellist
43adfee174 [LoRaWAN] Shorten LORAWAN to LW 2024-05-03 22:58:11 +02:00
StevenCellist
1b2b8bd67b
[LoRaWAN] Improve PHY behaviour, update beginABP, bugfixes (#1080)
* [LoRaWAN] Add getter for ToA, prevent MAC queue overflow

* [LoRaWAN] Permute arguments to beginABP

* Implement & split off checkOutputPower

* [LoRaWAN] Configure physical layer on each up/downlink

* [LoRaWAN] Remove unnecessary dynamic array

* [LoRaWAN] Improve downlink handling

* Resolve return-warnings in checkOutputPower()

* [LoRaWAN] Improve buffer definition

* [LoRaWAN] Prevent requesting repeated MAC commands

* Update keywords.txt

* [CC1101] Resolve unused variable warning

* [CC1101] Update checkOutputPower

* [SX1278] Fix variable assignment

* Update keywords.txt

* [CC1101] Added checkOutputPower override for PHY compatibility

* [LR11x0] Added checkOutputPower override for PHY compatibility

* [SX127x] Added checkOutputPower override for PHY compatibility

---------

Co-authored-by: jgromes <jan.gromes@gmail.com>
2024-05-01 13:35:22 +02:00
Elizabeth Myers
205031550b
Use RadioLibTime_t (aka unsigned long) when dealing with millis() and micros() (#1075)
* Use unsigned long when dealing with millis() and micros().

Although sizeof(uint32_t) == sizeof(unsigned long) on Arduino, this is
not the case on 64-bit Linux, where sizeof(unsigned long) ==
sizeof(uint64_t).

Most timestamp arithmetic and comparisons have been left alone, to
reduce code churn. This is fine, as uint32_t is perfectly wide to store
most timestamp deltas this library will deal with, and C will promote
the integer rather than do a narrowing conversion. The real problem
arises with narrowing conversions being done by assuming timestamps are
32-bit.

No functional changes intended for platforms where sizeof(uint32_t) ==
sizeof(unsigned long) (so most 8/16/32-bit platforms).

Signed-off-by: Elizabeth Myers <elizabeth.jennifer.myers@gmail.com>

* Change most timestamps to use RadioLibTime_t.

This makes it obvious what is and isn't a timestamp.

Not everything has been converted; anything dealing with protocol and
chip-level timestamps has been left alone on purpose, to make it clear
that these functions do require 32-bit timestamps.

No functional changes intended on platforms where sizeof(uint32_t) ==
sizeof(unsigned long).

Signed-off-by: Elizabeth Myers <elizabeth.jennifer.myers@gmail.com>

* Use uint32_t internally in getTimeOnAir.

We need to not overflow the integers with the shifts and
multiplications, so this is correct behaviour.

Signed-off-by: Elizabeth Myers <elizabeth.jennifer.myers@gmail.com>

---------

Signed-off-by: Elizabeth Myers <elizabeth.jennifer.myers@gmail.com>
2024-04-25 21:50:58 +02:00
StevenCellist
aa46a0c8b3 [LoRaWAN] Hide broken CSMA 2024-04-02 22:25:50 +02:00
StevenCellist
a4ad32e6ff [LoRaWAN] Fix downlink crashes (#1049), remove redundant parameter 2024-04-02 22:24:06 +02:00
Jan Gromeš
e57c9b08ea
[Doxygen] Warnings fixes (#1046)
* [APRS] Fix Doxygen warnings

* [Print] Fix Doxygen warnings

* [CC1101] Fixed doxygen warnings

* [nRF24] Fixed doxygen warnings

* [RF69] Fixed doxygen warnings

* [SX126x] Fixed doxygen warnings

* [SX127x] Fixed doxygen warnings

* [AFSK] Fixed doxygen warnings

* [APRS] Fixed doxygen warnings

* [Bell] Fixed doxygen warnings

* [Ext] Fixed doxygen warnings

* [LoRaWAN] Fixed doxygen warnings

* [PHY] Fixed doxygen warnings

* [Print] Fixed doxygen warnings

* [Mod] Fixed doxygen warnings
2024-04-01 11:11:24 +02:00
Jan Gromeš
648b455cff
[LoRaWAN] Added array of supported bands (#1032) 2024-03-26 06:57:25 +01:00
Jan Gromeš
cfc425970c
[LoRaWAN] Resolve warnings, fix bugs for fixed bands (#1021)
* [LoRaWAN] Resolve warnings

* [LoRaWAN] Fixed bands: improve initial datarate, fix CFList bug

* [LoRaWAN] Improve MAC debug output formatting

* Fix hexdump debug level

* Remove unnecessary error, add new ones to keywords

* [LoRaWAN] Discard useless check

---------

Co-authored-by: StevenCellist <steven@boonstoppel.nu>
2024-03-18 16:39:55 +01:00
StevenCellist
ca2a3073b9
[LoRaWAN] Change and upgrade persistence handling (#1017)
* [LoRaWAN] Change and upgrade persistence handling

* [BuildOpt] Patch to upstream

* [LoRaWAN] Fix #1018

* [LoRaWAN] Remove outdated parts

* [LoRaWAN] Resolve feedback

Warning: untested - am not at my desk

* [LoRaWAN] Small bugfixes
2024-03-18 08:51:38 +01:00
StevenCellist
5766d386af
[LoRaWAN] Improve persistence behaviour, add dwell time error, clear up debug output (#980)
* [LoRaWAN] Improve examples, add getter for DevAddr

* [ArduinoHAL] Only (over)write new values

* [HAL] Fix comment

* [TypeDef] Introduce error for LoRaWAN dwell time

* [LoRaWAN] Improve persistence behaviour, add dwell time error, clear up debug output

* [LoRaWAN] Prevent incorrect behaviour in restore()

* [LoRaWAN] Improve example comments and persistence

* [LoRaWAN] Fix DeviceTime and LinkCheck, fix FcntUp offset

* [LoRaWAN] Fix example incorrectly processing MAC commands

* [LoRaWAN] Fix downlink port, Fcnt 'underflow', user MAC processing

* [LoRaWAN] Add simple receive methods

* [LoRaWAN] Add co-author

Co-Authored-By: HeadBoffin <60431281+HeadBoffin@users.noreply.github.com>

* [LoRaWAN] Fix example output

* [LoRaWAN] Improve persistence behaviour, bugfix subband

* [LoRaWAN] Prevent useless rejoin during nonpersistent session

* [LoRaWAN] Graciously block an uplink if not joined

---------

Co-authored-by: HeadBoffin <60431281+HeadBoffin@users.noreply.github.com>
2024-02-27 17:29:45 +01:00
StevenCellist
0ea00fad44
[LoRaWAN] Improve examples, add getter for DevAddr (#974) 2024-02-15 20:36:03 +01:00
jgromes
1c8d2d5cfb [LoRaWAN] Typo fixes 2024-01-27 18:49:34 +01:00
jgromes
b2d1306e9e [LoRaWAN] Simplify variable length arrays (CI_BUILD_ALL) 2024-01-14 16:40:23 +01:00
StevenCellist
0bba68f3ae [LoRaWAN] Rework channel logic 2024-01-13 00:05:25 +01:00
StevenCellist
7c676f9393 [LoRaWAN] Implement requested changes 2024-01-08 22:33:34 +01:00
StevenCellist
2da09b5adc [LoRaWAN] Convert setDatarate() and setTxPower() to internal MAC; improve ADR 2024-01-06 15:03:55 +01:00
StevenCellist
574555ca09 [LoRaWAN] Revamp internal processing, key checking, new MAC commands, implement DutyCycle & DwellTime 2024-01-05 11:06:24 +01:00
StevenCellist
fc8d80c9de
Merge branch 'jgromes:master' into master 2023-12-09 10:31:13 +01:00
StevenCellist
62276e070b [LoRaWAN] Expose downlink framecounters 2023-12-09 10:28:13 +01:00
Andrzej Perczak
79fbe9be8e LoRaWAN: Fix uninitialized variables 2023-12-08 18:34:21 +01:00
jgromes
670e70bd9f [LoRaWAN] Reworked macro configuration system 2023-11-27 21:17:26 +01:00
StevenCellist
b6f6718f1f
[LoRaWAN] Add datarate into event structure (#885)
* [LoRaWAN] Move TX power logic to function

* Update keywords

* [LoRaWAN] Add datarate into event structure
2023-11-27 16:43:56 +01:00
StevenCellist
4703f58b7f [LoRaWAN] Add datarate into event structure 2023-11-27 16:20:06 +01:00
StevenCellist
b2b73ab21d
[LoRaWAN] Move TX power logic to function (#884)
* [LoRaWAN] Move TX power logic to function

* Update keywords
2023-11-27 16:10:47 +01:00
StevenCellist
594d8cbba1 [LoRaWAN] Move TX power logic to function 2023-11-27 12:39:14 +01:00
jgromes
063b42752f [LoRaWAN] Fixed a few warnings 2023-11-18 15:03:48 +01:00
jgromes
75a9420552 [LoRaWAN] Added event struct to pass extra info (#821) 2023-11-12 17:53:05 +01:00
StevenCellist
82258105b7
[LoRaWAN] Rework bands, official Rx windows, support ADR, confirm frames, improve EEPROM handling, support clock drift (#867)
* [LoRaWAN] rework bands, add ADR, partial MAC support

Known problem: terribly bad at receiving downlinks
Mask-list bands (e.g. US915) untested, likely a few bugs

* [LoRaWAN] Change Rx windows from CAD to RxSingle

* [LoRaWAN] improve persistence, better Rx windows, wear leveling, confirmed frames

* [LoRaWAN] Module-independent (OTAA) Rx windows, fix confirming downlinks

* [LoRaWAN] Implement SX127x support, fix MAC uplinking, support clock drift

* [ArduinoHal] fix clock drift calculation

* [LoRaWAN] Improve band & ADR logic, allow setting ADR, DR, subband, update examples

* [LoRaWAN] Fix EU868 coding rate, improve example

* [LoRaWAN] fix unused channel index

* [LoRaWAN] fix merge issue (deleted line)

* [LoRaWAN] fix CSMA calling now incorrect function

* [LoRaWAN] fix include logic

* [LoRaWAN] fix warnings, remove duplicate function

* [LoRaWAN] improve examples, add unified sendReceive, bugfixes, add FSK

* [LoRaWAN] improve examples

* [LoRaWAN] add new keywords, add debug guard

* [SX127x] Updated startReceive interface to be more in line with SX126x

* [SX127x] Added public method to convert from bytes to symbols

* [LoRaWAN] Update start receive for SX127x

* Added note about LoRaWAN beta

* [SX127x] Fixed potential float overflow

---------

Co-authored-by: jgromes <jan.gromes@gmail.com>
2023-11-12 14:02:39 +01:00
Amalinda Gamage
aca1d78a97
added functionality for LoRa Alliance TR-13 Enabling CSMA for LoRaWAN (#859)
* added functionality for LoRa Alliance TR-13 Enabling CSMA for LoRaWAN

* Addressed feedback on CSMA implementation

* symbolNumValues[6] array no longer needed as we will utilize only two symbol CAD operations for all SFs.
2023-10-29 14:19:00 +01:00
StevenCellist
556f37f608
[LoRaWAN] Implement full session persistence & more v1.1 specification (#835)
* Implement session persistence & more 1.1 protocol

* [LoRaW] Improve session persistence, check frame counters & Nonces, multiple MAC commands

* [LoRaWAN] fix popping MAC command from queue

I just realized that the method popMacCommand did not correctly remove items from the queue - this should solve the problem

* [LoRaWAN] implement improvements from #835

* [LoRaWAN] String --> uint8_t[]

* [LoRaWAN] Fix typo
2023-10-23 17:50:16 +02:00
jgromes
58eab402ad [LoRaWAN] Implemented most MAC commands 2023-09-14 20:58:46 +02:00
jgromes
a23d85c196 [LoRaWAN] Typo fixes 2023-09-13 17:05:19 +02:00
jgromes
3055613b6d [LoRaWAN] Added support for US bands and reworked channel selection process (#814) 2023-09-12 19:10:44 +02:00
jgromes
d170c02561 [LoRaWAN] Fixed initialization warnings 2023-08-26 20:34:37 +02:00
jgromes
16f0ba7cce [LoRaWAN] Implemented MAC command support 2023-08-23 19:22:23 +02:00
jgromes
cd9ac9916c [LoRaWAN] Added support for 1.1 and downlink (#58) 2023-08-12 19:49:37 +02:00
jgromes
0a6026e69e [LoRaWAN] Fixed typo in variable name 2023-07-20 18:43:49 +02:00
jgromes
6a7773e005 [LoRaWAN] Fixed APB begin 2023-07-16 16:34:32 +02:00
jgromes
8fd0a67a78 Typo fixes 2023-07-15 19:13:16 +02:00
jgromes
f354903864 [LoRaWAN] Added rev 1.1 checking 2023-07-06 18:50:04 +02:00
jgromes
a27d54716c [LoRaWAN] Added all official bands 2023-07-06 18:38:20 +02:00
jgromes
0d2ef419bf [LoRaWAN] Added basic LoRaWAN support (#58) 2023-07-06 13:41:31 +02:00