diff --git a/Main/chameleon-vision.iml b/Main/chameleon-vision.iml index 46611ad3c..bb72d8934 100644 --- a/Main/chameleon-vision.iml +++ b/Main/chameleon-vision.iml @@ -10,7 +10,6 @@ - @@ -39,9 +38,6 @@ - - - diff --git a/Main/src/main/java/com/chameleonvision/vision/camera/Camera.java b/Main/src/main/java/com/chameleonvision/vision/camera/Camera.java index b5ee7d7a7..1f7165ab6 100644 --- a/Main/src/main/java/com/chameleonvision/vision/camera/Camera.java +++ b/Main/src/main/java/com/chameleonvision/vision/camera/Camera.java @@ -229,26 +229,26 @@ public class Camera { public void setDriverMode(boolean state) { Map data = new HashMap<>(); - isDriver=state; - if(isDriver){ - UsbCam.setBrightness(driverBrightness); - UsbCam.setBrightness(driverBrightness); - try{UsbCam.setExposureManual(driverExposure);} - catch (VideoException e) - { - System.out.println("Exposure change isnt supported"); - } - data.put("brightness",getBrightness()); - data.put("exposure",driverExposure); - } - else{ - UsbCam.setBrightness(getCurrentPipeline().brightness); - UsbCam.setBrightness(getCurrentPipeline().brightness); - try{UsbCam.setExposureManual(getCurrentPipeline().exposure);} - catch (VideoException e) - { - System.out.println("Exposure change isnt supported"); + isDriver=state; + if(isDriver){ + UsbCam.setBrightness(driverBrightness); + UsbCam.setBrightness(driverBrightness); + try{UsbCam.setExposureManual(driverExposure);} + catch (VideoException e) + { + System.out.println("Exposure change isnt supported"); + } + data.put("brightness",getBrightness()); + data.put("exposure",driverExposure); } + else{ + UsbCam.setBrightness(getCurrentPipeline().brightness); + UsbCam.setBrightness(getCurrentPipeline().brightness); + try{UsbCam.setExposureManual(getCurrentPipeline().exposure);} + catch (VideoException e) + { + System.out.println("Exposure change isnt supported"); + } data.put("brightness",getBrightness()); data.put("exposure",getCurrentPipeline().exposure); } diff --git a/Main/src/main/java/com/chameleonvision/web/ServerHandler.java b/Main/src/main/java/com/chameleonvision/web/ServerHandler.java index 1d8af3556..746ab9d7e 100644 --- a/Main/src/main/java/com/chameleonvision/web/ServerHandler.java +++ b/Main/src/main/java/com/chameleonvision/web/ServerHandler.java @@ -114,6 +114,7 @@ public class ServerHandler { break; case "save": SettingsManager.saveSettings(); + System.out.println("saved Settings"); break; } // used to define all incoming commands diff --git a/chameleon-client/.eslintrc.js b/chameleon-client/.eslintrc.js index 1c6179f37..fa60bcbb4 100644 --- a/chameleon-client/.eslintrc.js +++ b/chameleon-client/.eslintrc.js @@ -14,4 +14,4 @@ module.exports = { parserOptions: { parser: 'babel-eslint' } -} +}; diff --git a/chameleon-client/babel.config.js b/chameleon-client/babel.config.js index ba179669a..fd1df2a30 100644 --- a/chameleon-client/babel.config.js +++ b/chameleon-client/babel.config.js @@ -2,4 +2,4 @@ module.exports = { presets: [ '@vue/app' ] -} +}; diff --git a/chameleon-client/postcss.config.js b/chameleon-client/postcss.config.js index 961986e2b..5bfb8f628 100644 --- a/chameleon-client/postcss.config.js +++ b/chameleon-client/postcss.config.js @@ -2,4 +2,4 @@ module.exports = { plugins: { autoprefixer: {} } -} +}; diff --git a/chameleon-client/src/App.vue b/chameleon-client/src/App.vue index 4bb7f2913..07c7953cb 100644 --- a/chameleon-client/src/App.vue +++ b/chameleon-client/src/App.vue @@ -15,7 +15,12 @@ - + + +
+

Saved All changes

+
+
@@ -42,9 +47,23 @@ } } } + }, + saveSettings() { + clearInterval(this.timer); + this.saveSnackbar = true; + this.handleInput("command", "save"); + }, + startTimer() { + if (this.timer !== undefined) { + clearInterval(this.timer); + } + this.timer = setInterval(this.saveSettings, 4000); } }, - data: () => ({}), + data: () => ({ + saveSnackbar: false, + timer: undefined + }), created() { this.$options.sockets.onmessage = async (data) => { try { diff --git a/chameleon-client/src/components/cv-select.vue b/chameleon-client/src/components/cv-select.vue index 44a713527..02b33e6c7 100644 --- a/chameleon-client/src/components/cv-select.vue +++ b/chameleon-client/src/components/cv-select.vue @@ -29,7 +29,7 @@ } }, indexList() { - let list = [] + let list = []; for (let i = 0; i < this.list.length; i++) { list.push({ name: this.list[i], diff --git a/chameleon-client/src/main.js b/chameleon-client/src/main.js index e5b238da4..86192f4ea 100644 --- a/chameleon-client/src/main.js +++ b/chameleon-client/src/main.js @@ -9,18 +9,18 @@ import msgPack from 'msgpack5'; Vue.config.productionTip = false; // Vue.use(VueNativeSock,'ws://' + location.host + '/websocket',{format: 'json'}); Vue.use(VueNativeSock, 'ws://' + location.hostname + ':8888/websocket'); -Vue.prototype.$msgPack = msgPack(true) +Vue.prototype.$msgPack = msgPack(true); Vue.mixin({ methods: { handleInput(key, value) { - let msg = this.$msgPack.encode({[key]: value}) + let msg = this.$msgPack.encode({[key]: value}); this.$socket.send(msg); } } -}) +}); new Vue({ router, store, vuetify, render: h => h(App) -}).$mount('#app') +}).$mount('#app'); diff --git a/chameleon-client/src/router.js b/chameleon-client/src/router.js index 7e07bff01..6319584d0 100644 --- a/chameleon-client/src/router.js +++ b/chameleon-client/src/router.js @@ -1,6 +1,6 @@ import Vue from 'vue' import Router from 'vue-router' -Vue.use(Router) +Vue.use(Router); function lazyLoad(view){ return() => import(`@/views/${view}.vue`) diff --git a/chameleon-client/src/store.js b/chameleon-client/src/store.js index 85e05e73b..9a060c585 100644 --- a/chameleon-client/src/store.js +++ b/chameleon-client/src/store.js @@ -1,77 +1,84 @@ import Vue from 'vue' import Vuex from 'vuex' -Vue.use(Vuex) +Vue.use(Vuex); -const set = key => (state,val) =>{ - Vue.set(state,key,val); +const set = key => (state, val) => { + Vue.set(state, key, val); }; export default new Vuex.Store({ - state: { - settings:{ - teamNumber:1577, - connectionType:0, - ip:"", - gateway:"", - netmask:"", - hostname: "Chameleon-vision" + state: { + settings: { + teamNumber: 1577, + connectionType: 0, + ip: "", + gateway: "", + netmask: "", + hostname: "Chameleon-vision" + }, + pipeline: { + exposure: 0, + brightness: 0, + orientation: 0, + hue: [0, 15], + saturation: [0, 15], + value: [0, 25], + erode: false, + dilate: false, + area: [0, 12], + ratio: [0, 12], + extent: [0, 12], + speckle: 5, + targetGrouping: 0, + targetIntersection: 0, + sortMode: 0, + isBinary: 0, + calibrationMode: 0 + }, + driverState: { + startDriver: false, + exposure: 0, + brightness: 0 + }, + cameraSettings: {}, + resolutionList: [], + port: 1181, + currentCameraIndex: 0, + currentPipelineIndex: 0, + cameraList: [], + pipelineList: [], + point: {} }, - pipeline:{ - exposure:0, - brightness:0, - orientation:0, - hue:[0,15], - saturation:[0,15], - value:[0,25], - erode:false, - dilate:false, - area:[0,12], - ratio:[0,12], - extent:[0,12], - speckle:5, - targetGrouping:0, - targetIntersection:0, - sortMode:0, - isBinary:0, - calibrationMode:0 + mutations: { + settings: set('settings'), + pipeline: set('pipeline'), + cameraSettings: set('cameraSettings'), + resolutionList: set('resolutionList'), + port: set('port'), + currentCameraIndex: set('currentCameraIndex'), + currentPipelineIndex: set('currentPipelineIndex'), + cameraList: set('cameraList'), + pipelineList: set('pipelineList'), + point: set('point'), + setPipeValues(state, obj) { + for (let i in obj) { + Vue.set(state.pipeline, i, obj[i]); + } + }, + driverState: set('driverState') }, - cameraSettings:{}, - resolutionList:[], - port:1181, - currentCameraIndex:0, - currentPipelineIndex:0, - cameraList:[], - pipelineList:[], - point:{} - }, - mutations: { - settings: set('settings'), - pipeline: set('pipeline'), - cameraSettings: set('cameraSettings'), - resolutionList: set('resolutionList'), - port: set('port'), - currentCameraIndex: set('currentCameraIndex'), - currentPipelineIndex: set('currentPipelineIndex'), - cameraList: set('cameraList'), - pipelineList: set('pipelineList'), - point:set('point'), - setPipeValues(state,obj){ - for(let i in obj){ - Vue.set(state.pipeline,i,obj[i]); - } + actions: { + settings: state => state.settings, + pipeline: state => state.pipeline, + cameraSettings: state => state.cameraSettings, + resolutionList: state => state.resolutionList, + port: state => state.port, + currentCameraIndex: state => state.currentCameraIndex, + currentPipelineIndex: state => state.currentPipelineIndex, + cameraList: state => state.cameraList, + pipelineList: state => state.pipelineList, + point: state => state.point, + driverState: state => state.driverState } - }, - actions: { - settings: state => state.settings, - pipeline: state => state.pipeline, - cameraSettings: state =>state.cameraSettings, - resolutionList: state =>state.resolutionList, - port: state =>state.port, - currentCameraIndex: state =>state.currentCameraIndex, - currentPipelineIndex: state =>state.currentPipelineIndex, - cameraList: state =>state.cameraList, - pipelineList: state =>state.pipelineList, - point: state =>state.point, - } }) diff --git a/chameleon-client/src/views/Camera.vue b/chameleon-client/src/views/Camera.vue index 87d07cb48..04011a568 100644 --- a/chameleon-client/src/views/Camera.vue +++ b/chameleon-client/src/views/Camera.vue @@ -85,7 +85,7 @@
- +
@@ -131,12 +131,6 @@ Can not remove the only pipeline! Close - -
-

Saved All changes

-
- -
@@ -198,7 +192,7 @@ this.pipelineDuplicate = { pipeline: this.currentPipelineIndex, camera: -1 - } + }; this.duplicateDialog = true; }, closeDuplicateDialog() { @@ -214,16 +208,6 @@ } else { this.snackbar = true; } - }, - saveSettings() { - clearInterval(this.timer); - this.saveSnackbar = true; - }, - startTimer() { - if (this.timer !== undefined) { - clearInterval(this.timer); - } - this.timer = setInterval(this.saveSettings, 4000); } }, data() { @@ -243,8 +227,6 @@ camera: -1 }, snackbar: false, - saveSnackbar: false, - timer: undefined } }, diff --git a/chameleon-client/src/views/CameraViewes/ContoursTab.vue b/chameleon-client/src/views/CameraViewes/ContoursTab.vue index c7f9dd183..ede74506f 100644 --- a/chameleon-client/src/views/CameraViewes/ContoursTab.vue +++ b/chameleon-client/src/views/CameraViewes/ContoursTab.vue @@ -31,7 +31,7 @@ }, methods: { handleData(val) { - this.handleInput(val, this.value[val]) + this.handleInput(val, this.value[val]); this.$emit('update') } }, diff --git a/chameleon-client/src/views/CameraViewes/InputTab.vue b/chameleon-client/src/views/CameraViewes/InputTab.vue index 6d602b5a4..4f1681739 100644 --- a/chameleon-client/src/views/CameraViewes/InputTab.vue +++ b/chameleon-client/src/views/CameraViewes/InputTab.vue @@ -20,7 +20,7 @@ }, methods: { handleData(val) { - this.handleInput(val, this.value[val]) + this.handleInput(val, this.value[val]); this.$emit('update') } }, diff --git a/chameleon-client/src/views/CameraViewes/OutputTab.vue b/chameleon-client/src/views/CameraViewes/OutputTab.vue index 629c6e343..d08c4b2e3 100644 --- a/chameleon-client/src/views/CameraViewes/OutputTab.vue +++ b/chameleon-client/src/views/CameraViewes/OutputTab.vue @@ -31,7 +31,7 @@ }, methods: { handleData(val) { - this.handleInput(val, this.value[val]) + this.handleInput(val, this.value[val]); this.$emit('update') }, doUpdate() { diff --git a/chameleon-client/src/views/CameraViewes/ThresholdTab.vue b/chameleon-client/src/views/CameraViewes/ThresholdTab.vue index 848e9b165..4067bb804 100644 --- a/chameleon-client/src/views/CameraViewes/ThresholdTab.vue +++ b/chameleon-client/src/views/CameraViewes/ThresholdTab.vue @@ -27,7 +27,7 @@ import CVswitch from '../../components/cv-switch' }, methods:{ handleData(val){ - this.handleInput(val,this.value[val]) + this.handleInput(val,this.value[val]); this.$emit('update') } } diff --git a/chameleon-client/src/views/Settings.vue b/chameleon-client/src/views/Settings.vue index 763e67c22..7e2503619 100644 --- a/chameleon-client/src/views/Settings.vue +++ b/chameleon-client/src/views/Settings.vue @@ -1,19 +1,20 @@