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
bc2ce1ab
Commit
bc2ce1ab
authored
Jul 17, 2013
by
Bill Bonney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix to make Baud and PortName update when changed
parent
a12f68ca
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
5 deletions
+31
-5
ApmToolBar.qml
qml/ApmToolBar.qml
+6
-3
SerialLink.cc
src/comm/SerialLink.cc
+20
-2
SerialLink.h
src/comm/SerialLink.h
+3
-0
apmtoolbar.cpp
src/ui/apmtoolbar.cpp
+2
-0
No files found.
qml/ApmToolBar.qml
View file @
bc2ce1ab
...
...
@@ -10,7 +10,7 @@ Rectangle {
property
alias
baudrateLabel
:
baudrate
.
label
property
bool
connected
:
false
width
:
1024
<
parent
.
width
?
1024
:
parent
.
width
width
:
toolbar
.
width
height
:
72
color
:
"
black
"
border.color
:
"
black
"
...
...
@@ -19,9 +19,11 @@ Rectangle {
if
(
connected
){
console
.
log
(
"
APM Tool BAR QML: connected
"
)
connectButton
.
image
=
"
./resources/apmplanner/toolbar/disconnect.png
"
connectButton
.
label
=
"
CONNECT
"
}
else
{
console
.
log
(
"
APM Tool BAR QML: disconnected
"
)
connectButton
.
image
=
"
./resources/apmplanner/toolbar/connect.png
"
connectButton
.
label
=
"
DISCONNECT
"
}
}
...
...
@@ -83,7 +85,7 @@ Rectangle {
}
Button
{
id
:
simu
al
tionView
id
:
simu
la
tionView
label
:
"
SIMULATION
"
image
:
"
./resources/apmplanner/toolbar/simulation.png
"
onClicked
:
globalObj
.
triggerSimulationView
()
...
...
@@ -102,6 +104,8 @@ Rectangle {
color
:
"
black
"
}
// [BB] Commented out ToolBar Status info work.
// WIP: To be fixed later
// DigitalDisplay { // Information Pane
// title:"Mode"
// textValue: "Stabilize"
...
...
@@ -169,7 +173,6 @@ Rectangle {
}
Rectangle
{
// Spacer
anchors.right
:
parent
.
right
width
:
5
height
:
parent
.
height
color
:
"
black
"
...
...
src/comm/SerialLink.cc
View file @
bc2ce1ab
...
...
@@ -97,7 +97,14 @@ QVector<QString>* SerialLink::getCurrentPorts()
m_ports
->
clear
();
// Example use QSerialPortInfo
// [TODO] make this thread safe
foreach
(
const
QSerialPortInfo
&
info
,
QSerialPortInfo
::
availablePorts
())
QList
<
QSerialPortInfo
>
portList
=
QSerialPortInfo
::
availablePorts
();
if
(
portList
.
count
()
==
0
){
qDebug
()
<<
"No Ports Found"
<<
m_ports
;
}
foreach
(
const
QSerialPortInfo
&
info
,
portList
)
{
// qDebug() << "PortName : " << info.portName()
// << "Description : " << info.description();
...
...
@@ -706,6 +713,7 @@ bool SerialLink::setPortName(QString portName)
m_port
->
setPortName
(
portName
);
emit
nameChanged
(
m_portName
);
// [TODO] maybe we can eliminate this
emit
updateLink
(
this
);
return
accepted
;
}
return
false
;
...
...
@@ -716,12 +724,15 @@ bool SerialLink::setBaudRateType(int rateIndex)
{
Q_ASSERT_X
(
m_port
!=
NULL
,
"setBaudRateType"
,
"m_port is NULL"
);
// These minimum and maximum baud rates were based on those enumerated in qserialport.h
bool
result
;
const
int
minBaud
=
(
int
)
QSerialPort
::
Baud1200
;
const
int
maxBaud
=
(
int
)
QSerialPort
::
Baud115200
;
if
(
m_port
&&
(
rateIndex
>=
minBaud
&&
rateIndex
<=
maxBaud
))
{
return
m_port
->
setBaudRate
(
static_cast
<
QSerialPort
::
BaudRate
>
(
rateIndex
));
result
=
m_port
->
setBaudRate
(
static_cast
<
QSerialPort
::
BaudRate
>
(
rateIndex
));
emit
updateLink
(
this
);
return
result
;
}
return
false
;
...
...
@@ -743,6 +754,7 @@ bool SerialLink::setBaudRate(int rate)
accepted
=
true
;
if
(
m_port
)
accepted
=
m_port
->
setBaudRate
(
rate
);
emit
updateLink
(
this
);
}
return
accepted
;
}
...
...
@@ -755,6 +767,7 @@ bool SerialLink::setFlowType(int flow)
accepted
=
true
;
if
(
m_port
)
accepted
=
m_port
->
setFlowControl
(
static_cast
<
QSerialPort
::
FlowControl
>
(
flow
));
emit
updateLink
(
this
);
}
return
accepted
;
}
...
...
@@ -784,6 +797,7 @@ bool SerialLink::setParityType(int parity)
accepted
=
false
;
break
;
}
emit
updateLink
(
this
);
}
}
return
accepted
;
...
...
@@ -798,6 +812,7 @@ bool SerialLink::setDataBits(int dataBits)
accepted
=
true
;
if
(
m_port
)
accepted
=
m_port
->
setDataBits
(
static_cast
<
QSerialPort
::
DataBits
>
(
dataBits
));
emit
updateLink
(
this
);
}
return
accepted
;
}
...
...
@@ -811,6 +826,7 @@ bool SerialLink::setStopBits(int stopBits)
accepted
=
true
;
if
(
m_port
)
accepted
=
m_port
->
setStopBits
(
static_cast
<
QSerialPort
::
StopBits
>
(
stopBits
));
emit
updateLink
(
this
);
}
return
accepted
;
}
...
...
@@ -823,6 +839,7 @@ bool SerialLink::setDataBitsType(int dataBits)
accepted
=
true
;
if
(
m_port
)
accepted
=
m_port
->
setDataBits
(
static_cast
<
QSerialPort
::
DataBits
>
(
dataBits
));
emit
updateLink
(
this
);
}
return
accepted
;
}
...
...
@@ -835,6 +852,7 @@ bool SerialLink::setStopBitsType(int stopBits)
accepted
=
true
;
if
(
m_port
)
accepted
=
m_port
->
setStopBits
(
static_cast
<
QSerialPort
::
StopBits
>
(
stopBits
));
emit
updateLink
(
this
);
}
return
accepted
;
}
src/comm/SerialLink.h
View file @
bc2ce1ab
...
...
@@ -112,6 +112,9 @@ public:
bool
isFullDuplex
();
int
getId
();
signals:
//[TODO] Refactor to Linkinterface
void
updateLink
(
LinkInterface
*
);
public
slots
:
bool
setPortName
(
QString
portName
);
bool
setBaudRate
(
int
rate
);
...
...
src/ui/apmtoolbar.cpp
View file @
bc2ce1ab
...
...
@@ -143,6 +143,8 @@ void APMToolBar::showConnectionDialog()
if
(
link
&&
LinkManager
::
instance
()
->
getLinks
().
count
()
>=
3
)
{
// Serial Link so prompt to config it
connect
(
link
,
SIGNAL
(
updateLink
(
LinkInterface
*
)),
this
,
SLOT
(
updateLinkDisplay
(
LinkInterface
*
)));
result
=
MainWindow
::
instance
()
->
configLink
(
link
);
if
(
!
result
)
...
...
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