merged upstream master

This commit is contained in:
Eike Ahmels committed 2021-02-24 22:11:46 +01:00
commit 01df98b8ec
12 files changed
+198 -49

No files matched your search

+1 -1
View File
@@ -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.
![](../assets/img/quicktips/presets/preheat.png)
+12
View File
@@ -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",
+1
View File
@@ -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",
+7 -7
View File
@@ -57,11 +57,11 @@ export default {
if (mainDataset)
output += "<span style=\"" +
"display:inline-block;" +
"margin-right:6px;" +
"width:10px;" +
"height:10px;" +
"border:1px solid "+mainDataset.lineStyle.color+";" +
"background-color:"+mainDataset.lineStyle.color+"66;" +
"margin-right:10px;" +
"width:8px;" +
"height:8px;" +
"border-radius: 50%;" +
"background-color:"+mainDataset.lineStyle.color+"CC;" +
"\"></span>"
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()
+22 -15
View File
@@ -9,13 +9,13 @@
<v-col class="col col-md-6">
<v-label>Feed amount in mm:</v-label>
<v-btn-toggle class="mt-2" dense no-gutters style="flex-wrap: nowrap; width: 100%;" >
<v-btn v-for="amount in feedamountsSorted" v-bind:key="amount" @click="setFeedAmount(amount)" dense :class="(amount === feedAmount ? 'v-btn--active' : '') + ' btnMinWidthAuto flex-grow-1 px-0 _btnFeedrate'">{{ amount }}</v-btn>
<v-btn v-for="amount in feedamountsSorted" v-bind:key="amount" @click="setFeedAmount(amount)" dense :class="(amount === currentFeedAmount ? 'v-btn--active' : '') + ' btnMinWidthAuto flex-grow-1 px-0 _btnFeedrate'">{{ amount }}</v-btn>
</v-btn-toggle>
</v-col>
<v-col class="col col-md-6">
<v-label>Feedrate in mm/s:</v-label>
<v-btn-toggle class="mt-2" dense no-gutters style="flex-wrap: nowrap; width: 100%;" >
<v-btn v-for="rate in feedratesSorted" v-bind:key="rate" @click="setFeedrate(rate)" dense :class="(feedrate === rate ? 'v-btn--active' : '') + ' btnMinWidthAuto flex-grow-1 px-0 _btnFeedrate'">{{ rate }}</v-btn>
<v-btn v-for="rate in feedratesSorted" v-bind:key="rate" @click="setFeedrate(rate)" dense :class="(rate === currentFeedRate ? 'v-btn--active' : '') + ' btnMinWidthAuto flex-grow-1 px-0 _btnFeedrate'">{{ rate }}</v-btn>
</v-btn-toggle>
</v-col>
</v-row>
@@ -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' });
+32 -2
View File
@@ -12,7 +12,17 @@
<v-card-text>
<v-container px-0 py-0>
<v-row>
<v-col class="pt-2 mb-1">
<v-col class="py-2">
<v-select v-model="service" :items="serviceItems" hide-details label="Service" class="mt-0"></v-select>
</v-col>
</v-row>
<v-row v-if="service === 'mjpegstreamer-adaptive'">
<v-col class="py-2 mt-2">
<v-text-field v-model="targetFps" hide-details label="Target FPS" class="mt-0"></v-text-field>
</v-col>
</v-row>
<v-row>
<v-col class="pt-2 mt-2 mb-1">
<v-text-field
v-model="webcamUrl"
hide-details
@@ -55,7 +65,11 @@
},
data: function() {
return {
rotationEnabled: false
rotationEnabled: false,
serviceItems: [
{ value: 'mjpegstreamer', text: 'MJPEG-Streamer' },
{ value: 'mjpegstreamer-adaptive', text: 'Adaptive MJPEG-Streamer (experimental)' },
]
}
},
computed: {
@@ -107,6 +121,22 @@
return this.$store.dispatch('gui/setSettings', { webcam: { bool: showNav } });
}
},
service: {
get() {
return this.$store.state.gui.webcam.service;
},
set(selectedMethod) {
return this.$store.dispatch('gui/setSettings', { webcam: { service: selectedMethod } });
}
},
targetFps: {
get() {
return this.$store.state.gui.webcam.targetFps;
},
set(fps) {
return this.$store.dispatch('gui/setSettings', { webcam: { targetFps: fps } });
}
}
},
methods: {
+12 -10
View File
@@ -12,10 +12,12 @@
}
.datasetColorSymbol {
width: 15px;
height: 15px;
width: 8px;
height: 8px;
border-style: solid;
border-width: 1px;
border-width: 0px;
cursor: pointer;
border-radius: 50%;
}
</style>
@@ -75,7 +77,7 @@
<v-container class="px-0">
<v-row align="center">
<v-col class="py-2 font-weight-bold" style="padding-left: 68px;">Name</v-col>
<v-col class="py-2 text-center flex-grow-0 font-weight-bold d-none d-sm-block" style="min-width: 70px;">Color</v-col>
<v-col class="py-2 text-center flex-grow-0 font-weight-bold d-none d-sm-block" v-if="boolTempchart" style="min-width: 70px;">Color</v-col>
<v-col class="py-2 text-center font-weight-bold d-none d-sm-block">State</v-col>
<v-col class="py-2 text-center font-weight-bold">Current</v-col>
<v-col class="py-2 pr-8 text-center font-weight-bold">Target</v-col>
@@ -87,8 +89,8 @@
<v-icon :color="heater.color">mdi-{{ heater.icon }}</v-icon>
</v-col>
<v-col class="py-2 font-weight-bold"><span style="cursor: pointer;" @click="openHeater(heater)">{{ convertName(heater.name) }}</span></v-col>
<v-col class="py-2 flex-grow-0 text-center d-none d-sm-block" style="min-width: 70px;">
<div :style="'background-color: '+heater.chartColor+'66; border-color: '+heater.chartColor+'; cursor: pointer;'" class="datasetColorSymbol d-inline-block" @click="openHeater(heater)"></div>
<v-col class="py-2 flex-grow-0 text-center d-none d-sm-block" v-if="boolTempchart" style="min-width: 70px;">
<div :style="'background-color: '+heater.chartColor+'cc;'" class="datasetColorSymbol d-inline-block" @click="openHeater(heater)"></div>
</v-col>
<v-col class="py-2 text-center d-none d-sm-block"><small>{{ heater.target > 0 ? (heater.power !== null ? (heater.power > 0 ? (heater.power * 100).toFixed(0)+'%' : "0%") : "active") : "off" }}</small></v-col>
<v-col class="py-2 text-center">
@@ -107,8 +109,8 @@
<v-icon :color="(fan.target ? 'grey lighten-5' : 'grey darken-2')" :class="(fan.speed ? ' icon-rotate' : '')">mdi-fan</v-icon>
</v-col>
<v-col class="py-2 font-weight-bold"><span style="cursor: pointer;" @click="openHeater(fan)">{{ convertName(fan.name) }}</span></v-col>
<v-col class="py-2 flex-grow-0 text-center d-none d-sm-block" style="min-width: 70px;">
<div :style="'background-color: '+fan.chartColor+'66; border-color: '+fan.chartColor+'; cursor: pointer;'" class="datasetColorSymbol d-inline-block" @click="openHeater(fan)"></div>
<v-col class="py-2 flex-grow-0 text-center d-none d-sm-block" v-if="boolTempchart" style="min-width: 70px;">
<div :style="'background-color: '+fan.chartColor+'cc;'" class="datasetColorSymbol d-inline-block" @click="openHeater(fan)"></div>
</v-col>
<v-col class="py-2 text-center d-none d-sm-block"><small>{{ fan.target > 0 && fan.speed > 0 ? (fan.speed * 100).toFixed(0)+"%" : (fan.target > 0 ? "standby" : "off") }}</small></v-col>
<v-col class="py-2 text-center">
@@ -129,8 +131,8 @@
<v-col class="py-2 font-weight-bold">
<span style="cursor: pointer;" @click="openHeater(sensor)">{{ convertName(sensor.name) }}</span>
</v-col>
<v-col class="py-2 flex-grow-0 text-center d-none d-sm-block" style="min-width: 70px;">
<div :style="'background-color: '+sensor.chartColor+'66; border-color: '+sensor.chartColor+'; cursor: pointer;'" class="datasetColorSymbol d-inline-block" @click="openHeater(sensor)"></div>
<v-col class="py-2 flex-grow-0 text-center d-none d-sm-block" v-if="boolTempchart" style="min-width: 70px;">
<div :style="'background-color: '+sensor.chartColor+'CC;'" class="datasetColorSymbol d-inline-block" @click="openHeater(sensor)"></div>
</v-col>
<v-col class="py-2 d-none d-sm-block"><span>&nbsp;</span></v-col>
<v-col class="py-2 text-center">
+77 -11
View File
@@ -5,14 +5,17 @@
</style>
<template>
<v-card>
<v-card v-observe-visibility="visibilityChanged">
<v-toolbar flat dense >
<v-toolbar-title>
<span class="subheading"><v-icon left>mdi-webcam</v-icon>Webcam</span>
<span class="subheading">
<v-icon left>mdi-webcam</v-icon> Webcam
<small v-if="this.webcamConfig.service === 'mjpegstreamer-adaptive' && this.time">(FPS: {{ currentFPS }})</small>
</span>
</v-toolbar-title>
</v-toolbar>
<v-card-text class="px-0 py-0 content">
<img :src="url" class="webcamImage" :style="webcamStyle" alt="Webcam"/>
<img :src="url" class="webcamImage" :style="webcamStyle" @load="onLoad" alt="Webcam"/>
</v-card-text>
</v-card>
</template>
@@ -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()
}
}
}
+2
View File
@@ -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, */*';
+4
View File
@@ -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,
+27 -2
View File
@@ -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: [],
+1 -1
View File
@@ -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)
}
}
},