diff --git a/external_components/hoermann_door/hciemulator.cpp b/external_components/hoermann_door/hciemulator.cpp index fdf83c5..a432d0b 100644 --- a/external_components/hoermann_door/hciemulator.cpp +++ b/external_components/hoermann_door/hciemulator.cpp @@ -1,4 +1,5 @@ #include "hciemulator.h" +#include #define CHECKCHANGEDSET(Target, Value, Flag) \ if ((Target) != (Value)) \ @@ -22,14 +23,19 @@ void LogCore(int Level, const char *msg, const unsigned char *data = NULL, size_ } if (data != NULL && datalen > 0) { - String newmsg(msg); + //std::string newmsg(msg); + char* newmsg = (char*)malloc(strlen(msg) + datalen * 3 + 1); + strncpy(newmsg, msg, strlen(msg) + 1); + newmsg[strlen(msg)] = '\0'; char str[4]; for (size_t i = 0; i < datalen; i++) { snprintf(str, sizeof(str), "%02x ", data[i]); - newmsg += str; + str[3] = '\0'; + strncat(newmsg, str, sizeof(str)); } - Serial.println(newmsg); + ESP_LOGD(TAG, newmsg); + free(newmsg); } else { diff --git a/external_components/hoermann_door/hoermann.h b/external_components/hoermann_door/hoermann.h index 235c2ff..056176f 100644 --- a/external_components/hoermann_door/hoermann.h +++ b/external_components/hoermann_door/hoermann.h @@ -46,7 +46,7 @@ class HoermannMainComponent: public Component{ dispatcherFn, // Function to implement the task "ModBusTask", // Name of the task 10000, // Stack size in words - true, // Task input parameter + this, // Task input parameter // 1, // Priority of the task configMAX_PRIORITIES - 1, &modBusTask, // Task handle.