mirror of
https://github.com/fishyboteso/fishyboteso.git
synced 2024-08-30 18:32:13 +00:00
created look for hole option
This commit is contained in:
parent
814ca1e0d5
commit
f31fa11804
@ -35,7 +35,6 @@ class FullAuto(IEngine):
|
|||||||
from fishy.engine.fullautofisher.test import Test
|
from fishy.engine.fullautofisher.test import Test
|
||||||
|
|
||||||
super().__init__(gui_ref)
|
super().__init__(gui_ref)
|
||||||
self._hole_found_flag = False
|
|
||||||
self._curr_rotate_y = 0
|
self._curr_rotate_y = 0
|
||||||
|
|
||||||
self.fisher = SemiFisherEngine(None)
|
self.fisher = SemiFisherEngine(None)
|
||||||
@ -175,20 +174,22 @@ class FullAuto(IEngine):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def look_for_hole(self) -> bool:
|
def look_for_hole(self) -> bool:
|
||||||
self._hole_found_flag = False
|
|
||||||
|
|
||||||
valid_states = [fishing_mode.State.LOOKING, fishing_mode.State.FISHING]
|
valid_states = [fishing_mode.State.LOOKING, fishing_mode.State.FISHING]
|
||||||
|
_hole_found_flag = FishingMode.CurrentMode in valid_states
|
||||||
|
|
||||||
|
if not config.get("look_for_hole", 1):
|
||||||
|
return _hole_found_flag
|
||||||
|
|
||||||
t = 0
|
t = 0
|
||||||
while not self._hole_found_flag and t <= 2.5:
|
while not _hole_found_flag and t <= 2.5:
|
||||||
direction = -1 if t > 1.25 else 1
|
direction = -1 if t > 1.25 else 1
|
||||||
mse.move(0, FullAuto.rotate_by*direction)
|
mse.move(0, FullAuto.rotate_by*direction)
|
||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
t += 0.05
|
t += 0.05
|
||||||
self._hole_found_flag = FishingMode.CurrentMode in valid_states
|
_hole_found_flag = FishingMode.CurrentMode in valid_states
|
||||||
|
|
||||||
self._curr_rotate_y = t
|
self._curr_rotate_y = t
|
||||||
return self._hole_found_flag
|
return _hole_found_flag
|
||||||
|
|
||||||
def rotate_back(self):
|
def rotate_back(self):
|
||||||
while self._curr_rotate_y > 0.01:
|
while self._curr_rotate_y > 0.01:
|
||||||
|
@ -48,10 +48,12 @@ def start_fullfisher_config(gui: 'GUI'):
|
|||||||
config.set("full_auto_mode", mode_var.get())
|
config.set("full_auto_mode", mode_var.get())
|
||||||
edit_cb['state'] = "normal" if config.get("full_auto_mode", 0) == FullAutoMode.Recorder.value else "disable"
|
edit_cb['state'] = "normal" if config.get("full_auto_mode", 0) == FullAutoMode.Recorder.value else "disable"
|
||||||
|
|
||||||
|
# todo repetitive code fix
|
||||||
file_name_label = tk.StringVar(value=file_name())
|
file_name_label = tk.StringVar(value=file_name())
|
||||||
mode_var = tk.IntVar(value=config.get("full_auto_mode", 0))
|
mode_var = tk.IntVar(value=config.get("full_auto_mode", 0))
|
||||||
edit_var = tk.IntVar(value=config.get("edit_recorder_mode", 0))
|
edit_var = tk.IntVar(value=config.get("edit_recorder_mode", 0))
|
||||||
tabout_var = tk.IntVar(value=config.get("tabout_stop", 1))
|
tabout_var = tk.IntVar(value=config.get("tabout_stop", 1))
|
||||||
|
look_for_hole = tk.IntVar(value=config.get("look_for_hole", 1))
|
||||||
row = 0
|
row = 0
|
||||||
|
|
||||||
ttk.Label(controls_frame, text="Calibration: ").grid(row=row, column=0, pady=(5, 0))
|
ttk.Label(controls_frame, text="Calibration: ").grid(row=row, column=0, pady=(5, 0))
|
||||||
@ -78,6 +80,11 @@ def start_fullfisher_config(gui: 'GUI'):
|
|||||||
|
|
||||||
row += 1
|
row += 1
|
||||||
|
|
||||||
|
ttk.Label(controls_frame, text="Look for hole: ").grid(row=row, column=0)
|
||||||
|
ttk.Checkbutton(controls_frame, variable=look_for_hole, command=lambda: config.set("look_for_hole", look_for_hole.get())).grid(row=row, column=1, pady=(5, 0))
|
||||||
|
|
||||||
|
row += 1
|
||||||
|
|
||||||
ttk.Label(controls_frame, text="Fishy file: ").grid(row=row, column=0, rowspan=2)
|
ttk.Label(controls_frame, text="Fishy file: ").grid(row=row, column=0, rowspan=2)
|
||||||
ttk.Button(controls_frame, text="Select", command=select_file).grid(row=row, column=1, pady=(5, 0))
|
ttk.Button(controls_frame, text="Select", command=select_file).grid(row=row, column=1, pady=(5, 0))
|
||||||
row += 1
|
row += 1
|
||||||
|
Loading…
Reference in New Issue
Block a user