I don’t understand how this part of the code works, and I don’t even know why we use this library.
I would appreciate an explanation.
#ifdef DUMP_AT_COMMANDS
#include <StreamDebugger.h>
StreamDebugger debugger(SerialAT, SerialMon);
TinyGsm modem(debugger);
#else
TinyGsm modem(SerialAT);
#endif
It’s about ESP32 publishes data to cloud without Wi-Fi (TTGO T-Call ESP32 SIM800L)
It’s about ESP32 publishes data to cloud without Wi-Fi (TTGO T-Call ESP32 SIM800L)
Hi again.
That part of the code will include a library called StreamDebugger based on whether the DUMP_AT_COMMANDS macro is defined or not. In our case, it’s not because that line is commented in the code.
//#define DUMP_AT_COMMANDS
The StreamDebugger library is used to log and debug AT commands sent and received by the GSM module. I find it a bit confusing to use, I don’t think I use that in our examples.
We include this because it’s included in all library examples, even though it’s not used in our code.
In our case, because we don’t define the DUMP_AT_COMMANDS, it will use this line instead:
TinyGsm modem(SerialAT);
So, instead of this
#ifdef DUMP_AT_COMMANDS
#include <StreamDebugger.h>
StreamDebugger debugger(SerialAT, SerialMon);
TinyGsm modem(debugger);
#else
TinyGsm modem(SerialAT);
#endif
You can just include
TinyGsm modem(SerialAT);
Regards
Sara