no commit message

pull/1/head
慕炎 2022-12-14 19:51:43 +08:00
parent 93d2791723
commit 2242643b84
66 changed files with 1602 additions and 0 deletions

View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.9 (python-3.9.4-embed-amd64-wEqWS3AS)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">
<option name="renderExternalDocumentation" value="true" />
</component>
</module>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (python-3.9.4-embed-amd64-wEqWS3AS)" project-jdk-type="Python SDK" />
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/gui.iml" filepath="$PROJECT_DIR$/.idea/gui.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PySciProjectComponent">
<option name="PY_SCI_VIEW" value="true" />
<option name="PY_SCI_VIEW_SUGGESTED" value="true" />
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,187 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="3e5c5a0f-021a-4404-8abd-a5f5b6fa3c1c" name="Changes" comment="Changes">
<change beforePath="$PROJECT_DIR$/build/main/Analysis-00.toc" beforeDir="false" afterPath="$PROJECT_DIR$/build/main/Analysis-00.toc" afterDir="false" />
<change beforePath="$PROJECT_DIR$/build/main/COLLECT-00.toc" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/build/main/EXE-00.toc" beforeDir="false" afterPath="$PROJECT_DIR$/build/main/EXE-00.toc" afterDir="false" />
<change beforePath="$PROJECT_DIR$/build/main/PKG-00.toc" beforeDir="false" afterPath="$PROJECT_DIR$/build/main/PKG-00.toc" afterDir="false" />
<change beforePath="$PROJECT_DIR$/build/main/PYZ-00.pyz" beforeDir="false" afterPath="$PROJECT_DIR$/build/main/PYZ-00.pyz" afterDir="false" />
<change beforePath="$PROJECT_DIR$/build/main/PYZ-00.toc" beforeDir="false" afterPath="$PROJECT_DIR$/build/main/PYZ-00.toc" afterDir="false" />
<change beforePath="$PROJECT_DIR$/build/main/Tree-00.toc" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/build/main/Tree-01.toc" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/build/main/Tree-02.toc" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/build/main/base_library.zip" beforeDir="false" afterPath="$PROJECT_DIR$/build/main/base_library.zip" afterDir="false" />
<change beforePath="$PROJECT_DIR$/build/main/main.exe" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/build/main/main.pkg" beforeDir="false" afterPath="$PROJECT_DIR$/build/main/main.pkg" afterDir="false" />
<change beforePath="$PROJECT_DIR$/build/main/warn-main.txt" beforeDir="false" afterPath="$PROJECT_DIR$/build/main/warn-main.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/build/main/xref-main.html" beforeDir="false" afterPath="$PROJECT_DIR$/build/main/xref-main.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/dist/main.exe" beforeDir="false" afterPath="$PROJECT_DIR$/dist/main.exe" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main_ui.py" beforeDir="false" afterPath="$PROJECT_DIR$/main_ui.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main_ui.ui" beforeDir="false" afterPath="$PROJECT_DIR$/main_ui.ui" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="GitSEFilterConfiguration">
<file-type-list>
<filtered-out-file-type name="LOCAL_BRANCH" />
<filtered-out-file-type name="REMOTE_BRANCH" />
<filtered-out-file-type name="TAG" />
<filtered-out-file-type name="COMMIT_BY_MESSAGE" />
</file-type-list>
</component>
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProjectId" id="2GGUMftZTHUUr9Qr31TvxqWlSSU" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
<option name="showMembers" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$USER_HOME$/AppData/Local/Programs/Python/Python39/Scripts/pyuic6.exe" />
<property name="node.js.detected.package.eslint" value="true" />
<property name="node.js.selected.package.eslint" value="(autodetect)" />
<property name="run.code.analysis.last.selected.profile" value="aDefault" />
<property name="settings.editor.selected.configurable" value="preferences.externalTools" />
</component>
<component name="RunManager">
<configuration default="true" type="PythonConfigurationType" factoryName="Python">
<module name="gui" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="true" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<configuration name="main" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="gui" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/main.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Python.main" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="SvnConfiguration">
<configuration>C:\Users\Administrator\AppData\Roaming\Subversion</configuration>
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="3e5c5a0f-021a-4404-8abd-a5f5b6fa3c1c" name="Changes" comment="" />
<created>1666014368602</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1666014368602</updated>
<workItem from="1666014372693" duration="4581000" />
<workItem from="1666019118050" duration="177000" />
<workItem from="1666019963413" duration="214000" />
<workItem from="1666051541742" duration="32934000" />
<workItem from="1666103009602" duration="2443000" />
<workItem from="1666137766105" duration="9305000" />
<workItem from="1666231006298" duration="14881000" />
<workItem from="1666309417987" duration="16085000" />
<workItem from="1666354423006" duration="4490000" />
<workItem from="1666419438320" duration="7528000" />
<workItem from="1666483550118" duration="3493000" />
<workItem from="1666576609366" duration="5721000" />
<workItem from="1666662357654" duration="10832000" />
<workItem from="1666748063859" duration="3224000" />
<workItem from="1666830981448" duration="3025000" />
<workItem from="1666921346062" duration="1194000" />
<workItem from="1667200440602" duration="772000" />
<workItem from="1667269420400" duration="1267000" />
</task>
<task id="LOCAL-00001" summary="Changes">
<created>1666317348784</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1666317348784</updated>
</task>
<option name="localTasksCounter" value="2" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="Changes" />
<option name="LAST_COMMIT_MESSAGE" value="Changes" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<default-breakpoints>
<breakpoint log-message="true" log-stack="true" type="python-exception">
<properties notifyOnlyOnFirst="true" notifyOnTerminate="true" exception="BaseException">
<option name="notifyOnTerminate" value="true" />
<option name="notifyOnlyOnFirst" value="true" />
</properties>
</breakpoint>
</default-breakpoints>
</breakpoint-manager>
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/gui$main.coverage" NAME="main 覆盖结果" MODIFIED="1667274136542" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
</component>
</project>

View File

