feature: variable max temp from temp chart

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej committed 2020-12-09 23:54:13 +01:00
1 parent 8ee22269e2
commit ea932e85f0
2 files changed
+31 -7

No files matched your search

+6 -7
View File
@@ -3,7 +3,6 @@
</template>
<script>
import { mapState, mapGetters } from 'vuex'
import CanvasJS from '@/assets/canvasjs-3.2.3/canvasjs.min'
export default {
@@ -48,17 +47,16 @@ export default {
}
},
computed: {
...mapState({
}),
...mapGetters([
//'printer/getMacros',
]),
datasets: {
get () {
return this.$store.state.printer.tempHistory.datasets
}
},
maxTemp: {
get() {
return this.$store.getters["printer/getMaxTemp"]
}
}
},
methods: {
@@ -72,6 +70,7 @@ export default {
this.chartOptions.data = this.datasets
this.chartOptions.axisX.minimum = new Date() - 60* this.tempchartDisplayMinutes *1000
this.chartOptions.axisX.maximum = new Date()
this.chartOptions.axisY.maximum = this.maxTemp
this.chart.render()
}
}, 1000);
+25
View File
@@ -275,6 +275,31 @@ export default {
return ''
},
getMaxTemp: state => {
let maxtemp = 0
Object.entries(state.configfile.config).forEach(([key, value]) => {
if (
Array.isArray(state.heaters.available_heaters) &&
state.heaters.available_heaters.length
) {
let keySplit = key.split(" ")
if (
(
state.heaters.available_heaters.includes(key) ||
keySplit[0] === "temperature_fan" ||
keySplit[0] === "temperature_sensor"
) &&
'max_temp' in value &&
maxtemp < parseInt(value.max_temp)
) maxtemp = parseInt(value.max_temp)
}
})
return (maxtemp > 0 ? maxtemp + 10 : 300)
},
existPrinterConfig: state => {
if (
typeof(state.configfile.config) === "object" &&