Skip to content

Commit 3ecb771

Browse files
committed
Watchdog: include Arduino_ConnectionHandler.h instead of Wifi/Ethernet.h
In this way we can also use the more meaningful define BOARD_HAS_ETHERNET
1 parent 1a5d2db commit 3ecb771

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/utility/watchdog/Watchdog.cpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,17 @@
2929

3030
#ifdef ARDUINO_ARCH_SAMD
3131
# include <Adafruit_SleepyDog.h>
32-
# include <WiFi.h>
3332
# define SAMD_WATCHDOG_MAX_TIME_ms (16 * 1000)
3433
#endif /* ARDUINO_ARCH_SAMD */
3534

3635
#ifdef ARDUINO_ARCH_MBED
3736
# include <watchdog_api.h>
38-
# include <WiFi.h>
39-
# include <Ethernet.h>
4037
# define PORTENTA_H7_WATCHDOG_MAX_TIMEOUT_ms (32760)
4138
# define NANO_RP2040_WATCHDOG_MAX_TIMEOUT_ms (8389)
4239
#endif /* ARDUINO_ARCH_MBED */
4340

41+
#include <Arduino_ConnectionHandler.h>
42+
4443
/******************************************************************************
4544
* GLOBAL VARIABLES
4645
******************************************************************************/
@@ -127,13 +126,13 @@ static void mbed_watchdog_reset()
127126
#if defined (ARDUINO_PORTENTA_H7_WIFI_HAS_FEED_WATCHDOG_FUNC)
128127
static void mbed_watchdog_enable_network_feed(const bool use_ethernet)
129128
{
129+
#if defined(BOARD_HAS_ETHERNET)
130130
if(use_ethernet) {
131-
#if defined(ARDUINO_PORTENTA_H7_M7)
132131
Ethernet.setFeedWatchdogFunc(watchdog_reset);
132+
} else
133133
#endif
134-
} else {
135134
WiFi.setFeedWatchdogFunc(watchdog_reset);
136-
}
135+
137136
}
138137
#endif
139138

0 commit comments

Comments
 (0)