Compare commits

...
30 Commits
Author SHA1 Message Date
Stefan Dej 0a51b0d255 bugfix: time format in status panel,
update README.md for V0.0.12
2020-05-11 08:40:00 +02:00
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
Stefan Dej 706515bc84 Update Websocket + README.md 2020-04-27 01:55:01 +02:00
Stefan Dej efc70ca5aa test with new websocket implementation 2020-04-25 21:17:27 +02:00
Stefan Dej 544d5e2db5 update npm packages & change to local dependency 2020-04-19 17:06:31 +02:00
Stefan Dej 70e8ce5687 update README.md for V0.0.8 2020-04-18 03:24:21 +02:00
Stefan Dej 6bc72dcb8c modify nginx config in README;
Settings > Machine > Endstop Status
Settings > Machine > Runout Sensor
2020-04-18 03:13:44 +02:00
Stefan Dej d0f78196c5 modify nginx config in README 2020-04-14 13:48:33 +02:00
Stefan Dej ec827bbea4 add nginx config in README 2020-04-14 13:34:32 +02:00
Stefan Dej beba547031 clean settings and last API corrections 2020-04-14 00:43:32 +02:00
Stefan Dej bb18992f80 add interface settings and save gui.json on virtual_sdcard 2020-04-14 00:08:52 +02:00
Stefan Dej 572fbd7629 edit README.md: including lighttpd and optimize haproxy 2020-04-12 17:42:23 +02:00
Stefan Dej 69fff8fe0e dashboard:
- temp combine table+chart;
- add estimated time by: filament, slicer
- format control buttons

gcode files:
- add meta data
2020-04-12 03:56:32 +02:00
Stefan Dej 101904bd6d console autocomplete;
tempchart target temp;
settings machinelimits
add webcamsupport
2020-04-12 00:13:40 +02:00
Stefan Dej 28177e35a7 update README.md to V0.0.6 2020-03-26 01:50:54 +01: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
56 changed files with 7043 additions and 1116 deletions

No files matched your search

+192 -43
View File
@@ -1,28 +1,195 @@
# Klipper Web Control
KWC 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
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).
## Installation
At first install Arksine klipper-api fork/branch -> [install manual](https://github.com/Arksine/klipper/tree/work-web_server-20200131/klippy/extras/web_server)
## Automatic Install Scripts
* [Installer from ArmyAg08](https://github.com/ArmyAg08/mainsail-installer) (recommended)
* [Installer from BlackStump](https://github.com/BlackStump/mainsail-install) (untested)
## 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).
The installation is split into several sections:
- [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.
Download and install KWC:
```bash
mkdir -p ~/kwc
cd ~/kwc
wget -q -O kwc.zip https://github.com/meteyou/kwc/releases/download/v0.0.5/kwc-alpha-0.0.5.zip && unzip kwc.zip && rm kwc.zip
cd ~/klipper
git remote add arksine https://github.com/Arksine/klipper.git
git fetch arksine
git checkout arksine/work-web_server-20200131
~/klipper/scripts/install-moonraker.sh
```
Configure web_server in printer.cfg:
### Configure Moonraker
Edit your `printer.cfg` with `nano ~/printer.cfg` and add the following lines:
```
[web_server]
port: 8080
enable_cors: true
[virtual_sdcard]
path: /home/pi/sdcard
[api_server]
trusted_clients:
192.168.1.0/24
192.168.0.0/24
127.0.0.1
web_path: ~/kwc
```
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).
Finally, we create the `virtual_sdcard` directory:
```
mkdir ~/sdcard
```
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
```
{"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)"}}
```
your API is working!
### install webserver & reverse proxy (nginx)
nginx is important to mount all components on port 80 and host the static files from Mainsail.
If you have installed lighttpd & haproxy before you have to stop & disable it:
```bash
sudo service haproxy stop
sudo service lighttpd stop
sudo apt remove haproxy lighttpd
```
Example Klipper macros:
After disable all other webserver you can install nginx now:
```bash
sudo apt install nginx
```
now we create the config file with
```bash
sudo nano /etc/nginx/sites-available/mainsail
```
and fill it with the following content:
```
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream apiserver {
#edit your api port here
ip_hash;
server 127.0.0.1:7125;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
access_log /var/log/nginx/kwc-access.log;
error_log /var/log/nginx/kwc-error.log;
#web_path from mainsail static files
root /home/pi/mainsail;
index index.html;
server_name _;
#max upload size for gcodes
client_max_body_size 200M;
location / {
try_files $uri $uri/ /index.html;
}
location /printer {
proxy_pass http://apiserver/printer;
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;
}
location /api {
proxy_pass http://apiserver/api;
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;
}
location /access {
proxy_pass http://apiserver/access;
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;
}
location /websocket {
proxy_pass http://apiserver/websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
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_read_timeout 86400;
}
location /machine {
proxy_pass http://apiserver/machine;
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;
}
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:
```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:
```
{"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.
### 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.12/mainsail-alpha-0.0.12.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.
## Klipper example macros for Mainsail
These macros are important to start/pause/cancel prints.
```
[pause_resume]
@@ -67,33 +234,15 @@ gcode:
BASE_RESUME
```
## Installation haproxy
haproxy is necessary to use port 80.
`sudo apt install haproxy`
add following lines at the end of `/etc/haproxy/haproxy.cfg`:
## Update Mainsail to V0.0.11
```
frontend public
bind :::80 v4v6
# use_backend webcam if { path_beg /webcam/ }
default_backend kwc
backend kwc
reqrep ^([^\ :]*)\ /(.*)     \1\ /\2
option forwardfor
server kwc1 127.0.0.1:8080
#backend webcam
# reqrep ^([^\ :]*)\ /webcam/(.*) \1\ /\2
# server webcam1 127.0.0.1:8081
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 mainsail.zip https://github.com/meteyou/mainsail/releases/download/v0.0.12/mainsail-alpha-0.0.12.zip && unzip mainsail.zip && rm mainsail.zip
```
## Update KWC to V0.0.5
```
rm -R ~/kwc/*
cd ~/kwc
wget -q -O kwc.zip https://github.com/meteyou/kwc/releases/download/v0.0.5/kwc-alpha-0.0.5.zip && unzip kwc.zip && rm kwc.zip
```
and update your macros
and update your macros & nginx config.
+4824 -538
View File
File diff suppressed because it is too large. Load diff
+15 -17
View File
@@ -10,34 +10,32 @@
"dependencies": {
"axios": "^0.19.2",
"chart.js": "^2.9.3",
"core-js": "^3.6.4",
"core-js": "^3.6.5",
"object-assign-deep": "^0.4.0",
"vue": "^2.6.11",
"vue-chartjs": "^3.5.0",
"vue-context": "^5.0.0",
"vue-context": "^5.1.0",
"vue-headful": "^2.1.0",
"vue-json-rpc-websocket": "^1.1.1",
"vue-plotly": "^1.1.0",
"vue-resource": "^1.5.1",
"vue-simple-upload": "^0.1.6",
"vue-toast-notification": "0.0.3",
"vuetify": "^2.2.17",
"vuetify-toast-snackbar": "^0.6.1",
"vuex": "^3.1.3"
"vue-toast-notification": "^0.2.0",
"vuetify": "^2.2.22",
"vuex": "^3.2.0"
},
"devDependencies": {
"@fortawesome/fontawesome-free": "^5.12.1",
"@mdi/font": "^4.9.95",
"@vue/cli-plugin-babel": "^4.2.3",
"@vue/cli-plugin-eslint": "^4.2.3",
"@vue/cli-service": "^4.2.3",
"@mdi/font": "^5.1.45",
"@vue/cli-plugin-babel": "^4.3.1",
"@vue/cli-plugin-eslint": "^4.3.1",
"@vue/cli-service": "^4.3.1",
"babel-eslint": "^10.1.0",
"css-loader": "^3.4.2",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"material-design-icons-iconfont": "^5.0.1",
"css-loader": "^3.5.2",
"eslint": "^6.8.0",
"eslint-plugin-vue": "^6.2.2",
"sass": "^1.26.3",
"sass-loader": "^8.0.2",
"vue-cli-plugin-route": "0.0.7",
"vue-cli-plugin-vuetify": "^1.1.2",
"vue-cli-plugin-vuetify": "^2.0.5",
"vue-router": "^3.1.6",
"vue-template-compiler": "^2.6.11",
"vuetify-loader": "^1.4.3"
+7
View File
@@ -0,0 +1,7 @@
{
"socket": {
"hostname": "kossel.local",
"port": 80,
"reconnectInterval": 3000
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

-2
View File
@@ -6,8 +6,6 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico" id="favicon" />
<title>KlipperWebControl</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">
</head>
<body>
<noscript>
+38 -27
View File
@@ -1,3 +1,7 @@
<style>
@import './assets/styles/fonts.css';
</style>
<template>
<v-app>
<vue-headful
@@ -12,8 +16,21 @@
<v-toolbar-title>{{ hostname }}</v-toolbar-title>
</div>
<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>
<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 === '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>
@@ -21,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>
@@ -52,7 +69,7 @@
<v-dialog v-model="isConnecting" persistent width="300">
<v-card color="primary" dark >
<v-card-text class="pt-2">
Connecting to Klipper
Connecting...
<v-progress-linear indeterminate color="white" class="mb-0"></v-progress-linear>
</v-card-text>
</v-card>
@@ -60,7 +77,7 @@
<v-footer app class="d-block">
<span v-if="version">{{ version }}</span>
<span class="float-right">&copy; 2020</span>
<span class="float-right">Made with <img src="/img/heard.png" height="15" title="love" alt="heard" /> by <a href="http://www.vorondesign.com/" target="_blank"><img src="/img/voron.png" height="15" title="VoronDesign" alt="Logo - VoronDesign" /></a></span>
</v-footer>
</v-app>
</template>
@@ -79,29 +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.$socket.onOpen = () => {
this.$socket.sendObj('get_printer_info', {}, 'getKlipperInfo');
this.$socket.sendObj('get_printer_objects', {}, 'getObjectInfo');
this.$socket.sendObj('get_printer_status', { heater: [] }, 'getObjectInfo');
this.$socket.sendObj('get_printer_status', { configfile: ['config'] }, 'getPrinterConfig');
this.$socket.sendObj('post_printer_subscriptions', {
gcode: [],
toolhead: [],
virtual_sdcard: [],
heater: [],
heater_bed: [],
extruder: ["temperature", "target"],
fan: [],
pause_resume: [],
idle_timeout: [],
});
this.$socket.sendObj('get_printer_files', {}, 'getFileList');
}
this.$vuetify.theme.dark = true;
this.is_ready = (this.klippy_state === "ready") ? true : false;
this.boolNaviHeightmap = (typeof(this.config.bed_mesh) !== "undefined");
},
computed: {
currentPage: function() {
@@ -115,6 +117,9 @@ export default {
isConnected: state => state.socket.isConnected,
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'
@@ -175,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>
+48
View File
@@ -0,0 +1,48 @@
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(/fonts/roboto-thin.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(/fonts/roboto-light.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(/fonts/roboto-regular.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(/fonts/roboto-medium.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(/fonts/roboto-bold.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(/fonts/roboto-black.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
+30 -4
View File
@@ -1,3 +1,4 @@
import store from '../store'
import { Line, mixins } from 'vue-chartjs'
const { reactiveProp } = mixins;
@@ -23,17 +24,42 @@ export default {
legend: {
labels: {
fontColor: 'rgb(203, 203, 203)',
fontFamily: 'Roboto,sans-serif'
fontFamily: 'Roboto,sans-serif',
filter: function(item) {
return !item.text.includes('_target');
}
},
onClick: function(e, legendItem) {
let ci = this.chart;
let index = legendItem.datasetIndex;
let index_target = ci.data.datasets.findIndex(dataset => dataset.label === legendItem.text+'_target');
let meta = ci.getDatasetMeta(index);
// See controller.isDatasetVisible comment
meta.hidden = meta.hidden === null ? !ci.data.datasets[index].hidden : null;
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();
}
},
tooltips: {
enabled: true,
callbacks: {
title: function (tooltipItem, data) {
return data['labels'][tooltipItem[0]['index']];
title: function (tooltipItem) {
let date = new Date(tooltipItem[0].label);
return date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
},
label: function (tooltipItem, data) {
return data['datasets'][0]['data'][tooltipItem['index']];
let label_target = data['datasets'][tooltipItem.datasetIndex].label+"_target";
let target_dataset = data['datasets'].find(dataset => dataset.label === label_target);
if (target_dataset !== undefined) return tooltipItem.value+" / "+target_dataset.data[tooltipItem.index];
return tooltipItem.value;
},
}
},
+69 -60
View File
@@ -4,53 +4,64 @@
<template>
<v-card>
<v-col xs12 md12>
<v-row class="pl-3 pr-3 text-center">
<v-row class="">
<v-col class="col-12 pb-0 text-center">
<div class="d-inline-block mx-2 my-1"><v-btn @click="doHome" :loading="loadingHomeAll" :color="homedAxes.includes('xyz') ? 'primary' : 'warning'" class=""><v-icon class="mr-1">mdi-home</v-icon><span class="d-none d-sm-inline">Home </span>all</v-btn></div>
<div class="d-inline-block mx-2 my-1" v-if="config.hasOwnProperty('quad_gantry_level')"><v-btn @click="doQGL" :loading="loadingQGL" color="primary">QGL</v-btn></div>
</v-col>
</v-row>
<v-row class="mt-3">
<v-col class="col-12 py-0 px-6 text-center">
<v-btn-toggle borderless no-gutters style="flex-wrap: nowrap; width: 100%;" >
<v-btn @click="doSend('X-100')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left>mdi-chevron-left</v-icon><span>X-100</span></v-btn>
<v-btn @click="doSend('X-10')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left>mdi-chevron-left</v-icon><span>X-10</span></v-btn>
<v-btn @click="doSend('X-1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left>mdi-chevron-left</v-icon><span>X-1</span></v-btn>
<v-btn @click="doSendMove('X-100')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><v-icon left class="d-sm-flex">mdi-chevron-left</v-icon><span>X-100</span></v-btn>
<v-btn @click="doSendMove('X-10')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>X-10</span></v-btn>
<v-btn @click="doSendMove('X-1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>X-1</span></v-btn>
<v-btn @click="doHomeX" :color="homedAxes.includes('x') ? 'primary' : 'warning'" :loading="loadingHomeX"><v-icon class="mdi mdi-home"></v-icon></v-btn>
<v-btn @click="doSend('X+1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>X+1</span><v-icon right>mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSend('X+10')" cols="1" class="flex-grow-1 flex-shrink-0"><span>X+10</span><v-icon right>mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSend('X+100')" cols="1" class="flex-grow-1 flex-shrink-0"><span>X+100</span><v-icon right>mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('X+1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>X+1</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('X+10')" cols="1" class="flex-grow-1 flex-shrink-0"><span>X+10</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('X+100')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><span>X+100</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
</v-btn-toggle>
</v-row>
<v-row class="pl-3 pr-3 mt-3 text-center">
</v-col>
</v-row>
<v-row class="mt-3">
<v-col class="col-12 py-0 px-6 text-center">
<v-btn-toggle borderless no-gutters style="flex-wrap: nowrap; width: 100%;" >
<v-btn @click="doSend('Y-100')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left>mdi-chevron-left</v-icon><span>Y-100</span></v-btn>
<v-btn @click="doSend('Y-10')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left>mdi-chevron-left</v-icon><span>Y-10</span></v-btn>
<v-btn @click="doSend('Y-1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left>mdi-chevron-left</v-icon><span>Y-1</span></v-btn>
<v-btn @click="doSendMove('Y-100')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>Y-100</span></v-btn>
<v-btn @click="doSendMove('Y-10')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>Y-10</span></v-btn>
<v-btn @click="doSendMove('Y-1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>Y-1</span></v-btn>
<v-btn @click="doHomeY" :color="homedAxes.includes('y') ? 'primary' : 'warning'" :loading="loadingHomeY"><v-icon class="mdi mdi-home"></v-icon></v-btn>
<v-btn @click="doSend('Y+1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Y+1</span><v-icon right>mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSend('Y+10')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Y+10</span><v-icon right>mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSend('Y+100')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Y+100</span><v-icon right>mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('Y+1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Y+1</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('Y+10')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Y+10</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('Y+100')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><span>Y+100</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
</v-btn-toggle>
</v-row>
<v-row class="pl-3 pr-3 mt-3 text-center">
</v-col>
</v-row>
<v-row class="mt-3">
<v-col class="col-12 py-0 px-6 text-center">
<v-btn-toggle borderless no-gutters style="flex-wrap: nowrap; width: 100%;" >
<v-btn @click="doSend('Z-25')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left>mdi-chevron-left</v-icon><span>Z-25</span></v-btn>
<v-btn @click="doSend('Z-1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left>mdi-chevron-left</v-icon><span>Z-1</span></v-btn>
<v-btn @click="doSend('Z-0.1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left>mdi-chevron-left</v-icon><span>Z-0.1</span></v-btn>
<v-btn @click="doSendMove('Z-25')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>Z-25</span></v-btn>
<v-btn @click="doSendMove('Z-1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>Z-1</span></v-btn>
<v-btn @click="doSendMove('Z-0.1')" cols="1" class="flex-grow-1 flex-shrink-0"><v-icon left class="d-none d-sm-flex">mdi-chevron-left</v-icon><span>Z-0.1</span></v-btn>
<v-btn @click="doHomeZ" :color="homedAxes.includes('z') ? 'primary' : 'warning'" :loading="loadingHomeZ"><v-icon class="mdi mdi-home"></v-icon></v-btn>
<v-btn @click="doSend('Z+0.1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Z+0.1</span><v-icon right>mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSend('Z+1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Z+1</span><v-icon right>mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSend('Z+25')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Z+25</span><v-icon right>mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('Z+0.1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Z+0.1</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('Z+1')" cols="1" class="flex-grow-1 flex-shrink-0"><span>Z+1</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
<v-btn @click="doSendMove('Z+25')" cols="1" class="flex-grow-1 flex-shrink-0 d-none d-sm-flex"><span>Z+25</span><v-icon right class="d-none d-sm-flex">mdi-chevron-right</v-icon></v-btn>
</v-btn-toggle>
</v-row>
<v-row class="px-3 mt-3">
<v-spacer></v-spacer>
<v-btn @click="doHome" :loading="loadingHome" :color="homedAxes.includes('xyz') ? 'primary' : 'warning'"><v-icon left>mdi-home</v-icon>Home all</v-btn>
<v-btn v-if="config.hasOwnProperty('quad_gantry_level')" @click="doQGL" :loading="loadingQGL" color="primary" class="ml-3">QGL</v-btn>
<v-btn @click="doRestart" :loading="loadingRestart" color="error" class="ml-3"><v-icon left>mdi-cached</v-icon>Restart</v-btn>
<v-btn @click="doRestartFirmware" :loading="loadingRestartFirmware" color="error" class="ml-3"><v-icon left>mdi-cached</v-icon>Firmware Restart</v-btn>
</v-row>
</v-col>
</v-col>
</v-row>
<v-row class="" v-if="getMacros.length > 0">
<v-col class="col-12 px-0 py-2 text-center">
<div v-for="(macro, index) in getMacros" v-bind:key="index+99" class="d-inline-block mx-1 my-1">
<v-btn color="primary" class="mx-1 my-1" @click="doSend(macro.name)">{{ macro.name }}</v-btn>
</div>
</v-col>
</v-row>
</v-card>
</template>
<script>
import { mapState, mapMutations } from 'vuex'
import { mapState, mapGetters, mapMutations } from 'vuex'
import Vue from "vue";
export default {
components: {
@@ -58,67 +69,65 @@
},
data: function() {
return {
loadingHomeAll: false,
loadingHomeX: false,
loadingHomeY: false,
loadingHomeZ: false,
}
},
computed: {
...mapState({
loadingHome: state => state.socket.loadingHome,
loadingHomeX: state => state.socket.loadingHomeX,
loadingHomeY: state => state.socket.loadingHomeY,
loadingHomeZ: state => state.socket.loadingHomeZ,
loadingQGL: state => state.socket.loadingQGL,
loadingRestart: state => state.socket.loadingRestart,
loadingRestartFirmware: state => state.socket.loadingRestartFirmware,
homedAxes: state => state.printer.toolhead.homed_axes,
config: state => state.config,
loadings: state => state.loadings,
}),
...mapMutations([
'setLoadingHome',
'setLoadingHomeX',
'setLoadingHomeY',
'setLoadingHomeZ',
'setLoadingQGL',
'setLoadingRestart',
'setLoadingRestartFirmware',
]),
...mapGetters([
'getMacros',
])
},
methods: {
doHome() {
this.$store.commit('setLoadingHome', true);
this.$store.commit('setLoading', { name: 'controlHomeAll' });
this.$socket.sendObj('post_printer_gcode', { script: "G28" }, "responseHome");
},
doHomeX() {
this.$store.commit('setLoadingHomeX', true);
this.$store.commit('setLoading', { name: 'controlHomeX' });
this.$socket.sendObj('post_printer_gcode', { script: "G28 X" }, "responseHomeX");
},
doHomeY() {
this.$store.commit('setLoadingHomeY', true);
this.$store.commit('setLoading', { name: 'controlHomeY' });
this.$socket.sendObj('post_printer_gcode', { script: "G28 Y" }, "responseHomeY");
},
doHomeZ() {
this.$store.commit('setLoadingHomeZ', true);
this.$store.commit('setLoading', { name: 'controlHomeZ' });
this.$socket.sendObj('post_printer_gcode', { script: "G28 Z" }, "responseHomeZ");
},
doQGL() {
this.$store.commit('setLoadingQGL', true);
this.$socket.sendObj('post_printer_gcode', { script: "quad_gantry_level" }, "responseQGL");
},
doSend(gcode) {
doSendMove(gcode) {
gcode = "G91" + "\n" +
"G1 " + gcode + " F6000" + "\n" +
"G90";
this.$socket.sendObj('post_printer_gcode', { script: gcode }, "sendGcode");
this.doSend(gcode);
},
doRestart() {
this.$store.commit('setLoadingRestart', true);
this.$socket.sendObj('post_printer_restart', { }, "responseRestart");
},
doRestartFirmware() {
this.$store.commit('setLoadingRestartFirmware', true);
this.$socket.sendObj('post_printer_firmware_restart', { }, "responseRestartFirmware");
doSend(gcode) {
Vue.prototype.$socket.sendObj('post_printer_gcode', { script: gcode }, "sendGcode");
},
},
watch: {
loadings: function(loadings) {
this.loadingHomeAll = loadings.includes('controlHomeAll');
this.loadingHomeX = loadings.includes('controlHomeX');
this.loadingHomeY = loadings.includes('controlHomeY');
this.loadingHomeZ = loadings.includes('controlHomeZ');
}
}
}
</script>
-45
View File
@@ -1,45 +0,0 @@
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>fa-thermometer-three-quarters</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Macros</v-list-item-title>
<v-list-item-subtitle>
{{ getMacros.length }} Macros
</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
<v-divider class="my-2"></v-divider>
<v-card-text class="px-0 pt-0 pb-2 content text-center">
<div v-for="(macro, index) in getMacros" v-bind:key="index+99" style="display: inline-block;" class="mx-1 my-1">
<v-btn color="primary" class="ml-3" @click="doSend(macro.name)">{{ macro.name }}</v-btn>
</div>
</v-card-text>
</v-card>
</template>
<script>
import {mapGetters} from 'vuex'
export default {
components: {
},
data: function() {
return {
}
},
computed: {
...mapGetters([
'getMacros',
]),
},
methods: {
doSend(gcode) {
this.$socket.sendObj('post_printer_gcode', { script: gcode }, "sendGcode");
},
},
}
</script>
@@ -0,0 +1,81 @@
<style>
.minievent-table {
max-height: 250px;
overflow-y: auto;
}
</style>
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-console-line</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Console</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider class="mt-2"></v-divider>
<v-card-text class="px-0 py-0 content">
<v-data-table
:headers="headers"
:options="options"
:sort-by.sync="sortBy"
:sort-desc.sync="sortDesc"
:items="events"
item-key="date"
hide-default-footer
disable-pagination
class="minievent-table"
>
<template #no-data>
<div class="text-center">empty</div>
</template>
<template #item="{ item }">
<tr>
<td class="log-cell title-cell">
{{ item.date.toLocaleString() }}
</td>
<td class="log-cell content-cell" colspan="2">
<span v-if="item.message" class="message" v-html="formatMessage(item.message)"></span>
</td>
</tr>
</template>
</v-data-table>
</v-card-text>
</v-card>
</template>
<script>
import { mapState } from 'vuex'
export default {
components: {
},
data: function() {
return {
sortBy: 'date',
sortDesc: true,
headers: [
],
options: {
},
}
},
computed: {
...mapState({
events: state => state.events,
})
},
methods: {
formatMessage(message) {
message = message.replace(/(?:\r\n|\r|\n)/g, '<br>');
return message;
},
}
}
</script>
+4 -4
View File
@@ -10,14 +10,14 @@
from {
transform: rotate(0deg);
} to {
transform: rotate(360deg);
transform: rotate(-360deg);
}
}
</style>
<template>
<div>
<v-card class="mt-4" v-if="bool_fan">
<v-card v-if="bool_fan">
<v-toolbar flat dense >
<v-toolbar-title>
<span class="subheading"><v-icon :class="fan_speed > 0 ? 'mdi mdi-fan icon-rotate' : 'mdi mdi-fan'" left></v-icon>Tool Fan</span>
@@ -28,7 +28,7 @@
<tool-slider :target="fan_speed" :multi="100" command="M106" attribute-name="S" :attribute-scale="2.55" ></tool-slider>
</v-card-text>
</v-card>
<v-card class="mt-4" v-if="is_printing">
<v-card class="mt-6" v-if="is_printing">
<v-toolbar flat dense >
<v-toolbar-title>
<span class="subheading"><v-icon class="mdi mdi-timer" left></v-icon>Speed Factor</span>
@@ -39,7 +39,7 @@
<tool-slider :target="speed_factor" :max="200" :multi="100" command="M220" attribute-name="S" ></tool-slider>
</v-card-text>
</v-card>
<v-card class="mt-4" v-if="is_printing">
<v-card class="mt-6" v-if="is_printing">
<v-toolbar flat dense >
<v-toolbar-title>
<span class="subheading"><v-icon class="mdi mdi-texture" left></v-icon>Extrusion Factor</span>
@@ -0,0 +1,71 @@
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-view-dashboard</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Dashboard</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider class="my-2"></v-divider>
<v-card-text class="px-0 pb-0 pt-3 content">
<v-row>
<v-col class="px-10 py-0">
<v-switch v-model="boolShowWebcamOnDashboard" label="Webcam"></v-switch>
</v-col>
</v-row>
<v-row>
<v-col class="px-10 py-0">
<v-switch v-model="boolShowTempchartOnDashboard" label="Tempchart"></v-switch>
</v-col>
</v-row>
<v-row>
<v-col class="px-10 py-0">
<v-switch v-model="boolShowConsoleOnDashboard" label="Console"></v-switch>
</v-col>
</v-row>
</v-card-text>
</v-card>
</template>
<script>
export default {
components: {
},
data: function() {
return {
}
},
computed: {
boolShowWebcamOnDashboard: {
get() {
return this.$store.state.gui.dashboard.boolWebcam;
},
set(status) {
return this.$store.dispatch('setSettings', { gui: { dashboard: { boolWebcam: status } } });
}
},
boolShowTempchartOnDashboard: {
get() {
return this.$store.state.gui.dashboard.boolTempchart;
},
set(status) {
return this.$store.dispatch('setSettings', { gui: { dashboard: { boolTempchart: status } } });
}
},
boolShowConsoleOnDashboard: {
get() {
return this.$store.state.gui.dashboard.boolConsole;
},
set(status) {
return this.$store.dispatch('setSettings', { gui: { dashboard: { boolConsole: status } } });
}
},
},
methods: {
}
}
</script>
@@ -0,0 +1,73 @@
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-arrow-expand-vertical</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Endstops</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider class="my-2"></v-divider>
<v-card-text class="px-0 pt-0 pb-2 content">
<div v-for="(status, index) of sortEndstops" v-bind:key="index">
<v-row class="px-6" >
<v-col sm-12>
<label class="mt-1 d-inline-block">Endstop <b>{{ index.toUpperCase() }}</b></label>
<v-chip class="float-right" :color="status === 'open' ? 'green' : 'red' " text-color="white">{{ status }}</v-chip>
</v-col>
</v-row>
</div>
<v-row class="px-6" v-if="(Object.keys(endstops).length === 0 && endstops.constructor === Object)" >
<v-col sm-12>
<p>Press the sync-button on the right-bottom to load the current endstop status.</p>
</v-col>
</v-row>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn icon @click="syncEndstops" :loading="loading">
<v-icon>mdi-sync</v-icon>
</v-btn>
</v-card-actions>
</v-card>
</template>
<script>
import { mapState } from 'vuex'
export default {
components: {
},
data: function() {
return {
sortEndstops: {}
}
},
computed: {
...mapState({
loading: state => state.socket.loadingEndstopStatus,
endstops: state => state.printer.endstops,
})
},
methods: {
syncEndstops() {
this.$store.commit('setLoadingEndstopStatus', true);
this.$socket.sendObj('get_printer_endstops', { }, "responseEndstopStatus");
}
},
watch: {
endstops: function() {
this.sortEndstops = {};
let keys = Object.keys(this.endstops);
keys.sort();
for (let i = 0; i < keys.length; i++) {
let k = keys[i];
this.sortEndstops[k] = this.endstops[k];
}
}
}
}
</script>
@@ -0,0 +1,48 @@
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-exclamation-thick</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Machinelimits</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider class="my-2"></v-divider>
<v-card-text class="px-0 pt-0 pb-2 content">
<v-row class="px-6" >
<v-col sm-12>
<toolSlider label="VELOCITY" v-bind:target="max_velocity" :max="500" :extender-steps="100" command="SET_VELOCITY_LIMIT" attribute-name="VELOCITY=" class="mt-5" ></toolSlider>
<toolSlider label="ACCEL" v-bind:target="max_accel" :max="5000" :extender-steps="500" command="SET_VELOCITY_LIMIT" attribute-name="ACCEL=" class="mt-5" ></toolSlider>
<toolSlider label="DECEL" v-bind:target="max_accel_to_decel" :max="5000" :extender-steps="500" command="SET_VELOCITY_LIMIT" attribute-name="ACCEL_TO_DECEL=" class="mt-5" ></toolSlider>
<toolSlider label="SCV" v-bind:target="square_corner_velocity" :max="10" :extender-steps="5" command="SET_VELOCITY_LIMIT" attribute-name="SQUARE_CORNER_VELOCITY=" class="mt-5" ></toolSlider>
</v-col>
</v-row>
</v-card-text>
</v-card>
</template>
<script>
import { mapState } from 'vuex'
import toolSlider from '../../../inputs/ToolSlider'
export default {
components: {
toolSlider
},
data: function() {
return {
}
},
computed: {
...mapState({
max_velocity: state => state.printer.toolhead.max_velocity,
max_accel: state => state.printer.toolhead.max_accel,
max_accel_to_decel: state => state.printer.toolhead.max_accel_to_decel,
square_corner_velocity: state => state.printer.toolhead.square_corner_velocity,
})
},
methods: {
}
}
</script>
@@ -0,0 +1,49 @@
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-code-tags</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Macros</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider class="my-2"></v-divider>
<v-card-text class="px-0 pb-3 pt-3 content">
<div v-for="(macro, index) in getAllMacros" v-bind:key="index">
<v-row>
<v-col class="px-10 py-0">
<settings-macro-switch :name="macro.name"></settings-macro-switch>
</v-col>
</v-row>
</div>
</v-card-text>
</v-card>
</template>
<script>
import { mapState, mapGetters } from 'vuex';
import SettingsMacroSwitch from "../../../inputs/SettingsMacroSwitch";
export default {
components: {
SettingsMacroSwitch
},
data: function() {
return {
}
},
computed: {
...mapState({
hiddenMacros: state => state.gui.dashboard.hiddenMacros,
}),
...mapGetters([
'getAllMacros',
])
},
methods: {
}
}
</script>
@@ -0,0 +1,42 @@
<template>
<div>
<div v-for="(runout, index) of getFilamentSwitchSensors" v-bind:key="index">
<v-card class="mt-6">
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-printer-3d-nozzle-alert</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">{{ runout.name }}</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider class="my-2"></v-divider>
<v-card-text class="px-0 pt-0 pb-2 content">
<settings-runout-switch :name="runout.name "></settings-runout-switch>
</v-card-text>
</v-card>
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import SettingsRunoutSwitch from "../../../inputs/SettingsRunoutSwitch";
export default {
components: {
SettingsRunoutSwitch
},
data: function() {
return {
}
},
computed: {
...mapGetters([
'getFilamentSwitchSensors'
])
},
methods: {
}
}
</script>
@@ -0,0 +1,66 @@
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-cpu-64-bit</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">System</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider class="my-2"></v-divider>
<v-card-text class="">
<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>
<div><v-btn @click="doShutdownHost" :loading="loadingShutdownHost" class="mt-3" color="error"><v-icon class="mr-sm-2">mdi-power</v-icon><span class="d-none d-sm-block">Host Shutdown</span></v-btn></div>
</v-card-text>
</v-card>
</template>
<script>
import {mapMutations, mapState} from 'vuex'
export default {
components: {
},
data: function() {
return {
}
},
computed: {
...mapState({
hostname: state => state.socket.hostname,
port: state => state.socket.port,
loadingRestart: state => state.socket.loadingRestart,
loadingRestartFirmware: state => state.socket.loadingRestartFirmware,
loadingRebootHost: state => state.socket.loadingRebootHost,
loadingShutdownHost: state => state.socket.loadingShutdownHost,
}),
...mapMutations([
'setLoadingRestart',
'setLoadingRestartFirmware',
]),
},
methods: {
doRestart() {
this.$store.commit('setLoadingRestart', true);
this.$socket.sendObj('post_printer_restart', { }, "responseRestart");
},
doRestartFirmware() {
this.$store.commit('setLoadingRestartFirmware', true);
this.$socket.sendObj('post_printer_firmware_restart', { }, "responseRestartFirmware");
},
doRebootHost() {
this.$store.commit('setLoadingRebootHost', true);
this.$socket.sendObj('post_machine_reboot', { });
},
doShutdownHost() {
this.$store.commit('setLoadingShutdownHost', true);
this.$socket.sendObj('post_machine_shutdown', { });
},
}
}
</script>
@@ -0,0 +1,66 @@
<style>
.webcamImage {
width: 100%;
}
</style>
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-webcam</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Webcam</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider class="my-2"></v-divider>
<v-card-text class="px-0 pb-0 pt-3 content">
<v-row>
<v-col class="px-10 py-0">
<v-text-field
v-model="webcamUrl"
label="Webcam URL"
></v-text-field>
</v-col>
</v-row>
<v-row>
<v-col class="px-10 py-0">
<v-switch v-model="boolNavi" label="Show in Navigation"></v-switch>
</v-col>
</v-row>
</v-card-text>
</v-card>
</template>
<script>
export default {
components: {
},
data: function() {
return {
}
},
computed: {
webcamUrl: {
get() {
return this.$store.state.webcam.url;
},
set(newWebcamUrl) {
return this.$store.dispatch('setSettings', { webcam: { url: newWebcamUrl } });
}
},
boolNavi: {
get() {
return this.$store.state.gui.webcam.bool;
},
set(bool) {
return this.$store.dispatch('setSettings', { gui: { webcam: { bool: bool } } });
}
},
},
methods: {
}
}
</script>
+21
View File
@@ -0,0 +1,21 @@
import Vue from 'vue'
import WebcamPanel from './WebcamPanel.vue'
import DashboardPanel from "./DashboardPanel";
import MacrosPanel from "./MacrosPanel";
import EndstopPanel from "./EndstopPanel";
import LimitsPanel from "./LimitsPanel";
import RunoutPanel from "./RunoutPanel";
import SystemPanel from "./SystemPanel";
Vue.component('settings-webcam-panel', WebcamPanel);
Vue.component('settings-dashboard-panel', DashboardPanel);
Vue.component('settings-macros-panel', MacrosPanel);
Vue.component('settings-endstop-panel', EndstopPanel);
Vue.component('settings-limits-panel', LimitsPanel);
Vue.component('settings-runout-panel', RunoutPanel);
Vue.component('settings-system-panel', SystemPanel);
export default {
}
+20 -13
View File
@@ -1,10 +1,10 @@
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>fa-info</v-icon></v-list-item-avatar>
<v-list-item-avatar color="grey"><v-icon dark>mdi-information-variant</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Status</v-list-item-title>
<v-list-item-subtitle>{{ printer_state }}{{ printer_is_printing ? " - "+current_file : "" }}</v-list-item-subtitle>
<v-list-item-subtitle class="mr-3">{{ printer_state }}{{ printer_is_printing ? " - "+current_file : "" }}</v-list-item-subtitle>
</v-list-item-content>
<v-btn class="orange" v-if="printer_state === 'Printing' && printer_is_printing" @click="btnPauseJob" :loading="btnStatusPause">pause job</v-btn>
<v-btn class="red" v-if="(is_printing && printer_is_paused)" :loading="btnStatusCancel" @click="btnCancelJob">cancel job</v-btn>
@@ -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
@@ -66,20 +71,20 @@
</v-flex>
<v-flex grow class="equal-width">
<v-layout column>
<v-flex tag="strong">Time</v-flex>
<v-flex tag="strong">File</v-flex>
<v-flex tag="span">{{ print_time > 0 && printProgress > 0 ? formatTime(print_time / printProgress - print_time) : '--' }}</v-flex>
</v-layout>
</v-flex>
<v-flex grow class="equal-width">
<v-layout column>
<v-flex tag="strong">File Progress</v-flex>
<v-flex tag="span">{{ print_time > 0 && file_position > 0 ? formatTime(print_time / (file_position / current_file_size) - print_time) : '--' }}</v-flex>
<v-flex tag="strong">Filament</v-flex>
<v-flex tag="span">{{ (filament_used > 0 && current_file_filament_total > filament_used) ? formatTime(print_time / (filament_used / current_file_filament_total) - print_time) : '--' }}</v-flex>
</v-layout>
</v-flex>
<v-flex grow class="equal-width">
<v-layout column>
<v-flex tag="strong">Slicer</v-flex>
<v-flex tag="span"><i>coming soon</i></v-flex>
<v-flex tag="span">{{ current_file_estimated_time > print_time ? formatTime(current_file_estimated_time - print_time) : '--'}}</v-flex>
</v-layout>
</v-flex>
</v-layout>
@@ -103,10 +108,6 @@
import { mapState, mapGetters } from 'vuex';
export default {
data: () => ({
}),
computed: {
...mapState({
toolhead: state => state.printer.toolhead,
@@ -126,11 +127,15 @@
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([
'current_file_size',
'current_file_metadata',
'current_file_estimated_time',
'current_file_filament_total',
'is_printing',
]),
},
@@ -148,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 = ("0" + Math.floor(seconds / 60)).slice(-2);
let s = ("0" + (seconds % 60).toFixed(0)).slice(-2);
return date.toISOString().substr(11,8);
return h+':'+m+':'+s;
},
},
}
+1 -1
View File
@@ -7,7 +7,7 @@
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>fa-thermometer-three-quarters</v-icon></v-list-item-avatar>
<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">Temperature Chart</v-list-item-title>
<v-list-item-subtitle>
+57 -7
View File
@@ -7,13 +7,15 @@
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>fa-thermometer-three-quarters</v-icon></v-list-item-avatar>
<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,32 +52,80 @@
</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>
<line-chart :chart-data="chartdata" v-if="loaded"></line-chart>
</v-col>
</v-row>
</v-card-text>
</v-card>
</template>
<script>
import { mapGetters } from 'vuex'
import { mapGetters, mapState } from 'vuex'
import toolInput from '../../inputs/ToolInput'
import LineChart from '../../charts/LineChart.js'
export default {
components: {
toolInput
toolInput,
LineChart
},
data: function() {
return {
extruderTemps: [250,215,195,0]
extruderTemps: [250,215,195,0],
loaded: false,
chartdata: {
labels: [],
datasets: []
}
}
},
computed: {
...mapState({
labels: state => state.temperaturChart.labels,
datasets: state => state.temperaturChart.datasets,
boolTempchart: state => state.gui.dashboard.boolTempchart,
}),
...mapGetters([
'heaters',
'heatersCount',
'temperature_fans'
'temperature_fans',
'temperature_sensors',
])
},
methods: {
created() {
},
methods: {
fillData () {
this.loaded = true;
this.chartdata = {
labels: this.labels,
datasets: this.datasets
}
}
},
mounted () {
this.fillData();
},
watch: {
labels() {
this.fillData();
}
}
}
</script>
+43
View File
@@ -0,0 +1,43 @@
<style>
.webcamImage {
width: 100%;
}
</style>
<template>
<v-card>
<v-list-item>
<v-list-item-avatar color="grey"><v-icon dark>mdi-webcam</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">Webcam</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">
<img :src="webcamUrl" class="webcamImage" />
</v-card-text>
</v-card>
</template>
<script>
import { mapState } from 'vuex'
export default {
components: {
},
data: function() {
return {
}
},
computed: {
...mapState({
webcamUrl: state => state.webcam.url,
})
},
methods: {
}
}
</script>
+6 -3
View File
@@ -5,15 +5,18 @@ import ToolsPanel from './ToolsPanel.vue'
import TempchartPanel from './TempchartPanel.vue'
import ControlPanel from "./ControlPanel";
import Peripherie from "./PeripheriePanel";
import MacrosPanel from "./MacrosPanel";
import WebcamPanel from "./WebcamPanel";
import MiniconsolePanel from "./MiniconsolePanel";
import Settings from "./Settings/";
Vue.component('status-panel', StatusPanel);
Vue.component('tools-panel', ToolsPanel);
Vue.component('tempchart-panel', TempchartPanel);
Vue.component('control-panel', ControlPanel);
Vue.component('peripherie-panel', Peripherie);
Vue.component('macros-panel', MacrosPanel);
Vue.component('webcam-panel', WebcamPanel);
Vue.component('miniconsole-panel', MiniconsolePanel);
export default {
StatusPanel,
Settings
}
+46
View File
@@ -0,0 +1,46 @@
<style>
.settings_macro_switch .v-messages {
display: none;
}
</style>
<template>
<v-switch v-model="value" :label="name.toUpperCase()" @change="setValue" class="settings_macro_switch mt-0"></v-switch>
</template>
<script>
import { mapState } from 'vuex';
export default {
data: function() {
return {
value: false
}
},
props: {
name: String,
},
computed: {
...mapState({
hiddenMacros: state => state.gui.dashboard.hiddenMacros
}),
},
methods: {
setValue() {
if (this.value) {
let index = this.hiddenMacros.indexOf(this.name.toUpperCase());
if (index > -1) this.hiddenMacros.splice(index, 1);
} else this.hiddenMacros.push(this.name.toUpperCase());
}
},
watch: {
hiddenMacros: function() {
this.value = !this.hiddenMacros.includes(this.name.toUpperCase());
}
},
created() {
this.value = !this.hiddenMacros.includes(this.name.toUpperCase());
}
}
</script>
+67
View File
@@ -0,0 +1,67 @@
<style>
.settingsRunoutSwitchInput .v-messages {
display: none;
}
</style>
<template>
<div>
<v-row class="px-6" >
<v-col sm-12>
<v-switch v-model="enabled" :label="enabled ? 'enabled' : 'disabled'" @change="changeSensor()" class="settingsRunoutSwitchInput my-0"></v-switch>
</v-col>
</v-row>
<v-row class="px-6" v-if="enabled" >
<v-col sm-12>
<label class="mt-1 d-inline-block">Filament:</label>
<v-chip class="float-right" :color="filament_detected ? 'green' : 'red' " text-color="white">{{ filament_detected ? 'detected' : 'empty' }}</v-chip>
</v-col>
</v-row>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
export default {
data: function() {
return {
value: false,
enabled: false,
filament_detected: false,
}
},
props: {
name: String,
},
computed: {
...mapGetters([
'getFilamentSwitchSensors'
])
},
methods: {
changeSensor() {
this.$socket.sendObj('post_printer_gcode', { script: 'SET_FILAMENT_SENSOR SENSOR='+this.name+' ENABLE='+(this.enabled ? 0 : 1) });
}
},
watch: {
getFilamentSwitchSensors: function() {
let sensor = this.getFilamentSwitchSensors.find(sensor => sensor.name === this.name);
if (sensor) {
this.enabled = sensor.enabled;
this.filament_detected = sensor.filament_detected;
}
}
},
created() {
let sensor = this.getFilamentSwitchSensors.find(sensor => sensor.name === this.name);
if (sensor) {
this.enabled = sensor.enabled;
this.filament_detected = sensor.filament_detected;
}
}
}
</script>
+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>
+31 -3
View File
@@ -5,7 +5,7 @@
<template>
<v-row>
<v-col class="col-auto"><v-icon @click="decrement">mdi-minus</v-icon></v-col>
<v-col class="col"><v-slider v-model="value" thumb-label="always" :min="min" :max="max" @change="sendCmd" hide-details></v-slider></v-col>
<v-col class="col"><v-slider v-model="value" thumb-label="always" :label="label" :min="min" :max="max" @change="sendCmd" hide-details></v-slider></v-col>
<v-col class="col-auto"><v-icon @click="increment">mdi-plus</v-icon></v-col>
</v-row>
</template>
@@ -15,7 +15,8 @@
export default {
data: function() {
return {
value: this.target * this.multi
value: this.target * this.multi,
variableMax: 0,
}
},
props: {
@@ -32,6 +33,11 @@
required: false,
default: ''
},
label: {
type: String,
required: false,
default: ''
},
attributeScale: {
type: Number,
required: false,
@@ -47,6 +53,11 @@
required: false,
default: 100
},
extenderSteps: {
type: Number,
required: false,
default: 100
},
multi: {
type: Number,
required: false,
@@ -72,7 +83,24 @@
watch: {
target: function() {
this.value = this.target * this.multi;
}
},
/*value: function() {
if (this.value > 0) {
if (this.value > (this.variableMax - this.extenderSteps) && this.value < (this.variableMax + this.extenderSteps)) this.variableMax += this.extenderSteps;
else if (this.value > (this.variableMax - this.extenderSteps)) {
this.variableMax = (this.value / this.extenderSteps).toFixed(0) * this.extenderSteps;
if (this.variableMax < this.max) this.variableMax = this.max;
}
}
}*/
},
/*created: function() {
/!*window.console.log("Test");
window.console.log(this.target+' * '+this.multi);
this.value = this.target * this.multi;*!/
window.console.log(this.target+' * '+this.multi);
this.variableMax = (this.value / this.extenderSteps + 1).toFixed(0) * this.extenderSteps;
if (this.variableMax < this.max) this.variableMax = this.max;
}*/
}
</script>
+28 -16
View File
@@ -1,22 +1,13 @@
import Vue from 'vue'
import JRPCWS from './plugins/json-rpc-websocket'
import WebSocketClient from './plugins/wsClient'
import App from './App.vue'
import vuetify from './plugins/vuetify'
import VueResource from 'vue-resource'
import './components'
import store from './store'
import router from './plugins/router'
import { hostname } from './store/variables'
import 'vue-toast-notification/dist/index.css';
import vueHeadful from 'vue-headful';
Vue.use(JRPCWS, 'ws://' + hostname + '/websocket', {
store: store,
reconnectEnabled: true,
reconnectInterval: 3000,
recconectAttempts: 1000,
});
Vue.config.productionTip = false;
Vue.use(VueResource);
@@ -28,9 +19,30 @@ Vue.http.headers.common['Access-Control-Allow-Methods'] = 'POST, GET, PUT, OPTIO
Vue.component('vue-headful', vueHeadful);
new Vue({
vuetify,
router,
store,
render: h => h(App)
}).$mount('#app')
fetch('/config.json')
.then(res => res.json())
.then(file => {
store.commit('setSettings', file);
const socketClient = new WebSocketClient('ws://' + store.state.socket.hostname + ':' + store.state.socket.port + '/websocket', {
store: store,
reconnectEnabled: true,
reconnectInterval: store.state.socket.reconnectInterval,
});
socketClient.connect();
Vue.prototype.$socket = socketClient;
new Vue({
vuetify,
router,
store,
render: h => h(App)
}).$mount('#app')
})
.catch((error) => {
let p = document.createElement("p");
let content = document.createTextNode("config.json not found or cannot be decoded!");
p.appendChild(content);
document.getElementById('app').append(p);
window.console.error('Error:', error);
});
+24 -12
View File
@@ -28,25 +28,18 @@
<div>
<v-row>
<v-col class="col">
<v-combobox
<v-text-field
v-model="gcode"
:items="items"
label="Send code..."
solo
class="gcode-command-field"
ref="gcodeCommandField"
v-on:keyup.enter="doSend"
v-on:keyup.up="onKeyUp"
v-on:keyup.down="onKeyDown"
></v-combobox>
<!--<v-text-field
v-model="gcode"
label="Send code..."
solo
class="gcode-command-field"
v-on:keyup.enter="doSend"
v-on:keyup.up="onKeyUp"
v-on:keyup.down="onKeyDown"
></v-text-field>-->
v-on:keydown.tab="getAutocomplete"
></v-text-field>
</v-col>
<v-col class="col-auto align-content-center">
@@ -89,6 +82,7 @@
</template>
<script>
import { mapState, mapGetters } from 'vuex';
import Vue from "vue";
export default {
data () {
@@ -122,6 +116,7 @@
computed: {
...mapState({
events: state => state.events,
helplist: state => state.helplist,
}),
...mapGetters([
'getMacros'
@@ -138,7 +133,7 @@
methods: {
doSend() {
this.loadingSendGcode = true;
this.$socket.sendObj('post_printer_gcode', { script: this.gcode }, "sendGcode");
Vue.prototype.$socket.sendObj('post_printer_gcode', { script: this.gcode }, "sendGcode");
this.lastCommands.push(this.gcode);
this.gcode = "";
this.lastCommandNumber = null;
@@ -165,6 +160,23 @@
this.lastCommandNumber = null;
this.gcode = "";
}
},
getAutocomplete(e) {
e.preventDefault();
if (this.gcode.length) {
let commands = this.helplist.filter((element) => element.commandLow.indexOf(this.gcode.toLowerCase()) === 0);
if (commands && commands.length === 1) this.gcode = commands[0].command;
else {
let commands = this.helplist.filter((element) => element.commandLow.includes(this.gcode.toLowerCase()));
if (commands && commands.length) {
let output = "";
commands.forEach(command => output += "<b>"+command.command+":</b> "+command.description+"<br />");
this.$store.commit('addGcodeResponse', output);
}
}
}
this.$refs.gcodeCommandField.focus();
}
}
}
+27 -6
View File
@@ -2,19 +2,40 @@
<v-row>
<v-col class="col-sm-12 col-md-7">
<status-panel></status-panel>
<control-panel class="mt-6"></control-panel>
<macros-panel class="mt-6"></macros-panel>
<webcam-panel v-if="showDashboardWebcam" class="mt-6"></webcam-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>
<tempchart-panel class="mt-6"></tempchart-panel>
<peripherie-panel></peripherie-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>
<script>
export default {
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>
+77 -26
View File
@@ -3,8 +3,8 @@
margin-left: 7px;
}
.v-data-table th:last-child .v-data-table-header__icon {
float: right;
.v-data-table th {
white-space: nowrap;
}
.v-data-table .file-list-cursor:hover {
@@ -60,6 +60,7 @@
:sort-by.sync="sortBy"
:sort-desc.sync="sortDesc"
:items="files"
:items-per-page="countPerPage"
item-key="date"
class="files-table"
>
@@ -72,12 +73,27 @@
<td class=" ">
{{ item.filename }}
</td>
<td class=" ">
<td class="text-no-wrap text-right">
{{ formatFilesize(item.size) }}
</td>
<td class="text-end ">
<td class="text-right">
{{ formatDate(item.modified) }}
</td>
<td class="text-no-wrap text-right">
{{ item.object_height ? item.object_height.toFixed(2)+' mm' : '--' }}
</td>
<td class="text-no-wrap text-right">
{{ item.layer_height ? item.layer_height.toFixed(2)+' mm' : '--' }}
</td>
<td class="text-no-wrap text-right">
{{ item.filament_total ? item.filament_total.toFixed()+' mm' : '--' }}
</td>
<td class="text-no-wrap text-right">
{{ formatPrintTime(item.estimated_time) }}
</td>
<td class="text-no-wrap text-right">
{{ item.slicer ? item.slicer : '--' }}
</td>
</tr>
</template>
</v-data-table>
@@ -111,7 +127,6 @@
<script>
import { mapState, mapGetters } from 'vuex';
import axios from 'axios';
import { hostname } from '../store/variables';
export default {
data () {
@@ -126,16 +141,41 @@
{
text: 'Name',
value: 'filename',
width: '50%'
},
{
text: 'Filesize',
value: 'size',
align: 'right',
},
{
text: 'last modified',
text: 'Last modified',
value: 'modified',
align: 'end'
align: 'right',
},
{
text: 'Object Height',
value: 'object_height',
align: 'right',
},
{
text: 'Layer Height',
value: 'layer_height',
align: 'right',
},
{
text: 'Filament Usage',
value: 'filament_total',
align: 'right',
},
{
text: 'Print Time',
value: 'estimated_time',
align: 'right',
},
{
text: 'Generated by',
value: 'slicer',
align: 'right',
},
],
options: {
@@ -148,7 +188,6 @@
y: 0,
item: {}
},
hostname: hostname,
dropzone: {
visibility: 'hidden',
opacity: 0,
@@ -160,6 +199,9 @@
files: state => state.files,
loadingUpload: state => state.socket.loadingGcodeUpload,
loadingRefresh: state => state.socket.loadingGcodeRefresh,
countPerPage: state => state.gui.gcodefiles.countPerPage,
hostname: state => state.socket.hostname,
port: state => state.socket.port,
}),
...mapGetters([
'is_printing'
@@ -177,21 +219,17 @@
formData.append('file', file);
this.$store.commit('setLoadingGcodeUpload', true);
axios.post('http://' + hostname + '/printer/files/upload',
axios.post('http://' + this.hostname + ':' + this.port + '/printer/files/upload',
formData, {
headers: { 'Content-Type': 'multipart/form-data' }
}
).then((result) => {
this.$store.commit('setLoadingGcodeUpload', false);
toast.success("Upload of "+result.data.result+" successful!", {
icon: 'fa-check'
});
toast.success("Upload of "+result.data.result+" successful!");
})
.catch(() => {
this.$store.commit('setLoadingGcodeUpload', false);
toast.error("Cannot upload the file!", {
icon: 'fa-exclamation-triangle'
});
toast.error("Cannot upload the file!");
});
},
clickUploadButton: function() {
@@ -204,7 +242,7 @@
formatDate(date) {
let tmp2 = new Date(date);
return tmp2.toLocaleString();
return tmp2.toLocaleString().replace(',', '');
},
formatFilesize(fileSizeInBytes) {
let i = -1;
@@ -216,6 +254,23 @@
return Math.max(fileSizeInBytes, 0.1).toFixed(1) + byteUnits[i];
},
formatPrintTime(totalSeconds) {
if (totalSeconds) {
let output = "";
let hours = Math.floor(totalSeconds / 3600);
totalSeconds %= 3600;
if (hours) output += hours+"h";
let minutes = Math.floor(totalSeconds / 60);
if (minutes) output += " "+minutes+"m";
let seconds = totalSeconds % 60;
if (seconds) output += " "+seconds.toFixed(0)+"s";
return output;
}
return '--';
},
showContextMenu (e, item) {
e.preventDefault();
this.contextMenu.shown = true;
@@ -229,22 +284,18 @@
downloadFile() {
let link = document.createElement("a");
link.download = name;
link.href = 'http://' + hostname + '/printer/files/' + this.contextMenu.item.filename;
link.href = 'http://' + this.hostname + ':' + this.port + '/printer/files/' + this.contextMenu.item.filename;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
},
removeFile() {
axios.delete(
'http://'+hostname+'/printer/files/'+this.contextMenu.item.filename
).then(() => {
this.$toast(this.contextMenu.item.filename+" successfully deleted.", {
icon: 'fa-trash'
});
'http://'+ this.hostname + ':' + this.port +'/printer/files/'+this.contextMenu.item.filename
).then((result) => {
this.$toast.success(result.data.result+" successfully deleted.");
}).catch(() => {
this.$toast.error("Error! Cannot delete file.", {
icon: 'fa-warning'
});
this.$toast.error("Error! Cannot delete file.");
});
},
startPrint(filename = "") {
+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>
@@ -1,6 +1,8 @@
<template>
<div>
Settings - General
<router-view></router-view>
</div>
</template>
<script>
+32
View File
@@ -0,0 +1,32 @@
<style>
</style>
<template>
<div>
<v-row>
<v-col col-12>
<webcam-panel></webcam-panel>
</v-col>
</v-row>
</div>
</template>
<script>
import { mapState } from 'vuex';
export default {
data () {
return {
}
},
computed: {
...mapState({
webcamUrl: state => state.webcam.url,
}),
},
methods: {
}
}
</script>
+36
View File
@@ -0,0 +1,36 @@
<template>
<div>
<v-row>
<v-col class="col-12 col-md-6 col-lg-4">
<settings-dashboard-panel></settings-dashboard-panel>
</v-col>
<v-col class="col-12 col-md-6 col-lg-4">
<settings-webcam-panel></settings-webcam-panel>
</v-col>
<v-col class="col-12 col-md-6 col-lg-4">
<settings-macros-panel></settings-macros-panel>
</v-col>
</v-row>
<v-fab-transition>
<v-btn fab fixed large bottom right :loading="loadingUpload" @click="saveGuiSettings">
<v-icon>mdi-check</v-icon>
</v-btn>
</v-fab-transition>
</div>
</template>
<script>
import { mapState, mapActions } from 'vuex';
export default {
computed: {
...mapState({
loadingUpload: state => state.socket.loadingSaveGuiConfig,
}),
},
methods: {
...mapActions([
'saveGuiSettings'
]),
}
}
</script>
+30 -2
View File
@@ -1,10 +1,38 @@
<template>
<div>
Settings - Machine
<v-row>
<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-if="is_ready">
<settings-endstop-panel></settings-endstop-panel>
<settings-runout-panel></settings-runout-panel>
</v-col>
<v-col class="col-sm-12 col-md-3">
<settings-system-panel></settings-system-panel>
</v-col>
</v-row>
</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>
-9
View File
@@ -1,9 +0,0 @@
import WebSocketClient from './wsClient'
export default {
install (Vue, url, options) {
const socketClient = new WebSocketClient(url, options)
socketClient.connect()
Vue.prototype.$socket = socketClient
}
}
-122
View File
@@ -1,122 +0,0 @@
export default class WebSocketClient {
constructor (url, options) {
this.instance = null
this.url = url
this.options = options || this.defaultOptions()
if (this.options) {
if (options.reconnectEnabled) {
this.reconnectEnabled = options.reconnectEnabled
if (this.reconnectEnabled) {
this.reconnectInterval = options.reconnectInterval
this.reconnectAttempts = options.recconectAttempts
this.reconnectCount = 1
}
}
if (options.store) {
this.store = options.store
}
}
this.wsData = []
this.onOpen = null
this.onMessage = null
this.onClose = null
this.onError = null
}
createMessage (method, params, id) {
let msg = {
jsonrpc: '2.0', method: method, params: params, id: id
};
return JSON.stringify(msg)
}
defaultOptions () {
return {
reconnectEnabled: false,
reconnectInterval: 0,
recconectAttempts: 0,
store: undefined
}
}
passToStore (eventName, event) {
if (!eventName.startsWith('socket_')) { return }
let method = 'dispatch'
let target = eventName
let msg = event
if (event.data) {
msg = JSON.parse(event.data)
}
this.store[method](target, msg)
}
connect () {
this.instance = new WebSocket(this.url);
this.instance.onopen = () => {
if (this.reconnectEnabled) this.reconnectCount = 1;
if (typeof this.onOpen === 'function') this.onOpen();
if (this.store) this.passToStore('socket_on_open', event);
};
this.instance.onmessage = (msg) => {
let data = JSON.parse(msg.data);
if (typeof this.onMessage === 'function') {
this.onMessage(data)
} else if (this.store) {
if ('error' in data) {
this.passToStore('socket_on_error', data.error)
} else if (this.wsData.filter(item => item.id === data.id).length > 0 &&
this.wsData.filter(item => item.id === data.id)[0].action !== "") {
this.store.dispatch(
this.wsData.filter(item => item.id === data.id)[0].action,
data.result
)
} else this.passToStore('socket_on_message', data)
}
}
this.instance.onclose = (e) => {
if (typeof this.onClose === 'function') {
this.onClose(e)
} else if (this.store) {
this.passToStore('socket_on_close', e)
}
if (!e.wasClean && this.reconnectEnabled) {
this.reconnect()
}
}
this.instance.onerror = (e) => {
if (typeof this.onError === 'function') {
this.onError(e)
} else if (this.store) {
this.passToStore('socket_on_error', e)
}
}
}
reconnect () {
if (this.reconnectCount <= this.reconnectAttempts) {
this.reconnectCount++
delete this.instance
setTimeout(() => {
this.connect()
if (this.store) { this.passToStore('socket_reconnect', this.reconnectCount) }
}, this.reconnectInterval)
} else {
if (this.store) { this.passToStore('socket_reconnect_error', true) }
}
}
sendObj (method, params, action = '') {
let id = Math.floor(Math.random() * 10000) + 1
this.wsData.push({
id: id,
action: action
})
this.instance.send(this.createMessage(method, params, id))
}
}
+10 -10
View File
@@ -1,7 +1,14 @@
import '@fortawesome/fontawesome-free/css/all.css'
import '@mdi/font/css/materialdesignicons.css'
import Vue from 'vue';
import Vuetify, { VSnackbar, VBtn, VIcon } from 'vuetify/lib';
import VuetifyToast from 'vuetify-toast-snackbar'
//vue-toast-notification
import VueToast from 'vue-toast-notification';
import 'vue-toast-notification/dist/theme-sugar.css';
Vue.use(VueToast, {
duration: 3000,
});
Vue.use(Vuetify,{
@@ -12,15 +19,8 @@ Vue.use(Vuetify,{
}
});
Vue.use(VuetifyToast, {
x: 'right',
y: 'bottom',
timeout: 3000,
});
export default new Vuetify({
icons: {
iconfont: 'fa',
iconfont: 'mdi',
},
});
+79
View File
@@ -0,0 +1,79 @@
export default class WebSocketClient {
constructor (url, options) {
this.instance = null;
this.url = url;
this.reconnectInterval = options.reconnectInterval;
this.store = options.store;
this.wsData = [];
this.timerId = 0;
this.keepAliveTimeout = 1000;
this.onOpen = null;
this.onMessage = null;
this.onClose = null;
this.onError = null;
}
createMessage (method, params, id) {
let msg = {
jsonrpc: '2.0', method: method, params: params, id: id
};
return JSON.stringify(msg)
}
passToStore (eventName, event) {
if (!eventName.startsWith('socket_')) { return }
let method = 'dispatch'
let target = eventName
let msg = event
if (event && event.data) {
msg = JSON.parse(event.data)
}
this.store[method](target, msg)
}
connect () {
this.instance = new WebSocket(this.url);
this.instance.onopen = () => {
if (this.store) this.passToStore('socket_on_open', event);
};
this.instance.onclose = (e) => {
window.console.log("Websocket Closed, reconnecting in "+this.reconnectInterval+"ms: ", e.reason);
this.passToStore('socket_on_close', e);
setTimeout(() => {
this.connect();
}, this.reconnectInterval);
};
this.instance.onerror = (err) => {
console.log("Websocket Error: ", err);
this.instance.close();
};
this.instance.onmessage = (msg) => {
let data = JSON.parse(msg.data);
if (this.store) {
if (this.wsData.filter(item => item.id === data.id).length > 0 &&
this.wsData.filter(item => item.id === data.id)[0].action !== "") {
this.store.dispatch(
this.wsData.filter(item => item.id === data.id)[0].action,
data.result
)
} else this.passToStore('socket_on_message', data)
}
};
}
sendObj (method, params, action = '') {
let id = Math.floor(Math.random() * 10000) + 1
this.wsData.push({
id: id,
action: action
})
this.instance.send(this.createMessage(method, params, id))
}
}
+39 -16
View File
@@ -1,22 +1,41 @@
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 SettingsGeneral from '../pages/settings/general.vue'
//import SettingsMachine from '../pages/settings/machine.vue'
import Settings from '../pages/Settings.vue'
import SettingsInterface from '../pages/settings/interface.vue'
import SettingsMachine from '../pages/settings/machine.vue'
const routes = [
{
title: "Dashboard",
path: '/',
icon: 'view-dashboard',
component: Dashboard
component: Dashboard,
alwaysShow: true,
},
{
title: "Webcam",
path: '/webcam',
icon: 'webcam',
component: Webcam,
alwaysShow: false,
},
{
title: "Console",
path: '/console',
icon: 'code-tags',
component: Console
icon: 'console-line',
component: Console,
alwaysShow: false,
},
{
title: "Heightmap",
path: '/heightmap',
icon: 'grid',
component: Heightmap,
alwaysShow: false,
},
/*{
title: "Current Job",
@@ -28,27 +47,31 @@ const routes = [
title: "G-Code Files",
path: '/files',
icon: 'printer-3d-nozzle',
component: Files
component: Files,
alwaysShow: false,
},
/*{
{
title: "Settings",
path: '/settings',
redirect: '/settings/machine',
icon: 'wrench',
component: Settings,
alwaysShow: true,
children: [
{
title: 'General',
path: '/settings/general',
icon: 'settings',
component: SettingsGeneral
},
{
title: 'Machine',
path: '/settings/machine',
icon: 'settings-box',
component: SettingsMachine
component: SettingsMachine,
alwaysShow: true,
},
{
title: 'Interface',
path: '/settings/interface',
component: SettingsInterface,
alwaysShow: true,
},
]
},*/
},
];
+105 -29
View File
@@ -1,14 +1,26 @@
import Vue from 'vue'
import router from "../plugins/router";
import store from "./index";
import axios from "axios";
export default {
socket_on_open ({ commit }) {
commit('setConnected');
window.console.log('Socket connected');
Vue.prototype.$socket.sendObj('get_printer_status', { }, 'getHelpData');
fetch('http://'+store.state.socket.hostname+':'+store.state.socket.port+'/printer/files/gui.json')
.then(res => res.json()).then(file => {
store.commit('setSettings', file);
}).catch(function() {
window.console.warn('No kwc config file found.');
});
Vue.prototype.$socket.sendObj('get_printer_info', {}, 'getKlipperInfo');
},
socket_on_close ({ commit }, event) {
commit('setDisconnected')
commit('setDisconnected');
if (event.wasClean) {
window.console.log('Socket closed clear')
} else {
@@ -17,10 +29,6 @@ export default {
window.console.error('Code: ' + event.code)
},
socket_on_error ({ commit }, data) {
commit('reportError', data);
},
socket_on_message ({ commit, state }, data) {
if (!state.socket.isConnected) commit('setConnected');
switch(data.method) {
@@ -36,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);
@@ -57,34 +65,79 @@ export default {
}
},
socket_reconnect ({ commit }, count) {
commit('setConnected');
window.console.log(count)
},
saveGuiSettings({ commit, state }) {
commit('setLoadingSaveGuiConfige', true);
let file = new File([JSON.stringify({ webcam: state.webcam, gui: state.gui })], 'gui.json');
socket_reconnect_error ({ commit }) {
commit('setDisconnected');
window.console.error('Socket disconnected')
let formData = new FormData();
formData.append('file', file);
axios.post('http://' + state.socket.hostname + ':' + state.socket.port + '/printer/files/upload',
formData, {
headers: { 'Content-Type': 'multipart/form-data' }
}
).then(() => {
commit('setLoadingSaveGuiConfige', false);
}).catch(() => {
window.console.error("Error save gui.json!");
});
},
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);
},
getPrinterConfig({commit}, data) {
commit('setPrinterConfig', 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");
},
addSubscription(state, data) {
window.console.log(state);
window.console.log(data);
getHeatersHistory({ commit }, data) {
commit('setHeaterHistory', data);
},
getPrinterConfig({commit}, data) {
commit('setPrinterConfig', data);
},
getFileList({ commit }, data) {
@@ -92,6 +145,15 @@ export default {
commit('setLoadingGcodeRefresh', false);
},
getHelpList({ commit }, data) {
commit('setHelpList', data);
},
setHeaterChartVisibility({ commit, dispatch }, data) {
commit('setHeaterChartVisibility', data);
dispatch('saveGuiSettings');
},
setLoadingSendGcode({commit}, value) {
commit('setLoadingSendGcode', value);
},
@@ -115,22 +177,23 @@ export default {
sendGcode({commit}, data) {
commit('setLoadingSendGcode', false);
commit('sendGcode', data);
commit('addGcodeResponse', data);
},
responseHome({commit}) {
commit('setLoadingHome', false);
commit('removeLoading', { name: 'controlHomeAll' });
},
responseHomeX({commit}) {
commit('setLoadingHomeX', false);
commit('removeLoading', { name: 'controlHomeX' });
},
responseHomeY({commit}) {
commit('setLoadingHomeY', false);
commit('removeLoading', { name: 'controlHomeY' });
},
responseHomeZ({commit}) {
commit('setLoadingHomeZ', false);
commit('removeLoading', { name: 'controlHomeZ' });
},
responseQGL({commit}) {
@@ -145,7 +208,20 @@ export default {
commit('setLoadingRestartFirmware', false);
},
responseEndstopStatus({ commit }, data) {
commit('setLoadingEndstopStatus', false);
commit('setEndstopStatus', data);
},
switchToDashboard() {
router.push("/");
}
},
getHelpData({ commit }, data) {
commit('voidMutation', data);
},
setSettings({ commit }, data) {
commit('setSettings', data);
},
}
+141 -4
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);
@@ -76,6 +103,22 @@ export default {
return []
},
current_file_estimated_time: state => {
let file = state.files.filter((file) => file.filename === state.printer.virtual_sdcard.current_file);
if (file.length) return file[0]['estimated_time'];
return 0;
},
current_file_filament_total: state => {
let file = state.files.filter((file) => file.filename === state.printer.virtual_sdcard.current_file);
if (file.length) return file[0]['filament_total'];
return 0;
},
bool_fan: state => {
return Object.entries(state.object).indexOf('fan');
},
@@ -86,9 +129,16 @@ export default {
getMacros: state => {
let array = [];
let hiddenMacros = [];
state.gui.dashboard.hiddenMacros.forEach(function(item,index) {
hiddenMacros[index] = item.toLowerCase();
});
for (let prop in state.config) {
if (prop.startsWith('gcode_macro') && !state.config[prop].hasOwnProperty('rename_existing')) {
if (prop.startsWith('gcode_macro') &&
!Object.hasOwnProperty.call(state.config[prop], 'rename_existing') &&
!(hiddenMacros.indexOf(prop.replace('gcode_macro ', '').toLowerCase()) > -1)
) {
array.push({
'name': prop.replace('gcode_macro ', ''),
'prop': state.config[prop]
@@ -96,7 +146,90 @@ export default {
}
}
return array;
return array.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;
});
},
getAllMacros: state => {
let array = [];
for (let prop in state.config) {
if (prop.startsWith('gcode_macro') &&
!Object.hasOwnProperty.call(state.config[prop], 'rename_existing')) {
array.push({
'name': prop.replace('gcode_macro ', ''),
'prop': state.config[prop]
});
}
}
return array.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;
});
},
getFilamentSwitchSensors: state => {
let sensors = [];
for (let [key, value] of Object.entries(state.printer)) {
let nameSplit = key.split(" ");
if (nameSplit[0] === "filament_switch_sensor") {
sensors.push({
name: nameSplit[1],
enabled: value.enabled,
filament_detected: value.filament_detected,
});
}
}
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;
});
},
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 => {
@@ -106,5 +239,9 @@ export default {
return state.printer.hostname;
} else return "KlipperWebControl";
},
showDashboardWebcam: state => {
return (state.webcam.url !== "" && state.gui.dashboard.boolWebcam);
}
}
+42 -9
View File
@@ -11,19 +11,45 @@ Vue.use(VueToast);
export default new Vuex.Store({
state: {
socket: {
hostname: window.location.hostname,
port: window.location.port,
reconnectInterval: 3000,
isConnected: false,
loadingGcodeUpload: false,
loadingGcodeRefresh: false,
loadingEmergencyStop: false,
loadingPrintPause: false,
loadingPrintResume: false,
loadingHome: false,
loadingHomeX: false,
loadingHomeY: false,
loadingHomeZ: false,
loadingQGL: false,
loadingRestart: false,
loadingRestartFirmware: false,
loadingRebootHost: false,
loadingShutdownHost: false,
loadingSaveGuiConfig: false,
loadingEndstopStatus: false,
klippy_state: "ready",
},
webcam: {
url: ""
},
gui: {
dashboard: {
boolWebcam: true,
boolTempchart: true,
boolConsole: false,
hiddenMacros: [],
hiddenTempChart: [],
},
webcam: {
bool: false,
},
gcodefiles: {
countPerPage: 10,
}
},
loadings: [],
config: {
},
printer: {
hostname: '',
@@ -35,6 +61,10 @@ export default new Vuex.Store({
print_time: 0,
printing_time: 0,
estimated_print_time: 0,
max_velocity: 0,
max_accel: 0,
max_accel_to_decel: 0,
square_corner_velocity: 0,
},
pause_resume: {
is_paused: false
@@ -43,6 +73,10 @@ export default new Vuex.Store({
printing_time: 0,
state: "",
},
display_status: {
message: null,
progress: 0,
},
virtual_sdcard: {
progress: 0,
current_file: "",
@@ -58,20 +92,19 @@ export default new Vuex.Store({
},
fan: {
speed: 0,
}
},
endstops: {},
},
object: {
heater: {
heaters: {
available_heaters: []
}
},
config: {
},
temperaturChart: {
labels: [],
datasets: [],
},
helplist: [],
files: [],
events: []
},
+193 -83
View File
@@ -1,119 +1,218 @@
import Vue from "vue";
import { colorArray, colorChamber, colorHeaterBed, temperaturChartSampleInterval, temperaturChartSampleLength } from './variables';
const objectAssignDeep = require(`object-assign-deep`);
import { colorArray, colorChamber, colorHeaterBed, temperaturChartSampleLength } from './variables';
export default {
setConnected (state) {
state.socket.isConnected = true;
//reset store
},
setDisconnected (state) {
state.socket.isConnected = false
Vue.prototype.$socket.reconnect();
state.socket.isConnected = false;
//Vue.prototype.$socket.reconnect();
},
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);
if (index >= 0) state.temperaturChart.datasets[index].data.push(value.temperature.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: 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);
},
setObjectData(state, data) {
Object.assign(state.object, data);
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] === "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) {
state.files = [];
let array = Object.entries(data);
for (let [key, file] of Object.entries(data)) {
state.files.push({
number: key,
filename: file.filename,
modified: Date.parse(file.modified),
size: file.size,
});
for (let [key, file] of array) {
if (file.filename !== "gui.json") {
state.files.push({
number: key,
filename: file.filename,
modified: Date.parse(file.modified),
size: file.size,
slicer: file.slicer,
filament_total: file.filament_total,
estimated_time: file.estimated_time,
layer_height: file.layer_height,
first_layer_height: file.first_layer_height,
object_height: file.object_height,
});
}
}
//state.files = data;
},
setHelpList(state, data) {
state.helplist = [];
for (let [command, description] of Object.entries(data)) {
state.helplist.push({
'commandLow': command.toLowerCase(),
'command': command,
'description': description,
});
}
},
addGcodeResponse(state, data) {
state.events.push({
date: new Date(),
message: data
});
if (data.substring(0,2) === "!!") {
if (data !== undefined && data.substring(0,2) === "!!") {
Vue.$toast.error(data);
}
},
setEndstopStatus(state, data) {
Vue.set(state.printer, 'endstops', data);
},
setLoadingSendGcode(state, value) {
state.socket.loadingSendGcode = value;
},
@@ -122,8 +221,19 @@ export default {
state.socket.loadingSendGcode = false;
},
setLoading(state, data) {
if (!state.loadings.includes(data.name)) {
state.loadings.push(data.name);
}
},
removeLoading(state, data) {
state.loadings = state.loadings.filter(function(ele){ return ele !== data.name; });
},
setPrinterStatus(state, value) {
state.printer.toolhead.status = value;
state.socket.klippy_state = value;
//state.printer.toolhead.status = value;
},
setLoadingGcodeUpload(state, value) {
@@ -150,22 +260,6 @@ export default {
state.socket.loadingPrintCancel = value;
},
setLoadingHome(state, value) {
state.socket.loadingHome = value;
},
setLoadingHomeX(state, value) {
state.socket.loadingHomeX = value;
},
setLoadingHomeY(state, value) {
state.socket.loadingHomeY = value;
},
setLoadingHomeZ(state, value) {
state.socket.loadingHomeZ = value;
},
setLoadingQGL(state, value) {
state.socket.loadingQGL = value;
},
@@ -178,6 +272,22 @@ export default {
state.socket.loadingRestartFirmware = value;
},
setLoadingRebootHost(state, value) {
state.socket.loadingRebootHost = value;
},
setLoadingShutdownHost(state, value) {
state.socket.loadingShutdownHost = value;
},
setLoadingSaveGuiConfige(state, value) {
state.socket.loadingSaveGuiConfig = value;
},
setLoadingEndstopStatus(state, value) {
state.socket.loadingEndstopStatus = value;
},
reportError(state, data) {
//Vue.$toast.error(data.message);
window.console.log(data);
+2 -3
View File
@@ -1,5 +1,5 @@
export const hostname = window.location.host;
//export const hostname = "voron250.local:8080";
//export const hostname = window.location.host;
export const hostname = "voron250.local:8080";
//export const hostname = "kossel.local:8080";
export const colorArray = [
@@ -14,5 +14,4 @@ export const colorArray = [
export const colorHeaterBed = '#2196F3';
export const colorChamber = '#4CAF50';
export const temperaturChartSampleInterval = 1000;
export const temperaturChartSampleLength = 600;