Skip to content

Commit

Permalink
abb db meter to config
Browse files Browse the repository at this point in the history
  • Loading branch information
LoSk-p committed Jun 13, 2024
1 parent 05fc28c commit 2d7c08d
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ gui/*.py
!gui/__init__.py

.DS_Store
.venv
3 changes: 2 additions & 1 deletion airrohr-flasher.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def on_wifiButton_clicked(self):

device = self.boardBox.currentData(ROLE_DEVICE)

configstring = '{"SOFTWARE_VERSION":"flashingtool","current_lang":"","wlanssid":"","wlanpwd":"","wlannopwd":false,"www_username":"admin","www_password":"","fs_ssid":"","fs_pwd":"","www_basicauth_enabled":false,"dht_read":false,"htu21d_read":true,"ppd_read":false,"sds_read":true,"gc_read":false,"ccs811_read":false,"ccs811_27_read":false,"file_write":false,"pms_read":false,"hpm_read":false,"npm_read":false,"sps30_read":false,"bmp_read":false,"bmx280_read":false,"sht3x_read":false,"ds18b20_read":false,"dnms_read":false,"dnms_correction":"0.0","lat_gps":"0.0","lon_gps":"0.0","temp_correction":"0.0","gps_read":true,"send2dusti":true,"ssl_dusti":false,"send2madavi":true,"ssl_madavi":false,"send2robonomics":true,"send2sensemap":false,"send2fsapp":false,"send2aircms":false,"send2csv":false,"auto_update":true,"use_beta":false,"has_display":false,"has_sh1106":false,"has_flipped_display":false,"has_lcd1602":false,"has_lcd1602_27":false,"has_lcd2004":false,"has_lcd2004_27":false,"display_wifi_info":true,"display_device_info":true,"debug":3,"sending_intervall_ms":145000,"time_for_wifi_config":600000,"senseboxid":"","send2custom":false,"host_custom":"192.168.234.1","url_custom":"/data.php","port_custom":80,"user_custom":"","pwd_custom":"","ssl_custom":false,"send2influx":false,"host_influx":"influx.server","url_influx":"/write?db=sensorcommunity","port_influx":8086,"user_influx":"","pwd_influx":"","measurement_name_influx":"feinstaub","ssl_influx":false,"donated_by":"","current_reg":"Global"}'
configstring = '{"SOFTWARE_VERSION":"flashingtool","current_lang":"","wlanssid":"","wlanpwd":"","wlannopwd":false,"www_username":"admin","www_password":"","fs_ssid":"","fs_pwd":"","www_basicauth_enabled":false,"dht_read":false,"htu21d_read":true,"ppd_read":false,"sds_read":true,"gc_read":false,"ccs811_read":false,"ccs811_27_read":false,"dbmeter_read":false,"file_write":false,"pms_read":false,"hpm_read":false,"npm_read":false,"sps30_read":false,"bmp_read":false,"bmx280_read":false,"sht3x_read":false,"ds18b20_read":false,"dnms_read":false,"dnms_correction":"0.0","lat_gps":"0.0","lon_gps":"0.0","temp_correction":"0.0","gps_read":true,"send2dusti":true,"ssl_dusti":false,"send2madavi":true,"ssl_madavi":false,"send2robonomics":true,"send2sensemap":false,"send2fsapp":false,"send2aircms":false,"send2csv":false,"auto_update":true,"use_beta":false,"has_display":false,"has_sh1106":false,"has_flipped_display":false,"has_lcd1602":false,"has_lcd1602_27":false,"has_lcd2004":false,"has_lcd2004_27":false,"display_wifi_info":true,"display_device_info":true,"debug":3,"sending_intervall_ms":145000,"time_for_wifi_config":600000,"senseboxid":"","send2custom":false,"host_custom":"192.168.234.1","url_custom":"/data.php","port_custom":80,"user_custom":"","pwd_custom":"","ssl_custom":false,"send2influx":false,"host_influx":"influx.server","url_influx":"/write?db=sensorcommunity","port_influx":8086,"user_influx":"","pwd_influx":"","measurement_name_influx":"feinstaub","ssl_influx":false,"donated_by":"","current_reg":"Global"}'
self.configjson = json.loads(configstring)
# ssid = self.wifiSSID.text()
# pw = self.wifiPW.text()
Expand All @@ -401,6 +401,7 @@ def on_wifiButton_clicked(self):
self.configjson['gc_read'] = self.check_Geiger_Counter.isChecked()
self.configjson['ccs811_read'] = self.check_CCS811.isChecked()
self.configjson['ccs811_27_read'] = self.check_CCS811_5B.isChecked()
self.configjson['dbmeter_read'] = self.check_DB_meter.isChecked()
# language = self.languagesList[self.languageBox.currentIndex()]

# if language not in self.languagesList:
Expand Down
40 changes: 27 additions & 13 deletions gui/mainwindow.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'mainwindow.ui'
# Form implementation generated from reading ui file 'gui/mainwindow.ui'
#
# Created by: PyQt5 UI code generator 5.11.2
# Created by: PyQt5 UI code generator 5.15.9
#
# WARNING! All changes made in this file will be lost!
# 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")
Expand All @@ -18,7 +21,7 @@ def setupUi(self, MainWindow):
sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
MainWindow.setSizePolicy(sizePolicy)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap("../assets/logo.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon.addPixmap(QtGui.QPixmap("gui/../assets/logo.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
MainWindow.setWindowIcon(icon)
self.centralwidget = QtWidgets.QWidget(MainWindow)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
Expand Down Expand Up @@ -279,48 +282,59 @@ def setupUi(self, MainWindow):
self.check_CCS811_5B.setSizePolicy(sizePolicy)
self.check_CCS811_5B.setObjectName("check_CCS811_5B")
self.gridLayout_2.addWidget(self.check_CCS811_5B, 21, 1, 1, 1)
self.label_DB_meter = QtWidgets.QLabel(self.programmingTab)
self.label_DB_meter.setObjectName("label_DB_meter")
self.gridLayout_2.addWidget(self.label_DB_meter, 22, 0, 1, 1)
self.check_DB_meter = QtWidgets.QCheckBox(self.programmingTab)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.check_DB_meter.sizePolicy().hasHeightForWidth())
self.check_DB_meter.setSizePolicy(sizePolicy)
self.check_DB_meter.setObjectName("check_DB_meter")
self.gridLayout_2.addWidget(self.check_DB_meter, 22, 1, 1, 1)
self.label_DonatedBy = QtWidgets.QLabel(self.programmingTab)
self.label_DonatedBy.setObjectName("label_DonatedBy")
self.gridLayout_2.addWidget(self.label_DonatedBy, 22, 0, 1, 1)
self.gridLayout_2.addWidget(self.label_DonatedBy, 23, 0, 1, 1)
self.DonatedBy = QtWidgets.QLineEdit(self.programmingTab)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.DonatedBy.sizePolicy().hasHeightForWidth())
self.DonatedBy.setSizePolicy(sizePolicy)
self.DonatedBy.setObjectName("DonatedBy")
self.gridLayout_2.addWidget(self.DonatedBy, 22, 1, 1, 1)
self.gridLayout_2.addWidget(self.DonatedBy, 23, 1, 1, 1)
self.label_spacer3 = QtWidgets.QLabel(self.programmingTab)
self.label_spacer3.setTextFormat(QtCore.Qt.RichText)
self.label_spacer3.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.label_spacer3.setWordWrap(True)
self.label_spacer3.setObjectName("label_spacer3")
self.gridLayout_2.addWidget(self.label_spacer3, 23, 0, 1, 2)
self.gridLayout_2.addWidget(self.label_spacer3, 24, 0, 1, 2)
self.label_progress_config = QtWidgets.QLabel(self.programmingTab)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.label_progress_config.sizePolicy().hasHeightForWidth())
self.label_progress_config.setSizePolicy(sizePolicy)
self.label_progress_config.setObjectName("label_progress_config")
self.gridLayout_2.addWidget(self.label_progress_config, 24, 0, 1, 2)
self.gridLayout_2.addWidget(self.label_progress_config, 25, 0, 1, 2)
self.progressBar_config = QtWidgets.QProgressBar(self.programmingTab)
self.progressBar_config.setObjectName("progressBar_config")
self.gridLayout_2.addWidget(self.progressBar_config, 25, 0, 1, 2)
self.gridLayout_2.addWidget(self.progressBar_config, 26, 0, 1, 2)
self.label_spacer4 = QtWidgets.QLabel(self.programmingTab)
self.label_spacer4.setTextFormat(QtCore.Qt.RichText)
self.label_spacer4.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.label_spacer4.setWordWrap(True)
self.label_spacer4.setObjectName("label_spacer4")
self.gridLayout_2.addWidget(self.label_spacer4, 26, 0, 1, 2)
self.gridLayout_2.addWidget(self.label_spacer4, 27, 0, 1, 2)
self.wifiButton = QtWidgets.QPushButton(self.programmingTab)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.wifiButton.sizePolicy().hasHeightForWidth())
self.wifiButton.setSizePolicy(sizePolicy)
self.wifiButton.setObjectName("wifiButton")
self.gridLayout_2.addWidget(self.wifiButton, 27, 0, 1, 2)
self.gridLayout_2.addWidget(self.wifiButton, 28, 0, 1, 2)
self.expertForm = QtWidgets.QWidget(self.programmingTab)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
Expand Down Expand Up @@ -557,7 +571,7 @@ def setupUi(self, MainWindow):
self.label_6 = QtWidgets.QLabel(self.aboutTab)
self.label_6.setMaximumSize(QtCore.QSize(64, 64))
self.label_6.setText("")
self.label_6.setPixmap(QtGui.QPixmap("../assets/logo.png"))
self.label_6.setPixmap(QtGui.QPixmap("gui/../assets/logo.png"))
self.label_6.setScaledContents(True)
self.label_6.setObjectName("label_6")
self.gridLayout_3.addWidget(self.label_6, 1, 0, 1, 1)
Expand Down Expand Up @@ -609,6 +623,7 @@ def retranslateUi(self, MainWindow):
self.label_Geiger_Counter.setText(_translate("MainWindow", "Geiger Counter"))
self.label_CCS811.setText(_translate("MainWindow", "CCS811"))
self.label_CCS811_5B.setText(_translate("MainWindow", "CCS811_5B"))
self.label_DB_meter.setText(_translate("MainWindow", "Noise Meter"))
self.label_DonatedBy.setText(_translate("MainWindow", "Donated by:"))
self.label_spacer3.setText(_translate("MainWindow", " "))
self.label_progress_config.setText(_translate("MainWindow", "Progress:"))
Expand Down Expand Up @@ -645,4 +660,3 @@ def retranslateUi(self, MainWindow):
self.buildLabel.setText(_translate("MainWindow", "<b>Sensor.Community Airrohr Flasher</b><br/>Build {build_id}"))
self.label_8.setText(_translate("MainWindow", "<html><head/><body><p>Original version developed by <a href=\"https://inf.re/\"><span style=\" text-decoration: underline; color:#0000ff;\">Piotr Dobrowolski</span></a>.</p><p>This software is released under the terms of MIT license. No warranty is provided.</p><p>For newest release see: <a href=\"https://firmware.sensor.community/airrohr/flashing-tool/\"><span style=\" text-decoration: underline; color:#0000ff;\">https://github.com/LoSk-p/airrohr-firmware-flasher/releases/</span></a></p></body></html>"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.aboutTab), _translate("MainWindow", "About"))

31 changes: 25 additions & 6 deletions gui/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -505,13 +505,32 @@
</item>

<item row="22" column="0">
<widget class="QLabel" name="label_DB_meter">
<property name="text">
<string>Noise Meter</string>
</property>
</widget>
</item>

<item row="22" column="1">
<widget class="QCheckBox" name="check_DB_meter">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>

<item row="23" column="0">
<widget class="QLabel" name="label_DonatedBy">
<property name="text">
<string>Donated by:</string>
</property>
</widget>
</item>
<item row="22" column="1">
<item row="23" column="1">
<widget class="QLineEdit" name="DonatedBy">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
Expand All @@ -522,7 +541,7 @@
</widget>
</item>

<item row="23" column="0" colspan="2">
<item row="24" column="0" colspan="2">
<widget class="QLabel" name="label_spacer">
<property name="text">
<string> </string>
Expand All @@ -539,7 +558,7 @@
</widget>
</item>

<item row="24" column="0" colspan="2">
<item row="25" column="0" colspan="2">
<widget class="QLabel" name="label_progress_config">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
Expand All @@ -553,11 +572,11 @@
</widget>
</item>

<item row="25" column="0" colspan="2">
<item row="26" column="0" colspan="2">
<widget class="QProgressBar" name="progressBar_config" />
</item>

<item row="26" column="0" colspan="2">
<item row="27" column="0" colspan="2">
<widget class="QLabel" name="label_spacer">
<property name="text">
<string> </string>
Expand All @@ -574,7 +593,7 @@
</widget>
</item>

<item row="27" column="0" colspan="2">
<item row="28" column="0" colspan="2">
<widget class="QPushButton" name="wifiButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
Expand Down

0 comments on commit 2d7c08d

Please sign in to comment.