@ -0,0 +1,373 @@
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QGridLayout, QMainWindow, QMessageBox
from PyQt5.QtGui import QTextCursor, QIcon
from main_ui import *
from wifi_udp import *
import threading # 引入并行
import numpy as np
import pyqtgraph as pg
import re
import time
from sharedcomponets import GUIToolKit
import socket
import webbrowser
import copy
class MyWindow(QMainWindow, Ui_MainWindow):
signalColors = [GUIToolKit.RED_COLOR, GUIToolKit.BLUE_COLOR, GUIToolKit.PURPLE_COLOR, GUIToolKit.YELLOW_COLOR,
GUIToolKit.MAROON_COLOR, GUIToolKit.ORANGE_COLOR, GUIToolKit.GREEN_COLOR, GUIToolKit.GREEN_COLOR,
GUIToolKit.GREEN_COLOR, GUIToolKit.GREEN_COLOR, GUIToolKit.GREEN_COLOR]
signalIcons = ['reddot', 'bluedot', 'purpledot', 'yellowdot', 'maroondot', 'orangedot', 'greendot', 'greendot',
'greendot', 'greendot', 'greendot']
textColors = ['FD42AC', '398AD9', 'FF33FF', 'FFFF00', 'AA0000', 'FF5C5C', '5BEC8D', '5BEC8D', '5BEC8D', '5BEC8D',
'5BEC8D', '5BEC8D']
def __init__(self, parent=None):
super(MyWindow, self).__init__(parent)
self.title = "ESP32 MPPT Monitor"
self.version = "Ver: 0.1.2"
self.wid = QWidget(self)
self.setCentralWidget(self.wid)
self.setupUi(self)
self.setWindowTitle(self.title)
self.pLabel1 = QtWidgets.QLabel()
self.pLabel1.setMinimumWidth(65)
self.statusbar.addWidget(self.pLabel1)
self.pLabel1.setText(self.version)
self.pLabel2 = QtWidgets.QLabel()
self.pLabel2.setMinimumWidth(125)
self.statusbar.addWidget(self.pLabel2)
self.timerLocaltime = QtCore.QTimer()
self.timerLocaltime.timeout.connect(self.updateUiTime)
self.timerLocaltime.start(500)
# 变量初始化
self.wifi_open_flag = 0
self.test_flag = 0
self.wifi_IP_lineEdit.setText(self.get_host_ip())
# self.variable_init()
# 设置实例
# self.CreateItems()
# 设置信号与槽
self.CreateSignalSlot()
def updateUiTime(self):
self.pLabel2.setText(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
def get_host_ip(self):
"""
查询本机ip地址
:return:
"""
st = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
st.connect(('10.255.255.255', 1))
IP = st.getsockname()[0]
except Exception:
IP = '127.0.0.1'
finally:
st.close()
return IP
# 设置信号与槽
def CreateSignalSlot(self):
self.wifi_config_pushButton.clicked.connect(self.wifi_config_pushButton_clicked)
self.wifi_command_pushButton_1.clicked.connect(self.wifi_command_pushButton_1_clicked)
self.SERIAL_pushButton.clicked.connect(self.SERIAL_pushButton_clicked)
self.FWUPDATE_pushButton.clicked.connect(self.FWUPDATE_pushButton_clicked)
self.ESPRESTART_pushButton.clicked.connect(self.ESPRESTART_pushButton_clicked)
self.raw_pushButton.clicked.connect(self.raw_pushButton_clicked)
self.wave_pushButton.clicked.connect(self.wave_pushButton_clicked)
def raw_pushButton_clicked(self):
self.change_state = 1
self.stackedWidget.setCurrentIndex(1)
def wave_pushButton_clicked(self):
self.change_state = 0
self.stackedWidget.setCurrentIndex(0)
# 设置实例
def CreateItems(self):
# 定时器-绘图刷新
self.timer = QtCore.QTimer()
self.timer.timeout.connect(self.update_plot)
self.timer.start(20)
# wifi udp
self.udp = udp(self.wifi_IP_lineEdit_3.text())
# self.wifi_IP_lineEdit.setText(self.udp.user_ip)#设置为当前本机ID
def variable_init(self):
# wifi变量
self.wifi_recv_flag = 0
self.close_flag = 1
self.change_state = 0
self.re_item = []
self.re_item2 = []
self.raw_roll = 0
def plot_init(self):
# 绘图对象
pg.setConfigOptions(antialias=True)
self.plotWidget = pg.PlotWidget()
self.plotWidget.showGrid(x=True, y=True, alpha=0.5)
self.plotWidget.addLegend()
self.controlPlotWidget = ControlPlotPanel(controllerPlotWidget=self)
# 图表可视化数组
self.numberOfSamples = int(self.SAMPLE_doubleSpinBox.text())
self.signalDataArrays = []
self.signalPlots = []
self.signalPlotFlags = []
self.timeArray = np.arange(-self.numberOfSamples, 0, 1)
for (sig, sigColor, checkBox, tooltip) in zip(self.re_item, self.signalColors,
self.controlPlotWidget.signalCheckBox, self.re_item):
# define signal plot data array
self.signalDataArrays.append(np.zeros(self.numberOfSamples))
# configure signal plot parameters
signalPen = pg.mkPen(color=sigColor, width=1.5)
self.signalPlots.append(pg.PlotDataItem(self.timeArray, self.signalDataArrays[-1],
pen=signalPen, name=tooltip))
self.plotWidget.addItem(self.signalPlots[-1])
# is plotted flag
self.signalPlotFlags.append(True)
# add callback
checkBox.stateChanged.connect(self.signalPlotFlagUpdate)
self.stackedWidget = QtWidgets.QStackedWidget()
self.gridLayout.addWidget(self.stackedWidget)
self.raw_line = QtWidgets.QTextEdit()
self.raw_line.setStyleSheet('background: rgb(0, 0, 0)')
self.stackedWidget.addWidget(self.plotWidget)
self.stackedWidget.addWidget(self.raw_line)
self.tool_layout.addWidget(self.controlPlotWidget)
# checkbox
def signalPlotFlagUpdate(self):
for i, (checkBox, plotFlag) in enumerate(zip(self.controlPlotWidget.signalCheckBox, self.signalPlotFlags)):
if checkBox.isChecked() and (not plotFlag):
self.signalPlotFlags[i] = True
self.plotWidget.addItem(self.signalPlots[i])
elif (not checkBox.isChecked()) and plotFlag:
self.signalPlotFlags[i] = False
self.plotWidget.removeItem(self.signalPlots[i])
# 滑条绑定
def horizontalSlider_valueChanged(self, slider):
i = self.slider_lab.index(slider.objectName())
layout = getattr(self, 'horizontalLayout_{}'.format(i + 4))
value = layout.itemAt(1).widget().value()
value = float(layout.itemAt(0).widget().text()) + (value + 100) * (
float(layout.itemAt(2).widget().text()) - float(layout.itemAt(0).widget().text())) / 200
layout.itemAt(6).widget().setText(str(value))
value = layout.itemAt(4).widget().text() + str(value)
self.udp.send_message(str(value))
# command命令发送事件
def wifi_command_pushButton_1_clicked(self):
self.udp.send_message(self.wifi_command_lineEdit_1.text())
def SERIAL_pushButton_clicked(self):
self.udp.send_message("SERIAL")
def GETESPINFO_pushButton_clicked(self):
self.udp.send_message("ESPINFO")
def FWUPDATE_pushButton_clicked(self):
self.udp.send_message("FWUPDATE")
url = "http://"+self.wifi_IP_lineEdit_3.text()
webbrowser.open_new_tab(url)
def ESPRESTART_pushButton_clicked(self):
self.udp.send_message("ESPRESTART")
def INVD_pushButton_clicked(self):
self.udp.send_message("INVD" + self.INVD_doubleSpinBox.text())
# WIFI设置点击后判断有无接收到esp32发来的数据
def wifi_config_pushButton_clicked(self):
if self.wifi_open_flag == 0:
try:
self.variable_init()
self.CreateItems()
print(self.wifi_IP_lineEdit.text())
self.udp.udpClientSocket.bind((self.wifi_IP_lineEdit.text(), 2333))
self.udp.udpClientSocket.settimeout(1)
# 第一次接受数据,用于判断项目数,
self.udp.send_message("START1")
recv_data = self.udp.udpClientSocket.recv(1024)
recv_data = recv_data.decode('utf-8')
recv_data = recv_data[:-1]
recv_data = recv_data.split(',')
"""处理接受的信息"""
for i, data in enumerate(recv_data):
if i< 5:
self.re_item2.append(''.join(re.split(r'[^A-Za-z]', data)))
if(i==0):
self.RNFA_doubleSpinBox.setProperty("value", data.replace(self.re_item2[i], ''))
elif(i==1):
self.RNFB_doubleSpinBox.setProperty("value", data.replace(self.re_item2[i], ''))
elif(i==2):
self.pwm_label.setText(data.replace(self.re_item2[i], ''))
elif(i==3):
self.ppwm_label.setText(data.replace(self.re_item2[i], ''))
elif(i==4):
self.pwmc_label.setText(data.replace(self.re_item2[i], ''))
else:
self.re_item.append(''.join(re.split(r'[^A-Za-z]', data)))
if(i==6):
print(data.replace(self.re_item[i-5], ''))
self.INVD_doubleSpinBox.setProperty("value", data.replace(self.re_item[i-5], ''))
elif(i==9):
print(data.replace(self.re_item[i-5], ''))
self.OUTVD_doubleSpinBox.setProperty("value", data.replace(self.re_item[i-5], ''))
print(self.re_item)
print(self.re_item2)
# 图表初始化
self.plot_init()
t1 = threading.Thread(target=self.udp_recv)
# t1.setDaemon(True)
t1.start()
self.wifi_open_flag = 1
self.wifi_config_pushButton.setText("断开连接")
self.wifi_config_pushButton.setStyleSheet("QPushButton{color:rgb(255,0,0,255);}")
except Exception as e:
print(e)
QMessageBox.critical(self, "错误", str(e))
else:
self.close_flag = 0
self.wifi_open_flag = 0
self.tool_layout.itemAt(0).widget().deleteLater()
self.gridLayout.itemAt(0).widget().deleteLater()
self.wifi_config_pushButton.setText("设置")
print("断开连接")
print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
def udp_recv(self):
while self.close_flag:
try:
recv_data = self.udp.udpClientSocket.recv(1024)
recv_data = recv_data.decode('utf-8')
recv_data = recv_data[:-1]
recv_data = recv_data.split(',')
"""处理接受的信息"""
# print(recv_data)
self.re_text = ''
for i, data in enumerate(recv_data):
if i < 5:
if (i == 2):
self.pwm_label.setText(data.replace(self.re_item2[i], ''))
elif (i == 3):
self.ppwm_label.setText(data.replace(self.re_item2[i], ''))
elif (i == 4):
self.pwmc_label.setText(data.replace(self.re_item2[i], ''))
else:
if self.signalPlotFlags[i-5]:
# self.re_item.append(''.join(re.split(r'[^A-Za-z]', data)))
data = data.replace(self.re_item[i-5], '')
if self.change_state:
self.re_text += '<font color=\"#{1}\">{0}\t</font>'.format(data, self.textColors[i-5])
else:
self.signalDataArrays[i-5] = np.roll(self.signalDataArrays[i-5], -1)
self.signalDataArrays[i-5][-1] = data
del recv_data
except socket.timeout:
print("closing socket")
print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
self.wifi_config_pushButton_clicked()
self.closeUDP()
def update_plot(self):
if self.wifi_recv_flag:
if self.change_state:
self.raw_line.append(self.re_text)
if self.raw_roll:
self.raw_line.moveCursor(QTextCursor.End)
else:
for i, plotFlag in enumerate(self.signalPlotFlags):
if plotFlag:
self.signalPlots[i].setData(self.timeArray, self.signalDataArrays[i])
self.signalPlots[i].updateItems()
self.signalPlots[i].sigPlotChanged.emit(self.signalPlots[i])
def closeUDP(self):
self.variable_init()
self.close_flag = 0
self.udp.send_message("START0")
self.udp.udpClientSocket.close()
del self.udp
def closeEvent(self, a0: QtGui.QCloseEvent) -> None:
print("关闭")
self.close_flag = 0
class ControlPlotPanel(QtWidgets.QWidget):
def __init__(self, parent=None, controllerPlotWidget=None):
'''Constructor for ToolsWidget'''
super().__init__(parent)
# 变量
# 继承主窗口对象
self.controlledPlot = controllerPlotWidget
self.horizontalLayout1 = QtWidgets.QHBoxLayout()
self.horizontalLayout1.setObjectName('horizontalLayout')
self.setLayout(self.horizontalLayout1)
self.startStopButton = QtWidgets.QPushButton(self)
self.startStopButton.setObjectName('Start')
self.startStopButton.setText('Start')
self.startStopButton.setIcon(GUIToolKit.getIconByName('start'))
self.startStopButton.clicked.connect(self.wifi_recv_open_pushButton_clicked)
self.horizontalLayout1.addWidget(self.startStopButton)
self.zoomAllButton = QtWidgets.QPushButton(self)
self.zoomAllButton.setObjectName('zoomAllButton')
self.zoomAllButton.setText('View all')
self.zoomAllButton.setIcon(GUIToolKit.getIconByName('zoomall'))
self.zoomAllButton.clicked.connect(self.zoomAllPlot)
self.horizontalLayout1.addWidget(self.zoomAllButton)
self.signalCheckBox = []
for i in range(len(self.controlledPlot.re_item)):
checkBox = QtWidgets.QCheckBox(self)
checkBox.setObjectName('signalCheckBox' + str(i))
checkBox.setToolTip(self.controlledPlot.re_item[i])
checkBox.setText(self.controlledPlot.re_item[i])
checkBox.setIcon(GUIToolKit.getIconByName(self.controlledPlot.signalIcons[i]))
checkBox.setChecked(True)
self.signalCheckBox.append(checkBox)
self.horizontalLayout1.addWidget(checkBox)
def zoomAllPlot(self):
if self.controlledPlot.change_state:
self.controlledPlot.raw_roll = ~self.controlledPlot.raw_roll
else:
self.controlledPlot.plotWidget.enableAutoRange()
def wifi_recv_open_pushButton_clicked(self):
if self.controlledPlot.wifi_recv_flag == 0:
# 打开wifi接收
self.controlledPlot.wifi_recv_flag = 1
self.startStopButton.setText('Stop')
else:
self.controlledPlot.wifi_recv_flag = 0
self.startStopButton.setText('Start')
if __name__ == '__main__':
QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
app = QApplication(sys.argv)
myWin = MyWindow()
myWin.show()
sys.exit(app.exec())

View File

@ -0,0 +1,44 @@
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(
['main.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)

View File

@ -0,0 +1,321 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'main_ui.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1095, 681)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.formLayout = QtWidgets.QFormLayout(self.centralwidget)
self.formLayout.setObjectName("formLayout")
self.groupBox_3 = QtWidgets.QGroupBox(self.centralwidget)
self.groupBox_3.setObjectName("groupBox_3")
self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox_3)
self.gridLayout_2.setObjectName("gridLayout_2")
self.horizontalLayout_1 = QtWidgets.QHBoxLayout()
self.horizontalLayout_1.setObjectName("horizontalLayout_1")
self.label_10 = QtWidgets.QLabel(self.groupBox_3)
self.label_10.setObjectName("label_10")
self.horizontalLayout_1.addWidget(self.label_10)
self.wifi_command_lineEdit_1 = QtWidgets.QLineEdit(self.groupBox_3)
self.wifi_command_lineEdit_1.setObjectName("wifi_command_lineEdit_1")
self.horizontalLayout_1.addWidget(self.wifi_command_lineEdit_1)
self.wifi_command_pushButton_1 = QtWidgets.QPushButton(self.groupBox_3)
self.wifi_command_pushButton_1.setObjectName("wifi_command_pushButton_1")
self.horizontalLayout_1.addWidget(self.wifi_command_pushButton_1)
self.gridLayout_2.addLayout(self.horizontalLayout_1, 0, 0, 1, 1)
self.groupBox_5 = QtWidgets.QGroupBox(self.groupBox_3)
self.groupBox_5.setObjectName("groupBox_5")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.groupBox_5)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.groupBox_8 = QtWidgets.QGroupBox(self.groupBox_5)
self.groupBox_8.setObjectName("groupBox_8")
self.gridLayout_10 = QtWidgets.QGridLayout(self.groupBox_8)
self.gridLayout_10.setObjectName("gridLayout_10")
self.label_6 = QtWidgets.QLabel(self.groupBox_8)
self.label_6.setObjectName("label_6")
self.gridLayout_10.addWidget(self.label_6, 0, 0, 1, 1)
self.label_9 = QtWidgets.QLabel(self.groupBox_8)
self.label_9.setObjectName("label_9")
self.gridLayout_10.addWidget(self.label_9, 0, 1, 1, 1)
self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
self.horizontalLayout_6.setObjectName("horizontalLayout_6")
self.label = QtWidgets.QLabel(self.groupBox_8)
self.label.setObjectName("label")
self.horizontalLayout_6.addWidget(self.label)
self.label_3 = QtWidgets.QLabel(self.groupBox_8)
self.label_3.setObjectName("label_3")
self.horizontalLayout_6.addWidget(self.label_3)
self.gridLayout_10.addLayout(self.horizontalLayout_6, 0, 2, 1, 1)
self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
self.horizontalLayout_7.setObjectName("horizontalLayout_7")
self.label_7 = QtWidgets.QLabel(self.groupBox_8)
self.label_7.setObjectName("label_7")
self.horizontalLayout_7.addWidget(self.label_7)
self.label_8 = QtWidgets.QLabel(self.groupBox_8)
self.label_8.setObjectName("label_8")
self.horizontalLayout_7.addWidget(self.label_8)
self.gridLayout_10.addLayout(self.horizontalLayout_7, 0, 3, 1, 1)
self.verticalLayout_2.addWidget(self.groupBox_8)
self.groupBox_7 = QtWidgets.QGroupBox(self.groupBox_5)
self.groupBox_7.setObjectName("groupBox_7")
self.gridLayout_9 = QtWidgets.QGridLayout(self.groupBox_7)
self.gridLayout_9.setObjectName("gridLayout_9")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.label_5 = QtWidgets.QLabel(self.groupBox_7)
self.label_5.setObjectName("label_5")
self.horizontalLayout_2.addWidget(self.label_5)
self.pwmc_label = QtWidgets.QLabel(self.groupBox_7)
self.pwmc_label.setObjectName("pwmc_label")
self.horizontalLayout_2.addWidget(self.pwmc_label)
self.gridLayout_9.addLayout(self.horizontalLayout_2, 0, 0, 1, 1)
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
self.label_2 = QtWidgets.QLabel(self.groupBox_7)
self.label_2.setObjectName("label_2")
self.horizontalLayout_4.addWidget(self.label_2)
self.pwm_label = QtWidgets.QLabel(self.groupBox_7)
self.pwm_label.setObjectName("pwm_label")
self.horizontalLayout_4.addWidget(self.pwm_label)
self.gridLayout_9.addLayout(self.horizontalLayout_4, 0, 1, 1, 1)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.label_4 = QtWidgets.QLabel(self.groupBox_7)
self.label_4.setObjectName("label_4")
self.horizontalLayout_3.addWidget(self.label_4)
self.ppwm_label = QtWidgets.QLabel(self.groupBox_7)
self.ppwm_label.setObjectName("ppwm_label")
self.horizontalLayout_3.addWidget(self.ppwm_label)
self.gridLayout_9.addLayout(self.horizontalLayout_3, 0, 2, 1, 1)
self.verticalLayout_2.addWidget(self.groupBox_7)
self.gridLayout_2.addWidget(self.groupBox_5, 1, 0, 1, 1)
self.groupBox_6 = QtWidgets.QGroupBox(self.groupBox_3)
self.groupBox_6.setObjectName("groupBox_6")
self.gridLayout_7 = QtWidgets.QGridLayout(self.groupBox_6)
self.gridLayout_7.setObjectName("gridLayout_7")
self.horizontalLayout_10 = QtWidgets.QHBoxLayout()
self.horizontalLayout_10.setSpacing(1)
self.horizontalLayout_10.setObjectName("horizontalLayout_10")
self.label_11 = QtWidgets.QLabel(self.groupBox_6)
self.label_11.setObjectName("label_11")
self.horizontalLayout_10.addWidget(self.label_11)
self.wifi_IP_lineEdit_3 = QtWidgets.QLineEdit(self.groupBox_6)
self.wifi_IP_lineEdit_3.setObjectName("wifi_IP_lineEdit_3")
self.horizontalLayout_10.addWidget(self.wifi_IP_lineEdit_3)
self.gridLayout_7.addLayout(self.horizontalLayout_10, 1, 0, 1, 1)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setSpacing(1)
self.horizontalLayout.setObjectName("horizontalLayout")
self.label_12 = QtWidgets.QLabel(self.groupBox_6)
self.label_12.setObjectName("label_12")
self.horizontalLayout.addWidget(self.label_12)
self.wifi_IP_lineEdit = QtWidgets.QLineEdit(self.groupBox_6)
self.wifi_IP_lineEdit.setText("")
self.wifi_IP_lineEdit.setObjectName("wifi_IP_lineEdit")
self.horizontalLayout.addWidget(self.wifi_IP_lineEdit)
self.wifi_config_pushButton = QtWidgets.QPushButton(self.groupBox_6)
self.wifi_config_pushButton.setObjectName("wifi_config_pushButton")
self.horizontalLayout.addWidget(self.wifi_config_pushButton)
self.gridLayout_7.addLayout(self.horizontalLayout, 2, 0, 1, 1)
self.horizontalLayout_21 = QtWidgets.QHBoxLayout()
self.horizontalLayout_21.setObjectName("horizontalLayout_21")
self.label_20 = QtWidgets.QLabel(self.groupBox_6)
self.label_20.setObjectName("label_20")
self.horizontalLayout_21.addWidget(self.label_20)
self.SAMPLE_doubleSpinBox = QtWidgets.QDoubleSpinBox(self.groupBox_6)
self.SAMPLE_doubleSpinBox.setDecimals(0)
self.SAMPLE_doubleSpinBox.setMinimum(300.0)
self.SAMPLE_doubleSpinBox.setMaximum(10000.0)
self.SAMPLE_doubleSpinBox.setSingleStep(100.0)
self.SAMPLE_doubleSpinBox.setStepType(QtWidgets.QAbstractSpinBox.AdaptiveDecimalStepType)
self.SAMPLE_doubleSpinBox.setProperty("value", 300.0)
self.SAMPLE_doubleSpinBox.setObjectName("SAMPLE_doubleSpinBox")
self.horizontalLayout_21.addWidget(self.SAMPLE_doubleSpinBox)
self.gridLayout_7.addLayout(self.horizontalLayout_21, 0, 0, 1, 1)
self.gridLayout_2.addWidget(self.groupBox_6, 5, 0, 1, 1)
self.groupBox_4 = QtWidgets.QGroupBox(self.groupBox_3)
self.groupBox_4.setObjectName("groupBox_4")
self.gridLayout_5 = QtWidgets.QGridLayout(self.groupBox_4)
self.gridLayout_5.setObjectName("gridLayout_5")
self.horizontalLayout_20 = QtWidgets.QHBoxLayout()
self.horizontalLayout_20.setObjectName("horizontalLayout_20")
self.label_19 = QtWidgets.QLabel(self.groupBox_4)
self.label_19.setObjectName("label_19")
self.horizontalLayout_20.addWidget(self.label_19)
self.INCD_doubleSpinBox = QtWidgets.QDoubleSpinBox(self.groupBox_4)
self.INCD_doubleSpinBox.setSingleStep(0.5)
self.INCD_doubleSpinBox.setProperty("value", 10.0)
self.INCD_doubleSpinBox.setObjectName("INCD_doubleSpinBox")
self.horizontalLayout_20.addWidget(self.INCD_doubleSpinBox)
self.INCD_pushButton = QtWidgets.QPushButton(self.groupBox_4)
self.INCD_pushButton.setObjectName("INCD_pushButton")
self.horizontalLayout_20.addWidget(self.INCD_pushButton)
self.gridLayout_5.addLayout(self.horizontalLayout_20, 4, 0, 1, 1)
self.horizontalLayout_18 = QtWidgets.QHBoxLayout()
self.horizontalLayout_18.setObjectName("horizontalLayout_18")
self.label_17 = QtWidgets.QLabel(self.groupBox_4)
self.label_17.setObjectName("label_17")
self.horizontalLayout_18.addWidget(self.label_17)
self.RNFA_doubleSpinBox = QtWidgets.QDoubleSpinBox(self.groupBox_4)
self.RNFA_doubleSpinBox.setDecimals(4)
self.RNFA_doubleSpinBox.setMaximum(1.0)
self.RNFA_doubleSpinBox.setSingleStep(0.001)
self.RNFA_doubleSpinBox.setProperty("value", 0.002)
self.RNFA_doubleSpinBox.setObjectName("RNFA_doubleSpinBox")
self.horizontalLayout_18.addWidget(self.RNFA_doubleSpinBox)
self.RNFA_pushButton = QtWidgets.QPushButton(self.groupBox_4)
self.RNFA_pushButton.setObjectName("RNFA_pushButton")
self.horizontalLayout_18.addWidget(self.RNFA_pushButton)
self.gridLayout_5.addLayout(self.horizontalLayout_18, 2, 0, 1, 1)
self.horizontalLayout_17 = QtWidgets.QHBoxLayout()
self.horizontalLayout_17.setObjectName("horizontalLayout_17")
self.label_16 = QtWidgets.QLabel(self.groupBox_4)
self.label_16.setObjectName("label_16")
self.horizontalLayout_17.addWidget(self.label_16)
self.INVD_doubleSpinBox = QtWidgets.QDoubleSpinBox(self.groupBox_4)
self.INVD_doubleSpinBox.setDecimals(3)
self.INVD_doubleSpinBox.setMaximum(120.0)
self.INVD_doubleSpinBox.setSingleStep(0.5)
self.INVD_doubleSpinBox.setProperty("value", 50.0)
self.INVD_doubleSpinBox.setObjectName("INVD_doubleSpinBox")
self.horizontalLayout_17.addWidget(self.INVD_doubleSpinBox)
self.INVD_pushButton = QtWidgets.QPushButton(self.groupBox_4)
self.INVD_pushButton.setObjectName("INVD_pushButton")
self.horizontalLayout_17.addWidget(self.INVD_pushButton)
self.gridLayout_5.addLayout(self.horizontalLayout_17, 0, 0, 1, 1)
self.horizontalLayout_19 = QtWidgets.QHBoxLayout()
self.horizontalLayout_19.setObjectName("horizontalLayout_19")
self.label_18 = QtWidgets.QLabel(self.groupBox_4)
self.label_18.setObjectName("label_18")
self.horizontalLayout_19.addWidget(self.label_18)
self.RNFB_doubleSpinBox = QtWidgets.QDoubleSpinBox(self.groupBox_4)
self.RNFB_doubleSpinBox.setDecimals(4)
self.RNFB_doubleSpinBox.setMaximum(1.0)
self.RNFB_doubleSpinBox.setSingleStep(0.001)
self.RNFB_doubleSpinBox.setProperty("value", 0.002)
self.RNFB_doubleSpinBox.setObjectName("RNFB_doubleSpinBox")
self.horizontalLayout_19.addWidget(self.RNFB_doubleSpinBox)
self.RNFB_pushButton = QtWidgets.QPushButton(self.groupBox_4)
self.RNFB_pushButton.setObjectName("RNFB_pushButton")
self.horizontalLayout_19.addWidget(self.RNFB_pushButton)
self.gridLayout_5.addLayout(self.horizontalLayout_19, 3, 0, 1, 1)
self.horizontalLayout_16 = QtWidgets.QHBoxLayout()
self.horizontalLayout_16.setObjectName("horizontalLayout_16")
self.label_15 = QtWidgets.QLabel(self.groupBox_4)
self.label_15.setObjectName("label_15")
self.horizontalLayout_16.addWidget(self.label_15)
self.OUTVD_doubleSpinBox = QtWidgets.QDoubleSpinBox(self.groupBox_4)
self.OUTVD_doubleSpinBox.setDecimals(3)
self.OUTVD_doubleSpinBox.setSingleStep(0.1)
self.OUTVD_doubleSpinBox.setProperty("value", 50.0)
self.OUTVD_doubleSpinBox.setObjectName("OUTVD_doubleSpinBox")
self.horizontalLayout_16.addWidget(self.OUTVD_doubleSpinBox)
self.OUTVD_pushButton = QtWidgets.QPushButton(self.groupBox_4)
self.OUTVD_pushButton.setObjectName("OUTVD_pushButton")
self.horizontalLayout_16.addWidget(self.OUTVD_pushButton)
self.gridLayout_5.addLayout(self.horizontalLayout_16, 1, 0, 1, 1)
self.gridLayout_2.addWidget(self.groupBox_4, 3, 0, 1, 1)
self.groupBox_9 = QtWidgets.QGroupBox(self.groupBox_3)
self.groupBox_9.setObjectName("groupBox_9")
self.gridLayout_11 = QtWidgets.QGridLayout(self.groupBox_9)
self.gridLayout_11.setObjectName("gridLayout_11")
self.SERIAL_pushButton = QtWidgets.QPushButton(self.groupBox_9)
self.SERIAL_pushButton.setObjectName("SERIAL_pushButton")
self.gridLayout_11.addWidget(self.SERIAL_pushButton, 1, 2, 1, 1)
self.ESPRESTART_pushButton = QtWidgets.QPushButton(self.groupBox_9)
self.ESPRESTART_pushButton.setObjectName("ESPRESTART_pushButton")
self.gridLayout_11.addWidget(self.ESPRESTART_pushButton, 2, 2, 1, 1)
self.FWUPDATE_pushButton = QtWidgets.QPushButton(self.groupBox_9)
self.FWUPDATE_pushButton.setObjectName("FWUPDATE_pushButton")
self.gridLayout_11.addWidget(self.FWUPDATE_pushButton, 3, 2, 1, 1)
self.gridLayout_2.addWidget(self.groupBox_9, 4, 0, 1, 1)
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.groupBox_3)
self.groupBox_2 = QtWidgets.QGroupBox(self.centralwidget)
self.groupBox_2.setObjectName("groupBox_2")
self.gridLayout_4 = QtWidgets.QGridLayout(self.groupBox_2)
self.gridLayout_4.setObjectName("gridLayout_4")
self.gridLayout_6 = QtWidgets.QGridLayout()
self.gridLayout_6.setObjectName("gridLayout_6")
self.raw_pushButton = QtWidgets.QPushButton(self.groupBox_2)
self.raw_pushButton.setObjectName("raw_pushButton")
self.gridLayout_6.addWidget(self.raw_pushButton, 0, 1, 1, 1)
self.wave_pushButton = QtWidgets.QPushButton(self.groupBox_2)
self.wave_pushButton.setObjectName("wave_pushButton")
self.gridLayout_6.addWidget(self.wave_pushButton, 0, 0, 1, 1)
self.gridLayout_4.addLayout(self.gridLayout_6, 0, 0, 1, 1)
self.tool_layout = QtWidgets.QHBoxLayout()
self.tool_layout.setObjectName("tool_layout")
self.gridLayout_4.addLayout(self.tool_layout, 2, 0, 1, 1)
self.gridLayout = QtWidgets.QGridLayout()
self.gridLayout.setObjectName("gridLayout")
self.gridLayout_4.addLayout(self.gridLayout, 1, 0, 1, 1)
self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.groupBox_2)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1095, 23))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.groupBox_3.setTitle(_translate("MainWindow", "控制台"))
self.label_10.setText(_translate("MainWindow", "命令"))
self.wifi_command_pushButton_1.setText(_translate("MainWindow", "发送"))
self.groupBox_5.setTitle(_translate("MainWindow", "状态"))
self.groupBox_8.setTitle(_translate("MainWindow", "运行信息"))
self.label_6.setText(_translate("MainWindow", "BUCK"))
self.label_9.setText(_translate("MainWindow", "防逆流"))
self.label.setText(_translate("MainWindow", "驱动"))
self.label_3.setText(_translate("MainWindow", "EN"))
self.label_7.setText(_translate("MainWindow", "错误信息"))
self.label_8.setText(_translate("MainWindow", "0"))
self.groupBox_7.setTitle(_translate("MainWindow", "PWM值"))
self.label_5.setText(_translate("MainWindow", "PWMC:"))
self.pwmc_label.setText(_translate("MainWindow", "0"))
self.label_2.setText(_translate("MainWindow", "PWM"))
self.pwm_label.setText(_translate("MainWindow", "0"))
self.label_4.setText(_translate("MainWindow", "PPWM:"))
self.ppwm_label.setText(_translate("MainWindow", "0"))
self.groupBox_6.setTitle(_translate("MainWindow", "连接"))
self.label_11.setText(_translate("MainWindow", "目标IP"))
self.wifi_IP_lineEdit_3.setText(_translate("MainWindow", "192.168.5.63"))
self.label_12.setText(_translate("MainWindow", "本机IP"))
self.wifi_config_pushButton.setText(_translate("MainWindow", "设置"))
self.label_20.setText(_translate("MainWindow", "图表采样数"))
self.groupBox_4.setTitle(_translate("MainWindow", "参数校准"))
self.label_19.setText(_translate("MainWindow", "ADS712电流校准"))
self.INCD_pushButton.setText(_translate("MainWindow", "发送"))
self.label_17.setText(_translate("MainWindow", "输入采样电阻"))
self.RNFA_pushButton.setText(_translate("MainWindow", "发送"))
self.label_16.setText(_translate("MainWindow", "校准输入电压"))
self.INVD_pushButton.setText(_translate("MainWindow", "发送"))
self.label_18.setText(_translate("MainWindow", "输出采样电阻"))
self.RNFB_pushButton.setText(_translate("MainWindow", "发送"))
self.label_15.setText(_translate("MainWindow", "校准输出电压"))
self.OUTVD_pushButton.setText(_translate("MainWindow", "发送"))
self.groupBox_9.setTitle(_translate("MainWindow", "功能"))
self.SERIAL_pushButton.setText(_translate("MainWindow", "串口信息设置"))
self.ESPRESTART_pushButton.setText(_translate("MainWindow", "重启ESP32"))
self.FWUPDATE_pushButton.setText(_translate("MainWindow", "升级固件"))
self.groupBox_2.setTitle(_translate("MainWindow", "可视化图表"))
self.raw_pushButton.setText(_translate("MainWindow", "原始数据"))
self.wave_pushButton.setText(_translate("MainWindow", "波形图"))

View File

@ -0,0 +1,519 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0" idbasedtr="true">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1099</width>
<height>681</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>控制台</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_1">
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string>命令</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="wifi_command_lineEdit_1"/>
</item>
<item>
<widget class="QPushButton" name="wifi_command_pushButton_1">
<property name="text">
<string>发送</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_5">
<property name="title">
<string>状态</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox_8">
<property name="title">
<string>运行信息</string>
</property>
<layout class="QGridLayout" name="gridLayout_10">
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>BUCK</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_9">
<property name="text">
<string>防逆流</string>
</property>
</widget>
</item>
<item row="0" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>驱动</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>EN</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="3">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>错误信息</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_7">
<property name="title">
<string>PWM值</string>
</property>
<layout class="QGridLayout" name="gridLayout_9">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>PWMC:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="pwmc_label">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>PWM</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="pwm_label">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>PPWM:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="ppwm_label">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="0">
<widget class="QGroupBox" name="groupBox_6">
<property name="title">
<string>连接</string>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_10">
<property name="spacing">
<number>1</number>
</property>
<item>
<widget class="QLabel" name="label_11">
<property name="text">
<string>目标IP</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="wifi_IP_lineEdit_3">
<property name="text">
<string>192.168.5.63</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>1</number>
</property>
<item>
<widget class="QLabel" name="label_12">
<property name="text">
<string>本机IP</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="wifi_IP_lineEdit">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="wifi_config_pushButton">
<property name="text">
<string>设置</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_21">
<item>
<widget class="QLabel" name="label_20">
<property name="text">
<string>图表采样数</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="SAMPLE_doubleSpinBox">
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>300.000000000000000</double>
</property>
<property name="maximum">
<double>10000.000000000000000</double>
</property>
<property name="singleStep">
<double>100.000000000000000</double>
</property>
<property name="stepType">
<enum>QAbstractSpinBox::AdaptiveDecimalStepType</enum>
</property>
<property name="value">
<double>300.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>参数校准</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="4" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_20">
<item>
<widget class="QLabel" name="label_19">
<property name="text">
<string>ADS712电流校准</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="INCD_doubleSpinBox">
<property name="singleStep">
<double>0.500000000000000</double>
</property>
<property name="value">
<double>10.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="INCD_pushButton">
<property name="text">
<string>发送</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_18">
<item>
<widget class="QLabel" name="label_17">
<property name="text">
<string>输入采样电阻</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="RNFA_doubleSpinBox">
<property name="decimals">
<number>4</number>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.001000000000000</double>
</property>
<property name="value">
<double>0.002000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="RNFA_pushButton">
<property name="text">
<string>发送</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_17">
<item>
<widget class="QLabel" name="label_16">
<property name="text">
<string>校准输入电压</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="INVD_doubleSpinBox">
<property name="decimals">
<number>3</number>
</property>
<property name="maximum">
<double>120.000000000000000</double>
</property>
<property name="singleStep">
<double>0.500000000000000</double>
</property>
<property name="value">
<double>50.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="INVD_pushButton">
<property name="text">
<string>发送</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_19">
<item>
<widget class="QLabel" name="label_18">
<property name="text">
<string>输出采样电阻</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="RNFB_doubleSpinBox">
<property name="decimals">
<number>4</number>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.001000000000000</double>
</property>
<property name="value">
<double>0.002000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="RNFB_pushButton">
<property name="text">
<string>发送</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_16">
<item>
<widget class="QLabel" name="label_15">
<property name="text">
<string>校准输出电压</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="OUTVD_doubleSpinBox">
<property name="decimals">
<number>3</number>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>50.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="OUTVD_pushButton">
<property name="text">
<string>发送</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QGroupBox" name="groupBox_9">
<property name="title">
<string>功能</string>
</property>
<layout class="QGridLayout" name="gridLayout_11">
<item row="1" column="2">
<widget class="QPushButton" name="SERIAL_pushButton">
<property name="text">
<string>串口信息设置</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="ESPRESTART_pushButton">
<property name="text">
<string>重启ESP32</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="FWUPDATE_pushButton">
<property name="text">
<string>升级固件</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>可视化图表</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="1">
<widget class="QPushButton" name="raw_pushButton">
<property name="text">
<string>原始数据</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="wave_pushButton">
<property name="text">
<string>波形图</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="tool_layout"/>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1099</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

