mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-30 08:24:11 +01:00
Merge remote-tracking branch 'origin/naiiawah/uploader_detection' into next
This commit is contained in:
commit
e108bcafed
@ -1017,3 +1017,43 @@ int DFUObject::receiveData(void * data,int size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define BOARD_ID_MB 1
|
||||||
|
#define BOARD_ID_INS 2
|
||||||
|
#define BOARD_ID_PIP 3
|
||||||
|
#define BOARD_ID_CC 4
|
||||||
|
//#define BOARD_ID_PRO ?
|
||||||
|
|
||||||
|
/**
|
||||||
|
Gets the type of board connected
|
||||||
|
*/
|
||||||
|
OP_DFU::eBoardType DFUObject::GetBoardType(int boardNum)
|
||||||
|
{
|
||||||
|
OP_DFU::eBoardType brdType = eBoardUnkwn;
|
||||||
|
|
||||||
|
// First of all, check what Board type we are talking to
|
||||||
|
int board = devices[boardNum].ID;
|
||||||
|
qDebug() << "Board model: " << board;
|
||||||
|
switch (board >> 8) {
|
||||||
|
case BOARD_ID_MB: // Mainboard family
|
||||||
|
brdType = eBoardMainbrd;
|
||||||
|
break;
|
||||||
|
case BOARD_ID_INS: // Inertial Nav
|
||||||
|
brdType = eBoardINS;
|
||||||
|
break;
|
||||||
|
case BOARD_ID_PIP: // PIP RF Modem
|
||||||
|
brdType = eBoardPip;
|
||||||
|
break;
|
||||||
|
case BOARD_ID_CC: // CopterControl family
|
||||||
|
brdType = eBoardCC;
|
||||||
|
break;
|
||||||
|
#if 0 // Someday ;-)
|
||||||
|
case BOARD_ID_PRO: // Pro board
|
||||||
|
brdType = eBoardPro;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return brdType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,6 +92,16 @@ namespace OP_DFU {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum eBoardType
|
||||||
|
{
|
||||||
|
eBoardUnkwn = 0,
|
||||||
|
eBoardMainbrd = 1,
|
||||||
|
eBoardINS,
|
||||||
|
eBoardPip,
|
||||||
|
eBoardCC,
|
||||||
|
eBoardPro,
|
||||||
|
};
|
||||||
|
|
||||||
struct device
|
struct device
|
||||||
{
|
{
|
||||||
int ID;
|
int ID;
|
||||||
@ -154,6 +164,7 @@ namespace OP_DFU {
|
|||||||
// Helper functions:
|
// Helper functions:
|
||||||
QString StatusToString(OP_DFU::Status const & status);
|
QString StatusToString(OP_DFU::Status const & status);
|
||||||
static quint32 CRC32WideFast(quint32 Crc, quint32 Size, quint32 *Buffer);
|
static quint32 CRC32WideFast(quint32 Crc, quint32 Size, quint32 *Buffer);
|
||||||
|
OP_DFU::eBoardType GetBoardType(int boardNum);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -480,7 +480,7 @@ void UploaderGadgetWidget::systemRescue()
|
|||||||
m_config->rescueButton->setEnabled(true);
|
m_config->rescueButton->setEnabled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(QMessageBox::question(this,tr("OpenPilot Uploader"),tr("If you want to search for other boards connect power now and press Yes"),QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes)
|
if ((eBoardCC != dfu->GetBoardType(0)) && (QMessageBox::question(this,tr("OpenPilot Uploader"),tr("If you want to search for other boards connect power now and press Yes"),QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes))
|
||||||
{
|
{
|
||||||
log("\nWaiting...");
|
log("\nWaiting...");
|
||||||
QTimer::singleShot(3000, &m_eventloop, SLOT(quit()));
|
QTimer::singleShot(3000, &m_eventloop, SLOT(quit()));
|
||||||
|
Loading…
Reference in New Issue
Block a user