Move SPI buffer new (memory allocation) to before isConnected
This commit is contained in:
@@ -469,15 +469,6 @@ boolean SFE_UBLOX_GNSS::begin(SPIClass &spiPort, uint8_t csPin, uint32_t spiSpee
|
|||||||
|
|
||||||
createFileBuffer();
|
createFileBuffer();
|
||||||
|
|
||||||
// Call isConnected up to three times
|
|
||||||
boolean connected = isConnected();
|
|
||||||
|
|
||||||
if (!connected)
|
|
||||||
connected = isConnected();
|
|
||||||
|
|
||||||
if (!connected)
|
|
||||||
connected = isConnected();
|
|
||||||
|
|
||||||
//Create the SPI buffer
|
//Create the SPI buffer
|
||||||
if (spiBuffer == NULL) //Memory has not yet been allocated - so use new
|
if (spiBuffer == NULL) //Memory has not yet been allocated - so use new
|
||||||
{
|
{
|
||||||
@@ -489,6 +480,7 @@ boolean SFE_UBLOX_GNSS::begin(SPIClass &spiPort, uint8_t csPin, uint32_t spiSpee
|
|||||||
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
|
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
|
||||||
{
|
{
|
||||||
_debugSerial->print(F("begin (SPI): memory allocation failed for SPI Buffer!"));
|
_debugSerial->print(F("begin (SPI): memory allocation failed for SPI Buffer!"));
|
||||||
|
return (false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -500,6 +492,15 @@ boolean SFE_UBLOX_GNSS::begin(SPIClass &spiPort, uint8_t csPin, uint32_t spiSpee
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Call isConnected up to three times
|
||||||
|
boolean connected = isConnected();
|
||||||
|
|
||||||
|
if (!connected)
|
||||||
|
connected = isConnected();
|
||||||
|
|
||||||
|
if (!connected)
|
||||||
|
connected = isConnected();
|
||||||
|
|
||||||
return (connected);
|
return (connected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user