modifying state for updating config
This commit is contained in:
@@ -775,18 +775,8 @@ module.exports = {
|
||||
SvelteComponents.showDialog("Message", { title: this[axis].toolmsg });
|
||||
},
|
||||
|
||||
set_position: async function (axis, position) {
|
||||
set_position: function (axis, position) {
|
||||
api.put(`position/${axis}`, { position: parseFloat(position) });
|
||||
// this.update_config();
|
||||
// if (!this.config.axes) {
|
||||
// this.config.axes = {};
|
||||
// }
|
||||
// this.config.axes[axis] = {
|
||||
// abs: position + this.state["offset_" + axis],
|
||||
// off: this.state["offset_" + axis],
|
||||
// };
|
||||
// console.log(this.config);
|
||||
// await this.save_config(this.config);
|
||||
},
|
||||
|
||||
zero_all: function () {
|
||||
|
||||
@@ -28,8 +28,7 @@
|
||||
import bbctrl
|
||||
from bbctrl.Comm import Comm
|
||||
import bbctrl.Cmd as Cmd
|
||||
import os
|
||||
import json
|
||||
|
||||
|
||||
# Axis homing procedure:
|
||||
#
|
||||
@@ -358,7 +357,6 @@ class Mach(Comm):
|
||||
def set_position(self, axis, position):
|
||||
axis = axis.lower()
|
||||
state = self.ctrl.state
|
||||
config = self.ctrl.config
|
||||
|
||||
if state.is_axis_homed(axis):
|
||||
# If homed, change the offset rather than the absolute position
|
||||
@@ -371,14 +369,7 @@ class Mach(Comm):
|
||||
|
||||
# Set the absolute position both locally and via the AVR
|
||||
target = position + state.get('offset_' + axis)
|
||||
self.mlog.info('target %s' % str(target))
|
||||
self.mlog.info('state.get %s axis' % str(state.get('offset_' + axis)))
|
||||
state.set(axis + 'p', target)
|
||||
axes = config.values.setdefault('axes',{})
|
||||
axes[axis + 'p'] = target
|
||||
self.mlog.info('Saving %s axis' % axis)
|
||||
config.set('axes', axes)
|
||||
self.mlog
|
||||
super().queue_command(Cmd.set_axis(axis, target))
|
||||
|
||||
|
||||
|
||||
@@ -241,8 +241,11 @@ class State(object):
|
||||
|
||||
|
||||
def update(self, update):
|
||||
keys = ['xp', 'yp', 'zp', 'offset_x', 'offset_y', 'offset_z']
|
||||
for name, value in update.items():
|
||||
self.set(name, value)
|
||||
if name in keys:
|
||||
self.log.info('Sanjay name: %s : data: %f' % (name,value))
|
||||
|
||||
|
||||
def get(self, name, default = None):
|
||||
|
||||
Reference in New Issue
Block a user