From 7258f78232ee50793a3edeed69a9f6b300fee233 Mon Sep 17 00:00:00 2001 From: seky Date: Tue, 29 Oct 2019 09:38:21 +0100 Subject: [PATCH 1/3] for some rason this mac was not allowed on my network --- src/arduinoWrapper/ArduinoConfig.h | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) 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) From 31fbd36cfedcd9b37fdcab453be9f1f550100274 Mon Sep 17 00:00:00 2001 From: seky Date: Tue, 29 Oct 2019 09:39:12 +0100 Subject: [PATCH 2/3] moved debug defines from wrappers to debugDefines --- src/arduinoWrapper/ArduinoEspWrapper.cpp | 3 +-- src/arduinoWrapper/ArduinoEthernetWrapper.cpp | 3 +-- src/arduinoWrapper/ArduinoWrapper.cpp | 8 +++++++- src/debugDefines.h | 8 +++++++- 4 files changed, 16 insertions(+), 6 deletions(-) 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..523e8db 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 } @@ -170,6 +171,8 @@ void wrapperSetUsernamePassword(const char* const username, const char* const pa // private functions: bool wrapperReconnectMqtt() { + Serial.println("Reconnect"); + Serial.flush(); #ifdef ARDUINO_WRAPPER_DEBUG if(m_username == nullptr) Serial.println(F("mqtt username is null")); @@ -178,6 +181,9 @@ bool wrapperReconnectMqtt() Serial.println(F("Trying to reconnect to mqtt broker")); #endif + + Serial.println("Trying to reconnect"); + Serial.flush(); // 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 From 281b53a36da7839dfc47e44af2105e069ac5bf12 Mon Sep 17 00:00:00 2001 From: seky Date: Tue, 29 Oct 2019 09:43:41 +0100 Subject: [PATCH 3/3] removed some serial outputs --- src/arduinoWrapper/ArduinoWrapper.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/arduinoWrapper/ArduinoWrapper.cpp b/src/arduinoWrapper/ArduinoWrapper.cpp index 523e8db..b2ead29 100644 --- a/src/arduinoWrapper/ArduinoWrapper.cpp +++ b/src/arduinoWrapper/ArduinoWrapper.cpp @@ -171,8 +171,6 @@ void wrapperSetUsernamePassword(const char* const username, const char* const pa // private functions: bool wrapperReconnectMqtt() { - Serial.println("Reconnect"); - Serial.flush(); #ifdef ARDUINO_WRAPPER_DEBUG if(m_username == nullptr) Serial.println(F("mqtt username is null")); @@ -182,8 +180,6 @@ bool wrapperReconnectMqtt() Serial.println(F("Trying to reconnect to mqtt broker")); #endif - Serial.println("Trying to reconnect"); - Serial.flush(); // Attempt to connect if(m_mqtt_client.connect(getUniqueId(), m_username, m_password, m_will_topic, MQTTQOS1, true, "offline")) {