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
Show 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 {
...
@@ -41,7 +41,7 @@ QGCView {
QGCPalette
{
id
:
palette
;
colorGroupEnabled
:
panel
.
enabled
}
QGCPalette
{
id
:
palette
;
colorGroupEnabled
:
panel
.
enabled
}
property
int
_firstColumn
:
ScreenTools
.
defaultFontPixelWidth
*
20
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
"
)
readonly
property
string
dialogTitle
:
qsTr
(
"
controller WiFi Bridge
"
)
property
int
stStatus
:
XMLHttpRequest
.
UNSENT
property
int
stStatus
:
XMLHttpRequest
.
UNSENT
property
int
stErrorCount
:
0
property
int
stErrorCount
:
0
...
@@ -64,15 +64,19 @@ QGCView {
...
@@ -64,15 +64,19 @@ QGCView {
function
updateStatus
()
{
function
updateStatus
()
{
timer
.
stop
()
timer
.
stop
()
var
req
=
new
XMLHttpRequest
;
var
req
=
new
XMLHttpRequest
;
var
url
=
"
http://192.168.4.1/status.json
"
var
url
=
"
http://
"
url
+=
controller
.
wifiIPAddress
url
+=
"
/status.json
"
if
(
stResetCounters
)
{
if
(
stResetCounters
)
{
url
=
url
+
"
?r=1
"
url
=
url
+
"
?r=1
"
stResetCounters
=
false
stResetCounters
=
false
}
}
console
.
log
(
url
)
req
.
open
(
"
GET
"
,
url
);
req
.
open
(
"
GET
"
,
url
);
req
.
onreadystatechange
=
function
()
{
req
.
onreadystatechange
=
function
()
{
stStatus
=
req
.
readyState
;
stStatus
=
req
.
readyState
;
if
(
stStatus
===
XMLHttpRequest
.
DONE
)
{
if
(
stStatus
===
XMLHttpRequest
.
DONE
)
{
console
.
log
(
req
.
responseText
)
var
objectArray
=
JSON
.
parse
(
req
.
responseText
);
var
objectArray
=
JSON
.
parse
(
req
.
responseText
);
if
(
objectArray
.
errors
!==
undefined
)
{
if
(
objectArray
.
errors
!==
undefined
)
{
console
.
log
(
qsTr
(
"
Error fetching WiFi Bridge Status: %1
"
).
arg
(
objectArray
.
errors
[
0
].
message
))
console
.
log
(
qsTr
(
"
Error fetching WiFi Bridge Status: %1
"
).
arg
(
objectArray
.
errors
[
0
].
message
))
...
@@ -107,6 +111,7 @@ QGCView {
...
@@ -107,6 +111,7 @@ QGCView {
timer
.
triggered
.
connect
(
updateStatus
)
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
wifiChannel
:
controller
.
getParameterFact
(
controller
.
componentID
,
"
WIFI_CHANNEL
"
)
property
Fact
hostPort
:
controller
.
getParameterFact
(
controller
.
componentID
,
"
WIFI_UDP_HPORT
"
)
property
Fact
hostPort
:
controller
.
getParameterFact
(
controller
.
componentID
,
"
WIFI_UDP_HPORT
"
)
property
Fact
clientPort
:
controller
.
getParameterFact
(
controller
.
componentID
,
"
WIFI_UDP_CPORT
"
)
property
Fact
clientPort
:
controller
.
getParameterFact
(
controller
.
componentID
,
"
WIFI_UDP_CPORT
"
)
...
@@ -149,6 +154,24 @@ QGCView {
...
@@ -149,6 +154,24 @@ QGCView {
id
:
wifiCol
id
:
wifiCol
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
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
{
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
QGCLabel
{
...
@@ -159,6 +182,7 @@ QGCView {
...
@@ -159,6 +182,7 @@ QGCView {
QGCComboBox
{
QGCComboBox
{
id
:
channelField
id
:
channelField
width
:
_secondColumn
width
:
_secondColumn
enabled
:
wifiMode
&&
wifiMode
.
value
===
0
model
:
controller
.
wifiChannels
model
:
controller
.
wifiChannels
currentIndex
:
wifiChannel
?
wifiChannel
.
value
-
1
:
0
currentIndex
:
wifiChannel
?
wifiChannel
.
value
-
1
:
0
onActivated
:
{
onActivated
:
{
...
...
src/AutoPilotPlugins/Common/ESP8266ComponentController.cc
View file @
275ea54a
...
@@ -74,6 +74,21 @@ ESP8266ComponentController::version()
...
@@ -74,6 +74,21 @@ ESP8266ComponentController::version()
return
versionString
;
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
QString
ESP8266ComponentController
::
wifiSSID
()
ESP8266ComponentController
::
wifiSSID
()
...
...
src/AutoPilotPlugins/Common/ESP8266ComponentController.h
View file @
275ea54a
...
@@ -52,6 +52,7 @@ public:
...
@@ -52,6 +52,7 @@ public:
Q_PROPERTY
(
int
componentID
READ
componentID
CONSTANT
)
Q_PROPERTY
(
int
componentID
READ
componentID
CONSTANT
)
Q_PROPERTY
(
QString
version
READ
version
NOTIFY
versionChanged
)
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
wifiSSID
READ
wifiSSID
WRITE
setWifiSSID
NOTIFY
wifiSSIDChanged
)
Q_PROPERTY
(
QString
wifiPassword
READ
wifiPassword
WRITE
setWifiPassword
NOTIFY
wifiPasswordChanged
)
Q_PROPERTY
(
QString
wifiPassword
READ
wifiPassword
WRITE
setWifiPassword
NOTIFY
wifiPasswordChanged
)
Q_PROPERTY
(
QStringList
wifiChannels
READ
wifiChannels
CONSTANT
)
Q_PROPERTY
(
QStringList
wifiChannels
READ
wifiChannels
CONSTANT
)
...
@@ -65,6 +66,7 @@ public:
...
@@ -65,6 +66,7 @@ public:
int
componentID
()
{
return
MAV_COMP_ID_UDP_BRIDGE
;
}
int
componentID
()
{
return
MAV_COMP_ID_UDP_BRIDGE
;
}
QString
version
();
QString
version
();
QString
wifiIPAddress
();
QString
wifiSSID
();
QString
wifiSSID
();
QString
wifiPassword
();
QString
wifiPassword
();
QStringList
wifiChannels
()
{
return
_channels
;
}
QStringList
wifiChannels
()
{
return
_channels
;
}
...
@@ -100,6 +102,7 @@ private:
...
@@ -100,6 +102,7 @@ private:
QTimer
_timer
;
QTimer
_timer
;
QStringList
_channels
;
QStringList
_channels
;
QStringList
_baudRates
;
QStringList
_baudRates
;
QString
_ipAddress
;
enum
{
enum
{
WAIT_FOR_NOTHING
,
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