From fa601aab686852407bf2b7a24235146ad1d1c89e Mon Sep 17 00:00:00 2001 From: Kevin Peter Hickerson Date: Tue, 25 Apr 2023 11:52:41 -0700 Subject: [PATCH] Added and commented out some bias on the turret. --- lumascope_api.py | 1 + lumaviewpro.kv | 14 ++++++++++++++ lumaviewpro.py | 27 +++++++++++++++++++++------ 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/lumascope_api.py b/lumascope_api.py index c0611be..0964f2c 100644 --- a/lumascope_api.py +++ b/lumascope_api.py @@ -329,6 +329,7 @@ def tmove(self, degrees): if not self.motion: return # MUST home move objective home first to prevent crash + self.zhome() #self.xyhome() #self.xycenter() diff --git a/lumaviewpro.kv b/lumaviewpro.kv index f7a4b11..e6770af 100644 --- a/lumaviewpro.kv +++ b/lumaviewpro.kv @@ -400,6 +400,13 @@ size_hint_y: None height: '30dp' + Button: + id: turret_left_btn + size_hint_x: None + width: '40dp' + text: '<' + on_release: root.turret_left() + Button: id: turret_home_btn size_hint_x: None @@ -423,6 +430,13 @@ id: turret_pos_4_btn text: '4' on_release: root.turret_select('4') + + Button: + id: turret_right_btn + size_hint_x: None + width: '40dp' + text: '>' + on_release: root.turret_right() ZStack: id: zstack_id diff --git a/lumaviewpro.py b/lumaviewpro.py index d62dd1f..6c1cc38 100644 --- a/lumaviewpro.py +++ b/lumaviewpro.py @@ -1049,7 +1049,18 @@ def Richardson_Lucy(self, image): # plot_deconvolution.html#sphx-glr-download-auto-examples-filters-plot-deconvolution-py pass + def turret_left(self): + lumaview.scope.turret_bias -= 1 + angle = 90*lumaview.scope.turret_id + lumaview.scope.turret_bias + lumaview.scope.tmove(angle) + + def turret_right(self): + lumaview.scope.turret_bias += 1 + angle = 90*lumaview.scope.turret_id + lumaview.scope.turret_bias + lumaview.scope.tmove(angle) + def turret_home(self): + lumaview.scope.turret_bias = 0 lumaview.scope.thome() self.ids['turret_pos_1_btn'].state = 'normal' self.ids['turret_pos_2_btn'].state = 'normal' @@ -1057,32 +1068,36 @@ def turret_home(self): self.ids['turret_pos_4_btn'].state = 'normal' def turret_select(self, position): - #TODO check if turret has been HOMED turret first - + lumaview.scope.turret_id = int(position) - 1 + angle = 90*lumaview.scope.turret_id #+ lumaview.scope.turret_bias + lumaview.scope.tmove(angle) + + #self.ids['turret_pos_1_btn'].state = 'normal' + #self.ids['turret_pos_2_btn'].state = 'normal' + #self.ids['turret_pos_3_btn'].state = 'normal' + #self.ids['turret_pos_4_btn'].state = 'normal' + #self.ids[f'turret_pos_{position}_btn'].state = 'down' + if position == '1': - lumaview.scope.tmove(0) self.ids['turret_pos_1_btn'].state = 'down' self.ids['turret_pos_2_btn'].state = 'normal' self.ids['turret_pos_3_btn'].state = 'normal' self.ids['turret_pos_4_btn'].state = 'normal' elif position == '2': - lumaview.scope.tmove(90) self.ids['turret_pos_1_btn'].state = 'normal' self.ids['turret_pos_2_btn'].state = 'down' self.ids['turret_pos_3_btn'].state = 'normal' self.ids['turret_pos_4_btn'].state = 'normal' elif position == '3': - lumaview.scope.tmove(180) self.ids['turret_pos_1_btn'].state = 'normal' self.ids['turret_pos_2_btn'].state = 'normal' self.ids['turret_pos_3_btn'].state = 'down' self.ids['turret_pos_4_btn'].state = 'normal' elif position == '4': - lumaview.scope.tmove(270) self.ids['turret_pos_1_btn'].state = 'normal' self.ids['turret_pos_2_btn'].state = 'normal' self.ids['turret_pos_3_btn'].state = 'normal'