Skip to content

Fix enum redeclaration issue when using WiFi and Ethernet for EthernetLinkStatus #260

Open
@rpineau

Description

When using other library that also declare this enum there is a conflict and triggers a compiler error.
Adding the #ifdef fixes the issue as if it's already declared in another include (arduino pico code for wifi from earlephilhower for example) there will not be a re-declaration.

diff --git a/src/Ethernet.h b/src/Ethernet.h
index 0045de8..73abfa3 100644
--- a/src/Ethernet.h
+++ b/src/Ethernet.h
@@ -53,11 +53,14 @@
 #include "Server.h"
 #include "Udp.h"

+#ifndef __EthernetLinkStatus__
+#define __EthernetLinkStatus__
 enum EthernetLinkStatus {
-       Unknown,
-       LinkON,
-       LinkOFF
+       Unknown,
+       LinkON,
+       LinkOFF
 };
+#endif

 enum EthernetHardwareStatus {
        EthernetNoHardware,

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: enhancementProposed improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions