Skip to content

Commit

Permalink
FluidNC usability fixes (#2135)
Browse files Browse the repository at this point in the history
Made a couple of usability changes to the FluidNC implementation:
* When stopping a running GCode program it will no longer fully reset the controller
* When initializing and it starts in Alarm or Hold state it will now do a quick check if it is finite and requires a reset
* Made the command text area active on alarms to be able to reconfigure the controller
* Made the console window focusable again to be able to copy text
* Made the file browser openable on alarm state
  • Loading branch information
breiler authored Jan 21, 2023
1 parent 1687b2a commit f49b390
Show file tree
Hide file tree
Showing 12 changed files with 406 additions and 175 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ This file is part of Universal Gcode Sender (UGS).
import com.willwinder.universalgcodesender.types.GcodeCommand;
import com.willwinder.universalgcodesender.types.GrblFeedbackMessage;
import com.willwinder.universalgcodesender.types.GrblSettingMessage;
import com.willwinder.universalgcodesender.utils.ControllerUtils;
import com.willwinder.universalgcodesender.utils.GrblLookups;
import org.apache.commons.lang3.StringUtils;

Expand Down Expand Up @@ -378,33 +379,7 @@ public CommunicatorState getCommunicatorState() {
return super.getCommunicatorState();
}

ControllerState state = this.controllerStatus == null ? ControllerState.DISCONNECTED : this.controllerStatus.getState();
switch(state) {
case JOG:
case RUN:
return CommunicatorState.COMM_SENDING;
case HOLD:
case DOOR:
return CommunicatorState.COMM_SENDING_PAUSED;
case IDLE:
if (isStreaming()){
return CommunicatorState.COMM_SENDING_PAUSED;
} else {
return CommunicatorState.COMM_IDLE;
}
case ALARM:
return CommunicatorState.COMM_IDLE;
case CHECK:
if (isStreaming() && comm.isPaused()) {
return CommunicatorState.COMM_SENDING_PAUSED;
} else if (isStreaming() && !comm.isPaused()) {
return CommunicatorState.COMM_SENDING;
} else {
return COMM_CHECK;
}
default:
return CommunicatorState.COMM_IDLE;
}
return ControllerUtils.getCommunicatorState(controllerStatus.getState(), this, comm);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ This file is part of Universal Gcode Sender (UGS).
import com.willwinder.universalgcodesender.listeners.MessageType;
import com.willwinder.universalgcodesender.model.*;
import com.willwinder.universalgcodesender.types.GcodeCommand;
import com.willwinder.universalgcodesender.utils.ControllerUtils;
import org.apache.commons.lang3.StringUtils;

import static com.willwinder.universalgcodesender.model.CommunicatorState.*;
Expand Down Expand Up @@ -274,32 +275,7 @@ public void killAlarmLock() throws Exception {

@Override
public CommunicatorState getCommunicatorState() {
ControllerState state = controllerStatus.getState();
switch(state) {
case JOG:
case RUN:
return COMM_SENDING;
case HOLD:
case DOOR:
return COMM_SENDING_PAUSED;
case IDLE:
if (isStreaming()){
return COMM_SENDING_PAUSED;
} else {
return COMM_IDLE;
}
case CHECK:
if (isStreaming() && comm.isPaused()) {
return COMM_SENDING_PAUSED;
} else if (isStreaming() && !comm.isPaused()) {
return COMM_SENDING;
} else {
return COMM_CHECK;
}
case ALARM:
default:
return COMM_IDLE;
}
return ControllerUtils.getCommunicatorState(controllerStatus.getState(), this, comm);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ This file is part of Universal Gcode Sender (UGS).
import com.willwinder.universalgcodesender.model.*;
import com.willwinder.universalgcodesender.types.GcodeCommand;
import com.willwinder.universalgcodesender.types.TinyGGcodeCommand;
import com.willwinder.universalgcodesender.utils.ControllerUtils;

import java.util.List;
import java.util.Optional;
Expand All @@ -42,8 +43,6 @@ This file is part of Universal Gcode Sender (UGS).

import static com.willwinder.universalgcodesender.model.CommunicatorState.COMM_CHECK;
import static com.willwinder.universalgcodesender.model.CommunicatorState.COMM_IDLE;
import static com.willwinder.universalgcodesender.model.CommunicatorState.COMM_SENDING;
import static com.willwinder.universalgcodesender.model.CommunicatorState.COMM_SENDING_PAUSED;

/**
* TinyG Control layer, coordinates all aspects of control.
Expand Down Expand Up @@ -430,32 +429,7 @@ public CommunicatorState getCommunicatorState() {
}

protected CommunicatorState getControlState(ControllerState controllerState) {
switch (controllerState) {
case JOG:
case RUN:
return COMM_SENDING;
case HOLD:
case DOOR:
return COMM_SENDING_PAUSED;
case IDLE:
if (isStreaming()) {
return COMM_SENDING_PAUSED;
} else {
return COMM_IDLE;
}
case ALARM:
return COMM_IDLE;
case CHECK:
if (isStreaming() && comm.isPaused()) {
return COMM_SENDING_PAUSED;
} else if (isStreaming() && !comm.isPaused()) {
return COMM_SENDING;
} else {
return COMM_CHECK;
}
default:
return COMM_IDLE;
}
return ControllerUtils.getCommunicatorState(controllerState, this, comm);
}

@Override
Expand Down
Loading

0 comments on commit f49b390

Please sign in to comment.