Skip to content

Commit

Permalink
Update telecommands, remove unnecessary buttons and add sample alarm …
Browse files Browse the repository at this point in the history
…lights
  • Loading branch information
fthrslntgy committed Jan 28, 2023
1 parent c493cd9 commit 3ced3ea
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 75 deletions.
3 changes: 1 addition & 2 deletions constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
NUM_OF_VARS = 24
TELEMETRY_LEN = 88
TELEMETRY_PERIOD = 1
SAT_STATUS_VARS = ("1. Beklemede", "2. Yükselme", "3. Model uydu iniş ", "4. Ayrılma",
"5. Görev yükü iniş 6", "6. Askıda kalma", "7. Görev yükü iniş 4", "8. Kurtarma")
SAT_STATUS_VARS = ("0. Telekomut yok", "1. Görev Yükü Ayrılma", "2. Görev Yükü Kilitlenme", "3. Uçuşa Hazır" ,"4. Model Uydu İniş" ,"5. Ayrılma", "6. Görev Yükü İniş", "7. Kurtarma")

TELEMETRY_FILE_NAME = "/telemetry.csv"
VIDEO_FILE_NAME = "video.avi"
Expand Down
159 changes: 100 additions & 59 deletions form.ui
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<ui version="4.0">
<class>centralwidget</class>
<widget class="QWidget" name="centralwidget">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
Expand Down Expand Up @@ -139,8 +142,8 @@
<widget class="QPushButton" name="button_servo_open">
<property name="geometry">
<rect>
<x>870</x>
<y>40</y>
<x>990</x>
<y>20</y>
<width>111</width>
<height>24</height>
</rect>
Expand All @@ -152,8 +155,8 @@
<widget class="QPushButton" name="button_servo_close">
<property name="geometry">
<rect>
<x>870</x>
<y>70</y>
<x>990</x>
<y>50</y>
<width>111</width>
<height>24</height>
</rect>
Expand All @@ -166,7 +169,7 @@
<property name="geometry">
<rect>
<x>750</x>
<y>70</y>
<y>60</y>
<width>111</width>
<height>24</height>
</rect>
Expand All @@ -175,25 +178,12 @@
<string>GÖNDER</string>
</property>
</widget>
<widget class="QPushButton" name="button_engine_stop">
<property name="geometry">
<rect>
<x>990</x>
<y>70</y>
<width>111</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string>MOTOR STOP</string>
</property>
</widget>
<widget class="QComboBox" name="combobox_command">
<property name="geometry">
<rect>
<x>750</x>
<y>40</y>
<width>111</width>
<y>10</y>
<width>231</width>
<height>24</height>
</rect>
</property>
Expand All @@ -211,19 +201,6 @@
<string/>
</property>
</widget>
<widget class="QPushButton" name="button_engine_run">
<property name="geometry">
<rect>
<x>990</x>
<y>40</y>
<width>111</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string>MOTOR TAHRİK</string>
</property>
</widget>
<widget class="Line" name="line_8">
<property name="geometry">
<rect>
Expand All @@ -237,32 +214,6 @@
<enum>Qt::Vertical</enum>
</property>
</widget>
<widget class="QLabel" name="label_run_value">
<property name="geometry">
<rect>
<x>750</x>
<y>10</y>
<width>291</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Manuel motor tahrik komutu için değer:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QSpinBox" name="spinbox_value">
<property name="geometry">
<rect>
<x>1020</x>
<y>10</y>
<width>81</width>
<height>24</height>
</rect>
</property>
<property name="maximum">
<number>127</number>
</property>
</widget>
<widget class="QPushButton" name="button_refresh">
<property name="geometry">
<rect>
Expand Down Expand Up @@ -529,6 +480,9 @@
<height>171</height>
</rect>
</property>
<property name="cursor">
<cursorShape>SizeAllCursor</cursorShape>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
Expand All @@ -545,6 +499,12 @@
<height>171</height>
</rect>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
Expand Down Expand Up @@ -692,6 +652,87 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-weight:700; color:#ffffff;&quot;&gt;REALTIME VIDEO CONNECTION&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QPushButton" name="button_caliber">
<property name="geometry">
<rect>
<x>870</x>
<y>60</y>
<width>111</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string>KALİBRE ET</string>
</property>
</widget>
<widget class="QLabel" name="label_alarms">
<property name="geometry">
<rect>
<x>1430</x>
<y>10</y>
<width>101</width>
<height>20</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(148, 0, 0);</string>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-weight:600; color:#ffffff;&quot;&gt;Alarmlar&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QPushButton" name="button_alarm1">
<property name="geometry">
<rect>
<x>1520</x>
<y>40</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="button_alarm2">
<property name="geometry">
<rect>
<x>1520</x>
<y>60</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_alarm1">
<property name="geometry">
<rect>
<x>1420</x>
<y>40</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;Alarm 1:&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="label_alarm2">
<property name="geometry">
<rect>
<x>1420</x>
<y>60</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;Alarm 2:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
Expand Down
Binary file added images/alarm_ok.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/alarm_warning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 12 additions & 14 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,22 +108,18 @@ def __init__(self, parent=None):
self.label_status.setAlignment(Qt.AlignCenter)
self.label_timer.setAlignment(Qt.AlignCenter)
self.label_timer.setStyleSheet("background-color: black; color: red; font-size: 14px;font-weight: bold;")
self.spinbox_value.setStyleSheet("background-color: white; color: black;")

