This commit is contained in:
2021-08-23 00:02:56 +02:00
parent 4d1783ad33
commit 4575bea50e
3 changed files with 6 additions and 9 deletions

View File

@ -11,9 +11,9 @@ def dummyPublisher(processImage):
analogInputChangeset = processImage.getChangedAnalogsInputs()
if discreteInputChangeset != []:
print("Discrete: ".format(discreteInputChangeset))
print("Discrete: {}".format(discreteInputChangeset))
if analogInputChangeset != []:
print("Analog: ".format(analogInputChangeset))
print("Analog: {}".format(analogInputChangeset))
# for discreteInputChangeItem in discreteInputChangeset:
# print("Discrete input {} changed from {} to {}"

View File

@ -39,17 +39,14 @@ def modbusHandler(processImage):
client.connect()
reg = client.read_input_registers(0, analogInputBits // 8)
print("M0: ".format(type(reg)))
if isinstance(reg, ModbusIOException):
raise Exception(reg)
analogInputs = reg.registers
print("M1: ".format(reg.registers))
reg = client.read_discrete_inputs(0, digitalInputBits)
if isinstance(reg, ModbusIOException):
raise Exception(reg)
discreteInputs = reg.bits
print("M2: ".format(reg.bits))
coils = None
with processImage:

View File

@ -40,12 +40,12 @@ class ProcessImage(Condition):
def getChangedDiscreteInputs(self):
if not self.initialized:
raise NotInitializedException
print("D1: ".format(self.discreteInputs))
print("D2: ".format(self.shadowDiscreteInputs))
print("D1: {}".format(self.discreteInputs))
print("D2: {}".format(self.shadowDiscreteInputs))
changedDiscreteInputs = zippingFilter(self.discreteInputs, self.shadowDiscreteInputs)
print("D3: ".format(changedDiscreteInputs))
print("D3: {}".format(changedDiscreteInputs))
self.shadowDiscreteInputs = self.discreteInputs
print("D4: ".format(self.shadowDiscreteInputs))
print("D4: {}".format(self.shadowDiscreteInputs))
return changedDiscreteInputs
def getDiscreteInputs(self):