Merge branch 'nativeserial' into mrbeam
This commit is contained in:
commit
e7fcb5b228
9 changed files with 167 additions and 19 deletions
|
|
@ -1160,6 +1160,7 @@ ul.dropdown-menu li a {
|
||||||
#control_zaxis {
|
#control_zaxis {
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
width: 80px;
|
width: 80px;
|
||||||
|
margin: 1em auto 0;
|
||||||
}
|
}
|
||||||
#control_zaxis_focus {
|
#control_zaxis_focus {
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
|
|
@ -1541,7 +1542,7 @@ td.settings_printerProfiles_profiles_action a.disabled {
|
||||||
.nav-pills>li>a,
|
.nav-pills>li>a,
|
||||||
select,
|
select,
|
||||||
textarea,
|
textarea,
|
||||||
input,
|
input, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"],
|
||||||
input.search-query,
|
input.search-query,
|
||||||
.uneditable-input,
|
.uneditable-input,
|
||||||
.input-append .add-on:last-child,
|
.input-append .add-on:last-child,
|
||||||
|
|
|
||||||
|
|
@ -102,3 +102,28 @@ svg text {
|
||||||
.overrideSlider span {
|
.overrideSlider span {
|
||||||
padding-left: .6em;
|
padding-left: .6em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.repeatGcode .btn-group {
|
||||||
|
width: 145px;
|
||||||
|
}
|
||||||
|
.repeatGcode input, .repeatGcode button {
|
||||||
|
width: 33%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.repeatGcode input {
|
||||||
|
margin-bottom:0;
|
||||||
|
padding-left: 0;
|
||||||
|
padding-right: 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.repeatGcode>span {
|
||||||
|
padding-left: .6em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.manual_position_input {
|
||||||
|
padding-top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#manual_position.warning {
|
||||||
|
color: #DD0000;
|
||||||
|
}
|
||||||
|
|
@ -450,10 +450,16 @@ $(function(){
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getUsefulDimensions = function(wpx, hpx){
|
self.getUsefulDimensions = function(wpx, hpx){
|
||||||
var maxWidthMM = wpx * 0.25; // TODO parametrize
|
var maxWidthMM = wpx * 0.25; // TODO parametrize
|
||||||
var aspectRatio = wpx / hpx;
|
var maxHeightMM = hpx * 0.25; // TODO parametrize
|
||||||
var destWidthMM = Math.min(self.workingAreaWidthMM() - 2, maxWidthMM);
|
var aspectRatio = wpx / hpx;
|
||||||
var destHeightMM = destWidthMM / aspectRatio;
|
var destWidthMM = Math.min(self.workingAreaWidthMM() - 2, maxWidthMM);
|
||||||
|
var destHeightMM = Math.min(self.workingAreaHeightMM() - 2, maxHeightMM);
|
||||||
|
if ((destWidthMM / aspectRatio) > destHeightMM) {
|
||||||
|
destWidthMM = destHeightMM * aspectRatio;
|
||||||
|
} else {
|
||||||
|
destHeightMM = destWidthMM / aspectRatio;
|
||||||
|
}
|
||||||
var destWidthPT = self.mm2svgUnits(destWidthMM);
|
var destWidthPT = self.mm2svgUnits(destWidthMM);
|
||||||
var destHeightPT = self.mm2svgUnits(destHeightMM);
|
var destHeightPT = self.mm2svgUnits(destHeightMM);
|
||||||
return [destWidthPT, destHeightPT];
|
return [destWidthPT, destHeightPT];
|
||||||
|
|
|
||||||
|
|
@ -433,6 +433,22 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||||
payload["origin"] = FileDestinations.SDCARD
|
payload["origin"] = FileDestinations.SDCARD
|
||||||
eventManager().fire(Events.PRINT_FAILED, payload)
|
eventManager().fire(Events.PRINT_FAILED, payload)
|
||||||
|
|
||||||
|
def increase_passes(self):
|
||||||
|
"""
|
||||||
|
increase the number of passes by one.
|
||||||
|
"""
|
||||||
|
if self._comm is None:
|
||||||
|
return
|
||||||
|
self._comm.increasePasses()
|
||||||
|
|
||||||
|
def degrease_passes(self):
|
||||||
|
"""
|
||||||
|
degrease the number of passes by one.
|
||||||
|
"""
|
||||||
|
if self._comm is None:
|
||||||
|
return
|
||||||
|
self._comm.degreasePasses()
|
||||||
|
|
||||||
def get_state_string(self):
|
def get_state_string(self):
|
||||||
"""
|
"""
|
||||||
Returns a human readable string corresponding to the current communication state.
|
Returns a human readable string corresponding to the current communication state.
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,9 @@ def controlJob():
|
||||||
"start": [],
|
"start": [],
|
||||||
"restart": [],
|
"restart": [],
|
||||||
"pause": [],
|
"pause": [],
|
||||||
"cancel": []
|
"cancel": [],
|
||||||
|
"incpasses": [],
|
||||||
|
"degpasses": []
|
||||||
}
|
}
|
||||||
|
|
||||||
command, data, response = get_json_command_from_request(request, valid_commands)
|
command, data, response = get_json_command_from_request(request, valid_commands)
|
||||||
|
|
@ -48,6 +50,15 @@ def controlJob():
|
||||||
if not activePrintjob:
|
if not activePrintjob:
|
||||||
return make_response("Printer is neither printing nor paused, 'cancel' command cannot be performed", 409)
|
return make_response("Printer is neither printing nor paused, 'cancel' command cannot be performed", 409)
|
||||||
printer.cancel_print()
|
printer.cancel_print()
|
||||||
|
elif command == "incpasses":
|
||||||
|
if not activePrintjob:
|
||||||
|
return make_response("Printer is neither printing nor paused, 'incpasses' command cannot be performed", 409)
|
||||||
|
printer.increase_passes()
|
||||||
|
elif command == "degpasses":
|
||||||
|
if not activePrintjob:
|
||||||
|
return make_response("Printer is neither printing nor paused, 'degpasses' command cannot be performed", 409)
|
||||||
|
printer.degrease_passes()
|
||||||
|
|
||||||
return NO_CONTENT
|
return NO_CONTENT
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -404,6 +404,11 @@ $(function() {
|
||||||
self.onStartup = function () {
|
self.onStartup = function () {
|
||||||
self.requestData();
|
self.requestData();
|
||||||
self._configureJogDistanceSlider();
|
self._configureJogDistanceSlider();
|
||||||
|
$('#manual_position').keyup(function(e) {
|
||||||
|
if (e.which === 13){ // 13 == enter
|
||||||
|
self.manualPosition();
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
self.updateRotatorWidth = function() {
|
self.updateRotatorWidth = function() {
|
||||||
|
|
@ -606,6 +611,24 @@ $(function() {
|
||||||
self.setCoordinateOrigin = function () {
|
self.setCoordinateOrigin = function () {
|
||||||
self.sendCustomCommand({type: 'command', command: "G92 X0 Y0"});
|
self.sendCustomCommand({type: 'command', command: "G92 X0 Y0"});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.manualPosition = function(){
|
||||||
|
$('#manual_position').removeClass('warning');
|
||||||
|
var s = $('#manual_position').val();
|
||||||
|
var tmp = s.split(/[^0-9.,-\\+]+/);
|
||||||
|
if (tmp.length === 2) {
|
||||||
|
var x = parseFloat(tmp[0]);
|
||||||
|
var y = parseFloat(tmp[1]);
|
||||||
|
if(!isNaN(x) && !isNaN(y)) {
|
||||||
|
self.sendCustomCommand({type: 'command', command: "G0X"+x+"Y"+y});
|
||||||
|
$('#manual_position').val('');
|
||||||
|
} else {
|
||||||
|
$('#manual_position').addClass('warning');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$('#manual_position').addClass('warning');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
self.jogDistanceInMM = ko.observable(undefined);
|
self.jogDistanceInMM = ko.observable(undefined);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ $(function() {
|
||||||
self.feedrateOverride = ko.observable(100);
|
self.feedrateOverride = ko.observable(100);
|
||||||
self.intensityOverride.extend({ rateLimit: 500 });
|
self.intensityOverride.extend({ rateLimit: 500 });
|
||||||
self.feedrateOverride.extend({ rateLimit: 500 });
|
self.feedrateOverride.extend({ rateLimit: 500 });
|
||||||
|
self.numberOfPasses = ko.observable(1);
|
||||||
|
|
||||||
self.TITLE_PRINT_BUTTON_PAUSED = gettext("Restarts the print job from the beginning");
|
self.TITLE_PRINT_BUTTON_PAUSED = gettext("Restarts the print job from the beginning");
|
||||||
self.TITLE_PRINT_BUTTON_UNPAUSED = gettext("Starts the print job");
|
self.TITLE_PRINT_BUTTON_UNPAUSED = gettext("Starts the print job");
|
||||||
|
|
@ -216,6 +217,8 @@ $(function() {
|
||||||
$("#confirmation_dialog .confirmation_dialog_acknowledge").click(
|
$("#confirmation_dialog .confirmation_dialog_acknowledge").click(
|
||||||
function (e) {
|
function (e) {
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
|
self.resetOverrideSlider();
|
||||||
|
self.numberOfPasses(1);
|
||||||
callback(e);
|
callback(e);
|
||||||
$("#confirmation_dialog").modal("hide");
|
$("#confirmation_dialog").modal("hide");
|
||||||
$("#confirmation_dialog .confirmation_dialog_message").html('');
|
$("#confirmation_dialog .confirmation_dialog_message").html('');
|
||||||
|
|
@ -285,14 +288,14 @@ $(function() {
|
||||||
self.onEventRealTimeState = function(payload){
|
self.onEventRealTimeState = function(payload){
|
||||||
self.currentPos({x: payload.wx, y: payload.wy});
|
self.currentPos({x: payload.wx, y: payload.wy});
|
||||||
};
|
};
|
||||||
|
|
||||||
self.intensityOverride.subscribe(function(factor){
|
self.intensityOverride.subscribe(function(factor){
|
||||||
self._overrideCommand("/intensity "+factor);
|
self._overrideCommand("/intensity "+factor);
|
||||||
});
|
});
|
||||||
self.feedrateOverride.subscribe(function(factor){
|
self.feedrateOverride.subscribe(function(factor){
|
||||||
self._overrideCommand("/feedrate "+factor);
|
self._overrideCommand("/feedrate "+factor);
|
||||||
});
|
});
|
||||||
|
|
||||||
self._overrideCommand = function(command, callback) {
|
self._overrideCommand = function(command, callback) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: API_BASEURL + "printer/command",
|
url: API_BASEURL + "printer/command",
|
||||||
|
|
@ -307,7 +310,7 @@ $(function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
self._configureOverrideSliders = function() {
|
self._configureOverrideSliders = function() {
|
||||||
self.intensityOverrideSlider = $("#intensity_override_slider").slider({
|
self.intensityOverrideSlider = $("#intensity_override_slider").slider({
|
||||||
step: 1,
|
step: 1,
|
||||||
|
|
@ -318,7 +321,7 @@ $(function() {
|
||||||
}).on("slideStop", function(ev){
|
}).on("slideStop", function(ev){
|
||||||
self.intensityOverride(ev.value);
|
self.intensityOverride(ev.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
self.feedrateOverrideSlider = $("#feedrate_override_slider").slider({
|
self.feedrateOverrideSlider = $("#feedrate_override_slider").slider({
|
||||||
step: 1,
|
step: 1,
|
||||||
min: 10,
|
min: 10,
|
||||||
|
|
@ -330,17 +333,31 @@ $(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.increasePasses = function(){
|
||||||
|
self.numberOfPasses(self.numberOfPasses()+1);
|
||||||
|
self._jobCommand("incpasses");
|
||||||
|
}
|
||||||
|
self.decreasePasses = function(){
|
||||||
|
var passes = Math.max(self.numberOfPasses()-1, 1);
|
||||||
|
self.numberOfPasses(passes);
|
||||||
|
self._jobCommand("degpasses");
|
||||||
|
}
|
||||||
|
|
||||||
self.onEventPrintDone = function(){
|
self.onEventPrintDone = function(){
|
||||||
self.feedrateOverrideSlider.slider('setValue', 100);
|
self.resetOverrideSlider();
|
||||||
|
};
|
||||||
|
|
||||||
|
self.onStartup = function() {
|
||||||
|
self._configureOverrideSliders();
|
||||||
|
};
|
||||||
|
|
||||||
|
self.resetOverrideSlider = function() {
|
||||||
|
self.feedrateOverrideSlider.slider('setValue', 100);
|
||||||
self.intensityOverrideSlider.slider('setValue', 100);
|
self.intensityOverrideSlider.slider('setValue', 100);
|
||||||
self.intensityOverride(100);
|
self.intensityOverride(100);
|
||||||
self.feedrateOverride(100);
|
self.feedrateOverride(100);
|
||||||
};
|
};
|
||||||
|
|
||||||
self.onStartup = function() {
|
|
||||||
self._configureOverrideSliders();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OCTOPRINT_VIEWMODELS.push([
|
OCTOPRINT_VIEWMODELS.push([
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,10 @@
|
||||||
<div class="distance">
|
<div class="distance">
|
||||||
<input type="text" id="jogDistance" />
|
<input type="text" id="jogDistance" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="input-append manual_position_input">
|
||||||
|
<input id="manual_position" placeholder="x.xx y.yy" onsubmit="manualPosition"/>
|
||||||
|
<button class="" data-bind="click: manualPosition">Go</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -168,6 +172,19 @@
|
||||||
<input id="feedrate_override_slider" type="text" data-bind="sliderValue: feedrateOverride">
|
<input id="feedrate_override_slider" type="text" data-bind="sliderValue: feedrateOverride">
|
||||||
<span data-bind="text:feedrateOverride()">100</span>% Feedrate
|
<span data-bind="text:feedrateOverride()">100</span>% Feedrate
|
||||||
</div>
|
</div>
|
||||||
|
<div class="repeatGcode">
|
||||||
|
<div class="btn-group">
|
||||||
|
<button type="button" class="btn btn-default btn-number" data-bind="enable: numberOfPasses() > 1, click:decreasePasses">
|
||||||
|
<span class="icon-minus"></span>
|
||||||
|
</button>
|
||||||
|
<input type="text" class="input-mini text-right" value="1" min="1" max="10" data-bind="value:numberOfPasses()">
|
||||||
|
<button type="button" class="btn btn-default btn-number" data-bind="click:increasePasses">
|
||||||
|
<span class="icon-plus"></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<span>Passes</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- {{ _('Print Time') }}: <strong data-bind="text: printTimeString"></strong><br>
|
<!-- {{ _('Print Time') }}: <strong data-bind="text: printTimeString"></strong><br>
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,8 @@ class MachineCom(object):
|
||||||
self._actual_intensity = None
|
self._actual_intensity = None
|
||||||
self._feedrate_dict = {}
|
self._feedrate_dict = {}
|
||||||
self._intensity_dict = {}
|
self._intensity_dict = {}
|
||||||
|
self._passes = 1
|
||||||
|
self._finished_passes = 0
|
||||||
|
|
||||||
# regular expressions
|
# regular expressions
|
||||||
self._regex_command = re.compile("^\s*\$?([GM]\d+|[TH])")
|
self._regex_command = re.compile("^\s*\$?([GM]\d+|[TH])")
|
||||||
|
|
@ -164,8 +166,15 @@ class MachineCom(object):
|
||||||
if cmd is not None:
|
if cmd is not None:
|
||||||
self.sendCommand(cmd)
|
self.sendCommand(cmd)
|
||||||
self._callback.on_comm_progress()
|
self._callback.on_comm_progress()
|
||||||
elif len(self._acc_line_buffer) == 0:
|
else:
|
||||||
self._set_print_finished()
|
if self._finished_passes >= self._passes:
|
||||||
|
if len(self._acc_line_buffer) == 0:
|
||||||
|
self._set_print_finished()
|
||||||
|
self._currentFile.resetToBeginning()
|
||||||
|
cmd = self._getNext()
|
||||||
|
if cmd is not None:
|
||||||
|
self.sendCommand(cmd)
|
||||||
|
self._callback.on_comm_progress()
|
||||||
|
|
||||||
self._sendCommand()
|
self._sendCommand()
|
||||||
self._send_event.wait(1)
|
self._send_event.wait(1)
|
||||||
|
|
@ -311,7 +320,9 @@ class MachineCom(object):
|
||||||
if self._finished_currentFile is False:
|
if self._finished_currentFile is False:
|
||||||
line = self._currentFile.getNext()
|
line = self._currentFile.getNext()
|
||||||
if line is None:
|
if line is None:
|
||||||
self._finished_currentFile = True
|
self._finished_passes += 1
|
||||||
|
if self._finished_passes >= self._passes:
|
||||||
|
self._finished_currentFile = True
|
||||||
return line
|
return line
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
@ -824,6 +835,12 @@ class MachineCom(object):
|
||||||
if self._currentFile is None:
|
if self._currentFile is None:
|
||||||
raise ValueError("No file selected for printing")
|
raise ValueError("No file selected for printing")
|
||||||
|
|
||||||
|
# reset feedrate and intesity factor in case they where changed in a previous run
|
||||||
|
self._feedrate_factor = 1
|
||||||
|
self._intensity_factor = 1
|
||||||
|
self._passes = 1
|
||||||
|
self._finished_passes = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# ensure fan is on whatever gcode follows.
|
# ensure fan is on whatever gcode follows.
|
||||||
self.sendCommand("M08")
|
self.sendCommand("M08")
|
||||||
|
|
@ -893,6 +910,14 @@ class MachineCom(object):
|
||||||
self._send_event.set()
|
self._send_event.set()
|
||||||
eventManager().fire(Events.PRINT_PAUSED, payload)
|
eventManager().fire(Events.PRINT_PAUSED, payload)
|
||||||
|
|
||||||
|
def increasePasses(self):
|
||||||
|
self._passes += 1
|
||||||
|
self._log("increased Passes to %d" % self._passes)
|
||||||
|
|
||||||
|
def degreasePasses(self):
|
||||||
|
self._passes -= 1
|
||||||
|
self._log("degrease Passes to %d" % self._passes)
|
||||||
|
|
||||||
def getStateString(self):
|
def getStateString(self):
|
||||||
if self._state == self.STATE_NONE:
|
if self._state == self.STATE_NONE:
|
||||||
return "Offline"
|
return "Offline"
|
||||||
|
|
@ -1155,6 +1180,12 @@ class PrintingGcodeFileInformation(PrintingFileInformation):
|
||||||
pass
|
pass
|
||||||
self._handle = None
|
self._handle = None
|
||||||
|
|
||||||
|
def resetToBeginning(self):
|
||||||
|
"""
|
||||||
|
resets the file handle so you can read from the beginning again.
|
||||||
|
"""
|
||||||
|
self._handle = open(self._filename, "r")
|
||||||
|
|
||||||
def getNext(self):
|
def getNext(self):
|
||||||
"""
|
"""
|
||||||
Retrieves the next line for printing.
|
Retrieves the next line for printing.
|
||||||
|
|
@ -1244,6 +1275,7 @@ def serialList():
|
||||||
baselist = baselist \
|
baselist = baselist \
|
||||||
+ glob.glob("/dev/ttyUSB*") \
|
+ glob.glob("/dev/ttyUSB*") \
|
||||||
+ glob.glob("/dev/ttyACM*") \
|
+ glob.glob("/dev/ttyACM*") \
|
||||||
|
+ glob.glob("/dev/ttyAMA*") \
|
||||||
+ glob.glob("/dev/tty.usb*") \
|
+ glob.glob("/dev/tty.usb*") \
|
||||||
+ glob.glob("/dev/cu.*") \
|
+ glob.glob("/dev/cu.*") \
|
||||||
+ glob.glob("/dev/cuaU*") \
|
+ glob.glob("/dev/cuaU*") \
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue