Commit 37f7521f authored by Čermák Petr's avatar Čermák Petr
Browse files

Fix unipi

parent b1f971be
......@@ -90,10 +90,10 @@ class DiscreteOutput(UnipiBase, base.DiscreteOutput):
return ON, 'idle'
def read_value(self):
return self._iodev.ReadInputBit(BITS_DO[self.output])
return self._iodev.ReadInputBit(BITS_DO[self.output-1])
def write_value(self, value):
self._iodev.WriteOutputBit([BITS_DO[self.output], value])
self._iodev.WriteOutputBit([BITS_DO[self.output-1], value])
def On(self):
self.write_value(1)
......@@ -109,7 +109,7 @@ class DiscreteInput(UnipiBase, base.DiscreteInput):
}
def read_value(self):
return self._iodev.ReadInputBit(BITS_DI[self.input])
return self._iodev.ReadInputBit(BITS_DI[self.input-1])
class AnalogOutput(UnipiBase, base.AnalogOutput):
"""Device for setting the Analog output."""
......@@ -121,7 +121,7 @@ class AnalogOutput(UnipiBase, base.AnalogOutput):
def init(self):
UnipiBase.init(self)
# set correct mode
self._iodev.WriteOutputWord(REG_AOCONF, AO_MODES[self.mode])
self._iodev.WriteOutputWord([REG_AOCONF, AO_MODES[self.mode]])
def read_value(self):
return self._iodev.ReadInputFloat(REG_AO)
......@@ -140,7 +140,7 @@ class Sensor(UnipiBase, base.Sensor):
def init(self):
UnipiBase.init(self)
# set correct mode
self._iodev.WriteOutputWord(REG_AICONF, AI_MODES[self.mode])
self._iodev.WriteOutputWord([REG_AICONF, AI_MODES[self.mode]])
def read_value(self):
return self._iodev.ReadInputFloat(REG_AI)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment