Brought back the metric and imperial state variables.

This commit is contained in:
David Carley
2022-07-16 19:07:28 -07:00
parent f0bb9079d4
commit f34e1413b7
2 changed files with 10 additions and 0 deletions

View File

@@ -71,6 +71,7 @@ class Ctrl(object):
def configure(self):
# Indirectly configures state via calls to config() and the AVR
self.config.reload()
self.state.init()
def ready(self):
# This is used to synchronize the start of the preplanner

View File

@@ -419,3 +419,12 @@ class State(object):
if switch[1:] == '-max':
return self.get_axis_switch(switch[0], 'max')
raise Exception('Unsupported switch "%s"' % switch)
def init(self):
# Init machine units
metric = self.ctrl.config.get('units', 'METRIC').upper() == 'METRIC'
self.log.info('INIT Metric %d' % metric)
if not 'metric' in self.vars:
self.set('metric', metric)
if not 'imperial' in self.vars:
self.set('imperial', not metric)