aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsw/eval-clock-cw-tx/gui.py49
1 files changed, 45 insertions, 4 deletions
diff --git a/sw/eval-clock-cw-tx/gui.py b/sw/eval-clock-cw-tx/gui.py
index 577dd8c..bf7e54e 100755
--- a/sw/eval-clock-cw-tx/gui.py
+++ b/sw/eval-clock-cw-tx/gui.py
@@ -32,12 +32,15 @@ import sys
NUM_MACROS=5
-DEFAULT_MACROS=["CQ WCA de HB9HI HB9HI HB9HI pse K", "REF WCA HB-xxxxx", "12345667890123455678901234567890", "", ""]
+DEFAULT_MACROS=["CQ WCA de HB9HI/P HB9HI/P HB9HI/P pse K", "THIS IS A CASTLE ACTIVATION", "REF WCA HB-00631 LOC JN36GR", "", ""]
+
+DEFAULT_CQ_TIMER = 30
class GUI(Frame):
def __init__(self, root):
super().__init__(root)
self.root = root
+ self.timer_interval = DEFAULT_CQ_TIMER
self.create_widgets()
self.last_tx_freq = None
self.last_serial_message = bytes()
@@ -50,6 +53,7 @@ class GUI(Frame):
self.root.after(1000, self.fetch_gqrx_freq)
self.root.after(1000, self.read_serial)
+ self.root.after(1000, self.handle_timer)
def read_serial(self):
if self.serial is not None:
@@ -61,9 +65,9 @@ class GUI(Frame):
print(f"< {self.last_serial_message.decode().strip()}")
self.set_status(f"Received: {self.last_serial_message.decode().strip()}")
if self.last_serial_message == b"Switch RX\n" and self.enable_mute.get():
- os.system("pactl set-sink-mute 0 0")
+ os.system("pactl set-sink-mute alsa_output.pci-0000_00_1f.3.analog-stereo false")
elif self.last_serial_message == b"Switch TX\n" and self.enable_mute.get():
- os.system("pactl set-sink-mute 0 1")
+ os.system("pactl set-sink-mute alsa_output.pci-0000_00_1f.3.analog-stereo true")
elif self.last_serial_message.startswith(b"FH sent"):
if self.tx_messages:
del self.tx_messages[0]
@@ -111,6 +115,28 @@ class GUI(Frame):
gqrx_sock.close()
+ def handle_timer(self):
+ try:
+ if self.timer_enabled.get():
+ pending = self.timer_pending.get()
+ if pending == 0:
+ msg = self.macro_widgets[0]["var"].get()
+ print(f"TX and Send '{msg}'")
+ self.send_serial('tx\nm {} \n'.format(msg).encode("ascii"))
+ if self.timer_interval > 0:
+ self.timer_pending.set(self.timer_interval)
+ else:
+ self.timer_enabled.set(0) # safety
+ else:
+ self.timer_pending.set(pending - 1)
+ else:
+ self.timer_interval = self.timer_pending.get()
+ except Exception as e:
+ print(f"Exception {e}")
+ self.root.after(1000, self.handle_timer)
+
+
+
def terminate(self):
print("Terminate: send RX")
self.send_serial(b'rx\n')
@@ -213,8 +239,23 @@ class GUI(Frame):
self.gqrx_offset.grid(column=1, row=2, columnspan=1, sticky=(N, S, E, W))
+ self.timer_frame = Frame(self.control_frame, borderwidth=1, relief="ridge")
+ self.timer_frame.grid(column=0, row=2, sticky=(N, S, E, W))
+
+ self.timer_label = Label(self.timer_frame, text="CQ Timer")
+ self.timer_label.grid(column=0, row=1)
+ self.timer_pending = IntVar()
+ self.timer_pending.set(self.timer_interval)
+ self.timer_entry = Entry(self.timer_frame, textvariable=self.timer_pending)
+ self.timer_entry.grid(column=0, row=2, columnspan=1, sticky=(N, S, E, W))
+
+ self.timer_enabled = IntVar()
+ self.timer_enable_checkbox = Checkbutton(self.timer_frame, text="CQ Timer", variable=self.timer_enabled)
+ self.timer_enable_checkbox.grid(column=0, row=3, columnspan=1)
+
+
self.tx_frame = Frame(self.control_frame, borderwidth=1, relief="ridge")
- self.tx_frame.grid(column=0, row=2, sticky=(N, S, E, W))
+ self.tx_frame.grid(column=0, row=3, sticky=(N, S, E, W))
self.tx_button = Button(self.tx_frame, text="Receive!", command=self.toggle_to_rx)
self.tx_button.grid(column=0, row=0, columnspan=2)