Merge branch 'tidied_autofocus_method' into 'master'
Streamlined autofocus code See merge request openflexure/openflexure-microscope-jsclient!4
This commit is contained in:
commit
a5b08ab34c
1 changed files with 9 additions and 15 deletions
|
|
@ -218,28 +218,22 @@ export default {
|
||||||
if (!this.$store.state.moveLock) {
|
if (!this.$store.state.moveLock) {
|
||||||
// Lock move requests
|
// Lock move requests
|
||||||
this.$store.commit('changeMoveLock', true);
|
this.$store.commit('changeMoveLock', true);
|
||||||
|
this.isAutofocusing = true
|
||||||
axios.post(this.autofocusApiUri, {dz: dz})
|
axios.post(this.autofocusApiUri, {dz: dz})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
console.log("Autofocus Task ID: " + response.data[0].id)
|
console.log("Autofocus Task ID: " + response.data[0].id)
|
||||||
this.isAutofocusing = true
|
|
||||||
// Start the store polling TaskId for success
|
// Start the store polling TaskId for success
|
||||||
self = this;
|
return this.$store.dispatch('pollTask', [response.data[0].id, null, null])
|
||||||
this.$store.dispatch('pollTask', [response.data[0].id, null, null])
|
|
||||||
.then(function() {
|
|
||||||
UIkit.notification({message: "Finished recalibration.", status: 'success'})
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
UIkit.notification({message: `<span uk-icon=\'icon: warning\'></span> ${error}`, status: 'danger'})
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
self.isAutofocusing = false
|
|
||||||
this.$store.commit('changeMoveLock', false) // Release the move lock
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
.then(() => { console.log("Successfully finished autofocus"); })
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
UIkit.notification({message: `<span uk-icon=\'icon: warning\'></span> ${error}`, status: 'danger'})
|
||||||
this.$store.dispatch('handleHTTPError', error); // Let store handle error
|
this.$store.dispatch('handleHTTPError', error); // Let store handle error
|
||||||
self.isAutofocusing = false
|
})
|
||||||
this.$store.commit('changeMoveLock', false) // Release the move lock
|
.finally(() => {
|
||||||
|
console.log("Cleaning up after autofocus.")
|
||||||
|
this.isAutofocusing = false;
|
||||||
|
this.$store.commit('changeMoveLock', false); // Release the move lock
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue