|
|
@ -1,3 +1,4 @@ |
|
|
|
|
|
|
|
#!/usr/bin/env python |
|
|
|
import time |
|
|
|
import time |
|
|
|
|
|
|
|
|
|
|
|
from PyQt4 import QtCore, QtGui |
|
|
|
from PyQt4 import QtCore, QtGui |
|
|
@ -11,7 +12,9 @@ class MyMainScreen(QMainWindow): |
|
|
|
QtGui.QMainWindow.__init__(self, parent) |
|
|
|
QtGui.QMainWindow.__init__(self, parent) |
|
|
|
self.resize(800, 600) |
|
|
|
self.resize(800, 600) |
|
|
|
|
|
|
|
|
|
|
|
self.CAPLEN = 1000 |
|
|
|
self.LINEWIDTH = 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.CAPLEN = 1400 |
|
|
|
self.CAPRATE = 115000 # must be > 80 for nyquist |
|
|
|
self.CAPRATE = 115000 # must be > 80 for nyquist |
|
|
|
|
|
|
|
|
|
|
|
self.samples_trig = None |
|
|
|
self.samples_trig = None |
|
|
@ -122,7 +125,7 @@ class MyMainScreen(QMainWindow): |
|
|
|
|
|
|
|
|
|
|
|
# Rx |
|
|
|
# Rx |
|
|
|
mult = 0.17*H/500 |
|
|
|
mult = 0.17*H/500 |
|
|
|
painter.setPen(QtGui.QPen(QtGui.QColor(color_rx), 2)) |
|
|
|
painter.setPen(QtGui.QPen(QtGui.QColor(color_rx), self.LINEWIDTH)) |
|
|
|
n = 0 |
|
|
|
n = 0 |
|
|
|
for i in range(0, W, step): |
|
|
|
for i in range(0, W, step): |
|
|
|
if n == len(self.samples_echo) - 1: |
|
|
|
if n == len(self.samples_echo) - 1: |
|
|
@ -135,7 +138,7 @@ class MyMainScreen(QMainWindow): |
|
|
|
|
|
|
|
|
|
|
|
# Tx |
|
|
|
# Tx |
|
|
|
mult = 0.12*H/500 |
|
|
|
mult = 0.12*H/500 |
|
|
|
painter.setPen(QtGui.QPen(QtGui.QColor(color_tx), 2)) |
|
|
|
painter.setPen(QtGui.QPen(QtGui.QColor(color_tx), self.LINEWIDTH)) |
|
|
|
n = 0 |
|
|
|
n = 0 |
|
|
|
for i in range(0, W, step): |
|
|
|
for i in range(0, W, step): |
|
|
|
if n == len(self.samples_trig)-1: |
|
|
|
if n == len(self.samples_trig)-1: |
|
|
@ -158,11 +161,11 @@ class MyMainScreen(QMainWindow): |
|
|
|
painter.drawText(W-170, 85, "Přijímač") |
|
|
|
painter.drawText(W-170, 85, "Přijímač") |
|
|
|
|
|
|
|
|
|
|
|
painter.setPen(QtGui.QPen(QtGui.QColor(0xFFFFFF), 2)) |
|
|
|
painter.setPen(QtGui.QPen(QtGui.QColor(0xFFFFFF), 2)) |
|
|
|
painter.drawText(round(W/2)-200, 50, "Ultrazvukový dálkoměr HC-SR04") |
|
|
|
painter.drawText(round(W/2)-220, 50, "Ultrazvukový dálkoměr HC-SR04") |
|
|
|
|
|
|
|
|
|
|
|
with gex.Client(gex.TrxSerialThread()) as client: |
|
|
|
with gex.Client(gex.TrxSerialThread()) as client: |
|
|
|
app = QApplication(sys.argv) |
|
|
|
app = QApplication(sys.argv) |
|
|
|
mainscreen = MyMainScreen(client) |
|
|
|
mainscreen = MyMainScreen(client) |
|
|
|
#mainscreen.showFullScreen() |
|
|
|
mainscreen.showFullScreen() |
|
|
|
mainscreen.show() |
|
|
|
#mainscreen.show() |
|
|
|
app.exec_() |
|
|
|
app.exec_() |
|
|
|