toggling min and max soft limit on switching rotary
This commit is contained in:
@@ -87,27 +87,47 @@ module.exports = {
|
|||||||
return this.stallRPM * this.stepsPerRev * ustep / 60;
|
return this.stallRPM * this.stepsPerRev * ustep / 60;
|
||||||
},
|
},
|
||||||
|
|
||||||
current_axis_value: function() {
|
current_axis: function() {
|
||||||
return this.state[this.index + 'an'];
|
return this.state[this.index + 'an'];
|
||||||
},
|
},
|
||||||
|
|
||||||
current_max_velocity_value: function() {
|
current_max_velocity: function() {
|
||||||
return this.state[this.index + 'vm'];
|
return this.state[this.index + 'vm'];
|
||||||
}
|
},
|
||||||
|
|
||||||
|
current_max_soft_limit: function() {
|
||||||
|
return this.state[this.index + 'tm'];
|
||||||
|
},
|
||||||
|
|
||||||
|
current_min_soft_limit: function() {
|
||||||
|
return this.state[this.index + 'tn'];
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
current_axis_value(new_value) {
|
current_axis(new_value) {
|
||||||
const motor_axes = ["X", "Y", "Z", "A", "B", "C"]
|
const motor_axes = ["X", "Y", "Z", "A", "B", "C"]
|
||||||
if(motor_axes[new_value] != this.motor['axis']){
|
if(motor_axes[new_value] != this.motor['axis']){
|
||||||
this.motor['axis'] = motor_axes[new_value];
|
this.motor['axis'] = motor_axes[new_value];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
current_max_velocity_value(new_value) {
|
current_max_velocity(new_value) {
|
||||||
if(new_value != this.motor['max-velocity']) {
|
if(new_value != this.motor['max-velocity']) {
|
||||||
this.motor['max-velocity'] = new_value;
|
this.motor['max-velocity'] = new_value;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
current_max_soft_limit(new_value) {
|
||||||
|
if(new_value != this.motor['max-soft-limit']) {
|
||||||
|
this.motor['max-soft-limit'] = new_value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
current_min_soft_limit(new_value) {
|
||||||
|
if(new_value != this.motor['min-soft-limit']) {
|
||||||
|
this.motor['min-soft-limit'] = new_value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -639,6 +639,19 @@ class RotaryHandler(bbctrl.APIHandler):
|
|||||||
motor_2["axis"] = "Y" if is_axis_A else "A"
|
motor_2["axis"] = "Y" if is_axis_A else "A"
|
||||||
motor_1["max-velocity"] *= 2 if is_axis_A else 0.5
|
motor_1["max-velocity"] *= 2 if is_axis_A else 0.5
|
||||||
|
|
||||||
|
if is_axis_A:
|
||||||
|
if 'min-soft-limit-backup' in motor_2 and 'max-soft-limit-backup' in motor_2:
|
||||||
|
motor_2['min-soft-limit'] = motor_2['min-soft-limit-backup']
|
||||||
|
motor_2['max-soft-limit'] = motor_2['max-soft-limit-backup']
|
||||||
|
else:
|
||||||
|
raise ValueError("Backup soft limits are missing for motor_2.")
|
||||||
|
else:
|
||||||
|
motor_2['min-soft-limit-backup'] = motor_2['min-soft-limit']
|
||||||
|
motor_2['max-soft-limit-backup'] = motor_2['max-soft-limit']
|
||||||
|
|
||||||
|
motor_2['min-soft-limit'] = -720
|
||||||
|
motor_2['max-soft-limit'] = 720
|
||||||
|
|
||||||
config.save(config_data)
|
config.save(config_data)
|
||||||
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
|
|||||||
@@ -142,6 +142,22 @@
|
|||||||
"default": 0,
|
"default": 0,
|
||||||
"code": "tm"
|
"code": "tm"
|
||||||
},
|
},
|
||||||
|
"min-soft-limit-backup": {
|
||||||
|
"type": "float",
|
||||||
|
"unit": "mm",
|
||||||
|
"iunit": "in",
|
||||||
|
"scale": 25.4,
|
||||||
|
"default": 0,
|
||||||
|
"code": "tnb"
|
||||||
|
},
|
||||||
|
"max-soft-limit-backup": {
|
||||||
|
"type": "float",
|
||||||
|
"unit": "mm",
|
||||||
|
"iunit": "in",
|
||||||
|
"scale": 25.4,
|
||||||
|
"default": 0,
|
||||||
|
"code": "tmb"
|
||||||
|
},
|
||||||
"min-switch": {
|
"min-switch": {
|
||||||
"type": "enum",
|
"type": "enum",
|
||||||
"values": ["disabled", "normally-open", "normally-closed"],
|
"values": ["disabled", "normally-open", "normally-closed"],
|
||||||
|
|||||||
Reference in New Issue
Block a user