Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: huangziyi <[email protected]>
  • Loading branch information
MrThanlon committed Dec 25, 2023
1 parent c1191e0 commit bb71f71
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 64 deletions.
8 changes: 6 additions & 2 deletions src/plugins/openmv/openmvplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1853,13 +1853,17 @@ void OpenMVPlugin::extensionsInitialized()
helpMenu->addAction(aboutCommand, Core::Constants::G_HELP_ABOUT);
connect(aboutAction, &QAction::triggered, this, [] {
QMessageBox::about(Core::ICore::dialogParent(), Tr::tr("About CanMV IDE"), Tr::tr(
"<p><b>About CanMV IDE %L1</b></p>"
"<p><b>About CanMV IDE %L1-%L4</b></p>"
"<p>By: Canaan Inc.</p>"
"<p>Based on OpenMV IDE By Ibrahim Abdelkader & Kwabena W. Agyeman</p>"
"<p><b>GNU GENERAL PUBLIC LICENSE</b></p>"
"<p>Copyright (C) %L2 %L3</p>"
"<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the <a href=\"https://github.com/openmv/qt-creator/raw/master/LICENSE.GPL3-EXCEPT\">GNU General Public License</a> for more details.</p>"
).arg(QLatin1String(Core::Constants::IDE_VERSION_LONG)).arg(QLatin1String(Core::Constants::IDE_YEAR)).arg(QLatin1String(Core::Constants::IDE_AUTHOR)) + Tr::tr(
)
.arg(QLatin1String(Core::Constants::IDE_VERSION_LONG))
.arg(QLatin1String(Core::Constants::IDE_YEAR))
.arg(QLatin1String(Core::Constants::IDE_AUTHOR))
.arg(QLatin1String("0")) + Tr::tr(
"<p><b>Credits</b></p>") + Tr::tr(
"<p>OpenMV IDE English translation by Kwabena W. Agyeman.</p>")
);
Expand Down
63 changes: 1 addition & 62 deletions src/plugins/openmv/openmvpluginconnect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,12 +592,7 @@ QPair<QStringList, QStringList> filterPorts(const QString &serialNumberFilter,

if(port.hasVendorIdentifier() && port.hasProductIdentifier()
&& (serialNumberFilter.isEmpty() || (serialNumberFilter == port.serialNumber().toUpper()))
&& (((port.vendorIdentifier() == OPENMVCAM_VID) && (port.productIdentifier() == OPENMVCAM_PID) && (port.serialNumber() != QStringLiteral("000000000010")) && (port.serialNumber() != QStringLiteral("000000000011")))
|| ((port.vendorIdentifier() == ARDUINOCAM_VID) && (((port.productIdentifier() & ARDUINOCAM_PID_MASK) == ARDUINOCAM_PH7_PID) ||
((port.productIdentifier() & ARDUINOCAM_PID_MASK) == ARDUINOCAM_NRF_PID) ||
((port.productIdentifier() & ARDUINOCAM_PID_MASK) == ARDUINOCAM_RPI_PID) ||
((port.productIdentifier() & ARDUINOCAM_PID_MASK) == ARDUINOCAM_NCL_PID)))
|| ((port.vendorIdentifier() == RPI2040_VID) && (port.productIdentifier() == RPI2040_PID))))
&& (((port.vendorIdentifier() == OPENMVCAM_VID) && (port.productIdentifier() == OPENMVCAM_PID) && (port.serialNumber() != QStringLiteral("000000000010")) && (port.serialNumber() != QStringLiteral("000000000011")))))
{
stringList.append(port.portName());
}
Expand All @@ -608,62 +603,6 @@ QPair<QStringList, QStringList> filterPorts(const QString &serialNumberFilter,
stringList = stringList.filter(QStringLiteral("cu"), Qt::CaseInsensitive);
}

if(!forceBootloader)
{
foreach(wifiPort_t port, availableWifiPorts)
{
stringList.append(QString(QStringLiteral("%1:%2")).arg(port.name).arg(port.addressAndPort));
}
}

dfuDevices = picotoolGetDevices() + imxGetAllDevices();

foreach(const QString &device, getDevices())
{
dfuDevices.append(device);
QStringList vidpid = device.split(QStringLiteral(",")).first().split(QStringLiteral(":"));

for(QList<QString>::iterator it = stringList.begin(); it != stringList.end(); )
{
QSerialPortInfo raw_info = QSerialPortInfo(*it);
MyQSerialPortInfo info(raw_info);

if(info.hasVendorIdentifier()
&& info.vendorIdentifier() == vidpid.at(0).toInt(nullptr, 16)
&& info.hasProductIdentifier()
&& info.productIdentifier() == vidpid.at(1).toInt(nullptr, 16))
{
it = stringList.erase(it);
}
else
{
it++;
}
}
}

// Move known bootloader serial ports to dfuDevices.
{
for(QList<QString>::iterator it = stringList.begin(); it != stringList.end(); )
{
QSerialPortInfo raw_info = QSerialPortInfo(*it);
MyQSerialPortInfo info(raw_info);

if(info.hasVendorIdentifier()
&& (info.vendorIdentifier() == ARDUINOCAM_VID)
&& info.hasProductIdentifier()
&& ((info.productIdentifier() == NRF_OLD_PID) || (info.productIdentifier() == NRF_LDR_PID) || (info.productIdentifier() == RPI_OLD_PID) || (info.productIdentifier() == RPI_LDR_PID)))
{
dfuDevices.append(QString(QStringLiteral("%1:%2").arg(info.vendorIdentifier(), 4, 16, QLatin1Char('0')).arg(info.productIdentifier(), 4, 16, QLatin1Char('0'))));
it = stringList.erase(it);
}
else
{
it++;
}
}
}

return QPair<QStringList, QStringList>(stringList, dfuDevices);
}

Expand Down

0 comments on commit bb71f71

Please sign in to comment.