Merge with latest 2.3
This commit is contained in:
@@ -54,7 +54,7 @@ DownloadDialog::DownloadDialog(QWidget *parent, QString src, QString tgt):
|
||||
reply = qnam.get(QNetworkRequest(QUrl(src)));
|
||||
connect(reply, SIGNAL(finished()), this, SLOT(httpFinished()));
|
||||
connect(reply, SIGNAL(readyRead()), this, SLOT(httpReadyRead()));
|
||||
connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(updateDataReadProgress(qint64,qint64)));
|
||||
connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(updateDataReadProgress(qint64, qint64)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ void DownloadDialog::updateDataReadProgress(qint64 bytesRead, qint64 totalBytes)
|
||||
void DownloadDialog::fileError()
|
||||
{
|
||||
delete file;
|
||||
file = NULL;
|
||||
file = nullptr;
|
||||
reject();
|
||||
}
|
||||
|
||||
|
||||
@@ -45,15 +45,12 @@ AdjustmentReference::AdjustmentReference(AdjustRefType type, int value)
|
||||
|
||||
bool AdjustmentReference::isValid(const int value) const
|
||||
{
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case ADJUST_REF_VALUE:
|
||||
if (abs(value) < ADJUST_REF_GVAR_BASE)
|
||||
return true;
|
||||
break;
|
||||
return abs(value) < ADJUST_REF_GVAR_BASE;
|
||||
|
||||
case ADJUST_REF_GVAR:
|
||||
if (abs(value) > 0 && abs(value) <= CPN_MAX_GVARS);
|
||||
return true;
|
||||
break;
|
||||
return abs(value) > 0 && abs(value) <= CPN_MAX_GVARS;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,8 @@ class LimitData {
|
||||
int offset;
|
||||
int ppmCenter;
|
||||
bool symetrical;
|
||||
char name[LIMITDATA_NAME_LEN+1];
|
||||
int failsafe;
|
||||
char name[LIMITDATA_NAME_LEN + 1];
|
||||
CurveReference curve;
|
||||
QString minToString() const;
|
||||
QString maxToString() const;
|
||||
|
||||
@@ -1174,8 +1174,7 @@ void ModelData::updateModuleFailsafes(ModuleData * md)
|
||||
|
||||
bool updated = false;
|
||||
|
||||
switch (updRefInfo.action)
|
||||
{
|
||||
switch (updRefInfo.action) {
|
||||
case REF_UPD_ACT_CLEAR:
|
||||
break;
|
||||
case REF_UPD_ACT_SHIFT:
|
||||
@@ -1183,16 +1182,16 @@ void ModelData::updateModuleFailsafes(ModuleData * md)
|
||||
return;
|
||||
|
||||
if (updRefInfo.shift > 0) {
|
||||
for (int i = (CPN_MAX_CHNOUT - 1); i > updRefInfo.index1; i--) {
|
||||
md->failsafeChannels[i] = md->failsafeChannels[i - 1];
|
||||
for (int i = CPN_MAX_CHNOUT - 1; i > updRefInfo.index1; i--) {
|
||||
limitData[i].failsafe = limitData[i - 1].failsafe;
|
||||
}
|
||||
md->failsafeChannels[updRefInfo.index1] = 0;
|
||||
limitData[updRefInfo.index1].failsafe = 0;
|
||||
}
|
||||
else {
|
||||
for (int i = (updRefInfo.index1 + 1); i < (CPN_MAX_CHNOUT - 1); i++) {
|
||||
md->failsafeChannels[i - 1] = md->failsafeChannels[i];
|
||||
for (int i = updRefInfo.index1 + 1; i < CPN_MAX_CHNOUT - 1; i++) {
|
||||
limitData[i - 1].failsafe = limitData[i].failsafe;
|
||||
}
|
||||
md->failsafeChannels[CPN_MAX_CHNOUT - 1] = 0;
|
||||
limitData[CPN_MAX_CHNOUT - 1].failsafe = 0;
|
||||
}
|
||||
updated = true;
|
||||
break;
|
||||
@@ -1200,17 +1199,18 @@ void ModelData::updateModuleFailsafes(ModuleData * md)
|
||||
int tmp;
|
||||
if (updRefInfo.index1 >= 0 && updRefInfo.index1 < CPN_MAX_CHNOUT) {
|
||||
updated = true;
|
||||
tmp = md->failsafeChannels[updRefInfo.index1];
|
||||
tmp = limitData[updRefInfo.index1].failsafe;
|
||||
if (updRefInfo.index2 >= 0 && updRefInfo.index2 < CPN_MAX_CHNOUT)
|
||||
md->failsafeChannels[updRefInfo.index1] = md->failsafeChannels[updRefInfo.index2];
|
||||
limitData[updRefInfo.index1].failsafe = limitData[updRefInfo.index2].failsafe;
|
||||
else
|
||||
md->failsafeChannels[updRefInfo.index1] = 0;
|
||||
limitData[updRefInfo.index1].failsafe = 0;
|
||||
}
|
||||
else
|
||||
tmp = 0;
|
||||
if (updRefInfo.index2 >= 0 && updRefInfo.index2 < CPN_MAX_CHNOUT)
|
||||
if (updRefInfo.index2 >= 0 && updRefInfo.index2 < CPN_MAX_CHNOUT) {
|
||||
updated = true;
|
||||
md->failsafeChannels[updRefInfo.index2] = tmp;
|
||||
limitData[updRefInfo.index2].failsafe = tmp;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Error - unhandled action:" << updRefInfo.action;
|
||||
|
||||
@@ -132,7 +132,8 @@ enum MultiModuleRFProtocols {
|
||||
MODULE_SUBTYPE_MULTI_ESKY150V2,
|
||||
MODULE_SUBTYPE_MULTI_DSM_RX,
|
||||
MODULE_SUBTYPE_MULTI_JJRC345,
|
||||
MODULE_SUBTYPE_MULTI_LAST = MODULE_SUBTYPE_MULTI_JJRC345
|
||||
MODULE_SUBTYPE_MULTI_Q90C,
|
||||
MODULE_SUBTYPE_MULTI_LAST = MODULE_SUBTYPE_MULTI_Q90C
|
||||
};
|
||||
|
||||
enum TrainerProtocol {
|
||||
@@ -158,7 +159,11 @@ class ModuleData {
|
||||
Q_DECLARE_TR_FUNCTIONS(ModuleData)
|
||||
|
||||
public:
|
||||
ModuleData() { clear(); }
|
||||
ModuleData()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
unsigned int modelId;
|
||||
unsigned int protocol; // type in datastructs.h
|
||||
int rfProtocol; // rfProtocol in datastructs.h
|
||||
@@ -168,7 +173,6 @@ class ModuleData {
|
||||
unsigned int channelsStart;
|
||||
int channelsCount; // 0=8 channels
|
||||
unsigned int failsafeMode;
|
||||
int failsafeChannels[CPN_MAX_CHNOUT];
|
||||
|
||||
struct PPM {
|
||||
int delay;
|
||||
|
||||
@@ -50,7 +50,7 @@ static const QStringList STR_SUBTYPE_SYMAX {"Standard", "Syma X5C"};
|
||||
static const QStringList STR_SUBTYPE_SLT {"V1 (6 Channel)", "V2 (8 Channel)", "Q100", "Q200", "MR100"};
|
||||
static const QStringList STR_SUBTYPE_CX10 {"Green", "Blue", "DM007", "-", "JC3015a", "JC3015b", "MK33041"};
|
||||
static const QStringList STR_SUBTYPE_CG023 {"Standard", "YD829"};
|
||||
static const QStringList STR_SUBTYPE_BAYANG {"Standard", "H8S3D", "X16 AH", "IRDRONE", "DHD D4"};
|
||||
static const QStringList STR_SUBTYPE_BAYANG {"Standard", "H8S3D", "X16 AH", "IRDRONE", "DHD D4", "QX100"};
|
||||
static const QStringList STR_SUBTYPE_ESky {"Standard", "ET4"};
|
||||
static const QStringList STR_SUBTYPE_MT99 {"MT99", "H7", "YZ", "LS", "FY805"};
|
||||
static const QStringList STR_SUBTYPE_MJXQ {"WLH08", "X600", "X800", "H26D", "E010", "H26WH", "Phoenix"};
|
||||
@@ -76,7 +76,9 @@ static const QStringList STR_SUBTYPE_POTENSIC {"A20 Firefly"};
|
||||
static const QStringList STR_SUBTYPE_ZSX {"JJRC ZSX-280"};
|
||||
static const QStringList STR_SUBTYPE_FLYZONE {"FZ-410 TX"};
|
||||
static const QStringList STR_SUBTYPE_FRSKYX_RX {"RX", "Clone TX"};
|
||||
static const QStringList STR_SUBTYPE_HOTT {"Sync", "No_Sync"};
|
||||
static const QStringList STR_SUBTYPE_FX816 {"P38"};
|
||||
static const QStringList STR_SUBTYPE_PELIKAN {"Pro", "Lite"};
|
||||
static const QStringList STR_SUBTYPE_XK {"X450", "X420"};
|
||||
static const QStringList STR_SUBTYPE_XN297DUMP {"250K", "1M", "2M", "AUTO"};
|
||||
static const QStringList STR_SUBTYPE_FRSKYX2 {"D16", "D16 8ch", "D16 EU-LBT", "D16 EU-LBT 8ch", "D16 Cloned"};
|
||||
@@ -104,7 +106,7 @@ const Multiprotocols multiProtocols {
|
||||
{MODULE_SUBTYPE_MULTI_SLT, 4, false, STR_SUBTYPE_SLT, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_CX10, 6, false, STR_SUBTYPE_CX10, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_CG023, 1, false, STR_SUBTYPE_CG023, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_BAYANG, 4, false, STR_SUBTYPE_BAYANG, STR_MULTI_TELEMETRY},
|
||||
{MODULE_SUBTYPE_MULTI_BAYANG, 5, false, STR_SUBTYPE_BAYANG, STR_MULTI_TELEMETRY},
|
||||
{MODULE_SUBTYPE_MULTI_ESky, 1, false, STR_SUBTYPE_ESky, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_MT99XX, 4, false, STR_SUBTYPE_MT99, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_MJXQ, 6, false, STR_SUBTYPE_MJXQ, STR_MULTI_RFTUNE},
|
||||
@@ -134,8 +136,9 @@ const Multiprotocols multiProtocols {
|
||||
{MODULE_SUBTYPE_MULTI_ZSX, 0, false, STR_SUBTYPE_ZSX, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_FLYZONE, 0, false, STR_SUBTYPE_FLYZONE, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_FRSKYX_RX, 1, false, STR_SUBTYPE_FRSKYX_RX, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_HOTT, 0, true, NO_SUBTYPE, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_HOTT, 1, true, STR_SUBTYPE_HOTT, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_FX816, 0, false, STR_SUBTYPE_FX816, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_PELIKAN, 1, false, STR_SUBTYPE_PELIKAN, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_XK, 1, false, STR_SUBTYPE_XK, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_XN297DUMP, 3, false, STR_SUBTYPE_XN297DUMP, nullptr},
|
||||
{MODULE_SUBTYPE_MULTI_FRSKYX2, 4, true, STR_SUBTYPE_FRSKYX2, STR_MULTI_RFTUNE},
|
||||
@@ -144,6 +147,7 @@ const Multiprotocols multiProtocols {
|
||||
{MODULE_SUBTYPE_MULTI_FRSKYL, 1, false, STR_SUBTYPE_FRSKYL, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_SKYARTEC, 0, false, NO_SUBTYPE, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_ESKY150V2, 0, false, STR_SUBTYPE_ESKY150V2, STR_MULTI_RFTUNE},
|
||||
{MODULE_SUBTYPE_MULTI_Q90C, 0, false, NO_SUBTYPE, STR_MULTI_RFTUNE},
|
||||
{MM_RF_CUSTOM_SELECTED, 7, true, STR_SUBTYPE_CUSTOM, STR_MULTI_OPTION},
|
||||
|
||||
// Sentinel and default for protocols not listed above (MM_RF_CUSTOM is 0xff)
|
||||
@@ -188,7 +192,7 @@ QString Multiprotocols::protocolToString(int protocol, bool custom)
|
||||
"Hitec", "Wfly", "Bugs", "Bugs Mini", "Traxxas", "NCC-1701-A", "E01X", "WL Heli V911S", "GD00X", "Volantex V761",
|
||||
"KFPlan KF606", "Redpine", "Potensic", "ZSX", "FlyZone", "Scanner", "FrSky RX", "FlySky AFHDS2A RX", "HoTT", "Fx816",
|
||||
"Bayang RX", "Pelikan", "Tiger", "XK", "XN297 Dump", "FrSky X 2.1", "FrSky R9", "Propel", "FrSky L", "Skyartec",
|
||||
"ESky 150v2", "DSM RX", "JJRC345"
|
||||
"ESky 150v2", "DSM RX", "JJRC345", "Q90C"
|
||||
});
|
||||
|
||||
return strings.value(protocol, CPN_STR_UNKNOWN_ITEM);
|
||||
|
||||
@@ -128,7 +128,7 @@ inline int SWITCHES_CONFIG_SIZE(Board::Type board, int version)
|
||||
return 16;
|
||||
}
|
||||
|
||||
#define MAX_ROTARY_ENCODERS(board) (IS_SKY9X(board) ? 1 : 0)
|
||||
#define MAX_ROTARY_ENCODERS(board) 0
|
||||
#define MAX_FLIGHT_MODES(board, version) 9
|
||||
#define MAX_TIMERS(board, version) 3
|
||||
#define MAX_MIXERS(board, version) 64
|
||||
@@ -1880,7 +1880,7 @@ class CustomScreenField: public StructField {
|
||||
|
||||
class SensorField: public TransformedField {
|
||||
public:
|
||||
SensorField(DataField * parent, const ModelData& model, SensorData & sensor, Board::Type board, unsigned int version):
|
||||
SensorField(DataField * parent, const ModelData & model, SensorData & sensor, Board::Type board, unsigned int version):
|
||||
TransformedField(parent, internalField),
|
||||
internalField(this, "Sensor"),
|
||||
sensor(sensor),
|
||||
@@ -1948,16 +1948,9 @@ class SensorField: public TransformedField {
|
||||
else {
|
||||
sensor.id = _id;
|
||||
sensor.subid = _subid;
|
||||
if (model.moduleData[0].isPxx1Module() || model.moduleData[1].isPxx1Module()) {
|
||||
sensor.instance = (_instance & 0x1F) + (version <= 218 ? 0 : 1); // 5 bits instance
|
||||
sensor.rxIdx = 0x03; // 2 bits Rx idx
|
||||
sensor.moduleIdx = 0x01; // 1 bit module idx
|
||||
}
|
||||
else {
|
||||
sensor.instance = (_instance & 0x1F) + 1;
|
||||
sensor.rxIdx = (_instance >> 5) & 0x03; // 2 bits Rx idx
|
||||
sensor.moduleIdx = (_instance >> 7) & 0x1; // 1 bit module idx
|
||||
}
|
||||
sensor.instance = (_instance & 0x1F) + (version <= 218 ? 0 : 1); // 5 bits instance
|
||||
sensor.rxIdx = (_instance >> 5) & 0x03; // 2 bits Rx idx
|
||||
sensor.moduleIdx = (_instance >> 7) & 0x1; // 1 bit module idx
|
||||
sensor.ratio = _ratio;
|
||||
sensor.offset = _offset;
|
||||
}
|
||||
@@ -1983,6 +1976,12 @@ class SensorField: public TransformedField {
|
||||
sensor.unit++;
|
||||
}
|
||||
|
||||
if (version < 219) {
|
||||
if (sensor.unit > SensorData::UNIT_FLOZ) {
|
||||
sensor.unit += 11;
|
||||
}
|
||||
}
|
||||
|
||||
qCDebug(eepromImport) << QString("imported %1").arg(internalField.getName());
|
||||
}
|
||||
|
||||
@@ -2185,7 +2184,7 @@ class ModuleUnionField: public UnionField<unsigned int> {
|
||||
|
||||
class ModuleField: public TransformedField {
|
||||
public:
|
||||
ModuleField(DataField * parent, ModuleData & module, Board::Type board, unsigned int version):
|
||||
ModuleField(DataField * parent, ModuleData & module, ModelData & model, Board::Type board, unsigned int version):
|
||||
TransformedField(parent, internalField),
|
||||
internalField(this, "Module"),
|
||||
module(module),
|
||||
@@ -2199,8 +2198,8 @@ class ModuleField: public TransformedField {
|
||||
internalField.Append(new UnsignedField<3>(this, module.subType));
|
||||
internalField.Append(new BoolField<1>(this, module.invertedSerial));
|
||||
if (version <= 218) {
|
||||
for (int i=0; i<32; i++) {
|
||||
internalField.Append(new SignedField<16>(this, module.failsafeChannels[i]));
|
||||
for (int i = 0; i < 32; i++) {
|
||||
internalField.Append(new SignedField<16>(this, model.limitData[i].failsafe));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2394,12 +2393,12 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, Board::Type board, unsig
|
||||
|
||||
int modulesCount = (version <= 218 ? 3 : 2);
|
||||
for (int module = 0; module < modulesCount; module++) {
|
||||
internalField.Append(new ModuleField(this, modelData.moduleData[module], board, version));
|
||||
internalField.Append(new ModuleField(this, modelData.moduleData[module], modelData, board, version));
|
||||
}
|
||||
|
||||
if (version >= 219) {
|
||||
for (int i = 0; i < 32; i++) {
|
||||
internalField.Append(new SignedField<16>(this, modelData.moduleData[0].failsafeChannels[i]));
|
||||
internalField.Append(new SignedField<16>(this, modelData.limitData[i].failsafe));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1218,11 +1218,6 @@ void addOpenTxTaranisOptions(OpenTxFirmware * firmware)
|
||||
addOpenTxFontOptions(firmware);
|
||||
}
|
||||
|
||||
void addPPMInternalModuleHack(OpenTxFirmware * firmware)
|
||||
{
|
||||
firmware->addOption("internalppm", Firmware::tr("Support for PPM internal module hack"));
|
||||
}
|
||||
|
||||
void addOpenTxArm9xOptions(OpenTxFirmware * firmware, bool dblkeys = true)
|
||||
{
|
||||
addOpenTxCommonOptions(firmware);
|
||||
@@ -1249,7 +1244,6 @@ void registerOpenTxFirmwares()
|
||||
firmware = new OpenTxFirmware("opentx-x9d+", Firmware::tr("FrSky Taranis X9D+"), BOARD_TARANIS_X9DP);
|
||||
firmware->addOption("noras", Firmware::tr("Disable RAS (SWR)"));
|
||||
addOpenTxTaranisOptions(firmware);
|
||||
addPPMInternalModuleHack(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
addOpenTxRfOptions(firmware, EU + FLEX);
|
||||
|
||||
@@ -1264,7 +1258,6 @@ void registerOpenTxFirmwares()
|
||||
firmware->addOption("noras", Firmware::tr("Disable RAS (SWR)"));
|
||||
firmware->addOption("haptic", Firmware::tr("Haptic module installed"));
|
||||
addOpenTxTaranisOptions(firmware);
|
||||
addPPMInternalModuleHack(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
addOpenTxRfOptions(firmware, EU + FLEX);
|
||||
|
||||
@@ -1273,7 +1266,6 @@ void registerOpenTxFirmwares()
|
||||
firmware->addOption("shutdownconfirm", Firmware::tr("Confirmation before radio shutdown"));
|
||||
firmware->addOption("horussticks", Firmware::tr("Horus gimbals installed (Hall sensors)"));
|
||||
addOpenTxTaranisOptions(firmware);
|
||||
addPPMInternalModuleHack(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
addOpenTxRfOptions(firmware, EU + FLEX);
|
||||
|
||||
|
||||
@@ -74,10 +74,13 @@ class SensorData {
|
||||
UNIT_METERS_PER_SECOND,
|
||||
UNIT_FEET_PER_SECOND,
|
||||
UNIT_KMH,
|
||||
UNIT_SPEED = UNIT_KMH,
|
||||
UNIT_MPH,
|
||||
UNIT_METERS,
|
||||
UNIT_DIST = UNIT_METERS,
|
||||
UNIT_FEET,
|
||||
UNIT_CELSIUS,
|
||||
UNIT_TEMPERATURE = UNIT_CELSIUS,
|
||||
UNIT_FAHRENHEIT,
|
||||
UNIT_PERCENT,
|
||||
UNIT_MAH,
|
||||
@@ -91,18 +94,30 @@ class SensorData {
|
||||
UNIT_MILLILITERS,
|
||||
UNIT_FLOZ,
|
||||
UNIT_MILLILITERS_PER_MINUTE,
|
||||
UNIT_MAX = UNIT_MILLILITERS_PER_MINUTE,
|
||||
UNIT_SPARE1,
|
||||
UNIT_SPARE2,
|
||||
UNIT_SPARE3,
|
||||
UNIT_SPARE4,
|
||||
UNIT_SPARE5,
|
||||
UNIT_SPARE6,
|
||||
UNIT_SPARE7,
|
||||
UNIT_SPARE8,
|
||||
UNIT_SPARE9,
|
||||
UNIT_SPARE10,
|
||||
UNIT_HOURS,
|
||||
UNIT_MINUTES,
|
||||
UNIT_SECONDS,
|
||||
// FrSky format used for these fields, could be another format in the future
|
||||
UNIT_FIRST_VIRTUAL,
|
||||
UNIT_FIRST_VIRTUAL,
|
||||
UNIT_CELLS = UNIT_FIRST_VIRTUAL,
|
||||
UNIT_DATETIME,
|
||||
UNIT_GPS,
|
||||
UNIT_BITFIELD,
|
||||
UNIT_TEXT,
|
||||
// Internal units (not stored in sensor unit)
|
||||
UNIT_GPS_LONGITUDE,
|
||||
UNIT_GPS_LATITUDE,
|
||||
UNIT_GPS_LONGITUDE_EW,
|
||||
UNIT_GPS_LATITUDE_NS,
|
||||
UNIT_DATETIME_YEAR,
|
||||
UNIT_DATETIME_DAY_MONTH,
|
||||
UNIT_DATETIME_HOUR_MIN,
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "flashfirmwaredialog.h"
|
||||
#include "ui_flashfirmwaredialog.h"
|
||||
#include "appdata.h"
|
||||
#include "process_flash.h"
|
||||
#include "helpers.h"
|
||||
#include "progressdialog.h"
|
||||
#include "radiointerface.h"
|
||||
@@ -112,7 +111,7 @@ void FlashFirmwareDialog::updateUI()
|
||||
}
|
||||
|
||||
QImage image;
|
||||
switch(imageSource) {
|
||||
switch (imageSource) {
|
||||
case FIRMWARE:
|
||||
ui->useFirmwareSplash->setChecked(true);
|
||||
image = firmware.getSplash();
|
||||
@@ -202,7 +201,7 @@ void FlashFirmwareDialog::on_useExternalSplash_clicked()
|
||||
void FlashFirmwareDialog::on_useLibrarySplash_clicked()
|
||||
{
|
||||
QString fileName;
|
||||
SplashLibraryDialog *ld = new SplashLibraryDialog(this, &fileName);
|
||||
auto ld = new SplashLibraryDialog(this, &fileName);
|
||||
ld->exec();
|
||||
if (!fileName.isEmpty()) {
|
||||
QImage image(fileName);
|
||||
|
||||
@@ -565,7 +565,6 @@ QPixmap makePixMap(const QImage & image)
|
||||
return QPixmap::fromImage(result);
|
||||
}
|
||||
|
||||
|
||||
int version2index(const QString & version)
|
||||
{
|
||||
int result = 999;
|
||||
@@ -581,6 +580,10 @@ int version2index(const QString & version)
|
||||
result = parts[1].toInt(); // nightly build up to 899
|
||||
mainVersion = parts[0];
|
||||
}
|
||||
else if (version.contains("-")) {
|
||||
parts = version.split("-");
|
||||
mainVersion = parts[0];
|
||||
}
|
||||
parts = mainVersion.split('.');
|
||||
if (parts.size() > 2)
|
||||
result += 1000 * parts[2].toInt();
|
||||
|
||||
@@ -360,7 +360,6 @@ void MainWindow::checkForCompanionUpdateFinished(QNetworkReply * reply)
|
||||
return onUpdatesError(tr("Companion update check failed, new version information not found."));
|
||||
|
||||
int webVersion = version2index(version);
|
||||
|
||||
int ownVersion = version2index(VERSION);
|
||||
|
||||
if (ownVersion < webVersion) {
|
||||
|
||||
@@ -643,7 +643,7 @@ void InputsPanel::cmInputSwapData(int idx1, int idx2)
|
||||
}
|
||||
// move expos up
|
||||
const int offset = i - expoidx;
|
||||
int expocnt;
|
||||
int expocnt = 0;
|
||||
for (int j = i; j < CPN_MAX_EXPOS; j++) {
|
||||
ExpoData *ed = &model->expoData[j];
|
||||
if ((int)ed->chn == idx2) {
|
||||
|
||||
@@ -792,18 +792,22 @@ void ModulePanel::on_lowPower_stateChanged(int state)
|
||||
module.multi.lowPowerMode = (state == Qt::Checked);
|
||||
}
|
||||
|
||||
// updtSb (update spin box(es)): 0=none or bitmask of FailsafeValueDisplayTypes
|
||||
void ModulePanel::setChannelFailsafeValue(const int channel, const int value, quint8 updtSb)
|
||||
void ModulePanel::onFailsafeModified(unsigned channel)
|
||||
{
|
||||
if (channel < 0 || channel >= CPN_MAX_CHNOUT)
|
||||
return;
|
||||
updateFailsafeUI(channel, FAILSAFE_DISPLAY_PERCENT | FAILSAFE_DISPLAY_USEC);
|
||||
}
|
||||
|
||||
module.failsafeChannels[channel] = value;
|
||||
void ModulePanel::updateFailsafeUI(unsigned channel, quint8 updtSb)
|
||||
{
|
||||
int value = model->limitData[channel].failsafe;
|
||||
double pctVal = divRoundClosest(value * 1000, 1024) / 10.0;
|
||||
// qDebug() << value << pctVal;
|
||||
|
||||
if (failsafeGroupsMap.contains(channel)) {
|
||||
const ChannelFailsafeWidgetsGroup & grp = failsafeGroupsMap.value(channel);
|
||||
bool disable = (value == FAILSAFE_CHANNEL_HOLD || value == FAILSAFE_CHANNEL_NOPULSE);
|
||||
if (grp.combo) {
|
||||
grp.combo->setCurrentIndex(grp.combo->findData(disable ? value : 0));
|
||||
}
|
||||
if ((updtSb & FAILSAFE_DISPLAY_PERCENT) && grp.sbPercent) {
|
||||
grp.sbPercent->blockSignals(true);
|
||||
grp.sbPercent->setValue(pctVal);
|
||||
@@ -815,8 +819,21 @@ void ModulePanel::setChannelFailsafeValue(const int channel, const int value, qu
|
||||
grp.sbUsec->blockSignals(false);
|
||||
}
|
||||
}
|
||||
if (!lock)
|
||||
}
|
||||
|
||||
// updtSb (update spin box(es)): 0=none or bitmask of FailsafeValueDisplayTypes
|
||||
void ModulePanel::setChannelFailsafeValue(const int channel, const int value, quint8 updtSb)
|
||||
{
|
||||
if (channel < 0 || channel >= CPN_MAX_CHNOUT)
|
||||
return;
|
||||
|
||||
model->limitData[channel].failsafe = value;
|
||||
updateFailsafeUI(channel, updtSb);
|
||||
|
||||
if (!lock) {
|
||||
emit failsafeModified(channel);
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void ModulePanel::onFailsafeUsecChanged(int value)
|
||||
@@ -853,8 +870,9 @@ void ModulePanel::onFailsafeComboIndexChanged(int index)
|
||||
bool ok = false;
|
||||
int channel = sender()->property("index").toInt(&ok);
|
||||
if (ok) {
|
||||
module.failsafeChannels[channel] = cb->itemData(index).toInt();
|
||||
model->limitData[channel].failsafe = cb->itemData(index).toInt();
|
||||
updateFailsafe(channel);
|
||||
emit failsafeModified(channel);
|
||||
emit modified();
|
||||
}
|
||||
lock = false;
|
||||
@@ -886,12 +904,12 @@ void ModulePanel::onExtendedLimitsToggled()
|
||||
}
|
||||
}
|
||||
|
||||
void ModulePanel::updateFailsafe(int channel)
|
||||
void ModulePanel::updateFailsafe(unsigned channel)
|
||||
{
|
||||
if (channel >= CPN_MAX_CHNOUT || !failsafeGroupsMap.contains(channel))
|
||||
return;
|
||||
|
||||
const int failsafeValue = module.failsafeChannels[channel];
|
||||
const int failsafeValue = model->limitData[channel].failsafe;
|
||||
const ChannelFailsafeWidgetsGroup & grp = failsafeGroupsMap.value(channel);
|
||||
const bool valDisable = (failsafeValue == FAILSAFE_CHANNEL_HOLD || failsafeValue == FAILSAFE_CHANNEL_NOPULSE);
|
||||
|
||||
@@ -903,7 +921,7 @@ void ModulePanel::updateFailsafe(int channel)
|
||||
grp.sbUsec->setDisabled(valDisable);
|
||||
|
||||
if (!valDisable)
|
||||
setChannelFailsafeValue(channel, failsafeValue, (FAILSAFE_DISPLAY_PERCENT | FAILSAFE_DISPLAY_USEC));
|
||||
setChannelFailsafeValue(channel, failsafeValue, FAILSAFE_DISPLAY_PERCENT | FAILSAFE_DISPLAY_USEC);
|
||||
}
|
||||
|
||||
void ModulePanel::onClearAccessRxClicked()
|
||||
@@ -1166,13 +1184,21 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
|
||||
ui->trimsDisplay->hide();
|
||||
}
|
||||
|
||||
for (int i=firmware->getCapability(NumFirstUsableModule); i<firmware->getCapability(NumModules); i++) {
|
||||
for (int i = firmware->getCapability(NumFirstUsableModule); i < firmware->getCapability(NumModules); i++) {
|
||||
modules[i] = new ModulePanel(this, model, model.moduleData[i], generalSettings, firmware, i);
|
||||
ui->modulesLayout->addWidget(modules[i]);
|
||||
connect(modules[i], &ModulePanel::modified, this, &SetupPanel::modified);
|
||||
connect(this, &SetupPanel::extendedLimitsToggled, modules[i], &ModulePanel::onExtendedLimitsToggled);
|
||||
}
|
||||
|
||||
for (int i = firmware->getCapability(NumFirstUsableModule); i < firmware->getCapability(NumModules); i++) {
|
||||
for (int j = firmware->getCapability(NumFirstUsableModule); j < firmware->getCapability(NumModules); j++) {
|
||||
if (i != j) {
|
||||
connect(modules[i], SIGNAL(failsafeModified(unsigned)), modules[j], SLOT(onFailsafeModified(unsigned)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (firmware->getCapability(ModelTrainerEnable)) {
|
||||
modules[CPN_MAX_MODULES] = new ModulePanel(this, model, model.moduleData[CPN_MAX_MODULES], generalSettings, firmware, -1);
|
||||
ui->modulesLayout->addWidget(modules[CPN_MAX_MODULES]);
|
||||
|
||||
@@ -61,15 +61,17 @@ class ModulePanel : public ModelPanel
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ModulePanel(QWidget *parent, ModelData & model, ModuleData & module, GeneralSettings & generalSettings, Firmware * firmware, int moduleIdx);
|
||||
ModulePanel(QWidget * parent, ModelData & model, ModuleData & module, GeneralSettings & generalSettings, Firmware * firmware, int moduleIdx);
|
||||
virtual ~ModulePanel();
|
||||
virtual void update();
|
||||
|
||||
public slots:
|
||||
void onExtendedLimitsToggled();
|
||||
void onFailsafeModified(unsigned index);
|
||||
|
||||
signals:
|
||||
void channelsRangeChanged();
|
||||
void failsafeModified(unsigned index);
|
||||
|
||||
private slots:
|
||||
void setupFailsafes();
|
||||
@@ -95,7 +97,7 @@ class ModulePanel : public ModelPanel
|
||||
void onFailsafeUsecChanged(int value);
|
||||
void onFailsafePercentChanged(double value);
|
||||
void onFailsafesDisplayValueTypeChanged(int type);
|
||||
void updateFailsafe(int channel);
|
||||
void updateFailsafe(unsigned channel);
|
||||
void on_optionValue_editingFinished();
|
||||
void onClearAccessRxClicked();
|
||||
|
||||
@@ -114,6 +116,7 @@ class ModulePanel : public ModelPanel
|
||||
Ui::Module *ui;
|
||||
QMap<int, ChannelFailsafeWidgetsGroup> failsafeGroupsMap;
|
||||
static quint8 failsafesValueDisplayType; // FailsafeValueDisplayTypes
|
||||
void updateFailsafeUI(unsigned channel, quint8 updtSb);
|
||||
};
|
||||
|
||||
class SetupPanel : public ModelPanel
|
||||
|
||||
@@ -897,9 +897,8 @@ QString ModelPrinter::printFailsafe(int idx)
|
||||
ModuleData module = model.moduleData[idx];
|
||||
strl << printLabelValue(tr("Failsafe Mode"), printFailsafeMode(module.failsafeMode));
|
||||
if (module.failsafeMode == FAILSAFE_CUSTOM) {
|
||||
for (int i=0; i<module.channelsCount; i++) {
|
||||
//strl << QString("%1(%2)").arg(printChannelName(module.channelsStart + i).trimmed()).arg(printFailsafeValue(module.failsafeChannels[i]));
|
||||
strl << printLabelValue(printChannelName(module.channelsStart + i).trimmed(), printFailsafeValue(module.failsafeChannels[i]));
|
||||
for (int i = 0; i < module.channelsCount; i++) {
|
||||
strl << printLabelValue(printChannelName(module.channelsStart + i).trimmed(), printFailsafeValue(model.limitData[i].failsafe));
|
||||
}
|
||||
}
|
||||
return strl.join(" ");
|
||||
|
||||
@@ -134,27 +134,30 @@ void FlashProcess::onKillTimerElapsed()
|
||||
#endif
|
||||
}
|
||||
|
||||
void FlashProcess::analyseStandardOutput(const QString &text)
|
||||
void FlashProcess::analyseStandardOutput(const QString & text)
|
||||
{
|
||||
currStdoutLine.append(text);
|
||||
|
||||
if (currStdoutLine.contains("size = ")) {
|
||||
int pos = currStdoutLine.lastIndexOf("size = ");
|
||||
QString temp = currStdoutLine.mid(pos+7);
|
||||
pos = temp.lastIndexOf("\n");
|
||||
int size = temp.left(pos).toInt();
|
||||
progress->setMaximum(size/2048);
|
||||
progress->setMaximum(size / 2048);
|
||||
}
|
||||
|
||||
if (currStdoutLine.contains("\n")) {
|
||||
int nlPos = currStdoutLine.lastIndexOf("\n");
|
||||
currStdoutLine = currStdoutLine.mid(nlPos+1);
|
||||
}
|
||||
|
||||
if (!currStdoutLine.isEmpty()) {
|
||||
if (currStdoutLine.at(0) == QChar('.')) {
|
||||
int pos = currStdoutLine.lastIndexOf(".");
|
||||
progress->setValue(pos);
|
||||
}
|
||||
else if (currStdoutLine.startsWith("Starting upload: [")) {
|
||||
int pos = (currStdoutLine.lastIndexOf("#")-19)*100/256;
|
||||
int pos = (currStdoutLine.lastIndexOf("#") - 19) * 100 / 256;
|
||||
progress->setValue(pos);
|
||||
}
|
||||
}
|
||||
@@ -168,7 +171,15 @@ void FlashProcess::analyseStandardOutput(const QString &text)
|
||||
int end = text.indexOf("%");
|
||||
if (start > 0) {
|
||||
start += 9;
|
||||
int value = text.mid(start, end-start).toInt();
|
||||
int value = text.mid(start, end - start).toInt();
|
||||
progress->setValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
if (text.contains("Upload\t[") || text.contains("Download\t[")) {
|
||||
int end = text.indexOf("%");
|
||||
if (end > 0) {
|
||||
int value = text.mid(end - 3, 3).toInt();
|
||||
progress->setValue(value);
|
||||
}
|
||||
}
|
||||
@@ -277,7 +288,7 @@ void FlashProcess::errorWizard()
|
||||
DeviceStr = "Atmega 2561";
|
||||
}
|
||||
}
|
||||
if (fwexist==false) {
|
||||
if (!fwexist) {
|
||||
QMessageBox::warning(nullptr, "Companion - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease check advanced burn options to set the correct cpu type.").arg(DeviceStr));
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -53,10 +53,10 @@ protected:
|
||||
void analyseStandardError(const QString &text);
|
||||
void errorWizard();
|
||||
void addReadFuses();
|
||||
ProgressWidget *progress;
|
||||
ProgressWidget * progress;
|
||||
const QString cmd;
|
||||
const QStringList args;
|
||||
QProcess *process;
|
||||
QProcess * process;
|
||||
bool hasErrors;
|
||||
QString currStdoutLine;
|
||||
QString currStderrLine;
|
||||
|
||||
@@ -253,7 +253,6 @@ void resetAvrdudeFuses(bool eepromProtect, ProgressWidget * progress)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool readFirmware(const QString & filename, ProgressWidget * progress)
|
||||
{
|
||||
bool result = false;
|
||||
@@ -274,7 +273,7 @@ bool readFirmware(const QString & filename, ProgressWidget * progress)
|
||||
}
|
||||
}
|
||||
|
||||
if (result == false) {
|
||||
if (!result) {
|
||||
qDebug() << "readFirmware: reading" << filename << "with" << getRadioInterfaceCmd() << getReadFirmwareArgs(filename);
|
||||
FlashProcess flashProcess(getRadioInterfaceCmd(), getReadFirmwareArgs(filename), progress);
|
||||
result = flashProcess.run();
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
FirmwareInterface::FirmwareInterface(const QString & filename):
|
||||
flash(FSIZE_MAX, 0),
|
||||
flashSize(0),
|
||||
versionId(0),
|
||||
eepromVersion(0),
|
||||
eepromVariant(0),
|
||||
splashOffset(0),
|
||||
@@ -65,7 +64,7 @@ FirmwareInterface::FirmwareInterface(const QString & filename):
|
||||
// old version format
|
||||
int index = version.lastIndexOf('-');
|
||||
flavour = version.mid(0, index);
|
||||
version = version.mid(index+1);
|
||||
version = version.mid(index + 1);
|
||||
}
|
||||
date = seekLabel(DATE_MARK);
|
||||
time = seekLabel(TIME_MARK);
|
||||
@@ -80,7 +79,6 @@ FirmwareInterface::FirmwareInterface(const QString & filename):
|
||||
eepromVersion = eepromId.toInt();
|
||||
}
|
||||
|
||||
versionId = version2index(version);
|
||||
seekSplash();
|
||||
isValidFlag = !version.isEmpty();
|
||||
}
|
||||
|
||||
@@ -39,14 +39,13 @@
|
||||
class FirmwareInterface
|
||||
{
|
||||
public:
|
||||
FirmwareInterface(const QString &filename);
|
||||
FirmwareInterface(const QString & filename);
|
||||
inline QString getDate() { return date; }
|
||||
inline QString getTime() { return time; }
|
||||
int getSize() { return flashSize; }
|
||||
QString getFlavour() const;
|
||||
bool isHardwareCompatible(const FirmwareInterface &previousFirmware) const;
|
||||
inline QString getVersion() { return version; }
|
||||
unsigned int getVersionId() { return versionId; }
|
||||
inline int getEEpromVersion() { return eepromVersion; }
|
||||
inline int getEEpromVariant() { return eepromVariant; }
|
||||
inline QString getEEpromId() { return eepromId; }
|
||||
@@ -72,7 +71,6 @@ class FirmwareInterface
|
||||
QString time;
|
||||
QString flavour;
|
||||
QString version;
|
||||
int versionId;
|
||||
QString eepromId;
|
||||
int eepromVersion;
|
||||
int eepromVariant;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user