Fix AUnit in debug mode / Not async

This commit is contained in:
hsaturn
2021-04-11 17:02:24 +02:00
parent 24ee6b5201
commit b023cd67a9
2 changed files with 16 additions and 11 deletions

View File

@@ -167,7 +167,7 @@ void MqttBroker::loop()
} }
else 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. // Note: deleting a client not added by the broker itself will probably crash later.
delete client; delete client;
break; break;
@@ -288,7 +288,7 @@ void MqttClient::onConnect(void *mqttclient_ptr, TcpClient*)
debug("cnx: mqtt connecting"); debug("cnx: mqtt connecting");
msg.sendTo(mqtt); msg.sendTo(mqtt);
msg.reset(); msg.reset();
debug("cnx: mqtt sent " << (int32_t)mqtt->parent); debug("cnx: mqtt sent " << (dbg_ptr)mqtt->parent);
mqtt->clientAlive(0); mqtt->clientAlive(0);
} }
@@ -386,7 +386,7 @@ void MqttClient::processMessage(const MqttMessage* mesg)
#ifdef TINY_MQTT_DEBUG #ifdef TINY_MQTT_DEBUG
if (mesg->type() != MqttMessage::Type::PingReq && mesg->type() != MqttMessage::Type::PingResp) 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"); // mesg->hexdump("Incoming");
} }
#endif #endif

View File

@@ -3,20 +3,26 @@
// TODO Should add a AUnit with both TCP_ASYNC and not TCP_ASYNC // 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 // #define TCP_ASYNC // Uncomment this to use ESPAsyncTCP instead of normal cnx
#ifdef ESP8266 #if defined(ESP8266) || defined(EPOXY_DUINO)
#ifdef TCP_ASYNC #ifdef TCP_ASYNC
#include <ESPAsyncTCP.h> #include <ESPAsyncTCP.h>
#else #else
#include <ESP8266WiFi.h> #include <ESP8266WiFi.h>
#endif #endif
#elif defined(ESP32) #elif defined(ESP32)
#include <WiFi.h> #ifdef TCP_ASYNC
#include <AsyncTCP.h> // https://github.com/me-no-dev/AsyncTCP #include <AsyncTCP.h> // https://github.com/me-no-dev/AsyncTCP
#elif defined(EPOXY_DUINO) #else
#include <ESPAsyncTCP.h> #include <WiFi.h>
#endif
#else #else
#error "Unsupported platform" #error "Unsupported platform"
#endif #endif
#ifdef EPOXY_DUINO
#define dbg_ptr uint64_t
#else
#define dbg_ptr uint32_t
#endif
#include <vector> #include <vector>
#include <set> #include <set>
#include <string> #include <string>
@@ -24,7 +30,6 @@
#include <MqttStreaming.h> #include <MqttStreaming.h>
// #define TINY_MQTT_DEBUG // #define TINY_MQTT_DEBUG
#define TINY_MQTT_DEBUG
#ifdef TINY_MQTT_DEBUG #ifdef TINY_MQTT_DEBUG
#define debug(what) { Serial << __LINE__ << ' ' << what << endl; delay(100); } #define debug(what) { Serial << __LINE__ << ' ' << what << endl; delay(100); }