Compare commits

...
16 Commits
Author SHA1 Message Date
Stefan Dej 52afc35fd6 update README.md for V0.0.11 2020-05-11 01:11:27 +02:00
Stefan Dej 9e5266425c feature: select value by focus heater input field 2020-05-11 01:07:29 +02:00
Stefan Dej 86595ab70b feature: temperature_sensor min/max temp by hover 2020-05-11 01:04:59 +02:00
Stefan Dej 0f87e3f28f bugfix: temperature_fans onload & update fix
feature: save hidden sensors from chart in gui.json
2020-05-11 00:54:36 +02:00
Stefan Dej 88305e74cf fixes #9 2020-05-09 02:20:50 +02:00
Stefan Dej abea5d8660 fixes #13 for time > 24h 2020-05-09 02:12:42 +02:00
Stefan Dej d2bccb737e Update README.md 2020-05-09 02:03:19 +02:00
Stefan Dej 0bfde82ee8 add sensor number 2020-05-09 01:58:16 +02:00
Stefan Dej de9485cc84 update README.md, load tempchart history, update to moonraker 2020-05-09 01:47:30 +02:00
Stefan Dej e8d2c71401 update README.md 2020-04-27 21:52:37 +02:00
meteyou 554b25d754 Merge pull request #5 from pusewicz/patch-1
Few tweaks to the README file

