# HG changeset patch # User Daniel O'Connor # Date 1611038875 -37800 # Node ID 98b9258c75b658f51b93a5e413ae8568cca5eff0 # Parent bf411c7f5e7871cb37ce4964b659dd36714de849 Add chkcmd helper to execute command check STB to see if it failed. diff -r bf411c7f5e78 -r 98b9258c75b6 usb488.py --- a/usb488.py Tue Jan 19 17:13:21 2021 +1030 +++ b/usb488.py Tue Jan 19 17:17:55 2021 +1030 @@ -338,9 +338,17 @@ return result def ask(self, s, timeout = None): + '''Wrapper to send a command and wait for a reply''' self.write(s) return self.read(timeout = timeout) + def chkcmd(self, cmd): + '''Wrapper to send a command and check for an error''' + self.write(cmd) + if int(self.ask('*STB?')) & STATUS_EVE_QUEUE != 0: + self.write('*CLS') + raise BaseException('Command failed') + def isConnected(self): """Check if the device is present"""