adaptative MQTT MAX PACKET SIZE

change mqtt max packet size depending on the board and display the value on serial monitor
This commit is contained in:
Florian committed 2018-09-13 22:10:18 +02:00
1 parent ace5fe7161
commit cd3a2a0499
2 files changed
+14 -8

No files matched your search

+13 -7
View File
@@ -111,6 +111,7 @@
#endif
// array to store previous received RFs, IRs codes and their timestamps
#if defined(ESP8266) || defined(ESP32)
#define MQTT_MAX_PACKET_SIZE 1024
#define array_size 12
unsigned long ReceivedSignal[array_size][2] ={{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}};
#else
@@ -239,11 +240,12 @@ void callback(char* topic, byte* payload, unsigned int length) {
void setup()
{
//Launch serial for debugging purposes
Serial.begin(SERIAL_BAUD);
#if defined(ESP8266) || defined(ESP32)
//Launch serial for debugging purposes
#if defined(ZgatewaySRFB) || defined(ESP32)
Serial.begin(SERIAL_BAUD); // in the case of sonoff RF Bridge the link to the RF emitter/receiver is made by serial and need TX/RX
#else
#ifdef ESP8266
Serial.end();
Serial.begin(SERIAL_BAUD, SERIAL_8N1, SERIAL_TX_ONLY);
#endif
#if defined(ESP8266) && !defined(ESPWifiManualSetup)
@@ -251,13 +253,13 @@ void setup()
#else // ESP32 case we don't use Wifi manager yet
setup_wifi();
#endif
trc(F("OpenMQTTGateway mac: "));
trc(WiFi.macAddress());
trc(F("OpenMQTTGateway ip: "));
trc(WiFi.localIP().toString());
// Port defaults to 8266
ArduinoOTA.setPort(ota_port);
@@ -375,6 +377,10 @@ void setup()
#ifdef ZsensorGPIOInput
setupGPIOInput();
#endif
trc(F("MQTT_MAX_PACKET_SIZE"));
trc(MQTT_MAX_PACKET_SIZE);
trc(F("Setup OpenMQTTGateway end"));
}
+1 -1
View File
@@ -39,7 +39,7 @@
#define repeatIRwMQTT false // do we repeat a received signal by using mqtt
#define RawDirectForward false // direct repeat of IR signal with raw data
#define RawFrequency 38 // raw frequency sending
//#define DumpMode true // uncomment so as to see big dumps of IR codes, put also #define MQTT_MAX_PACKET_SIZE 1024 into the library pubsubclient.h by instead of #define MQTT_MAX_PACKET_SIZE 128
//#define DumpMode true // uncomment so as to see big dumps of IR codes
#define pubIRunknownPrtcl false // key to avoid mqtt publication of unknown IR protocol (set to true if you want to publish unknown protocol)
#define PanasonicAddress 0x4004 // Panasonic address (Pre data)