diff --git a/docs/quicktips/presets.md b/docs/quicktips/presets.md
index 9ee2f55a..41f6a23d 100644
--- a/docs/quicktips/presets.md
+++ b/docs/quicktips/presets.md
@@ -16,7 +16,7 @@ In Mainsails interface settings you will find a section called "Preheat Presets"
### Preheat
-Enter a name \(e.g. name, color and type of filament\) and the temperatures obtained. You can disable individual heaters and even specify a custom gcode for the preheat phase.
+Enter a name \(e.g. name, color and type of filament\) and the temperatures obtained. You can disable individual heaters and even specify a custom gcode for the preheat phase. The gcode will be executed after the selected temperatures are set.

diff --git a/package-lock.json b/package-lock.json
index 9a1f35ce..f5716fa5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5,6 +5,7 @@
"requires": true,
"packages": {
"": {
+ "name": "mainsail",
"version": "1.3.0",
"dependencies": {
"axios": "^0.21.1",
@@ -18,6 +19,7 @@
"vue-context": "^6.0.0",
"vue-github-api": "^0.1.7",
"vue-headful": "^2.1.0",
+ "vue-observe-visibility": "^1.0.0",
"vue-plotly": "^1.1.0",
"vue-prism-editor": "^1.2.2",
"vue-resource": "^1.5.1",
@@ -17388,6 +17390,11 @@
"integrity": "sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ=",
"dev": true
},
+ "node_modules/vue-observe-visibility": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/vue-observe-visibility/-/vue-observe-visibility-1.0.0.tgz",
+ "integrity": "sha512-s5TFh3s3h3Mhd3jaz3zGzkVHKHnc/0C/gNr30olO99+yw2hl3WBhK3ng3/f9OF+qkW4+l7GkmwfAzDAcY3lCFg=="
+ },
"node_modules/vue-plotly": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/vue-plotly/-/vue-plotly-1.1.0.tgz",
@@ -35074,6 +35081,11 @@
}
}
},
+ "vue-observe-visibility": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/vue-observe-visibility/-/vue-observe-visibility-1.0.0.tgz",
+ "integrity": "sha512-s5TFh3s3h3Mhd3jaz3zGzkVHKHnc/0C/gNr30olO99+yw2hl3WBhK3ng3/f9OF+qkW4+l7GkmwfAzDAcY3lCFg=="
+ },
"vue-plotly": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/vue-plotly/-/vue-plotly-1.1.0.tgz",
diff --git a/package.json b/package.json
index 7c3eaf6e..8880531c 100644
--- a/package.json
+++ b/package.json
@@ -20,6 +20,7 @@
"vue-context": "^6.0.0",
"vue-github-api": "^0.1.7",
"vue-headful": "^2.1.0",
+ "vue-observe-visibility": "^1.0.0",
"vue-plotly": "^1.1.0",
"vue-prism-editor": "^1.2.2",
"vue-resource": "^1.5.1",
diff --git a/src/components/charts/TempChart.vue b/src/components/charts/TempChart.vue
index e66517b5..e9ae9a4e 100644
--- a/src/components/charts/TempChart.vue
+++ b/src/components/charts/TempChart.vue
@@ -57,11 +57,11 @@ export default {
if (mainDataset)
output += ""
output += convertName(dataset.seriesName)+":"
@@ -118,7 +118,7 @@ export default {
},
yAxis: [
{
- name: '[°C] Temperature',
+ name: 'Temperature [°C]',
type: 'value',
min: 0,
max: 300,
@@ -260,7 +260,7 @@ export default {
methods: {
createChart() {
if (document.getElementById("tempchart") && this.chart === null) {
- this.chart = echarts.init(document.getElementById("tempchart"), null, {renderer: 'svg'})
+ this.chart = echarts.init(document.getElementById("tempchart"), null, {renderer: 'canvas'})
this.chart.setOption(this.chartOptions)
} else setTimeout(() => {
this.createChart()
diff --git a/src/components/panels/ExtruderPanel.vue b/src/components/panels/ExtruderPanel.vue
index 640d7150..1fef72f4 100644
--- a/src/components/panels/ExtruderPanel.vue
+++ b/src/components/panels/ExtruderPanel.vue
@@ -9,13 +9,13 @@
Feed amount in mm:
- {{ amount }}
+ {{ amount }}
Feedrate in mm/s:
- {{ rate }}
+ {{ rate }}
@@ -34,15 +34,6 @@
import Vue from "vue";
export default {
- components: {
-
- },
- data: function() {
- return {
- feedAmount: 25,
- feedrate: 5,
- }
- },
computed: {
...mapState({
loadings: state => state.socket.loadings,
@@ -65,23 +56,39 @@
get() {
return [...this.feedrates].sort((a,b) => { return b-a })
}
+ },
+ currentFeedAmount: {
+ get() {
+ return parseFloat(this.$store.state.gui.dashboard.extruder.feedamount)
+ },
+ set(newVal) {
+ return this.$store.dispatch('gui/setSettings', { dashboard: { extruder: { feedamount: newVal } } })
+ }
+ },
+ currentFeedRate: {
+ get() {
+ return parseFloat(this.$store.state.gui.dashboard.extruder.feedrate)
+ },
+ set(newVal) {
+ return this.$store.dispatch('gui/setSettings', { dashboard: { extruder: { feedrate: newVal } } })
+ }
}
},
methods: {
setFeedAmount(value) {
- this.feedAmount = value;
+ this.currentFeedAmount = value;
},
setFeedrate(value) {
- this.feedrate = value;
+ this.currentFeedRate = value;
},
sendRetract() {
- let gcode = "M83\nG1 E-"+this.feedAmount+" F"+(this.feedrate * 60);
+ let gcode = "M83\nG1 E-"+this.currentFeedAmount+" F"+(this.currentFeedRate * 60);
this.$store.commit('server/addEvent', { message: gcode, type: 'command' });
this.$store.commit('socket/addLoading', { name: 'btnRetract' });
Vue.prototype.$socket.sendObj('printer.gcode.script', { script: gcode }, "socket/removeLoading", { name: 'btnRetract' });
},
sendDetract() {
- let gcode = "M83\nG1 E"+this.feedAmount+" F"+(this.feedrate * 60);
+ let gcode = "M83\nG1 E"+this.currentFeedAmount+" F"+(this.currentFeedRate * 60);
this.$store.commit('server/addEvent', { message: gcode, type: 'command' });
this.$store.commit('socket/addLoading', { name: 'btnDetract' });
Vue.prototype.$socket.sendObj('printer.gcode.script', { script: gcode }, "socket/removeLoading", { name: 'btnDetract' });
diff --git a/src/components/panels/Settings/WebcamPanel.vue b/src/components/panels/Settings/WebcamPanel.vue
index 2fef7043..f33ce99f 100644
--- a/src/components/panels/Settings/WebcamPanel.vue
+++ b/src/components/panels/Settings/WebcamPanel.vue
@@ -12,7 +12,17 @@
-
+
+
+
+
+
+
+
+
+
+
+
@@ -75,7 +77,7 @@
Name
- Color
+ Color
State
Current
Target
@@ -87,8 +89,8 @@
mdi-{{ heater.icon }}
{{ convertName(heater.name) }}
-
-
+
+
{{ heater.target > 0 ? (heater.power !== null ? (heater.power > 0 ? (heater.power * 100).toFixed(0)+'%' : "0%") : "active") : "off" }}
@@ -107,8 +109,8 @@
mdi-fan
{{ convertName(fan.name) }}
-
-
+
+
{{ fan.target > 0 && fan.speed > 0 ? (fan.speed * 100).toFixed(0)+"%" : (fan.target > 0 ? "standby" : "off") }}
@@ -129,8 +131,8 @@
{{ convertName(sensor.name) }}
-
-
+
+
diff --git a/src/components/panels/WebcamPanel.vue b/src/components/panels/WebcamPanel.vue
index 43e0271d..f28fc6c7 100644
--- a/src/components/panels/WebcamPanel.vue
+++ b/src/components/panels/WebcamPanel.vue
@@ -5,14 +5,17 @@
-
+
- mdi-webcamWebcam
+
+ mdi-webcam Webcam
+ (FPS: {{ currentFPS }})
+
-
+
@@ -23,12 +26,28 @@
export default {
data: function() {
return {
- refresh: Math.ceil(Math.random() * Math.pow(10, 12))
- }
+ refresh: Math.ceil(Math.random() * Math.pow(10, 12)),
+ connection: "",
+ imageData: "",
+
+ request_start_time: performance.now(),
+ start_time: performance.now(),
+ time: 0,
+ request_time: 0,
+ time_smoothing: 0.6,
+ request_time_smoothing: 0.1,
+ isVisible: true,
+ currentFPS: 0,
+ };
},
created: function () {
document.addEventListener("focus", () => this.handleRefreshChange(), false);
document.addEventListener("visibilitychange", this.handleRefreshChange, false);
+
+ if(this.webcamConfig.service === 'mjpegstreamer-adaptive') {
+ this.requestMjpeg()
+ }
+
},
components: {
@@ -37,14 +56,20 @@
...mapState({
'webcamConfig': state => state.gui.webcam
}),
- url() {
- let basicUrl = this.webcamConfig.url
- if (basicUrl && basicUrl.indexOf("?") === -1) basicUrl += "?"
- const params = new URLSearchParams(basicUrl)
- params.set('bypassCache', ""+this.refresh)
- return decodeURIComponent(params.toString())
+ url() {
+ if(this.webcamConfig.service === 'mjpegstreamer-adaptive') {
+ return this.imageData;
+ } else {
+ let basicUrl = this.webcamConfig.url
+ if (basicUrl && basicUrl.indexOf("?") === -1) basicUrl += "?"
+
+ const params = new URLSearchParams(basicUrl)
+ params.set('bypassCache', ""+this.refresh)
+ return decodeURIComponent(params.toString())
+ }
},
+
webcamStyle() {
let transforms = '';
if (this.webcamConfig.flipX) {
@@ -69,6 +94,47 @@
if (!document.hidden) {
this.refresh = Math.ceil(Math.random() * Math.pow(10, 12))
}
+ },
+
+ onLoad() {
+ const end_time = performance.now()
+ const current_time = end_time - this.start_time
+ this.time = (this.time * this.time_smoothing) + (current_time * (1.0 - this.time_smoothing))
+ this.start_time = end_time
+
+ const target_time = 1000/this.webcamConfig.targetFps
+
+ const current_request_time = performance.now() - this.request_start_time
+ this.request_time = (this.request_time * this.request_time_smoothing) + (current_request_time * (1.0 - this.request_time_smoothing))
+ const timeout = Math.max(0, target_time - this.request_time)
+
+ this.$nextTick(() => {
+ setTimeout(this.requestMjpeg, timeout)
+ })
+ },
+
+ requestMjpeg() {
+ if(!this.isVisible) return
+
+ this.request_start_time = performance.now()
+ let basicUrl = this.webcamConfig.url
+ basicUrl = basicUrl.replace("action=stream", "action=snapshot")
+ if (basicUrl && basicUrl.indexOf("?") === -1) basicUrl += "?"
+
+ const params = new URLSearchParams(basicUrl)
+ params.set('bypassCache', ""+ this.refresh + (Math.random() * 1000))
+
+
+ this.currentFPS = Math.round(1000 / this.time)
+
+ this.$nextTick(() => {
+ this.imageData = decodeURIComponent(params.toString())
+ })
+ },
+
+ visibilityChanged(isVisible) {
+ this.isVisible = isVisible
+ if(isVisible) this.requestMjpeg()
}
}
}
diff --git a/src/main.js b/src/main.js
index 1e72a08b..cc22b74a 100644
--- a/src/main.js
+++ b/src/main.js
@@ -7,10 +7,12 @@ import './components'
import store from './store'
import router from './plugins/router'
import vueHeadful from 'vue-headful';
+import VueObserveVisibility from 'vue-observe-visibility';
Vue.config.productionTip = false;
Vue.use(VueResource);
+Vue.use(VueObserveVisibility);
Vue.http.headers.common['Content-Type'] = 'application/json';
Vue.http.headers.common['Access-Control-Allow-Origin'] = '*';
Vue.http.headers.common['Accept'] = 'application/json, text/plain, */*';
diff --git a/src/store/gui/index.js b/src/store/gui/index.js
index 4e3bf7f4..9ea8da63 100644
--- a/src/store/gui/index.js
+++ b/src/store/gui/index.js
@@ -20,11 +20,15 @@ export function getDefaultState() {
stepsZ: [ 25, 1, 0.1 ],
},
extruder: {
+ feedamount: 25,
feedamounts: [ 50, 25, 10, 5, 1 ],
+ feedrate: 5,
feedrates: [ 60, 30, 15, 5, 1 ],
}
},
webcam: {
+ service: 'mjpegstreamer',
+ targetFps: 25,
url: "",
rotate: false,
rotateDegrees: 90,
diff --git a/src/store/printer/tempHistory/actions.js b/src/store/printer/tempHistory/actions.js
index 990dfffb..ec58701e 100644
--- a/src/store/printer/tempHistory/actions.js
+++ b/src/store/printer/tempHistory/actions.js
@@ -43,9 +43,16 @@ export default {
lineStyle: {
color: rootGetters["gui/getDatasetValue"]({ name: name, type: 'color' }) || color,
width: 2,
- opacity: (rootGetters["gui/getDatasetValue"]({ name: name, type: 'temperature' })) ? 1 : 0
+ opacity: (rootGetters["gui/getDatasetValue"]({ name: name, type: 'temperature' })) ? 0.9 : 0
},
symbol: 'none',
+ emphasis: {
+ lineStyle: {
+ color: rootGetters["gui/getDatasetValue"]({ name: name, type: 'color' }) || color,
+ width: 2,
+ opacity: (rootGetters["gui/getDatasetValue"]({ name: name, type: 'temperature' })) ? 0.9 : 0
+ }
+ },
data: [],
}
@@ -74,6 +81,16 @@ export default {
color: datasetTemperature.lineStyle.color,
opacity: (rootGetters["gui/getDatasetValue"]({ name: name, type: 'target' })) ? 0.1 : 0
},
+ emphasis: {
+ lineStyle: {
+ color: datasetTemperature.lineStyle.color,
+ width: 0,
+ },
+ areaStyle: {
+ color: datasetTemperature.lineStyle.color,
+ opacity: (rootGetters["gui/getDatasetValue"]({ name: name, type: 'target' })) ? 0.1 : 0
+ },
+ },
symbol: 'none',
data: [],
}
@@ -102,7 +119,15 @@ export default {
color: datasetTemperature.lineStyle.color,
width: 1,
type: 'dotted',
- opacity: (rootGetters["gui/getDatasetValue"]({ name: name, type: additionalType })) ? 1 : 0
+ opacity: (rootGetters["gui/getDatasetValue"]({ name: name, type: additionalType })) ? 0.9 : 0
+ },
+ emphasis: {
+ lineStyle: {
+ color: datasetTemperature.lineStyle.color,
+ width: 1,
+ type: 'dotted',
+ opacity: (rootGetters["gui/getDatasetValue"]({ name: name, type: additionalType })) ? 0.9 : 0
+ },
},
symbol: 'none',
data: [],
diff --git a/src/store/printer/tempHistory/mutations.js b/src/store/printer/tempHistory/mutations.js
index 453958f9..d47cd021 100644
--- a/src/store/printer/tempHistory/mutations.js
+++ b/src/store/printer/tempHistory/mutations.js
@@ -59,7 +59,7 @@ export default {
if (payload.type === "target" && 'areaStyle' in state.series[datasetIndex]) {
Vue.set(state.series[datasetIndex].areaStyle, 'opacity', payload.value ? 0.1 : 0)
} else if ('lineStyle' in state.series[datasetIndex]) {
- Vue.set(state.series[datasetIndex].lineStyle, 'opacity', payload.value)
+ Vue.set(state.series[datasetIndex].lineStyle, 'opacity', payload.value ? 0.9 : 0)
}
}
},