Example #1
0
 def set(self, debounce=None):
     if not (debounce is None):
         if not debounce:
             self._debounce = 0
         else:
             self._debounce = float(debounce) / 1000.0  #milisecs
         devents.config(self)
Example #2
0
 def set(self, debounce=None):
     if not (debounce is None):
         if not debounce:
             self._debounce = 0
         else:
             self._debounce = float(debounce) / 1000.0  #milisecs
         devents.config(self)
Example #3
0
    def set(self,
            scan_interval=None,
            do_scan=False,
            interval=None,
            circuit=None,
            do_reset=None):
        chg = False

        if do_reset is not None:
            self.taskWr.send((OWCMD_RESET_MASTER, 0, 0))
        if not (interval is None):
            if interval != self.interval:
                self.taskWr.send((OWCMD_INTERVAL,
                                  0 if circuit is None else circuit, interval))
                if circuit is None: self.interval = interval
                chg = True
        if not (scan_interval is None):
            if scan_interval != self.scan_interval:
                self.taskWr.send((OWCMD_SCAN_INTERVAL, 0, scan_interval))
                self.scan_interval = scan_interval
                chg = True
        if do_scan:
            logger.debug("Invoked scan of 1W bus")
            self.taskWr.send((OWCMD_SCAN, 0, 0))

        if chg:
            devents.config(self)

        return (self.full())
Example #4
0
 def set(self, bits=None, gain=None, interval=None):
     if not (bits is None): self.bits = int(bits)
     if not (gain is None):
         self.gain = int(gain)
         self.koef = self.correction / self.gain
     if not (interval is None): self.interval = float(interval)
     self.mcp.register_channel(self)
     devents.config(self)
     return 0
Example #5
0
 def set(self, bits=None, gain=None, interval=None):
     if not (bits is None): self.bits = int(bits)
     if not (gain is None):
         self.gain = int(gain)
         self.koef = self.correction / self.gain
     if not (interval is None): self.interval = float(interval)
     self.mcp.register_channel(self)
     devents.config(self)
     return 0
Example #6
0
 def register_device(self, devtype, device):
     """ can be called with devtype = INTEGER or NAME
     """
     if type(devtype) is int:
         devdict = self._arr[devtype]
     else:
         devdict = self[devtype]
     devdict[str(device.circuit)] = device
     devents.config(device)
Example #7
0
 def register_device(self, devtype, device):
     """ can be called with devtype = INTEGER or NAME
     """
     if type(devtype) is int:
         devdict = self._arr[devtype]
     else:
         devdict = self[devtype]
     devdict[str(device.circuit)] = device
     devents.config(device)
Example #8
0
 def register_device(self, devtype, device):
     """ can be called with devtype = INTEGER or NAME
     """
     if devtype is None:
         raise Exception('Devicetype must contain INTEGER OR NAME')
     if type(devtype) is int:
         devdict = self._arr[devtype]
     else:
         devdict = self[devtype]
     devdict[str(device.circuit)] = device
     devents.config(device)
Example #9
0
 def set(self, debounce=None, counter=None):
     if not (debounce is None):
         if not debounce:
             self._debounce = 0
         else:
             self._debounce = float(debounce) / 1000.0  #milisecs
         devents.config(self)
     if not (counter is None):
         if self.counter_mode != 'disabled':
             self.value = counter
             devents.status(self)
Example #10
0
 def register_device(self, devtype, device):
     """ can be called with devtype = INTEGER or NAME
     """
     if devtype is None:
         raise Exception('Devicetype must contain INTEGER OR NAME')
     if type(devtype) is int:
         devdict = self._arr[devtype]
     else:
         devdict = self[devtype]
     devdict[str(device.circuit)] = device
     devents.config(device)
Example #11
0
    def set(self, value=None, frequency=None):
        result = None
        if not (frequency is None) and (frequency != self.frequency):
            print int(frequency)
            result = pigpio._u2i((yield self.bus.apigpio_command(pigpio._PI_CMD_PFS, self.pin, int(frequency))))
            self.frequency = frequency
            if not (value is None):
                result = yield self.set_value(float(value))
            else:
                result = yield self.set_value(self.value)
            devents.config(self)
            raise gen.Return(result)

        if not (value is None) and (value != self.value):
            result = yield self.set_value(float(value))
        raise gen.Return(result)
Example #12
0
	def set(self, value=None, frequency=None):
		result = None
		if not (frequency is None) and (frequency != self.frequency):
			# print int(frequency)
			result = pigpio._u2i((yield self.bus.apigpio_command(pigpio._PI_CMD_PFS, self.pin, int(frequency))))
			self.frequency = frequency
			if not (value is None):
				result = yield self.set_value(float(value))
			else:
				result = yield self.set_value(self.value)
			devents.config(self)
			raise gen.Return(result)

		if not (value is None) and (value != self.value):
			result = yield self.set_value(float(value))
		raise gen.Return(result)
Example #13
0
    def set(self, scan_interval=None, do_scan=False, interval=None):
        chg = False
        if not (interval is None):
            if interval != self.interval:
                self.taskWr.send((OWCMD_DEFAULT_INTERVAL, 0, interval))
                self.interval = interval
                chg = True
        if not (scan_interval is None):
            if scan_interval != self.scan_interval:
                self.taskWr.send((OWCMD_SCAN_INTERVAL, 0, scan_interval))
                self.scan_interval = scan_interval
                chg = True
        if do_scan:
            self.taskWr.send((OWCMD_SCAN, 0, 0))

        if chg:
            devents.config(self)
Example #14
0
    def set(self, scan_interval=None, do_scan=False, interval=None):
        chg = False
        if not (interval is None):
            if interval != self.interval:
                self.taskWr.send((OWCMD_DEFAULT_INTERVAL, 0, interval))
                self.interval = interval
                chg = True
        if not (scan_interval is None):
            if scan_interval != self.scan_interval:
                self.taskWr.send((OWCMD_SCAN_INTERVAL, 0, scan_interval))
                self.scan_interval = scan_interval
                chg = True
        if do_scan:
            self.taskWr.send((OWCMD_SCAN, 0, 0))

        if chg:
            devents.config(self)
Example #15
0
 def set(self, interval=None):
     if not (interval is None):
         self.__bus.taskWr.send((OWCMD_INTERVAL, self.circuit, interval))
         self.interval = interval
         devents.config(self)
Example #16
0
 def set(self, interval=None):
     if not (interval is None):
         self.__bus.taskWr.send((OWCMD_INTERVAL, self.circuit, interval))
         self.interval = interval
         devents.config(self)