Esempio n. 1
0
    def acquire_cb(self, state):
        #print("acq callback")
        #print(state)
        if (self.action_acq.get_active()):
            # This is commented because it seems that comedi_cancel()
            # clears stale data in the fd and card?
            #data = os.read(self.fd, BUF_SIZE)
            #print("LEN DATA: %d" % len(data))

            # Start comedi command
            ret = c.comedi_command(self.dev, self.cmd)
            if (ret != 0):
                self.warn_dialog("PCI-6033E cannot collect data! Error: %d" % ret)
                print(c.comedi_strerror(c.comedi_errno()))
                return(False)



            #self.timer_id = GObject.timeout_add(100, self.my_timer)
            # Make these timeouts configurable...
            self.plotter_id = GObject.timeout_add(250, self.update_plots)
            self.plot_id = GObject.timeout_add(500, self.num_data_timer)
            self.timer_id = GObject.timeout_add(20, self.pci_6033e_get_data)
            #self.plot_timer.start()
            self.action_acq.set_label("Halt")
        else:
            self.action_acq.set_label("Acquire")
            if (self.timer_id):
                if (c.comedi_cancel(self.dev, SUBDEVICE) < 0):
                    print("failed to cancel comedi command...")
                GObject.source_remove(self.timer_id)
            if (self.plot_id):
                GObject.source_remove(self.plot_id)
            if (self.plotter_id):
                GObject.source_remove(self.plotter_id)
            #self.plot_timer.stop()
            # Empty stale data
            self.data_buf = ""
Esempio n. 2
0
def comedi_errcheck():
    errc = c.comedi_errno()
    raise Exception("NICOMEDI: %s" % c.comedi_strerror(errc))
Esempio n. 3
0
def _raise_comedi_error(fname, rc):
    errno = _comedi.comedi_errno()
    raise ComediError("%s() returned %r" % (fname, rc), errno,
                      _comedi.comedi_strerror(errno))
Esempio n. 4
0
def _raise_comedi_error(fname, rc):
    errno = _comedi.comedi_errno()
    raise ComediError("%s() returned %r" % (fname, rc),
                      errno, _comedi.comedi_strerror(errno))
Esempio n. 5
0
def comedi_errcheck():
    errc = c.comedi_errno()
    raise Exception("NICOMEDI: %s" % c.comedi_strerror(errc))