added flushing and printing config

This commit is contained in:
sanjayk03-dev
2024-01-02 19:08:01 +05:30
parent 505ea06c73
commit 20c4a3b39d
3 changed files with 18 additions and 13 deletions

View File

@@ -511,7 +511,7 @@ module.exports = {
try{ try{
this.load(); this.load();
console.log("Loaded file"); console.log("Loaded file");
// this.start_pause(); this.start_pause();
}catch(error){ }catch(error){
console.warn("Error running program: ",error); console.warn("Error running program: ",error);
} }

View File

@@ -100,7 +100,10 @@ module.exports = {
alert("Restore failed"); alert("Restore failed");
} }
}, },
printConfig: async function(){ printConfig: function(){
console.log(this.config);
},
flushConfig: async function(){
this.config.macros=[ this.config.macros=[
{ {
name:"Macros 1", name:"Macros 1",
@@ -110,25 +113,25 @@ module.exports = {
}, },
{ {
name:"Macros 2", name:"Macros 2",
color: "", color: "#efefef",
gcode_file_name: " ", gcode_file_name: " ",
gcode_file_time: 0 gcode_file_time: 0
}, },
{ {
name:"Macros 3", name:"Macros 3",
color: "", color: "#efefef",
gcode_file_name: " ", gcode_file_name: " ",
gcode_file_time: 0 gcode_file_time: 0
}, },
{ {
name:"Macros 4", name:"Macros 4",
color: "", color: "#efefef",
gcode_file_name: " ", gcode_file_name: " ",
gcode_file_time: 0 gcode_file_time: 0
}, },
{ {
name:"Macros 5", name:"Macros 5",
color: "", color: "#efefef",
gcode_file_name: " ", gcode_file_name: " ",
gcode_file_time: 0 gcode_file_time: 0
}, },
@@ -141,7 +144,7 @@ module.exports = {
] ]
try { try {
await api.put("config/save",this.config); await api.put("config/save",this.config);
console.log("Successfully saved"); console.log("Successfully flushed");
this.$dispatch("update"); this.$dispatch("update");
} catch (error) { } catch (error) {
console.error("Restore Failed: ",error); console.error("Restore Failed: ",error);

View File

@@ -25,7 +25,7 @@ script#macros-template(type="text/x-template")
p.title Enter Macros 1 Name p.title Enter Macros 1 Name
.input-container .input-container
input.input-color(type="color",id="macros-color-0",value="#ffffff") input.input-color(type="color",id="macros-color-0",value="#ffffff")
input.input-name(type="text",id="macros-name-0") input.input-name(type="text",maxlength='10',id="macros-name-0")
p.title Select/Upload G-Code p.title Select/Upload G-Code
select(title="Select previously uploaded GCode programs.", select(title="Select previously uploaded GCode programs.",
v-model="state.selected", @change="load", :disabled="!is_ready", v-model="state.selected", @change="load", :disabled="!is_ready",
@@ -47,7 +47,7 @@ script#macros-template(type="text/x-template")
p.title Enter Macros 2 Name p.title Enter Macros 2 Name
.input-container .input-container
input.input-color(type="color",id="macros-color-1",value="#ffffff") input.input-color(type="color",id="macros-color-1",value="#ffffff")
input.input-name(type="text",id="macros-name-1") input.input-name(type="text",maxlength='10',id="macros-name-1")
p.title Select/Upload G-Code p.title Select/Upload G-Code
select(title="Select previously uploaded GCode programs.", select(title="Select previously uploaded GCode programs.",
v-model="state.selected", @change="load", :disabled="!is_ready", v-model="state.selected", @change="load", :disabled="!is_ready",
@@ -69,7 +69,7 @@ script#macros-template(type="text/x-template")
p.title Enter Macros 3 Name p.title Enter Macros 3 Name
.input-container .input-container
input.input-color(type="color",id="macros-color-2",value="#ffffff") input.input-color(type="color",id="macros-color-2",value="#ffffff")
input.input-name(type="text",id="macros-name-2") input.input-name(type="text",maxlength='10',id="macros-name-2")
p.title Select/Upload G-Code p.title Select/Upload G-Code
select(title="Select previously uploaded GCode programs.", select(title="Select previously uploaded GCode programs.",
v-model="state.selected", @change="load", :disabled="!is_ready", v-model="state.selected", @change="load", :disabled="!is_ready",
@@ -91,7 +91,7 @@ script#macros-template(type="text/x-template")
p.title Enter Macros 4 Name p.title Enter Macros 4 Name
.input-container .input-container
input.input-color(type="color",id="macros-color-3",value="#ffffff") input.input-color(type="color",id="macros-color-3",value="#ffffff")
input.input-name(type="text",id="macros-name-3") input.input-name(type="text",maxlength='10',id="macros-name-3")
p.title Select/Upload G-Code p.title Select/Upload G-Code
select(title="Select previously uploaded GCode programs.", select(title="Select previously uploaded GCode programs.",
v-model="state.selected", @change="load", :disabled="!is_ready", v-model="state.selected", @change="load", :disabled="!is_ready",
@@ -113,7 +113,7 @@ script#macros-template(type="text/x-template")
p.title Enter Macros 5 Name p.title Enter Macros 5 Name
.input-container .input-container
input.input-color(type="color",id="macros-color-4",value="#ffffff") input.input-color(type="color",id="macros-color-4",value="#ffffff")
input.input-name(type="text",id="macros-name-4") input.input-name(type="text",maxlength='10',id="macros-name-4")
p.title Select/Upload G-Code p.title Select/Upload G-Code
select(title="Select previously uploaded GCode programs.", select(title="Select previously uploaded GCode programs.",
v-model="state.selected", @change="load", :disabled="!is_ready", v-model="state.selected", @change="load", :disabled="!is_ready",
@@ -135,7 +135,7 @@ script#macros-template(type="text/x-template")
p.title Enter Macros 6 Name p.title Enter Macros 6 Name
.input-container .input-container
input.input-color(type="color",id="macros-color-5",value="#ffffff") input.input-color(type="color",id="macros-color-5",value="#ffffff")
input.input-name(type="text",id="macros-name-5") input.input-name(type="text",maxlength='10',id="macros-name-5")
p.title Select/Upload G-Code p.title Select/Upload G-Code
select(title="Select previously uploaded GCode programs.", select(title="Select previously uploaded GCode programs.",
v-model="state.selected", @change="load", :disabled="!is_ready", v-model="state.selected", @change="load", :disabled="!is_ready",
@@ -154,4 +154,6 @@ script#macros-template(type="text/x-template")
button.pure-button(title="Print config.", @click="printConfig", button.pure-button(title="Print config.", @click="printConfig",
style="height:50px;width:120px;font-weight:normal;padding-top:5px") print Config style="height:50px;width:120px;font-weight:normal;padding-top:5px") print Config
button.pure-button(title="Print config.", @click="flushConfig",
style="height:50px;width:120px;font-weight:normal;padding-top:5px") Flush Config