diff --git a/src/TinyMqtt.cpp b/src/TinyMqtt.cpp index 7171f4a..7a4f49d 100644 --- a/src/TinyMqtt.cpp +++ b/src/TinyMqtt.cpp @@ -167,7 +167,7 @@ void MqttBroker::loop() } else { - debug("Client " << client->id().c_str() << " Disconnected, parent=" << (int32_t)client->parent); + debug("Client " << client->id().c_str() << " Disconnected, parent=" << (dbg_ptr)client->parent); // Note: deleting a client not added by the broker itself will probably crash later. delete client; break; @@ -288,7 +288,7 @@ void MqttClient::onConnect(void *mqttclient_ptr, TcpClient*) debug("cnx: mqtt connecting"); msg.sendTo(mqtt); msg.reset(); - debug("cnx: mqtt sent " << (int32_t)mqtt->parent); + debug("cnx: mqtt sent " << (dbg_ptr)mqtt->parent); mqtt->clientAlive(0); } @@ -386,7 +386,7 @@ void MqttClient::processMessage(const MqttMessage* mesg) #ifdef TINY_MQTT_DEBUG if (mesg->type() != MqttMessage::Type::PingReq && mesg->type() != MqttMessage::Type::PingResp) { - Serial << "---> INCOMING " << _HEX(mesg->type()) << " client(" << (int)client << ':' << clientId << ") mem=" << ESP.getFreeHeap() << endl; + Serial << "---> INCOMING " << _HEX(mesg->type()) << " client(" << (dbg_ptr)client << ':' << clientId << ") mem=" << ESP.getFreeHeap() << endl; // mesg->hexdump("Incoming"); } #endif diff --git a/src/TinyMqtt.h b/src/TinyMqtt.h index 006c01e..ed96fb3 100644 --- a/src/TinyMqtt.h +++ b/src/TinyMqtt.h @@ -3,20 +3,26 @@ // TODO Should add a AUnit with both TCP_ASYNC and not TCP_ASYNC // #define TCP_ASYNC // Uncomment this to use ESPAsyncTCP instead of normal cnx -#ifdef ESP8266 +#if defined(ESP8266) || defined(EPOXY_DUINO) #ifdef TCP_ASYNC #include - #else - #include + #else + #include #endif #elif defined(ESP32) - #include - #include // https://github.com/me-no-dev/AsyncTCP -#elif defined(EPOXY_DUINO) - #include + #ifdef TCP_ASYNC + #include // https://github.com/me-no-dev/AsyncTCP + #else + #include + #endif #else #error "Unsupported platform" #endif +#ifdef EPOXY_DUINO + #define dbg_ptr uint64_t +#else + #define dbg_ptr uint32_t +#endif #include #include #include @@ -24,7 +30,6 @@ #include // #define TINY_MQTT_DEBUG -#define TINY_MQTT_DEBUG #ifdef TINY_MQTT_DEBUG #define debug(what) { Serial << __LINE__ << ' ' << what << endl; delay(100); }