Tweaks for async direct mode usage with rtl_433_ESP
This commit is contained in:
parent
34a0d77998
commit
a74c0536b8
4 changed files with 25 additions and 8 deletions
|
@ -711,12 +711,25 @@ int16_t CC1101::setOOK(bool enableOOK) {
|
|||
return(setOutputPower(_power));
|
||||
}
|
||||
|
||||
float CC1101::getRSSI() const {
|
||||
float CC1101::getRSSI() {
|
||||
float rssi;
|
||||
if(_rawRSSI >= 128) {
|
||||
rssi = (((float)_rawRSSI - 256.0)/2.0) - 74.0;
|
||||
|
||||
if (_directMode) {
|
||||
if(_rawRSSI >= 128) {
|
||||
rssi = (((float)_rawRSSI - 256.0)/2.0) - 74.0;
|
||||
} else {
|
||||
rssi = (((float)_rawRSSI)/2.0) - 74.0;
|
||||
}
|
||||
} else {
|
||||
rssi = (((float)_rawRSSI)/2.0) - 74.0;
|
||||
uint8_t rawRssi = SPIreadRegister(RADIOLIB_CC1101_REG_RSSI);
|
||||
if (rawRssi >= 128)
|
||||
{
|
||||
rssi = ((rawRssi - 256) / 2) - 74;
|
||||
}
|
||||
else
|
||||
{
|
||||
rssi = (rawRssi / 2) - 74;
|
||||
}
|
||||
}
|
||||
return(rssi);
|
||||
}
|
||||
|
@ -907,6 +920,7 @@ int16_t CC1101::directMode(bool sync) {
|
|||
SPIsendCommand(RADIOLIB_CC1101_CMD_IDLE);
|
||||
|
||||
int16_t state = 0;
|
||||
_directMode = sync;
|
||||
if (sync) {
|
||||
// set GDO0 and GDO2 mapping
|
||||
state |= SPIsetRegValue(RADIOLIB_CC1101_REG_IOCFG0, RADIOLIB_CC1101_GDOX_SERIAL_CLOCK , 5, 0);
|
||||
|
|
|
@ -791,9 +791,11 @@ class CC1101: public PhysicalLayer {
|
|||
/*!
|
||||
\brief Gets RSSI (Recorded Signal Strength Indicator) of the last received packet.
|
||||
|
||||
\returns Last packet RSSI in dBm.
|
||||
or in asynchronous direct mode the current RSSI level
|
||||
|
||||
\returns RSSI in dBm.
|
||||
*/
|
||||
float getRSSI() const;
|
||||
float getRSSI();
|
||||
|
||||
/*!
|
||||
\brief Gets LQI (Link Quality Indicator) of the last received packet.
|
||||
|
@ -963,6 +965,7 @@ class CC1101: public PhysicalLayer {
|
|||
|
||||
bool _promiscuous = false;
|
||||
bool _crcOn = true;
|
||||
bool _directMode = true;
|
||||
|
||||
uint8_t _syncWordLength = 2;
|
||||
int8_t _power = 0;
|
||||
|
|
|
@ -297,7 +297,7 @@ int16_t SX1278::setGain(uint8_t gain) {
|
|||
// gain set to 0, enable AGC loop
|
||||
state |= _mod->SPIsetRegValue(RADIOLIB_SX127X_REG_RX_CONFIG, RADIOLIB_SX127X_AGC_AUTO_ON, 3, 3);
|
||||
} else {
|
||||
state |= _mod->SPIsetRegValue(RADIOLIB_SX127X_REG_RX_CONFIG, RADIOLIB_SX127X_AGC_AUTO_ON, 3, 3);
|
||||
state |= _mod->SPIsetRegValue(RADIOLIB_SX127X_REG_RX_CONFIG, RADIOLIB_SX1278_AGC_AUTO_OFF, 3, 3);
|
||||
state |= _mod->SPIsetRegValue(RADIOLIB_SX127X_REG_LNA, (gain << 5) | RADIOLIB_SX127X_LNA_BOOST_ON);
|
||||
}
|
||||
|
||||
|
|
|
@ -746,7 +746,7 @@ int16_t SX127x::setBitRate(float br) {
|
|||
|
||||
// check allowed bit rate
|
||||
if(_ook) {
|
||||
RADIOLIB_CHECK_RANGE(br, 1.2, 32.768, RADIOLIB_ERR_INVALID_BIT_RATE);
|
||||
RADIOLIB_CHECK_RANGE(br, 1.2, 32.768002, RADIOLIB_ERR_INVALID_BIT_RATE); // Found that 32.768 is 32.768002
|
||||
} else {
|
||||
RADIOLIB_CHECK_RANGE(br, 1.2, 300.0, RADIOLIB_ERR_INVALID_BIT_RATE);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue