4// Include sdkconfig file it it exists to allow overwriting of some defines with the configuration entered in the Espressif IDF menuconfig.
5// Only available when compiling for Espressif IDF, but allows to more easily change some configurations with a GUI instead of code.
6# ifdef __has_include
7# if __has_include(<sdkconfig.h>)
8# include <sdkconfig.h>
9# endif
10# endif
11
12// Include the internal version of the ESP IDF contained in the esp_idf_version file, if it exists, to allow checking for supported ESP IDF version.
13# ifdef __has_include
14# if __has_include(<esp_idf_version.h>)
15# include <esp_idf_version.h>
16# endif
17# endif
18
19// Enabled the usage of int64_t and double values with ArduinoJson. Making the JsonVariant store double and int64_t instead of float and int32_t.
20// See https://arduinojson.org/v6/api/config/use_long_long/ for more information. Use double is now enabled by default since ArduinoJson 6.19.4
21// and use long long as well, if the board is 32 bits. However because this library supports non 32-bit boards we still have to override the defines to ensure
22// both settings are actually enabled. See https://arduinojson.org/news/2022/01/08/arduinojson-6-19-0/#default-configuration for more information.
58// Use the esp_timer header internally for handling timeouts and callbacks, as long as the header exists, because it is more efficient than the Arduino Ticker implementation.
59// That is because we can stop the timer without having to delete it, removing the need to create a new timer to restart it, instead it can simply be stopped and started again.
60// Only exists following major version 3 minor version 0 on ESP32 (https://github.com/espressif/esp-idf/releases/tag/v3.0-rc1)and major version 3 minor version 1 on ESP8266 (https://github.com/espressif/ESP8266_RTOS_SDK/releases/tag/v3.1-rc1)
73// Use the mqtt_client header internally for handling the sending and receiving of MQTT data, as long as the header exists,
74// to allow users that do have the needed component to use the Espressif_MQTT_Client instead of only the Arduino_MQTT_Client.
75// Only exists following major version 3 minor version 2 on ESP32 (https://github.com/espressif/esp-idf/releases/tag/v3.2) and major version 3 minor version 4 on ESP8266 (https://github.com/espressif/ESP8266_RTOS_SDK/releases/tag/v3.4).
88// Use the mbed_tls header internally for handling the creation of hashes from binary data, as long as the header exists,
89// because if it is already included we do not need to rely on and incude external lbiraries like Seeed_mbedtls.h, which implements the same features.
90// Only exists following major version 0 minor version 9 on ESP32 (https://github.com/espressif/esp-idf/releases/v0.9) and major version 3 minor version 3 on ESP8266 (https://github.com/espressif/ESP8266_RTOS_SDK/releases/tag/v3.3-rc1).
103// Use the esp_ota_ops header internally for handling the writing of ota update data, as long as the header exists,
104// to allow users that do have the needed component to use the Espressif_Updater instead of only the Arduino_ESP32_Updater.
105// Only exists following major version 1 minor version 0 on ESP32 (https://github.com/espressif/esp-idf/releases/v0.9) and major version 3 minor version 0 on ESP8266 (https://github.com/espressif/ESP8266_RTOS_SDK/releases/tag/v3.0-rc1).
106// Additionally, for all the expected API calls to be implemented atleast major version 2 minor version 1 on ESP32 and major version 3 minor version 0 on ESP8266 is required.
128// Enables the ThingsBoard class to print all received and sent messages and their topic, from and to the server,
129// additionally some more debug messages will be printed. Requires more flash memory, and more calls to the logger implementation requiring more performance.
130// Recommended to disable when building for release, should only be enabled to debug where a issue might stem from.
131// Can also optionally be configured via the ESP-IDF menuconfig, if that is the done the value is set to the value entered in the menuconfig,
132// if the value is manually overriden tough with a #define before including ThingsBoard then the hardcoded value takes precendence.
137// Use the StreamUtils header internally for enabling the usage of an additonal library as a fallback, as long as the header exists,
138// to allow to directly serialize a json message that is sent to the cloud, if the size of that message would be bigger than the internal buffer size of the client.
139// Allows sending much bigger messages than would otherwise be possible, and without the need to increase stack or heap requirements, but at the cost of increased send times.
140// See https://arduinojson.org/v6/how-to/use-arduinojson-with-pubsubclient/#serializing-a-json-document-into-an-mqtt-message for the main difference in the underlying code.
141// Option can only be enabled when using Arduino, because this feature relies on Arduino as it improves the underlying data streams to directly write the data into the MQTT Client,
142// but writing each byte one by one, would be too slow, therefore the ArduinoStreamUtils (https://github.com/bblanchon/ArduinoStreamUtils) library is used to buffer those calls into bigger packets.
143// This allows sending data that is very big without requiring to allocate that much memory, because it is sent in smaller packets.
144// To support this feature, however the IMQTT_Client interface implementation, needs to additionally override the Print interface, because that is required by the wrapper class BufferingPrint.
157// Enables the ThingsBoard class to save the allocated memory of the DynamicJsonDocument into psram instead of onto the sram.
158// Enabled by default if THINGSBOARD_ENABLE_DYNAMIC has been set and the esp_heap_caps header exists, because it requries DynamicJsonDocument to work.
159// If enabled the program might be slightly slower, but all the memory will be placed onto psram instead of sram, meaning the sram can be allocated for other things.
160// See https://arduinojson.org/v6/how-to/use-external-ram-on-esp32/ and https://arduinojson.org/v6/api/basicjsondocument/ for the main difference in the underlying code.
161# ifndef THINGSBOARD_ENABLE_PSRAM
162# ifdef __has_include
163# if THINGSBOARD_ENABLE_DYNAMIC && __has_include(<esp_heap_caps.h>)