Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix function and default regions #177

Merged
merged 6 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 84 additions & 11 deletions .github/workflows/BuildLibrary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,97 @@ jobs:
#############################################################################################################
arduino-boards-fqbn:
- arduino:avr:uno
- arduino:avr:leonardo
- arduino:avr:uno|All-US_915
- arduino:avr:leonardo|All-US_915
- arduino:samd:nano_33_iot|All-US_915
- arduino:samd:nano_33_iot
- arduino:mbed:nano33ble
- esp8266:esp8266:huzzah:eesz=4M3M,xtal=80
- arduino:mbed:nano33ble|All-US_915
- esp8266:esp8266:huzzah:eesz=4M3M,xtal=80|All-US_915
- rp2040:rp2040:generic|All-US_915
#- esp32:esp32:esp32:FlashFreq=80
#- esp32:esp32:featheresp32:FlashFreq=80|All-US_915

# Specify parameters for each board.
# Parameters can be: platform-url, examples-exclude and examples-build-properties
# With examples-exclude you may exclude specific examples for a board. Use a space separated list.
#############################################################################################################
include:
- arduino-boards-fqbn: arduino:avr:uno

- arduino-boards-fqbn: arduino:avr:leonardo

sketch-names: class_c_abp.ino,class_c_otaa_ack.ino # Comma separated list of sketch names (no path required) or patterns to use in build
build-properties:
class_c_abp:
-DDEBUG
-DEU_868
-D_CLASS_C_
class_c_otaa_ack:
-DDEBUG
-DEU_868
-D_CLASS_C_
All:
-DEU_868
-DDEBUG
- arduino-boards-fqbn: arduino:avr:uno|All-US_915
build-properties:
All:
-DUS_915
-DDEBUG
- arduino-boards-fqbn: arduino:avr:leonardo|All-US_915
build-properties:
All:
-DUS_915
-DDEBUG
- arduino-boards-fqbn: arduino:samd:nano_33_iot

- arduino-boards-fqbn: arduino:mbed:nano33ble

- arduino-boards-fqbn: esp8266:esp8266:huzzah:eesz=4M3M,xtal=80
build-properties:
class_c_abp:
-DDEBUG
-DEU_868
-D_CLASS_C_
class_c_otaa_ack:
-DDEBUG
-DEU_868
-D_CLASS_C_
All:
-DEU_868
- arduino-boards-fqbn: arduino:samd:nano_33_iot|All-US_915
build-properties:
All:
-DUS_915
-DDEBUG
- arduino-boards-fqbn: arduino:mbed:nano33ble|All-US_915
build-properties:
All:
-DUS_915
-DDEBUG
- arduino-boards-fqbn: esp8266:esp8266:huzzah:eesz=4M3M,xtal=80|All-US_915
platform-url: https://arduino.esp8266.com/stable/package_esp8266com_index.json
build-properties:
All:
-DUS_915
-DDEBUG
- arduino-boards-fqbn: rp2040:rp2040:generic|All-US_915
platform-url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
build-properties:
All:
-DUS_915
-DDEBUG
#- arduino-boards-fqbn: esp32:esp32:esp32:FlashFreq=80
# platform-url: https://github.com/espressif/arduino-esp32/releases/download/3.0.0-alpha2/package_esp32_dev_index.json
# extra-arduino-cli-args: "--warnings default"
# build-properties:
# class_c_abp:
# -DEU_868
# -D_CLASS_C_
# class_c_otaa_ack:
# -DEU_868
# -D_CLASS_C_
#All:
# -DEU_868
#- arduino-boards-fqbn: esp32:esp32:featheresp32:FlashFreq=80|All-US_915
# platform-url: https://github.com/espressif/arduino-esp32/releases/download/3.0.0-alpha2/package_esp32_dev_index.json
# extra-arduino-cli-args: "--warnings default"
# build-properties:
# All:
# -DUS_915

# Do not cancel all jobs / architectures if one job fails
fail-fast: false
Expand All @@ -65,4 +136,6 @@ jobs:
with:
arduino-board-fqbn: ${{ matrix.arduino-boards-fqbn }}
platform-url: ${{ matrix.platform-url }}
examples-exclude: DetectingReaders
build-properties: ${{ toJson(matrix.build-properties) }}
extra-arduino-cli-args: ${{ matrix.extra-arduino-cli-args }}

75 changes: 0 additions & 75 deletions examples/class-C-ABP/class_c_ABP/class_c_ABP.ino

This file was deleted.

22 changes: 11 additions & 11 deletions src/arduino-rfm/Config.h
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
//Uncomment for debug
//#define DEBUG

// To define your LoRaWAN frequency band here
//#define US_915
//#define AS_923
//#define AS_923_2
#define EU_868
//#define US_915
//#define EU_868
//#define AU_915
#define IN_865
//#define IN_865

#if !defined(AS_923) && !defined(AS_923_2) && !defined(EU_868) && !defined(US_915) && !defined(AU_915) &&!defined(IN_865)
#error "Select the Region in Config.h"
#endif

// If you dont define _CLASS_C_, CLASS_A mode will be on
#define _CLASS_C_
//#define _CLASS_C_

//Uncomment for debug
//#define DEBUG

// Define max payload size used for this node
#define MAX_UPLINK_PAYLOAD_SIZE 220
#define MAX_DOWNLINK_PAYLOAD_SIZE 220

#if !defined(AS_923) && !defined(AS_923_2) && !defined(EU_868) && !defined(US_915) && !defined(AU_915) &&!defined(IN_865)
#define US_915 // Define default Region
#endif

#ifdef US_915
//Select the subband you're working on
// make sure your gateway is working with the selected subband
Expand Down
2 changes: 2 additions & 0 deletions src/arduino-rfm/lorawan-arduino-rfm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,13 +436,15 @@ bool LoRaWANClass::readAck(void)
return false;
}

#ifdef _CLASS_C_
void LoRaWANClass::switchToClassC(sSettings *LoRa_Settings)
{
lora.setDeviceClass(CLASS_C);
LoRa_Settings->Channel_Rx = CHRX2; // set Rx2 channel 868.500 MHZ
LoRa_Settings->Datarate_Rx = SF12BW125; //set RX2 datarate 12
RFM_Continuous_Receive(LoRa_Settings);
}
#endif

void LoRaWANClass::onMessage(void(*callback)(sBuffer *Data_Rx, bool isConfirmed, uint8_t fPort))
{
Expand Down
12 changes: 6 additions & 6 deletions test/testFullfrequency/testFullfrequency.ino
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ byte recvStatus = 0;

byte _dataRate;
byte _channel;
byte _times;
byte times;

const sRFM_pins RFM_pins = {
.CS = 20,
Expand Down Expand Up @@ -65,7 +65,7 @@ void setup() {
counter.val = 0;
_channel = 0; // 0 - 7
_dataRate = 0; // 0 - 3
_times = 0;
times = 0;

// Put ABP Key and DevAddress here
lora.setNwkSKey(nwkSKey);
Expand All @@ -77,8 +77,8 @@ void loop() {
currentMillis = millis();
// Check interval overflow
if(currentMillis - previousMillis > interval) {
if(_times > 0){
_times = 0;
if(times > 0){
times = 0;
_dataRate++;
if (_dataRate > 3){
_dataRate = 0;
Expand Down Expand Up @@ -106,13 +106,13 @@ void loop() {
payload[0] = _channel;
payload[1] = _dataRate;
payload[2] = 15;
payload[3] = _times + 1;
payload[3] = times + 1;
payload[4] = counter._cb[1];
payload[5] = counter._cb[0];

lora.sendUplink(payload, 6, 0, 1);
counter.val++;
_times++;
times++;
}

// Check Lora RX
Expand Down
12 changes: 6 additions & 6 deletions test/testOTAA/testOTAA.ino
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ byte recvStatus = 0;

byte _dataRate;
byte _channel;
byte _times;
byte times;

const sRFM_pins RFM_pins = {
.CS = 20,
Expand Down Expand Up @@ -64,7 +64,7 @@ void setup() {
counter.val = 0;
_channel = 0; // 0 - 7
_dataRate = 0; // 0 - 3
_times = 0;
times = 0;

lora.setDevEUI(devEui);
lora.setAppEUI(appEui);
Expand All @@ -83,8 +83,8 @@ void loop() {
currentMillis = millis();
// Check interval overflow
if(currentMillis - previousMillis > interval) {
if(_times > 0){
_times = 0;
if(times > 0){
times = 0;
_dataRate++;
if (_dataRate > 3){
_dataRate = 0;
Expand Down Expand Up @@ -112,13 +112,13 @@ void loop() {
payload[0] = _channel;
payload[1] = _dataRate;
payload[2] = 15;
payload[3] = _times + 1;
payload[3] = times + 1;
payload[4] = counter._cb[1];
payload[5] = counter._cb[0];

lora.sendUplink(payload, 6, 0, 1);
counter.val++;
_times++;
times++;
}

// Check Lora RX
Expand Down