Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed connection problem with GRBL_ESP32 in wifi mode #2583

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
import com.willwinder.universalgcodesender.firmware.grbl.commands.GetSettingsCommand;
import com.willwinder.universalgcodesender.listeners.ControllerState;
import com.willwinder.universalgcodesender.listeners.MessageType;
import static com.willwinder.universalgcodesender.utils.ControllerUtils.sendAndWaitForCompletion;

import java.util.Optional;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import java.util.logging.Logger;

import static com.willwinder.universalgcodesender.utils.ControllerUtils.sendAndWaitForCompletion;

/**
* A class that implements an initialization protocol for GRBL and keeps an internal state of the
* connection process. The query process will not require the controller to be reset which is needed
Expand Down Expand Up @@ -50,6 +49,7 @@ public boolean initialize() throws ControllerException{
controller.setControllerState(ControllerState.CONNECTING);
isInitializing.set(true);
try {
// Some controllers need this wait before we can query its status
Thread.sleep(2000);
if (!GrblUtils.isControllerResponsive(controller)) {
isInitializing.set(false);
Expand All @@ -58,6 +58,8 @@ public boolean initialize() throws ControllerException{
return false;
}

// Some controllers need this wait before we can query the rest of its information
Thread.sleep(2000);
fetchControllerVersion();
fetchControllerState();

Expand Down Expand Up @@ -110,6 +112,10 @@ public boolean isInitialized() {
return isInitialized.get();
}

public boolean isInitializing() {
return isInitializing.get();
}

public GrblVersion getVersion() {
return version;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,6 @@ private GrblController initializeAndConnectController(String grblVersionString)
instance.openCommPort(getSettings().getConnectionDriver(), "/dev/port", 1234);
Thread.sleep(50);

instance.rawResponseHandler(grblVersionString);
return instance;
}
}
Loading