fix more bugs

This commit is contained in:
SelfConfusion 2024-07-13 04:06:35 +08:00
parent c069db02d8
commit 76e2db423b
1 changed files with 16 additions and 9 deletions

View File

@ -17,7 +17,7 @@ class App(ctk.CTk):
__column_weight = [1, 9, 3]
serial_status = False
serial_baudrate = 9600
default_day = [1.10, 0.70, 1.10, 1.20, 0.60]
default_day = [0.59, 0.27, 0.48, 1.56, 0.40]
default_night = [1.30, 0.70, 1.10, 2.20, 0.50]
gain_default = default_day
gain_values = gain_default.copy()
@ -489,9 +489,7 @@ class App(ctk.CTk):
int(
self.gain_values[i]
if self.gain_values[i] > 0
else 255
if self.gain_values[i] < 0 and self.gain_values[i] > -1.0
else (~int(abs(self.gain_values[i])) + 1) % 256
else (~int(abs(self.gain_values[i] * 256)) + 1) / 256 % 256
)
)
bytes.append(
@ -535,9 +533,15 @@ class App(ctk.CTk):
messagebox.showError("Please Connect to Serial")
else:
if is_open:
if video == 0 or video == 1:
if video == 0:
self.gain_default = self.default_day
self.serial.write((switchSign(video) + "ed").encode())
for i in range(4):
if self.gain_checkbox[i].get() == 0:
self.gain_checkbox[i].toggle()
time.sleep(0.001)
self.setISP()
elif video == 1:
self.gain_default = self.default_night
@ -546,6 +550,9 @@ class App(ctk.CTk):
if self.gain_checkbox[i].get() == 0:
self.gain_checkbox[i].toggle()
time.sleep(0.001)
if self.gain_checkbox[3].get() == 1:
self.gain_checkbox[i].toggle()
time.sleep(0.001)
self.setISP()
elif video >= 2 and video <= 3:
self.serial.write((switchSign(video) + "ed").encode())