diff --git a/_repo/moduleb-circuit-on.svg b/_repo/moduleb-circuit-on.svg index 7b6e15f..bc3747d 100644 --- a/_repo/moduleb-circuit-on.svg +++ b/_repo/moduleb-circuit-on.svg @@ -60,9 +60,9 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="0.70000001" - inkscape:cx="92.359784" - inkscape:cy="169.14069" + inkscape:zoom="0.98994951" + inkscape:cx="360.31029" + inkscape:cy="169.35425" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" @@ -89,133 +89,129 @@ inkscape:groupmode="layer" id="layer1" transform="translate(0,-652.36218)"> + SRG8 + + + + + + + - SRG8 + id="g3670" + transform="matrix(1.2800233,0,0,1.2800241,-120.69619,-135.2493)" + style="stroke:#0000ff"> - - - - - - - - - - - + id="path9406" + style="fill:none;stroke:#0000ff;stroke-width:1.61322706mm;stroke-linecap:butt;stroke-opacity:1" + d="m 142.20507,801.35389 -22.82716,0" + inkscape:connector-curvature="0" /> + + diff --git a/software/modules/ModuleA.py b/software/modules/ModuleA.py index 09ac117..8c6c599 100644 --- a/software/modules/ModuleA.py +++ b/software/modules/ModuleA.py @@ -25,7 +25,7 @@ class ModuleAWidget(QWidget): class ModuleA(): def __init__(self): - self.title = 'Simple dynamo' + self.title = 'Sources of Electricity' self.widget = ModuleAWidget() def start(self): diff --git a/software/modules/ModuleB-on.png b/software/modules/ModuleB-on.png index 0978106..953994b 100644 Binary files a/software/modules/ModuleB-on.png and b/software/modules/ModuleB-on.png differ diff --git a/software/modules/ModuleB.py b/software/modules/ModuleB.py index d56fc67..e34ed8e 100644 --- a/software/modules/ModuleB.py +++ b/software/modules/ModuleB.py @@ -1,4 +1,6 @@ from PyQt4.QtGui import QWidget +from PyQt4.QtGui import QGraphicsScene +from PyQt4.QtGui import QPixmap from PyQt4.QtCore import pyqtSlot from PyQt4.QtCore import SIGNAL from PyQt4.QtCore import QObject @@ -16,12 +18,29 @@ class ModuleBWidget(QWidget): self.timer = QTimer() QObject.connect(self.timer, SIGNAL("timeout()"), self.read_inputs) + self.scene_nobat = QGraphicsScene() + self.scene_nobat.addPixmap(QPixmap('modules/ModuleB-nobat.png')) + self.scene_off = QGraphicsScene() + self.scene_off.addPixmap(QPixmap('modules/ModuleB-off.png')) + self.scene_on = QGraphicsScene() + self.scene_on.addPixmap(QPixmap('modules/ModuleB-on.png')) + self.ui.widgetImg.setScene(self.scene_nobat) + def read_inputs(self): - pass -# r = self.dev.read() -# v = r[0]/1023.0 * 3.3 -# self.ui.labelV.setText('{:0.3f} V'.format(v)) -# self.ui.progressV.setValue(1000*v) + r = self.dev.read() + us = r[1]/1023.0 * 3.3 + uc = r[2]/1023.0 * 3.3 + i = (us-uc)*10 + self.ui.labelUs.setText('Us = %0.3f V' % us) + self.ui.labelUc.setText('Uc = %0.3f V' % uc) + self.ui.labelI.setText('I = %0.2f mA' % i) + if us < 1.5: + self.ui.widgetImg.setScene(self.scene_nobat) + else: + if uc < 1.5: + self.ui.widgetImg.setScene(self.scene_off) + else: + self.ui.widgetImg.setScene(self.scene_on) class ModuleB(): diff --git a/software/modules/ModuleB.ui b/software/modules/ModuleB.ui index dafe69e..9bd9fcd 100644 --- a/software/modules/ModuleB.ui +++ b/software/modules/ModuleB.ui @@ -13,16 +13,64 @@ Form - + 10 10 761 - 511 + 471 + + + + 10 + 490 + 251 + 21 + + + + Us = 0.000 V + + + Qt::AlignCenter + + + + + + 260 + 490 + 261 + 21 + + + + Uc = 0.000 V + + + Qt::AlignCenter + + + + + + 520 + 490 + 251 + 21 + + + + I = 0.000 mA + + + Qt::AlignCenter + + diff --git a/software/resources.qrc b/software/resources.qrc index 0d9d433..183c54b 100644 --- a/software/resources.qrc +++ b/software/resources.qrc @@ -6,6 +6,9 @@ icon.png modules/ModuleA.png modules/ModuleB.png + modules/ModuleB-nobat.png + modules/ModuleB-off.png + modules/ModuleB-on.png modules/ModuleC.png modules/ModuleDebug.png