Skip to content

Commit

Permalink
[LR11x0] LR-FHSS reception is not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
jgromes committed Sep 22, 2024
1 parent 0f6e765 commit 07bcf38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 30 deletions.
23 changes: 2 additions & 21 deletions examples/LR11x0/LR11x0_LR_FHSS_Modem/LR11x0_LR_FHSS_Modem.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
RadioLib LR11x0 LR-FHSS Modem Example
This example shows how to use LR-FHSS modem in LR11x0 chips.
This modem can only transmit data, and is not able to receive.
NOTE: The sketch below is just a guide on how to use
LR-FHSS modem, so this code should not be run directly!
Expand Down Expand Up @@ -68,9 +69,7 @@ void setup() {
}

void loop() {
// LR-FHSS modem can use the same transmit/receive methods
// as the LoRa modem, even their interrupt-driven versions

// LR-FHSS modem can only transmit!
// transmit LR-FHSS packet
int state = radio.transmit("Hello World!");
/*
Expand All @@ -89,22 +88,4 @@ void loop() {
Serial.println(state);
}

// receive LR-FHSS packet
String str;
state = radio.receive(str);
/*
byte byteArr[8];
int state = radio.receive(byteArr, 8);
*/
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("[LR1110] Received packet!"));
Serial.print(F("[LR1110] Data:\t"));
Serial.println(str);
} else if (state == RADIOLIB_ERR_RX_TIMEOUT) {
Serial.println(F("[LR1110] Timed out while waiting for packet!"));
} else {
Serial.print(F("[LR1110] Failed to receive packet, code "));
Serial.println(state);
}

}
13 changes: 4 additions & 9 deletions src/modules/LR11x0/LR11x0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,8 @@ int16_t LR11x0::receive(uint8_t* data, size_t len) {
timeout = (RadioLibTime_t)(((maxLen * 8.0) / brBps) * 1000.0 * 5.0);

} else if(modem == RADIOLIB_LR11X0_PACKET_TYPE_LR_FHSS) {
size_t maxLen = len;
if(len == 0) {
maxLen = 0xFF;
}
timeout = (RadioLibTime_t)(((maxLen * 8.0) / (RADIOLIB_LR11X0_LR_FHSS_BIT_RATE)) * 1000.0 * 5.0);
// this modem cannot receive
return(RADIOLIB_ERR_WRONG_MODEM);

} else {
return(RADIOLIB_ERR_UNKNOWN);
Expand Down Expand Up @@ -472,8 +469,7 @@ int16_t LR11x0::startReceive(uint32_t timeout, uint32_t irqFlags, uint32_t irqMa
state = getPacketType(&modem);
RADIOLIB_ASSERT(state);
if((modem != RADIOLIB_LR11X0_PACKET_TYPE_LORA) &&
(modem != RADIOLIB_LR11X0_PACKET_TYPE_GFSK) &&
(modem != RADIOLIB_LR11X0_PACKET_TYPE_LR_FHSS)) {
(modem != RADIOLIB_LR11X0_PACKET_TYPE_GFSK)) {
return(RADIOLIB_ERR_WRONG_MODEM);
}

Expand Down Expand Up @@ -521,8 +517,7 @@ int16_t LR11x0::readData(uint8_t* data, size_t len) {
state = getPacketType(&modem);
RADIOLIB_ASSERT(state);
if((modem != RADIOLIB_LR11X0_PACKET_TYPE_LORA) &&
(modem != RADIOLIB_LR11X0_PACKET_TYPE_GFSK) &&
(modem != RADIOLIB_LR11X0_PACKET_TYPE_LR_FHSS)) {
(modem != RADIOLIB_LR11X0_PACKET_TYPE_GFSK)) {
return(RADIOLIB_ERR_WRONG_MODEM);
}

Expand Down

0 comments on commit 07bcf38

Please sign in to comment.