Skip to content

Commit

Permalink
fix lora problem
Browse files Browse the repository at this point in the history
  • Loading branch information
richonguzman authored Mar 24, 2024
1 parent ed9d80f commit 0ac2705
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions src/lora_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ namespace LoRa_Utils {
#endif
if (state == RADIOLIB_ERR_NONE) {
Serial.println("init : LoRa Module ... done!");
}
else {
} else {
Serial.println("Starting LoRa failed!");
while (true);
}
Expand Down Expand Up @@ -125,8 +124,7 @@ namespace LoRa_Utils {
LoRa.write('<');
if (typeOfMessage == "APRS") {
LoRa.write(0xFF);
}
else if (typeOfMessage == "LoRa") {
} else if (typeOfMessage == "LoRa") {
LoRa.write(0xF8);
}
LoRa.write(0x01);
Expand All @@ -142,14 +140,11 @@ namespace LoRa_Utils {
Utils::print("---> LoRa Packet Tx : ");
Utils::println(newPacket);
//Serial.println(F("success!"));
}
else if (state == RADIOLIB_ERR_PACKET_TOO_LONG) {
} else if (state == RADIOLIB_ERR_PACKET_TOO_LONG) {
Serial.println(F("too long!"));
}
else if (state == RADIOLIB_ERR_TX_TIMEOUT) {
} else if (state == RADIOLIB_ERR_TX_TIMEOUT) {
Serial.println(F("timeout!"));
}
else {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
}
Expand Down Expand Up @@ -205,10 +200,9 @@ namespace LoRa_Utils {
if (Config.syslog.active && WiFi.status() == WL_CONNECTED && loraPacket != "") {
SYSLOG_Utils::log("Rx", loraPacket, rssi, snr, freqError);
}
return loraPacket;
}
return loraPacket;
}
return loraPacket;
#endif
#ifdef HAS_SX126X
if (transmissionFlag) {
Expand All @@ -227,17 +221,14 @@ namespace LoRa_Utils {
}
return loraPacket;
}
}
else if (state == RADIOLIB_ERR_RX_TIMEOUT) {
} else if (state == RADIOLIB_ERR_RX_TIMEOUT) {
// timeout occurred while waiting for a packet
}
else if (state == RADIOLIB_ERR_CRC_MISMATCH) {
} else if (state == RADIOLIB_ERR_CRC_MISMATCH) {
Serial.println(F("CRC error!"));
if (Config.syslog.active && WiFi.status() == WL_CONNECTED) {
SYSLOG_Utils::log("Rx", "RADIOLIB_ERR_CRC_MISMATCH", 0,0,0);
}
}
else {
} else {
Serial.print(F("failed, code "));
Serial.println(state);
}
Expand Down

0 comments on commit 0ac2705

Please sign in to comment.