Skip to content

Commit

Permalink
SPIDrv improved waitForSlaveReady function
Browse files Browse the repository at this point in the history
changed deault behaviour for watchdog kick and added timeout as
parameter
  • Loading branch information
andreagilardoni committed Dec 19, 2024
1 parent 89ca316 commit a275da5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/utility/spi_drv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,13 @@ void SpiDrv::waitForSlaveSign()
while (!waitSlaveSign());
}

void SpiDrv::waitForSlaveReady(bool const feed_watchdog)
void SpiDrv::waitForSlaveReady(bool const feed_watchdog, int timeout)
{
unsigned long const start = millis();
while (!waitSlaveReady())
{
if (feed_watchdog) {
if ((millis() - start) < 10000) {
if ((millis() - start) < timeout) {
WiFi.feedWatchdog();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/utility/spi_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class SpiDrv

static char spiTransfer(volatile char data);

static void waitForSlaveReady(bool const feed_watchdog = false);
static void waitForSlaveReady(bool const feed_watchdog = true, int timeout=6000);

//static int waitSpiChar(char waitChar, char* readChar);

Expand Down

0 comments on commit a275da5

Please sign in to comment.