storing motors backup

This commit is contained in:
sanjayk03-dev
2025-06-04 22:00:12 +05:30
parent 879b36dd0d
commit eaf5c2a1e2
2 changed files with 77 additions and 0 deletions

View File

@@ -625,6 +625,7 @@ class RotaryHandler(bbctrl.APIHandler):
motors = config_data.get("motors")
motors_backup = config_data.get("motors_backup", {})
if not motors:
raise ValueError("Motors data not found in configuration")
@@ -632,6 +633,8 @@ class RotaryHandler(bbctrl.APIHandler):
motor_1 = motors[1]
motor_2 = motors[2]
motor_2_backup = motors_backup.get(2, {})
log.info("motor_2_backup: {}".format(motor_2_backup))
is_axis_A = motor_2.get("axis") == "A"
@@ -669,6 +672,14 @@ class RotaryHandler(bbctrl.APIHandler):
motor_2['step-angle-backup'] = motor_2["step-angle"]
motor_2['travel-per-rev-backup'] = motor_2["travel-per-rev"]
motor_2_backup['min-soft-limit'] = motor_2['min-soft-limit']
motor_2_backup['max-soft-limit'] = motor_2['max-soft-limit']
motor_2_backup['max-velocity'] = motor_2["max-velocity"]
motor_2_backup['max-accel'] = motor_2["max-accel"]
motor_2_backup['max-jerk'] = motor_2["max-jerk"]
motor_2_backup['step-angle'] = motor_2["step-angle"]
motor_2_backup['travel-per-rev'] = motor_2["travel-per-rev"]
motor_2['min-soft-limit'] = -720
motor_2['max-soft-limit'] = 720
motor_2['max-velocity'] = 100

View File

@@ -241,6 +241,72 @@
}
},
"motors-backup": {
"type": "list",
"index": "0123",
"default": [{ "axis": "X" }, { "axis": "Y" }, { "axis": "Z" }, { "axis": "A" }],
"template": {
"min-soft-limit": {
"type": "float",
"unit": "mm",
"iunit": "in",
"scale": 25.4,
"default": 0
},
"max-soft-limit": {
"type": "float",
"unit": "mm",
"iunit": "in",
"scale": 25.4,
"default": 0
},
"max-velocity": {
"type": "float",
"min": 0,
"unit": "m/min",
"iunit": "IPM",
"scale": 0.0254,
"default": 5,
"code": "vm"
},
"max-accel": {
"type": "float",
"min": 0,
"unit": "km/min²",
"iunit": "g-force",
"scale": 35.304,
"default": 10,
"code": "am"
},
"max-jerk": {
"type": "float",
"min": 0,
"unit": "km/min³",
"iunit": "g/min",
"scale": 35.304,
"default": 50,
"code": "jm"
},
"step-angle": {
"type": "float",
"min": 0,
"max": 360,
"step": 0.1,
"unit": "degrees",
"default": 1.8,
"code": "sa"
},
"travel-per-rev": {
"type": "float",
"unit": "mm",
"iunit": "in",
"scale": 25.4,
"default": 5,
"code": "tr"
}
}
},
"tool": {
"selected-tool": {
"type": "string",