mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +01:00
OP-1245 Added check for board connected to enable disable controls. This function is only available for Revolution board at this point.
This commit is contained in:
parent
4209f1d6b5
commit
4f6d680810
@ -33,6 +33,7 @@ Rectangle {
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredHeight: 1000;
|
||||
model: logManager.logEntries
|
||||
enabled: !logManager.disableControls && logManager.boardConnected
|
||||
|
||||
rowDelegate: Rectangle {
|
||||
height: 22
|
||||
@ -104,7 +105,7 @@ Rectangle {
|
||||
}
|
||||
CheckBox {
|
||||
id: exportRelativeTimeCB
|
||||
enabled: !logManager.disableControls && !logManager.disableExport
|
||||
enabled: !logManager.disableControls && !logManager.disableExport && logManager.boardConnected
|
||||
text: qsTr("Adjust timestamps")
|
||||
activeFocusOnPress: true
|
||||
checked: logManager.adjustExportedTimestamps
|
||||
@ -126,7 +127,7 @@ Rectangle {
|
||||
|
||||
ComboBox {
|
||||
id: flightCombo
|
||||
enabled: !logManager.disableControls
|
||||
enabled: !logManager.disableControls && logManager.boardConnected
|
||||
model: logManager.flightEntries
|
||||
}
|
||||
}
|
||||
@ -137,7 +138,7 @@ Rectangle {
|
||||
}
|
||||
Button {
|
||||
text: qsTr("Download logs")
|
||||
enabled: !logManager.disableControls
|
||||
enabled: !logManager.disableControls && logManager.boardConnected
|
||||
activeFocusOnPress: true
|
||||
onClicked: logManager.retrieveLogs(flightCombo.currentIndex - 1)
|
||||
}
|
||||
@ -151,14 +152,14 @@ Rectangle {
|
||||
}
|
||||
Button {
|
||||
id: clearButton
|
||||
enabled: !logManager.disableControls
|
||||
enabled: !logManager.disableControls && logManager.boardConnected
|
||||
text: qsTr("Clear all logs")
|
||||
activeFocusOnPress: true
|
||||
onClicked: logManager.clearAllLogs()
|
||||
}
|
||||
Button {
|
||||
id: exportButton
|
||||
enabled: !logManager.disableControls && !logManager.disableExport
|
||||
enabled: !logManager.disableControls && !logManager.disableExport && logManager.boardConnected
|
||||
text: qsTr("Export logs...")
|
||||
activeFocusOnPress: true
|
||||
onClicked: logManager.exportLogs()
|
||||
@ -218,6 +219,7 @@ Rectangle {
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredHeight: 1000;
|
||||
model: logManager.uavoEntries
|
||||
enabled: !logManager.disableControls && logManager.boardConnected
|
||||
|
||||
rowDelegate: Rectangle {
|
||||
height: 22
|
||||
|
@ -6,6 +6,7 @@ QT += qml quick
|
||||
include(../../openpilotgcsplugin.pri)
|
||||
include(../../plugins/coreplugin/coreplugin.pri)
|
||||
include(../../plugins/uavobjects/uavobjects.pri)
|
||||
include(../../plugins/uavobjectutil/uavobjectutil.pri)
|
||||
include(../../plugins/uavtalk/uavtalk.pri)
|
||||
|
||||
HEADERS += flightlogplugin.h \
|
||||
|
@ -35,17 +35,26 @@
|
||||
#include "uavobjecthelper.h"
|
||||
#include "uavtalk/uavtalk.h"
|
||||
#include "utils/logfile.h"
|
||||
#include <uavobjectutil/uavobjectutilmanager.h>
|
||||
|
||||
FlightLogManager::FlightLogManager(QObject *parent) :
|
||||
QObject(parent), m_disableControls(false),
|
||||
m_disableExport(true), m_cancelDownload(false),
|
||||
m_adjustExportedTimestamps(true)
|
||||
{
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance();
|
||||
Q_ASSERT(pluginManager);
|
||||
|
||||
m_objectManager = pm->getObject<UAVObjectManager>();
|
||||
m_objectManager = pluginManager->getObject<UAVObjectManager>();
|
||||
Q_ASSERT(m_objectManager);
|
||||
|
||||
m_telemtryManager = pluginManager->getObject<TelemetryManager>();
|
||||
Q_ASSERT(m_telemtryManager);
|
||||
|
||||
connect(m_telemtryManager, SIGNAL(connected()), this, SLOT(connectionStatusChanged()));
|
||||
connect(m_telemtryManager, SIGNAL(disconnected()), this, SLOT(connectionStatusChanged()));
|
||||
connectionStatusChanged();
|
||||
|
||||
m_flightLogControl = DebugLogControl::GetInstance(m_objectManager);
|
||||
Q_ASSERT(m_flightLogControl);
|
||||
|
||||
@ -400,6 +409,17 @@ void FlightLogManager::setupLogSettings()
|
||||
<< tr("Every 500ms") << tr("Every second") << tr("Every 5s") << tr("Every 10s") << tr("Every 30s") << tr("Every minute");
|
||||
}
|
||||
|
||||
void FlightLogManager::connectionStatusChanged()
|
||||
{
|
||||
if (m_telemtryManager->isConnected()) {
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
UAVObjectUtilManager *utilMngr = pm->getObject<UAVObjectUtilManager>();
|
||||
setBoardConnected(utilMngr->getBoardModel() == 0x0903);
|
||||
} else {
|
||||
setBoardConnected(false);
|
||||
}
|
||||
}
|
||||
|
||||
ExtendedDebugLogEntry::ExtendedDebugLogEntry() : DebugLogEntry(),
|
||||
m_object(0)
|
||||
{}
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "debuglogentry.h"
|
||||
#include "debuglogstatus.h"
|
||||
#include "debuglogcontrol.h"
|
||||
#include "uavtalk/telemetrymanager.h"
|
||||
|
||||
class UAVOLogSettingsWrapper : public QObject {
|
||||
Q_OBJECT
|
||||
@ -120,6 +121,7 @@ class FlightLogManager : public QObject {
|
||||
Q_PROPERTY(bool disableControls READ disableControls WRITE setDisableControls NOTIFY disableControlsChanged)
|
||||
Q_PROPERTY(bool disableExport READ disableExport WRITE setDisableExport NOTIFY disableExportChanged)
|
||||
Q_PROPERTY(bool adjustExportedTimestamps READ adjustExportedTimestamps WRITE setAdjustExportedTimestamps NOTIFY adjustExportedTimestampsChanged)
|
||||
Q_PROPERTY(bool boardConnected READ boardConnected WRITE setBoardConnected NOTIFY boardConnectedChanged)
|
||||
|
||||
Q_PROPERTY(QQmlListProperty<UAVOLogSettingsWrapper> uavoEntries READ uavoEntries NOTIFY uavoEntriesChanged)
|
||||
Q_PROPERTY(QStringList logSettings READ logSettings NOTIFY logSettingsChanged)
|
||||
@ -160,17 +162,20 @@ public:
|
||||
return m_adjustExportedTimestamps;
|
||||
}
|
||||
|
||||
bool boardConnected() const
|
||||
{
|
||||
return m_boardConnected;
|
||||
}
|
||||
|
||||
signals:
|
||||
void logEntriesChanged();
|
||||
void flightEntriesChanged();
|
||||
void logSettingsChanged();
|
||||
|
||||
void uavoEntriesChanged();
|
||||
|
||||
void disableControlsChanged(bool arg);
|
||||
void disableExportChanged(bool arg);
|
||||
|
||||
void adjustExportedTimestampsChanged(bool arg);
|
||||
void boardConnectedChanged(bool arg);
|
||||
|
||||
public slots:
|
||||
void clearAllLogs();
|
||||
@ -202,13 +207,23 @@ public slots:
|
||||
}
|
||||
}
|
||||
|
||||
void setBoardConnected(bool arg)
|
||||
{
|
||||
if (m_boardConnected != arg) {
|
||||
m_boardConnected = arg;
|
||||
emit boardConnectedChanged(arg);
|
||||
}
|
||||
}
|
||||
|
||||
private slots:
|
||||
void updateFlightEntries(quint16 currentFlight);
|
||||
void setupUAVOWrappers();
|
||||
void setupLogSettings();
|
||||
void connectionStatusChanged();
|
||||
|
||||
private:
|
||||
UAVObjectManager *m_objectManager;
|
||||
TelemetryManager *m_telemtryManager;
|
||||
DebugLogControl *m_flightLogControl;
|
||||
DebugLogStatus *m_flightLogStatus;
|
||||
DebugLogEntry *m_flightLogEntry;
|
||||
@ -219,15 +234,16 @@ private:
|
||||
|
||||
QList<UAVOLogSettingsWrapper *> m_uavoEntries;
|
||||
|
||||
void exportToOPL(QString fileName);
|
||||
void exportToCSV(QString fileName);
|
||||
void exportToXML(QString fileName);
|
||||
|
||||
static const int UAVTALK_TIMEOUT = 4000;
|
||||
bool m_disableControls;
|
||||
bool m_disableExport;
|
||||
bool m_cancelDownload;
|
||||
bool m_adjustExportedTimestamps;
|
||||
|
||||
void exportToOPL(QString fileName);
|
||||
void exportToCSV(QString fileName);
|
||||
void exportToXML(QString fileName);
|
||||
bool m_boardConnected;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user