[SX127x] Added reset to home channel to FHSS examples (#1266)
This commit is contained in:
parent
4a155b1922
commit
cc720a7a24
2 changed files with 6 additions and 1 deletions
|
@ -86,6 +86,7 @@ void setup() {
|
||||||
|
|
||||||
// set hop period in symbols
|
// set hop period in symbols
|
||||||
// this will also enable FHSS
|
// this will also enable FHSS
|
||||||
|
Serial.print(F("[SX1278] Setting hopping period ... "));
|
||||||
state = radio.setFHSSHoppingPeriod(9);
|
state = radio.setFHSSHoppingPeriod(9);
|
||||||
if (state == RADIOLIB_ERR_NONE) {
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
Serial.println(F("success!"));
|
Serial.println(F("success!"));
|
||||||
|
@ -153,6 +154,9 @@ void loop() {
|
||||||
// reset the counter
|
// reset the counter
|
||||||
hopsCompleted = 0;
|
hopsCompleted = 0;
|
||||||
|
|
||||||
|
// return to home channel before the next transaction
|
||||||
|
radio.setFrequency(channels[0]);
|
||||||
|
|
||||||
// put the module back to listen mode
|
// put the module back to listen mode
|
||||||
radio.startReceive();
|
radio.startReceive();
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,7 @@ void setup() {
|
||||||
|
|
||||||
// set hop period in symbols
|
// set hop period in symbols
|
||||||
// this will also enable FHSS
|
// this will also enable FHSS
|
||||||
|
Serial.print(F("[SX1278] Setting hopping period ... "));
|
||||||
state = radio.setFHSSHoppingPeriod(9);
|
state = radio.setFHSSHoppingPeriod(9);
|
||||||
if (state == RADIOLIB_ERR_NONE) {
|
if (state == RADIOLIB_ERR_NONE) {
|
||||||
Serial.println(F("success!"));
|
Serial.println(F("success!"));
|
||||||
|
@ -147,7 +148,7 @@ void loop() {
|
||||||
hopsCompleted = 0;
|
hopsCompleted = 0;
|
||||||
|
|
||||||
// return to home channel before the next transaction
|
// return to home channel before the next transaction
|
||||||
radio.setFrequency(channels[radio.getFHSSChannel() % numberOfChannels]);
|
radio.setFrequency(channels[0]);
|
||||||
|
|
||||||
// wait a second before transmitting again
|
// wait a second before transmitting again
|
||||||
delay(1000);
|
delay(1000);
|
||||||
|
|
Loading…
Add table
Reference in a new issue