From 4aa62e998268bb78e3a6a44018addd322e3c4de3 Mon Sep 17 00:00:00 2001 From: acidvegas Date: Thu, 6 Jun 2024 00:17:47 -0400 Subject: [PATCH] Lora recv loop added --- README.md | 5 +++-- src/apps/lora.cpp | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d591199..2ec8ba3 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ The device will scan for WiFi networks on boot. Once the list is displayed, you - [ ] GPS support - [ ] Lora support - [ ] BLE support +- [ ] SD card support ###### Features - [X] Wifi scanning & selection menu @@ -85,8 +86,8 @@ The device will scan for WiFi networks on boot. Once the list is displayed, you - [ ] Wardriving - [ ] Evil Portal AP - [ ] Local Network Probe *(Scans for devices on the wifi network you are connected to, add port scanning)* -- [ ] Gotify -- [ ] Meshtastic +- [ ] Gotify *(in progress)* +- [ ] Meshtastic *(in progress)* - [ ] Spotify/Music player *(can we play audio throuigh Bluetoth headphones or the on-board speaker?)* - [ ] Syslog *(All serial logs will be displayed here for on-device debugging)* diff --git a/src/apps/lora.cpp b/src/apps/lora.cpp index f0ffa13..232e30b 100644 --- a/src/apps/lora.cpp +++ b/src/apps/lora.cpp @@ -99,4 +99,39 @@ bool transmit() { Serial.println(state); return false; } +} + + +void recvLoop() { + String recv; + + while (true) { + if (radio.available()) { + int state = radio.readData(recv); + + if (state == RADIOLIB_ERR_NONE) { + Serial.print(F("[RADIO] Received packet!")); + + Serial.print(F(" Data:")); + Serial.print(recv); + + Serial.print(F(" RSSI:")); + Serial.print(radio.getRSSI()); + Serial.print(F(" dBm")); + // snprintf(dispRecvicerBuff[1], sizeof(dispRecvicerBuff[1]), "RSSI:%.2f dBm", radio.getRSSI()); + + Serial.print(F(" SNR:")); + Serial.print(radio.getSNR()); + Serial.println(F(" dB")); + } else if (state == RADIOLIB_ERR_CRC_MISMATCH) { + Serial.println(F("CRC error!")); + } else { + Serial.print(F("failed, code ")); + Serial.println(state); + } + } else { + Serial.println(F("Radio became unavailable!")); + break; + } + } } \ No newline at end of file