From 76e2db423b3ee8c5f498ac3b0efacab5a0b43038 Mon Sep 17 00:00:00 2001 From: SelfConfusion <1822250894@qq.com> Date: Sat, 13 Jul 2024 04:06:35 +0800 Subject: [PATCH] fix more bugs --- src/main.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/main.py b/src/main.py index ca6f52d..42289d5 100644 --- a/src/main.py +++ b/src/main.py @@ -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,11 +533,8 @@ 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 - elif video == 1: - self.gain_default = self.default_night + if video == 0: + self.gain_default = self.default_day self.serial.write((switchSign(video) + "ed").encode()) for i in range(4): @@ -547,6 +542,18 @@ class App(ctk.CTk): self.gain_checkbox[i].toggle() time.sleep(0.001) self.setISP() + elif video == 1: + self.gain_default = self.default_night + + 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) + 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()) else: