Skip to content

Commit

Permalink
[SX127x] Added reset to home channel to FHSS examples (#1266)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgromes committed Oct 20, 2024
1 parent 4a155b1 commit cc720a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions examples/SX127x/SX127x_Receive_FHSS/SX127x_Receive_FHSS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ void setup() {

// set hop period in symbols
// this will also enable FHSS
Serial.print(F("[SX1278] Setting hopping period ... "));
state = radio.setFHSSHoppingPeriod(9);
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
Expand Down Expand Up @@ -153,6 +154,9 @@ void loop() {
// reset the counter
hopsCompleted = 0;

// return to home channel before the next transaction
radio.setFrequency(channels[0]);

// put the module back to listen mode
radio.startReceive();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ void setup() {

// set hop period in symbols
// this will also enable FHSS
Serial.print(F("[SX1278] Setting hopping period ... "));
state = radio.setFHSSHoppingPeriod(9);
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
Expand Down Expand Up @@ -147,7 +148,7 @@ void loop() {
hopsCompleted = 0;

// return to home channel before the next transaction
radio.setFrequency(channels[radio.getFHSSChannel() % numberOfChannels]);
radio.setFrequency(channels[0]);

// wait a second before transmitting again
delay(1000);
Expand Down

0 comments on commit cc720a7

Please sign in to comment.