Closed coliss86 closed 2 years ago
sending 'N4 M280 P0 S90 T50*102'
is the issue. How did it start on line 4?
onHearError()
is where the dialog happens.
https://github.com/MarginallyClever/Makelangelo-software/commit/ead8a4149d7f10ec9229d0f17122154720183106#diff-4d19b6d9f314371405e605404a561089b61ddb1df76296768c24b1222a3e6315 is the commit that changed the popup dialog
https://github.com/MarginallyClever/Makelangelo-software/commit/c3538644617f7a2043ab374755a58a2bd1ec37a9 removed the popup but the robot still doesn't move after the 2nd opening of the dialog.
sending 'N4 M280 P0 S90 T50*102'
is the issue. How did it start on line 4?
It came from the first opening of the dialog box. I didn't find in the documentation of marlin a way to reset the counter of line expected when opening a new connection. Do you know how to do it ?
Another case to reproduce the issue is :
The robot will tell that the line number is not the value expected.
When the serial connection is opened the robot is reset.
When the robot is reset the robot's internal line number (A) is set to zero.
Every command sent from the app to the robot has a line number and checksum.
Every command is also queued so that if the robot says "please resend line n" it can pull that line. the queue is MarlinInterface.HISTORY_BUFFER_LIMIT
long.
The load + open PlotterControls fills the ProgramInterface with commands.
Home sends N1 to the robot.
reset/reconnect puts A back to zero.
send home again is now N2. mismatch.
The only way the app could know the robot reset is by watching in onDataReceived()
for the first message from Marlin. This is very do-able.
The N4 M280 P0 S90 T50*102
error should not exist because PlotterControls was closed and reopened. The state of the MarlinInterface should be completely reset back to N0, as well.
When the serial connection is opened the robot is reset.
I don't observed this :-( Here is what I did to be sure:
here is the log I see:
2022-01-29 16:28:34,243 DEBUG c.m.c.NetworkSessionUIManager - Fetching connections
2022-01-29 16:28:34,243 DEBUG c.m.c.NetworkSessionUIManager - USB Serial
2022-01-29 16:28:34,303 DEBUG c.m.c.NetworkSessionUIManager - /dev/cu.Bluetooth-Incoming-Port
2022-01-29 16:28:34,303 DEBUG c.m.c.NetworkSessionUIManager - /dev/cu.DRAWBOT-Port
2022-01-29 16:28:34,303 DEBUG c.m.c.NetworkSessionUIManager - /dev/cu.SRS-XB33-BluetoothSeria
2022-01-29 16:28:37,269 DEBUG c.m.m.p.p.ChooseConnection - onConnectAction()
2022-01-29 16:28:38,758 DEBUG c.m.m.p.p.ChooseConnection - open to /dev/cu.DRAWBOT-Port
2022-01-29 16:28:38,760 DEBUG c.m.m.p.p.MarlinInterface - MarlinInterface connected.
2022-01-29 16:28:39,776 DEBUG c.m.m.p.p.MarlinInterface - sendQueuedCommand history [MarlinCommand{lineNumber=1, command='N1 G28 XY*51'}]
2022-01-29 16:28:39,776 TRACE c.m.m.p.p.MarlinInterface - 1 sending 'N1 G28 XY*51'
2022-01-29 16:28:39,817 TRACE c.m.m.p.p.MarlinInterface - received 'Error:Line Number is not Last Line Number+1, Last Line: 2'
2022-01-29 16:28:39,817 ERROR c.m.m.p.p.MarlinInterface - Error from printer 'Error:Line Number is not Last Line Number+1, Last Line: 2'
2022-01-29 16:28:39,817 TRACE c.m.m.p.p.MarlinInterface - received 'Resend: 3'
so the robot is asking line 3 which was send in the first opening Makelangelo. Can you tell me what am I doing wrong please ? I woulk like to understand.
Nevertheless, there still is an issue in Makelangelo when opening and closing the plotter control, I'm digging...
This bug is not related to the serial communication ! the PlotterControls is instantiated once in Makelangelo.java but the listener associated to the home button is added as many times as this window is opened.
The issue is caused by the plotter controls recreated each times it is opened. The MarlinPlotterInterface
register itself each times and then when you clicked the home button, the event PlotterEvent.HOME_FOUND
is fired and 2 or more listener of MarlinPlotterInterface
react to send G28
.
The fix I did is to show / hide the plotter controls instead of destroying it
If the PlotterControls are recreated then so is the MarlinPlotterInterface and so is the home button. I don't understand your description of the problem or the solution. Which "register" is being saved even after PlotterControls is closed and reopened?
When the PlotterControls
is created, the constructor of MarlinPlotterInterface
register it self to the plotter :
https://github.com/MarginallyClever/Makelangelo-software/blob/782f02f9dcbb4866f23274a5a21da6b34f81138c/src/main/java/com/marginallyclever/makelangelo/plotter/plotterControls/MarlinPlotterInterface.java#L33.
When this window is closed, the listener does not remote itself from the plotter.
When a new PlotterControls
is created, the same registration occurs again.
So when the home button is click, one event PlotterEvent.HOME_FOUND
is fired but there are 2 instances of MarlinPlotterInterface
which will be triggered.
then it seems to me the correct fix is to unregister at the right moment.
then it seems to me the correct fix is to unregister at the right moment.
This is another way to fix the issue, avoiding recreated the whole pane works fine too.
Fixed along with #479, right?
With #500 :)
(#479 is this issue)
Steps to make the bug happen
What was supposed to happen No Error
Platform (please complete the following information):
Log file I have removed the svg parsing from the log