@@ -16,7 +16,54 @@ def read_output_voltage(self):
1616
1717 def read_output_current (self ):
1818 self .t .write_line ('IOUT1?' )
19- return self .t .read_until_reol (1024 )
19+ return self .t .read_until_reol (1024 )
20+
21+ def read_status (self ):
22+ """
23+ Query and parse the binary STATUS response.
24+
25+ Returns a dictionary like:
26+ {
27+ "ch1Mode": "C.V" | "C.C",
28+ "ch2Mode": "C.V" | "C.C",
29+ "Tracking": "Independent" | "Tracking Series" | "Tracking Parallel" | "Unknown",
30+ "BeepEnabled": bool,
31+ "lockEnabled": bool,
32+ "outEnabled": bool,
33+ }
34+ """
35+ # Send command without terminator (TENMA manifests typically use empty EOLs)
36+ self .t .write_line ('STATUS?' )
37+ # Read raw bytes and parse first status byte
38+ data = self .t .read (8 ) or b''
39+ if not data :
40+ return {}
41+ status = data [0 ]
42+
43+ ch1mode = (status & 0x01 ) != 0
44+ ch2mode = (status & 0x02 ) != 0
45+ tracking_bits = (status & 0x0C ) >> 2
46+ beep = (status & 0x10 ) != 0
47+ lock = (status & 0x20 ) != 0
48+ out = (status & 0x40 ) != 0
49+
50+ if tracking_bits == 0 :
51+ tracking = "Independent"
52+ elif tracking_bits == 1 :
53+ tracking = "Tracking Series"
54+ elif tracking_bits == 3 :
55+ tracking = "Tracking Parallel"
56+ else :
57+ tracking = "Unknown"
58+
59+ return {
60+ "ch1Mode" : "C.V" if ch1mode else "C.C" ,
61+ "ch2Mode" : "C.V" if ch2mode else "C.C" ,
62+ "Tracking" : tracking ,
63+ "BeepEnabled" : beep ,
64+ "lockEnabled" : lock ,
65+ "outEnabled" : out ,
66+ }
2067
2168 def write (self , text : str ):
2269 self .t .write_line (text )
0 commit comments