Skip to content

Commit 5fe5ae0

Browse files
committed
refactor(wifi): read handshake pin state via getHandshakePinState() consistently
1 parent 0f0c7d0 commit 5fe5ae0

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎src/system/wifi/esp32SpiAt.cpp‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ bool WiFiClass::getAtResponse(char *_response, uint32_t _bufferLen, unsigned lon
243243
while ((unsigned long)(millis() - _timeoutCounter) < _timeout)
244244
{
245245
// Wait for the response by checking the handshake pin.
246-
if (_esp32HandshakePinFlag)
246+
if (getHandshakePinState())
247247
{
248248
// Read the slave status.
249249
uint16_t _responseLen = 0;
@@ -315,11 +315,11 @@ bool WiFiClass::getSimpleAtResponse(char *_response, uint32_t _bufferLen, unsign
315315
_timeoutCounter = millis();
316316

317317
// Now loop until the timeout occurs
318-
while (((unsigned long)(millis() - _timeoutCounter) < _timeout) && (!_esp32HandshakePinFlag))
318+
while (((unsigned long)(millis() - _timeoutCounter) < _timeout) && (!getHandshakePinState()))
319319
;
320320

321321
// If the timeout occured, return false.
322-
if (!_esp32HandshakePinFlag)
322+
if (!getHandshakePinState())
323323
return false;
324324

325325
// Otherwise read the data.
@@ -1316,7 +1316,7 @@ bool WiFiClass::waitForHandshakePinInt(uint32_t _timeoutValue)
13161316
unsigned long _timeout = millis();
13171317

13181318
// Wait for the rising edge in Handshake pin.
1319-
while (((unsigned long)(millis() - _timeout) < _timeoutValue) && (!_esp32HandshakePinFlag))
1319+
while (((unsigned long)(millis() - _timeout) < _timeoutValue) && (!getHandshakePinState()))
13201320
;
13211321

13221322
// Clear the flag.
@@ -1620,7 +1620,7 @@ bool WiFiClass::flushModemReadReq()
16201620
{
16211621
// Now check the state of the handshake pin - if is set to high,
16221622
// ESP32 expects data read - flush needed.
1623-
if (_esp32HandshakePinFlag)
1623+
if (getHandshakePinState())
16241624
{
16251625
// Set return value to true since there is data to flush.
16261626
_retValue = true;
@@ -1630,7 +1630,7 @@ bool WiFiClass::flushModemReadReq()
16301630

16311631
// Keep it flushing until there is no more read requests. Bitwise check - READABLE and
16321632
// WRITEABLE are independent bits and can both be set at once.
1633-
while (_esp32HandshakePinFlag && (requestSlaveStatus(&_len) & INKPLATE_ESP32_SPI_SLAVE_STATUS_READABLE))
1633+
while (getHandshakePinState() && (requestSlaveStatus(&_len) & INKPLATE_ESP32_SPI_SLAVE_STATUS_READABLE))
16341634
{
16351635
// Clear the handshake flag.
16361636
_esp32HandshakePinFlag = false;

0 commit comments

Comments
 (0)