Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
i-make-robots committed Aug 24, 2023
1 parent 958fbc1 commit 6a94ff1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@
*/
public class JogPanel extends JPanel {
private static final Logger logger = LoggerFactory.getLogger(JogPanel.class);

private static final long serialVersionUID = -7408469373702327861L;
private Plotter myPlotter;
private CartesianButtons bCartesian = new CartesianButtons();

private final Plotter myPlotter;
private final CartesianButtons bCartesian = new CartesianButtons();
private JButton toggleEngageMotor;
private JButton findHome;
private JButton penUp;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.marginallyclever.makelangelo.plotter.plottercontrols;

import com.marginallyclever.communications.NetworkSessionEvent;
import com.marginallyclever.communications.NetworkSessionListener;
import com.marginallyclever.convenience.CommandLineOptions;
import com.marginallyclever.makelangelo.Translator;
import com.marginallyclever.util.PreferencesHelper;
Expand Down Expand Up @@ -84,10 +83,6 @@ public MarlinPanel(ChooseConnection chooseConnection) {
});
}

public void addNetworkSessionListener(NetworkSessionListener a) {
chatInterface.addNetworkSessionListener(a);
}

private void onConnect() {
logger.debug("MarlinInterface connected.");
setupNetworkListener();
Expand Down Expand Up @@ -123,8 +118,11 @@ private void onTimeoutCheck() {
private void setupNetworkListener() {
chatInterface.addNetworkSessionListener(this::onDataReceived);
}

// This does not fire on the Swing EVT thread. Be careful! Concurrency problems may happen.

/**
* This does not fire on the Swing EVT thread. Be careful! Concurrency problems may happen.
* @param evt the network session event
*/
protected void onDataReceived(NetworkSessionEvent evt) {
if (evt.flag == NetworkSessionEvent.DATA_RECEIVED) {
lastReceivedTime = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
import com.marginallyclever.communications.NetworkSessionEvent;
import com.marginallyclever.convenience.ColorRGB;
import com.marginallyclever.convenience.Point2D;
import com.marginallyclever.convenience.helpers.StringHelper;
import com.marginallyclever.convenience.W3CColorNames;
import com.marginallyclever.convenience.helpers.StringHelper;
import com.marginallyclever.makelangelo.plotter.Plotter;
import com.marginallyclever.makelangelo.plotter.PlotterEvent;
import com.marginallyclever.makelangelo.plotter.plottersettings.PlotterSettings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.Serial;

/**
* {@link MarlinPlotterPanel} is a {@link MarlinPanel} with extra
* instructions for interaction with a plotter robot.
Expand All @@ -21,15 +19,14 @@
* @since 7.28.0
*/
public class MarlinPlotterPanel extends MarlinPanel {
@Serial
private static final long serialVersionUID = -7114823910724405882L;

private static final Logger logger = LoggerFactory.getLogger(MarlinPlotterPanel.class);

private static final String STR_FEEDRATE = "echo: M203";
private static final String STR_ACCELERATION = "echo: M201";
private static final String MOTOR_ENGAGE = "M17";
private static final String MOTOR_DISENGAGE = "M18";

// M665 Set delta/polargraph configuration.
private static final String M665 = "M665";

private final Plotter myPlotter;
Expand Down Expand Up @@ -125,6 +122,10 @@ private void sendSizeUpdate() {
+" H"+StringHelper.formatDouble(maxLen));
}

/**
* This does not fire on the Swing EVT thread. Be careful! Concurrency problems may happen.
* @param evt the network session event
*/
@Override
protected void onDataReceived(NetworkSessionEvent evt) {
super.onDataReceived(evt);
Expand Down

0 comments on commit 6a94ff1

Please sign in to comment.