Binary file not shown.

After

Width:  |  Height:  |  Size: 838 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 934 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 829 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 907 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 999 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 800 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,73 @@
import os
from PyQt5 import QtGui, QtWidgets, QtCore
class GUIToolKit(object):
''' This class is used to provide icons for the rest of the application
hiding the location of the resources
'''
RED_COLOR = (255, 92, 92)
GREEN_COLOR = (57, 217, 138)
BLUE_COLOR = (91, 141, 236)
ORANGE_COLOR = (253, 172, 66)
YELLOW_COLOR = (255,255,51)
PURPLE_COLOR = (75,0,130)
MAROON_COLOR = (222,184,135)
@staticmethod
def getIconByName(icoName):
file_index = {
'add': 'add.png',
'add_motor': 'add_motor.png',
'tree': 'tree.png',
'gen': 'gen.png',
'home': 'home.png',
'form': 'form.png',
'edit': 'edit.png',
'delete': 'delete.png',
'statistics': 'statistics.png',
'reddot': 'reddot.png',
'orangedot': 'orangedot.png',
'greendot': 'greendot.png',
'bluedot': 'bluedot.png',
'purpledot': 'purpledot.png',
'yellowdot': 'yellowdot.png',
'maroondot': 'maroondot.png',
'send': 'send.png',
'zoomall': 'zoomall.png',
'connect': 'connect.png',
'continue': 'continue.png',
'alert': 'alert.png',
'gear': 'gear.png',
'generalsettings': 'generalsettings.png',
'open': 'open.png',
'loop': 'loop.png',
'save': 'save.png',
'stop': 'stop.png',
'restart': 'continue.png',
'res': 'res.png',
'sensor': 'sensor.png',
'start': 'start.png',
'motor': 'motor.png',
'pause': 'pause.png',
'pull': 'pull.png',
'push': 'push.png',
'list': 'list.png',
'disconnect': 'disconnect.png',
'configure': 'configure.png',
'pidconfig': 'pidconfig.png',
'consoletool': 'consoletool.png',
'fordward': 'fordward.png',
'fastbackward': 'fastbackward.png',
'backward': 'backward.png',
'stopjogging': 'stopjogging.png',
'fastfordward': 'fastfordward.png',
'customcommands':'customcommands.png'
}
currentDir = os.path.dirname(__file__)
icon_path = os.path.join(currentDir, './resources', file_index[icoName])
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(icon_path), QtGui.QIcon.Normal,
QtGui.QIcon.Off)
return icon

View File

@ -0,0 +1,35 @@
from socket import *
class udp(object):
"""wifi udp to esp32"""
def __init__(self, HOST = '192.168.5.63', PORT = 2333):
self.HOST = HOST
self.PORT = PORT
self.BUFSIZ = 1024
self.ADDRESS = (self.HOST, self.PORT)
self.udpClientSocket = socket(AF_INET, SOCK_DGRAM)
try:
s = socket(AF_INET, SOCK_DGRAM)
s.connect(('8.8.8.8', 80))
self.user_ip = s.getsockname()[0]
finally:
s.close()
def send_message(self,data):
if not data:
return 0
self.udpClientSocket.sendto(data.encode('utf-8'),self.ADDRESS)
if __name__ == '__main__':
udp = udp()
while True:
data = input('>')
udp.send_message(data)
# 接收数据
data, ADDR = udp.udpClientSocket.recvfrom(udp.BUFSIZ)
if not data:
break
print("服务器端响应:", data.decode('utf-8'))
udp.udpClientSocket.close()