mirror of
https://github.com/brmlab/edubrm.git
synced 2025-06-08 12:53:59 +02:00
more fixes
This commit is contained in:
parent
1413db58fd
commit
19bd37a530
7 changed files with 285 additions and 58 deletions
205
_repo/moduleb-circuit-nobulb.svg
Normal file
205
_repo/moduleb-circuit-nobulb.svg
Normal file
|
@ -0,0 +1,205 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="600"
|
||||||
|
height="400"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.48.1 r9760"
|
||||||
|
sodipodi:docname="moduleb-circuit-nobulb.svg"
|
||||||
|
inkscape:export-filename="/home/stick/work/scm/brmlab/edubrm/_repo/moduleb-circuit-on.png"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-ydpi="90">
|
||||||
|
<defs
|
||||||
|
id="defs4">
|
||||||
|
<linearGradient
|
||||||
|
id="linearGradient3834">
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ffff00;stop-opacity:1;"
|
||||||
|
offset="0"
|
||||||
|
id="stop3836" />
|
||||||
|
<stop
|
||||||
|
style="stop-color:#ffff00;stop-opacity:0;"
|
||||||
|
offset="1"
|
||||||
|
id="stop3838" />
|
||||||
|
</linearGradient>
|
||||||
|
<radialGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient3834"
|
||||||
|
id="radialGradient3842"
|
||||||
|
cx="531.84534"
|
||||||
|
cy="216.78358"
|
||||||
|
fx="531.84534"
|
||||||
|
fy="216.78358"
|
||||||
|
r="27.526657"
|
||||||
|
gradientUnits="userSpaceOnUse" />
|
||||||
|
<radialGradient
|
||||||
|
inkscape:collect="always"
|
||||||
|
xlink:href="#linearGradient3834"
|
||||||
|
id="radialGradient3844"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
cx="531.84534"
|
||||||
|
cy="216.78358"
|
||||||
|
fx="531.84534"
|
||||||
|
fy="216.78358"
|
||||||
|
r="27.526657" />
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="0.98994951"
|
||||||
|
inkscape:cx="427.04704"
|
||||||
|
inkscape:cy="140.78282"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
width="600px"
|
||||||
|
inkscape:window-width="1024"
|
||||||
|
inkscape:window-height="707"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="26"
|
||||||
|
inkscape:window-maximized="1" />
|
||||||
|
<metadata
|
||||||
|
id="metadata7">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(0,-652.36218)">
|
||||||
|
<flowRoot
|
||||||
|
xml:space="preserve"
|
||||||
|
id="flowRoot1894"
|
||||||
|
transform="matrix(0.71631544,0,0,0.71631544,-138.46838,598.22977)"
|
||||||
|
style="stroke:#0000ff"><flowRegion
|
||||||
|
id="flowRegion1896"><rect
|
||||||
|
id="rect1898"
|
||||||
|
width="50.507626"
|
||||||
|
height="29.294424"
|
||||||
|
x="181.82745"
|
||||||
|
y="94.737572"
|
||||||
|
style="stroke:#0000ff" /></flowRegion><flowPara
|
||||||
|
id="flowPara1900"
|
||||||
|
style="font-size:20px;stroke:#0000ff">SRG8</flowPara></flowRoot> <path
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:none;stroke:#0000ff;stroke-width:3.64284134;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:3.94970989;stroke-opacity:1;stroke-dasharray:none"
|
||||||
|
d="m 96.915379,756.46939 50.142091,0 73.86796,-7.07823"
|
||||||
|
id="path2246"
|
||||||
|
sodipodi:nodetypes="ccc" />
|
||||||
|
<path
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:none;stroke:#0000ff;stroke-width:3.64284134;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:3.94970989;stroke-opacity:1;stroke-dasharray:none"
|
||||||
|
d="m 96.915379,756.46939 -50.142081,0 0,66.08799"
|
||||||
|
id="path2250"
|
||||||
|
sodipodi:nodetypes="ccc" />
|
||||||
|
<path
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:none;stroke:#0000ff;stroke-width:3.64284134;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:3.94970989;stroke-opacity:1;stroke-dasharray:none"
|
||||||
|
d="m 46.773298,903.76659 0,81.92375 444.115572,0 0,-77.52047"
|
||||||
|
id="path2254"
|
||||||
|
sodipodi:nodetypes="cccc" />
|
||||||
|
<path
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:none;stroke:#0000ff;stroke-width:3.64284134;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:3.94970989;stroke-opacity:1;stroke-dasharray:none"
|
||||||
|
d="m 218.75996,756.46939 272.12891,0 0,70.99442"
|
||||||
|
id="path2256"
|
||||||
|
sodipodi:nodetypes="ccc" />
|
||||||
|
<g
|
||||||
|
id="g3670"
|
||||||
|
transform="matrix(1.2800233,0,0,1.2800241,-120.69619,-135.2493)"
|
||||||
|
style="stroke:#0000ff">
|
||||||
|
<path
|
||||||
|
id="path9387"
|
||||||
|
style="fill:none;stroke:#0000ff;stroke-width:0.80661353mm;stroke-linecap:butt;stroke-opacity:1;stroke-dasharray:4.8396813, 2.82314743;stroke-dashoffset:0"
|
||||||
|
d="m 130.83182,765.8629 0,29.28007"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
id="path9389"
|
||||||
|
style="fill:none;stroke:#0000ff;stroke-width:0.80661353mm;stroke-linecap:square;stroke-opacity:1"
|
||||||
|
d="m 130.83182,748.44004 0,11.45392"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
id="path9391"
|
||||||
|
style="fill:none;stroke:#0000ff;stroke-width:1.61322706mm;stroke-linecap:butt;stroke-opacity:1"
|
||||||
|
d="m 142.20507,767.07282 -22.82716,0"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
id="path9393"
|
||||||
|
style="fill:none;stroke:#0000ff;stroke-width:0.80661353mm;stroke-linecap:butt;stroke-opacity:1"
|
||||||
|
d="m 147.93203,759.89396 -34.28108,0"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
id="path9395"
|
||||||
|
style="fill:none;stroke:#0000ff;stroke-width:0.40330676mm;stroke-linecap:butt;stroke-opacity:1"
|
||||||
|
d="m 138.65597,753.1184 9.27606,0 m -4.5977,-4.67836 0,9.35672"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
id="path9404"
|
||||||
|
style="fill:none;stroke:#0000ff;stroke-width:0.80661353mm;stroke-linecap:square;stroke-opacity:1"
|
||||||
|
d="m 130.83182,802.8058 0,11.37325"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
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" />
|
||||||
|
<path
|
||||||
|
id="path9408"
|
||||||
|
style="fill:none;stroke:#0000ff;stroke-width:0.80661353mm;stroke-linecap:butt;stroke-opacity:1"
|
||||||
|
d="m 147.93203,794.17503 -34.28108,0"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
</g>
|
||||||
|
<path
|
||||||
|
sodipodi:type="arc"
|
||||||
|
style="fill:#0000ff;fill-opacity:1;stroke:#0000ff;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||||
|
id="path3761"
|
||||||
|
sodipodi:cx="237.13332"
|
||||||
|
sodipodi:cy="95.691544"
|
||||||
|
sodipodi:rx="4.9244938"
|
||||||
|
sodipodi:ry="4.9244938"
|
||||||
|
d="m 242.05781,95.691544 c 0,2.719722 -2.20477,4.924496 -4.92449,4.924496 -2.71973,0 -4.9245,-2.204774 -4.9245,-4.924496 0,-2.719723 2.20477,-4.924494 4.9245,-4.924494 2.71972,0 4.92449,2.204771 4.92449,4.924494 z"
|
||||||
|
transform="matrix(0.92,0,0,0.92,1.8360381,668.36218)" />
|
||||||
|
<path
|
||||||
|
transform="matrix(0.92,0,0,0.92,272.80202,741.45728)"
|
||||||
|
d="m 242.05781,95.691544 a 4.9244938,4.9244938 0 1 1 -9.84899,0 4.9244938,4.9244938 0 1 1 9.84899,0 z"
|
||||||
|
sodipodi:ry="4.9244938"
|
||||||
|
sodipodi:rx="4.9244938"
|
||||||
|
sodipodi:cy="95.691544"
|
||||||
|
sodipodi:cx="237.13332"
|
||||||
|
id="path3009"
|
||||||
|
style="fill:#0000ff;fill-opacity:1;stroke:#0000ff;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||||
|
sodipodi:type="arc" />
|
||||||
|
<path
|
||||||
|
sodipodi:type="arc"
|
||||||
|
style="fill:#0000ff;fill-opacity:1;stroke:#0000ff;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||||
|
id="path3011"
|
||||||
|
sodipodi:cx="237.13332"
|
||||||
|
sodipodi:cy="95.691544"
|
||||||
|
sodipodi:rx="4.9244938"
|
||||||
|
sodipodi:ry="4.9244938"
|
||||||
|
d="m 242.05781,95.691544 a 4.9244938,4.9244938 0 1 1 -9.84899,0 4.9244938,4.9244938 0 1 1 9.84899,0 z"
|
||||||
|
transform="matrix(0.92,0,0,0.92,272.48513,816.20157)" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 8.1 KiB |
|
@ -160,21 +160,29 @@ void ADCInit( uint32_t ADC_Clk )
|
||||||
to design team. */
|
to design team. */
|
||||||
LPC_IOCON->PIO0_11 &= ~0x8F; /* ADC I/O config */
|
LPC_IOCON->PIO0_11 &= ~0x8F; /* ADC I/O config */
|
||||||
LPC_IOCON->PIO0_11 |= 0x02; /* ADC IN0 */
|
LPC_IOCON->PIO0_11 |= 0x02; /* ADC IN0 */
|
||||||
|
LPC_IOCON->PIO0_11 |= 1<<3; /* ADC IN0 -- pulldown */
|
||||||
#if 1
|
#if 1
|
||||||
LPC_IOCON->PIO1_0 &= ~0x8F;
|
LPC_IOCON->PIO1_0 &= ~0x8F;
|
||||||
LPC_IOCON->PIO1_0 |= 0x02; /* ADC IN1 */
|
LPC_IOCON->PIO1_0 |= 0x02; /* ADC IN1 */
|
||||||
|
LPC_IOCON->PIO1_0 |= 1<<3; /* ADC IN1 -- pulldown */
|
||||||
LPC_IOCON->PIO1_1 &= ~0x8F;
|
LPC_IOCON->PIO1_1 &= ~0x8F;
|
||||||
LPC_IOCON->PIO1_1 |= 0x02; /* ADC IN2 */
|
LPC_IOCON->PIO1_1 |= 0x02; /* ADC IN2 */
|
||||||
|
LPC_IOCON->PIO1_1 |= 1<<3; /* ADC IN2 -- pulldown */
|
||||||
LPC_IOCON->PIO1_2 &= ~0x8F;
|
LPC_IOCON->PIO1_2 &= ~0x8F;
|
||||||
LPC_IOCON->PIO1_2 |= 0x02; /* ADC IN3 */
|
LPC_IOCON->PIO1_2 |= 0x02; /* ADC IN3 */
|
||||||
|
LPC_IOCON->PIO1_2 |= 1<<3; /* ADC IN3 -- pulldown */
|
||||||
LPC_IOCON->PIO1_3 &= ~0x8F;
|
LPC_IOCON->PIO1_3 &= ~0x8F;
|
||||||
LPC_IOCON->PIO1_3 |= 0x02; /* ADC IN4 */
|
LPC_IOCON->PIO1_3 |= 0x02; /* ADC IN4 */
|
||||||
|
LPC_IOCON->PIO1_3 |= 1<<3; /* ADC IN4 -- pulldown */
|
||||||
LPC_IOCON->PIO1_4 &= ~0x8F; /* Clear bit7, change to analog mode. */
|
LPC_IOCON->PIO1_4 &= ~0x8F; /* Clear bit7, change to analog mode. */
|
||||||
LPC_IOCON->PIO1_4 |= 0x01; /* ADC IN5 */
|
LPC_IOCON->PIO1_4 |= 0x01; /* ADC IN5 */
|
||||||
|
LPC_IOCON->PIO1_4 |= 1<<3; /* ADC IN5 -- pulldown */
|
||||||
LPC_IOCON->PIO1_10 &= ~0x8F; /* Clear bit7, change to analog mode. */
|
LPC_IOCON->PIO1_10 &= ~0x8F; /* Clear bit7, change to analog mode. */
|
||||||
LPC_IOCON->PIO1_10 |= 0x01; /* ADC IN6 */
|
LPC_IOCON->PIO1_10 |= 0x01; /* ADC IN6 */
|
||||||
|
LPC_IOCON->PIO1_10 |= 1<<3; /* ADC IN6 -- pulldown */
|
||||||
LPC_IOCON->PIO1_11 &= ~0x8F; /* Clear bit7, change to analog mode. */
|
LPC_IOCON->PIO1_11 &= ~0x8F; /* Clear bit7, change to analog mode. */
|
||||||
LPC_IOCON->PIO1_11 |= 0x01; /* ADC IN7 */
|
LPC_IOCON->PIO1_11 |= 0x01; /* ADC IN7 */
|
||||||
|
LPC_IOCON->PIO1_11 |= 1<<3; /* ADC IN7 -- pulldown */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LPC_ADC->CR = ( 0x01 << 0 ) | /* SEL=1,select channel 0~7 on ADC0 */
|
LPC_ADC->CR = ( 0x01 << 0 ) | /* SEL=1,select channel 0~7 on ADC0 */
|
||||||
|
|
|
@ -24,10 +24,8 @@ class ModuleAWidget(QWidget):
|
||||||
|
|
||||||
def read_inputs(self):
|
def read_inputs(self):
|
||||||
r = self.dev.read()
|
r = self.dev.read()
|
||||||
u = r[1]/1023.0 * 3.3 - 0.19
|
u = r[1]/1023.0 * 3.3
|
||||||
if u < 0:
|
self.dev.pwm(1, int(u*65536.0/3.3))
|
||||||
u = 0
|
|
||||||
self.dev.pwm(1, int(u*65536/3))
|
|
||||||
self.ui.labelU.setText('%0.3f V' % u)
|
self.ui.labelU.setText('%0.3f V' % u)
|
||||||
self.ui.progressU.setValue(1000*u)
|
self.ui.progressU.setValue(1000*u)
|
||||||
self.data.pop(0)
|
self.data.pop(0)
|
||||||
|
@ -53,7 +51,7 @@ class ModuleAWidget(QWidget):
|
||||||
self.scene.addSimpleText('1.0').moveBy(-40, 300-10)
|
self.scene.addSimpleText('1.0').moveBy(-40, 300-10)
|
||||||
self.scene.addSimpleText('0.5').moveBy(-40, 350-10)
|
self.scene.addSimpleText('0.5').moveBy(-40, 350-10)
|
||||||
self.scene.addSimpleText('0.0').moveBy(-40, 400-10)
|
self.scene.addSimpleText('0.0').moveBy(-40, 400-10)
|
||||||
self.scene.addSimpleText('[U]').moveBy(-39, 430-10)
|
self.scene.addSimpleText('[U/V]').moveBy(-39, 430-10)
|
||||||
path = QPainterPath()
|
path = QPainterPath()
|
||||||
path.moveTo(0,400-self.data[0]*100)
|
path.moveTo(0,400-self.data[0]*100)
|
||||||
for i in xrange(1,200):
|
for i in xrange(1,200):
|
||||||
|
@ -70,6 +68,7 @@ class ModuleA():
|
||||||
def start(self):
|
def start(self):
|
||||||
self.widget.dev = Device()
|
self.widget.dev = Device()
|
||||||
self.widget.timer.start(40)
|
self.widget.timer.start(40)
|
||||||
|
self.widget.data = 200*[0.0]
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self.widget.timer.stop()
|
self.widget.timer.stop()
|
||||||
|
|
BIN
software/modules/ModuleB-nobulb.png
Normal file
BIN
software/modules/ModuleB-nobulb.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
|
@ -24,16 +24,14 @@ class ModuleBWidget(QWidget):
|
||||||
self.scene_off.addPixmap(QPixmap('modules/ModuleB-off.png'))
|
self.scene_off.addPixmap(QPixmap('modules/ModuleB-off.png'))
|
||||||
self.scene_on = QGraphicsScene()
|
self.scene_on = QGraphicsScene()
|
||||||
self.scene_on.addPixmap(QPixmap('modules/ModuleB-on.png'))
|
self.scene_on.addPixmap(QPixmap('modules/ModuleB-on.png'))
|
||||||
|
self.scene_nobulb = QGraphicsScene()
|
||||||
|
self.scene_nobulb.addPixmap(QPixmap('modules/ModuleB-nobulb.png'))
|
||||||
self.ui.widgetImg.setScene(self.scene_nobat)
|
self.ui.widgetImg.setScene(self.scene_nobat)
|
||||||
|
|
||||||
def read_inputs(self):
|
def read_inputs(self):
|
||||||
r = self.dev.read()
|
r = self.dev.read()
|
||||||
us = r[1]/1023.0 * 3.3 - 0.095
|
us = r[1]/1023.0 * 3.3
|
||||||
if us < 0.0:
|
uc = r[2]/1023.0 * 3.3
|
||||||
us = 0.0
|
|
||||||
uc = r[2]/1023.0 * 3.3 - 0.04
|
|
||||||
if uc < 0.0:
|
|
||||||
uc = 0.0
|
|
||||||
i = (us-uc)/18*1000
|
i = (us-uc)/18*1000
|
||||||
if i < 0.0 or uc == 0.0:
|
if i < 0.0 or uc == 0.0:
|
||||||
i = 0.0
|
i = 0.0
|
||||||
|
@ -43,8 +41,10 @@ class ModuleBWidget(QWidget):
|
||||||
if us < 1.5:
|
if us < 1.5:
|
||||||
self.ui.widgetImg.setScene(self.scene_nobat)
|
self.ui.widgetImg.setScene(self.scene_nobat)
|
||||||
else:
|
else:
|
||||||
if uc < 1:
|
if uc < 0.9:
|
||||||
self.ui.widgetImg.setScene(self.scene_off)
|
self.ui.widgetImg.setScene(self.scene_off)
|
||||||
|
elif uc > 2.0:
|
||||||
|
self.ui.widgetImg.setScene(self.scene_nobulb)
|
||||||
else:
|
else:
|
||||||
self.ui.widgetImg.setScene(self.scene_on)
|
self.ui.widgetImg.setScene(self.scene_on)
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,11 @@ class ModuleCWidget(QWidget):
|
||||||
self.timer = QTimer()
|
self.timer = QTimer()
|
||||||
QObject.connect(self.timer, SIGNAL("timeout()"), self.read_inputs)
|
QObject.connect(self.timer, SIGNAL("timeout()"), self.read_inputs)
|
||||||
|
|
||||||
self.data1 = 200*[0.0]
|
self.datau = 200*[0.0]
|
||||||
self.data2 = 200*[0.0]
|
self.datai = 200*[0.0]
|
||||||
|
self.current = 0
|
||||||
|
|
||||||
self.mode = ['DC', 'L']
|
self.mode = ['DC', 'C']
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def on_radioAC_clicked(self):
|
def on_radioAC_clicked(self):
|
||||||
|
@ -54,6 +55,7 @@ class ModuleCWidget(QWidget):
|
||||||
def on_btnStart_clicked(self):
|
def on_btnStart_clicked(self):
|
||||||
self.ui.btnStart.setEnabled(False)
|
self.ui.btnStart.setEnabled(False)
|
||||||
self.ui.btnStop.setEnabled(True)
|
self.ui.btnStop.setEnabled(True)
|
||||||
|
self.current = 3.3
|
||||||
if self.mode == ['DC', 'L']:
|
if self.mode == ['DC', 'L']:
|
||||||
self.dev.setout(1, 1)
|
self.dev.setout(1, 1)
|
||||||
if self.mode == ['DC', 'C']:
|
if self.mode == ['DC', 'C']:
|
||||||
|
@ -65,6 +67,7 @@ class ModuleCWidget(QWidget):
|
||||||
def on_btnStop_clicked(self):
|
def on_btnStop_clicked(self):
|
||||||
self.ui.btnStart.setEnabled(True)
|
self.ui.btnStart.setEnabled(True)
|
||||||
self.ui.btnStop.setEnabled(False)
|
self.ui.btnStop.setEnabled(False)
|
||||||
|
self.current = 0.0
|
||||||
if self.mode == ['DC', 'L']:
|
if self.mode == ['DC', 'L']:
|
||||||
self.dev.setout(1, 0)
|
self.dev.setout(1, 0)
|
||||||
if self.mode == ['DC', 'C']:
|
if self.mode == ['DC', 'C']:
|
||||||
|
@ -73,45 +76,55 @@ class ModuleCWidget(QWidget):
|
||||||
self.dev.setout(3, 0)
|
self.dev.setout(3, 0)
|
||||||
|
|
||||||
def setup_hw(self):
|
def setup_hw(self):
|
||||||
if self.mode == ['DC', 'L']:
|
if self.mode == ['DC', 'L']: # AD6
|
||||||
self.dev.switches(1<<0)
|
self.dev.switches(1<<5)
|
||||||
if self.mode == ['DC', 'C']:
|
self.dev.opamp(2, 5, 0)
|
||||||
self.dev.switches(1<<1)
|
if self.mode == ['DC', 'C']: # AD5
|
||||||
if self.mode == ['DC', 'LC']:
|
self.dev.switches(1<<4)
|
||||||
|
self.dev.opamp(2, 4, 0)
|
||||||
|
if self.mode == ['DC', 'LC']: # AD3
|
||||||
self.dev.switches(1<<2)
|
self.dev.switches(1<<2)
|
||||||
|
self.dev.opamp(2, 2, 0)
|
||||||
|
|
||||||
def setup_scene(self, scene):
|
def setup_scene(self, scene):
|
||||||
scene.addLine(-5, 200-0, 610, 200-0)
|
scene.addLine(-5, 100-0, 605, 100-0)
|
||||||
scene.addLine(0, 200+5, 0, 200-205)
|
scene.addLine(0, 200+5, 0, 200-205)
|
||||||
scene.addLine(-5, 200- 50, 10, 200- 50)
|
scene.addLine(-5, 200- 0, 5, 200- 0)
|
||||||
scene.addLine(-5, 200-100, 10, 200-100)
|
scene.addLine(-5, 200- 50, 5, 200- 50)
|
||||||
scene.addLine(-5, 200-150, 10, 200-150)
|
scene.addLine(-5, 200-100, 5, 200-100)
|
||||||
scene.addSimpleText('4.0').moveBy(-40, 0-10)
|
scene.addLine(-5, 200-150, 5, 200-150)
|
||||||
scene.addSimpleText('3.0').moveBy(-40, 50-10)
|
scene.addLine(-5, 200-200, 5, 200-200)
|
||||||
scene.addSimpleText('2.0').moveBy(-40, 100-10)
|
|
||||||
scene.addSimpleText('1.0').moveBy(-40, 150-10)
|
|
||||||
scene.addSimpleText('0.0').moveBy(-40, 200-10)
|
|
||||||
|
|
||||||
def tick_DC(self, u, i):
|
def tick_DC(self, u, i):
|
||||||
self.data1.pop(0)
|
self.datau.pop(0)
|
||||||
self.data2.pop(0)
|
self.datai.pop(0)
|
||||||
self.data1.append(u)
|
self.datau.append(u)
|
||||||
self.data2.append(i)
|
self.datai.append(i)
|
||||||
self.scene1 = QGraphicsScene()
|
self.scene1 = QGraphicsScene()
|
||||||
self.scene2 = QGraphicsScene()
|
self.scene2 = QGraphicsScene()
|
||||||
self.setup_scene(self.scene1)
|
self.setup_scene(self.scene1)
|
||||||
self.setup_scene(self.scene2)
|
self.setup_scene(self.scene2)
|
||||||
self.scene1.addSimpleText('[U]').moveBy(-39, 220-10)
|
self.scene1.addSimpleText('[U/V]').moveBy(-39, 220-10)
|
||||||
self.scene2.addSimpleText('[I]').moveBy(-39, 220-10)
|
self.scene2.addSimpleText('[I/mA]').moveBy(-39, 220-10)
|
||||||
|
self.scene1.addSimpleText('+4.0').moveBy(-40, 0-10)
|
||||||
|
self.scene1.addSimpleText('+2.0').moveBy(-40, 50-10)
|
||||||
|
self.scene1.addSimpleText(' 0.0').moveBy(-40, 100-10)
|
||||||
|
self.scene1.addSimpleText('-2.0').moveBy(-40, 150-10)
|
||||||
|
self.scene1.addSimpleText('-4.0').moveBy(-40, 200-10)
|
||||||
|
self.scene2.addSimpleText('+0.4').moveBy(-40, 0-10)
|
||||||
|
self.scene2.addSimpleText('+0.2').moveBy(-40, 50-10)
|
||||||
|
self.scene2.addSimpleText(' 0.0').moveBy(-40, 100-10)
|
||||||
|
self.scene2.addSimpleText('-0.2').moveBy(-40, 150-10)
|
||||||
|
self.scene2.addSimpleText('-0.4').moveBy(-40, 200-10)
|
||||||
path = QPainterPath()
|
path = QPainterPath()
|
||||||
path.moveTo(0,200-self.data1[0]*50)
|
path.moveTo(0,100-self.datau[0]*25)
|
||||||
for i in xrange(1,200):
|
for i in xrange(1,200):
|
||||||
path.lineTo(3*(i+1), 200-self.data1[i]*50)
|
path.lineTo(3*(i+1), 100-self.datau[i]*25)
|
||||||
self.scene1.addPath(path, QPen(QColor(0,0,255), 3))
|
self.scene1.addPath(path, QPen(QColor(0,0,255), 3))
|
||||||
path = QPainterPath()
|
path = QPainterPath()
|
||||||
path.moveTo(0,200-self.data2[0]*50)
|
path.moveTo(0,100-self.datai[0]*25)
|
||||||
for i in xrange(1,200):
|
for i in xrange(1,200):
|
||||||
path.lineTo(3*(i+1), 200-self.data2[i]*50)
|
path.lineTo(3*(i+1), 100-self.datai[i]*25)
|
||||||
self.scene2.addPath(path, QPen(QColor(0,0,255), 3))
|
self.scene2.addPath(path, QPen(QColor(0,0,255), 3))
|
||||||
self.ui.graph1.setScene(self.scene1)
|
self.ui.graph1.setScene(self.scene1)
|
||||||
self.ui.graph2.setScene(self.scene2)
|
self.ui.graph2.setScene(self.scene2)
|
||||||
|
@ -121,7 +134,7 @@ class ModuleCWidget(QWidget):
|
||||||
|
|
||||||
if self.mode[0] == 'DC':
|
if self.mode[0] == 'DC':
|
||||||
u = r[0]/1023.0 * 3.3 # TODO: change this if we change opamp
|
u = r[0]/1023.0 * 3.3 # TODO: change this if we change opamp
|
||||||
i = 1 # TODO: read real current
|
i = self.current - r[0]/1023.0 * 3.3
|
||||||
self.tick_DC(u, i)
|
self.tick_DC(u, i)
|
||||||
|
|
||||||
class ModuleC():
|
class ModuleC():
|
||||||
|
@ -134,6 +147,8 @@ class ModuleC():
|
||||||
self.widget.dev = Device()
|
self.widget.dev = Device()
|
||||||
self.widget.setup_hw()
|
self.widget.setup_hw()
|
||||||
self.widget.timer.start(25)
|
self.widget.timer.start(25)
|
||||||
|
self.widget.datau = 200*[0.0]
|
||||||
|
self.widget.datai = 200*[0.0]
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self.widget.timer.stop()
|
self.widget.timer.stop()
|
||||||
|
|
|
@ -87,7 +87,7 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Mode</string>
|
<string>Mode</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QRadioButton" name="radioL">
|
<widget class="QRadioButton" name="radioC">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
|
@ -96,27 +96,11 @@
|
||||||
<height>26</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
|
||||||
<string>L</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QRadioButton" name="radioC">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>60</y>
|
|
||||||
<width>51</width>
|
|
||||||
<height>26</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>C</string>
|
<string>C</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QRadioButton" name="radioLC">
|
<widget class="QRadioButton" name="radioLC">
|
||||||
|
@ -135,6 +119,22 @@
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QRadioButton" name="radioL">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>60</y>
|
||||||
|
<width>51</width>
|
||||||
|
<height>26</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>L</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="btnStart">
|
<widget class="QPushButton" name="btnStart">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue