Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/helpers/radiolib/CustomSX1262Wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,22 @@
#include "CustomSX1262.h"
#include "RadioLibWrappers.h"

// RSSI_OFFSET is used to compensate for external LNA gain (e.g. Heltec V4)
// Set to a negative value equal to the LNA gain to get true RSSI values
#ifndef RSSI_OFFSET
#define RSSI_OFFSET 0
#endif

class CustomSX1262Wrapper : public RadioLibWrapper {
public:
CustomSX1262Wrapper(CustomSX1262& radio, mesh::MainBoard& board) : RadioLibWrapper(radio, board) { }
bool isReceivingPacket() override {
return ((CustomSX1262 *)_radio)->isReceiving();
}
float getCurrentRSSI() override {
return ((CustomSX1262 *)_radio)->getRSSI(false);
return ((CustomSX1262 *)_radio)->getRSSI(false) + RSSI_OFFSET;
}
float getLastRSSI() const override { return ((CustomSX1262 *)_radio)->getRSSI(); }
float getLastRSSI() const override { return ((CustomSX1262 *)_radio)->getRSSI() + RSSI_OFFSET; }
float getLastSNR() const override { return ((CustomSX1262 *)_radio)->getSNR(); }

float packetScore(float snr, int packet_len) override {
Expand Down
1 change: 1 addition & 0 deletions variants/heltec_v4/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ build_flags =
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
-D SX126X_CURRENT_LIMIT=140
-D SX126X_RX_BOOSTED_GAIN=1
-D RSSI_OFFSET=-17 ; GC1109 LNA gain compensation (17dB) - subtract to get true RSSI
-D PIN_GPS_RX=38
-D PIN_GPS_TX=39
-D PIN_GPS_RESET=42
Expand Down
Loading