Merge branch '2.2' into 2.3
This commit is contained in:
@@ -82,8 +82,9 @@ const char * const OPENTX_COMPANION_DOWNLOAD_URL[] = {
|
||||
};
|
||||
|
||||
MainWindow::MainWindow():
|
||||
downloadDialog_forWait(NULL),
|
||||
downloadDialog_forWait(nullptr),
|
||||
checkForUpdatesState(0),
|
||||
networkManager(nullptr),
|
||||
windowsListActions(new QActionGroup(this))
|
||||
{
|
||||
// setUnifiedTitleAndToolBarOnMac(true);
|
||||
@@ -260,39 +261,50 @@ QString MainWindow::getCompanionUpdateBaseUrl()
|
||||
|
||||
void MainWindow::checkForUpdates()
|
||||
{
|
||||
if (!checkForUpdatesState) {
|
||||
closeUpdatesWaitDialog();
|
||||
if (networkManager) {
|
||||
networkManager->deleteLater();
|
||||
networkManager = nullptr;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (checkForUpdatesState & SHOW_DIALOG_WAIT) {
|
||||
checkForUpdatesState -= SHOW_DIALOG_WAIT;
|
||||
downloadDialog_forWait = new downloadDialog(NULL, tr("Checking for updates"));
|
||||
downloadDialog_forWait->show();
|
||||
}
|
||||
|
||||
if (networkManager)
|
||||
disconnect(networkManager, 0, this, 0);
|
||||
else
|
||||
networkManager = new QNetworkAccessManager(this);
|
||||
|
||||
QUrl url;
|
||||
if (checkForUpdatesState & CHECK_COMPANION) {
|
||||
checkForUpdatesState -= CHECK_COMPANION;
|
||||
// TODO why create each time a network manager?
|
||||
networkManager = new QNetworkAccessManager(this);
|
||||
connect(networkManager, SIGNAL(finished(QNetworkReply*)),this, SLOT(checkForCompanionUpdateFinished(QNetworkReply*)));
|
||||
QUrl url(QString("%1/%2").arg(getCompanionUpdateBaseUrl()).arg(COMPANION_STAMP));
|
||||
url.setUrl(QString("%1/%2").arg(getCompanionUpdateBaseUrl()).arg(COMPANION_STAMP));
|
||||
connect(networkManager, &QNetworkAccessManager::finished, this, &MainWindow::checkForCompanionUpdateFinished);
|
||||
qDebug() << "Checking for Companion update " << url.url();
|
||||
QNetworkRequest request(url);
|
||||
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
|
||||
networkManager->get(request);
|
||||
}
|
||||
else if (checkForUpdatesState & CHECK_FIRMWARE) {
|
||||
checkForUpdatesState -= CHECK_FIRMWARE;
|
||||
QString stamp = getCurrentFirmware()->getStampUrl();
|
||||
const QString stamp = getCurrentFirmware()->getStampUrl();
|
||||
if (!stamp.isEmpty()) {
|
||||
networkManager = new QNetworkAccessManager(this);
|
||||
connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(checkForFirmwareUpdateFinished(QNetworkReply*)));
|
||||
QUrl url(stamp);
|
||||
url.setUrl(stamp);
|
||||
connect(networkManager, &QNetworkAccessManager::finished, this, &MainWindow::checkForFirmwareUpdateFinished);
|
||||
qDebug() << "Checking for firmware update " << url.url();
|
||||
QNetworkRequest request(url);
|
||||
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
|
||||
networkManager->get(request);
|
||||
}
|
||||
}
|
||||
else if (checkForUpdatesState==0) {
|
||||
closeUpdatesWaitDialog();
|
||||
if (!url.isValid()) {
|
||||
checkForUpdates();
|
||||
return;
|
||||
}
|
||||
|
||||
QNetworkRequest request(url);
|
||||
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
|
||||
networkManager->get(request);
|
||||
}
|
||||
|
||||
void MainWindow::onUpdatesError()
|
||||
@@ -328,6 +340,7 @@ QString MainWindow::seekCodeString(const QByteArray & qba, const QString & label
|
||||
void MainWindow::checkForCompanionUpdateFinished(QNetworkReply * reply)
|
||||
{
|
||||
QByteArray qba = reply->readAll();
|
||||
reply->deleteLater();
|
||||
QString version = seekCodeString(qba, "VERSION");
|
||||
if (version.isNull())
|
||||
return onUpdatesError();
|
||||
@@ -439,6 +452,7 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
|
||||
bool ignore = false;
|
||||
|
||||
QByteArray qba = reply->readAll();
|
||||
reply->deleteLater();
|
||||
QString versionString = seekCodeString(qba, "VERSION");
|
||||
QString dateString = seekCodeString(qba, "DATE");
|
||||
if (versionString.isNull() || dateString.isNull())
|
||||
|
||||
@@ -48,5 +48,6 @@ void ReleaseNotesFirmwareDialog::replyFinished(QNetworkReply * reply)
|
||||
{
|
||||
ui->textEditor->setHtml(reply->readAll());
|
||||
ui->textEditor->setOpenExternalLinks(true);
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
+17
-14
@@ -22,7 +22,10 @@
|
||||
// i.e. BACKUP RAM Backup/Restore functions
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "dataconstants.h"
|
||||
#include "definitions.h"
|
||||
|
||||
#define ARM_FIELD(x) x;
|
||||
#define AVR_FIELD(x)
|
||||
@@ -168,10 +171,10 @@ PACK(struct CustomFunctionData {
|
||||
NOBACKUP(CFN_SPARE_TYPE spare);
|
||||
}) all;
|
||||
|
||||
PACK(struct {
|
||||
NOBACKUP(PACK(struct {
|
||||
int32_t val1;
|
||||
NOBACKUP(CFN_SPARE_TYPE val2);
|
||||
}) clear;
|
||||
}) clear);
|
||||
});
|
||||
uint8_t active;
|
||||
});
|
||||
@@ -371,11 +374,11 @@ PACK(struct MavlinkTelemetryData {
|
||||
PACK(struct TelemetrySensor {
|
||||
union {
|
||||
uint16_t id; // data identifier, for FrSky we can reuse existing ones. Source unit is derived from type.
|
||||
uint16_t persistentValue;
|
||||
NOBACKUP(uint16_t persistentValue);
|
||||
};
|
||||
union {
|
||||
uint8_t instance; // instance ID to allow handling multiple instances of same value type, for FrSky can be the physical ID of the sensor
|
||||
uint8_t formula;
|
||||
NOBACKUP(uint8_t formula);
|
||||
};
|
||||
char label[TELEM_LABEL_LEN]; // user defined label
|
||||
uint8_t type:1; // 0=custom / 1=calculated
|
||||
@@ -388,27 +391,27 @@ PACK(struct TelemetrySensor {
|
||||
uint8_t onlyPositive:1;
|
||||
uint8_t subId:3;
|
||||
union {
|
||||
PACK(struct {
|
||||
NOBACKUP(PACK(struct {
|
||||
uint16_t ratio;
|
||||
int16_t offset;
|
||||
}) custom;
|
||||
PACK(struct {
|
||||
}) custom);
|
||||
NOBACKUP(PACK(struct {
|
||||
uint8_t source;
|
||||
uint8_t index;
|
||||
uint16_t spare;
|
||||
}) cell;
|
||||
PACK(struct {
|
||||
}) cell);
|
||||
NOBACKUP(PACK(struct {
|
||||
int8_t sources[4];
|
||||
}) calc;
|
||||
PACK(struct {
|
||||
}) calc);
|
||||
NOBACKUP(PACK(struct {
|
||||
uint8_t source;
|
||||
uint8_t spare[3];
|
||||
}) consumption;
|
||||
PACK(struct {
|
||||
}) consumption);
|
||||
NOBACKUP(PACK(struct {
|
||||
uint8_t gps;
|
||||
uint8_t alt;
|
||||
uint16_t spare;
|
||||
}) dist;
|
||||
}) dist);
|
||||
uint32_t param;
|
||||
};
|
||||
NOBACKUP(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//This file was auto-generated by generate_datacopy.py script on Sat May 7 11:05:00 2016. Do not edit this file!
|
||||
//This file was auto-generated by generate_datacopy.py script on Mon Jul 2 14:20:48 2018. Do not edit this file!
|
||||
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ void copytrim_t(A * dest, B * src)
|
||||
template <class A, class B>
|
||||
void copyFlightModeData(A * dest, B * src)
|
||||
{
|
||||
for (int i=0; i<NUM_STICKS; i++) {
|
||||
for (int i=0; i<6; i++) {
|
||||
copytrim_t(&dest->trim[i], &src->trim[i]);
|
||||
}
|
||||
dest->swtch = src->swtch;
|
||||
@@ -101,6 +101,14 @@ void copyFlightModeData(A * dest, B * src)
|
||||
memcpy(dest->gvars, src->gvars, sizeof(dest->gvars));
|
||||
}
|
||||
|
||||
template <class A, class B>
|
||||
void copyCurveData(A * dest, B * src)
|
||||
{
|
||||
dest->type = src->type;
|
||||
dest->smooth = src->smooth;
|
||||
dest->points = src->points;
|
||||
}
|
||||
|
||||
template <class A, class B>
|
||||
void copyGVarData(A * dest, B * src)
|
||||
{
|
||||
@@ -122,6 +130,7 @@ void copyTimerData(A * dest, B * src)
|
||||
dest->minuteBeep = src->minuteBeep;
|
||||
dest->persistent = src->persistent;
|
||||
dest->countdownStart = src->countdownStart;
|
||||
dest->direction = src->direction;
|
||||
}
|
||||
|
||||
template <class A, class B>
|
||||
@@ -146,10 +155,13 @@ void copyScriptData(A * dest, B * src)
|
||||
}
|
||||
|
||||
template <class A, class B>
|
||||
void copyFrSkyRSSIAlarm(A * dest, B * src)
|
||||
void copyRssiAlarmData(A * dest, B * src)
|
||||
{
|
||||
dest->level = src->level;
|
||||
dest->value = src->value;
|
||||
dest->disabled = src->disabled;
|
||||
dest->spare = src->spare;
|
||||
dest->warning = src->warning;
|
||||
dest->spare2 = src->spare2;
|
||||
dest->critical = src->critical;
|
||||
}
|
||||
|
||||
template <class A, class B>
|
||||
@@ -161,9 +173,6 @@ void copyFrSkyTelemetryData(A * dest, B * src)
|
||||
dest->varioCenterMin = src->varioCenterMin;
|
||||
dest->varioMin = src->varioMin;
|
||||
dest->varioMax = src->varioMax;
|
||||
for (int i=0; i<2; i++) {
|
||||
copyFrSkyRSSIAlarm(&dest->rssiAlarms[i], &src->rssiAlarms[i]);
|
||||
}
|
||||
}
|
||||
|
||||
template <class A, class B>
|
||||
@@ -181,7 +190,7 @@ void copyTelemetrySensor(A * dest, B * src)
|
||||
dest->persistent = src->persistent;
|
||||
dest->onlyPositive = src->onlyPositive;
|
||||
dest->subId = src->subId;
|
||||
copyTelemetrySensor_custom(&dest->custom, &src->custom);
|
||||
dest->param = src->param;
|
||||
}
|
||||
|
||||
template <class A, class B>
|
||||
@@ -205,23 +214,6 @@ void copyModelHeader(A * dest, B * src)
|
||||
memcpy(dest->modelId, src->modelId, sizeof(dest->modelId));
|
||||
}
|
||||
|
||||
template <class A, class B>
|
||||
void copyZone(A * dest, B * src)
|
||||
{
|
||||
dest->x = src->x;
|
||||
dest->y = src->y;
|
||||
dest->w = src->w;
|
||||
dest->h = src->h;
|
||||
}
|
||||
|
||||
template <class A, class B>
|
||||
void copyZoneOption(A * dest, B * src)
|
||||
{
|
||||
dest->name = src->name;
|
||||
dest->type = src->type;
|
||||
dest->deflt = src->deflt;
|
||||
}
|
||||
|
||||
template <class A, class B>
|
||||
void copyCustomScreenData(A * dest, B * src)
|
||||
{
|
||||
@@ -257,7 +249,9 @@ void copyModelData(A * dest, B * src)
|
||||
for (int i=0; i<64; i++) {
|
||||
copyExpoData(&dest->expoData[i], &src->expoData[i]);
|
||||
}
|
||||
memcpy(dest->curves, src->curves, sizeof(dest->curves));
|
||||
for (int i=0; i<32; i++) {
|
||||
copyCurveData(&dest->curves[i], &src->curves[i]);
|
||||
}
|
||||
memcpy(dest->points, src->points, sizeof(dest->points));
|
||||
for (int i=0; i<64; i++) {
|
||||
copyLogicalSwitchData(&dest->logicalSw[i], &src->logicalSw[i]);
|
||||
@@ -309,10 +303,12 @@ void copyTrainerData(A * dest, B * src)
|
||||
template <class A, class B>
|
||||
void copyRadioData(A * dest, B * src)
|
||||
{
|
||||
for (int i=0; i<11; i++) {
|
||||
for (int i=0; i<13; i++) {
|
||||
copyCalibData(&dest->calib[i], &src->calib[i]);
|
||||
}
|
||||
dest->stickMode = src->stickMode;
|
||||
dest->telemetryBaudrate = src->telemetryBaudrate;
|
||||
dest->splashSpares = src->splashSpares;
|
||||
dest->switchesDelay = src->switchesDelay;
|
||||
for (int i=0; i<64; i++) {
|
||||
copyCustomFunctionData(&dest->customFn[i], &src->customFn[i]);
|
||||
@@ -330,13 +326,6 @@ void copyCustomFunctionData_all(A * dest, B * src)
|
||||
dest->param = src->param;
|
||||
}
|
||||
|
||||
template <class A, class B>
|
||||
void copyTelemetrySensor_custom(A * dest, B * src)
|
||||
{
|
||||
dest->ratio = src->ratio;
|
||||
dest->offset = src->offset;
|
||||
}
|
||||
|
||||
template <class A, class B>
|
||||
void copyModuleData_ppm(A * dest, B * src)
|
||||
{
|
||||
|
||||
@@ -155,7 +155,7 @@ set(STM32LIB_SRC
|
||||
if(PYTHONINTERP_FOUND)
|
||||
add_custom_target(datacopy
|
||||
WORKING_DIRECTORY ${RADIO_DIRECTORY}/src
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${RADIO_DIRECTORY}/util/generate_datacopy.py datastructs.h -DPCBHORUS -DCPUARM -DCOLORLCD -DCPUARM -DBACKUP > storage/datacopy.cpp
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${RADIO_DIRECTORY}/util/generate_datacopy.py datastructs.h -DPCBHORUS -DPCBX10 -DCPUARM -DCOLORLCD -DBACKUP -DVIRTUAL_INPUTS -Itargets/horus > storage/datacopy.cpp
|
||||
DEPENDS ${RADIO_DIRECTORY}/src/datastructs.h ${RADIO_DIRECTORY}/util/generate_datacopy.py
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -8,8 +8,16 @@ import time
|
||||
import os
|
||||
|
||||
if sys.platform == "darwin":
|
||||
clang.cindex.Config.set_library_file('/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib')
|
||||
if os.path.exists('/usr/local/Cellar/llvm/6.0.0/lib/libclang.dylib'):
|
||||
clang.cindex.Config.set_library_file('/usr/local/Cellar/llvm/6.0.0/lib/libclang.dylib')
|
||||
elif os.path.exists('/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib'):
|
||||
clang.cindex.Config.set_library_file('/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib')
|
||||
elif os.path.exists('/Library/Developer/CommandLineTools/usr/lib/libclang.dylib'):
|
||||
clang.cindex.Config.set_library_file('/Library/Developer/CommandLineTools/usr/lib/libclang.dylib')
|
||||
|
||||
if sys.platform == "linux2":
|
||||
if os.path.exists('/usr/lib/x86_64-linux-gnu/libclang-3.8.so.1'):
|
||||
clang.cindex.Config.set_library_file('/usr/lib/x86_64-linux-gnu/libclang-3.8.so.1')
|
||||
|
||||
structs = []
|
||||
extrastructs = []
|
||||
@@ -41,15 +49,15 @@ def build_struct(cursor, anonymousUnion=False):
|
||||
elif c.kind == clang.cindex.CursorKind.FIELD_DECL:
|
||||
copy_decl(c, c.spelling)
|
||||
|
||||
|
||||
if not anonymousUnion:
|
||||
print("}\n")
|
||||
|
||||
def build(cursor):
|
||||
result = []
|
||||
for c in cursor.get_children():
|
||||
if c.kind == clang.cindex.CursorKind.STRUCT_DECL:
|
||||
build_struct(c)
|
||||
if c.location.file.name == sys.argv[1]:
|
||||
if c.kind == clang.cindex.CursorKind.STRUCT_DECL:
|
||||
build_struct(c)
|
||||
for c, spelling in extrastructs:
|
||||
print("template <class A, class B>\nvoid copy%s(A * dest, B * src)\n{" % spelling)
|
||||
build_struct(c, True)
|
||||
@@ -67,7 +75,7 @@ def copy_decl(c, spelling):
|
||||
print(" }")
|
||||
else:
|
||||
print(" memcpy(dest->%s, src->%s, sizeof(dest->%s));" % (spelling, spelling, spelling))
|
||||
elif c.type.kind == clang.cindex.TypeKind.UNEXPOSED and len(childs)==1 and childs[0].kind == clang.cindex.CursorKind.STRUCT_DECL:
|
||||
elif len(childs)==1 and childs[0].kind == clang.cindex.CursorKind.STRUCT_DECL and not childs[0].spelling:
|
||||
# inline declared structs
|
||||
if c.semantic_parent.spelling:
|
||||
spellingFunc = c.semantic_parent.spelling + "_" + spelling
|
||||
|
||||
Reference in New Issue
Block a user