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
+11 -5

No files matched your search

+10 -4
View File
@@ -111,6 +111,7 @@
#endif #endif
// array to store previous received RFs, IRs codes and their timestamps // array to store previous received RFs, IRs codes and their timestamps
#if defined(ESP8266) || defined(ESP32) #if defined(ESP8266) || defined(ESP32)
#define MQTT_MAX_PACKET_SIZE 1024
#define array_size 12 #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}}; 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 #else
@@ -239,11 +240,12 @@ void callback(char* topic, byte* payload, unsigned int length) {
void setup() void setup()
{ {
//Launch serial for debugging purposes
Serial.begin(SERIAL_BAUD);
#if defined(ESP8266) || defined(ESP32) #if defined(ESP8266) || defined(ESP32)
//Launch serial for debugging purposes #ifdef ESP8266
#if defined(ZgatewaySRFB) || defined(ESP32) Serial.end();
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
Serial.begin(SERIAL_BAUD, SERIAL_8N1, SERIAL_TX_ONLY); Serial.begin(SERIAL_BAUD, SERIAL_8N1, SERIAL_TX_ONLY);
#endif #endif
#if defined(ESP8266) && !defined(ESPWifiManualSetup) #if defined(ESP8266) && !defined(ESPWifiManualSetup)
@@ -375,6 +377,10 @@ void setup()
#ifdef ZsensorGPIOInput #ifdef ZsensorGPIOInput
setupGPIOInput(); setupGPIOInput();
#endif #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 repeatIRwMQTT false // do we repeat a received signal by using mqtt
#define RawDirectForward false // direct repeat of IR signal with raw data #define RawDirectForward false // direct repeat of IR signal with raw data
#define RawFrequency 38 // raw frequency sending #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 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) #define PanasonicAddress 0x4004 // Panasonic address (Pre data)