1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10: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) void NVIC_Configuration(void)
{ {
/* Set the Vector Table base address as specified in .ld file */ /* 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); NVIC_SetVectorTable((uint32_t)&pios_isr_vector_table_base, 0x0);
/* 4 bits for Interrupt priorities so no sub priorities */ /* 4 bits for Interrupt priorities so no sub priorities */

View File

@ -36,15 +36,13 @@
#include "fancytabwidget.h" #include "fancytabwidget.h"
#include "fancyactionbar.h" #include "fancyactionbar.h"
#include "mainwindow.h"
#include "qextserialport/src/qextserialenumerator.h" #include "qextserialport/src/qextserialenumerator.h"
#include "qextserialport/src/qextserialport.h" #include "qextserialport/src/qextserialport.h"
#include <QDebug> #include <QDebug>
#include <QLabel> #include <QLabel>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QComboBox> #include <QComboBox>
#include <QTimer>
namespace Core { namespace Core {
@ -52,9 +50,9 @@ ConnectionManager::ConnectionManager(Internal::MainWindow *mainWindow, Internal:
QWidget(mainWindow), // Pip QWidget(mainWindow), // Pip
m_availableDevList(0), m_availableDevList(0),
m_connectBtn(0), m_connectBtn(0),
m_ioDev(NULL) m_ioDev(NULL),m_mainWindow(mainWindow)
{ {
Q_UNUSED(mainWindow); // Q_UNUSED(mainWindow);
QVBoxLayout *top = new QVBoxLayout; QVBoxLayout *top = new QVBoxLayout;
top->setSpacing(0); top->setSpacing(0);
@ -356,7 +354,23 @@ void ConnectionManager::devChanged(IConnection *connection)
{ {
m_availableDevList->addItem(d.displayName); m_availableDevList->addItem(d.displayName);
m_availableDevList->setItemData(m_availableDevList->count()-1,(const QString)d.devName,Qt::ToolTipRole); 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) //disable connection button if the liNameif (m_availableDevList->count() > 0)
if (m_availableDevList->count() > 0) if (m_availableDevList->count() > 0)

View File

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

View File

@ -45,7 +45,8 @@ using namespace Core::Internal;
GeneralSettings::GeneralSettings(): GeneralSettings::GeneralSettings():
m_dialog(0), 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); m_page->setupUi(w);
fillLanguageBox(); fillLanguageBox();
connect(m_page->checkAutoConnect,SIGNAL(stateChanged(int)),this,SLOT(slotAutoConnect(int)));
m_page->checkBoxSaveOnExit->setChecked(m_saveSettingsOnExit); m_page->checkBoxSaveOnExit->setChecked(m_saveSettingsOnExit);
m_page->checkAutoConnect->setChecked(m_autoConnect);
m_page->checkAutoSelect->setChecked(m_autoSelect);
m_page->colorButton->setColor(StyleHelper::baseColor()); m_page->colorButton->setColor(StyleHelper::baseColor());
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
m_page->terminalEdit->setText(ConsoleProcess::terminalEmulator(Core::ICore::instance()->settings())); m_page->terminalEdit->setText(ConsoleProcess::terminalEmulator(Core::ICore::instance()->settings()));
@ -146,6 +149,8 @@ void GeneralSettings::apply()
StyleHelper::setBaseColor(m_page->colorButton->color()); StyleHelper::setBaseColor(m_page->colorButton->color());
m_saveSettingsOnExit = m_page->checkBoxSaveOnExit->isChecked(); m_saveSettingsOnExit = m_page->checkBoxSaveOnExit->isChecked();
m_autoConnect = m_page->checkAutoConnect->isChecked();
m_autoSelect = m_page->checkAutoSelect->isChecked();
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
ConsoleProcess::setTerminalEmulator(Core::ICore::instance()->settings(), ConsoleProcess::setTerminalEmulator(Core::ICore::instance()->settings(),
m_page->terminalEdit->text()); m_page->terminalEdit->text());
@ -163,6 +168,8 @@ void GeneralSettings::readSettings(QSettings* qs)
qs->beginGroup(QLatin1String("General")); qs->beginGroup(QLatin1String("General"));
m_language = qs->value(QLatin1String("OverrideLanguage"),QLocale::system().name()).toString(); m_language = qs->value(QLatin1String("OverrideLanguage"),QLocale::system().name()).toString();
m_saveSettingsOnExit = qs->value(QLatin1String("SaveSettingsOnExit"),m_saveSettingsOnExit).toBool(); 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(); qs->endGroup();
} }
@ -177,6 +184,8 @@ void GeneralSettings::saveSettings(QSettings* qs)
qs->setValue(QLatin1String("OverrideLanguage"), m_language); qs->setValue(QLatin1String("OverrideLanguage"), m_language);
qs->setValue(QLatin1String("SaveSettingsOnExit"), m_saveSettingsOnExit); qs->setValue(QLatin1String("SaveSettingsOnExit"), m_saveSettingsOnExit);
qs->setValue(QLatin1String("AutoConnect"), m_autoConnect);
qs->setValue(QLatin1String("AutoSelect"), m_autoSelect);
qs->endGroup(); qs->endGroup();
} }
@ -241,3 +250,21 @@ bool GeneralSettings::saveSettingsOnExit() const
{ {
return m_saveSettingsOnExit; 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 apply();
void finish(); void finish();
bool saveSettingsOnExit() const; bool saveSettingsOnExit() const;
bool autoConnect() const;
bool autoSelect() const;
void readSettings(QSettings* qs); void readSettings(QSettings* qs);
void saveSettings(QSettings* qs); void saveSettings(QSettings* qs);
@ -64,6 +66,7 @@ private slots:
void resetLanguage(); void resetLanguage();
void resetExternalEditor(); void resetExternalEditor();
void showHelpForExternalEditor(); void showHelpForExternalEditor();
void slotAutoConnect(int);
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
void resetTerminal(); void resetTerminal();
#endif #endif
@ -75,6 +78,8 @@ private:
Ui::GeneralSettings *m_page; Ui::GeneralSettings *m_page;
QString m_language; QString m_language;
bool m_saveSettingsOnExit; bool m_saveSettingsOnExit;
bool m_autoConnect;
bool m_autoSelect;
QPointer<QWidget> m_dialog; QPointer<QWidget> m_dialog;
QList<QTextCodec *> m_codecs; QList<QTextCodec *> m_codecs;

View File

@ -241,6 +241,49 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
</item> </item>

View File

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

View File

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

View File

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

View File

@ -27,6 +27,7 @@
*/ */
#include "uavobject.h" #include "uavobject.h"
#include <QtEndian> #include <QtEndian>
#include <QDebug>
/** /**
* Constructor * Constructor
@ -224,7 +225,7 @@ UAVObjectField* UAVObject::getField(const QString& name)
} }
} }
// If this point is reached then the field was not found // 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; return NULL;
} }