arduino-libraries / MKRWAN

An Arduino library for sending and receiving data using LoRaWAN protocol and LoRa® radios.
https://www.arduino.cc
GNU Lesser General Public License v3.0
87 stars 60 forks source link

Add functions to enable/disable channels #90

Closed giulcioffi closed 3 years ago

giulcioffi commented 3 years ago

This PR provides the functions to modify the channels mask using the AT command '+CHANMASK' (added in this commit ). The mask is intended to be a single-bit mask, so the user can enable/disable a channel using the related bit index. It is also possible to use a string of 24 characters to set the entire channel mask (6 channels of 4 characters). Only some regions allow to modify all the channels. For some others (like EU868), only the first 16 channels can be modified.

aalbinati commented 3 years ago

@facchinm It works as a charm!! I even tested it with the latest master commit included so as to verify it will work when pulled (@giulcioffi branch is one commit behind master). Thanks to both of you! Now I am able to join OTAA reliably adding just one line of code: modem.sendMask("ff000001f000ffff00020000"); This allows me to join on 8-channel gateways listening to AU915 sub-band 2