[RF69] Moved reset to chip detection loop

This commit is contained in:
jgromes 2020-01-06 17:20:43 +01:00
parent 9da1573df0
commit a4eeefada0

View file

@ -17,13 +17,14 @@ int16_t RF69::begin(float freq, float br, float rxBw, float freqDev, int8_t powe
_mod->init(RADIOLIB_USE_SPI); _mod->init(RADIOLIB_USE_SPI);
Module::pinMode(_mod->getIrq(), INPUT); Module::pinMode(_mod->getIrq(), INPUT);
// reset the module
reset();
// try to find the RF69 chip // try to find the RF69 chip
uint8_t i = 0; uint8_t i = 0;
bool flagFound = false; bool flagFound = false;
while((i < 10) && !flagFound) { while((i < 10) && !flagFound) {
// reset the module
reset();
// check version register
uint8_t version = _mod->SPIreadRegister(RF69_REG_VERSION); uint8_t version = _mod->SPIreadRegister(RF69_REG_VERSION);
if(version == 0x24) { if(version == 0x24) {
flagFound = true; flagFound = true;