Skip to content

Commit

Permalink
Repair example #256
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisxhe committed Feb 17, 2025
1 parent bdd534b commit 1ac3e92
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions examples/radio/SX1262/SX126x_Receive/SX126x_Receive.ino
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ void setup()
while (true);
}

// set carrier frequency to 433.5 MHz
if (radio.setFrequency(433.5) == RADIOLIB_ERR_INVALID_FREQUENCY) {
// set carrier frequency to 868.0 MHz
if (radio.setFrequency(868.0) == RADIOLIB_ERR_INVALID_FREQUENCY) {
Serial.println(F("Selected frequency is invalid for this module!"));
while (true);
}
Expand Down Expand Up @@ -102,6 +102,7 @@ void loop()
Serial.print(radio.getFrequencyError());
Serial.println(F(" Hz"));

lv_label_set_text_fmt(label1, "Recv :%s\nRSSI:%.2fdBm\nSNR:%.2f", str.c_str(), radio.getRSSI(), radio.getSNR());

} else if (state == RADIOLIB_ERR_RX_TIMEOUT) {
// timeout occurred while waiting for a packet
Expand Down
12 changes: 6 additions & 6 deletions examples/radio/SX1262/SX126x_Transmit/SX126x_Transmit.ino
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ void setup()

watch.begin();

// set carrier frequency to 433.5 MHz
if (radio.setFrequency(433.5) == RADIOLIB_ERR_INVALID_FREQUENCY) {
Serial.println(F("Selected frequency is invalid for this module!"));
while (true);
}

beginLvglHelper();

// initialize SX1262 with default settings
Expand All @@ -49,6 +43,12 @@ void setup()
while (true);
}

// set carrier frequency to 868.0 MHz
if (radio.setFrequency(868.0) == RADIOLIB_ERR_INVALID_FREQUENCY) {
Serial.println(F("Selected frequency is invalid for this module!"));
while (true);
}

label1 = lv_label_create(lv_scr_act());
lv_label_set_recolor(label1, true); /*Enable re-coloring by commands in the text*/
lv_label_set_text(label1, "SX126x_Transmit");
Expand Down

0 comments on commit 1ac3e92

Please sign in to comment.