updating in mach
This commit is contained in:
@@ -776,16 +776,17 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
set_position: async function (axis, position) {
|
set_position: async function (axis, position) {
|
||||||
this.update_config();
|
api.put(`position/${axis}`, { position: parseFloat(position) });
|
||||||
if (!this.config.axes) {
|
// this.update_config();
|
||||||
this.config.axes = {};
|
// if (!this.config.axes) {
|
||||||
}
|
// this.config.axes = {};
|
||||||
this.config.axes[axis] = {
|
// }
|
||||||
abs: position + this.state["offset_" + axis],
|
// this.config.axes[axis] = {
|
||||||
off: this.state["offset_" + axis],
|
// abs: position + this.state["offset_" + axis],
|
||||||
};
|
// off: this.state["offset_" + axis],
|
||||||
console.log(this.config);
|
// };
|
||||||
await api.put(`position/${axis}`, { position: parseFloat(position) });
|
// console.log(this.config);
|
||||||
|
// await this.save_config(this.config);
|
||||||
},
|
},
|
||||||
|
|
||||||
zero_all: function () {
|
zero_all: function () {
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ class Mach(Comm):
|
|||||||
def set_position(self, axis, position):
|
def set_position(self, axis, position):
|
||||||
axis = axis.lower()
|
axis = axis.lower()
|
||||||
state = self.ctrl.state
|
state = self.ctrl.state
|
||||||
# config = self.ctrl.config
|
config = self.ctrl.config
|
||||||
|
|
||||||
if state.is_axis_homed(axis):
|
if state.is_axis_homed(axis):
|
||||||
# If homed, change the offset rather than the absolute position
|
# If homed, change the offset rather than the absolute position
|
||||||
@@ -374,9 +374,13 @@ class Mach(Comm):
|
|||||||
# json_data = config.values
|
# json_data = config.values
|
||||||
# axes = json_data.setdefault('axes', {})
|
# axes = json_data.setdefault('axes', {})
|
||||||
# axes[axis] = { 'abs' : target, 'off' : state.get('offset_' + axis)}
|
# axes[axis] = { 'abs' : target, 'off' : state.get('offset_' + axis)}
|
||||||
self.mlog.info('target ' + target)
|
self.mlog.info('target ' + str(target))
|
||||||
self.mlog.info('state.get ' + state.get('offset_' + axis))
|
self.mlog.info('state.get ' + str(state.get('offset_' + axis)))
|
||||||
state.set(axis + 'p', target)
|
state.set(axis + 'p', target)
|
||||||
|
if 'axes' in config.values:
|
||||||
|
config.values['axes'][axis] = { 'abs' : target, 'off' : state.get('offset_' + axis) }
|
||||||
|
else:
|
||||||
|
config.values['axes'] = { axis : { 'abs' : target, 'off' : state.get('offset_' + axis) } }
|
||||||
super().queue_command(Cmd.set_axis(axis, target))
|
super().queue_command(Cmd.set_axis(axis, target))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user