self.button_send_command.setStyleSheet("color: black;")
self.button_servo_open.setStyleSheet("color: black;")
self.button_servo_close.setStyleSheet("color: black;")
self.button_engine_run.setStyleSheet("color: black;")
self.button_engine_stop.setStyleSheet("color: black;")
self.button_caliber.setStyleSheet("color: black;")
self.combobox_command.setStyleSheet("color: black;")

for element in cns.SAT_STATUS_VARS:
self.combobox_command.addItem(element)
self.button_send_command.clicked.connect(lambda: self.telecommand.sendTelecommand(self.combobox_command.currentText()))
self.button_servo_open.clicked.connect(self.telecommand.sendServoOpen)
self.button_servo_close.clicked.connect(self.telecommand.sendServoClose)
self.button_engine_run.clicked.connect(lambda: self.telecommand.sendEngineRun(self.spinbox_value.value()))
self.button_engine_stop.clicked.connect(self.telecommand.sendEngineStop)

# Video send components
self.button_select_video.clicked.connect(self.uploadVideo)
Expand All @@ -135,6 +131,14 @@ def __init__(self, parent=None):
self.button_select_video.setStyleSheet("color: black;")
self.button_send_video.setStyleSheet("background-color: green; color: black;")

## Alarm components
# self.button_alarm1.setIcon(QIcon("images/alarm_ok.png"))
self.button_alarm1.setStyleSheet("background-color: green;")
# self.button_alarm2.setIcon(QIcon("images/alarm_warning.png"))
self.button_alarm2.setStyleSheet("background-color: red;")
self.button_alarm1.setEnabled(False)
self.button_alarm2.setEnabled(False)

# Logo component
pixmap_tulpar = QPixmap('images/logo_tulpar.png')
self.label_logo_tulpar.setPixmap(pixmap_tulpar)
Expand Down Expand Up @@ -223,23 +227,19 @@ def updateButtons(self):

if tele_connected:
self.button_connection_tele.setStyleSheet("background-color: red")
self.spinbox_value.setEnabled(True)
self.combobox_command.setEnabled(True)
self.button_send_command.setEnabled(True)
self.button_servo_open.setEnabled(True)
self.button_servo_close.setEnabled(True)
self.button_engine_run.setEnabled(True)
self.button_engine_stop.setEnabled(True)
self.button_caliber.setEnabled(True)

else:
self.button_connection_tele.setStyleSheet("background-color: green")
self.spinbox_value.setEnabled(False)
self.combobox_command.setEnabled(False)
self.button_send_command.setEnabled(False)
self.button_servo_open.setEnabled(False)
self.button_servo_close.setEnabled(False)
self.button_engine_run.setEnabled(False)
self.button_engine_stop.setEnabled(False)
self.button_caliber.setEnabled(False)

else:
self.button_connection.setStyleSheet("background-color: green")
Expand All @@ -250,13 +250,11 @@ def updateButtons(self):

self.button_connection_tele.setEnabled(False)
self.button_connection_tele.setStyleSheet("background-color: None")
self.spinbox_value.setEnabled(False)
self.combobox_command.setEnabled(False)
self.button_send_command.setEnabled(False)
self.button_servo_open.setEnabled(False)
self.button_servo_close.setEnabled(False)
self.button_engine_run.setEnabled(False)
self.button_engine_stop.setEnabled(False)
self.button_caliber.setEnabled(False)

def refreshPorts(self):

Expand Down

0 comments on commit 3ced3ea

Please sign in to comment.