Skip to content

Commit

Permalink
Fix Issue #298 and a few other iOS build fixes (#299)
Browse files Browse the repository at this point in the history
* increase sw freq limit

* Halfway done with config tool stuff

* added enable boxes

* more work on motor setup and testing

* Cleaned up some stuff

* intermediate changes for apps setup

* Update boardsetupwindow.cpp

* more progress on tool

* beta version of tool

* fixed minor bugs

* Update boardsetupwindow.cpp

* fixed compilation issues for 3.01

* Fixed autodetection of USB on windows

* remove extra file

* fixed a few minor issues

* make ios work again

* fix for package store data on iOS issue #298

* Fixed firmware archive on iOS and patched a few build issues introduced from recent changes

- QProcess is not supported on iOS among a couple other platforms
- Added timer workaround to not freeze UI when archive is downloaded on iOS
- Apparently on iOS a mkpath call is required before writing to appdata. This keeps files hidden nicely and seems to work well. Also prevents need for platform specific #ifdefs which is nice
  • Loading branch information
Jfriesen222 authored Feb 19, 2023
1 parent a539edb commit a1268bb
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 17 deletions.
12 changes: 10 additions & 2 deletions codeloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,11 @@ bool CodeLoader::installVescPackageFromPath(QString path)
QVariantList CodeLoader::reloadPackageArchive()
{
QVariantList res;
QString path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/vesc_pkg_all.rcc";
QString appDataLoc = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
if(!QDir(appDataLoc).exists()) {
QDir().mkpath(appDataLoc);
}
QString path = appDataLoc + "/vesc_pkg_all.rcc";
QFile file(path);
if (file.exists()) {
QResource::unregisterResource(path);
Expand Down Expand Up @@ -850,7 +854,11 @@ bool CodeLoader::downloadPackageArchive()
loop.exec();

if (reply->error() == QNetworkReply::NoError) {
QString path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/vesc_pkg_all.rcc";
QString appDataLoc = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
if(!QDir(appDataLoc).exists()) {
QDir().mkpath(appDataLoc);
}
QString path = appDataLoc + "/vesc_pkg_all.rcc";
QResource::unregisterResource(path);
QFile file(path);
if (file.open(QIODevice::WriteOnly)) {
Expand Down
18 changes: 9 additions & 9 deletions ios/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>$(Vesc Tool)</string>
<string>Vesc Tool</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<string>VESC Tool</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/QMake</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<string>com.vesc-project.vesc-tool</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<string>VESC Tool</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<string>6.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<string>6.0</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
Expand All @@ -37,7 +37,7 @@
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Need access to connect to VESC</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>$(PRODUCT_NAME) searches Bluetooth LE Devices (WaiterLock, Barcode Scanner, eGK)</string>
<string>VESC Tool searches Bluetooth LE Devices (WaiterLock, Barcode Scanner, eGK)</string>
<key>NSDocumentsFolderUsageDescription</key>
<string>Saves log files here</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
Expand All @@ -47,13 +47,13 @@
<key>NSLocationWhenInUseUsageDescription</key>
<string>Used for Ride Tracking</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>$(PRODUCT_NAME) uses photos</string>
<string>VESC Tool uses photos</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>location</string>
<string>bluetooth-central</string>
<string>location</string>
</array>
<key>UIFileSharingEnabled</key>
<true/>
Expand Down
3 changes: 3 additions & 0 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <QDebug>
#include <QInputDialog>
#include <QFileDialog>
#include <QProcess>
#include <QListWidgetItem>
#include <cmath>
#include <QEventLoop>
Expand Down Expand Up @@ -1171,6 +1172,7 @@ void MainWindow::on_actionExit_triggered()
qApp->exit();
}

#ifndef Q_OS_IOS
void MainWindow::on_actionLaunchBoardConfigurator_triggered()
{
QString program = qApp->arguments()[0];
Expand All @@ -1186,6 +1188,7 @@ void MainWindow::on_actionLaunchMobileTool_triggered()
qApp->quit();
QProcess::startDetached(program, params);
}
#endif

void MainWindow::on_actionAbout_triggered()
{
Expand Down
2 changes: 2 additions & 0 deletions mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ private slots:
void on_actionSaveAppconfXml_triggered();
void on_actionLoadAppconfXml_triggered();
void on_actionExit_triggered();
#ifndef Q_OS_IOS
void on_actionLaunchBoardConfigurator_triggered();
void on_actionLaunchMobileTool_triggered();
#endif
void on_actionAbout_triggered();
void on_actionLibrariesUsed_triggered();
void on_dutyButton_clicked();
Expand Down
11 changes: 11 additions & 0 deletions mobile/FwUpdate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,17 @@ Item {

onAccepted: {
archUpdateButton.enabled = false
workaroundTimerDl.start()
}
}

Timer {
id: workaroundTimerDl
interval: 0
repeat: false
running: false
onTriggered: {
// dlArchive...
VescIf.downloadFwArchive()
updateArch(VescIf.getLastFwRxParams())
archUpdateButton.enabled = true
Expand Down
7 changes: 5 additions & 2 deletions mobile/fwhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,11 @@ bool FwHelper::uploadFirmwareSingleShotTimer(QString filename, VescInterface *ve
QVariantMap FwHelper::getArchiveDirs()
{
QVariantMap fws;

QString path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/res_fw.rcc";
QString appDataLoc = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
if(!QDir(appDataLoc).exists()) {
QDir().mkpath(appDataLoc);
}
QString path = appDataLoc + "/res_fw.rcc";
QFile file(path);
if (file.exists()) {
QResource::unregisterResource(path);
Expand Down
9 changes: 6 additions & 3 deletions vescinterface.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
Copyright 2016 - 2020 Benjamin Vedder [email protected]
This file is part of VESC Tool.
Expand Down Expand Up @@ -3993,8 +3993,11 @@ bool VescInterface::downloadFwArchive()
QNetworkAccessManager manager;
QNetworkRequest request(url);
QNetworkReply *reply = manager.get(request);

QString path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/res_fw.rcc";
QString appDataLoc = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
if(!QDir(appDataLoc).exists()) {
QDir().mkpath(appDataLoc);
}
QString path = appDataLoc + "/res_fw.rcc";
QFile file(path);
QResource::unregisterResource(path);
if (file.open(QIODevice::WriteOnly)) {
Expand Down
3 changes: 2 additions & 1 deletion widgets/experimentplot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/


#include <QFileDialog>
#include <QMessageBox>
#include "experimentplot.h"
#include "ui_experimentplot.h"
#include "utility.h"
Expand Down

0 comments on commit a1268bb

Please sign in to comment.