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

Merge remote-tracking branch 'origin/pt/version-mismach-warning' into next

This commit is contained in:
James Cotton 2011-11-21 07:38:16 -06:00
commit 856f8a9b6c
3 changed files with 34 additions and 3 deletions

View File

@ -212,8 +212,9 @@ QString UAVSettingsImportExportFactory::createXMLDocument(
QDomElement fw=doc.createElement("Embedded");
UAVObjectUtilManager* utilMngr = pm->getObject<UAVObjectUtilManager>();
fw.setAttribute("gitcommittag",utilMngr->getBoardDescriptionStruct().gitTag);
fw.setAttribute("fwtag",utilMngr->getBoardDescriptionStruct().description);
deviceDescriptorStruct struc=utilMngr->getBoardDescriptionStruct();
fw.setAttribute("gitcommittag",struc.gitTag);
fw.setAttribute("fwtag",struc.description);
fw.setAttribute("cpuSerial",QString(utilMngr->getBoardCPUSerial().toHex()));
versionInfo.appendChild(fw);

View File

@ -25,6 +25,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "uploadergadgetwidget.h"
#include "../../../../../build/ground/openpilotgcs/gcsversioninfo.h"
#include <coreplugin/coreconstants.h>
#include <QDebug>
#define DFU_DEBUG true
@ -37,11 +40,13 @@ UploaderGadgetWidget::UploaderGadgetWidget(QWidget *parent) : QWidget(parent)
dfu = NULL;
m_timer = 0;
m_progress = 0;
msg=new QErrorMessage(this);
// Listen to autopilot connection events
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
TelemetryManager* telMngr = pm->getObject<TelemetryManager>();
connect(telMngr, SIGNAL(connected()), this, SLOT(onAutopilotConnect()));
connect(telMngr, SIGNAL(connected()), this, SLOT(versionMatchCheck()));
connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect()));
connect(m_config->haltButton, SIGNAL(clicked()), this, SLOT(goToBootloader()));
@ -60,7 +65,10 @@ UploaderGadgetWidget::UploaderGadgetWidget(QWidget *parent) : QWidget(parent)
// And check whether by any chance we are not already connected
if (telMngr->isConnected())
{
onAutopilotConnect();
versionMatchCheck();
}
}
@ -603,3 +611,22 @@ void UploaderGadgetWidget::info(QString infoString, int infoNumber)
Q_UNUSED(infoNumber);
m_config->boardStatus->setText(infoString);
}
void UploaderGadgetWidget::versionMatchCheck()
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectUtilManager* utilMngr = pm->getObject<UAVObjectUtilManager>();
deviceDescriptorStruct boardDescription=utilMngr->getBoardDescriptionStruct();
QString gcsDescription=QString::fromLatin1(Core::Constants::GCS_REVISION_STR);
if(boardDescription.gitTag!=gcsDescription.mid(gcsDescription.indexOf(":")+1,8))
{
qDebug()<<QDate::fromString(boardDescription.buildDate.mid(0,8),"yyyyMMdd");
qDebug()<<QDate::fromString(gcsDescription.mid(gcsDescription.indexOf(" ")+1,8),"yyyyMMdd");
qDebug()<<QDate::fromString(boardDescription.buildDate.mid(0,8),"yyyyMMdd").daysTo(QDate::fromString(gcsDescription.mid(gcsDescription.indexOf(" ")+1,8),"yyyyMMdd"));
if(QDate::fromString(boardDescription.buildDate.mid(0,8),"yyyyMMdd").daysTo(QDate::fromString(gcsDescription.mid(gcsDescription.indexOf(" ")+1,8),"yyyyMMdd"))>0)
msg->showMessage(QString("Incompatible GCS and FW detected, you should upgrade your board's Firmware to %1 version.").arg(gcsDescription));
else
msg->showMessage(QString("Incompatible GCS and FW detected, you should upgrade your GCS to %1 version.").arg(boardDescription.gitTag+":"+boardDescription.buildDate));
}
}

View File

@ -54,6 +54,7 @@
#include <QTimer>
#include "devicedescriptorstruct.h"
#include <QProgressDialog>
#include <QErrorMessage>
using namespace OP_DFU;
@ -84,8 +85,10 @@ private:
QTimer* m_timer;
QLineEdit* openFileNameLE;
QEventLoop m_eventloop;
QErrorMessage * msg;
private slots:
void onPhisicalHWConnect();
void versionMatchCheck();
void error(QString errorString,int errorNumber);
void info(QString infoString,int infoNumber);
void goToBootloader(UAVObject* = NULL, bool = false);