Merge branch '2.3' into 3djc/2.3-synced

This commit is contained in:
3djc
2021-02-16 18:12:56 +01:00
50 changed files with 1361 additions and 1673 deletions
+29
View File
@@ -2117,3 +2117,32 @@ Aldo Visentin
Greg Wilson Greg Wilson
Mark Sutton Mark Sutton
Lukas Kana Lukas Kana
Peter Newman
Kevin Cave
Arold Reinders
Jason Plant
John Beech
Ian Parris
Danny Music
Eric Bissonnette
Riso LTD
William Booth
Ferenc Kunkli
Offer Shmuely
Troy Atneosen
Long Technologies
John Jaugilas
Jan-Hinrich Klee
Hans-Reinhard Mette
Alejandro Casals Oliver
David Homewood
John Dunning
Konrad Helbach
Bernard Delpy
Raymond Ellsworth
Bogdan Musial
Гасак Сергей
Philip Garcia
Helder Simoes
Thomas Blanchin
Jean-Luc Mesnier
+1
View File
@@ -30,6 +30,7 @@ string(REPLACE ".cpp" ".h" firmwares_HDRS "${firmwares_SRCS}")
list(APPEND firmwares_HDRS list(APPEND firmwares_HDRS
eepromimportexport.h eepromimportexport.h
moduledata.h moduledata.h
helpersdata.h
) )
set(firmwares_QT set(firmwares_QT
+4 -6
View File
@@ -91,11 +91,9 @@ uint32_t Boards::getFourCC(Type board)
return 0x4178746F; return 0x4178746F;
case BOARD_RADIOMASTER_T8: case BOARD_RADIOMASTER_T8:
return 0x4378746F; return 0x4378746F;
case BOARD_UNKNOWN: default:
break; return 0;
} }
return 0;
} }
int Boards::getEEpromSize(Board::Type board) int Boards::getEEpromSize(Board::Type board)
@@ -130,9 +128,9 @@ int Boards::getEEpromSize(Board::Type board)
case BOARD_JUMPER_T18: case BOARD_JUMPER_T18:
case BOARD_RADIOMASTER_TX16S: case BOARD_RADIOMASTER_TX16S:
return 0; return 0;
default:
return 0;
} }
return 0;
} }
int Boards::getFlashSize(Type board) int Boards::getFlashSize(Type board)
+50
View File
@@ -0,0 +1,50 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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
* GNU General Public License for more details.
*/
#pragma once
#include <QtCore>
class FieldRange
{
Q_DECLARE_TR_FUNCTIONS(FieldRange)
public:
FieldRange():
decimals(0),
min(0.0),
max(0.0),
step(1.0),
offset(0.0),
prefix(""),
unit("")
{
}
float getValue(int value) { return float(value) * step; }
int decimals;
double min;
double max;
double step;
double offset;
QString prefix;
QString unit;
};
+2
View File
@@ -70,6 +70,8 @@ class TimerData {
unsigned int countdownBeep; unsigned int countdownBeep;
unsigned int val; unsigned int val;
unsigned int persistent; unsigned int persistent;
int countdownStart;
unsigned int direction;
int pvalue; int pvalue;
void clear() { memset(reinterpret_cast<void *>(this), 0, sizeof(TimerData)); mode = RawSwitch(SWITCH_TYPE_TIMER_MODE, 0); } void clear() { memset(reinterpret_cast<void *>(this), 0, sizeof(TimerData)); mode = RawSwitch(SWITCH_TYPE_TIMER_MODE, 0); }
void convert(RadioDataConversionState & cstate); void convert(RadioDataConversionState & cstate);
@@ -2311,7 +2311,8 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, Board::Type board, unsig
internalField.Append(new UnsignedField<2>(this, modelData.timers[i].countdownBeep)); internalField.Append(new UnsignedField<2>(this, modelData.timers[i].countdownBeep));
internalField.Append(new BoolField<1>(this, modelData.timers[i].minuteBeep)); internalField.Append(new BoolField<1>(this, modelData.timers[i].minuteBeep));
internalField.Append(new UnsignedField<2>(this, modelData.timers[i].persistent)); internalField.Append(new UnsignedField<2>(this, modelData.timers[i].persistent));
internalField.Append(new SpareBitsField<3>(this)); internalField.Append(new SignedField<2>(this, modelData.timers[i].countdownStart));
internalField.Append(new UnsignedField<1>(this, modelData.timers[i].direction));
if (HAS_LARGE_LCD(board)) if (HAS_LARGE_LCD(board))
internalField.Append(new ZCharField<8>(this, modelData.timers[i].name, "Timer name")); internalField.Append(new ZCharField<8>(this, modelData.timers[i].name, "Timer name"));
else else
@@ -1307,7 +1307,7 @@ void registerOpenTxFirmwares()
firmware->addOption("lua", Firmware::tr("Enable Lua custom scripts screen")); firmware->addOption("lua", Firmware::tr("Enable Lua custom scripts screen"));
addOpenTxFontOptions(firmware); addOpenTxFontOptions(firmware);
registerOpenTxFirmware(firmware); registerOpenTxFirmware(firmware);
addOpenTxRfOptions(firmware, FLEX + AFHDS3); addOpenTxRfOptions(firmware, FLEX);
/* Jumper T16 board */ /* Jumper T16 board */
firmware = new OpenTxFirmware("opentx-t16", Firmware::tr("Jumper T16 / T16+ / T16 Pro"), BOARD_JUMPER_T16); firmware = new OpenTxFirmware("opentx-t16", Firmware::tr("Jumper T16 / T16+ / T16 Pro"), BOARD_JUMPER_T16);
+1 -1
View File
@@ -60,7 +60,7 @@ RawSourceRange RawSource::getRange(const ModelData * model, const GeneralSetting
result.min = -30000 * result.step; result.min = -30000 * result.step;
result.max = +30000 * result.step; result.max = +30000 * result.step;
result.decimals = sensor.prec; result.decimals = sensor.prec;
result.unit = sensor.unitString(); result.unit = SensorData::unitToString(qr.quot);
break; break;
} }
+306 -106
View File
@@ -33,12 +33,316 @@ void SensorData::updateUnit()
} }
} }
// TODO depreciated QString SensorData::nameToString(int index) const
QString SensorData::unitString() const {
return RadioData::getElementName(tr("TELE"), index + 1, label);
}
QString SensorData::getOrigin(const ModelData * model) const
{
if (type != TELEM_TYPE_CUSTOM || !id)
return QString();
const ModuleData & module = model->moduleData[moduleIdx];
if (module.isPxx2Module() && rxIdx <= 2 && module.access.receivers & (1 << rxIdx)) {
return QString(module.access.receiverName[rxIdx]);
}
else {
return QString();
}
}
bool SensorData::isEmpty() const
{
return (!isAvailable() && type == 0 && id == 0 && subid == 0 && instance == 0 && rxIdx == 0 && moduleIdx == 0 && unit == 0 && ratio == 0 && prec == 0 && offset == 0 && autoOffset == 0 && filter == 0 && onlyPositive == 0 && logs == 0);
}
QString SensorData::idToString() const
{
return idToString(id);
}
QString SensorData::typeToString() const
{
return typeToString(type);
}
QString SensorData::formulaToString() const
{
return formulaToString(formula);
}
QString SensorData::cellIndexToString() const
{
return cellIndexToString(index);
}
QString SensorData::unitToString() const
{ {
return unitToString(unit); return unitToString(unit);
} }
QString SensorData::precToString() const
{
return precToString(prec);
}
int SensorData::getMask() const
{
int mask = 0;
if (type == TELEM_TYPE_CALCULATED) {
if (formula < TELEM_FORMULA_CELL)
mask |= SENSOR_ISCONFIGURABLE | SENSOR_HAS_POSITIVE;
if (formula == TELEM_FORMULA_DIST)
mask |= SENSOR_HAS_GPS;
if (formula == TELEM_FORMULA_CELL)
mask |= SENSOR_HAS_CELLS;
if (formula == TELEM_FORMULA_CONSUMPTION)
mask |= SENSOR_HAS_CONSUMPTION;
if (formula <= TELEM_FORMULA_MULTIPLY)
mask |= SENSOR_HAS_SOURCES_12;
if (formula < TELEM_FORMULA_MULTIPLY)
mask |= SENSOR_HAS_SOURCES_34;
if (formula == TELEM_FORMULA_TOTALIZE)
mask |= SENSOR_HAS_TOTALIZE;
}
else {
if (unit < UNIT_FIRST_VIRTUAL)
mask |= (SENSOR_ISCONFIGURABLE | SENSOR_HAS_RATIO | SENSOR_HAS_POSITIVE);
}
if (mask & SENSOR_ISCONFIGURABLE && unit != UNIT_FAHRENHEIT)
mask |= SENSOR_HAS_PRECISION;
return mask;
}
constexpr char FMT_LABEL[] { "<b>%1:</b> " };
constexpr char FMT_VALUE[] { "%1 " };
constexpr char FMT_LABEL_VALUE[] { "<b>%1:</b> %2 " };
QString SensorData::paramsToString(const ModelData * model) const
{
if (!isAvailable())
return "";
QString str;
int mask = getMask();
if (type == TELEM_TYPE_CALCULATED) {
str.append(QString(FMT_LABEL_VALUE).arg(tr("Formula")).arg(formulaToString()));
}
else {
str.append(QString(FMT_LABEL_VALUE).arg(tr("Id")).arg(idToString()));
str.append(QString(FMT_LABEL_VALUE).arg(tr("Instance")).arg(instance));
}
if (mask & SENSOR_HAS_CELLS) {
str.append(QString(FMT_LABEL_VALUE).arg(tr("Sensor")).arg(sourceToString(model, source)));
str.append(QString(FMT_VALUE).arg(cellIndexToString()));
}
if (mask & SENSOR_HAS_SOURCES_12) {
str.append(QString(FMT_LABEL).arg(tr("Sources")));
for (int i = 0; i < 4; i++) {
if (i < 2 || mask & SENSOR_HAS_SOURCES_34) {
str.append(QString(FMT_VALUE).arg(sourceToString(model, sources[i])));
}
}
}
if (mask & SENSOR_HAS_CONSUMPTION || mask & SENSOR_HAS_TOTALIZE)
str.append(QString(FMT_LABEL_VALUE).arg(tr("Sensor")).arg(sourceToString(model, amps)));
if (mask & SENSOR_HAS_GPS) {
str.append(QString(FMT_LABEL_VALUE).arg(tr("GPS")).arg(sourceToString(model, gps)));
str.append(QString(FMT_LABEL_VALUE).arg(tr("Alt")).arg(sourceToString(model, alt)));
}
if (mask & SENSOR_ISCONFIGURABLE)
str.append(QString(FMT_LABEL_VALUE).arg(tr("Unit")).arg(unitToString()));
if (mask & SENSOR_HAS_PRECISION)
str.append(QString(FMT_LABEL_VALUE).arg(tr("Precision")).arg(precToString()));
if (mask & SENSOR_HAS_RATIO) {
if (unit != UNIT_RPMS) {
int precsn = prec == 0 ? 1 : pow(10, prec);
str.append(QString(FMT_LABEL_VALUE).arg(tr("Ratio")).arg((float)ratio / 10));
str.append(QString(FMT_LABEL_VALUE).arg(tr("Offset")).arg(QString::number((float)offset / precsn, 'f', prec)));
str.append(QString(FMT_LABEL_VALUE).arg(tr("Auto Offset")).arg(boolToString(autoOffset)));
}
else {
str.append(QString(FMT_LABEL_VALUE).arg(tr("Blades")).arg(ratio)); // TODO refactor to dedicated RPMS field
str.append(QString(FMT_LABEL_VALUE).arg(tr("Multiplier")).arg(offset)); // TODO refactor to dedicated RPMS field
}
}
if (mask & SENSOR_ISCONFIGURABLE)
str.append(QString(FMT_LABEL_VALUE).arg(tr("Filter")).arg(boolToString(filter)));
if (type == TELEM_TYPE_CALCULATED)
str.append(QString(FMT_LABEL_VALUE).arg(tr("Persist")).arg(boolToString(persistent)));
if (mask & SENSOR_HAS_POSITIVE)
str.append(QString(FMT_LABEL_VALUE).arg(tr("Positive")).arg(boolToString(onlyPositive)));
str.append(QString(FMT_LABEL_VALUE).arg(tr("Log")).arg(boolToString(logs)));
return str;
}
FieldRange SensorData::getRatioRange() const
{
FieldRange result;
if (unit == SensorData::UNIT_RPMS) {
result.decimals = 0;
result.max = 30000;
result.min = 1;
result.step = 1;
}
else {
result.decimals = 1;
result.max = 30000;
result.min = 0;
result.step = 0.1;
}
return result;
}
FieldRange SensorData::getOffsetRange() const
{
FieldRange result;
if (unit == SensorData::UNIT_RPMS) {
result.decimals = 0;
result.max = 30000;
result.min = 1;
result.step = 1;
}
else {
result.decimals = prec;
result.max = 30000.0f / powf(10.0f, prec);
result.min = -result.max;
result.step = pow(0.1, prec);
}
return result;
}
void SensorData::formulaChanged()
{
switch (formula) {
case TELEM_FORMULA_CELL:
prec = 2;
unit = UNIT_VOLTS;
break;
case TELEM_FORMULA_CONSUMPTION:
prec = 0;
unit = UNIT_MAH;
break;
case TELEM_FORMULA_DIST:
prec = 0;
unit = UNIT_METERS;
break;
}
}
void SensorData::unitChanged()
{
if (unit == UNIT_FAHRENHEIT)
prec = 0;
}
// static
QString SensorData::idToString(const int value)
{
return QString::number(value, 16).toUpper();
}
// static
QString SensorData::typeToString(const int value)
{
switch(value) {
case TELEM_TYPE_CUSTOM:
return tr("Custom");
case TELEM_TYPE_CALCULATED:
return tr("Calculated");
default:
return CPN_STR_UNKNOWN_ITEM;
}
}
// static
QString SensorData::formulaToString(const int value)
{
switch(value) {
case TELEM_FORMULA_ADD:
return tr("Add");
case TELEM_FORMULA_AVERAGE:
return tr("Average");
case TELEM_FORMULA_MIN:
return tr("Minimum");
case TELEM_FORMULA_MAX:
return tr("Maximum");
case TELEM_FORMULA_MULTIPLY:
return tr("Multiply");
case TELEM_FORMULA_TOTALIZE:
return tr("Totalize");
case TELEM_FORMULA_CELL:
return tr("Cell");
case TELEM_FORMULA_CONSUMPTION:
return tr("Consumption");
case TELEM_FORMULA_DIST:
return tr("Distance");
default:
return CPN_STR_UNKNOWN_ITEM;
}
}
// static
QString SensorData::cellIndexToString(const int value)
{
if (value == TELEM_CELL_INDEX_LOWEST)
return tr("Lowest");
if (value > TELEM_CELL_INDEX_LOWEST && value < TELEM_CELL_INDEX_HIGHEST)
return tr("Cell %1").arg(value - TELEM_CELL_INDEX_LOWEST);
if (value== TELEM_CELL_INDEX_HIGHEST)
return tr("Highest");
if (value == TELEM_CELL_INDEX_DELTA)
return tr("Delta");
return CPN_STR_UNKNOWN_ITEM;
}
// static
QString SensorData::precToString(const int value)
{
return QString("0.%1").arg(QString(value, '0'));
}
// static
QString SensorData::sourceToString(const ModelData * model, const int index, const bool sign)
{
if (model) {
const QString prfx = sign ? index < 0 ? "-" : "+" : "";
if (abs(index) > 0) {
const SensorData &sd = model->sensorData[abs(index) - 1];
if (sd.type == SensorData::TELEM_TYPE_CUSTOM)
return QString("%1%2 (%3)").arg(prfx).arg(sd.label).arg(sd.getOrigin(model));
else
return QString("%1%2").arg(prfx).arg(sd.label);
}
else
return CPN_STR_NONE_ITEM;
}
return "";
}
// static // static
QString SensorData::unitToString(const int value) QString SensorData::unitToString(const int value)
{ {
@@ -106,110 +410,6 @@ QString SensorData::unitToString(const int value)
} }
} }
QString SensorData::nameToString(int index) const
{
return RadioData::getElementName(tr("TELE"), index + 1, label);
}
QString SensorData::getOrigin(const ModelData * model) const
{
if (type != TELEM_TYPE_CUSTOM || !id)
return QString();
const ModuleData & module = model->moduleData[moduleIdx];
if (module.isPxx2Module() && rxIdx <= 2 && module.access.receivers & (1 << rxIdx)) {
return QString(module.access.receiverName[rxIdx]);
}
else {
return QString();
}
}
bool SensorData::isEmpty() const
{
return (!isAvailable() && type == 0 && id == 0 && subid == 0 && instance == 0 && rxIdx == 0 && moduleIdx == 0 && unit == 0 && ratio == 0 && prec == 0 && offset == 0 && autoOffset == 0 && filter == 0 && onlyPositive == 0 && logs == 0);
}
// static
QString SensorData::typeToString(const int value)
{
switch(value) {
case TELEM_TYPE_CUSTOM:
return tr("Custom");
case TELEM_TYPE_CALCULATED:
return tr("Calculated");
default:
return CPN_STR_UNKNOWN_ITEM;
}
}
// static
QString SensorData::formulaToString(const int value)
{
switch(value) {
case TELEM_FORMULA_ADD:
return tr("Add");
case TELEM_FORMULA_AVERAGE:
return tr("Average");
case TELEM_FORMULA_MIN:
return tr("Minimum");
case TELEM_FORMULA_MAX:
return tr("Maximum");
case TELEM_FORMULA_MULTIPLY:
return tr("Multiply");
case TELEM_FORMULA_TOTALIZE:
return tr("Totalize");
case TELEM_FORMULA_CELL:
return tr("Cell");
case TELEM_FORMULA_CONSUMPTION:
return tr("Consumption");
case TELEM_FORMULA_DIST:
return tr("Distance");
default:
return CPN_STR_UNKNOWN_ITEM;
}
}
// static
QString SensorData::cellIndexToString(const int value)
{
if (value == TELEM_CELL_INDEX_LOWEST)
return tr("Lowest");
if (value > TELEM_CELL_INDEX_LOWEST && value < TELEM_CELL_INDEX_HIGHEST)
return tr("Cell %1").arg(value - TELEM_CELL_INDEX_LOWEST);
if (value== TELEM_CELL_INDEX_HIGHEST)
return tr("Highest");
if (value == TELEM_CELL_INDEX_DELTA)
return tr("Delta");
return CPN_STR_UNKNOWN_ITEM;
}
// static
QString SensorData::precisionToString(const int value)
{
return QString("0.%1").arg(QString(value, '0'));
}
// static
QString SensorData::sourceToString(const ModelData * model, const int index, const bool sign)
{
if (model) {
const QString prfx = sign ? index < 0 ? "-" : "+" : "";
if (abs(index) > 0) {
const SensorData &sd = model->sensorData[abs(index) - 1];
if (sd.type == SensorData::TELEM_TYPE_CUSTOM)
return QString("%1%2 (%3)").arg(prfx).arg(sd.label).arg(sd.getOrigin(model));
else
return QString("%1%2").arg(prfx).arg(sd.label);
}
else
return CPN_STR_NONE_ITEM;
}
return "";
}
// static // static
bool SensorData::isSourceAvailable(const ModelData * model, const int index) bool SensorData::isSourceAvailable(const ModelData * model, const int index)
{ {
+32 -8
View File
@@ -18,19 +18,32 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#ifndef SENSORDATA_H #pragma once
#define SENSORDATA_H
#include "helpersdata.h"
#include <QtCore> #include <QtCore>
constexpr int CPN_MAX_SENSORS = 60; constexpr int CPN_MAX_SENSORS { 60 };
constexpr int SENSOR_LABEL_LEN = 4; constexpr int SENSOR_LABEL_LEN { 4 };
constexpr int SENSOR_ISCONFIGURABLE { 1 << 1 };
constexpr int SENSOR_HAS_GPS { 1 << 2 };
constexpr int SENSOR_HAS_CELLS { 1 << 3 };
constexpr int SENSOR_HAS_CONSUMPTION { 1 << 4 };
constexpr int SENSOR_HAS_RATIO { 1 << 5 };
constexpr int SENSOR_HAS_TOTALIZE { 1 << 6 };
constexpr int SENSOR_HAS_SOURCES_12 { 1 << 7 };
constexpr int SENSOR_HAS_SOURCES_34 { 1 << 8 };
constexpr int SENSOR_HAS_POSITIVE { 1 << 9 };
constexpr int SENSOR_HAS_PRECISION { 1 << 10 };
class ModelData; class ModelData;
class AbstractStaticItemModel; class AbstractStaticItemModel;
class PrecisionItemModel; class PrecisionItemModel;
class SensorData { class SensorData {
Q_DECLARE_TR_FUNCTIONS(SensorData) Q_DECLARE_TR_FUNCTIONS(SensorData)
public: public:
@@ -167,19 +180,32 @@ class SensorData {
bool isAvailable() const { return strlen(label) > 0; } bool isAvailable() const { return strlen(label) > 0; }
void updateUnit(); void updateUnit();
QString unitString() const;
QString nameToString(int index) const; QString nameToString(int index) const;
QString getOrigin(const ModelData* model) const; QString getOrigin(const ModelData* model) const;
void clear() { memset(this, 0, sizeof(SensorData)); } void clear() { memset(this, 0, sizeof(SensorData)); }
bool isEmpty() const; bool isEmpty() const;
QString idToString() const;
QString typeToString() const;
QString formulaToString() const;
QString cellIndexToString() const;
QString unitToString() const;
QString precToString() const;
int getMask() const;
QString paramsToString(const ModelData * model) const;
FieldRange getRatioRange() const;
FieldRange getOffsetRange() const;
void formulaChanged();
void unitChanged();
static QString sourceToString(const ModelData * model, const int index, const bool sign = false); static QString sourceToString(const ModelData * model, const int index, const bool sign = false);
static bool isSourceAvailable(const ModelData * model, const int index); static bool isSourceAvailable(const ModelData * model, const int index);
static QString idToString(const int value);
static QString typeToString(const int value); static QString typeToString(const int value);
static QString formulaToString(const int value); static QString formulaToString(const int value);
static QString cellIndexToString(const int value); static QString cellIndexToString(const int value);
static QString unitToString(const int value); static QString unitToString(const int value);
static QString precisionToString(const int value); static QString precToString(const int value);
static QString boolToString(const bool value) { return value ? tr("Y") : tr("N"); }
static AbstractStaticItemModel * typeItemModel(); static AbstractStaticItemModel * typeItemModel();
static AbstractStaticItemModel * formulaItemModel(); static AbstractStaticItemModel * formulaItemModel();
@@ -187,5 +213,3 @@ class SensorData {
static AbstractStaticItemModel * unitItemModel(); static AbstractStaticItemModel * unitItemModel();
static PrecisionItemModel * precisionItemModel(); static PrecisionItemModel * precisionItemModel();
}; };
#endif // SENSORDATA_H
+1 -1
View File
@@ -92,7 +92,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
if (firmware->getCapability(VirtualInputs)) { if (firmware->getCapability(VirtualInputs)) {
ui->inputName->setMaxLength(firmware->getCapability(InputsLength)); ui->inputName->setMaxLength(firmware->getCapability(InputsLength));
id = dialogFilteredItemModels->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSource), id = dialogFilteredItemModels->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSource),
(RawSource::InputSourceGroups & ~ RawSource::NoneGroup & ~RawSource::InputsGroup)), (RawSource::InputSourceGroups & ~RawSource::NoneGroup & ~RawSource::InputsGroup) | RawSource::TelemGroup),
"RawSource"); "RawSource");
ui->sourceCB->setModel(dialogFilteredItemModels->getItemModel(id)); ui->sourceCB->setModel(dialogFilteredItemModels->getItemModel(id));
ui->sourceCB->setCurrentIndex(ui->sourceCB->findData(ed->srcRaw.toValue())); ui->sourceCB->setCurrentIndex(ui->sourceCB->findData(ed->srcRaw.toValue()));
+1 -1
View File
@@ -49,7 +49,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData * mixdata,
this->setWindowTitle(tr("DEST -> %1").arg(RawSource(SOURCE_TYPE_CH, md->destCh - 1).toString(&model, &generalSettings))); this->setWindowTitle(tr("DEST -> %1").arg(RawSource(SOURCE_TYPE_CH, md->destCh - 1).toString(&model, &generalSettings)));
id = dialogFilteredItemModels->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSource), id = dialogFilteredItemModels->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_RawSource),
((RawSource::InputSourceGroups | RawSource::ScriptsGroup) & ~ RawSource::NoneGroup)), (RawSource::InputSourceGroups & ~RawSource::NoneGroup) | RawSource::ScriptsGroup),
"RawSource"); "RawSource");
ui->sourceCB->setModel(dialogFilteredItemModels->getItemModel(id)); ui->sourceCB->setModel(dialogFilteredItemModels->getItemModel(id));
ui->sourceCB->setCurrentIndex(ui->sourceCB->findData(md->srcRaw.toValue())); ui->sourceCB->setCurrentIndex(ui->sourceCB->findData(md->srcRaw.toValue()));
+17 -1
View File
@@ -74,12 +74,19 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, Ge
ui->persistent->addItem(tr("Persistent (flight)"), 1); ui->persistent->addItem(tr("Persistent (flight)"), 1);
ui->persistent->addItem(tr("Persistent (manual reset)"), 2); ui->persistent->addItem(tr("Persistent (manual reset)"), 2);
ui->countdownStart->setField(timer.countdownStart, this);
ui->countdownStart->addItem("5s", 1);
ui->countdownStart->addItem("10s", 0);
ui->countdownStart->addItem("20s", -1);
ui->countdownStart->addItem("30s", -2);
disableMouseScrolling(); disableMouseScrolling();
QWidget::setTabOrder(prevFocus, ui->name); QWidget::setTabOrder(prevFocus, ui->name);
QWidget::setTabOrder(ui->name, ui->value); QWidget::setTabOrder(ui->name, ui->value);
QWidget::setTabOrder(ui->value, ui->mode); QWidget::setTabOrder(ui->value, ui->mode);
QWidget::setTabOrder(ui->mode, ui->countdownBeep); QWidget::setTabOrder(ui->mode, ui->countdownBeep);
QWidget::setTabOrder(ui->countdownBeep, ui->minuteBeep); QWidget::setTabOrder(ui->countdownBeep, ui->countdownStart);
QWidget::setTabOrder(ui->countdownStart, ui->minuteBeep);
QWidget::setTabOrder(ui->minuteBeep, ui->persistent); QWidget::setTabOrder(ui->minuteBeep, ui->persistent);
update(); update();
@@ -121,6 +128,7 @@ void TimerPanel::update()
ui->countdownBeep->updateValue(); ui->countdownBeep->updateValue();
ui->minuteBeep->setChecked(timer.minuteBeep); ui->minuteBeep->setChecked(timer.minuteBeep);
ui->persistent->updateValue(); ui->persistent->updateValue();
ui->countdownStart->updateValue();
lock = false; lock = false;
} }
@@ -129,6 +137,14 @@ QWidget * TimerPanel::getLastFocus()
return ui->persistent; return ui->persistent;
} }
void TimerPanel::on_countdownBeep_currentIndexChanged(int index)
{
if(index == TimerData::COUNTDOWN_SILENT)
ui->countdownStart->hide();
else
ui->countdownStart->show();
}
void TimerPanel::on_value_editingFinished() void TimerPanel::on_value_editingFinished()
{ {
if (!lock) { if (!lock) {
+1
View File
@@ -51,6 +51,7 @@ class TimerPanel : public ModelPanel
void onModeChanged(int index); void onModeChanged(int index);
void on_value_editingFinished(); void on_value_editingFinished();
void on_minuteBeep_toggled(bool checked); void on_minuteBeep_toggled(bool checked);
void on_countdownBeep_currentIndexChanged(int index);
void on_name_editingFinished(); void on_name_editingFinished();
void onItemModelAboutToBeUpdated(); void onItemModelAboutToBeUpdated();
void onItemModelUpdateComplete(); void onItemModelUpdateComplete();
+13 -1
View File
@@ -20,7 +20,16 @@
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<property name="margin"> <property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@@ -59,6 +68,9 @@
<item> <item>
<widget class="AutoComboBox" name="countdownBeep"/> <widget class="AutoComboBox" name="countdownBeep"/>
</item> </item>
<item>
<widget class="AutoComboBox" name="countdownStart"/>
</item>
<item> <item>
<widget class="QCheckBox" name="minuteBeep"> <widget class="QCheckBox" name="minuteBeep">
<property name="text"> <property name="text">
+78 -128
View File
@@ -27,13 +27,13 @@
#include <TimerEdit> #include <TimerEdit>
constexpr char FIM_RAWSOURCE[] {"Raw Source"}; constexpr char FIM_RAWSOURCE[] {"Raw Source"};
constexpr char FIM_TELEALLSRC[] {"Tele All Source"}; constexpr char FIM_TELEALLSRC[] {"Tele All Source"};
constexpr char FIM_TELEPOSSRC[] {"Tele Pos Source"}; constexpr char FIM_TELEPOSSRC[] {"Tele Pos Source"};
constexpr char FIM_SENSORTYPE[] {"Sensor.Type"}; constexpr char FIM_SENSORTYPE[] {"Sensor.Type"};
constexpr char FIM_SENSORFORMULA[] {"Sensor.Formula"}; constexpr char FIM_SENSORFORMULA[] {"Sensor.Formula"};
constexpr char FIM_SENSORCELLINDEX[] {"Sensor.CellIndex"}; constexpr char FIM_SENSORCELLINDEX[] {"Sensor.CellIndex"};
constexpr char FIM_SENSORUNIT[] {"Sensor.Unit"}; constexpr char FIM_SENSORUNIT[] {"Sensor.Unit"};
constexpr char FIM_SENSORPRECISION[] {"Sensor.Precision"}; constexpr char FIM_SENSORPRECISION[] {"Sensor.Precision"};
TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings, TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings,
@@ -336,9 +336,6 @@ TelemetrySensorPanel::TelemetrySensorPanel(QWidget *parent, SensorData & sensor,
modelsUpdateCnt(0), modelsUpdateCnt(0),
parentLock(parentLock) parentLock(parentLock)
{ {
// TODO ui definition housekeeping
// - remove all predefined combobox lists leaving to code
// - use Auto types for consistency
ui->setupUi(this); ui->setupUi(this);
FilteredItemModel * fltmdl; FilteredItemModel * fltmdl;
@@ -358,11 +355,19 @@ TelemetrySensorPanel::TelemetrySensorPanel(QWidget *parent, SensorData & sensor,
ui->numLabel->setToolTip(tr("Popup menu available")); ui->numLabel->setToolTip(tr("Popup menu available"));
ui->numLabel->setMouseTracking(true); ui->numLabel->setMouseTracking(true);
connect(ui->numLabel, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_customContextMenuRequested(QPoint))); connect(ui->numLabel, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_customContextMenuRequested(QPoint)));
ui->name->setField(sensor.label, SENSOR_LABEL_LEN);
connect(ui->name, SIGNAL(currentDataChanged()), this, SLOT(on_nameDataChanged()));
ui->id->setField(sensor.id, this); ui->id->setField(sensor.id, this);
ui->instance->setField(sensor.instance, this); ui->instance->setField(sensor.instance, this);
ui->type->setModel(panelFilteredItemModels->getItemModel(FIM_SENSORTYPE)); ui->type->setModel(panelFilteredItemModels->getItemModel(FIM_SENSORTYPE));
ui->type->setField(sensor.type);
connect(ui->type, SIGNAL(currentDataChanged(int)), this, SLOT(update()));
ui->formula->setModel(panelFilteredItemModels->getItemModel(FIM_SENSORFORMULA)); ui->formula->setModel(panelFilteredItemModels->getItemModel(FIM_SENSORFORMULA));
ui->formula->setField(sensor.formula);
connect(ui->formula, SIGNAL(currentDataChanged(int)), this, SLOT(on_formulaDataChanged()));
ui->unit->setModel(panelFilteredItemModels->getItemModel(FIM_SENSORUNIT)); ui->unit->setModel(panelFilteredItemModels->getItemModel(FIM_SENSORUNIT));
ui->unit->setField(sensor.unit);
connect(ui->unit, SIGNAL(currentDataChanged(int)), this, SLOT(on_unitDataChanged()));
ui->ratio->setField(sensor.ratio, this); ui->ratio->setField(sensor.ratio, this);
ui->offset->setField(sensor.offset, this); ui->offset->setField(sensor.offset, this);
ui->autoOffset->setField(sensor.autoOffset, this); ui->autoOffset->setField(sensor.autoOffset, this);
@@ -390,7 +395,9 @@ TelemetrySensorPanel::TelemetrySensorPanel(QWidget *parent, SensorData & sensor,
ui->source3->setField(sensor.sources[2], this); ui->source3->setField(sensor.sources[2], this);
ui->source4->setModel(fltmdl); ui->source4->setModel(fltmdl);
ui->source4->setField(sensor.sources[3], this); ui->source4->setField(sensor.sources[3], this);
ui->prec->setField(sensor.prec, 0, 2, false, "", this); // TODO replace autoprecisioncombobox with autocombobox and filtereditemmodel ui->prec->setModel(panelFilteredItemModels->getItemModel(FIM_SENSORPRECISION));
ui->prec->setField(sensor.prec);
connect(ui->prec, SIGNAL(currentDataChanged(int)), this, SLOT(on_precDataChanged()));
lock = false; lock = false;
update(); update();
@@ -403,20 +410,13 @@ TelemetrySensorPanel::~TelemetrySensorPanel()
void TelemetrySensorPanel::update() void TelemetrySensorPanel::update()
{ {
// TODO use bit mask
bool isConfigurable = false;
bool gpsFieldsDisplayed = false;
bool cellsFieldsDisplayed = false;
bool consFieldsDisplayed = false;
bool ratioFieldsDisplayed = false;
bool totalizeFieldsDisplayed = false;
bool sources12FieldsDisplayed = false;
bool sources34FieldsDisplayed = false;
lock = true; lock = true;
ui->name->setText(sensor.label); int mask = sensor.getMask();
ui->type->setCurrentIndex(ui->type->findData(sensor.type));
ui->unit->setCurrentIndex(ui->unit->findData(sensor.unit)); ui->name->updateValue();
ui->type->updateValue();
ui->formula->updateValue();
ui->unit->updateValue();
ui->id->updateValue(); ui->id->updateValue();
ui->instance->updateValue(); ui->instance->updateValue();
ui->ratio->updateValue(); ui->ratio->updateValue();
@@ -443,13 +443,6 @@ void TelemetrySensorPanel::update()
ui->origin->hide(); ui->origin->hide();
ui->formula->show(); ui->formula->show();
ui->formula->setCurrentIndex(ui->formula->findData(sensor.formula)); ui->formula->setCurrentIndex(ui->formula->findData(sensor.formula));
isConfigurable = (sensor.formula < SensorData::TELEM_FORMULA_CELL);
gpsFieldsDisplayed = (sensor.formula == SensorData::TELEM_FORMULA_DIST);
cellsFieldsDisplayed = (sensor.formula == SensorData::TELEM_FORMULA_CELL);
consFieldsDisplayed = (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION);
sources12FieldsDisplayed = (sensor.formula <= SensorData::TELEM_FORMULA_MULTIPLY);
sources34FieldsDisplayed = (sensor.formula < SensorData::TELEM_FORMULA_MULTIPLY);
totalizeFieldsDisplayed = (sensor.formula == SensorData::TELEM_FORMULA_TOTALIZE);
ui->source1->updateValue(); ui->source1->updateValue();
ui->source2->updateValue(); ui->source2->updateValue();
ui->source3->updateValue(); ui->source3->updateValue();
@@ -464,121 +457,78 @@ void TelemetrySensorPanel::update()
ui->originLabel->setVisible(!origin.isEmpty()); ui->originLabel->setVisible(!origin.isEmpty());
ui->origin->setVisible(!origin.isEmpty()); ui->origin->setVisible(!origin.isEmpty());
ui->origin->setText(origin); ui->origin->setText(origin);
ui->formula->hide(); ui->formula->hide();
isConfigurable = sensor.unit < SensorData::UNIT_FIRST_VIRTUAL; FieldRange rng = sensor.getRatioRange();
ratioFieldsDisplayed = (sensor.unit < SensorData::UNIT_FIRST_VIRTUAL); ui->ratio->setDecimals(rng.decimals);
if (sensor.unit == SensorData::UNIT_RPMS) { ui->ratio->setMaximum(rng.max);
if (ui->ratio->decimals()) { ui->ratio->setMinimum(rng.min);
ui->ratio->setDecimals(0); ui->ratio->setSingleStep(rng.step);
ui->ratio->setMaximum(30000); rng = sensor.getOffsetRange();
ui->ratio->setMinimum(1); ui->offset->setDecimals(rng.decimals);
ui->ratio->setSingleStep(1); ui->offset->setMaximum(rng.max);
ui->offset->setDecimals(0); ui->offset->setMinimum(rng.min);
ui->offset->setMaximum(30000); ui->offset->setSingleStep(rng.step);
ui->offset->setMinimum(1);
ui->offset->setSingleStep(1);
}
}
else {
if (!ui->ratio->decimals()) {
ui->ratio->setDecimals(1);
ui->ratio->setMaximum(3000);
ui->ratio->setMinimum(0);
ui->ratio->setSingleStep(0.1);
}
if (ui->offset->decimals() != (int)sensor.prec) {
ui->offset->setDecimals(sensor.prec);
ui->offset->setMaximum(30000.0f / powf(10.0f, sensor.prec));
ui->offset->setMinimum(-ui->offset->maximum());
ui->offset->setSingleStep(pow(0.1, sensor.prec));
}
}
} }
ui->ratioLabel->setVisible(ratioFieldsDisplayed && sensor.unit != SensorData::UNIT_RPMS); ui->ratioLabel->setVisible(mask & SENSOR_HAS_RATIO && sensor.unit != SensorData::UNIT_RPMS);
ui->bladesLabel->setVisible(sensor.unit == SensorData::UNIT_RPMS); ui->bladesLabel->setVisible(mask & SENSOR_HAS_RATIO && sensor.unit == SensorData::UNIT_RPMS);
ui->ratio->setVisible(ratioFieldsDisplayed); ui->ratio->setVisible(mask & SENSOR_HAS_RATIO);
ui->offsetLabel->setVisible(ratioFieldsDisplayed && sensor.unit != SensorData::UNIT_RPMS);
ui->multiplierLabel->setVisible(sensor.unit == SensorData::UNIT_RPMS); ui->offsetLabel->setVisible(mask & SENSOR_HAS_RATIO && sensor.unit != SensorData::UNIT_RPMS);
ui->offset->setVisible(ratioFieldsDisplayed); ui->multiplierLabel->setVisible(mask & SENSOR_HAS_RATIO && sensor.unit == SensorData::UNIT_RPMS);
ui->precLabel->setVisible(isConfigurable && sensor.unit != SensorData::UNIT_FAHRENHEIT); ui->offset->setVisible(mask & SENSOR_HAS_RATIO);
ui->prec->setVisible(isConfigurable && sensor.unit != SensorData::UNIT_FAHRENHEIT);
ui->unit->setVisible((sensor.type == SensorData::TELEM_TYPE_CALCULATED && (sensor.formula == SensorData::TELEM_FORMULA_DIST)) || isConfigurable); ui->precLabel->setVisible(mask & SENSOR_HAS_PRECISION);
ui->gpsSensorLabel->setVisible(gpsFieldsDisplayed); ui->prec->setVisible(mask & SENSOR_HAS_PRECISION);
ui->gpsSensor->setVisible(gpsFieldsDisplayed);
ui->altSensorLabel->setVisible(gpsFieldsDisplayed); ui->unit->setVisible(mask & SENSOR_ISCONFIGURABLE);
ui->altSensor->setVisible(gpsFieldsDisplayed);
ui->ampsSensorLabel->setVisible(consFieldsDisplayed || totalizeFieldsDisplayed); ui->gpsSensorLabel->setVisible(mask & SENSOR_HAS_GPS);
ui->ampsSensor->setVisible(consFieldsDisplayed || totalizeFieldsDisplayed); ui->gpsSensor->setVisible(mask & SENSOR_HAS_GPS);
ui->cellsSensorLabel->setVisible(cellsFieldsDisplayed);
ui->cellsSensor->setVisible(cellsFieldsDisplayed); ui->altSensorLabel->setVisible(mask & SENSOR_HAS_GPS);
ui->cellsIndex->setVisible(cellsFieldsDisplayed); ui->altSensor->setVisible(mask & SENSOR_HAS_GPS);
ui->source1->setVisible(sources12FieldsDisplayed);
ui->source2->setVisible(sources12FieldsDisplayed); ui->ampsSensorLabel->setVisible(mask & SENSOR_HAS_CONSUMPTION || mask & SENSOR_HAS_TOTALIZE);
ui->source3->setVisible(sources34FieldsDisplayed); ui->ampsSensor->setVisible(mask & SENSOR_HAS_CONSUMPTION || mask & SENSOR_HAS_TOTALIZE);
ui->source4->setVisible(sources34FieldsDisplayed);
ui->autoOffset->setVisible(sensor.unit != SensorData::UNIT_RPMS && isConfigurable); ui->cellsSensorLabel->setVisible(mask & SENSOR_HAS_CELLS);
ui->filter->setVisible(isConfigurable); ui->cellsSensor->setVisible(mask & SENSOR_HAS_CELLS);
ui->persistent->setVisible(sensor.type == SensorData::TELEM_TYPE_CALCULATED); ui->cellsIndex->setVisible(mask & SENSOR_HAS_CELLS);
ui->source1->setVisible(mask & SENSOR_HAS_SOURCES_12);
ui->source2->setVisible(mask & SENSOR_HAS_SOURCES_12);
ui->source3->setVisible(mask & SENSOR_HAS_SOURCES_34);
ui->source4->setVisible(mask & SENSOR_HAS_SOURCES_34);
ui->autoOffset->setEnabled(mask & SENSOR_HAS_RATIO && sensor.unit != SensorData::UNIT_RPMS);
ui->onlyPositive->setEnabled(mask & SENSOR_HAS_POSITIVE);
ui->filter->setEnabled(mask & SENSOR_ISCONFIGURABLE);
ui->persistent->setEnabled(sensor.type == SensorData::TELEM_TYPE_CALCULATED);
lock = false; lock = false;
} }
void TelemetrySensorPanel::on_name_editingFinished() void TelemetrySensorPanel::on_nameDataChanged()
{ {
if (!isLocked() && (sensor.label != ui->name->text().toLatin1())) { emit dataModified();
strcpy(sensor.label, ui->name->text().toLatin1());
emit dataModified();
}
} }
void TelemetrySensorPanel::on_type_currentIndexChanged(int index) void TelemetrySensorPanel::on_formulaDataChanged()
{ {
if (!isLocked()) { sensor.formulaChanged();
sensor.type = ui->type->itemData(index).toInt(); update();
update();
emit modified();
}
} }
void TelemetrySensorPanel::on_formula_currentIndexChanged(int index) void TelemetrySensorPanel::on_unitDataChanged()
{ {
if (!isLocked()) { sensor.unitChanged();
sensor.formula = ui->formula->itemData(index).toInt(); update();
if (sensor.formula == SensorData::TELEM_FORMULA_CELL) {
sensor.prec = 2;
sensor.unit = SensorData::UNIT_VOLTS;
}
else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION) {
sensor.prec = 0;
sensor.unit = SensorData::UNIT_MAH;
}
else if (sensor.formula == SensorData::TELEM_FORMULA_DIST) {
sensor.prec = 0;
sensor.unit = SensorData::UNIT_METERS;
}
emit dataModified();
}
} }
void TelemetrySensorPanel::on_unit_currentIndexChanged(int index) void TelemetrySensorPanel::on_precDataChanged()
{ {
if (!isLocked()) { update();
sensor.unit = ui->unit->itemData(index).toInt();
if (sensor.unit == SensorData::UNIT_FAHRENHEIT) {
sensor.prec = 0;
}
update();
emit modified();
}
}
void TelemetrySensorPanel::on_prec_valueChanged()
{
if (!isLocked()) {
update();
}
} }
void TelemetrySensorPanel::on_customContextMenuRequested(QPoint pos) void TelemetrySensorPanel::on_customContextMenuRequested(QPoint pos)
+5 -9
View File
@@ -18,8 +18,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#ifndef _TELEMETRY_H_ #pragma once
#define _TELEMETRY_H_
#include "modeledit.h" #include "modeledit.h"
#include "eeprominterface.h" #include "eeprominterface.h"
@@ -94,11 +93,6 @@ class TelemetrySensorPanel: public ModelPanel
void moveDownSensor(int index); void moveDownSensor(int index);
protected slots: protected slots:
void on_name_editingFinished();
void on_type_currentIndexChanged(int index);
void on_formula_currentIndexChanged(int index);
void on_unit_currentIndexChanged(int index);
void on_prec_valueChanged();
void on_customContextMenuRequested(QPoint pos); void on_customContextMenuRequested(QPoint pos);
bool hasClipboardData(QByteArray * data = nullptr) const; bool hasClipboardData(QByteArray * data = nullptr) const;
void cmCopy(); void cmCopy();
@@ -112,6 +106,10 @@ class TelemetrySensorPanel: public ModelPanel
void cmMoveDown(); void cmMoveDown();
void onItemModelAboutToBeUpdated(); void onItemModelAboutToBeUpdated();
void onItemModelUpdateComplete(); void onItemModelUpdateComplete();
void on_nameDataChanged();
void on_formulaDataChanged();
void on_unitDataChanged();
void on_precDataChanged();
private: private:
Ui::TelemetrySensor * ui; Ui::TelemetrySensor * ui;
@@ -181,5 +179,3 @@ class TelemetryPanel : public ModelPanel
void connectItemModelEvents(const int id); void connectItemModelEvents(const int id);
inline bool isLocked() { return lock; } inline bool isLocked() { return lock; }
}; };
#endif // _TELEMETRY_H_
+9 -189
View File
@@ -40,7 +40,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="name"> <widget class="AutoLineEdit" name="name">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@@ -59,23 +59,13 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="type"> <widget class="AutoComboBox" name="type">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<item>
<property name="text">
<string>Custom</string>
</property>
</item>
<item>
<property name="text">
<string>Calculated</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item> <item>
@@ -147,7 +137,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="origin"> <widget class="AutoLineEdit" name="origin">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@@ -175,58 +165,13 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="formula"> <widget class="AutoComboBox" name="formula">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<item>
<property name="text">
<string>Add</string>
</property>
</item>
<item>
<property name="text">
<string>Average</string>
</property>
</item>
<item>
<property name="text">
<string>Min</string>
</property>
</item>
<item>
<property name="text">
<string>Max</string>
</property>
</item>
<item>
<property name="text">
<string>Multiply</string>
</property>
</item>
<item>
<property name="text">
<string>Totalize</string>
</property>
</item>
<item>
<property name="text">
<string>Cell</string>
</property>
</item>
<item>
<property name="text">
<string>Consumption</string>
</property>
</item>
<item>
<property name="text">
<string>Dist</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item> <item>
@@ -412,138 +357,13 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="unit"> <widget class="AutoComboBox" name="unit">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<item>
<property name="text">
<string>Raw (-)</string>
</property>
</item>
<item>
<property name="text">
<string>V</string>
</property>
</item>
<item>
<property name="text">
<string>A</string>
</property>
</item>
<item>
<property name="text">
<string>mA</string>
</property>
</item>
<item>
<property name="text">
<string>kt</string>
</property>
</item>
<item>
<property name="text">
<string>m/s</string>
</property>
</item>
<item>
<property name="text">
<string>ft/s</string>
</property>
</item>
<item>
<property name="text">
<string>km/h</string>
</property>
</item>
<item>
<property name="text">
<string>mph</string>
</property>
</item>
<item>
<property name="text">
<string>m</string>
</property>
</item>
<item>
<property name="text">
<string>ft</string>
</property>
</item>
<item>
<property name="text">
<string>°C</string>
</property>
</item>
<item>
<property name="text">
<string>°F</string>
</property>
</item>
<item>
<property name="text">
<string>%</string>
</property>
</item>
<item>
<property name="text">
<string>mAh</string>
</property>
</item>
<item>
<property name="text">
<string>W</string>
</property>
</item>
<item>
<property name="text">
<string>mW</string>
</property>
</item>
<item>
<property name="text">
<string>dBm</string>
</property>
</item>
<item>
<property name="text">
<string>RPM</string>
</property>
</item>
<item>
<property name="text">
<string>g</string>
</property>
</item>
<item>
<property name="text">
<string>°</string>
</property>
</item>
<item>
<property name="text">
<string>Rad</string>
</property>
</item>
<item>
<property name="text">
<string>mL</string>
</property>
</item>
<item>
<property name="text">
<string>US fl.Oz.</string>
</property>
</item>
<item>
<property name="text">
<string>ml/min</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item> <item>
@@ -560,7 +380,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="AutoPrecisionComboBox" name="prec"/> <widget class="AutoComboBox" name="prec"/>
</item> </item>
<item> <item>
<widget class="QLabel" name="ratioLabel"> <widget class="QLabel" name="ratioLabel">
@@ -720,9 +540,9 @@
<header>autohexspinbox.h</header> <header>autohexspinbox.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>AutoPrecisionComboBox</class> <class>AutoLineEdit</class>
<extends>QComboBox</extends> <extends>QLineEdit</extends>
<header>autoprecisioncombobox.h</header> <header>autolineedit.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
-163
View File
@@ -1071,17 +1071,6 @@ QString ModelPrinter::printRssiAlarmsDisabled(bool mb)
return printBoolean(!mb, BOOLEAN_ENABLEDISABLE); return printBoolean(!mb, BOOLEAN_ENABLEDISABLE);
} }
QString ModelPrinter::printTelemetrySource(int val)
{
QStringList strings = QStringList() << tr("None");
for (unsigned i=1; i<=CPN_MAX_SENSORS; ++i) {
strings << QString("%1").arg(model.sensorData[i-1].label);
}
return QString("%1%2").arg((val < 0 ? "-" : "")).arg(strings.value(abs(val)));
}
QString ModelPrinter::printVarioSource(unsigned int val) QString ModelPrinter::printVarioSource(unsigned int val)
{ {
switch (val) { switch (val) {
@@ -1155,144 +1144,6 @@ QString ModelPrinter::printIgnoreSensorIds(bool mb)
return printBoolean(mb, BOOLEAN_ENABLEDISABLE); return printBoolean(mb, BOOLEAN_ENABLEDISABLE);
} }
QString ModelPrinter::printSensorType(unsigned int val)
{
switch (val) {
case SensorData::TELEM_TYPE_CUSTOM:
return tr("Custom");
case SensorData::TELEM_TYPE_CALCULATED:
return tr("Calculated");
default:
return CPN_STR_UNKNOWN_ITEM;
}
}
QString ModelPrinter::printSensorFormula(unsigned int val)
{
switch (val) {
case SensorData::TELEM_FORMULA_ADD:
return tr("Add");
case SensorData::TELEM_FORMULA_AVERAGE:
return tr("Average");
case SensorData::TELEM_FORMULA_MIN:
return tr("Min");
case SensorData::TELEM_FORMULA_MAX:
return tr("Max");
case SensorData::TELEM_FORMULA_MULTIPLY:
return tr("Multiply");
case SensorData::TELEM_FORMULA_TOTALIZE:
return tr("Totalise");
case SensorData::TELEM_FORMULA_CELL:
return tr("Cell");
case SensorData::TELEM_FORMULA_CONSUMPTION:
return tr("Consumption");
case SensorData::TELEM_FORMULA_DIST:
return tr("Distance");
default:
return CPN_STR_UNKNOWN_ITEM;
}
}
QString ModelPrinter::printSensorCells(unsigned int val)
{
QStringList strings;
strings << tr("Lowest");
for (int i=1; i<=6; i++)
strings << tr("Cell %1").arg(i);
strings << tr("Highest") << tr("Delta");
return strings.value(val);
}
QString ModelPrinter::printSensorTypeCond(unsigned int idx)
{
if (!model.sensorData[idx].isAvailable())
return "";
else
return printSensorType(model.sensorData[idx].type);
}
QString ModelPrinter::printSensorParams(unsigned int idx)
{
QString str = "";
SensorData sensor = model.sensorData[idx];
if (!sensor.isAvailable())
return str;
bool isConfigurable = false;
bool gpsFieldsPrinted = false;
bool cellsFieldsPrinted = false;
bool consFieldsPrinted = false;
bool ratioFieldsPrinted = false;
bool totalizeFieldsPrinted = false;
bool sources12FieldsPrinted = false;
bool sources34FieldsPrinted = false;
if (sensor.type == SensorData::TELEM_TYPE_CALCULATED) {
isConfigurable = (sensor.formula < SensorData::TELEM_FORMULA_CELL);
gpsFieldsPrinted = (sensor.formula == SensorData::TELEM_FORMULA_DIST);
cellsFieldsPrinted = (sensor.formula == SensorData::TELEM_FORMULA_CELL);
consFieldsPrinted = (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION);
sources12FieldsPrinted = (sensor.formula <= SensorData::TELEM_FORMULA_MULTIPLY);
sources34FieldsPrinted = (sensor.formula < SensorData::TELEM_FORMULA_MULTIPLY);
totalizeFieldsPrinted = (sensor.formula == SensorData::TELEM_FORMULA_TOTALIZE);
str.append(printLabelValue(tr("F"), printSensorFormula(sensor.formula)));
}
else {
isConfigurable = sensor.unit < SensorData::UNIT_FIRST_VIRTUAL;
ratioFieldsPrinted = (sensor.unit < SensorData::UNIT_FIRST_VIRTUAL);
str.append(printLabelValue(tr("Id"), QString::number(sensor.id,16).toUpper()));
str.append(printLabelValue(tr("Inst"), QString::number(sensor.instance)));
}
if (cellsFieldsPrinted) {
str.append(printLabelValue(tr("Sensor"), QString("%1 %2").arg(printTelemetrySource(sensor.source), false).arg(printSensorCells(sensor.index))));
}
if (sources12FieldsPrinted) {
QStringList srcs;
for (int i=0;i<4;i++) {
if (i < 2 || sources34FieldsPrinted) {
srcs << printTelemetrySource(sensor.sources[i]);
}
}
str.append(printLabelValues(tr("Sources"), srcs));
}
if (consFieldsPrinted || totalizeFieldsPrinted)
str.append(printLabelValue(tr("Sensor"), printTelemetrySource(sensor.amps)));
if (gpsFieldsPrinted) {
str.append(printLabelValue(tr("GPS"), printTelemetrySource(sensor.gps)));
str.append(printLabelValue(tr("Alt"), printTelemetrySource(sensor.alt)));
}
QString u = sensor.unitString();
u = u.trimmed() == "" ? "-" : u;
str.append(printLabelValue(tr("Unit"), u));
if (isConfigurable && sensor.unit != SensorData::UNIT_FAHRENHEIT)
str.append(printLabelValue(tr("Prec"), printTelemetryPrecision(sensor.prec)));
if (ratioFieldsPrinted) {
if (sensor.unit != SensorData::UNIT_RPMS) {
int prec = sensor.prec == 0 ? 1 : pow(10, sensor.prec);
str.append(printLabelValue(tr("Ratio"), QString::number((float)sensor.ratio / 10)));
str.append(printLabelValue(tr("Offset"), QString::number((float)sensor.offset / prec, 'f', sensor.prec)));
}
else if (sensor.unit == SensorData::UNIT_RPMS) {
str.append(printLabelValue(tr("Blades"), QString::number(sensor.ratio)));
str.append(printLabelValue(tr("Multi"), QString::number(sensor.offset)));
}
}
if (sensor.unit != SensorData::UNIT_RPMS && isConfigurable)
str.append(printLabelValue(tr("Auto Offset"), printBoolean(sensor.autoOffset, BOOLEAN_YN)));
if (isConfigurable)
str.append(printLabelValue(tr("Filter"), printBoolean(sensor.filter, BOOLEAN_YN)));
if (sensor.type == SensorData::TELEM_TYPE_CALCULATED)
str.append(printLabelValue(tr("Persist"), printBoolean(sensor.persistent, BOOLEAN_YN)));
str.append(printLabelValue(tr("Positive"), printBoolean(sensor.onlyPositive, BOOLEAN_YN)));
str.append(printLabelValue(tr("Log"), printBoolean(sensor.logs, BOOLEAN_YN), false));
return str;
}
QString ModelPrinter::printTelemetryScreenType(unsigned int val) QString ModelPrinter::printTelemetryScreenType(unsigned int val)
{ {
switch (val) { switch (val) {
@@ -1373,17 +1224,3 @@ QString ModelPrinter::printChecklist()
} }
return str; return str;
} }
QString ModelPrinter::printTelemetryPrecision(unsigned int val)
{
switch (val) {
case 0:
return tr("0.");
case 1:
return tr("0.0");
case 2:
return tr("0.00");
default:
return CPN_STR_UNKNOWN_ITEM;
}
}
+1 -11
View File
@@ -18,8 +18,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#ifndef _MODELPRINTER_H_ #pragma once
#define _MODELPRINTER_H_
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
@@ -116,22 +115,15 @@ class ModelPrinter: public QObject
QString printLabelValue(const QString & lbl, const QString & val, const bool sep = false); QString printLabelValue(const QString & lbl, const QString & val, const bool sep = false);
QString printLabelValues(const QString & lbl, const QStringList & vals, const bool sep = false); QString printLabelValues(const QString & lbl, const QStringList & vals, const bool sep = false);
QString printRssiAlarmsDisabled(bool mb); QString printRssiAlarmsDisabled(bool mb);
QString printTelemetrySource(int val);
QString printVarioSource(unsigned int val); QString printVarioSource(unsigned int val);
QString printVarioCenterSilent(bool mb); QString printVarioCenterSilent(bool mb);
QString printVoltsSource(unsigned int val); QString printVoltsSource(unsigned int val);
QString printCurrentSource(unsigned int val); QString printCurrentSource(unsigned int val);
QString printMahPersistent(bool mb); QString printMahPersistent(bool mb);
QString printIgnoreSensorIds(bool mb); QString printIgnoreSensorIds(bool mb);
QString printSensorType(unsigned int val);
QString printSensorFormula(unsigned int val);
QString printSensorCells(unsigned int val);
QString printSensorTypeCond(unsigned int idx);
QString printSensorParams(unsigned int idx);
QString printTelemetryScreenType(unsigned int val); QString printTelemetryScreenType(unsigned int val);
QString printTelemetryScreen(unsigned int idx, unsigned int line, unsigned int width); QString printTelemetryScreen(unsigned int idx, unsigned int line, unsigned int width);
QString printChecklist(); QString printChecklist();
QString printTelemetryPrecision(unsigned int val);
private: private:
Firmware * firmware; Firmware * firmware;
@@ -139,5 +131,3 @@ class ModelPrinter: public QObject
const ModelData & model; const ModelData & model;
}; };
#endif // _MODELPRINTER_H_
+7 -7
View File
@@ -777,7 +777,7 @@ QString MultiModelPrinter::printTelemetry()
if (firmware->getCapability(HasVario)) { if (firmware->getCapability(HasVario)) {
columns.appendRowStart(tr("Altimetry"), 20); columns.appendRowStart(tr("Altimetry"), 20);
if (IS_HORUS_OR_TARANIS(firmware->getBoard())) { if (IS_HORUS_OR_TARANIS(firmware->getBoard())) {
LABELCOMPARECELL(tr("Vario source"), modelPrinter->printTelemetrySource(model->frsky.varioSource), 80); LABELCOMPARECELL(tr("Vario source"), SensorData::sourceToString(model, model->frsky.varioSource), 80);
} }
else { else {
LABELCOMPARECELL(tr("Vario source"), modelPrinter->printVarioSource(model->frsky.varioSource), 80); LABELCOMPARECELL(tr("Vario source"), modelPrinter->printVarioSource(model->frsky.varioSource), 80);
@@ -801,8 +801,8 @@ QString MultiModelPrinter::printTelemetry()
if (IS_HORUS_OR_TARANIS(firmware->getBoard())) { if (IS_HORUS_OR_TARANIS(firmware->getBoard())) {
columns.appendRowStart(tr("Top Bar"), 20); columns.appendRowStart(tr("Top Bar"), 20);
columns.appendCellStart(80); columns.appendCellStart(80);
COMPARESTRING(tr("Volts source"), modelPrinter->printTelemetrySource(model->frsky.voltsSource), true); COMPARESTRING(tr("Volts source"), SensorData::sourceToString(model, model->frsky.voltsSource), true);
COMPARESTRING(tr("Altitude source"), modelPrinter->printTelemetrySource(model->frsky.altitudeSource), false); COMPARESTRING(tr("Altitude source"), SensorData::sourceToString(model, model->frsky.altitudeSource), false);
columns.appendCellEnd(); columns.appendCellEnd();
columns.appendRowEnd(); columns.appendRowEnd();
} }
@@ -822,9 +822,9 @@ QString MultiModelPrinter::printSensors()
int count = 0; int count = 0;
columns.appendSectionTableStart(); columns.appendSectionTableStart();
columns.appendRowHeader(QStringList() << tr("Name") << tr("Type") << tr("Parameters")); columns.appendRowHeader(QStringList() << tr("Name") << tr("Type") << tr("Parameters"));
for (unsigned i=0; i<CPN_MAX_SENSORS; ++i) { for (unsigned i = 0; i < CPN_MAX_SENSORS; ++i) {
bool tsEmpty = true; bool tsEmpty = true;
for (int k=0; k < modelPrinterMap.size(); k++) { for (int k = 0; k < modelPrinterMap.size(); k++) {
if (modelPrinterMap.value(k).first->sensorData[i].isAvailable()) { if (modelPrinterMap.value(k).first->sensorData[i].isAvailable()) {
tsEmpty = false; tsEmpty = false;
break; break;
@@ -836,8 +836,8 @@ QString MultiModelPrinter::printSensors()
columns.appendCellStart(20, true); columns.appendCellStart(20, true);
COMPARE(model->sensorData[i].nameToString(i)); COMPARE(model->sensorData[i].nameToString(i));
columns.appendCellEnd(true); columns.appendCellEnd(true);
COMPARECELLWIDTH(modelPrinter->printSensorTypeCond(i), 15); COMPARECELLWIDTH(model->sensorData[i].isAvailable() ? model->sensorData[i].typeToString() : "", 15);
COMPARECELLWIDTH(modelPrinter->printSensorParams(i), 65); COMPARECELLWIDTH(model->sensorData[i].paramsToString(model), 65);
columns.appendRowEnd(); columns.appendRowEnd();
} }
} }
+1 -4
View File
@@ -18,8 +18,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#ifndef AUTOBITSETCHECKBOX_H #pragma once
#define AUTOBITSETCHECKBOX_H
#include <QCheckBox> #include <QCheckBox>
#include "genericpanel.h" #include "genericpanel.h"
@@ -174,5 +173,3 @@ class AutoBitsetCheckBox: public QCheckBox
bool m_lock = false; bool m_lock = false;
GenericPanel * m_panel = nullptr; GenericPanel * m_panel = nullptr;
}; };
#endif // AUTOBITSETCHECKBOX_H
+6 -4
View File
@@ -18,8 +18,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#ifndef _AUTOCHECKBOX_H_ #pragma once
#define _AUTOCHECKBOX_H_
#include <QCheckBox> #include <QCheckBox>
#include "modeledit/modeledit.h" #include "modeledit/modeledit.h"
@@ -45,6 +44,11 @@ class AutoCheckBox: public QCheckBox
updateValue(); updateValue();
} }
void setEnabled(bool enabled)
{
QCheckBox::setEnabled(enabled);
}
void updateValue() void updateValue()
{ {
lock = true; lock = true;
@@ -70,5 +74,3 @@ class AutoCheckBox: public QCheckBox
ModelPanel * panel; ModelPanel * panel;
bool lock; bool lock;
}; };
#endif // _AUTOCHECKBOX_H_
+1 -4
View File
@@ -18,8 +18,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#ifndef _AUTOCOMBOBOX_H_ #pragma once
#define _AUTOCOMBOBOX_H_
#include <QComboBox> #include <QComboBox>
#include "genericpanel.h" #include "genericpanel.h"
@@ -137,5 +136,3 @@ class AutoComboBox: public QComboBox
bool lock = false; bool lock = false;
bool hasModel = false; bool hasModel = false;
}; };
#endif // _AUTOCOMBOBOX_H_
+1 -4
View File
@@ -18,8 +18,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#ifndef _AUTODOUBLESPINBOX_H_ #pragma once
#define _AUTODOUBLESPINBOX_H_
#include <QDoubleSpinBox> #include <QDoubleSpinBox>
#include "modeledit/modeledit.h" #include "modeledit/modeledit.h"
@@ -97,5 +96,3 @@ class AutoDoubleSpinBox: public QDoubleSpinBox
ModelPanel * panel; ModelPanel * panel;
bool lock; bool lock;
}; };
#endif // _AUTODOUBLESPINBOX_H_
+1 -4
View File
@@ -18,8 +18,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#ifndef _AUTOHEXSPINBOX_H_ #pragma once
#define _AUTOHEXSPINBOX_H_
#include "hexspinbox.h" #include "hexspinbox.h"
#include "modeledit/modeledit.h" #include "modeledit/modeledit.h"
@@ -68,5 +67,3 @@ class AutoHexSpinBox: public HexSpinBox
ModelPanel * panel; ModelPanel * panel;
bool lock; bool lock;
}; };
#endif // _AUTOHEXSPINBOX_H_
+7 -5
View File
@@ -18,8 +18,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#ifndef _AUTOLINEEDIT_H_ #pragma once
#define _AUTOLINEEDIT_H_
#include <QLineEdit> #include <QLineEdit>
#include <QRegExpValidator> #include <QRegExpValidator>
@@ -71,10 +70,13 @@ class AutoLineEdit: public QLineEdit
lock = false; lock = false;
} }
signals:
void currentDataChanged();
protected slots: protected slots:
void onEdited() void onEdited()
{ {
if (lock) if ((panel && panel->lock) || lock)
return; return;
if (field) if (field)
@@ -86,6 +88,8 @@ class AutoLineEdit: public QLineEdit
if (panel) if (panel)
emit panel->modified(); emit panel->modified();
emit currentDataChanged();
} }
protected: protected:
@@ -94,5 +98,3 @@ class AutoLineEdit: public QLineEdit
GenericPanel * panel; GenericPanel * panel;
bool lock; bool lock;
}; };
#endif // _AUTOLINEEDIT_H_
+1 -4
View File
@@ -18,8 +18,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#ifndef _AUTOPRECISIONCOMBOBOX_H_ #pragma once
#define _AUTOPRECISIONCOMBOBOX_H_
#include "genericpanel.h" #include "genericpanel.h"
@@ -253,5 +252,3 @@ class AutoPrecisionComboBox: public QComboBox
QString m_suffix = ""; QString m_suffix = "";
bool m_lock = false; bool m_lock = false;
}; };
#endif // _AUTOPRECISIONCOMBOBOX_H_
+1 -4
View File
@@ -18,8 +18,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#ifndef _GENERICPANEL_H_ #pragma once
#define _GENERICPANEL_H_
#include <QWidget> #include <QWidget>
@@ -65,5 +64,3 @@ class GenericPanel : public QWidget
void setFocusFilter(QWidget * w); void setFocusFilter(QWidget * w);
void disableMouseScrolling(); void disableMouseScrolling();
}; };
#endif // _GENERICPANEL_H_
+1 -4
View File
@@ -18,8 +18,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#ifndef _HEXSPINBOX_H_ #pragma once
#define _HEXSPINBOX_H_
#include <QSpinBox> #include <QSpinBox>
@@ -40,5 +39,3 @@ class HexSpinBox : public QSpinBox
private: private:
QRegExpValidator *validator; QRegExpValidator *validator;
}; };
#endif // _HEXSPINBOX_H_
+1 -5
View File
@@ -18,8 +18,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#ifndef _VERTICALSCROLLAREA_H_ #pragma once
#define _VERTICALSCROLLAREA_H_
#include <QScrollArea> #include <QScrollArea>
@@ -36,6 +35,3 @@ class VerticalScrollArea : public QScrollArea
private: private:
GenericPanel * panel; GenericPanel * panel;
}; };
#endif // _VERTICALSCROLLAREA_H_
File diff suppressed because it is too large Load Diff
+45 -61
View File
@@ -129,9 +129,6 @@ enum MenuModelSetupItems {
ITEM_MODEL_SETUP_EXTERNAL_MODULE_CHANNELS, ITEM_MODEL_SETUP_EXTERNAL_MODULE_CHANNELS,
ITEM_MODEL_SETUP_EXTERNAL_MODULE_NOT_ACCESS_RXNUM_BIND_RANGE, ITEM_MODEL_SETUP_EXTERNAL_MODULE_NOT_ACCESS_RXNUM_BIND_RANGE,
ITEM_MODEL_SETUP_EXTERNAL_MODULE_PXX2_MODEL_NUM, ITEM_MODEL_SETUP_EXTERNAL_MODULE_PXX2_MODEL_NUM,
#if defined(PCBSKY9X) && defined(REVX)
ITEM_MODEL_SETUP_EXTERNAL_MODULE_OUTPUT_TYPE,
#endif
#if defined(AFHDS3) #if defined(AFHDS3)
ITEM_MODEL_SETUP_EXTERNAL_MODULE_AFHDS3_RX_FREQ, ITEM_MODEL_SETUP_EXTERNAL_MODULE_AFHDS3_RX_FREQ,
ITEM_MODEL_SETUP_EXTERNAL_MODULE_AFHDS3_ACTUAL_POWER, ITEM_MODEL_SETUP_EXTERNAL_MODULE_AFHDS3_ACTUAL_POWER,
@@ -151,6 +148,9 @@ enum MenuModelSetupItems {
ITEM_MODEL_SETUP_EXTERNAL_MODULE_PXX2_RECEIVER_2, ITEM_MODEL_SETUP_EXTERNAL_MODULE_PXX2_RECEIVER_2,
ITEM_MODEL_SETUP_EXTERNAL_MODULE_PXX2_RECEIVER_3, ITEM_MODEL_SETUP_EXTERNAL_MODULE_PXX2_RECEIVER_3,
#if defined(PCBSKY9X) && defined(REVX)
ITEM_MODEL_SETUP_EXTERNAL_MODULE_OUTPUT_TYPE,
#endif
#if defined(PCBSKY9X) #if defined(PCBSKY9X)
ITEM_MODEL_SETUP_EXTRA_MODULE_LABEL, ITEM_MODEL_SETUP_EXTRA_MODULE_LABEL,
ITEM_MODEL_SETUP_EXTRA_MODULE_CHANNELS, ITEM_MODEL_SETUP_EXTRA_MODULE_CHANNELS,
@@ -211,8 +211,8 @@ enum MenuModelSetupItems {
#endif #endif
#if defined(PCBSKY9X) && defined(REVX) #if defined(PCBSKY9X) && defined(REVX)
#define OUTPUT_TYPE_ROW (isModulePPM(EXTERNAL_MODULE) ? (uint8_t)0 : HIDDEN_ROW), #define OUTPUT_TYPE_ROW (isModulePPM(EXTERNAL_MODULE) ? (uint8_t)0 : HIDDEN_ROW), // Output type (OpenDrain / PushPull)
#elif defined(PCBSKY9X) #else
#define OUTPUT_TYPE_ROW #define OUTPUT_TYPE_ROW
#endif #endif
@@ -236,7 +236,8 @@ inline uint8_t MODULE_SUBTYPE_ROWS(int moduleIdx)
} }
#define POT_WARN_ROWS ((g_model.potsWarnMode) ? (uint8_t)(NUM_POTS+NUM_SLIDERS) : (uint8_t)0) #define POT_WARN_ROWS ((g_model.potsWarnMode) ? (uint8_t)(NUM_POTS+NUM_SLIDERS) : (uint8_t)0)
#define TIMER_ROWS 2, 0, 0, 0, 0 #define TIMER_ROWS(x) 2, 0, 0, 0, g_model.timers[x].countdownBeep != COUNTDOWN_SILENT ? (uint8_t)1 : (uint8_t)0
#define TIMERS_ROWS TIMER_ROWS(0), TIMER_ROWS(1), TIMER_ROWS(2)
#if defined(PCBSKY9X) #if defined(PCBSKY9X)
#define EXTRA_MODULE_ROWS LABEL(ExtraModule), 1, 2, #define EXTRA_MODULE_ROWS LABEL(ExtraModule), 1, 2,
@@ -306,6 +307,27 @@ void onBluetoothConnectMenu(const char * result)
} }
#endif #endif
void editTimerCountdown(int timerIdx, coord_t y, LcdFlags attr, event_t event)
{
TimerData & timer = g_model.timers[timerIdx];
lcdDrawTextAlignedLeft(y, STR_BEEPCOUNTDOWN);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VBEEPCOUNTDOWN, timer.countdownBeep, (menuHorizontalPosition == 0 ? attr : 0));
if (timer.countdownBeep != COUNTDOWN_SILENT) {
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN + 6 * FW, y, TIMER_COUNTDOWN_START(timerIdx), (menuHorizontalPosition == 1 ? attr : 0) | LEFT);
lcdDrawChar(lcdLastRightPos, y, 's');
}
if (attr && s_editMode > 0) {
switch (menuHorizontalPosition) {
case 0:
CHECK_INCDEC_MODELVAR(event, timer.countdownBeep, COUNTDOWN_SILENT, COUNTDOWN_COUNT - 1);
break;
case 1:
timer.countdownStart = -checkIncDecModel(event, -timer.countdownStart, -1, +2);
break;
}
}
}
#include "common/stdlcd/model_setup_pxx1.cpp" #include "common/stdlcd/model_setup_pxx1.cpp"
#if defined(PXX2) #if defined(PXX2)
@@ -365,19 +387,27 @@ void onBluetoothConnectMenu(const char * result)
#define EXTERNAL_MODULE_ROWS #define EXTERNAL_MODULE_ROWS
#endif #endif
#if defined(PCBTARANIS)
#define WARN_ROWS \
SW_WARN_ROWS, /* Switch warning */ \
POT_WARN_ROWS, /* Pot warning */
#else
#define WARN_ROWS \
NUM_SWITCHES - 1, /* Switch warning */
#endif
void menuModelSetup(event_t event) void menuModelSetup(event_t event)
{ {
int8_t old_editMode = s_editMode; int8_t old_editMode = s_editMode;
#if defined(PCBTARANIS) #if defined(PCBTARANIS)
int8_t old_posHorz = menuHorizontalPosition; int8_t old_posHorz = menuHorizontalPosition;
#endif
MENU_TAB({ MENU_TAB({
HEADER_LINE_COLUMNS HEADER_LINE_COLUMNS
0, 0,
TIMER_ROWS, TIMERS_ROWS,
TIMER_ROWS,
TIMER_ROWS,
0, // Extended limits 0, // Extended limits
1, // Extended trims 1, // Extended trims
0, // Show trims 0, // Show trims
@@ -390,8 +420,7 @@ void menuModelSetup(event_t event)
LABEL(PreflightCheck), LABEL(PreflightCheck),
0, // Checklist 0, // Checklist
0, // Throttle warning 0, // Throttle warning
SW_WARN_ROWS, // Switch warning WARN_ROWS
POT_WARN_ROWS, // Pot warning
NUM_STICKS + NUM_POTS + NUM_SLIDERS - 1, // Center beeps NUM_STICKS + NUM_POTS + NUM_SLIDERS - 1, // Center beeps
0, // Global functions 0, // Global functions
@@ -402,56 +431,12 @@ void menuModelSetup(event_t event)
EXTERNAL_MODULE_ROWS EXTERNAL_MODULE_ROWS
TRAINER_ROWS OUTPUT_TYPE_ROW
});
#else
MENU_TAB({
HEADER_LINE_COLUMNS
0,
TIMER_ROWS,
TIMER_ROWS,
TIMER_ROWS,
0, // Extended limits
1, // Extended trims
0, // Show trims
0, // Trims step
0, // Throttle reverse
0, // Throttle trace source
0, // Throttle trim
0, // Throttle trim switch
LABEL(PreflightCheck),
0, // Checklist
0, // Throttle warning
NUM_SWITCHES-1, // Switch warning
NUM_STICKS+NUM_POTS+NUM_SLIDERS-1, // Center beeps
0, // Global functions
LABEL(ExternalModule),
MODULE_TYPE_ROWS(EXTERNAL_MODULE),
MULTIMODULE_TYPE_ROWS(EXTERNAL_MODULE)
MULTIMODULE_SUBTYPE_ROWS(EXTERNAL_MODULE)
MULTIMODULE_STATUS_ROWS(EXTERNAL_MODULE)
MODULE_CHANNELS_ROWS(EXTERNAL_MODULE),
IF_NOT_ACCESS_MODULE_RF(EXTERNAL_MODULE, MODULE_BIND_ROWS(EXTERNAL_MODULE)), // line reused for PPM: PPM settings
IF_ACCESS_MODULE_RF(EXTERNAL_MODULE, 0), // RxNum
0, // Output type (OpenDrain / PushPull)
MODULE_POWER_ROW(EXTERNAL_MODULE),
IF_NOT_PXX2_MODULE(EXTERNAL_MODULE, MODULE_OPTION_ROW(EXTERNAL_MODULE)),
MULTIMODULE_MODULE_ROWS(EXTERNAL_MODULE)
FAILSAFE_ROWS(EXTERNAL_MODULE),
IF_ACCESS_MODULE_RF(EXTERNAL_MODULE, 1), // Range check and Register buttons
IF_PXX2_MODULE(EXTERNAL_MODULE, 0), // Module options
IF_ACCESS_MODULE_RF(EXTERNAL_MODULE, 0), // Receiver 1
IF_ACCESS_MODULE_RF(EXTERNAL_MODULE, 0), // Receiver 2
IF_ACCESS_MODULE_RF(EXTERNAL_MODULE, 0), // Receiver 3
EXTRA_MODULE_ROWS EXTRA_MODULE_ROWS
TRAINER_ROWS TRAINER_ROWS
}); });
#endif
MENU_CHECK(menuTabModel, MENU_MODEL_SETUP, HEADER_LINE + ITEM_MODEL_SETUP_LINES_COUNT); MENU_CHECK(menuTabModel, MENU_MODEL_SETUP, HEADER_LINE + ITEM_MODEL_SETUP_LINES_COUNT);
title(STR_MENUSETUP); title(STR_MENUSETUP);
@@ -489,7 +474,7 @@ void menuModelSetup(event_t event)
} }
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k); uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
LcdFlags blink = ((s_editMode>0) ? BLINK|INVERS : INVERS); LcdFlags blink = ((s_editMode > 0) ? BLINK|INVERS : INVERS);
LcdFlags attr = (sub == k ? blink : 0); LcdFlags attr = (sub == k ? blink : 0);
switch (k) { switch (k) {
@@ -520,7 +505,7 @@ void menuModelSetup(event_t event)
timerMode += TMRMODE_COUNT-1; timerMode += TMRMODE_COUNT-1;
timer->mode = timerMode; timer->mode = timerMode;
#if defined(AUTOSWITCH) #if defined(AUTOSWITCH)
if (s_editMode>0) { if (s_editMode > 0) {
int8_t val = timer->mode - (TMRMODE_COUNT-1); int8_t val = timer->mode - (TMRMODE_COUNT-1);
int8_t switchVal = checkIncDecMovedSwitch(val); int8_t switchVal = checkIncDecMovedSwitch(val);
if (val != switchVal) { if (val != switchVal) {
@@ -568,8 +553,7 @@ void menuModelSetup(event_t event)
case ITEM_MODEL_SETUP_TIMER2_COUNTDOWN_BEEP: case ITEM_MODEL_SETUP_TIMER2_COUNTDOWN_BEEP:
case ITEM_MODEL_SETUP_TIMER3_COUNTDOWN_BEEP: case ITEM_MODEL_SETUP_TIMER3_COUNTDOWN_BEEP:
{ {
TimerData * timer = &g_model.timers[k>=ITEM_MODEL_SETUP_TIMER3 ? 2 : (k>=ITEM_MODEL_SETUP_TIMER2 ? 1 : 0)]; editTimerCountdown(k>=ITEM_MODEL_SETUP_TIMER3 ? 2 : (k>=ITEM_MODEL_SETUP_TIMER2 ? 1 : 0), y, attr, event);
timer->countdownBeep = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, timer->countdownBeep, COUNTDOWN_SILENT, COUNTDOWN_COUNT-1, attr, event);
break; break;
} }
+1 -1
View File
@@ -126,7 +126,7 @@ void onHardwareAntennaSwitchConfirm(const char * result)
#define EXTERNAL_ANTENNA_ROW #define EXTERNAL_ANTENNA_ROW
#endif #endif
#if (defined(CROSSFIRE) || defined(GHOST)) #if (defined(CROSSFIRE) || defined(GHOST)) && (SPORT_MAX_BAUDRATE < 400000 || defined(DEBUG))
#define MAX_BAUDRATE_ROW 0 #define MAX_BAUDRATE_ROW 0
#else #else
#define MAX_BAUDRATE_ROW HIDDEN_ROW #define MAX_BAUDRATE_ROW HIDDEN_ROW
@@ -284,7 +284,7 @@ enum {
#define TX_CAPACITY_MEASUREMENT_ROWS #define TX_CAPACITY_MEASUREMENT_ROWS
#endif #endif
#if (defined(CROSSFIRE) || defined(GHOST)) && SPORT_MAX_BAUDRATE < 400000 #if (defined(CROSSFIRE) || defined(GHOST)) && (SPORT_MAX_BAUDRATE < 400000 || defined(DEBUG))
#define MAX_BAUD_ROWS 0, #define MAX_BAUD_ROWS 0,
#else #else
#define MAX_BAUD_ROWS #define MAX_BAUD_ROWS
+1
View File
@@ -24,6 +24,7 @@ if(PYTHONINTERP_FOUND)
add_lua_export_target(xlite ${LUA_INCLUDES} -DPCBTARANIS -DPCBXLITE) add_lua_export_target(xlite ${LUA_INCLUDES} -DPCBTARANIS -DPCBXLITE)
add_lua_export_target(xlites ${LUA_INCLUDES} -DPCBTARANIS -DPCBXLITES -DPCBXLITE -DGYRO) add_lua_export_target(xlites ${LUA_INCLUDES} -DPCBTARANIS -DPCBXLITES -DPCBXLITE -DGYRO)
add_lua_export_target(x9d ${LUA_INCLUDES} -DPCBTARANIS -DPCBX9D -DPCBX9) add_lua_export_target(x9d ${LUA_INCLUDES} -DPCBTARANIS -DPCBX9D -DPCBX9)
add_lua_export_target(x9d+2019 ${LUA_INCLUDES} -DPCBTARANIS -DPCBX9D -DPCBX9 -DRADIO_X9DP2019)
add_lua_export_target(x9e ${LUA_INCLUDES} -DPCBTARANIS -DPCBX9E -DPCBX9) add_lua_export_target(x9e ${LUA_INCLUDES} -DPCBTARANIS -DPCBX9E -DPCBX9)
add_lua_export_target(x10 ${LUA_INCLUDES} -DPCBHORUS -DPCBX10) add_lua_export_target(x10 ${LUA_INCLUDES} -DPCBHORUS -DPCBX10)
add_lua_export_target(x12s ${LUA_INCLUDES} -DPCBHORUS -DPCBX12S) add_lua_export_target(x12s ${LUA_INCLUDES} -DPCBHORUS -DPCBX12S)
+2
View File
@@ -54,6 +54,8 @@
#include "lua/lua_exports_xlites.inc" #include "lua/lua_exports_xlites.inc"
#elif defined(PCBXLITE) #elif defined(PCBXLITE)
#include "lua/lua_exports_xlite.inc" #include "lua/lua_exports_xlite.inc"
#elif defined(RADIO_X9DP2019)
#include "lua/lua_exports_x9d+2019.inc"
#elif defined(PCBTARANIS) #elif defined(PCBTARANIS)
#include "lua/lua_exports_x9d.inc" #include "lua/lua_exports_x9d.inc"
#endif #endif
+3 -3
View File
@@ -108,15 +108,15 @@ static void sendFailsafeChannels(uint8_t moduleIdx)
int16_t failsafeValue = g_model.failsafeChannels[i]; int16_t failsafeValue = g_model.failsafeChannels[i];
int pulseValue; int pulseValue;
if (g_model.moduleData[moduleIdx].failsafeMode == FAILSAFE_HOLD) { if (g_model.moduleData[moduleIdx].failsafeMode == FAILSAFE_HOLD || failsafeValue == FAILSAFE_CHANNEL_HOLD) {
pulseValue = 2047; pulseValue = 2047;
} }
else if (g_model.moduleData[moduleIdx].failsafeMode == FAILSAFE_NOPULSES) { else if (g_model.moduleData[moduleIdx].failsafeMode == FAILSAFE_NOPULSES || failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
pulseValue = 0; pulseValue = 0;
} }
else { else {
failsafeValue += 2 * PPM_CH_CENTER(g_model.moduleData[moduleIdx].channelsStart + i) - 2 * PPM_CENTER; failsafeValue += 2 * PPM_CH_CENTER(g_model.moduleData[moduleIdx].channelsStart + i) - 2 * PPM_CENTER;
pulseValue = limit(1, (failsafeValue * 800 / 1000) + 1024, 2047); pulseValue = limit(1, (failsafeValue * 800 / 1000) + 1024, 2046);
} }
bits |= pulseValue << bitsavailable; bits |= pulseValue << bitsavailable;
+16
View File
@@ -533,6 +533,14 @@ bool setupPulsesInternalModule(uint8_t protocol)
} }
} }
void stopPulsesInternalModule()
{
if (moduleState[INTERNAL_MODULE].protocol != PROTOCOL_CHANNELS_UNINITIALIZED) {
intmoduleStop();
moduleState[INTERNAL_MODULE].protocol = PROTOCOL_CHANNELS_NONE;
}
}
bool setupPulsesInternalModule() bool setupPulsesInternalModule()
{ {
uint8_t protocol = getRequiredProtocol(INTERNAL_MODULE); uint8_t protocol = getRequiredProtocol(INTERNAL_MODULE);
@@ -551,6 +559,14 @@ bool setupPulsesInternalModule()
} }
#endif #endif
void stopPulsesExternalModule()
{
if (moduleState[EXTERNAL_MODULE].protocol != PROTOCOL_CHANNELS_UNINITIALIZED) {
extmoduleStop();
moduleState[EXTERNAL_MODULE].protocol = PROTOCOL_CHANNELS_NONE;
}
}
bool setupPulsesExternalModule() bool setupPulsesExternalModule()
{ {
uint8_t protocol = getRequiredProtocol(EXTERNAL_MODULE); uint8_t protocol = getRequiredProtocol(EXTERNAL_MODULE);
+6
View File
@@ -314,8 +314,12 @@ extern TrainerPulsesData trainerPulsesData;
#if defined(HARDWARE_INTERNAL_MODULE) #if defined(HARDWARE_INTERNAL_MODULE)
bool setupPulsesInternalModule(); bool setupPulsesInternalModule();
void stopPulsesInternalModule();
#endif #endif
#if defined(HARDWARE_EXTERNAL_MODULE)
bool setupPulsesExternalModule(); bool setupPulsesExternalModule();
void stopPulsesExternalModule();
#endif
void setupPulsesDSM2(); void setupPulsesDSM2();
void setupPulsesCrossfire(); void setupPulsesCrossfire();
void setupPulsesGhost(); void setupPulsesGhost();
@@ -352,7 +356,9 @@ inline void startPulses()
setupPulsesInternalModule(); setupPulsesInternalModule();
#endif #endif
#if defined(HARDWARE_EXTERNAL_MODULE)
setupPulsesExternalModule(); setupPulsesExternalModule();
#endif
#if defined(HARDWARE_EXTRA_MODULE) #if defined(HARDWARE_EXTRA_MODULE)
extramodulePpmStart(); extramodulePpmStart();
+4 -4
View File
@@ -53,11 +53,11 @@ void preModelLoad()
} }
pauseMixerCalculations(); pauseMixerCalculations();
#if defined(INTMODULE_PWR_GPIO) #if defined(HARDWARE_INTERNAL_MODULE)
INTERNAL_MODULE_OFF(); stopPulsesInternalModule();
#endif #endif
#if defined(EXTMODULE_PWR_GPIO) #if defined(HARDWARE_EXTERNAL_MODULE)
EXTERNAL_MODULE_OFF(); stopPulsesExternalModule();
#endif #endif
stopTrainer(); stopTrainer();
@@ -21,10 +21,6 @@
#include "opentx.h" #include "opentx.h"
#include "targets/horus/board.h" #include "targets/horus/board.h"
#if defined(SBUS)
extern Fifo<uint8_t, 32> trainerSbusFifo;
#endif
#if defined(AUX_SERIAL) #if defined(AUX_SERIAL)
uint8_t auxSerialMode = UART_MODE_COUNT; // Prevent debug output before port is setup uint8_t auxSerialMode = UART_MODE_COUNT; // Prevent debug output before port is setup
Fifo<uint8_t, 512> auxSerialTxFifo; Fifo<uint8_t, 512> auxSerialTxFifo;
+5
View File
@@ -21,6 +21,7 @@ set(RTC_BACKUP_RAM YES)
set(PPM_LIMITS_SYMETRICAL YES) set(PPM_LIMITS_SYMETRICAL YES)
set(USB_SERIAL ON CACHE BOOL "Enable USB serial (CDC)") set(USB_SERIAL ON CACHE BOOL "Enable USB serial (CDC)")
set(ROTARY_ENCODER YES) set(ROTARY_ENCODER YES)
set(EXTERNAL_MODULE YES)
# for size report script # for size report script
set(CPU_TYPE_FULL STM32F429xI) set(CPU_TYPE_FULL STM32F429xI)
@@ -173,6 +174,10 @@ if(INTERNAL_MODULE_MULTI)
add_definitions(-DINTERNAL_MODULE_MULTI) add_definitions(-DINTERNAL_MODULE_MULTI)
endif() endif()
if(EXTERNAL_MODULE)
add_definitions(-DHARDWARE_EXTERNAL_MODULE)
endif()
include_directories(${RADIO_SRC_DIRECTORY}/fonts/480x272 gui/${GUI_DIR} gui/${GUI_DIR}/layouts) include_directories(${RADIO_SRC_DIRECTORY}/fonts/480x272 gui/${GUI_DIR} gui/${GUI_DIR}/layouts)
file(GLOB THEMES_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/480x272 ${RADIO_SRC_DIRECTORY}/gui/480x272/themes/*.cpp) file(GLOB THEMES_SRC RELATIVE ${RADIO_SRC_DIRECTORY}/gui/480x272 ${RADIO_SRC_DIRECTORY}/gui/480x272/themes/*.cpp)
@@ -20,10 +20,6 @@
#include "opentx.h" #include "opentx.h"
#if defined(SBUS_TRAINER)
Fifo<uint8_t, 32> trainerSbusFifo;
#endif
void trainerSendNextFrame(); void trainerSendNextFrame();
void init_trainer_ppm() void init_trainer_ppm()
+1 -11
View File
@@ -213,17 +213,7 @@ void OpenTxSimulator::setTrim(unsigned int idx, int value)
if (i < 4) // swap axes if (i < 4) // swap axes
i = modn12x3[4 * getStickMode() + idx]; i = modn12x3[4 * getStickMode() + idx];
uint8_t phase = getTrimFlightMode(getFlightMode(), i); uint8_t phase = getTrimFlightMode(getFlightMode(), i);
setTrimValue(phase, i, value);
if (!setTrimValue(phase, i, value)) {
QTimer *timer = new QTimer(this);
timer->setSingleShot(true);
connect(timer, &QTimer::timeout, [=]() {
emit trimValueChange(idx, 0);
emit outputValueChange(OUTPUT_SRC_TRIM_VALUE, idx, 0);
timer->deleteLater();
});
timer->start(350);
}
} }
void OpenTxSimulator::setTrainerInput(unsigned int inputNumber, int16_t value) void OpenTxSimulator::setTrainerInput(unsigned int inputNumber, int16_t value)
+1
View File
@@ -63,6 +63,7 @@ elseif(PCB STREQUAL X9D+)
option(INTERNAL_MODULE_PXX1 "Support for PXX1 internal module" OFF) option(INTERNAL_MODULE_PXX1 "Support for PXX1 internal module" OFF)
option(INTERNAL_MODULE_PXX2 "Support for PXX2 internal module" ON) option(INTERNAL_MODULE_PXX2 "Support for PXX2 internal module" ON)
set(FLAVOUR x9d+2019) set(FLAVOUR x9d+2019)
set(LUA_EXPORT lua_export_x9d+2019)
set(CPU_TYPE STM32F4) set(CPU_TYPE STM32F4)
set(CPU_TYPE_FULL STM32F407xE) # for size report set(CPU_TYPE_FULL STM32F407xE) # for size report
set(LINKER_SCRIPT targets/taranis/stm32f4_flash.ld) set(LINKER_SCRIPT targets/taranis/stm32f4_flash.ld)
-10
View File
@@ -33,16 +33,6 @@ RTOS_DEFINE_STACK(audioStack, AUDIO_STACK_SIZE);
RTOS_MUTEX_HANDLE audioMutex; RTOS_MUTEX_HANDLE audioMutex;
RTOS_MUTEX_HANDLE mixerMutex; RTOS_MUTEX_HANDLE mixerMutex;
enum TaskIndex {
MENU_TASK_INDEX,
MIXER_TASK_INDEX,
AUDIO_TASK_INDEX,
CLI_TASK_INDEX,
BLUETOOTH_TASK_INDEX,
TASK_INDEX_COUNT,
MAIN_TASK_INDEX = 255
};
void stackPaint() void stackPaint()
{ {
menusStack.paint(); menusStack.paint();
+1 -1
View File
@@ -102,7 +102,7 @@ const uint8_t CROSSFIRE_PERIODS[] = {
4, 4,
16, 16,
}; };
#if SPORT_MAX_BAUDRATE < 400000 #if SPORT_MAX_BAUDRATE < 400000 || defined(DEBUG)
#define CROSSFIRE_BAUDRATE CROSSFIRE_BAUDRATES[g_eeGeneral.telemetryBaudrate] #define CROSSFIRE_BAUDRATE CROSSFIRE_BAUDRATES[g_eeGeneral.telemetryBaudrate]
#define CROSSFIRE_PERIOD (CROSSFIRE_PERIODS[g_eeGeneral.telemetryBaudrate]*1000) #define CROSSFIRE_PERIOD (CROSSFIRE_PERIODS[g_eeGeneral.telemetryBaudrate]*1000)
#else #else
+5
View File
@@ -138,6 +138,11 @@ def main():
cmake_options["PCB"] = "X12S" cmake_options["PCB"] = "X12S"
firmware_options = options_horus_x12s firmware_options = options_horus_x12s
maxsize = 2 * 1024 * 1024 maxsize = 2 * 1024 * 1024
elif board_name == "tlite":
cmake_options["PCB"] = "X7"
cmake_options["PCBREV"] = "TLITE"
firmware_options = options_jumper_tlite
maxsize = 65536 * 8
elif board_name == "t12": elif board_name == "t12":
cmake_options["PCB"] = "X7" cmake_options["PCB"] = "X7"
cmake_options["PCBREV"] = "T12" cmake_options["PCBREV"] = "T12"
+13
View File
@@ -207,6 +207,18 @@ options_horus_x10express = {
"flexr9m": ("MODULE_PROTOCOL_FLEX", "YES", None), "flexr9m": ("MODULE_PROTOCOL_FLEX", "YES", None),
} }
options_jumper_tlite = {
"noheli": ("HELI", "NO", "YES"),
"ppmus": ("PPM_UNIT", "US", "PERCENT_PREC1"),
"lua": ("LUA", "YES", "NO_MODEL_SCRIPTS"),
"nogvars": ("GVARS", "NO", "YES"),
"faimode": ("FAI", "YES", None),
"faichoice": ("FAI", "CHOICE", None),
"nooverridech": ("OVERRIDE_CHANNEL_FUNCTION", "NO", "YES"),
"flexr9m": ("MODULE_PROTOCOL_FLEX", "YES", None),
}
options_jumper_t12 = { options_jumper_t12 = {
"noheli": ("HELI", "NO", "YES"), "noheli": ("HELI", "NO", "YES"),
"ppmus": ("PPM_UNIT", "US", "PERCENT_PREC1"), "ppmus": ("PPM_UNIT", "US", "PERCENT_PREC1"),
@@ -244,6 +256,7 @@ options_jumper_t18 = {
"nooverridech": ("OVERRIDE_CHANNEL_FUNCTION", "NO", "YES"), "nooverridech": ("OVERRIDE_CHANNEL_FUNCTION", "NO", "YES"),
"flexr9m": ("MODULE_PROTOCOL_FLEX", "YES", None), "flexr9m": ("MODULE_PROTOCOL_FLEX", "YES", None),
"bluetooth": ("BLUETOOTH", "YES", "NO"), "bluetooth": ("BLUETOOTH", "YES", "NO"),
"externalaccessmod": ("HARDWARE_EXTERNAL_ACCESS_MOD", "YES", "NO"),
} }
options_radiomaster_tx12 = { options_radiomaster_tx12 = {