meshtastic / c-sharp

C# / .NET 7 based command line interface for Meshtastic
GNU General Public License v3.0
23 stars 7 forks source link

Default SerialConnection issue #74

Open buldo opened 6 months ago

buldo commented 6 months ago

Maybe not an issue.
I have LILIGO T3 V1.6.1 connected to PC via default(onboard) USB-serial.
Web interface connects succesfully via WebUSB.
But I have problems with default SerialPort of this app.
I fixed my issue with next fix - I commented serial port config(DtrEnable, Handshake, WriteBufferSize ):

    public SerialConnection(ILogger logger, string port, int baudRate = Resources.DEFAULT_BAUD_RATE) : base(logger)
    {
        serialPort = new SerialPort(port, baudRate)
        {
            //DtrEnable = true,
            //Handshake = Handshake.XOnXOff,
            //WriteBufferSize = 8,
        };
    }

I understand that library have special constructor for overriding default values. But I want to understand is it problem with my device? Or meybe I have to not to use default usb/serial on board?

pfjason commented 6 months ago

I'm pretty sure it's the Handshake. In my branch to get it working consistently I had to set it to Handshake.None, then copy what the python library is doing and send the second framing byte a bunch of times to force the device to resync the packet stream. Take a look at #66, there are a few things up with the serial connection.