Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
d8229281
Commit
d8229281
authored
Jul 29, 2013
by
Bill Bonney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Terminal Console: Added APM mode to send reset and send the break to enable the CLI on connect
parent
d86262ee
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
13 deletions
+44
-13
terminalconsole.cpp
src/ui/configuration/terminalconsole.cpp
+38
-2
terminalconsole.h
src/ui/configuration/terminalconsole.h
+5
-0
terminalconsole.ui
src/ui/configuration/terminalconsole.ui
+1
-11
No files found.
src/ui/configuration/terminalconsole.cpp
View file @
d8229281
...
...
@@ -50,7 +50,8 @@ This file is part of the APM_PLANNER project
TerminalConsole
::
TerminalConsole
(
QWidget
*
parent
)
:
QWidget
(
parent
),
ui
(
new
Ui
::
TerminalConsole
)
ui
(
new
Ui
::
TerminalConsole
),
m_consoleMode
(
APM
)
{
ui
->
setupUi
(
this
);
...
...
@@ -71,6 +72,7 @@ TerminalConsole::TerminalConsole(QWidget *parent) :
ui
->
disconnectButton
->
setEnabled
(
false
);
ui
->
settingsButton
->
setEnabled
(
true
);
addBaudComboBoxConfig
();
fillPortsInfo
(
*
ui
->
linkComboBox
);
...
...
@@ -82,12 +84,18 @@ TerminalConsole::TerminalConsole(QWidget *parent) :
ui
->
linkComboBox
->
setCurrentIndex
(
0
);
}
//setUiControls(m_settingsDialog
);
addConsoleModesComboBoxConfig
(
);
initConnections
();
}
void
TerminalConsole
::
addBaudComboBoxConfig
()
{
ui
->
consoleModeBox
->
addItem
(
QLatin1String
(
"APM"
),
APM
);
ui
->
consoleModeBox
->
addItem
(
QLatin1String
(
"PX4"
),
PX4
);
}
void
TerminalConsole
::
addConsoleModesComboBoxConfig
()
{
ui
->
baudComboBox
->
addItem
(
QLatin1String
(
"115200"
),
QSerialPort
::
Baud115200
);
ui
->
baudComboBox
->
addItem
(
QLatin1String
(
"57600"
),
QSerialPort
::
Baud57600
);
...
...
@@ -147,6 +155,8 @@ void TerminalConsole::openSerialPort(const SerialSettings &settings)
qDebug
()
<<
"Open Terminal Console Serial Port"
;
writeSettings
();
// Save last successful connection
sendResetCommand
();
}
else
{
m_serial
->
close
();
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
m_serial
->
errorString
());
...
...
@@ -170,6 +180,15 @@ void TerminalConsole::closeSerialPort()
m_statusBar
->
showMessage
(
tr
(
"Disconnected"
));
}
void
TerminalConsole
::
sendResetCommand
()
{
if
(
m_serial
->
isOpen
())
{
m_serial
->
setDataTerminalReady
(
true
);
m_serial
->
waitForBytesWritten
(
250
);
m_serial
->
setDataTerminalReady
(
false
);
}
}
void
TerminalConsole
::
writeData
(
const
QByteArray
&
data
)
{
// qDebug() << "writeData:" << data;
...
...
@@ -181,6 +200,23 @@ void TerminalConsole::readData()
QByteArray
data
=
m_serial
->
readAll
();
// qDebug() << "readData:" << data;
m_console
->
putData
(
data
);
switch
(
m_consoleMode
)
{
case
APM
:
// APM
// On reset, send the break sequence and display help
if
(
data
.
contains
(
"ENTER 3"
))
{
m_serial
->
write
(
"
\r\r\r
"
);
m_serial
->
waitForBytesWritten
(
10
);
m_serial
->
write
(
"HELP
\r
"
);
}
break
;
case
PX4
:
// Do nothing
default:
qDebug
()
<<
"Mode not yet implemented"
;
}
}
void
TerminalConsole
::
handleError
(
QSerialPort
::
SerialPortError
error
)
...
...
src/ui/configuration/terminalconsole.h
View file @
d8229281
...
...
@@ -54,6 +54,8 @@ class TerminalConsole : public QWidget
{
Q_OBJECT
public:
enum
ConsoleMode
{
APM
,
PX4
};
public:
explicit
TerminalConsole
(
QWidget
*
parent
=
0
);
~
TerminalConsole
();
...
...
@@ -64,6 +66,7 @@ private slots:
void
closeSerialPort
();
void
writeData
(
const
QByteArray
&
data
);
void
readData
();
void
sendResetCommand
();
void
handleError
(
QSerialPort
::
SerialPortError
error
);
...
...
@@ -75,6 +78,7 @@ private:
void
initConnections
();
void
addBaudComboBoxConfig
();
void
fillPortsInfo
(
QComboBox
&
comboxBox
);
void
addConsoleModesComboBoxConfig
();
void
writeSettings
();
void
loadSettings
();
...
...
@@ -87,6 +91,7 @@ private:
SettingsDialog
*
m_settingsDialog
;
QSerialPort
*
m_serial
;
SerialSettings
m_settings
;
ConsoleMode
m_consoleMode
;
};
#endif // TERMINALCONSOLE_H
src/ui/configuration/terminalconsole.ui
View file @
d8229281
...
...
@@ -126,7 +126,7 @@
</widget>
</item>
<item
alignment=
"Qt::AlignRight"
>
<widget
class=
"QComboBox"
name=
"
fmuCombo
Box"
>
<widget
class=
"QComboBox"
name=
"
consoleMode
Box"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Minimum"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
...
...
@@ -139,16 +139,6 @@
<height>
0
</height>
</size>
</property>
<item>
<property
name=
"text"
>
<string>
APM
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
PX4
</string>
</property>
</item>
</widget>
</item>
<item>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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