Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tk joystick status #11566

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,7 @@ Qt*-linux*.tar.*
# vitepress - user guide
node_modules/
docs/.vitepress/cache/
docs/.vitepress/dist/
docs/.vitepress/dist/

# all zip builds
*.zip
2 changes: 1 addition & 1 deletion libs/OpenSSL/android_openssl
Submodule android_openssl updated 1015 files
2 changes: 1 addition & 1 deletion libs/eigen
Submodule eigen updated from 0fd6b4 to 5a9f66
2 changes: 1 addition & 1 deletion libs/mavlink/include/mavlink/v2.0
Submodule v2.0 updated 463 files
2 changes: 1 addition & 1 deletion libs/qmdnsengine
2 changes: 1 addition & 1 deletion libs/shapelib
Submodule shapelib updated 139 files
1 change: 1 addition & 0 deletions src/FirmwarePlugin/FirmwarePlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ const QVariantList& FirmwarePlugin::toolIndicators(const Vehicle*)
_toolIndicatorList = QVariantList({
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/MessageIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/GPSIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/JoystickIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/TelemetryRSSIIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/RCRSSIIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/BatteryIndicator.qml")),
Expand Down
2 changes: 1 addition & 1 deletion src/GPS/Drivers
3 changes: 3 additions & 0 deletions src/Vehicle/Vehicle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#include <iostream>

#include <QTime>
#include <QDateTime>
Expand Down Expand Up @@ -2158,6 +2159,8 @@ bool Vehicle::joystickEnabled() const

void Vehicle::setJoystickEnabled(bool enabled)
{
std::cout << "WTF" << enabled << std::endl;

if (enabled){
qCDebug(JoystickLog) << "Vehicle " << this->id() << " Joystick Enabled";
}
Expand Down
22 changes: 21 additions & 1 deletion src/ui/toolbar/JoystickIndicator.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ Item {
width: joystickRow.width * 1.1
anchors.top: parent.top
anchors.bottom: parent.bottom
visible: globals.activeVehicle ? globals.activeVehicle.sub : false
// visible: globals.activeVehicle ? globals.activeVehicle.sub : false
// visible: globals.activeVehicle ? globals.activeVehicle.rover : false

property bool showIndicator: true
property bool _joystickEnabled: globals.activeVehicle ? globals.activeVehicle.joystickEnabled : false


Component {
Expand Down Expand Up @@ -66,6 +70,22 @@ Item {
text: globals.activeVehicle && globals.activeVehicle.joystickEnabled ? qsTr("Yes") : qsTr("No")
color: globals.activeVehicle && globals.activeVehicle.joystickEnabled ? qgcPal.buttonText : "red"
}

QGCButton {
Layout.leftMargin: width / 2
Layout.alignment: Qt.AlignHCenter
enabled: true
text: _joystickEnabled ? qsTr("Disable") : qsTr("Enable")
onClicked: {
if (_joystickEnabled) {
globals.activeVehicle.setJoystickEnabled(false)
} else {
globals.activeVehicle.setJoystickEnabled(true)
}
// close popup
mainWindow.hideIndicatorPopup()
}
}
}
}
}
Expand Down
Loading