Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Labor Systemanalyse und Optimierung
mBot
mBot Konsole
Commits
273c4df9
Commit
273c4df9
authored
Oct 05, 2022
by
B-OURGER
Browse files
erstellen einer Serial verbindungsmoeglichkeit
parent
ec3b1da0
Changes
3
Hide whitespace changes
Inline
Side-by-side
mBot_Konsole/konsole.cpp
View file @
273c4df9
...
...
@@ -30,7 +30,7 @@ void Konsole::init_Nachricht(){ //Init Nachricht, die in der UI im Konsolenberei
void
Konsole
::
on_bt_verbinden_clicked
()
{
if
(
ui
->
c
b_serial
->
isChecked
()
==
true
)
{
if
(
ui
->
r
b_serial
->
isChecked
()
==
true
)
{
serialFile
.
setFileName
(
ui
->
tf_port
->
text
());
if
(
!
serialFile
.
open
(
QIODevice
::
ReadWrite
|
QIODevice
::
Text
))
{
qDebug
()
<<
"nicht verbunden"
;
...
...
@@ -71,7 +71,7 @@ QString Konsole::updateKonsole(){
connectionSucc
();
firstrun
=
false
;
}
if
(
ui
->
c
b_serial
->
isChecked
()
==
true
)
{
if
(
ui
->
r
b_serial
->
isChecked
()
==
true
)
{
QByteArray
line
=
serialFile
.
readLine
();
QString
lineToChop
=
QString
(
line
);
lineToChop
.
remove
(
"
\n
"
,
Qt
::
CaseInsensitive
);
...
...
@@ -104,7 +104,7 @@ void Konsole::sendCommand(QString command_str){ //Sendet Nachricht an IP und POR
ui
->
tf_konsole
->
append
(
helptext
);
return
;
}
if
(
ui
->
c
b_serial
->
isChecked
()
==
true
)
{
if
(
ui
->
r
b_serial
->
isChecked
()
==
true
)
{
QTextStream
out
(
&
serialFile
);
QString
message
=
QString
::
number
(
commandID
)
+
" "
+
command_str
+
" ;"
;
out
<<
message
;
...
...
@@ -258,17 +258,20 @@ void Konsole::on_slider_speed_sliderReleased()
sendCommand
(
"SP "
+
ui
->
lb_speed
->
text
());
}
// aendert die Sichtbarkeit der Elemente in dem UI
void
Konsole
::
on_cb_serial_stateChanged
(
int
arg1
)
void
Konsole
::
on_rb_serial_clicked
()
{
if
(
arg1
==
2
)
{
ui
->
tf_ipaddr
->
setEnabled
(
false
);
ui
->
bt_autoconnect
->
setEnabled
(
false
);
ui
->
tf_port
->
setText
(
"/dev/ttyUSB0"
);
}
else
{
ui
->
tf_ipaddr
->
setEnabled
(
true
);
ui
->
bt_autoconnect
->
setEnabled
(
true
);
ui
->
tf_port
->
setText
(
"1025"
);
}
ui
->
tf_port
->
setEnabled
(
true
);
ui
->
tf_ipaddr
->
setEnabled
(
false
);
ui
->
bt_autoconnect
->
setEnabled
(
false
);
ui
->
tf_port
->
setText
(
"/dev/ttyUSB0"
);
//ui->tf_port->setText("/dev/cu.usbserial-131210");
}
void
Konsole
::
on_rb_wifi_clicked
()
{
ui
->
tf_port
->
setEnabled
(
true
);
ui
->
tf_ipaddr
->
setEnabled
(
true
);
ui
->
bt_autoconnect
->
setEnabled
(
true
);
ui
->
tf_port
->
setText
(
"1025"
);
}
mBot_Konsole/konsole.h
View file @
273c4df9
...
...
@@ -49,7 +49,9 @@ private slots:
void
on_slider_speed_sliderReleased
();
void
on_cb_serial_stateChanged
(
int
arg1
);
void
on_rb_serial_clicked
();
void
on_rb_wifi_clicked
();
private:
Ui
::
Konsole
*
ui
;
...
...
mBot_Konsole/konsole.ui
View file @
273c4df9
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
96
3
</width>
<height>
6
2
1
</height>
<width>
96
0
</width>
<height>
61
6
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
@@ -486,10 +486,45 @@ Winkel pro click:</string>
</widget>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"cb_serial"
>
<property
name=
"text"
>
<string>
Serial Communication
</string>
<widget
class=
"QGroupBox"
name=
"groupBox_2"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
60
</height>
</size>
</property>
<property
name=
"title"
>
<string>
Communication
</string>
</property>
<widget
class=
"QWidget"
name=
"horizontalLayoutWidget"
>
<property
name=
"geometry"
>
<rect>
<x>
10
</x>
<y>
20
</y>
<width>
431
</width>
<height>
41
</height>
</rect>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_6"
>
<item>
<widget
class=
"QRadioButton"
name=
"rb_wifi"
>
<property
name=
"text"
>
<string>
WiFi
</string>
</property>
<property
name=
"checked"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QRadioButton"
name=
"rb_serial"
>
<property
name=
"text"
>
<string>
Serial
</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
...
...
@@ -502,8 +537,8 @@ Winkel pro click:</string>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
96
3
</width>
<height>
2
2
</height>
<width>
96
0
</width>
<height>
2
4
</height>
</rect>
</property>
</widget>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment