diff --git a/control_seekat_demo.py b/control_seekat_demo.py
index 7af6cd3..0c180c2 100644
--- a/control_seekat_demo.py
+++ b/control_seekat_demo.py
@@ -23,14 +23,25 @@ class SerComm:
def error_popup(self, x):
error_popup(self.getobj("win"), x)
+ def append(self, s):
+ o = self.getobj("debug_buf")
+ o.insert_markup(o.get_end_iter(), s, -1)
+ self.getobj("debug_win").scroll_to_mark(
+ o.get_insert(), 0.1, False, 0, 1)
+
def get_or_to(self):
s = self.ser.read_until().decode()
if not s:
raise Exception(f"DAC timeout: '{s}'")
s = s.rstrip("\r\n")
- self.getobj("dac_resp").set_text(s)
+ self.append(f'{s}\n')
return s
+ def send(self, s):
+ b = bytes(s, "UTF-8")
+ self.ser.write(b + b"\r")
+ self.append(f'{s}\n')
+
def make_dac_conn(self, f):
for x in CHANGE_BUTTONS:
self.getobj(x).set_sensitive(False)
@@ -51,8 +62,10 @@ class SerComm:
if s == None:
self.getobj("dac_idn").set_label("(disconnected)")
+ self.append('Disconnecting\n')
return None
+ self.append(f'Connecting to "{s}"\n')
self.ser.port = s
self.ser.open()
@@ -66,7 +79,7 @@ class SerComm:
raise Exception(f"Unknown message from DAC: '{s}'")
self.getobj(f"Ch{int(loc.group(0)) + 1}").set_label('ERR')
- self.ser.write(b"*IDN?\r\n")
+ self.send("*IDN?")
self.getobj("dac_idn").set_label(self.get_or_to())
def on_connect(self, _):
@@ -79,7 +92,7 @@ class SerComm:
ch = int(self.getobj("SET_ch").get_active_id()) - 1
vol = float(self.getobj("SET_v").get_text())
- self.ser.write(bytes(f"SET,{ch},{vol}\r", "UTF-8"))
+ self.send(f"SET,{ch},{vol}")
s = self.get_or_to()
if not s.startswith("DAC"):
diff --git a/gui.glade b/gui.glade
index 3b1215c..39a930a 100644
--- a/gui.glade
+++ b/gui.glade
@@ -2,6 +2,10 @@
+