diff --git a/package-lock.json b/package-lock.json index 9b9bb676..3f3707c6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12321,11 +12321,6 @@ "integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==", "dev": true }, - "vue-json-rpc-websocket": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/vue-json-rpc-websocket/-/vue-json-rpc-websocket-1.1.1.tgz", - "integrity": "sha512-uyIVLpToFnLcPLgTSb6hEvvtrgwyD8hAkozPfpRT1E3c8Fzs3XQjvTOLkbO2DkUYBXQzIAS1uH5GSuy3YL9v8Q==" - }, "vue-loader": { "version": "15.9.1", "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.9.1.tgz", @@ -12545,6 +12540,15 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", "dev": true + }, + "ws": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", + "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", + "dev": true, + "requires": { + "async-limiter": "~1.0.0" + } } } }, @@ -12751,6 +12755,15 @@ } } }, + "ws": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", + "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", + "dev": true, + "requires": { + "async-limiter": "~1.0.0" + } + }, "yargs": { "version": "12.0.5", "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", @@ -12958,15 +12971,6 @@ "mkdirp": "^0.5.1" } }, - "ws": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", - "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", - "dev": true, - "requires": { - "async-limiter": "~1.0.0" - } - }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", diff --git a/package.json b/package.json index edc65bb0..49ff1671 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "vue-chartjs": "^3.5.0", "vue-context": "^5.1.0", "vue-headful": "^2.1.0", - "vue-json-rpc-websocket": "^1.1.1", "vue-resource": "^1.5.1", "vue-simple-upload": "^0.1.6", "vue-toast-notification": "^0.2.0", diff --git a/public/config.json b/public/config.json index ed78de34..02de5939 100644 --- a/public/config.json +++ b/public/config.json @@ -1,7 +1,7 @@ { "socket": { "hostname": "voron250.local", - "reconnectInterval": 5000, - "reconnectAttempts": 1000 + "port": 8080, + "reconnectInterval": 3000 } } \ No newline at end of file diff --git a/public/img/heard.png b/public/img/heard.png new file mode 100644 index 00000000..abe3fd48 Binary files /dev/null and b/public/img/heard.png differ diff --git a/public/img/voron.png b/public/img/voron.png new file mode 100644 index 00000000..f47c6d7c Binary files /dev/null and b/public/img/voron.png differ diff --git a/src/App.vue b/src/App.vue index af068fba..317c7c57 100644 --- a/src/App.vue +++ b/src/App.vue @@ -66,7 +66,7 @@ {{ version }} - Made with by . © 2020 + Made with heard by Logo - VoronDesign @@ -89,9 +89,8 @@ export default { }), created () { this.$vuetify.theme.dark = true; - this.$socket.onOpen = () => { - - } + window.console.log('app created'); + this.$webSocketsConnect(); }, computed: { currentPage: function() { @@ -114,7 +113,7 @@ export default { methods: { emergencyStop: function() { this.$store.commit('setLoadingEmergencyStop', true); - this.$socket.sendObj('post_printer_gcode', {script: 'M112'}, 'setLoadingEmergencyStop'); + //this.$socket.sendObj('post_printer_gcode', {script: 'M112'}, 'setLoadingEmergencyStop'); }, drawFavicon(val) { let favicon = document.getElementById('favicon'); diff --git a/src/components/panels/ControlPanel.vue b/src/components/panels/ControlPanel.vue index 2348e7e0..892a8114 100644 --- a/src/components/panels/ControlPanel.vue +++ b/src/components/panels/ControlPanel.vue @@ -6,7 +6,7 @@ -
mdi-homeHome all
+
mdi-homeHome all
QGL
@@ -61,6 +61,7 @@ \ No newline at end of file diff --git a/src/components/panels/Settings/SystemPanel.vue b/src/components/panels/Settings/SystemPanel.vue index 7a74e6a9..d85dd3eb 100644 --- a/src/components/panels/Settings/SystemPanel.vue +++ b/src/components/panels/Settings/SystemPanel.vue @@ -11,6 +11,8 @@
mdi-downloadDownload Log
mdi-cachedRestart
mdi-cachedFW Restart
+
mdi-cachedHost Restart
+
mdi-powerHost Shutdown
@@ -33,6 +35,8 @@ 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', @@ -48,6 +52,14 @@ 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', { }); + }, } } \ No newline at end of file diff --git a/src/components/panels/StatusPanel.vue b/src/components/panels/StatusPanel.vue index 75d7e31a..b1bcf007 100644 --- a/src/components/panels/StatusPanel.vue +++ b/src/components/panels/StatusPanel.vue @@ -43,7 +43,7 @@ Filament used - {{ filament_used.toFixed(2) }}mm + {{ filament_total.toFixed(2) }}mm @@ -73,13 +73,13 @@ Filament - {{ filament_used > 0 && current_file_filament_used > 0 ? formatTime(print_time / (filament_used / current_file_filament_used) - print_time) : '--' }} + {{ (filament_used > 0 && current_file_filament_total > filament_used) ? formatTime(print_time / (filament_used / current_file_filament_total) - print_time) : '--' }} Slicer - {{ current_file_estimated_time > print_time ? formatTime(current_file_estimated_time - print_time) : formatTime(0) }} + {{ current_file_estimated_time > print_time ? formatTime(current_file_estimated_time - print_time) : '--'}} @@ -132,7 +132,7 @@ 'current_file_size', 'current_file_metadata', 'current_file_estimated_time', - 'current_file_filament_used', + 'current_file_filament_total', 'is_printing', ]), }, diff --git a/src/main.js b/src/main.js index 2c9d7568..599b03a6 100644 --- a/src/main.js +++ b/src/main.js @@ -1,5 +1,6 @@ import Vue from 'vue' -import JRPCWS from './plugins/json-rpc-websocket' +//import WebSocketClient from './plugins/wsClient' +import webSocketService from './services/websocket' import App from './App.vue' import vuetify from './plugins/vuetify' import VueResource from 'vue-resource' @@ -22,12 +23,19 @@ Vue.component('vue-headful', vueHeadful); fetch('/config.json').then(res => res.json()) .then(file => { store.commit('setSettings', file); - Vue.use(JRPCWS, 'ws://' + store.state.socket.hostname + ':' + store.state.socket.port + '/websocket', { - store: store, - reconnectEnabled: true, - reconnectInterval: store.state.socket.reconnectInterval, - reconnectAttempts: store.state.socket.reconnectAttempts, + + /*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*/ + + Vue.use(webSocketService, { + store, + url: 'ws://' + store.state.socket.hostname + ':' + store.state.socket.port + '/websocket' + }) new Vue({ vuetify, diff --git a/src/pages/Console.vue b/src/pages/Console.vue index 659c5f81..3ccb1fa7 100644 --- a/src/pages/Console.vue +++ b/src/pages/Console.vue @@ -82,6 +82,7 @@