From 749d63ec6dd292352378b9c784efd9a074b2052d Mon Sep 17 00:00:00 2001 From: sanjayk03-dev Date: Fri, 20 Dec 2024 01:12:45 +0530 Subject: [PATCH] updating motors-view data while switching rotary mode --- src/js/motor-view.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/js/motor-view.js b/src/js/motor-view.js index 8a41d3a..cc7fedd 100644 --- a/src/js/motor-view.js +++ b/src/js/motor-view.js @@ -85,6 +85,29 @@ module.exports = { stallUStepPerSec: function() { const ustep = this.motor["stall-microstep"]; return this.stallRPM * this.stepsPerRev * ustep / 60; + }, + + current_axis_value: function() { + return this.state[this.index + 'an']; + }, + + current_max_velocity_value: function() { + return this.state[this.index + 'vm']; + } + }, + + watch: { + current_axis_value(new_value) { + const motor_axes = ["X", "Y", "Z", "A", "B", "C"] + if(motor_axes[new_value] != this.motor['axis']){ + this.motor['axis'] = motor_axes[new_value]; + } + }, + + current_max_velocity_value(new_value) { + if(new_value != this.motor['max-velocity']) { + this.motor['max-velocity'] = new_value; + } } },