logging
This commit is contained in:
@@ -80,7 +80,6 @@ class Config(object):
|
|||||||
return self.values.get(name, default)
|
return self.values.get(name, default)
|
||||||
|
|
||||||
def set(self, name, default = None):
|
def set(self, name, default = None):
|
||||||
config = self.ctrl.config
|
|
||||||
path = self.ctrl.get_path('config.json')
|
path = self.ctrl.get_path('config.json')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -91,7 +90,8 @@ class Config(object):
|
|||||||
if name in config_data:
|
if name in config_data:
|
||||||
existing_value = config_data[name]
|
existing_value = config_data[name]
|
||||||
if isinstance(existing_value, dict) and isinstance(default, dict):
|
if isinstance(existing_value, dict) and isinstance(default, dict):
|
||||||
config_data[name] = {**existing_value, **default}
|
# config_data[name] = {**existing_value, **default}
|
||||||
|
existing_value.update(default)
|
||||||
elif isinstance(existing_value, list) and isinstance(default, list):
|
elif isinstance(existing_value, list) and isinstance(default, list):
|
||||||
config_data[name].extend(default)
|
config_data[name].extend(default)
|
||||||
elif isinstance(existing_value, list):
|
elif isinstance(existing_value, list):
|
||||||
@@ -101,8 +101,8 @@ class Config(object):
|
|||||||
else:
|
else:
|
||||||
config_data[name] = default
|
config_data[name] = default
|
||||||
|
|
||||||
config.save(config_data)
|
self.save(config_data)
|
||||||
self.log.info('name:{} default:{}'.format(name, default))
|
self.log.info('105: name:{} default:{}'.format(name, default))
|
||||||
except Exception: self.log.exception('Internal error: Failed to upgrade config')
|
except Exception: self.log.exception('Internal error: Failed to upgrade config')
|
||||||
|
|
||||||
def save(self, config):
|
def save(self, config):
|
||||||
|
|||||||
@@ -371,12 +371,14 @@ class Mach(Comm):
|
|||||||
|
|
||||||
# Set the absolute position both locally and via the AVR
|
# Set the absolute position both locally and via the AVR
|
||||||
target = position + state.get('offset_' + axis)
|
target = position + state.get('offset_' + axis)
|
||||||
self.mlog.info('target ' + str(target))
|
self.mlog.info('target %s' % str(target))
|
||||||
self.mlog.info('state.get ' + str(state.get('offset_' + axis)))
|
self.mlog.info('state.get %s axis' % str(state.get('offset_' + axis)))
|
||||||
state.set(axis + 'p', target)
|
state.set(axis + 'p', target)
|
||||||
axes = config.values.setdefault('axes',{})
|
axes = config.values.setdefault('axes',{})
|
||||||
axes[axis + 'p'] = target
|
axes[axis + 'p'] = target
|
||||||
|
self.mlog.info('Saving %s axis' % axis)
|
||||||
config.set('axes', axes)
|
config.set('axes', axes)
|
||||||
|
self.mlog
|
||||||
super().queue_command(Cmd.set_axis(axis, target))
|
super().queue_command(Cmd.set_axis(axis, target))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user