mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
Merge remote-tracking branch 'origin/ccfly/channelformlayout' into revolution
This commit is contained in:
commit
4dfdeb9418
@ -134,6 +134,7 @@ void ConfigGadgetWidget::onAutopilotDisconnect() {
|
||||
|
||||
void ConfigGadgetWidget::onAutopilotConnect() {
|
||||
|
||||
qDebug()<<"ConfigGadgetWidget onAutopilotConnect";
|
||||
// First of all, check what Board type we are talking to, and
|
||||
// if necessary, remove/add tabs in the config gadget:
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
|
@ -93,6 +93,13 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren
|
||||
this->setEnabled(false);
|
||||
connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(disableIfNotMe(UAVObject*)));
|
||||
}
|
||||
void ConfigOutputWidget::enableControls(bool enable)
|
||||
{
|
||||
ConfigTaskWidget::enableControls(enable);
|
||||
if(!enable)
|
||||
m_config->channelOutTest->setChecked(false);
|
||||
m_config->channelOutTest->setEnabled(enable);
|
||||
}
|
||||
|
||||
ConfigOutputWidget::~ConfigOutputWidget()
|
||||
{
|
||||
@ -108,6 +115,7 @@ ConfigOutputWidget::~ConfigOutputWidget()
|
||||
*/
|
||||
void ConfigOutputWidget::runChannelTests(bool state)
|
||||
{
|
||||
qDebug()<<"configoutputwidget runChannelTests"<<state;
|
||||
SystemAlarms * systemAlarmsObj = SystemAlarms::GetInstance(getObjectManager());
|
||||
SystemAlarms::DataFields systemAlarms = systemAlarmsObj->getData();
|
||||
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
ConfigOutputWidget(QWidget *parent = 0);
|
||||
~ConfigOutputWidget();
|
||||
|
||||
|
||||
private:
|
||||
Ui_OutputWidget *m_config;
|
||||
|
||||
@ -74,6 +75,8 @@ private slots:
|
||||
void sendChannelTest(int index, int value);
|
||||
void setSpinningArmed(bool val);
|
||||
void openHelp();
|
||||
protected:
|
||||
void enableControls(bool enable);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -142,6 +142,12 @@
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Neutral</string>
|
||||
</property>
|
||||
@ -149,6 +155,12 @@
|
||||
</item>
|
||||
<item row="2" column="6">
|
||||
<widget class="QSlider" name="channelNeutral">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
@ -99,7 +99,7 @@
|
||||
<item row="1" column="4">
|
||||
<widget class="QSlider" name="actuatorNeutral">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -187,7 +187,7 @@
|
||||
<item row="0" column="4">
|
||||
<widget class="QLabel" name="legend2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -358,7 +358,10 @@ void ConnectionManager::devChanged(IConnection *connection)
|
||||
if(m_mainWindow->generalSettings()->autoConnect() || m_mainWindow->generalSettings()->autoSelect())
|
||||
m_availableDevList->setCurrentIndex(m_availableDevList->count()-1);
|
||||
if(m_mainWindow->generalSettings()->autoConnect())
|
||||
{
|
||||
connectDevice();
|
||||
qDebug()<<"ConnectionManager::devChanged autoconnected USB device";
|
||||
}
|
||||
}
|
||||
}
|
||||
if(m_ioDev)//if a device is connected make it the one selected on the dropbox
|
||||
|
@ -28,7 +28,8 @@
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
#include <initguid.h>
|
||||
|
||||
#include <QEventLoop>
|
||||
#include <QTimer>
|
||||
#include "usbmonitor.h"
|
||||
#include <QDebug>
|
||||
#define printf qDebug
|
||||
@ -78,9 +79,9 @@ QList<USBPortInfo> USBMonitor::availableDevices(int vid, int pid, int bcdDeviceM
|
||||
{
|
||||
QList<USBPortInfo> allPorts = availableDevices();
|
||||
QList<USBPortInfo> thePortsWeWant;
|
||||
|
||||
qDebug()<<"USBMonitor::availableDevices bcdLSB="<<bcdDeviceLSB;
|
||||
foreach (USBPortInfo port, allPorts) {
|
||||
//qDebug()<<"USBMonitorWin:Port VID="<<port.vendorID<<"PID="<<port.productID<<"bcddevice="<<port.bcdDevice;
|
||||
qDebug()<<"USBMonitorWin:Port VID="<<port.vendorID<<"PID="<<port.productID<<"bcddevice="<<port.bcdDevice;
|
||||
if((port.vendorID==vid || vid==-1) && (port.productID==pid || pid==-1) && ((port.bcdDevice>>8)==bcdDeviceMSB || bcdDeviceMSB==-1) &&
|
||||
( (port.bcdDevice&0x00ff) ==bcdDeviceLSB || bcdDeviceLSB==-1))
|
||||
thePortsWeWant.append(port);
|
||||
@ -178,9 +179,23 @@ bool USBMonitor::matchAndDispatchChangedDevice(const QString & deviceID, const G
|
||||
if( wParam == DBT_DEVICEARRIVAL )
|
||||
{
|
||||
qDebug()<<"INSERTION";
|
||||
if(infoFromHandle(guid,info,devInfo,i)==0)
|
||||
QEventLoop m_eventloop;
|
||||
QTimer::singleShot(1000,&m_eventloop, SLOT(quit()));
|
||||
m_eventloop.exec();
|
||||
if(infoFromHandle(guid,info,devInfo,i)!=1)
|
||||
{
|
||||
qDebug()<<"USB_MONITOR infoFromHandle failed on matchAndDispatchChangedDevice";
|
||||
break;
|
||||
}
|
||||
bool m_break=false;
|
||||
foreach (USBPortInfo m_info, knowndevices) {
|
||||
if(m_info.serialNumber==info.serialNumber && m_info.productID==info.productID)
|
||||
m_break=true;
|
||||
}
|
||||
if(m_break)
|
||||
break;
|
||||
knowndevices.append(info);
|
||||
qDebug()<<"USB_MONITOR emit device discovered on device:"<<info.product<<info.bcdDevice;
|
||||
emit deviceDiscovered(info);
|
||||
break;
|
||||
|
||||
|
@ -80,20 +80,26 @@ DFUObject::DFUObject(bool _debug,bool _use_serial,QString portname):
|
||||
}
|
||||
else
|
||||
{
|
||||
QEventLoop m_eventloop;
|
||||
QTimer::singleShot(200,&m_eventloop, SLOT(quit()));
|
||||
m_eventloop.exec();
|
||||
QList<USBPortInfo> devices;
|
||||
devices = USBMonitor::instance()->availableDevices(0x20a0,-1,-1,USBMonitor::Bootloader);
|
||||
if (devices.length()==1) {
|
||||
hidHandle.open(1,devices.first().vendorID,devices.first().productID,0,0);
|
||||
qDebug()<<"OP_DFU detected first time";
|
||||
} else {
|
||||
// Wait for the board to appear on the USB bus:
|
||||
QEventLoop m_eventloop;
|
||||
connect(USBMonitor::instance(), SIGNAL(deviceDiscovered(USBPortInfo)),&m_eventloop, SLOT(quit()));
|
||||
QTimer::singleShot(5000,&m_eventloop, SLOT(quit()));
|
||||
QTimer::singleShot(15000,&m_eventloop, SLOT(quit()));
|
||||
m_eventloop.exec();
|
||||
disconnect(USBMonitor::instance(), SIGNAL(deviceDiscovered(USBPortInfo)),&m_eventloop, SLOT(quit()));
|
||||
devices = USBMonitor::instance()->availableDevices(0x20a0,-1,-1,USBMonitor::Bootloader);
|
||||
if (devices.length()==1) {
|
||||
delay::msleep(2000); // Let the USB Subsystem settle (especially important on Mac!)
|
||||
QTimer::singleShot(1000,&m_eventloop, SLOT(quit()));
|
||||
m_eventloop.exec();
|
||||
hidHandle.open(1,devices.first().vendorID,devices.first().productID,0,0);
|
||||
qDebug()<<"OP_DFU detected after delay";
|
||||
}
|
||||
else {
|
||||
qDebug() << devices.length() << " device(s) detected, don't know what to do!";
|
||||
|
@ -125,6 +125,11 @@ void UploaderGadgetWidget::onPhisicalHWConnect()
|
||||
Enables widget buttons if autopilot connected
|
||||
*/
|
||||
void UploaderGadgetWidget::onAutopilotConnect(){
|
||||
QTimer::singleShot(1000,this,SLOT(populate()));
|
||||
}
|
||||
|
||||
void UploaderGadgetWidget::populate()
|
||||
{
|
||||
m_config->haltButton->setEnabled(true);
|
||||
m_config->resetButton->setEnabled(true);
|
||||
m_config->bootButton->setEnabled(false);
|
||||
@ -141,7 +146,6 @@ void UploaderGadgetWidget::onAutopilotConnect(){
|
||||
runningDeviceWidget* dw = new runningDeviceWidget(this);
|
||||
dw->populate();
|
||||
m_config->systemElements->addTab(dw, QString("Connected Device"));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
public slots:
|
||||
void onAutopilotConnect();
|
||||
void onAutopilotDisconnect();
|
||||
|
||||
void populate();
|
||||
private:
|
||||
Ui_UploaderWidget *m_config;
|
||||
DFUObject *dfu;
|
||||
|
Loading…
Reference in New Issue
Block a user