diff --git a/src/modules/SX128x/SX1280.cpp b/src/modules/SX128x/SX1280.cpp index cc4c97983..b5b30dd09 100644 --- a/src/modules/SX128x/SX1280.cpp +++ b/src/modules/SX128x/SX1280.cpp @@ -12,10 +12,11 @@ int16_t SX1280::range(bool master, uint32_t addr, uint16_t calTable[3][6]) { RADIOLIB_ASSERT(state); // wait until ranging is finished - uint32_t start = this->mod->hal->millis(); - while(!this->mod->hal->digitalRead(this->mod->getIrq())) { - this->mod->hal->yield(); - if(this->mod->hal->millis() - start > 10000) { + Module* mod = this->getMod(); + uint32_t start = mod->hal->millis(); + while(!mod->hal->digitalRead(mod->getIrq())) { + mod->hal->yield(); + if(mod->hal->millis() - start > 10000) { clearIrqStatus(); standby(); return(RADIOLIB_ERR_RANGING_TIMEOUT); diff --git a/src/modules/SX128x/SX128x.cpp b/src/modules/SX128x/SX128x.cpp index 6f14b536c..07d8661bf 100644 --- a/src/modules/SX128x/SX128x.cpp +++ b/src/modules/SX128x/SX128x.cpp @@ -6,10 +6,6 @@ SX128x::SX128x(Module* mod) : PhysicalLayer(RADIOLIB_SX128X_FREQUENCY_STEP_SIZE, this->mod = mod; } -Module* SX128x::getMod() { - return(this->mod); -} - int16_t SX128x::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, int8_t pwr, uint16_t preambleLength) { // set module properties this->mod->init(); @@ -1347,6 +1343,10 @@ void SX128x::readBit(uint32_t pin) { } #endif +Module* SX128x::getMod() { + return(this->mod); +} + uint8_t SX128x::getStatus() { uint8_t data = 0; this->mod->SPIreadStream(RADIOLIB_SX128X_CMD_GET_STATUS, &data, 0); diff --git a/src/modules/SX128x/SX128x.h b/src/modules/SX128x/SX128x.h index 4029635f0..8d4526ac2 100644 --- a/src/modules/SX128x/SX128x.h +++ b/src/modules/SX128x/SX128x.h @@ -361,8 +361,6 @@ class SX128x: public PhysicalLayer { */ SX128x(Module* mod); - Module* getMod(); - // basic methods /*! @@ -782,11 +780,7 @@ class SX128x: public PhysicalLayer { #if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL protected: #endif - Module* mod; - -#if !RADIOLIB_GODMODE - protected: -#endif + Module* getMod(); // cached LoRa parameters float bandwidthKhz = 0; @@ -814,19 +808,16 @@ class SX128x: public PhysicalLayer { int16_t clearIrqStatus(uint16_t clearIrqParams = RADIOLIB_SX128X_IRQ_ALL); int16_t setRangingRole(uint8_t role); int16_t setPacketType(uint8_t type); - int16_t setHeaderType(uint8_t hdrType, size_t len = 0xFF); -#if !RADIOLIB_GODMODE && !RADIOLIB_LOW_LEVEL +#if !RADIOLIB_GODMODE private: #endif + Module* mod; // common low-level SPI interface static int16_t SPIparseStatus(uint8_t in); -#if !RADIOLIB_GODMODE - private: -#endif // common parameters uint8_t power = 0;