fix more bugs
This commit is contained in:
parent
c069db02d8
commit
76e2db423b
25
src/main.py
25
src/main.py
|
@ -17,7 +17,7 @@ class App(ctk.CTk):
|
||||||
__column_weight = [1, 9, 3]
|
__column_weight = [1, 9, 3]
|
||||||
serial_status = False
|
serial_status = False
|
||||||
serial_baudrate = 9600
|
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]
|
default_night = [1.30, 0.70, 1.10, 2.20, 0.50]
|
||||||
gain_default = default_day
|
gain_default = default_day
|
||||||
gain_values = gain_default.copy()
|
gain_values = gain_default.copy()
|
||||||
|
@ -489,9 +489,7 @@ class App(ctk.CTk):
|
||||||
int(
|
int(
|
||||||
self.gain_values[i]
|
self.gain_values[i]
|
||||||
if self.gain_values[i] > 0
|
if self.gain_values[i] > 0
|
||||||
else 255
|
else (~int(abs(self.gain_values[i] * 256)) + 1) / 256 % 256
|
||||||
if self.gain_values[i] < 0 and self.gain_values[i] > -1.0
|
|
||||||
else (~int(abs(self.gain_values[i])) + 1) % 256
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
bytes.append(
|
bytes.append(
|
||||||
|
@ -535,11 +533,8 @@ class App(ctk.CTk):
|
||||||
messagebox.showError("Please Connect to Serial")
|
messagebox.showError("Please Connect to Serial")
|
||||||
else:
|
else:
|
||||||
if is_open:
|
if is_open:
|
||||||
if video == 0 or video == 1:
|
if video == 0:
|
||||||
if video == 0:
|
self.gain_default = self.default_day
|
||||||
self.gain_default = self.default_day
|
|
||||||
elif video == 1:
|
|
||||||
self.gain_default = self.default_night
|
|
||||||
|
|
||||||
self.serial.write((switchSign(video) + "ed").encode())
|
self.serial.write((switchSign(video) + "ed").encode())
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
|
@ -547,6 +542,18 @@ class App(ctk.CTk):
|
||||||
self.gain_checkbox[i].toggle()
|
self.gain_checkbox[i].toggle()
|
||||||
time.sleep(0.001)
|
time.sleep(0.001)
|
||||||
self.setISP()
|
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:
|
elif video >= 2 and video <= 3:
|
||||||
self.serial.write((switchSign(video) + "ed").encode())
|
self.serial.write((switchSign(video) + "ed").encode())
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue