mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
LP-72 use TauLabs USB IDs for Sparky2 so users can cross flash LP and TL without SBL.
This commit is contained in:
parent
2b760f9d39
commit
fdc8b10ddf
@ -358,7 +358,7 @@ enum usb_product_ids {
|
||||
USB_PRODUCT_ID_OPLINK = 0x415C,
|
||||
USB_PRODUCT_ID_CC3D = 0x415D,
|
||||
USB_PRODUCT_ID_REVOLUTION = 0x415E,
|
||||
USB_PRODUCT_ID_SPARKY2 = 0x415E,
|
||||
USB_PRODUCT_ID_SPARKY2 = 0x41D0, // was 0x415E during LP testing
|
||||
USB_PRODUCT_ID_OSD = 0x4194,
|
||||
USB_PRODUCT_ID_SPARE = 0x4195,
|
||||
} __attribute__((packed));
|
||||
|
@ -1,4 +1,4 @@
|
||||
BOARD_TYPE := 0x0b
|
||||
BOARD_TYPE := 0x92
|
||||
BOARD_REVISION := 0x01
|
||||
BOOTLOADER_VERSION := 0x06
|
||||
HW_TYPE := 0x00
|
||||
|
@ -15,8 +15,8 @@ int main(int argc, char *argv[])
|
||||
bool use_serial = false;
|
||||
bool verify;
|
||||
bool debug = false;
|
||||
bool umodereset = false;
|
||||
OP_DFU::Actions action;
|
||||
//bool umodereset = false;
|
||||
OP_DFU::Actions action = OP_DFU::actionNone;
|
||||
QString file;
|
||||
QString serialport;
|
||||
QString description;
|
||||
@ -27,7 +27,7 @@ int main(int argc, char *argv[])
|
||||
debug = true;
|
||||
}
|
||||
if (args.contains("-ur")) {
|
||||
umodereset = true;
|
||||
//umodereset = true;
|
||||
}
|
||||
standardOutput << "OpenPilot serial firmware uploader tool." << endl;
|
||||
if (args.indexOf(PROGRAMFW) + 1 < args.length()) {
|
||||
@ -57,17 +57,17 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
action = OP_DFU::actionProgram;
|
||||
} else if (args.contains(COMPARECRC) || args.contains(COMPAREALL)) {
|
||||
int index;
|
||||
//int index;
|
||||
if (args.contains(COMPARECRC)) {
|
||||
index = args.indexOf(COMPARECRC);
|
||||
//index = args.indexOf(COMPARECRC);
|
||||
action = OP_DFU::actionCompareCrc;
|
||||
} else {
|
||||
index = args.indexOf(COMPAREALL);
|
||||
//index = args.indexOf(COMPAREALL);
|
||||
action = OP_DFU::actionCompareAll;
|
||||
}
|
||||
} else if (args.contains(DOWNLOAD)) {
|
||||
int index;
|
||||
index = args.indexOf(DOWNLOAD);
|
||||
//int index;
|
||||
//index = args.indexOf(DOWNLOAD);
|
||||
action = OP_DFU::actionDownload;
|
||||
} else if (args.contains(STATUSREQUEST)) {
|
||||
action = OP_DFU::actionStatusReq;
|
||||
|
@ -1124,6 +1124,7 @@ int DFUObject::receiveData(void *data, int size)
|
||||
#define BOARD_ID_PIP 3
|
||||
#define BOARD_ID_CC 4
|
||||
#define BOARD_ID_REVO 9
|
||||
#define BOARD_ID_SPARKY2 0x92
|
||||
|
||||
/**
|
||||
Gets the type of board connected
|
||||
@ -1152,6 +1153,9 @@ OP_DFU::eBoardType DFUObject::GetBoardType(int boardNum)
|
||||
case BOARD_ID_REVO: // Revo board
|
||||
brdType = eBoardRevo;
|
||||
break;
|
||||
case BOARD_ID_SPARKY2: // Sparky2 board
|
||||
brdType = eBoardSparky2;
|
||||
break;
|
||||
}
|
||||
return brdType;
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ enum Status {
|
||||
};
|
||||
|
||||
enum Actions {
|
||||
actionNone,
|
||||
actionProgram,
|
||||
actionProgramAndVerify,
|
||||
actionDownload,
|
||||
@ -109,6 +110,7 @@ enum eBoardType {
|
||||
eBoardPip = 3,
|
||||
eBoardCC = 4,
|
||||
eBoardRevo = 9,
|
||||
eBoardSparky2 = 0x92,
|
||||
};
|
||||
|
||||
struct device {
|
||||
|
@ -202,7 +202,7 @@ void ConfigGadgetWidget::onAutopilotConnect()
|
||||
qwd = new ConfigRevoNanoHWWidget(this);
|
||||
}
|
||||
stackWidget->replaceTab(ConfigGadgetWidget::hardware, qwd);
|
||||
} else if ((board & 0xff00) == 0x0b00) {
|
||||
} else if ((board & 0xff00) == 0x9200) {
|
||||
// Sparky2
|
||||
QWidget *qwd = new ConfigRevoWidget(this);
|
||||
stackWidget->replaceTab(ConfigGadgetWidget::sensors, qwd);
|
||||
|
@ -208,7 +208,7 @@ void ConfigOPLinkWidget::updateSettings(UAVObject *object)
|
||||
UAVObjectField *board_type_field = oplinkStatusObj->getField("BoardType");
|
||||
switch (board_type_field->getValue().toInt()) {
|
||||
case 0x09: // Revolution, DiscoveryF4Bare, RevoNano, RevoProto
|
||||
case 0x0b: // Sparky2
|
||||
case 0x92: // Sparky2
|
||||
m_oplink->MainPort->setVisible(false);
|
||||
m_oplink->MainPortLabel->setVisible(false);
|
||||
m_oplink->FlexiPort->setVisible(false);
|
||||
|
@ -381,7 +381,7 @@ void ConfigOutputWidget::refreshWidgetsValues(UAVObject *obj)
|
||||
// Revolution Nano
|
||||
bankLabels << "1 (1)" << "2 (2,7,11)" << "3 (3)" << "4 (4)" << "5 (5-6)" << "6 (8-10,12)";
|
||||
channelBanks << 1 << 2 << 3 << 4 << 5 << 5 << 2 << 6 << 6 << 6 << 2 << 6;
|
||||
} else if (board == 0x0b01) {
|
||||
} else if (board == 0x9201) {
|
||||
// Sparky2
|
||||
bankLabels << "1 (1-2)" << "2 (3)" << "3 (4)" << "4 (5-6)" << "5 (7-8)" << "6 (9-10)";
|
||||
channelBanks << 1 << 1 << 2 << 3 << 4 << 4 << 5 << 5 << 6 << 6;
|
||||
|
@ -657,7 +657,7 @@ void ConfigStabilizationWidget::onBoardConnected()
|
||||
Q_ASSERT(utilMngr);
|
||||
boardModel = utilMngr->getBoardModel();
|
||||
// If Revolution/Sparky2 board enable Althold tab, otherwise disable it
|
||||
ui->AltitudeHold->setEnabled(((boardModel & 0xff00) == 0x0900) || ((boardModel & 0xff00) == 0x0b00));
|
||||
ui->AltitudeHold->setEnabled(((boardModel & 0xff00) == 0x0900) || ((boardModel & 0xff00) == 0x9200));
|
||||
}
|
||||
|
||||
void ConfigStabilizationWidget::stabBankChanged(int index)
|
||||
@ -689,7 +689,7 @@ void ConfigStabilizationWidget::stabBankChanged(int index)
|
||||
bool ConfigStabilizationWidget::shouldObjectBeSaved(UAVObject *object)
|
||||
{
|
||||
// AltitudeHoldSettings should only be saved for Revolution/Sparky2 board to avoid error.
|
||||
if (((boardModel & 0xff00) != 0x0900) && ((boardModel & 0xff00) != 0x0b00)) {
|
||||
if (((boardModel & 0xff00) != 0x0900) && ((boardModel & 0xff00) != 0x9200)) {
|
||||
return dynamic_cast<AltitudeHoldSettings *>(object) == 0;
|
||||
} else {
|
||||
return true;
|
||||
|
@ -603,7 +603,7 @@ void FlightLogManager::connectionStatusChanged()
|
||||
if (m_telemtryManager->isConnected()) {
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
UAVObjectUtilManager *utilMngr = pm->getObject<UAVObjectUtilManager>();
|
||||
setBoardConnected(utilMngr->getBoardModel() == 0x0903 || utilMngr->getBoardModel() == 0x0904 || utilMngr->getBoardModel() == 0x0905 || utilMngr->getBoardModel() == 0x0b01);
|
||||
setBoardConnected(utilMngr->getBoardModel() == 0x0903 || utilMngr->getBoardModel() == 0x0904 || utilMngr->getBoardModel() == 0x0905 || utilMngr->getBoardModel() == 0x9201);
|
||||
} else {
|
||||
setBoardConnected(false);
|
||||
}
|
||||
|
@ -31,10 +31,10 @@
|
||||
#include <QDebug>
|
||||
|
||||
#ifdef OPHID_DEBUG_ON
|
||||
#define OPHID_DEBUG(fmt, args ...) qDebug("[DEBUG] "fmt,##args)
|
||||
#define OPHID_TRACE(fmt, args ...) qDebug("[TRACE] %s:%s:%d: "fmt, __FILE__, __func__, __LINE__,##args)
|
||||
#define OPHID_ERROR(fmt, args ...) qDebug("[ERROR] %s:%s:%d: "fmt, __FILE__, __func__, __LINE__,##args)
|
||||
#define OPHID_WARNING(fmt, args ...) qDebug("[WARNING] "fmt,##args)
|
||||
#define OPHID_DEBUG(fmt, args ...) qDebug("[DEBUG] " ## fmt, args)
|
||||
#define OPHID_TRACE(fmt, args ...) qDebug("[TRACE] %s:%s:%d: " ## fmt, __FILE__, __func__, __LINE__, args)
|
||||
#define OPHID_ERROR(fmt, args ...) qDebug("[ERROR] %s:%s:%d: " ## fmt, __FILE__, __func__, __LINE__, args)
|
||||
#define OPHID_WARNING(fmt, args ...) qDebug("[WARNING] " ## fmt, args)
|
||||
#else
|
||||
#define OPHID_DEBUG(fmt, args ...)
|
||||
#define OPHID_TRACE(fmt, args ...)
|
||||
|
@ -117,7 +117,7 @@ SetupWizard::CONTROLLER_TYPE ControllerPage::getControllerType()
|
||||
case 0x0905:
|
||||
return SetupWizard::CONTROLLER_NANO;
|
||||
|
||||
case 0x0b01:
|
||||
case 0x9201:
|
||||
return SetupWizard::CONTROLLER_SPARKY2;
|
||||
|
||||
default:
|
||||
|
@ -9,9 +9,9 @@ public:
|
||||
QString gitTag;
|
||||
QByteArray fwHash;
|
||||
QByteArray uavoHash;
|
||||
int boardType;
|
||||
int boardRevision;
|
||||
static QString idToBoardName(int id)
|
||||
quint8 boardType;
|
||||
quint8 boardRevision;
|
||||
static QString idToBoardName(quint16 id)
|
||||
{
|
||||
switch (id) {
|
||||
case 0x0101:
|
||||
@ -59,7 +59,7 @@ public:
|
||||
// Nano
|
||||
return QString("RevoNano");
|
||||
|
||||
case 0x0b01:
|
||||
case 0x9201:
|
||||
// Sparky 2.0
|
||||
return QString("Sparky2");
|
||||
|
||||
|
@ -469,8 +469,8 @@ bool UAVObjectUtilManager::descriptionToStructure(QByteArray desc, deviceDescrip
|
||||
|
||||
// TODO: check platform compatibility
|
||||
QByteArray targetPlatform = desc.mid(12, 2);
|
||||
struc.boardType = (int)targetPlatform.at(0);
|
||||
struc.boardRevision = (int)targetPlatform.at(1);
|
||||
struc.boardType = (quint8)targetPlatform.at(0);
|
||||
struc.boardRevision = (quint8)targetPlatform.at(1);
|
||||
struc.fwHash.clear();
|
||||
struc.fwHash = desc.mid(40, 20);
|
||||
struc.uavoHash.clear();
|
||||
|
@ -112,7 +112,7 @@ void DeviceWidget::populate()
|
||||
// Nano
|
||||
devicePic.load(":/uploader/images/gcs-board-nano.png");
|
||||
break;
|
||||
case 0x0b01:
|
||||
case 0x9201:
|
||||
// Sparky2
|
||||
devicePic.load(":/uploader/images/gcs-board-sparky2.png");
|
||||
break;
|
||||
@ -203,7 +203,7 @@ bool DeviceWidget::populateBoardStructuredDescription(QByteArray desc)
|
||||
myDevice->lblCertified->setToolTip(tr("Untagged or custom firmware build"));
|
||||
}
|
||||
|
||||
myDevice->lblBrdName->setText(deviceDescriptorStruct::idToBoardName(onBoardDescription.boardType << 8 | onBoardDescription.boardRevision));
|
||||
myDevice->lblBrdName->setText(deviceDescriptorStruct::idToBoardName(((quint16)onBoardDescription.boardType << 8) | onBoardDescription.boardRevision));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -227,7 +227,7 @@ bool DeviceWidget::populateLoadedStructuredDescription(QByteArray desc)
|
||||
myDevice->lblCertifiedL->setPixmap(QPixmap(":uploader/images/warning.svg"));
|
||||
myDevice->lblCertifiedL->setToolTip(tr("Untagged or custom firmware build"));
|
||||
}
|
||||
myDevice->lblBrdNameL->setText(deviceDescriptorStruct::idToBoardName(LoadedDescription.boardType << 8 | LoadedDescription.boardRevision));
|
||||
myDevice->lblBrdNameL->setText(deviceDescriptorStruct::idToBoardName(((quint16)LoadedDescription.boardType << 8) | LoadedDescription.boardRevision));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -371,13 +371,15 @@ void DeviceWidget::uploadFirmware()
|
||||
// Now do sanity checking:
|
||||
// - Check whether board type matches firmware:
|
||||
int board = m_dfu->devices[deviceID].ID;
|
||||
int firmwareBoard = ((desc.at(12) & 0xff) << 8) + (desc.at(13) & 0xff);
|
||||
int firmwareBoard = ((quint16)(quint8)desc.at(12) << 8) + (quint16)(quint8)desc.at(13);
|
||||
if ((board == 0x0401 && firmwareBoard == 0x0402) ||
|
||||
(board == 0x0901 && firmwareBoard == 0x0902) || // L3GD20 revo supports Revolution firmware
|
||||
(board == 0x0902 && firmwareBoard == 0x0903)) { // RevoMini1 supporetd by RevoMini2 firmware
|
||||
// These firmwares are designed to be backwards compatible
|
||||
} else if (firmwareBoard != board) {
|
||||
status("Error: firmware does not match board", STATUSICON_FAIL);
|
||||
char buf[100];
|
||||
sprintf(buf, "Error: Device ID: firmware 0x%x does not match board 0x%x", firmwareBoard, board);
|
||||
status(buf, STATUSICON_FAIL);
|
||||
updateButtons(true);
|
||||
return;
|
||||
}
|
||||
|
@ -1089,6 +1089,7 @@ int DFUObject::receiveData(void *data, int size)
|
||||
#define BOARD_ID_PIP 3
|
||||
#define BOARD_ID_CC 4
|
||||
#define BOARD_ID_REVO 9
|
||||
#define BOARD_ID_SPARKY2 0x92
|
||||
|
||||
/**
|
||||
Gets the type of board connected
|
||||
@ -1117,6 +1118,9 @@ OP_DFU::eBoardType DFUObject::GetBoardType(int boardNum)
|
||||
case BOARD_ID_REVO: // Revo board
|
||||
brdType = eBoardRevo;
|
||||
break;
|
||||
case BOARD_ID_SPARKY2: // Sparky2 board
|
||||
brdType = eBoardSparky2;
|
||||
break;
|
||||
}
|
||||
return brdType;
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ enum Status {
|
||||
};
|
||||
|
||||
enum Actions {
|
||||
actionNone,
|
||||
actionProgram,
|
||||
actionProgramAndVerify,
|
||||
actionDownload,
|
||||
@ -94,12 +95,13 @@ enum eBoardType {
|
||||
eBoardPip = 3,
|
||||
eBoardCC = 4,
|
||||
eBoardRevo = 9,
|
||||
eBoardSparky2 = 0x92,
|
||||
};
|
||||
|
||||
struct device {
|
||||
int ID;
|
||||
quint16 ID;
|
||||
quint32 FW_CRC;
|
||||
int BL_Version;
|
||||
quint8 BL_Version;
|
||||
int SizeOfDesc;
|
||||
quint32 SizeOfCode;
|
||||
bool Readable;
|
||||
|
@ -97,7 +97,7 @@ void RunningDeviceWidget::populate()
|
||||
// Nano
|
||||
devicePic.load(":/uploader/images/gcs-board-nano.png");
|
||||
break;
|
||||
case 0x0b01:
|
||||
case 0x9201:
|
||||
// Sparky2
|
||||
devicePic.load(":/uploader/images/gcs-board-sparky2.png");
|
||||
break;
|
||||
|
@ -773,7 +773,7 @@ bool UploaderGadgetWidget::autoUpdate(bool erase)
|
||||
case 0x0905:
|
||||
filename = "fw_revonano";
|
||||
break;
|
||||
case 0x0b01:
|
||||
case 0x9201:
|
||||
filename = "fw_sparky2";
|
||||
break;
|
||||
default:
|
||||
|
@ -194,7 +194,7 @@ void UsageTrackerPlugin::collectUsageParameters(QMap<QString, QString> ¶mete
|
||||
parameters["conf_mport"] = getUAVFieldValue(objManager, "HwSettings", "RM_MainPort");
|
||||
parameters["conf_fport"] = getUAVFieldValue(objManager, "HwSettings", "RM_FlexiPort");
|
||||
parameters["conf_fusion"] = getUAVFieldValue(objManager, "RevoSettings", "FusionAlgorithm");
|
||||
} else if ((boardModel & 0xff00) == 0x0b00) {
|
||||
} else if ((boardModel & 0xff00) == 0x9200) {
|
||||
// Sparky2
|
||||
parameters["conf_rport"] = getUAVFieldValue(objManager, "HwSettings", "SPK2_RcvrPort");
|
||||
parameters["conf_mport"] = getUAVFieldValue(objManager, "HwSettings", "SPK2_MainPort");
|
||||
|
Loading…
x
Reference in New Issue
Block a user