thx!
2020-04-27 12:36:51 +02:00
Piotr Usewicz ecf2ee070b Few tweaks to the README file
This is a PR that tweaks some of the README that fixes some of the typos. I did not go much into detail.
2020-04-27 12:14:42 +02:00
meteyou e35d13d446 Merge pull request #1 from meteyou/dependabot/npm_and_yarn/acorn-6.4.1
Bump acorn from 6.3.0 to 6.4.1
2020-04-27 10:52:07 +02:00
Stefan Dej 9f46a502fc finish README.md 2020-04-27 10:31:56 +02:00
Stefan Dej a4436348df finish README.md 2020-04-27 08:40:06 +02:00
dependabot[bot] d57e888133 Bump acorn from 6.3.0 to 6.4.1
Bumps [acorn](https://github.com/acornjs/acorn) from 6.3.0 to 6.4.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/6.3.0...6.4.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-03-16 03:31:57 +00:00
20 changed files with 4133 additions and 303 deletions

No files matched your search

+60 -33
View File
@@ -1,50 +1,53 @@
# Mainsail
Mainsail is a responsive web interface for [Klipper](https://github.com/KevinOConnor/klipper) 3D printer firmware. It communicates with the klipper-api from [Arksine](https://github.com/arksine).
Mainsail is a responsive web interface for the [Klipper](https://github.com/KevinOConnor/klipper) 3D printer firmware. It communicates with the Moonraker (Klipper-API) from [Arksine](https://github.com/arksine).
## Requirement
You need a full working Klipper-instance. Install Klipper with the official Installation documentaion and check the Logfile if klipper (/tmp/klippy.log) works.
## Automatic Install Scripts
* [Installer from ArmyAg08](https://github.com/ArmyAg08/mainsail-installer) (recommended)
* [Installer from BlackStump](https://github.com/BlackStump/mainsail-install) (untested)
## Installtion of Mainsail
The installation is split into several sections
## Manual installation of Mainsail
Mainsail requires a working Klipper instance. Please head over to the official Klipper [installation documentation](https://www.klipper3d.org/Installation.html).
- [Change branch for Klipper-API](#change-brunch-for-klipper-api)
- [configure Klipper-API](#configure-klipper-api)
- [install webserver & reverse proxy (nginx)](#install-webserver--reverse-proxy-nginx)
- [install & configure Mainsail](#install--configure-mainsail)
The installation is split into several sections:
### Change brunch for Klipper-API
- [Change branch for Klipper-API](#change-branch-for-moonraker)
- [Configure Klipper-API](#configure-moonraker)
- [Install the Webserver & Reverse Proxy (NGINX)](#install-webserver--reverse-proxy-nginx)
- [Install & Configure Mainsail](#install--configure-mainsail)
- [Change the Hostname](#change-the-hostname-optional)
### Change branch for Moonraker
The Klipper-API isn't merged in Klipper at the moment, so you have to change the Repository to [Arksine's Fork](https://github.com/Arksine/klipper/tree/work-web_server-20200131/klippy/extras/remote_api) with the Klipper-API.
```bash
cd ~/klipper
git remote add arksine https://github.com/Arksine/klipper.git
git fetch arksine
git checkout arksine/work-web_server-20200131
```
and install the python package "tornado"
```bash
~/klippy-env/bin/pip install tornado
~/klipper/scripts/install-moonraker.sh
```
### configure Klipper-API
edit your `printer.cfg` with `nano ~/printer.cfg` and add following lines:
### Configure Moonraker
Edit your `printer.cfg` with `nano ~/printer.cfg` and add the following lines:
```
[virtual_sdcard]
path: /home/pi/sdcard
[remote_api]
[api_server]
trusted_clients:
192.168.0.0/24
127.0.0.0/24
127.0.0.1
```
edit the first line of trusted_clients (192.168.0.0/24) to your network. The second line (127.0.0.0/24) is for reverse proxy later.
Edit the first line of `trusted_clients` (192.168.0.0/24) to your network. The second line (127.0.0.0/24) is for reverse proxy later.
If you need other options in your API you can find all options with descriptions on [Arksine's Fork](https://github.com/Arksine/klipper/tree/work-web_server-20200131/moonraker).
at last, we create the virtual_sdcard directory:
Finally, we create the `virtual_sdcard` directory:
```
mkdir ~/sdcard
```
now restart klipper (`sudo service klipper restart`) and check your klippy-log if klipper is starting correct again.
Restart klipper (`sudo service klipper restart`) and check your klippy.log if klipper is starting correct again.
when klipper is running, open the url `http://<printer-ip>:7125/printer/info` in your browser. if you see a content like this
When klipper is running, open the url `http://<printer-ip>:7125/printer/info` in your browser. If you see a content like this
```
{"result": {"hostname": "voron250", "error_detected": false, "version": "v0.8.0-479-gd586fb06", "is_ready": true, "message": "Printer is ready", "cpu": "4 core ARMv7 Processor rev 4 (v7l)"}}
```
@@ -56,9 +59,8 @@ nginx is important to mount all components on port 80 and host the static files
If you have installed lighttpd & haproxy before you have to stop & disable it:
```bash
sudo service haproxy stop
sudo update-rc.d -f haproxy remove
sudo service lighttpd stop
sudo update-rc.d -f lighttpd remove
sudo apt remove haproxy lighttpd
```
After disable all other webserver you can install nginx now:
@@ -144,30 +146,50 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
}
location /server {
proxy_pass http://apiserver/server;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
}
}
```
create directory for static files and active nginx config:
Create directory for static files and active nginx config:
```bash
mkdir ~/mainsail
sudo rm /etc/nginx/sites-enabled/default
sudo ln -s /etc/nginx/sites-available/mainsail /etc/nginx/sites-enabled/
sudo service nginx restart
```
now you can check again the API if it works with the reverse proxy. Open the url `http://<printer-ip>/printer/info` in your browser. if you see a content like this:
Now you can check again the API if it works with the reverse proxy. Open the url `http://<printer-ip>/printer/info` in your browser. if you see a content like this:
```
{"result": {"hostname": "voron250", "error_detected": false, "version": "v0.8.0-479-gd586fb06", "is_ready": true, "message": "Printer is ready", "cpu": "4 core ARMv7 Processor rev 4 (v7l)"}}
```
now we can install Mainsail.
Now we can install Mainsail.
### install & configure Mainsail
now you can download the current mainsail static data
### Install & Configure Mainsail
Now you can download the current mainsail static data
```bash
cd ~/mainsail
wget -q -O mainsail.zip https://github.com/meteyou/mainsail/releases/download/v0.0.9/mailsail-alpha-0.0.9.zip && unzip mainsail.zip && rm mainsail.zip
wget -q -O mainsail.zip https://github.com/meteyou/mainsail/releases/download/v0.0.11/mainsail-alpha-0.0.11.zip && unzip mainsail.zip && rm mainsail.zip
```
Now it should be possible to open the interface: `http://<printer-ip>/`.
### Change the Hostname (Optional)
to use the hostname instate of the ip, you can install the avahi-daemon:
```bash
sudo apt install avahi-daemon
```
and you can config your hostname (if you use a raspberry pi):
```bash
sudo raspi-config
```
in `2 Network Options` > `N1 Hostname` you can edit your hostname of your raspberry pi. After a reboot you can use `http://<hostname>.local/` to open the webinterface.
Example Klipper macros:
## Klipper example macros for Mainsail
These macros are important to start/pause/cancel prints.
```
[pause_resume]
@@ -212,10 +234,15 @@ gcode:
BASE_RESUME
```
## Update Mainsail to V0.0.9
## Update Mainsail to V0.0.11
```
sudo service klipper stop
cd ~/klipper
git clean -x -d -i
git fetch arksine && git checkout arksine/work-web_server-20200131
~/klipper/scripts/install-moonraker.sh #optional: only for the first installation of moonraker
rm -R ~/mainsail/*
cd ~/mainsail
wget -q -O kwc.zip https://github.com/meteyou/kwc/releases/download/v0.0.8/kwc-alpha-0.0.8.zip && unzip kwc.zip && rm kwc.zip
wget -q -O mainsail.zip https://github.com/meteyou/mainsail/releases/download/v0.0.11/mainsail-alpha-0.0.11.zip && unzip mainsail.zip && rm mainsail.zip
```
and update your macros & nginx config.
+3547 -133
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -16,6 +16,7 @@
"vue-chartjs": "^3.5.0",
"vue-context": "^5.1.0",
"vue-headful": "^2.1.0",
"vue-plotly": "^1.1.0",
"vue-resource": "^1.5.1",
"vue-simple-upload": "^0.1.6",
"vue-toast-notification": "^0.2.0",
+2 -2
View File
@@ -1,7 +1,7 @@
{
"socket": {
"hostname": "voron250.local",
"port": 8080,
"hostname": "kossel.local",
"port": 80,
"reconnectInterval": 3000
}
}
+29 -7
View File
@@ -18,8 +18,19 @@
<ul class="navi" :expand="$vuetify.breakpoint.mdAndUp">
<li v-for="(category, index) in routes" :key="index" :prepend-icon="category.icon"
:class="[category.path !== '/' && currentPage.includes(category.path) ? 'active' : '', 'nav-item']"
:value="true">
<router-link slot="activator" class="nav-link" exact :to="category.path" @click.prevent v-if="(category.title === 'Webcam' && boolNaviWebcam) || category.title !== 'Webcam'">
:value="true"
>
<router-link
slot="activator" class="nav-link" exact :to="category.path" @click.prevent
v-if="
(category.title === 'Webcam' && boolNaviWebcam) ||
(category.title === 'Heightmap' && boolNaviHeightmap) ||
(
category.title !== 'Webcam' &&
category.title !== 'Heightmap' &&
(is_ready || category.alwaysShow)
)
">
<v-icon>mdi-{{ category.icon }}</v-icon>
<span class="nav-title">{{ category.title }}</span>
<v-icon class="nav-arrow" v-if="category.children && category.children.length > 0">mdi-chevron-down</v-icon>
@@ -27,7 +38,7 @@
<ul class="child">
<li v-for="(page, pageIndex) in category.children" class="nav-item" v-bind:key="`${index}-${pageIndex}`">
<router-link :to="page.path" class="nav-link" @click.prevent>
<router-link :to="page.path" class="nav-link" @click.prevent v-if="is_ready || page.alwaysShow">
<v-icon>mdi-{{ page.icon }}</v-icon>
<span class="nav-title">{{ page.title }}</span>
</router-link>
@@ -85,11 +96,14 @@ export default {
data: () => ({
drawer: null,
activeClass: 'active',
routes: routes
routes: routes,
is_ready: false,
boolNaviHeightmap: false,
}),
created () {
this.$vuetify.theme.dark = true;
//this.$webSocketsConnect();
this.is_ready = (this.klippy_state === "ready") ? true : false;
this.boolNaviHeightmap = (typeof(this.config.bed_mesh) !== "undefined");
},
computed: {
currentPage: function() {
@@ -104,6 +118,8 @@ export default {
isConnecting: state => !state.socket.isConnected,
progress: state => state.printer.virtual_sdcard.progress,
boolNaviWebcam: state => state.gui.webcam.bool,
klippy_state: state => state.socket.klippy_state,
config: state => state.config,
}),
...mapGetters([
'getTitle'
@@ -112,7 +128,7 @@ export default {
methods: {
emergencyStop: function() {
this.$store.commit('setLoadingEmergencyStop', true);
//this.$socket.sendObj('post_printer_gcode', {script: 'M112'}, 'setLoadingEmergencyStop');
this.$socket.sendObj('post_printer_gcode', {script: 'M112'}, 'setLoadingEmergencyStop');
},
drawFavicon(val) {
let favicon = document.getElementById('favicon');
@@ -164,8 +180,14 @@ export default {
handler: function(val) {
this.drawFavicon(val);
}
},
klippy_state() {
this.is_ready = (this.klippy_state === "ready") ? true : false;
},
config() {
this.boolNaviHeightmap = (typeof(this.config.bed_mesh) !== "undefined");
}
}
},
}
</script>
+4 -1
View File
@@ -1,3 +1,4 @@
import store from '../store'
import { Line, mixins } from 'vue-chartjs'
const { reactiveProp } = mixins;
@@ -36,11 +37,13 @@ export default {
// See controller.isDatasetVisible comment
meta.hidden = meta.hidden === null ? !ci.data.datasets[index].hidden : null;
if (index_target) {
if (index_target !== -1) {
let meta_target = ci.getDatasetMeta(index_target);
meta_target.hidden = meta.hidden;
}
store.dispatch('setHeaterChartVisibility', { name: legendItem.text, hidden: meta.hidden });
ci.update();
}
},
@@ -8,7 +8,8 @@
</v-list-item>
<v-divider class="my-2"></v-divider>
<v-card-text class="">
<div><v-btn :href="'http://'+hostname+':'+port+'/printer/log'" color="primary"><v-icon class="mr-sm-2">mdi-download</v-icon>Download Log</v-btn></div>
<div><v-btn :href="'http://'+hostname+':'+port+'/printer/klippy.log'" color="primary"><v-icon class="mr-sm-2">mdi-download</v-icon>Klipper Log</v-btn></div>
<div><v-btn :href="'http://'+hostname+':'+port+'/server/moonraker.log'" color="mt-3 primary"><v-icon class="mr-sm-2">mdi-download</v-icon>Moonraker Log</v-btn></div>
<div><v-btn @click="doRestart" :loading="loadingRestart" color="error" class="mt-3"><v-icon class="mr-sm-2">mdi-cached</v-icon>Restart</v-btn></div>
<div><v-btn @click="doRestartFirmware" :loading="loadingRestartFirmware" class="mt-3" color="error"><v-icon class="mr-sm-2">mdi-cached</v-icon><span class="d-none d-sm-block">FW Restart</span></v-btn></div>
<div><v-btn @click="doRebootHost" :loading="loadingRebootHost" class="mt-3" color="error"><v-icon class="mr-sm-2">mdi-cached</v-icon><span class="d-none d-sm-block">Host Restart</span></v-btn></div>
+12 -7
View File
@@ -12,6 +12,11 @@
</v-list-item>
<v-divider class="my-2" ></v-divider>
<v-card-text class="px-0 pt-0 pb-2 content">
<v-layout wrap class=" text-center" v-if="display_message">
<v-flex col tag="strong" class="category-header">Message</v-flex>
<v-flex col class="text-left">{{ display_message }}</v-flex>
</v-layout>
<v-divider class="my-2" v-if="display_message" ></v-divider>
<v-layout wrap class=" text-center">
<v-flex col tag="strong" class="category-header">
Position
@@ -103,10 +108,6 @@
import { mapState, mapGetters } from 'vuex';
export default {
data: () => ({
}),
computed: {
...mapState({
toolhead: state => state.printer.toolhead,
@@ -126,6 +127,8 @@
printer_state: state => state.printer.idle_timeout.state,
printer_is_paused: state => state.printer.pause_resume.is_paused,
printer_is_printing: state => state.printer.virtual_sdcard.is_active,
display_message: state => state.printer.display_status.message,
}),
...mapGetters([
@@ -150,10 +153,12 @@
this.$socket.sendObj('post_printer_print_cancel', { }, 'setLoadingPrintCancel');
},
formatTime(seconds) {
let date = new Date(null);
date.setSeconds(seconds);
let h = Math.floor(seconds / 3600);
seconds %= 3600;
let m = Math.floor(seconds / 60);
let s = seconds % 60;
return date.toISOString().substr(11,8);
return h+':'+m+':'+s;
},
},
}
+20 -2
View File
@@ -9,11 +9,13 @@
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-thermometer</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Heaters</v-list-item-title>
<v-list-item-title class="headline">Temperatures</v-list-item-title>
<v-list-item-subtitle>
{{ heatersCount }} heaters
<span v-if="temperature_fans.length === 1">, {{ temperature_fans.length }} fan</span>
<span v-if="temperature_fans.length > 1">, {{ temperature_fans.length }} fans</span>
<span v-if="temperature_sensors.length === 1">, {{ temperature_sensors.length }} sensor</span>
<span v-if="temperature_sensors.length > 1">, {{ temperature_sensors.length }} sensors</span>
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
@@ -50,6 +52,18 @@
</v-col>
</v-row>
</div>
<div v-if="temperature_sensors.length" >
<v-divider class="my-2"></v-divider>
<v-row class="pl-3 pr-3 heater-row">
<v-col class="text-center py-0">
<b>Temperature<br />Sensors</b>
</v-col>
<v-col class="text-center py-0 vertical_align_center" v-for="(sensor,index) in temperature_sensors" v-bind:key="index+999" >
<span style="cursor: default;" :title="'min: '+sensor.measured_min_temp.toFixed(1)+'° / max: '+sensor.measured_max_temp.toFixed(1)+'°'">{{ sensor.temperature.toFixed(1) }}°C</span><br />
<small style="cursor: default;" :title="'min: '+sensor.measured_min_temp.toFixed(1)+'° / max: '+sensor.measured_max_temp.toFixed(1)+'°'">{{ sensor.name }}</small>
</v-col>
</v-row>
</div>
<v-divider class="my-2" v-if="boolTempchart"></v-divider>
<v-row v-if="boolTempchart">
<v-col>
@@ -61,7 +75,7 @@
</template>
<script>
import {mapGetters, mapState} from 'vuex'
import { mapGetters, mapState } from 'vuex'
import toolInput from '../../inputs/ToolInput'
import LineChart from '../../charts/LineChart.js'
@@ -90,7 +104,11 @@
'heaters',
'heatersCount',
'temperature_fans',
'temperature_sensors',
])
},
created() {
},
methods: {
fillData () {
+1 -1
View File
@@ -10,7 +10,7 @@
</style>
<template>
<v-text-field type="number" min="-273" max="1999" step="any" ref="toolField" v-model="value" class="tool-input" @change="setTemps">
<v-text-field type="number" min="-273" max="1999" step="any" ref="toolField" v-model="value" class="tool-input" @change="setTemps" onClick="this.select();">
</v-text-field>
</template>
+16 -4
View File
@@ -3,12 +3,12 @@
<v-col class="col-sm-12 col-md-7">
<status-panel></status-panel>
<webcam-panel v-if="showDashboardWebcam" class="mt-6"></webcam-panel>
<control-panel class="mt-6"></control-panel>
<control-panel class="mt-6" v-if="is_ready"></control-panel>
</v-col>
<v-col class="col-sm-12 col-md-5">
<tools-panel></tools-panel>
<peripherie-panel class="mt-6"></peripherie-panel>
<miniconsole-panel class="mt-6" v-if="showDashboardConsole"></miniconsole-panel>
<tools-panel v-if="is_ready"></tools-panel>
<peripherie-panel class="mt-6" v-if="is_ready"></peripherie-panel>
<miniconsole-panel class="mt-6" v-if="is_ready && showDashboardConsole"></miniconsole-panel>
</v-col>
</v-row>
</template>
@@ -17,13 +17,25 @@
import { mapState, mapGetters } from 'vuex'
export default {
data: () => ({
is_ready: false
}),
computed: {
...mapState({
showDashboardConsole: state => state.gui.dashboard.boolConsole,
klippy_state: state => state.socket.klippy_state,
}),
...mapGetters([
'showDashboardWebcam'
])
},
created() {
this.is_ready = (this.klippy_state === "ready") ? true : false;
},
watch: {
klippy_state() {
this.is_ready = (this.klippy_state === "ready") ? true : false;
}
}
}
</script>
+2 -2
View File
@@ -86,7 +86,7 @@
{{ item.layer_height ? item.layer_height.toFixed(2)+' mm' : '--' }}
</td>
<td class="text-no-wrap text-right">
{{ item.filament_used ? item.filament_used.toFixed()+' mm' : '--' }}
{{ item.filament_total ? item.filament_total.toFixed()+' mm' : '--' }}
</td>
<td class="text-no-wrap text-right">
{{ formatPrintTime(item.estimated_time) }}
@@ -164,7 +164,7 @@
},
{
text: 'Filament Usage',
value: 'filament_used',
value: 'filament_total',
align: 'right',
},
{
+159
View File
@@ -0,0 +1,159 @@
<style>
</style>
<template>
<div>
<v-row>
<v-col class="col-xl-8">
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-grid</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Heightmap</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider class="my-2"></v-divider>
<v-card-text class="px-0 py-0 content">
<Plotly ref="heightmap" :data="data" :layout="layout" :display-mode-bar="false"></Plotly>
</v-card-text>
</v-card>
</v-col>
<v-col class="col-xl-4">
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-cogs</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Profile</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider class="my-2"></v-divider>
<v-card-text>
<v-select
:items="profiles"
v-model="profile"
item-text="name"
item-value="data"
label="Profil"
outlined
></v-select>
</v-card-text>
</v-card>
</v-col>
</v-row>
</div>
</template>
<script>
import { mapState } from 'vuex';
import { Plotly } from 'vue-plotly'
export default {
components: {
Plotly
},
data () {
return {
data:[
{
x: [],
y: [],
z: [],
type:"surface",
intensity: [0, .05, .1],
cmin: -0.1,
cmax: 0.1,
showscale: true,
autocolorscale: true,
colorbar: {
tickfont: {
color: '#fff'
},
}
}
],
layout:{
showScale: true,
plot_bgcolor: 'transparent',
paper_bgcolor: 'transparent',
margin: {
l: 0,
r: 100,
b: 0,
t: 0
},
scene: {
camera: {
eye: {
x: -1.25,
y: -1.25,
z: 0.25
}
},
xaxis: {
color: '#fff',
range: [0,200]
},
yaxis: {
color: '#fff',
range: [0,200]
},
zaxis: {
color: '#fff',
range: [-1,1]
}
}
},
profiles: [],
profile: {}
}
},
computed: {
...mapState({
config: state => state.config,
}),
},
methods: {
},
watch: {
config: function() {
this.profiles = this.$store.getters.getBedMeshProfiles;
if (this.config.stepper_x !== undefined) this.layout.scene.xaxis.range = [this.config.stepper_x.position_min, this.config.stepper_x.position_max];
if (this.config.stepper_y !== undefined) this.layout.scene.yaxis.range= [this.config.stepper_y.position_min, this.config.stepper_y.position_max];
this.$refs.heightmap.update();
},
profile: function() {
this.data[0].x = [];
let x_step = (this.profile.max_x - this.profile.min_x) / this.profile.x_count;
for(let i = 0; i < this.profile.x_count; i++) {
this.data[0].x.push(parseFloat(this.profile.min_x) + parseFloat(x_step) * i);
}
this.data[0].y = [];
let y_step = (this.profile.max_y - this.profile.min_y) / this.profile.y_count;
for(let i = 0; i < this.profile.y_count; i++) {
this.data[0].y.push(parseFloat(this.profile.min_y) + parseFloat(y_step) * i);
}
this.data[0].z = [];
let rows = this.profile.points.split('\n')
rows.forEach((row) => {
if (row !== "") {
let tmp = [];
let cols = row.split(', ');
cols.forEach((col) => {
tmp.push(parseFloat(col));
});
this.data[0].z.push(tmp);
}
});
//this.$refs.heightmap.plot();
window.console.log(this.$refs);
}
}
}
</script>
+20 -3
View File
@@ -1,10 +1,10 @@
<template>
<div>
<v-row>
<v-col class="col-sm-12 col-md-6">
<v-col class="col-sm-12 col-md-6" v-if="is_ready">
<settings-limits-panel></settings-limits-panel>
</v-col>
<v-col class="col-sm-12 col-md-3">
<v-col class="col-sm-12 col-md-3" v-if="is_ready">
<settings-endstop-panel></settings-endstop-panel>
<settings-runout-panel></settings-runout-panel>
</v-col>
@@ -15,7 +15,24 @@
</div>
</template>
<script>
export default {
import {mapState} from "vuex";
export default {
data: () => ({
is_ready: false
}),
computed: {
...mapState({
klippy_state: state => state.socket.klippy_state,
}),
},
created() {
this.is_ready = (this.klippy_state === "ready") ? true : false;
},
watch: {
klippy_state() {
this.is_ready = (this.klippy_state === "ready") ? true : false;
}
}
}
</script>
+17 -2
View File
@@ -2,6 +2,7 @@ import Dashboard from '../pages/Dashboard.vue'
//import Status from '../pages/Status.vue'
import Webcam from '../pages/Webcam.vue'
import Console from '../pages/Console.vue'
import Heightmap from '../pages/Heightmap.vue'
import Files from '../pages/Files.vue'
import Settings from '../pages/Settings.vue'
import SettingsInterface from '../pages/settings/interface.vue'
@@ -13,18 +14,28 @@ const routes = [
path: '/',
icon: 'view-dashboard',
component: Dashboard,
alwaysShow: true,
},
{
title: "Webcam",
path: '/webcam',
icon: 'webcam',
component: Webcam,
alwaysShow: false,
},
{
title: "Console",
path: '/console',
icon: 'console-line',
component: Console,
alwaysShow: false,
},
{
title: "Heightmap",
path: '/heightmap',
icon: 'grid',
component: Heightmap,
alwaysShow: false,
},
/*{
title: "Current Job",
@@ -37,6 +48,7 @@ const routes = [
path: '/files',
icon: 'printer-3d-nozzle',
component: Files,
alwaysShow: false,
},
{
title: "Settings",
@@ -44,16 +56,19 @@ const routes = [
redirect: '/settings/machine',
icon: 'wrench',
component: Settings,
alwaysShow: true,
children: [
{
title: 'Machine',
path: '/settings/machine',
component: SettingsMachine
component: SettingsMachine,
alwaysShow: true,
},
{
title: 'Interface',
path: '/settings/interface',
component: SettingsInterface
component: SettingsInterface,
alwaysShow: true,
},
]
},
+53 -23
View File
@@ -17,23 +17,6 @@ export default {
});
Vue.prototype.$socket.sendObj('get_printer_info', {}, 'getKlipperInfo');
Vue.prototype.$socket.sendObj('get_printer_objects', {}, 'getObjectInfo');
Vue.prototype.$socket.sendObj('get_printer_status', { heater: [] }, 'getObjectInfo');
Vue.prototype.$socket.sendObj('get_printer_status', { configfile: ['config'] }, 'getPrinterConfig');
Vue.prototype.$socket.sendObj('post_printer_subscriptions', {
gcode: [],
toolhead: [],
virtual_sdcard: [],
heater: [],
heater_bed: [],
extruder: ["temperature", "target"],
fan: [],
pause_resume: [],
idle_timeout: [],
});
Vue.prototype.$socket.sendObj('get_printer_files', {}, 'getFileList');
Vue.prototype.$socket.sendObj('get_printer_gcode_help', {}, 'getHelpList');
},
socket_on_close ({ commit }, event) {
@@ -61,9 +44,9 @@ export default {
commit('setPrinterStatus', data.params[0]);
break;
/*case 'notify_klippy_state_changed':
case 'notify_klippy_state_changed':
commit('setPrinterStatus', data.params[0]);
break;*/
break;
case 'notify_filelist_changed':
commit('setFileList', data.params[0].filelist);
@@ -101,16 +84,58 @@ export default {
},
getKlipperInfo({ commit }, data) {
commit('setPrinterData', {
hostname: data.hostname,
version: data.version
});
if (data !== undefined && data.is_ready) {
commit('setPrinterData', {
hostname: data.hostname,
version: data.version
});
commit('setPrinterStatus', 'ready');
Vue.prototype.$socket.sendObj('get_printer_objects', {}, 'getObjectInfo');
Vue.prototype.$socket.sendObj('get_printer_status', { heaters: [] }, 'getHeatersInfo');
Vue.prototype.$socket.sendObj('get_printer_status', { configfile: ['config'] }, 'getPrinterConfig');
Vue.prototype.$socket.sendObj('post_printer_subscriptions', {
gcode: [],
toolhead: [],
virtual_sdcard: [],
heaters: [],
fan: [],
pause_resume: [],
idle_timeout: [],
display_status: [],
});
Vue.prototype.$socket.sendObj('get_printer_files', {}, 'getFileList');
Vue.prototype.$socket.sendObj('get_printer_gcode_help', {}, 'getHelpList');
} else {
commit('setPrinterStatus', 'disconnected');
setTimeout(function() {
Vue.prototype.$socket.sendObj('get_printer_info', {}, 'getKlipperInfo');
}, 1000);
}
},
getObjectInfo({ commit }, data) {
commit('setObjectData', data);
},
getHeatersInfo({ commit }, data) {
commit('setObjectData', data);
if (data.heaters.available_heaters.length) {
data.heaters.available_heaters.forEach(function(heater) {
Vue.prototype.$socket.sendObj('post_printer_subscriptions', { [heater]: [] });
})
}
Vue.prototype.$socket.sendObj("get_server_temperature_store", {}, "getHeatersHistory");
},
getHeatersHistory({ commit }, data) {
commit('setHeaterHistory', data);
},
getPrinterConfig({commit}, data) {
commit('setPrinterConfig', data);
},
@@ -124,6 +149,11 @@ export default {
commit('setHelpList', data);
},
setHeaterChartVisibility({ commit, dispatch }, data) {
commit('setHeaterChartVisibility', data);
dispatch('saveGuiSettings');
},
setLoadingSendGcode({commit}, value) {
commit('setLoadingSendGcode', value);
},
+54 -2
View File
@@ -6,9 +6,9 @@ export default {
heaters: state => {
let heaters = [];
if (state.object.heater.available_heaters) {
if (state.object.heaters.available_heaters) {
for (let [key, value] of Object.entries(state.printer)) {
if (state.object.heater.available_heaters.includes(key)) {
if (state.object.heaters.available_heaters.includes(key)) {
heaters.push({
name: key,
target: value.target,
@@ -60,6 +60,33 @@ export default {
});
},
temperature_sensors: state => {
let sensors = [];
for (let [key, value] of Object.entries(state.printer)) {
let nameSplit = key.split(" ");
if (nameSplit[0] === "temperature_sensor") {
sensors.push({
name: nameSplit[1],
temperature: value.temperature,
measured_min_temp: value.measured_min_temp,
measured_max_temp: value.measured_max_temp,
});
}
}
return sensors.sort((a, b) => {
let nameA = a.name.toUpperCase();
let nameB = b.name.toUpperCase();
if (nameA < nameB) return -1;
if (nameA > nameB) return 1;
return 0;
});
},
current_file_size: state => {
let file = state.files.filter((file) => file.filename === state.printer.virtual_sdcard.current_file);
@@ -180,6 +207,31 @@ export default {
});
},
getBedMeshProfiles: state => {
let profiles = [];
for (let [key, value] of Object.entries(state.config)) {
let nameSplit = key.split(" ");
if (nameSplit[0] === "bed_mesh" && nameSplit[1] !== undefined) {
profiles.push({
name: nameSplit[1],
data: value
});
}
}
return profiles.sort((a, b) => {
let nameA = a.name.toUpperCase();
let nameB = b.name.toUpperCase();
if (nameA < nameB) return -1;
if (nameA > nameB) return 1;
return 0;
});
},
getTitle: state => {
if (state.socket.isConnected) {
if (state.printer.pause_resume.is_paused) return "Pause Print";
+7 -1
View File
@@ -27,6 +27,7 @@ export default new Vuex.Store({
loadingShutdownHost: false,
loadingSaveGuiConfig: false,
loadingEndstopStatus: false,
klippy_state: "ready",
},
webcam: {
url: ""
@@ -37,6 +38,7 @@ export default new Vuex.Store({
boolTempchart: true,
boolConsole: false,
hiddenMacros: [],
hiddenTempChart: [],
},
webcam: {
bool: false,
@@ -71,6 +73,10 @@ export default new Vuex.Store({
printing_time: 0,
state: "",
},
display_status: {
message: null,
progress: 0,
},
virtual_sdcard: {
progress: 0,
current_file: "",
@@ -90,7 +96,7 @@ export default new Vuex.Store({
endstops: {},
},
object: {
heater: {
heaters: {
available_heaters: []
}
},
+127 -78
View File
@@ -1,11 +1,13 @@
import Vue from "vue";
const objectAssignDeep = require(`object-assign-deep`);
import { colorArray, colorChamber, colorHeaterBed, temperaturChartSampleInterval, temperaturChartSampleLength } from './variables';
import { colorArray, colorChamber, colorHeaterBed, temperaturChartSampleLength } from './variables';
export default {
setConnected (state) {
state.socket.isConnected = true;
//reset store
},
setDisconnected (state) {
@@ -16,81 +18,129 @@ export default {
setPrinterData(state, data) {
Object.assign(state.printer, data);
if (Array.isArray(state.object.heater.available_heaters) && state.object.heater.available_heaters.length) {
let boolAddValues = false;
let now = new Date();
if (Array.isArray(state.object.heaters.available_heaters) && state.object.heaters.available_heaters.length) {
let now = Date.now();
if (state.temperaturChart.labels.length === 0 || now - state.temperaturChart.labels[state.temperaturChart.labels.length - 1] > temperaturChartSampleInterval) {
for (let [key, value] of Object.entries(data)) {
let keySplit = key.split(" ");
for (let [key, value] of Object.entries(data)) {
let keySplit = key.split(" ");
if (state.object.heater.available_heaters.includes(key) || keySplit[0] === "temperature_fan") {
if (keySplit[0] === "temperature_fan") key = keySplit[1];
if (state.object.heaters.available_heaters.includes(key) || keySplit[0] === "temperature_fan") {
if (keySplit[0] === "temperature_fan") key = keySplit[1];
let index = state.temperaturChart.datasets.findIndex(element => element.label === key);
let index_target = state.temperaturChart.datasets.findIndex(element => element.label === key+'_target');
if (index >= 0) {
state.temperaturChart.datasets[index].data.push(value.temperature.toFixed(1));
state.temperaturChart.datasets[index_target].data.push(value.target.toFixed(1));
} else {
let color = '#f87979';
switch (key) {
case 'heater_bed': color = colorHeaterBed; break;
case 'chamber': color = colorChamber; break;
default: color = colorArray[state.temperaturChart.datasets.length]; break;
}
state.temperaturChart.datasets.push({
label: key,
data: [value.temperature.toFixed(1)],
borderColor: color,
backgroundColor: color,
fill: false,
borderDash: undefined,
borderWidth: 2,
pointRadius: 0,
pointHitRadius: 5,
showLine: true
});
state.temperaturChart.datasets.push({
label: key+"_target",
data: [value.target.toFixed(1)],
borderColor: color,
backgroundColor: color+'20',
fill: true,
borderDash: undefined,
borderWidth: 0,
pointRadius: 0,
pointHitRadius: 0,
showLine: true
});
}
boolAddValues = true;
}
this.commit('addTemperatureChartValue', { name: key, value: value, time: now });
}
if (boolAddValues) {
state.temperaturChart.labels.push(now);
if (state.temperaturChart.labels.length > temperaturChartSampleLength) {
state.temperaturChart.labels.splice(0, state.temperaturChart.labels.length-temperaturChartSampleLength)
}
}
for (let [key, dataset] of Object.entries(state.temperaturChart.datasets)) {
if (dataset.data.length > temperaturChartSampleLength) {
state.temperaturChart.datasets[key].data.splice(0, dataset.data.length-temperaturChartSampleLength)
}
}
}
}
},
setHeaterHistory(state, data) {
let now = new Date();
if (data !== undefined) {
for (let [key, datasets] of Object.entries(data)) {
let keySplit = key.split(" ");
if (keySplit.length > 1) key = keySplit[1];
let max = datasets.temperatures.length;
for (let i = 0; i < max; i++) {
let time = new Date(now.getTime() - 1000 * (max - i));
this.commit('addTemperatureChartValue', {
name: key,
value: {
temperature: datasets.temperatures[i],
target: datasets.targets[i],
},
type: keySplit[0],
time: time
});
}
}
}
},
addTemperatureChartValue(state, payload) {
if (state.temperaturChart.labels.map(Number).indexOf(+payload.time) < 0) {
state.temperaturChart.labels.push(payload.time);
if (state.temperaturChart.labels.length > temperaturChartSampleLength) {
state.temperaturChart.labels = state.temperaturChart.labels.splice(state.temperaturChart.labels.length - temperaturChartSampleLength)
}
}
let index = state.temperaturChart.datasets.findIndex(element => element.label === payload.name);
if (index < 0) {
this.commit('addTemperatureChartHeater', {
name: payload.name,
type: payload.type,
});
index = state.temperaturChart.datasets.findIndex(element => element.label === payload.name);
}
let index_target = state.temperaturChart.datasets.findIndex(element => element.label === payload.name+'_target');
if (index >= 0) state.temperaturChart.datasets[index].data.push(payload.value.temperature.toFixed(1));
if (index_target >= 0) state.temperaturChart.datasets[index_target].data.push(payload.value.target.toFixed(1));
if (index >= 0 && state.temperaturChart.datasets[index].data.length > temperaturChartSampleLength) {
state.temperaturChart.datasets[index].data = state.temperaturChart.datasets[index].data.splice(state.temperaturChart.datasets[index].data.length - temperaturChartSampleLength)
}
if (index_target >= 0 && state.temperaturChart.datasets[index_target].data.length > temperaturChartSampleLength) {
state.temperaturChart.datasets[index_target].data = state.temperaturChart.datasets[index_target].data.splice(state.temperaturChart.datasets[index_target].data.length - temperaturChartSampleLength)
}
},
addTemperatureChartHeater(state, payload) {
let color = '';
switch (payload.name) {
case 'heater_bed': color = colorHeaterBed; break;
case 'chamber': color = colorChamber; break;
default: color = colorArray[state.temperaturChart.datasets.length]; break;
}
let hidden = state.gui.dashboard.hiddenTempChart.indexOf(payload.name.toUpperCase()) >= 0 ? true : null;
state.temperaturChart.datasets.push({
label: payload.name,
data: [],
borderColor: color,
backgroundColor: color,
fill: false,
borderDash: undefined,
borderWidth: 2,
pointRadius: 0,
pointHitRadius: 5,
showLine: true,
lineTension: 0,
hidden: hidden,
});
if (payload.type !== "temperature_sensor") {
state.temperaturChart.datasets.push({
label: payload.name+"_target",
data: [],
borderColor: color,
backgroundColor: color+'20',
fill: true,
borderDash: undefined,
borderWidth: 0,
pointRadius: 0,
pointHitRadius: 0,
showLine: true,
lineTension: 0,
hidden: hidden,
});
}
},
setHeaterChartVisibility(state, data) {
let index = state.gui.dashboard.hiddenTempChart.indexOf(data.name.toUpperCase());
if (data.hidden && index === -1) state.gui.dashboard.hiddenTempChart.push(data.name.toUpperCase())
else if (data.hidden !== true && index > -1) state.gui.dashboard.hiddenTempChart.splice(index, 1);
},
setSettings(state, data) {
state = objectAssignDeep(state, data);
},
@@ -101,18 +151,16 @@ export default {
for (let key of Object.keys(data)) {
let nameSplit = key.split(" ");
if (nameSplit[0] === "temperature_fan") {
Vue.prototype.$socket.sendObj('post_printer_subscriptions', { [key]: [] });
}
if (nameSplit[0] === "filament_switch_sensor") {
Vue.prototype.$socket.sendObj('post_printer_subscriptions', { [key]: [] });
}
if (
nameSplit[0] === "temperature_fan" ||
nameSplit[0] === "temperature_sensors" ||
nameSplit[0] === "filament_switch_sensor"
) Vue.prototype.$socket.sendObj('post_printer_subscriptions', { [key]: [] });
}
},
setPrinterConfig(state, data) {
Vue.set(state, 'config', data.configfile.config);
if (data.configfile) Vue.set(state, 'config', data.configfile.config);
},
setFileList(state, data) {
@@ -156,7 +204,7 @@ export default {
message: data
});
if (data.substring(0,2) === "!!") {
if (data !== undefined && data.substring(0,2) === "!!") {
Vue.$toast.error(data);
}
},
@@ -184,7 +232,8 @@ export default {
},
setPrinterStatus(state, value) {
state.printer.toolhead.status = value;
state.socket.klippy_state = value;
//state.printer.toolhead.status = value;
},
setLoadingGcodeUpload(state, value) {
-1
View File
@@ -14,5 +14,4 @@ export const colorArray = [
export const colorHeaterBed = '#2196F3';
export const colorChamber = '#4CAF50';
export const temperaturChartSampleInterval = 1000;
export const temperaturChartSampleLength = 600;