setting max x,y travel on grbl takes origin offsets into account.

This commit is contained in:
Teja 2015-10-31 19:02:05 +01:00
parent 099c5dc33c
commit 577ed9591a
5 changed files with 16 additions and 8 deletions

View file

@ -204,15 +204,17 @@ class LaserCutterProfilesPlugin(octoprint.plugin.SettingsPlugin,
if self._printer.is_locked() or self._printer.is_operational():
if "volume" in new_profile:
if "width" in new_profile["volume"]:
width = int(new_profile['volume']['width'])
width = float(new_profile['volume']['width'])
if identifier == "_mrbeam_senior":
width *= 2
width += float(new_profile['volume']['origin_offset_x'])
self._printer.commands('$130=' + str(width))
time.sleep(0.1) ### TODO find better solution then sleep
if "depth" in new_profile["volume"]:
depth = int(new_profile['volume']['depth'])
depth = float(new_profile['volume']['depth'])
if identifier == "_mrbeam_senior":
depth *= 2
depth += float(new_profile['volume']['origin_offset_y'])
self._printer.commands('$131=' + str(depth))
new_profile["id"] = identifier

View file

@ -29,9 +29,11 @@ class LaserCutterProfileManager(object):
name = "Mr Beam",
model = "Junior",
volume=dict(
width = 216,
depth = 297,
width = 217,
depth = 298,
height = 0,
origin_offset_x = 1,
origin_offset_y = 1,
),
zAxis = False,
axes=dict(

View file

@ -16,7 +16,9 @@ $(function() {
formFactor: "rectangular",
width: 216,
depth: 297,
height: 0
height: 0,
origin_offset_x: 1,
origin_offset_y: 1
},
zAxis: false,
axes: {
@ -108,8 +110,8 @@ $(function() {
self.currentProfile(currentProfile);
self.currentProfileData(currentProfileData);
self.workingarea.workingAreaWidthMM(self.currentProfileData().volume.width());
self.workingarea.workingAreaHeightMM(self.currentProfileData().volume.depth());
self.workingarea.workingAreaWidthMM(self.currentProfileData().volume.width() - self.currentProfileData().volume.origin_offset_x());
self.workingarea.workingAreaHeightMM(self.currentProfileData().volume.depth() - self.currentProfileData().volume.origin_offset_y());
var maxSpeed = Math.min(self.currentProfileData().axes.x.speed(), self.currentProfileData().axes.y.speed());
self.conversion.maxSpeed(maxSpeed);
};

View file

@ -107,6 +107,8 @@ $(function(){
if(self.state.isOperational() && !self.state.isPrinting()){
var x = self.px2mm(event.offsetX);
var y = self.px2mm(event.toElement.ownerSVGElement.offsetHeight - event.offsetY); // hopefully this works across browsers
x = Math.min(x, self.workingAreaWidthMM());
y = Math.min(y, self.workingAreaHeightMM());
$.ajax({
url: API_BASEURL + "printer/printhead",
type: "POST",

View file

@ -292,7 +292,7 @@
<text
xml:space="preserve"
data-bind="visible: working_area_empty"
style="font-size:64px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#DDDDDD;fill-opacity:1;stroke:none;font-family:DIN-BoldAlternate;-inkscape-font-specification:DIN-BoldAlternate Bold"
style="font-size:64px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#DDDDDD;fill-opacity:1;stroke:none;font-family:DIN-BoldAlternate, Helvetica, Arial, Sans-serif;"
x="396.81018"
y="552.36218"
id="add_designs_hint"