Prusa i3 Mk3s+ sequential gcode read and compose isn't steady
 
Benachrichtigungen
Alles löschen

Prusa i3 Mk3s+ sequential gcode read and compose isn't steady  

  RSS
Kadinhilperters
(@kadinhilperters)
Mitglied
Prusa i3 Mk3s+ sequential gcode read and compose isn't steady

I'm dealing with a long end of the week project where I needed to check whether I could send and print a GCODE document from my windows PC by means of the sequential port and C.

I'm getting the printer to associate however I'm not come by steady outcomes while attempting to keep in touch with the sequential stream. I'm not even certain that my sequential port settings are right, I was unable to find any genuine instances of how OctoPrint associates with my printer for instance. I think my concern is that I am sending an excess of information at the same time however I'm additionally battling to peruse from the sequential association and hang tight for as it were "Alright" as they appear to emerge from request. 

I can associate and send a solitary line, no issue. When I give it a whole document with many lines the printer gets to different pieces of the record and simply hangs.

How might I stream huge documents over the sequential port to a 3D printer without over-burdening the printers inner cradle?

Code I'm utilizing: 

private static async Task Main(string[] args)
{
    var ports = SerialPort.GetPortNames();

    if (!ports.Any())
    {
        Console.WriteLine("No ports found");
        Console.WriteLine("Press any key to continue...");
        Console.WriteLine();
        Console.ReadKey();
    }
    else
    {
        using (SerialPort mySerialPort = new SerialPort(ports.First()))
        {
            mySerialPort.BaudRate = 115200;
            mySerialPort.Parity = Parity.None;
            mySerialPort.StopBits = StopBits.One;
            mySerialPort.DataBits = 8;
            mySerialPort.Handshake = Handshake.None;

            mySerialPort.Open();

            mySerialPort.DataReceived += DataRecieved;

            using (var fileToPrint = File.OpenRead({Path to GCODE file})
            using (var lineReader = new StreamReader(fileToPrint))
            {
                while (!lineReader.EndOfStream && lineReader is not null)
                {
                    var line = await lineReader.ReadLineAsync() ?? string.Empty;

                    if (!line.StartsWith(";"))
                    {
                        var cleanLine = line. Split(";").First().Trim();

                        mySerialPort.WriteLine(cleanLine);
                    }
                }
            }

            Console.WriteLine("Press any key to continue...");
            Console.WriteLine();
            Console.ReadKey();

            mySerialPort.Close();
        }
    }
}

private static void DataRecieved(object sender, SerialDataReceivedEventArgs e)
{
    SerialPort sp = (SerialPort)sender;

    var line = sp.ReadLine();

    Console.WriteLine("Data from printer: {0}", line);
}
Veröffentlicht : 23/06/2023 10:45 am
Teilen: