Greetings,
I'm not local. I'm sorry for mistakes.I have a code to connect to a 3d printer.
Code:
procedure TForm1.btnConnectClick(Sender: TObject);
begin
ComPort.Port := ComComboBox1.Text; // hier der Port als String
ComPort.BaudRate := br115200;
ComPort.DataBits := dbSeven;
ComPort.StopBits := sbOneStopBit;
ComPort.Parity.Bits := prEven;
ComPort.Buffer.InputSize := 1024; // musst du anpassen
ComPort.Buffer.OutputSize := 1024; // musst du anpassen
begin
try
ComPort.Open;
if ComPort.Connected then
begin
Memo.Text := Memo.Text + 'Connected to the
com serial port ('+ComPort.Port+')';
Memo.Lines.Add(''); //
end
else
Memo.Text := Memo.Text + 'Failed to open
com serial port ('+ComPort.Port+')';
Memo.Lines.Add(''); //
Except on E :
Exception do
begin
Memo.Text := Memo.Text + 'ERROR opening connection: Details> '+E.Message;
Memo.Lines.Add(''); //
end
end
end;
end;
procedure TForm1.ComPortOpen(Sender: TObject);
begin
btnConnect.Caption := 'Disconnect';
end;
procedure TForm1.ComPortClose(Sender: TObject);
begin
if btnConnect <> nil then
btnConnect.Caption := 'Connection';
end;
I don't know how to append this code to change the button
Code:
begin
if ComPort.Connected then
ComPort.Close
else
ComPort.Open;
end;
And how do I sort the Listing so that Echo is on each line
Code:
procedure TForm1.ComPortRxChar(Sender: TObject; Count: Integer);
var
Str: String;
begin
ComPort.ReadStr(Str, Count);
Memo.Text := Memo.Text + Str;
Memo.Lines.Add('');
end;
my idea
start
echo:Marlin 2.0.5.3
echo:
Free Memory: 1156 PlannerBufferBytes: 1200
echo:V76 stored settings retriev
ed (656 bytes; crc 27057)
echo: G21 ; Units in mm (mm)
echo: M149 C ; Units in Celsius
ech
o:; Filament settings: Disabled
echo: M200 D1.75
echo: M200 D0
echo:; Steps per
unit:
echo: M92 X80.00 Y80.00 Z400.00 E415.00
echo:; Maximum feedrates (units/s):
echo: M203 X500.00 Y500.00 Z10.00 E50.00
echo:; Maximum Acceleration (units/s2):
echo: M201 X500.00 Y500.00 Z100.00 E5000.00
echo:; Acceleration (units/s2
): P<print_accel> R<retract_accel> T<travel_accel>
UPDATE
Line spacing resolved. Removal echo code
Code:
procedure TForm1.ComPortRxChar(Sender: TObject; Count: Integer);
var
Str: String;
begin
ComPort.ReadStr(Str, Count);
Memo.Text := Memo.Text + Str;
[B][U] Memo.Lines.Text := StringReplace(Memo.Lines.Text,'echo:','',[rfReplaceAll, rfIgnoreCase]);[/U][/B]
Memo.Lines.Add('');
end;
and increase the Max length
Thank you for the answers and advice