Skip to content

Commit

Permalink
Added a detection if echo mode is active and will only try to disable…
Browse files Browse the repository at this point in the history
… if it is. (#2392)

This will prevent the echo disable command to be sent on channels that doesn't support them on FluidNC.
  • Loading branch information
breiler authored Dec 14, 2023
1 parent 0117e56 commit dc6e806
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ This file is part of Universal Gcode Sender (UGS).
import com.willwinder.universalgcodesender.firmware.IFirmwareSettings;
import static com.willwinder.universalgcodesender.firmware.fluidnc.FluidNCUtils.DISABLE_ECHO_COMMAND;
import static com.willwinder.universalgcodesender.firmware.fluidnc.FluidNCUtils.GRBL_COMPABILITY_VERSION;
import com.willwinder.universalgcodesender.firmware.fluidnc.commands.DetectEchoCommand;
import com.willwinder.universalgcodesender.firmware.fluidnc.commands.FluidNCCommand;
import com.willwinder.universalgcodesender.firmware.fluidnc.commands.GetAlarmCodesCommand;
import com.willwinder.universalgcodesender.firmware.fluidnc.commands.GetErrorCodesCommand;
Expand Down Expand Up @@ -568,7 +569,11 @@ private void initializeController() {
}

private void disableEcho() throws Exception {
communicator.sendByteImmediately(DISABLE_ECHO_COMMAND);
DetectEchoCommand detectEchoCommand = sendAndWaitForCompletion(this, new DetectEchoCommand());
if (detectEchoCommand.isEchoActivated()) {
LOGGER.log(Level.INFO, "Controller has echo activated, turning it off");
communicator.sendByteImmediately(DISABLE_ECHO_COMMAND);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
Copyright 2023 Will Winder
This file is part of Universal Gcode Sender (UGS).
UGS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
UGS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with UGS. If not, see <http://www.gnu.org/licenses/>.
*/
package com.willwinder.universalgcodesender.firmware.fluidnc.commands;

import com.willwinder.universalgcodesender.types.GcodeCommand;

/**
* A command for detecting if echo mode is activated on the controller
*
* @author Joacim Breiler
*/
public class DetectEchoCommand extends GcodeCommand {
public DetectEchoCommand() {
super("");
}

public boolean isEchoActivated() {
return getResponse().equals("\nok");
}
}

0 comments on commit dc6e806

Please sign in to comment.