diff --git a/software/device.py b/software/device.py
index e6a84d3..8ec2859 100644
--- a/software/device.py
+++ b/software/device.py
@@ -83,7 +83,7 @@ class Device:
return (randint(0,65535), # AD0
randint(0,65535), randint(0,65535), randint(0,65535), # AD1 .. AD3
randint(0,65535), randint(0,65535), randint(0,65535), # AD4 .. AD6
- randint(0,7)) # IO1 .. IO3
+ randint(0,1), randint(0,1), randint(0,1)) # IO1 .. IO3
else:
i = self.epi.read(self.INSIZE)
return (i[0] + i[1]<<8, # AD0
diff --git a/software/modules/ModuleDebug.py b/software/modules/ModuleDebug.py
index 58bdf29..d260483 100644
--- a/software/modules/ModuleDebug.py
+++ b/software/modules/ModuleDebug.py
@@ -2,6 +2,7 @@ from PyQt4.QtGui import QWidget
from PyQt4.QtCore import pyqtSlot
from PyQt4.QtCore import SIGNAL
from PyQt4.QtCore import QObject
+from PyQt4.QtCore import QTimer
from ModuleDebugUi import Ui_ModuleDebug
from device import Device
@@ -25,7 +26,13 @@ class ModuleDebugWidget(QWidget):
QObject.connect(self.ui.pushPin2, SIGNAL("clicked(bool)"), self.on_pins_changed)
QObject.connect(self.ui.pushPin3, SIGNAL("clicked(bool)"), self.on_pins_changed)
- self.dev = Device(True)
+ # real device:
+ self.dev = Device()
+ # fake device:
+ # self.dev = Device(True)
+
+ self.timer = QTimer()
+ QObject.connect(self.timer, SIGNAL("timeout()"), self.read_inputs)
@pyqtSlot(int)
def on_dialPWM1_valueChanged(self, val):
@@ -109,7 +116,34 @@ class ModuleDebugWidget(QWidget):
@pyqtSlot(int)
def on_dialInputFreq_valueChanged(self, val):
- print self.dev.read()
+ self.timer.stop()
+ if val > 0:
+ self.timer.start(1000.0/val)
+ else:
+ self.ui.labelAD0.setText('AD0: -')
+ self.ui.labelAD1.setText('AD1: -')
+ self.ui.labelAD2.setText('AD2: -')
+ self.ui.labelAD3.setText('AD3: -')
+ self.ui.labelAD4.setText('AD4: -')
+ self.ui.labelAD5.setText('AD5: -')
+ self.ui.labelAD6.setText('AD6: -')
+ self.ui.labelIO1.setText('IO1: -')
+ self.ui.labelIO2.setText('IO2: -')
+ self.ui.labelIO3.setText('IO3: -')
+
+
+ def read_inputs(self):
+ r = self.dev.read()
+ self.ui.labelAD0.setText('AD0: ' + str(r[0]))
+ self.ui.labelAD1.setText('AD1: ' + str(r[1]))
+ self.ui.labelAD2.setText('AD2: ' + str(r[2]))
+ self.ui.labelAD3.setText('AD3: ' + str(r[3]))
+ self.ui.labelAD4.setText('AD4: ' + str(r[4]))
+ self.ui.labelAD5.setText('AD5: ' + str(r[5]))
+ self.ui.labelAD6.setText('AD6: ' + str(r[6]))
+ self.ui.labelIO1.setText('IO1: ' + str(r[7]))
+ self.ui.labelIO2.setText('IO2: ' + str(r[8]))
+ self.ui.labelIO3.setText('IO3: ' + str(r[9]))
class ModuleDebug():
diff --git a/software/modules/ModuleDebug.ui b/software/modules/ModuleDebug.ui
index 1da9560..f3c7dbb 100644
--- a/software/modules/ModuleDebug.ui
+++ b/software/modules/ModuleDebug.ui
@@ -662,10 +662,10 @@
- 1
+ 0
- 999
+ 1000
10
@@ -687,13 +687,13 @@
1
- 1
+ 0
- 999
+ 1000
- 1
+ 0
3
@@ -709,7 +709,7 @@
- AD1: 0
+ AD1: -
@@ -722,7 +722,7 @@
- AD2: 0
+ AD2: -
@@ -735,7 +735,7 @@
- AD3: 0
+ AD3: -
@@ -748,7 +748,7 @@
- AD4: 0
+ AD4: -
@@ -761,7 +761,7 @@
- AD5: 0
+ AD5: -
@@ -774,7 +774,7 @@
- AD6: 0
+ AD6: -
@@ -787,7 +787,7 @@
- IO2: 0
+ IO2: -
@@ -800,7 +800,7 @@
- IO3: 0
+ IO3: -
@@ -813,7 +813,7 @@
- IO1: 0
+ IO1: -
@@ -826,7 +826,7 @@
- AD0: 0
+ AD0: -