You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use it with my ESP32-S3 MCU- it have multiple UART peripherals (many Serial instances in the Arduino environment)..
I specifically use the Virtual Serial Port (VCP) with USBSerial.begin(0); // baudrate have no meaning on VCP...
and USBSerial.println("LoRa!"); for example.
(Also Arduino Micro and Arduino Mega2560 have many Serial instances).
My problem is with the hard-coded Serial.print in this library - I cannot set it to print to other Serial instances..
I think the best solution is replacing all Serial.print with _stream.print, and add: LT.setLogStream(Stream &stream); that allows setting the output stream like I did here.
Another option is using a macro in the .h file like (replacing all Serial.print with SERIAL_DEV.print):
#ifndef SERIAL_DEV
#define SERIAL_DEV Serial
#endif
...
SERIAL_DEV.println(...);
So users can choose to define their own stream like:
Another option is like the first one - but every function that print something will get the stream as an argument-
So no need to add another LT.setLogStream function - but I think its better to just save an internal stream pointer..
Many libraries allows setting the I2C or SPI or UART streams, I also see an open PR 33 for SPI.
The text was updated successfully, but these errors were encountered:
I currently have no plans at present to make such a change.
Whilst the change itself might not be seen as time consuming, it would have to be made for the SX126x, SX127X and SX128X libraries. Checking that the change had been implemented correctly and that examples performed correctly would take a considerable amount of testing.
I have SX1280 so I can test its examples, maybe other who sees this issue and want that feature can offer testing :)
But if you go with my #2 implementing option (using a macro) - it is 100% backwards compatible down to the final compiled .hex file-
So testing can be done by comparing the compiled binaries before and after the change and make sure they are the same using a script (that script can be re-used to make sure all examples compiles after every small commit as well).
(I once wrote similar script using Arduino cli).
Hi,
This library is awesome! many thanks!
I use it with my ESP32-S3 MCU- it have multiple UART peripherals (many
Serial
instances in the Arduino environment)..I specifically use the Virtual Serial Port (VCP) with
USBSerial.begin(0); // baudrate have no meaning on VCP...
and
USBSerial.println("LoRa!");
for example.(Also Arduino Micro and Arduino Mega2560 have many
Serial
instances).My problem is with the hard-coded
Serial.print
in this library - I cannot set it to print to otherSerial
instances..I think the best solution is replacing all
Serial.print
with_stream.print
, and add:LT.setLogStream(Stream &stream);
that allows setting the output stream like I did here.Another option is using a macro in the .h file like (replacing all
Serial.print
withSERIAL_DEV.print
):So users can choose to define their own stream like:
But this one isn't very elegant..
So no need to add another
LT.setLogStream
function - but I think its better to just save an internal stream pointer..Many libraries allows setting the I2C or SPI or UART streams, I also see an open PR 33 for SPI.
The text was updated successfully, but these errors were encountered: