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
275ea54a
Commit
275ea54a
authored
Apr 30, 2016
by
dogmaphobic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for new firmware.
Added setting to set the WiFi mode (AP or Station)
parent
c5a25cf7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
20 deletions
+62
-20
ESP8266Component.qml
src/AutoPilotPlugins/Common/ESP8266Component.qml
+28
-4
ESP8266ComponentController.cc
src/AutoPilotPlugins/Common/ESP8266ComponentController.cc
+22
-7
ESP8266ComponentController.h
src/AutoPilotPlugins/Common/ESP8266ComponentController.h
+12
-9
No files found.
src/AutoPilotPlugins/Common/ESP8266Component.qml
View file @
275ea54a
...
...
@@ -41,7 +41,7 @@ QGCView {
QGCPalette
{
id
:
palette
;
colorGroupEnabled
:
panel
.
enabled
}
property
int
_firstColumn
:
ScreenTools
.
defaultFontPixelWidth
*
20
property
int
_secondColumn
:
ScreenTools
.
defaultFontPixelWidth
*
1
2
property
int
_secondColumn
:
ScreenTools
.
defaultFontPixelWidth
*
1
8
readonly
property
string
dialogTitle
:
qsTr
(
"
controller WiFi Bridge
"
)
property
int
stStatus
:
XMLHttpRequest
.
UNSENT
property
int
stErrorCount
:
0
...
...
@@ -64,15 +64,19 @@ QGCView {
function
updateStatus
()
{
timer
.
stop
()
var
req
=
new
XMLHttpRequest
;
var
url
=
"
http://192.168.4.1/status.json
"
var
url
=
"
http://
"
url
+=
controller
.
wifiIPAddress
url
+=
"
/status.json
"
if
(
stResetCounters
)
{
url
=
url
+
"
?r=1
"
stResetCounters
=
false
}
console
.
log
(
url
)
req
.
open
(
"
GET
"
,
url
);
req
.
onreadystatechange
=
function
()
{
stStatus
=
req
.
readyState
;
if
(
stStatus
===
XMLHttpRequest
.
DONE
)
{
console
.
log
(
req
.
responseText
)
var
objectArray
=
JSON
.
parse
(
req
.
responseText
);
if
(
objectArray
.
errors
!==
undefined
)
{
console
.
log
(
qsTr
(
"
Error fetching WiFi Bridge Status: %1
"
).
arg
(
objectArray
.
errors
[
0
].
message
))
...
...
@@ -107,6 +111,7 @@ QGCView {
timer
.
triggered
.
connect
(
updateStatus
)
}
property
Fact
wifiMode
:
controller
.
getParameterFact
(
controller
.
componentID
,
"
WIFI_MODE
"
,
false
)
//-- Don't bitch about missing as this is new
property
Fact
wifiChannel
:
controller
.
getParameterFact
(
controller
.
componentID
,
"
WIFI_CHANNEL
"
)
property
Fact
hostPort
:
controller
.
getParameterFact
(
controller
.
componentID
,
"
WIFI_UDP_HPORT
"
)
property
Fact
clientPort
:
controller
.
getParameterFact
(
controller
.
componentID
,
"
WIFI_UDP_CPORT
"
)
...
...
@@ -149,6 +154,24 @@ QGCView {
id
:
wifiCol
anchors.verticalCenter
:
parent
.
verticalCenter
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
Row
{
visible
:
wifiMode
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
text
:
qsTr
(
"
WiFi Mode
"
)
width
:
_firstColumn
anchors.baseline
:
modeField
.
baseline
}
QGCComboBox
{
id
:
modeField
width
:
_secondColumn
model
:
[
"
Access Point Mode
"
,
"
Station Mode
"
]
currentIndex
:
wifiMode
?
wifiMode
.
value
:
0
onActivated
:
{
wifiMode
.
value
=
index
}
}
}
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
...
...
@@ -159,6 +182,7 @@ QGCView {
QGCComboBox
{
id
:
channelField
width
:
_secondColumn
enabled
:
wifiMode
&&
wifiMode
.
value
===
0
model
:
controller
.
wifiChannels
currentIndex
:
wifiChannel
?
wifiChannel
.
value
-
1
:
0
onActivated
:
{
...
...
@@ -395,8 +419,8 @@ QGCView {
}
}
QGCButton
{
text
:
stEnabled
?
qsTr
(
"
Hide Status
"
)
:
qsTr
(
"
Show Status
"
)
width
:
ScreenTools
.
defaultFontPixelWidth
*
16
text
:
stEnabled
?
qsTr
(
"
Hide Status
"
)
:
qsTr
(
"
Show Status
"
)
width
:
ScreenTools
.
defaultFontPixelWidth
*
16
onClicked
:
{
stEnabled
=
!
stEnabled
if
(
stEnabled
)
...
...
src/AutoPilotPlugins/Common/ESP8266ComponentController.cc
View file @
275ea54a
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
...
...
@@ -74,6 +74,21 @@ ESP8266ComponentController::version()
return
versionString
;
}
//-----------------------------------------------------------------------------
QString
ESP8266ComponentController
::
wifiIPAddress
()
{
if
(
_ipAddress
.
isEmpty
())
{
if
(
parameterExists
(
MAV_COMP_ID_UDP_BRIDGE
,
"WIFI_IPADDRESS"
))
{
QHostAddress
address
(
ntohl
(
getParameterFact
(
MAV_COMP_ID_UDP_BRIDGE
,
"WIFI_IPADDRESS"
)
->
rawValue
().
toUInt
()));
_ipAddress
=
address
.
toString
();
}
else
{
_ipAddress
=
"192.168.4.1"
;
}
}
return
_ipAddress
;
}
//-----------------------------------------------------------------------------
QString
ESP8266ComponentController
::
wifiSSID
()
...
...
src/AutoPilotPlugins/Common/ESP8266ComponentController.h
View file @
275ea54a
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
...
...
@@ -45,26 +45,28 @@ namespace Ui {
class
ESP8266ComponentController
:
public
FactPanelController
{
Q_OBJECT
public:
ESP8266ComponentController
();
~
ESP8266ComponentController
();
Q_PROPERTY
(
int
componentID
READ
componentID
CONSTANT
)
Q_PROPERTY
(
QString
version
READ
version
NOTIFY
versionChanged
)
Q_PROPERTY
(
QString
wifiIPAddress
READ
wifiIPAddress
CONSTANT
)
Q_PROPERTY
(
QString
wifiSSID
READ
wifiSSID
WRITE
setWifiSSID
NOTIFY
wifiSSIDChanged
)
Q_PROPERTY
(
QString
wifiPassword
READ
wifiPassword
WRITE
setWifiPassword
NOTIFY
wifiPasswordChanged
)
Q_PROPERTY
(
QStringList
wifiChannels
READ
wifiChannels
CONSTANT
)
Q_PROPERTY
(
QStringList
baudRates
READ
baudRates
CONSTANT
)
Q_PROPERTY
(
int
baudIndex
READ
baudIndex
WRITE
setBaudIndex
NOTIFY
baudIndexChanged
)
Q_PROPERTY
(
bool
busy
READ
busy
NOTIFY
busyChanged
)
Q_PROPERTY
(
Vehicle
*
vehicle
READ
vehicle
CONSTANT
)
Q_PROPERTY
(
Vehicle
*
vehicle
READ
vehicle
CONSTANT
)
Q_INVOKABLE
void
restoreDefaults
();
Q_INVOKABLE
void
reboot
();
int
componentID
()
{
return
MAV_COMP_ID_UDP_BRIDGE
;
}
QString
version
();
QString
wifiIPAddress
();
QString
wifiSSID
();
QString
wifiPassword
();
QStringList
wifiChannels
()
{
return
_channels
;
}
...
...
@@ -100,6 +102,7 @@ private:
QTimer
_timer
;
QStringList
_channels
;
QStringList
_baudRates
;
QString
_ipAddress
;
enum
{
WAIT_FOR_NOTHING
,
...
...
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