Example #1
0
    def supported_ranges(self):
        result = []
        # Check if the range is ignored by passing a bogus range in
        try:
            ul.a_out(self._board_num, 0, -5, 0)
            range_ignored = True
        except ULError as e:
            if (e.errorcode == ErrorCode.NETDEVINUSE
                    or e.errorcode == ErrorCode.NETDEVINUSEBYANOTHERPROC):
                raise
            range_ignored = False

        if range_ignored:
            # Try and get the range configured in InstaCal
            try:
                curr_range = ULRange(
                    ul.get_config(InfoType.BOARDINFO, self._board_num, 0,
                                  BoardInfo.DACRANGE))
                result.append(curr_range)
            except ULError as e:
                if (e.errorcode == ErrorCode.NETDEVINUSE
                        or e.errorcode == ErrorCode.NETDEVINUSEBYANOTHERPROC):
                    raise
        else:
            for dac_range in ULRange:
                try:
                    ul.a_out(self._board_num, 0, dac_range, 0)
                    result.append(dac_range)
                except ULError as e:
                    if (e.errorcode == ErrorCode.NETDEVINUSE or e.errorcode
                            == ErrorCode.NETDEVINUSEBYANOTHERPROC):
                        raise

        return result
Example #2
0
 def set_analog_out(self, value: float):
     board_num = self.device.board_num
     ul_range = self.device.ao_range
     convert = lambda value: ul.from_eng_units(
         board_num=board_num, ul_range=ul_range, eng_units_value=value)
     ul.a_out(board_num=board_num,
              ul_range=ul_range,
              channel=self.channel_idx,
              data_value=convert(value))
Example #3
0
    def update_value(self):
        channel = self.get_channel_num()
        ao_range = self.ao_props.available_ranges[0]
        data_value = self.get_data_value()

        raw_value = ul.from_eng_units(self.board_num, ao_range, data_value)

        try:
            ul.a_out(self.board_num, channel, ao_range, raw_value)
        except ULError as e:
            self.show_ul_error(e)
    def update_arena_output(self):
        channel = self.get_channel_num()
        ao_range = self.ao_props.available_ranges[0]
        data_value = self.get_speed()

        if self.tempo is not None:
            ULAIO01.output_value = ul.from_eng_units(self.board_num, ao_range,
                                                     self.tempo)
        else:
            ULAIO01.output_value = ul.from_eng_units(self.board_num, ao_range,
                                                     data_value)
            print(ULAIO01.output_value)

        try:
            ul.a_out(self.board_num, channel, ao_range, ULAIO01.output_value)
        except ULError as e:
            self.show_ul_error(e)