mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-21 21:58:05 -06:00
klippy: Warn the user on common errors due to old firmware
Check for msgproto.error and warn the user about version firmware version mismatch. Raise msgproto.error when extracting firmware constants. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
eebaeeff96
commit
93d3a6e1d1
3 changed files with 31 additions and 5 deletions
|
@ -308,3 +308,15 @@ class MessageParser:
|
|||
self.static_strings = data.get('static_strings', [])
|
||||
self.config.update(data.get('config', {}))
|
||||
self.version = data.get('version', '')
|
||||
def get_constant(self, name):
|
||||
try:
|
||||
return self.config[name]
|
||||
except KeyError:
|
||||
raise error("Firmware constant '%s' not found" % (name,))
|
||||
def get_constant_float(self, name):
|
||||
try:
|
||||
return float(self.config[name])
|
||||
except ValueError:
|
||||
raise error("Firmware constant '%s' not a float" % (name,))
|
||||
except KeyError:
|
||||
raise error("Firmware constant '%s' not found" % (name,))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue