Some memory optimization for Arduino UNO following this thread:

https://community.openmqttgateway.com/t/arduino-uno-ethernet-shield-reboots-on-receiving-rf-signal-on-v-0-9/346/22
Rework led management to avoid use of global variables
and specify special JSON_MSG_BUFFER for arduino UNO
led can now be used for all the boards

generalize use of F macro
for memory optimization
change jsonbuffer calculation method
reduce pubsubclient max packet size for uno and nano
This commit is contained in:
Florian committed 2019-03-09 17:28:54 +01:00
1 parent a34d476f04
commit da859cc6ae
22 files changed
+166 -131

No files matched your search

+23 -5
View File
@@ -26,7 +26,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*-------------------VERSION----------------------*/
#define OMG_VERSION "0.9"
#define OMG_VERSION "0.9.1beta"
/*-------------CONFIGURE WIFIMANAGER-------------(only ESP8266 & SONOFF RFBridge)*/
/*
@@ -137,9 +137,23 @@ const byte subnet[] = { 255, 255, 255, 0 }; //ip adress
#define ota_port 8266
/*-------------DEFINE PINs FOR STATUS LEDs----------------*/
#define led_receive 40
#define led_send 42
#define led_error 44
#ifdef ESP8266
#define led_receive 40
#define led_send 42
#define led_info 44
#elif ESP32
#define led_receive 40
#define led_send 42
#define led_info 44
#elif __AVR_ATmega2560__ //arduino mega
#define led_receive 40
#define led_send 42
#define led_info 44
#else //arduino uno/nano
#define led_receive 40
#define led_send 42
#define led_info 44
#endif
// VCC ------------D|-----------/\/\/\/\ ----------------- Arduino PIN
// LED Resistor 270-510R
@@ -166,7 +180,11 @@ const byte subnet[] = { 255, 255, 255, 0 }; //ip adress
#define multiCore //comment to don't use multicore function of ESP32 for BLE
#endif
#define JSON_MSG_BUFFER 512 // Json message max buffer size, don't put 1024 or higher it is causing unexpected behaviour on ESP8266
#if defined(ESP8266) || defined(ESP32) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
#define JSON_MSG_BUFFER 512 // Json message max buffer size, don't put 1024 or higher it is causing unexpected behaviour on ESP8266
#else // boards with smaller memory
#define JSON_MSG_BUFFER 64 // Json message max buffer size, don't put 1024 or higher it is causing unexpected behaviour on ESP8266
#endif
#define TimeBetweenReadingSYS 120000 // time between system readings (like memory)
#define subjectSYStoMQTT Base_Topic Gateway_Name "/SYStoMQTT"