1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-30 08:24:11 +01:00

Merge branch 'bugfix-ground' of ssh://git.openpilot.org/OpenPilot into bugfix-ground

This commit is contained in:
James Cotton 2011-06-01 14:20:54 -05:00
commit f8b945401d
10 changed files with 117 additions and 19 deletions

View File

@ -186,7 +186,7 @@ int32_t PIOS_SYS_SerialNumberGet(char *str)
void NVIC_Configuration(void)
{
/* Set the Vector Table base address as specified in .ld file */
extern void pios_isr_vector_table_base;
extern void *pios_isr_vector_table_base;
NVIC_SetVectorTable((uint32_t)&pios_isr_vector_table_base, 0x0);
/* 4 bits for Interrupt priorities so no sub priorities */

View File

@ -36,15 +36,13 @@
#include "fancytabwidget.h"
#include "fancyactionbar.h"
#include "mainwindow.h"
#include "qextserialport/src/qextserialenumerator.h"
#include "qextserialport/src/qextserialport.h"
#include <QDebug>
#include <QLabel>
#include <QHBoxLayout>
#include <QComboBox>
#include <QTimer>
namespace Core {
@ -52,9 +50,9 @@ ConnectionManager::ConnectionManager(Internal::MainWindow *mainWindow, Internal:
QWidget(mainWindow), // Pip
m_availableDevList(0),
m_connectBtn(0),
m_ioDev(NULL)
m_ioDev(NULL),m_mainWindow(mainWindow)
{
Q_UNUSED(mainWindow);
// Q_UNUSED(mainWindow);
QVBoxLayout *top = new QVBoxLayout;
top->setSpacing(0);
@ -356,7 +354,23 @@ void ConnectionManager::devChanged(IConnection *connection)
{
m_availableDevList->addItem(d.displayName);
m_availableDevList->setItemData(m_availableDevList->count()-1,(const QString)d.devName,Qt::ToolTipRole);
if(!m_ioDev && d.displayName.startsWith("USB"))
{
if(m_mainWindow->generalSettings()->autoConnect() || m_mainWindow->generalSettings()->autoSelect())
m_availableDevList->setCurrentIndex(m_availableDevList->count()-1);
if(m_mainWindow->generalSettings()->autoConnect())
connectDevice();
}
}
if(m_ioDev)//if a device is connected make it the one selected on the dropbox
{
for(int x=0;x<m_availableDevList->count();++x)
{
if(m_connectionDevice.devName==m_availableDevList->itemData(x,Qt::ToolTipRole).toString())
m_availableDevList->setCurrentIndex(x);
}
}
//disable connection button if the liNameif (m_availableDevList->count() > 0)
if (m_availableDevList->count() > 0)

View File

@ -30,7 +30,8 @@
#define CONNECTIONMANAGER_H
#include <QWidget>
#include "mainwindow.h"
#include "generalsettings.h"
#include <QtCore/QVector>
#include <QtCore/QIODevice>
#include <QtCore/QLinkedList>
@ -108,6 +109,7 @@ protected:
private:
bool connectDevice();
Internal::MainWindow *m_mainWindow;
};

View File

@ -45,7 +45,8 @@ using namespace Core::Internal;
GeneralSettings::GeneralSettings():
m_dialog(0),
m_saveSettingsOnExit(true)
m_saveSettingsOnExit(true),
m_autoConnect(true),m_autoSelect(true)
{
}
@ -113,8 +114,10 @@ QWidget *GeneralSettings::createPage(QWidget *parent)
m_page->setupUi(w);
fillLanguageBox();
connect(m_page->checkAutoConnect,SIGNAL(stateChanged(int)),this,SLOT(slotAutoConnect(int)));
m_page->checkBoxSaveOnExit->setChecked(m_saveSettingsOnExit);
m_page->checkAutoConnect->setChecked(m_autoConnect);
m_page->checkAutoSelect->setChecked(m_autoSelect);
m_page->colorButton->setColor(StyleHelper::baseColor());
#ifdef Q_OS_UNIX
m_page->terminalEdit->setText(ConsoleProcess::terminalEmulator(Core::ICore::instance()->settings()));
@ -146,6 +149,8 @@ void GeneralSettings::apply()
StyleHelper::setBaseColor(m_page->colorButton->color());
m_saveSettingsOnExit = m_page->checkBoxSaveOnExit->isChecked();
m_autoConnect = m_page->checkAutoConnect->isChecked();
m_autoSelect = m_page->checkAutoSelect->isChecked();
#ifdef Q_OS_UNIX
ConsoleProcess::setTerminalEmulator(Core::ICore::instance()->settings(),
m_page->terminalEdit->text());
@ -163,6 +168,8 @@ void GeneralSettings::readSettings(QSettings* qs)
qs->beginGroup(QLatin1String("General"));
m_language = qs->value(QLatin1String("OverrideLanguage"),QLocale::system().name()).toString();
m_saveSettingsOnExit = qs->value(QLatin1String("SaveSettingsOnExit"),m_saveSettingsOnExit).toBool();
m_autoConnect = qs->value(QLatin1String("AutoConnect"),m_autoConnect).toBool();
m_autoSelect = qs->value(QLatin1String("AutoSelect"),m_autoSelect).toBool();
qs->endGroup();
}
@ -177,6 +184,8 @@ void GeneralSettings::saveSettings(QSettings* qs)
qs->setValue(QLatin1String("OverrideLanguage"), m_language);
qs->setValue(QLatin1String("SaveSettingsOnExit"), m_saveSettingsOnExit);
qs->setValue(QLatin1String("AutoConnect"), m_autoConnect);
qs->setValue(QLatin1String("AutoSelect"), m_autoSelect);
qs->endGroup();
}
@ -241,3 +250,21 @@ bool GeneralSettings::saveSettingsOnExit() const
{
return m_saveSettingsOnExit;
}
bool GeneralSettings::autoConnect() const
{
return m_autoConnect;
}
bool GeneralSettings::autoSelect() const
{
return m_autoSelect;
}
void GeneralSettings::slotAutoConnect(int value)
{
if (value==Qt::Checked)
m_page->checkAutoSelect->setEnabled(false);
else
m_page->checkAutoSelect->setEnabled(true);
}

View File

@ -56,6 +56,8 @@ public:
void apply();
void finish();
bool saveSettingsOnExit() const;
bool autoConnect() const;
bool autoSelect() const;
void readSettings(QSettings* qs);
void saveSettings(QSettings* qs);
@ -64,6 +66,7 @@ private slots:
void resetLanguage();
void resetExternalEditor();
void showHelpForExternalEditor();
void slotAutoConnect(int);
#ifdef Q_OS_UNIX
void resetTerminal();
#endif
@ -75,6 +78,8 @@ private:
Ui::GeneralSettings *m_page;
QString m_language;
bool m_saveSettingsOnExit;
bool m_autoConnect;
bool m_autoSelect;
QPointer<QWidget> m_dialog;
QList<QTextCodec *> m_codecs;

View File

@ -241,6 +241,49 @@
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Automatically connect an OpenPilot USB device</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QCheckBox" name="checkAutoConnect">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Automatically select an OpenPilot USB device</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QCheckBox" name="checkAutoSelect">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -874,6 +874,11 @@ MimeDatabase *MainWindow::mimeDatabase() const
return m_mimeDatabase;
}
GeneralSettings * MainWindow::generalSettings() const
{
return m_generalSettings;
}
IContext *MainWindow::contextObject(QWidget *widget)
{
return m_contextWidgets.value(widget);

View File

@ -111,7 +111,7 @@ public:
Core::ThreadManager *threadManager() const;
Core::ModeManager *modeManager() const;
Core::MimeDatabase *mimeDatabase() const;
Internal::GeneralSettings *generalSettings() const;
QSettings *settings(QSettings::Scope scope) const;
inline SettingsDatabase *settingsDatabase() const { return m_settingsDatabase; }
IContext * currentContextObject() const;

View File

@ -177,6 +177,7 @@ bool USBMonitor::matchAndDispatchChangedDevice(const QString & deviceID, const G
info.devicePath=deviceID;
if( wParam == DBT_DEVICEARRIVAL )
{
qDebug()<<"INSERTION";
if(infoFromHandle(guid,info,devInfo,i)==0)
break;
knowndevices.append(info);
@ -186,19 +187,19 @@ bool USBMonitor::matchAndDispatchChangedDevice(const QString & deviceID, const G
}
else if( wParam == DBT_DEVICEREMOVECOMPLETE )
{
bool found=false;
for(int x=0;x<knowndevices.count();++x)
{
if(knowndevices[x].devicePath==deviceID)
{
emit deviceRemoved(knowndevices[x]);
//qDebug()<<"REMOVED"<<knowndevices[x].product;
knowndevices.removeAt(x);
USBPortInfo temp=knowndevices.at(x);
emit deviceRemoved(temp);
found=true;
break;
}
}
if(!found)
emit deviceRemoved(info);
}
break;

View File

@ -27,6 +27,7 @@
*/
#include "uavobject.h"
#include <QtEndian>
#include <QDebug>
/**
* Constructor
@ -224,7 +225,7 @@ UAVObjectField* UAVObject::getField(const QString& name)
}
}
// If this point is reached then the field was not found
Q_ASSERT_X(0,"UAVObject::getField",QString("Non existant field " + name + " requested. This indicates a bug. Make sure you also have null checking for non-debug code.").toAscii());
qWarning()<<"UAVObject::getField Non existant field "<<name<<" requested. This indicates a bug. Make sure you also have null checking for non-debug code.";
return NULL;
}