fix bugs and change end sign

This commit is contained in:
SelfConfusion 2024-07-12 22:27:12 +08:00
parent 4f85e5b1f2
commit 736a2a2506
1 changed files with 5 additions and 4 deletions

View File

@ -124,10 +124,10 @@ class App(ctk.CTk):
slider.configure(button_color="grey")
slider.configure(state="disabled")
else:
self.gain_values[i] = slider.get()
value.set(f"{self.gain_values_store[i]:.2f}")
slider.set(self.gain_values_store[i])
self.gain_values[i] = slider.get()
slider.configure(button_color="#1f538d")
slider.configure(state="normal")
return None
@ -351,7 +351,8 @@ class App(ctk.CTk):
bytes = list(map(lambda x: ord(x), list(switchSign(i))))
bytes.append(int(self.gain_values[i]))
bytes.append(int(self.gain_values[i] % 1 * 256))
bytes.append(0)
bytes.append(ord('e'))
bytes.append(ord('d'))
print(f"Send:{bytes} \t Hex:0x" + f"{hex(int( self.gain_values[i] * 256 )).replace('0x', '')}".zfill(4))
self.serial.write(bytes)
else:
@ -360,7 +361,7 @@ class App(ctk.CTk):
def setvideo(self, video: int) -> None:
try:
is_open = self.serial.is_open()
is_open = self.serial.is_open
except AttributeError:
messagebox.showError("Please Connect to Serial")
else: