Updated API to run with server 1.1.x

This commit is contained in:
Joel Collins 2019-06-05 17:48:41 +01:00
parent 2850eecf7a
commit ee91e11853
2 changed files with 25 additions and 16 deletions

View file

@ -4,21 +4,21 @@
<div> <div>
<label class="uk-form-label" for="form-stacked-text">Exposure time</label> <label class="uk-form-label" for="form-stacked-text">Exposure time</label>
<div class="uk-form-controls"> <div class="uk-form-controls">
<input v-model="shutterSpeed" class="uk-input uk-form-small" type="number"> <input v-model="displayShutterSpeed" class="uk-input uk-form-small" type="number">
</div> </div>
</div> </div>
<div> <div>
<label class="uk-form-label" for="form-stacked-text">Analogue gain</label> <label class="uk-form-label" for="form-stacked-text">Analogue gain</label>
<div class="uk-form-controls"> <div class="uk-form-controls">
<input v-model="analogGain" class="uk-input uk-form-small" type="number"> <input v-model="displayAnalogGain" class="uk-input uk-form-small" type="number" step="0.01">
</div> </div>
</div> </div>
<div> <div>
<label class="uk-form-label" for="form-stacked-text">Digital gain</label> <label class="uk-form-label" for="form-stacked-text">Digital gain</label>
<div class="uk-form-controls"> <div class="uk-form-controls">
<input v-model="digitalGain" class="uk-input uk-form-small" type="number"> <input v-model="displayDigitalGain" class="uk-input uk-form-small" type="number" step="0.01">
</div> </div>
</div> </div>
@ -47,18 +47,18 @@ export default {
data: function () { data: function () {
return { return {
shutterSpeed: this.$store.state.apiConfig.picamera_settings.shutter_speed, shutterSpeed: this.$store.state.apiConfig.camera_settings.picamera_settings.shutter_speed,
analogGain: this.$store.state.apiConfig.picamera_settings.analog_gain || this.$store.state.apiConfig.analog_gain, analogGain: this.$store.state.apiConfig.camera_settings.picamera_settings.analog_gain,
digitalGain: this.$store.state.apiConfig.picamera_settings.digital_gain || this.$store.state.apiConfig.digital_gain, digitalGain: this.$store.state.apiConfig.camera_settings.picamera_settings.digital_gain,
isCalibrating: false isCalibrating: false
} }
}, },
methods: { methods: {
updateInputValues: function () { updateInputValues: function () {
this.shutterSpeed = this.$store.state.apiConfig.picamera_settings.shutter_speed this.shutterSpeed = this.$store.state.apiConfig.camera_settings.picamera_settings.shutter_speed
this.digitalGain = this.$store.state.apiConfig.picamera_settings.digital_gain || this.$store.state.apiConfig.digital_gain this.digitalGain = this.$store.state.apiConfig.camera_settings.picamera_settings.digital_gain
this.analogGain = this.$store.state.apiConfig.picamera_settings.analog_gain || this.$store.state.apiConfig.analog_gain this.analogGain = this.$store.state.apiConfig.camera_settings.picamera_settings.analog_gain
}, },
applyConfigRequest: function() { applyConfigRequest: function() {
@ -66,9 +66,9 @@ export default {
var payload = {picamera_settings:{}} var payload = {picamera_settings:{}}
//if (this.shutterSpeed != this.$store.state.apiConfig.picamera_settings.shutter_speed) { //if (this.shutterSpeed != this.$store.state.apiConfig.picamera_settings.shutter_speed) {
payload.picamera_settings.shutter_speed = this.shutterSpeed payload.camera_settings.picamera_settings.shutter_speed = this.shutterSpeed
payload.analog_gain = this.analogGain payload.camera_settings.picamera_settings.analog_gain = this.analogGain
payload.digital_gain = this.digitalGain payload.camera_settings.picamera_settings.digital_gain = this.digitalGain
//}; //};
// Send request // Send request
@ -119,6 +119,15 @@ export default {
}, },
computed: { computed: {
displayDigitalGain: function () {
return Number(this.digitalGain).toFixed(2)
},
displayAnalogGain: function () {
return Number(this.analogGain).toFixed(2)
},
displayShutterSpeed: function () {
return (this.shutterSpeed != 0) ? this.shutterSpeed : "auto"
},
recalibrateApiUri: function () { recalibrateApiUri: function () {
return this.$store.getters.uri + "/plugin/default/camera_calibration/recalibrate" return this.$store.getters.uri + "/plugin/default/camera_calibration/recalibrate"
}, },

View file

@ -52,14 +52,14 @@ export default {
data: function () { data: function () {
return { return {
microscopeName: this.$store.state.apiConfig.name, microscopeName: this.$store.state.apiConfig.name,
stageBacklash: this.$store.state.apiConfig.backlash stageBacklash: this.$store.state.apiConfig.stage_settings.backlash
} }
}, },
methods: { methods: {
updateInputValues: function () { updateInputValues: function () {
this.microscopeName = this.$store.state.apiConfig.name; this.microscopeName = this.$store.state.apiConfig.name;
this.stageBacklash = this.$store.state.apiConfig.backlash this.stageBacklash = this.$store.state.apiConfig.stage_settings.backlash
}, },
applyConfigRequest: function() { applyConfigRequest: function() {
@ -69,8 +69,8 @@ export default {
payload.name = this.microscopeName payload.name = this.microscopeName
}; };
if (this.stageBacklash != this.$store.state.apiConfig.backlash) { if (this.stageBacklash != this.$store.state.apiConfig.stage_settings.backlash) {
payload.backlash = this.stageBacklash payload.stage_settings.backlash = this.stageBacklash
} }
// Send request to update config // Send request to update config