mirror of
https://github.com/Genaker/LoraSA.git
synced 2026-03-28 17:42:59 +01:00
CAD method to get RSSI (basic)
This commit is contained in:
26
src/main.cpp
26
src/main.cpp
@@ -505,6 +505,25 @@ float getRSSI(void *param)
|
||||
#endif
|
||||
}
|
||||
|
||||
float getCAD(void *param)
|
||||
{
|
||||
Scan *r = (Scan *)param;
|
||||
|
||||
int16_t err = radio.scanChannel();
|
||||
if (err != RADIOLIB_ERR_NONE)
|
||||
{
|
||||
return -999;
|
||||
}
|
||||
|
||||
#ifdef USING_LR1121
|
||||
// LR1121 doesn't implement getRSSI(bool), getRSSI always
|
||||
// returns RSSI of the last packet
|
||||
return radio.getRSSI();
|
||||
#else
|
||||
return radio.getRSSI(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
Scan r;
|
||||
|
||||
#define WATERFALL_SENSITIVITY 0.05
|
||||
@@ -1596,6 +1615,13 @@ void loop(void)
|
||||
|
||||
if (config.detection_strategy.equalsIgnoreCase("RSSI"))
|
||||
g = &getRSSI;
|
||||
else if (config.detection_strategy.equalsIgnoreCase("CAD"))
|
||||
{
|
||||
g = &getCAD;
|
||||
samples = min(
|
||||
1,
|
||||
CONF_SAMPLES); // TODO: do we need to support values other than 1
|
||||
}
|
||||
else
|
||||
g = &getRSSI;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user