diff --git a/src/arduinoWrapper/ArduinoConfig.h b/src/arduinoWrapper/ArduinoConfig.h index c02bde9..7b7e356 100644 --- a/src/arduinoWrapper/ArduinoConfig.h +++ b/src/arduinoWrapper/ArduinoConfig.h @@ -1,27 +1,29 @@ #pragma once -//#define ETHERNET // for WIZ5100 +// #define ETHERNET // for WIZ5100 //#define ETHERNET2 // for WIZ5500 #if defined(ETHERNET) || defined(ETHERNET2) #define ETH_MAC \ { \ - 0x11, 0x11, 0x22, 0x33, 0x44, 0x55 \ + 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED \ } // make sure that MAC is unique per device +/* #define ETH_IP \ - { \ - 192, 168, 5, 40 \ - } // device will use this IP if it can not get ip automatically +{ \ + 192, 168, 5, 40 \ +} // device will use this IP if it can not get ip automatically #define ETH_DNS \ - { \ - 192, 168, 5, 1 \ - } // IP of DNS server (router) +{ \ + 192, 168, 5, 1 \ +} // IP of DNS server (router) #define ETH_GATEWAY \ - { \ - 192, 168, 5, 1 \ - } // IP of internet gateway (router) +{ \ + 192, 168, 5, 1 \ +} // IP of internet gateway (router) #define ETH_SUBNET \ - { \ - 255, 255, 255, 0 \ - } // subnet (if you don't know what this is leave it like this) +{ \ + 255, 255, 255, 0 \ +} // subnet (if you don't know what this is leave it like this) +*/ #endif // defined(ETHERNET) || defined(ETHERNET2) diff --git a/src/arduinoWrapper/ArduinoEspWrapper.cpp b/src/arduinoWrapper/ArduinoEspWrapper.cpp index 160c322..b28721c 100644 --- a/src/arduinoWrapper/ArduinoEspWrapper.cpp +++ b/src/arduinoWrapper/ArduinoEspWrapper.cpp @@ -2,8 +2,7 @@ #include "ArduinoEspWrapper.h" #include "Arduino.h" #include "ArduinoDebugLed.h" - -//#define ESP_WRAPPER_DEBUG +#include "debugDefines.h" #define RESTART_TIME 1800000L // 30 minutes diff --git a/src/arduinoWrapper/ArduinoEthernetWrapper.cpp b/src/arduinoWrapper/ArduinoEthernetWrapper.cpp index b057a57..89f4fdf 100644 --- a/src/arduinoWrapper/ArduinoEthernetWrapper.cpp +++ b/src/arduinoWrapper/ArduinoEthernetWrapper.cpp @@ -4,13 +4,12 @@ #include "Arduino.h" #include "ArduinoDebugLed.h" #include "ArduinoEthernetWrapper.h" +#include "debugDefines.h" #ifndef ETH_MAC #error "You need to define ETH_MAC with mac address. Make sure it is unique" #endif -//#define ETHERNET_WRAPPER_DEBUG - static Client* m_client = nullptr; static char m_uid[20] = {'0'}; static unsigned long m_last_time_connected = 0; diff --git a/src/arduinoWrapper/ArduinoWrapper.cpp b/src/arduinoWrapper/ArduinoWrapper.cpp index b1df052..b2ead29 100644 --- a/src/arduinoWrapper/ArduinoWrapper.cpp +++ b/src/arduinoWrapper/ArduinoWrapper.cpp @@ -6,7 +6,7 @@ #include "PubSubClient.h" #include "helperFunctions.h" -//#define ARDUINO_WRAPPER_DEBUG +#include "debugDefines.h" // private vars: #define TOPIC_BUFFER_LENGTH 30 @@ -79,6 +79,7 @@ void wrapperSetup() #ifdef ARDUINO_WRAPPER_DEBUG Serial.print(F("Will topic: ")); Serial.println(m_will_topic); + Serial.flush(); #endif } @@ -178,6 +179,7 @@ bool wrapperReconnectMqtt() Serial.println(F("Trying to reconnect to mqtt broker")); #endif + // Attempt to connect if(m_mqtt_client.connect(getUniqueId(), m_username, m_password, m_will_topic, MQTTQOS1, true, "offline")) { diff --git a/src/debugDefines.h b/src/debugDefines.h index 14df0b0..6bd55b0 100644 --- a/src/debugDefines.h +++ b/src/debugDefines.h @@ -14,6 +14,9 @@ #define ENDPOINT_LEVEL_DEBUG #define ENDPOINT_IDENTIFY_DEBUG #define ENDPOINT_COLOR_DEBUG +#define ETHERNET_WRAPPER_DEBUG +#define ESP_WRAPPER_DEBUG +#define ARDUINO_WRAPPER_DEBUG #endif @@ -27,4 +30,7 @@ // #define ENDPOINT_MOTION_DEBUG // #define ENDPOINT_LEVEL_DEBUG // #define ENDPOINT_IDENTIFY_DEBUG -// #define ENDPOINT_COLOR_DEBUG \ No newline at end of file +// #define ENDPOINT_COLOR_DEBUG +// #define ETHERNET_WRAPPER_DEBUG +// #define ESP_WRAPPER_DEBUG +// #define ARDUINO_WRAPPER_DEBUG \ No newline at end of file