Skip to content

Commit bb69348

Browse files
committed
Dropped support for SX127x-based ground stations (#10)
1 parent e9ca4d4 commit bb69348

File tree

1 file changed

+13
-33
lines changed

1 file changed

+13
-33
lines changed

Code/GroundStation/GroundStation.ino

+13-33
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*
22
* FOSSA Ground Station Example
33
*
4-
* Tested on Arduino Uno and SX1278, can be used with any LoRa radio
5-
* from the SX127x or SX126x series. Make sure radio type (line 21)
6-
* and pin mapping (lines 26 - 29) match your hardware!
4+
* Tested on Arduino Uno and SX1268, can be used with any LoRa radio
5+
* from the SX126x series. Make sure radio type (line 37)
6+
* and pin mapping (lines 23 - 25) match your hardware!
77
*
88
* References:
99
*
@@ -19,29 +19,22 @@
1919
#include <RadioLib.h>
2020
#include <FOSSA-Comms.h>
2121

22-
#define RADIO_TYPE SX1278 // type of radio module to be used
23-
//#define RADIO_SX126X // also uncomment this line when using SX126x!!!
24-
2522
// pin definitions
2623
#define CS 10
27-
#define DIO0 2
28-
#define DIO1 3
24+
#define DIO1 2
2925
#define BUSY 9
3026

3127
// modem configuration
3228
#define FREQUENCY 436.7 // MHz
3329
#define BANDWIDTH 125.0 // kHz
3430
#define SPREADING_FACTOR 11
3531
#define CODING_RATE 8 // 4/8
36-
#define SYNC_WORD_7X 0xFF // sync word when using SX127x
37-
#define SYNC_WORD_6X 0x0F0F // SX126x
32+
#define SYNC_WORD 0x0F0F // sync word
33+
#define OUTPUT_POWER 21 // dBm
34+
#define CURRENT_LIMIT 200 // mA
3835

3936
// set up radio module
40-
#ifdef RADIO_SX126X
41-
RADIO_TYPE radio = new Module(CS, DIO0, BUSY);
42-
#else
43-
RADIO_TYPE radio = new Module(CS, DIO0, DIO1);
44-
#endif
37+
SX1268 radio = new Module(CS, DIO1, BUSY);
4538

4639
// flags
4740
volatile bool interruptEnabled = true;
@@ -199,19 +192,14 @@ void setup() {
199192
Serial.println(F("FOSSA Ground Station Demo Code"));
200193

201194
// initialize the radio
202-
#ifdef RADIO_SX126X
203-
int state = radio.begin(FREQUENCY,
204-
BANDWIDTH,
205-
SPREADING_FACTOR,
206-
CODING_RATE,
207-
SYNC_WORD_6X);
208-
#else
209195
int state = radio.begin(FREQUENCY,
210196
BANDWIDTH,
211197
SPREADING_FACTOR,
212198
CODING_RATE,
213-
SYNC_WORD_7X);
214-
#endif
199+
SYNC_WORD,
200+
OUTPUT_POWER,
201+
CURRENT_LIMIT);
202+
215203
if(state == ERR_NONE) {
216204
Serial.println(F("Radio initialization successful!"));
217205
} else {
@@ -221,11 +209,7 @@ void setup() {
221209
}
222210

223211
// attach the ISR to radio interrupt
224-
#ifdef RADIO_SX126X
225212
radio.setDio1Action(onInterrupt);
226-
#else
227-
radio.setDio0Action(onInterrupt);
228-
#endif
229213

230214
// begin listening for packets
231215
radio.startReceive();
@@ -272,11 +256,7 @@ void loop() {
272256
}
273257

274258
// set radio mode to reception
275-
#ifdef RADIO_SX126X
276259
radio.setDio1Action(onInterrupt);
277-
#else
278-
radio.setDio0Action(onInterrupt);
279-
#endif
280260
radio.startReceive();
281261
interruptEnabled = true;
282262
}
@@ -392,7 +372,7 @@ void loop() {
392372
}
393373

394374
} else {
395-
Serial.println(F("Reception failed, code "));
375+
Serial.print(F("Reception failed, code "));
396376
Serial.println(state);
397377

398378
}

0 commit comments

Comments
 (0)