Fixes ipp reading from Micro800 using class instances
This commit is contained in:
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import pickle
|
|
||||||
from device_base import deviceBase
|
from device_base import deviceBase
|
||||||
import micro800 as u800
|
import micro800 as u800
|
||||||
|
|
||||||
addr = '10.20.4.5'
|
addr = '10.20.4.5'
|
||||||
channels = {}
|
channels = {}
|
||||||
|
|
||||||
|
|
||||||
class Channel():
|
class Channel():
|
||||||
def read(self):
|
def read(self):
|
||||||
valData = u800.readMicroTag(self.device_addr, self.tag)
|
valData = u800.readMicroTag(self.device_addr, self.tag)
|
||||||
@@ -54,13 +54,11 @@ class Channel():
|
|||||||
self.e300_param = e300_param
|
self.e300_param = e300_param
|
||||||
self.read()
|
self.read()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def write(self, val, handshake=None, handshake_val=None):
|
def write(self, val, handshake=None, handshake_val=None):
|
||||||
if self.writeable:
|
if self.writeable:
|
||||||
h = handshake
|
h = handshake
|
||||||
hval = handshake_val
|
hval = handshake_val
|
||||||
if h == None:
|
if h is None:
|
||||||
if u800.writeMicroTag(self.device_addr, self.tag, val, handshake=self.tag, handshake_val=val):
|
if u800.writeMicroTag(self.device_addr, self.tag, val, handshake=self.tag, handshake_val=val):
|
||||||
self.sendFn(self.name, val, time.time())
|
self.sendFn(self.name, val, time.time())
|
||||||
self.last_value = val
|
self.last_value = val
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ import sys
|
|||||||
|
|
||||||
|
|
||||||
def readMicroTag(addr, tag):
|
def readMicroTag(addr, tag):
|
||||||
|
addr = str(addr)
|
||||||
|
tag = str(tag)
|
||||||
c = u800Driver()
|
c = u800Driver()
|
||||||
|
|
||||||
if c.open(addr, True):
|
if c.open(addr, True):
|
||||||
try:
|
try:
|
||||||
v = c.read_tag(tag)
|
v = c.read_tag(tag)
|
||||||
# print(v)
|
# print(v)
|
||||||
return v
|
return v
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
err = c.get_status()
|
err = c.get_status()
|
||||||
c.close()
|
c.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user