Merge pull request #169 from jgillula/listen_mode_encryption_fix

This is OK, but see my other comments on #171 
Fixing a bug with restoring encryption in listen mode
Fixes #170
This commit is contained in:
Felix Rusu 2021-09-20 09:44:32 -04:00 committed by GitHub
commit 3cbd159143
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -1046,8 +1046,9 @@ volatile uint16_t RFM69::RF69_LISTEN_BURST_REMAINING_MS = 0;
//=============================================================================
bool RFM69::reinitRadio()
{
bool haveEncryptKey = _haveEncryptKey;
if (!initialize(_freqBand, _address, _networkID)) return false;
if (_haveEncryptKey) RFM69::encrypt(_encryptKey); // Restore the encryption key if necessary
if (haveEncryptKey) encrypt(_encryptKey); // Restore the encryption key if necessary
if (_isHighSpeed) writeReg(REG_LNA, (readReg(REG_LNA) & ~0x3) | RF_LNA_GAINSELECT_AUTO);
return true;
}