modifying pwncnc settings

This commit is contained in:
sanjayk03-dev
2024-02-26 16:48:41 +05:30
parent d540809975
commit cf81ae5d87
2 changed files with 7 additions and 9 deletions

View File

@@ -407,12 +407,10 @@ module.exports = new Vue({
save: async function() { save: async function() {
const selected_tool = this.config.tool["selected-tool"]; const selected_tool = this.config.tool["selected-tool"];
console.log(selected_tool);
const saveModbus = const saveModbus =
selected_tool !== "pwm" && selected_tool !== "pwm" &&
selected_tool !== "laser" && selected_tool !== "laser" &&
selected_tool !== "router"; selected_tool !== "router";
console.log("saveModBus: ", saveModbus);
const settings = { const settings = {
["tool"]: { ...this.config.tool }, ["tool"]: { ...this.config.tool },
["pwm-spindle"]: { ...this.config["pwm-spindle"] }, ["pwm-spindle"]: { ...this.config["pwm-spindle"] },
@@ -421,8 +419,6 @@ module.exports = new Vue({
: undefined, : undefined,
}; };
delete settings.tool["tool-type"]; delete settings.tool["tool-type"];
console.log("settings: ", settings);
console.log('this.config["selected-tool-settings"]: ', this.config["selected-tool-settings"]);
this.config["selected-tool-settings"][selected_tool] = settings; this.config["selected-tool-settings"][selected_tool] = settings;
this.display_units = this.config.settings["units"]; this.display_units = this.config.settings["units"];

View File

@@ -155,17 +155,19 @@ module.exports = {
methods: { methods: {
change_selected_tool: function () { change_selected_tool: function () {
const selectedToolSettings = this.config["selected-tool-settings"] || {}; const selectedToolSettings = this.config["selected-tool-settings"] || {};
console.log("selectedToolSettings: ", selectedToolSettings);
const settings = selectedToolSettings[this.selected_tool] || {}; const settings = selectedToolSettings[this.selected_tool] || {};
console.log("settings", settings);
this.config.tool = merge({}, this.config.tool, settings["tool"]); this.config.tool = merge({}, this.config.tool, settings["tool"]);
this.config["pwm-spindle"] = merge({}, this.config["pwm-spindle"], settings["pwm-spindle"]); this.config["pwm-spindle"] = merge({}, this.config["pwm-spindle"], settings["pwm-spindle"]);
this.config["modbus-spindle"] = merge({}, this.config["modbus-spindle"], settings["modbus-spindle"]); this.config["modbus-spindle"] = merge({}, this.config["modbus-spindle"], settings["modbus-spindle"]);
console.log(this.config); if (this.selected_tool == "pwncnc-vfd" && _.isEmpty(settings)) {
this.config["modbus-spindle"]["regs"][5] = {
"reg-value": 6,
"reg-type": "stop-write",
"reg-addr": 40960,
};
}
const tool = this.toolList.find(tool => tool.id == this.config.tool["selected-tool"]); const tool = this.toolList.find(tool => tool.id == this.config.tool["selected-tool"]);
console.log("tool: ", tool);
this.config.tool["tool-type"] = tool.type || tool.name; this.config.tool["tool-type"] = tool.type || tool.name;
console.log(this.config.tool["tool-type"]);
this.$dispatch("config-changed"); this.$dispatch("config-changed");
}, },