Merge branch 'next' of https://github.com/opentx/opentx into kilrah/standalone_simu_dialog

This commit is contained in:
Andre Bernet
2014-03-17 22:16:34 +01:00
106 changed files with 6658 additions and 920 deletions
+9 -1
View File
@@ -36,7 +36,7 @@ ELSE()
MESSAGE( "SDL not found! Joysticks support will be disabled" )
ENDIF()
FIND_PACKAGE( Qt4 REQUIRED )
FIND_PACKAGE(Qt4 4.8.4 REQUIRED)
SET( QT_USE_QTNETWORK True )
SET( QT_USE_QTXML True )
INCLUDE( ${QT_USE_FILE} )
@@ -90,6 +90,13 @@ add_custom_command(
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
)
add_custom_command(
OUTPUT ${RADIO_SRC_DIRECTORY}/stamp-opentx.h
COMMAND make stamp_header
DEPENDS ${RADIO_SRC_DIRECTORY}/Makefile
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/../..
@@ -128,6 +135,7 @@ set(companion_SRCS
firmwares/opentx/opentxsimulator.cpp
firmwares/ersky9x/ersky9xeeprom.cpp
firmwares/ersky9x/ersky9xinterface.cpp
${RADIO_SRC_DIRECTORY}/stamp-opentx.h
${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm
${RADIO_SRC_DIRECTORY}/translations/en.h
appdata.cpp
+1
View File
@@ -15,6 +15,7 @@ burnConfigDialog::burnConfigDialog(QWidget *parent) :
ui(new Ui::burnConfigDialog)
{
ui->setupUi(this);
setWindowIcon(CompanionIcon("configure.png"));
ui->avrdude_programmer->model()->sort(0);
getSettings();
+1
View File
@@ -18,6 +18,7 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
hexType(Type)
{
ui->setupUi(this);
setWindowIcon(CompanionIcon("write_flash.png"));
if(!g.profile[g.id()].splashFile().isEmpty()){
imageSource=PROFILE;
+1 -1
View File
@@ -142,7 +142,7 @@ customizeSplashDialog::customizeSplashDialog(QWidget *parent) :
ui(new Ui::customizeSplashDialog)
{
ui->setupUi(this);
this->setWindowIcon(CompanionIcon("paint.png"));
setWindowIcon(CompanionIcon("paintbrush.png"));
ui->leftLibraryButton->setIcon(CompanionIcon("library.png"));
ui->rightLibraryButton->setIcon(CompanionIcon("library.png"));
+13 -3
View File
@@ -126,11 +126,14 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.max = singleprec ? 1540 : 3000;
break;
case TELEMETRY_SOURCE_T1:
case TELEMETRY_SOURCE_T1_MAX:
case TELEMETRY_SOURCE_T2:
case TELEMETRY_SOURCE_T2_MAX:
result.min = -30;
result.max = 225;
break;
case TELEMETRY_SOURCE_RPM:
case TELEMETRY_SOURCE_RPM_MAX:
result.step = singleprec ? 50 : 1;
result.max = singleprec ? 12750 : 20000;
break;
@@ -138,6 +141,7 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.max = 100;
break;
case TELEMETRY_SOURCE_SPEED:
case TELEMETRY_SOURCE_SPEED_MAX:
result.step = singleprec ? 4 : 1;
result.max = singleprec ? 944 : 2000;
if (model && !model->frsky.imperial) {
@@ -146,21 +150,26 @@ RawSourceRange RawSource::getRange(bool singleprec)
}
break;
case TELEMETRY_SOURCE_DIST:
case TELEMETRY_SOURCE_DIST_MAX:
result.step = singleprec ? 8 : 1;
result.max = singleprec ? 2040 : 10000;
break;
case TELEMETRY_SOURCE_CELL:
case TELEMETRY_SOURCE_CELL_MIN:
result.step = singleprec ? 0.02 : 0.01;
result.max = 5.1;
result.decimals = 2;
break;
case TELEMETRY_SOURCE_CELLS_SUM:
case TELEMETRY_SOURCE_CELLS_MIN:
case TELEMETRY_SOURCE_VFAS:
case TELEMETRY_SOURCE_VFAS_MIN:
result.step = 0.1;
result.max = 25.5;
result.decimals = 1;
break;
case TELEMETRY_SOURCE_CURRENT:
case TELEMETRY_SOURCE_CURRENT_MAX:
result.step = singleprec ? 0.5 : 0.1;
result.max = singleprec ? 127.5 : 200.0;
result.decimals = 1;
@@ -170,6 +179,7 @@ RawSourceRange RawSource::getRange(bool singleprec)
result.max = singleprec ? 5100 : 10000;
break;
case TELEMETRY_SOURCE_POWER:
case TELEMETRY_SOURCE_POWER_MAX:
result.step = singleprec ? 5 : 1;
result.max = singleprec ? 1275 : 2000;
break;
@@ -221,12 +231,12 @@ QString RawSource::toString()
QObject::tr("A1"), QObject::tr("A2"), QObject::tr("A3"), QObject::tr("A4"),
QObject::tr("Alt"), QObject::tr("Rpm"), QObject::tr("Fuel"), QObject::tr("T1"), QObject::tr("T2"),
QObject::tr("Speed"), QObject::tr("Dist"), QObject::tr("GPS Alt"),
QObject::tr("Cell"), QObject::tr("Cels"), QObject::tr("Vfas"), QObject::tr("Curr"), QObject::tr("Cnsp"), QObject::tr("Powr"),
QObject::tr("Cell"), QObject::tr("Cells"), QObject::tr("Vfas"), QObject::tr("Curr"), QObject::tr("Cnsp"), QObject::tr("Powr"),
QObject::tr("AccX"), QObject::tr("AccY"), QObject::tr("AccZ"),
QObject::tr("HDG "), QObject::tr("VSpd"), QObject::tr("ASpd"), QObject::tr("dTE"),
QObject::tr("A1-"), QObject::tr("A2-"), QObject::tr("A3-"), QObject::tr("A4-"),
QObject::tr("Alt-"), QObject::tr("Alt+"), QObject::tr("Rpm+"), QObject::tr("T1+"), QObject::tr("T2+"), QObject::tr("Spd+"), QObject::tr("Dst+"),
QObject::tr("Cel-"), QObject::tr("Cels-"), QObject::tr("Vfs-"), QObject::tr("Cur+"), QObject::tr("Pwr+"),
QObject::tr("Alt-"), QObject::tr("Alt+"), QObject::tr("Rpm+"), QObject::tr("T1+"), QObject::tr("T2+"), QObject::tr("Speed+"), QObject::tr("Dist+"),
QObject::tr("Cell-"), QObject::tr("Cells-"), QObject::tr("Vfas-"), QObject::tr("Curr+"), QObject::tr("Powr+"),
QObject::tr("ACC"), QObject::tr("Time"),
};
+1
View File
@@ -217,6 +217,7 @@ enum TelemetrySource {
TELEMETRY_SOURCE_CELL_MIN,
TELEMETRY_SOURCE_CELLS_MIN,
TELEMETRY_SOURCE_VFAS_MIN,
TELEMETRY_SOURCE_CURRENT_MAX,
TELEMETRY_SOURCE_POWER_MAX,
TELEMETRY_SOURCE_ACC,
TELEMETRY_SOURCE_GPS_TIME,
@@ -74,6 +74,7 @@ namespace Open9xGruvin9x {
#include "radio/src/simpgmspace.cpp"
#include "radio/src/templates.cpp"
#include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/audio_avr.cpp"
#include "radio/src/buzzer.cpp"
#include "radio/src/targets/gruvin9x/somo14d.cpp"
@@ -73,6 +73,7 @@ namespace Open9xM128 {
#include "radio/src/simpgmspace.cpp"
#include "radio/src/templates.cpp"
#include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/audio_avr.cpp"
#include "radio/src/targets/stock/voice.cpp"
#include "radio/src/telemetry/frsky.cpp"
@@ -91,6 +91,7 @@ namespace Open9xSky9x {
#include "radio/src/simpgmspace.cpp"
#include "radio/src/templates.cpp"
#include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/telemetry/frsky.cpp"
#include "radio/src/targets/sky9x/audio_driver.cpp"
#include "radio/src/audio_arm.cpp"
@@ -73,7 +73,7 @@ inline int geteepromsize() {
#include "radio/src/protocols/ppm_arm.cpp"
#include "radio/src/protocols/pxx_arm.cpp"
#include "radio/src/protocols/dsm2_arm.cpp"
#include "radio/src/targets/taranis/pwr_driver.cpp"
#include "radio/src/targets/taranis/pwr_driver.c"
#include "radio/src/eeprom_common.cpp"
#include "radio/src/eeprom_conversions.cpp"
#include "radio/src/eeprom_rlc.cpp"
@@ -106,6 +106,7 @@ inline int geteepromsize() {
#define SDCARD
#include "radio/src/templates.cpp"
#include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/telemetry/frsky_sport.cpp"
#include "radio/src/targets/taranis/audio_driver.cpp"
#include "radio/src/audio_arm.cpp"
@@ -384,8 +384,12 @@ class TelemetrySourcesConversionTable: public ConversionTable {
addConversion(1+TELEMETRY_SOURCE_T2_MAX, val++);
addConversion(1+TELEMETRY_SOURCE_SPEED_MAX, val++);
addConversion(1+TELEMETRY_SOURCE_DIST_MAX, val++);
addConversion(1+TELEMETRY_SOURCE_CELL_MIN, val++);
addConversion(1+TELEMETRY_SOURCE_VFAS_MIN, val++);
if (version >= 216) {
addConversion(1+TELEMETRY_SOURCE_CELL_MIN, val++);
addConversion(1+TELEMETRY_SOURCE_CELLS_MIN, val++);
addConversion(1+TELEMETRY_SOURCE_VFAS_MIN, val++);
}
addConversion(1+TELEMETRY_SOURCE_CURRENT_MAX, val++);
addConversion(1+TELEMETRY_SOURCE_POWER_MAX, val++);
if (IS_ARM(board) && version >= 216) {
for (int i=0; i<5; i++)
@@ -1008,9 +1012,15 @@ class InputField: public TransformedField {
virtual void afterImport()
{
if (IS_TARANIS(board) && version < 216) {
if (expo.mode) {
expo.srcRaw = RawSource(SOURCE_TYPE_STICK, expo.chn);
if (IS_TARANIS(board)) {
if (version < 216) {
if (expo.mode) {
expo.srcRaw = RawSource(SOURCE_TYPE_STICK, expo.chn);
}
}
else {
if (expo.srcRaw.type != SOURCE_TYPE_NONE)
expo.mode = 3;
}
}
@@ -80,6 +80,7 @@ namespace Open9x {
#include "radio/src/telemetry/frsky.cpp"
#include "radio/src/templates.cpp"
#include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/targets/stock/voice.cpp"
#include "radio/src/buzzer.cpp"
#include "radio/src/translations/tts_en.cpp"
-25
View File
@@ -95,31 +95,6 @@ void populateRotEncCB(QComboBox *b, int value, int renumber)
b->setCurrentIndex(value);
}
void populateCustomScreenFieldCB(QComboBox *b, unsigned int value, bool last=false, int hubproto=0)
{
int telem_hub[] = {0,0,0,0,0,0,0,0,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,0,0,2,2,1,1,1,1,1,1};
b->clear();
b->addItem(RawSource(SOURCE_TYPE_NONE, 0).toString());
for (unsigned int i = 0; i <= (last ? TELEMETRY_SOURCES_DISPLAY_COUNT : TELEMETRY_SOURCES_STATUS_COUNT); i++) {
b->addItem(RawSource(SOURCE_TYPE_TELEMETRY, i).toString());
if (!(i>=sizeof(telem_hub)/sizeof(int) || telem_hub[i]==0 || ((telem_hub[i]>=hubproto) && hubproto!=0))) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
}
}
if (value>=sizeof(telem_hub)/sizeof(int))
b->setCurrentIndex(0);
else if (telem_hub[value]==0 || ((telem_hub[value]>=hubproto) && hubproto!=0)) {
b->setCurrentIndex(value);
}
b->setMaxVisibleItems(10);
}
QString getProtocolStr(const int proto)
{
static const char *strings[] = { "OFF",
-1
View File
@@ -88,7 +88,6 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr=
void populatePhasesCB(QComboBox *b, int value);
void populateGvarUseCB(QComboBox *b, unsigned int phase);
void populateCustomScreenFieldCB(QComboBox *b, unsigned int value, bool last, int hubproto);
QString getProtocolStr(const int proto);
QString getPhasesStr(unsigned int phases, ModelData & model);
+5 -4
View File
@@ -3,11 +3,12 @@
#include "eeprominterface.h"
#include "helpers.h"
ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, int stickMode) :
ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, int stickMode, char * inputName) :
QDialog(parent),
ui(new Ui::ExpoDialog),
model(model),
ed(expoData)
ed(expoData),
inputName(inputName)
{
ui->setupUi(this);
QLabel * lb_fp[] = {ui->lb_FP0,ui->lb_FP1,ui->lb_FP2,ui->lb_FP3,ui->lb_FP4,ui->lb_FP5,ui->lb_FP6,ui->lb_FP7,ui->lb_FP8 };
@@ -76,7 +77,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i
}
ui->inputName->setValidator(new QRegExpValidator(rx, this));
ui->inputName->setText(model.inputNames[ed->chn]);
ui->inputName->setText(inputName);
ui->lineName->setValidator(new QRegExpValidator(rx, this));
ui->lineName->setText(ed->name);
@@ -139,7 +140,7 @@ void ExpoDialog::valuesChanged()
ed->mode = ui->sideCB->currentIndex() + 1;
strcpy(ed->name, ui->lineName->text().toAscii().data());
strcpy(model.inputNames[ed->chn], ui->inputName->text().toAscii().data());
strcpy(inputName, ui->inputName->text().toAscii().data());
ed->phases=0;
for (int i=8; i>=0 ; i--) {
+2 -1
View File
@@ -14,7 +14,7 @@ namespace Ui {
class ExpoDialog : public QDialog {
Q_OBJECT
public:
ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expodata, int stickMode);
ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expodata, int stickMode, char * inputName);
~ExpoDialog();
protected:
@@ -28,6 +28,7 @@ class ExpoDialog : public QDialog {
Ui::ExpoDialog * ui;
ModelData & model;
ExpoData * ed;
char * inputName;
GVarGroup * gvGroup;
CurveGroup * curveGroup;
};
+23 -45
View File
@@ -194,33 +194,29 @@ void FlightMode::update()
for (int i=0; i<gvCount; i++) {
gvNames[i]->setText(model.gvars_names[i]);
if (phase.gvars[i] < 1024) {
gvValues[i]->setValue(phase.gvars[i]);
gvValues[i]->setDisabled(false);
}
else {
int idx = phase.gvars[i] - 1025;
if (idx >= i) idx++;
// TODO no!!!!
PhaseData *phasegvar = &model.phaseData[idx];
gvValues[i]->setValue(phasegvar->gvars[i]);
gvValues[i]->setDisabled(true);
gvValues[i]->setDisabled(false);
int idx = phase.gvars[i];
PhaseData *phasegvar = &phase;
while (idx >= 1024) {
idx -= 1025;
phasegvar = &model.phaseData[idx];
idx = phasegvar->gvars[i];
gvValues[i]->setDisabled(true);
}
gvValues[i]->setValue(phasegvar->gvars[i]);
}
for (int i=0; i<reCount; i++) {
if (phase.rotaryEncoders[i] < 1024) {
reValues[i]->setValue(phase.rotaryEncoders[i]);
reValues[i]->setDisabled(false);
}
else {
int idx = phase.rotaryEncoders[i] - 1025;
if (idx >= i) idx++;
// TODO no!!!!
PhaseData *phasere = &model.phaseData[idx];
reValues[i]->setValue(phasere->rotaryEncoders[i]);
for (int i=0; i<reCount; i++) {
reValues[i]->setDisabled(false);
int idx = phase.rotaryEncoders[i];
PhaseData *phasere = &phase;
while (idx >= 1024) {
idx -= 1025;
phasere = &model.phaseData[idx];
idx = phasere->rotaryEncoders[i];
reValues[i]->setDisabled(true);
}
reValues[i]->setValue(phasere->rotaryEncoders[i]);
}
}
@@ -311,21 +307,12 @@ void FlightMode::phaseGVUse_currentIndexChanged(int index)
QComboBox *comboBox = qobject_cast<QComboBox*>(sender());
int gvar = comboBox->property("index").toInt();
if (index == 0) {
int value = phase.gvars[gvar];
if (value>1024) {
value=0;
}
gvValues[gvar]->setValue(value);
gvValues[gvar]->setEnabled(true);
phase.gvars[gvar]=value;
phase.gvars[gvar]=0;
}
else {
phase.gvars[gvar] = 1024+index;
// TOTO it's wrong!!!
int value = model.phaseData[index + (index>phaseIdx ? 0 :-1)].gvars[gvar];
gvValues[gvar]->setValue(value);
gvValues[gvar]->setDisabled(true);
}
update();
emit modified();
lock = false;
}
@@ -348,21 +335,12 @@ void FlightMode::phaseREUse_currentIndexChanged(int index)
QComboBox *comboBox = qobject_cast<QComboBox*>(sender());
int re = comboBox->property("index").toInt();
if (index == 0) {
// TODO no!!!
int value = phase.rotaryEncoders[re];
if (value > 1024) {
value = 0;
}
reValues[re]->setValue(value);
reValues[re]->setEnabled(true);
phase.rotaryEncoders[re] = value;
phase.rotaryEncoders[re] = 0;
}
else {
phase.rotaryEncoders[re] = 1024 + index;
int value = model.phaseData[index + (index>phaseIdx ? 0 :-1)].rotaryEncoders[re];
reValues[re]->setValue(value);
reValues[re]->setDisabled(true) ;
phase.rotaryEncoders[re] = 1024 + index; ;
}
update();
lock = false;
emit modified();
}
+7 -1
View File
@@ -169,12 +169,18 @@ void InputsPanel::gm_openExpo(int index)
if(index<0 || index>=C9X_MAX_EXPOS) return;
ExpoData mixd(model.expoData[index]);
char inputName[4+1];
emit modified();
update();
if (GetEepromInterface()->getCapability(VirtualInputs))
strcpy(inputName, model.inputNames[mixd.chn]);
ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings.stickMode);
ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings.stickMode, inputName);
if (g->exec()) {
model.expoData[index] = mixd;
if (GetEepromInterface()->getCapability(VirtualInputs))
strcpy(model.inputNames[mixd.chn], inputName);
emit modified();
update();
}
+1
View File
@@ -22,6 +22,7 @@ ModelEdit::ModelEdit(RadioData & radioData, int modelId, bool openWizard, bool i
generalSettings(radioData.generalSettings)
{
ui->setupUi(this);
setWindowIcon(CompanionIcon("edit.png"));
restoreGeometry(g.modelEditGeo());
ui->pushButton->setIcon(CompanionIcon("simulate.png"));
addTab(new Setup(this, model), tr("Setup"));
+64 -15
View File
@@ -28,10 +28,20 @@ TelemetryAnalog::TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog):
update();
ui->UnitCB->setCurrentIndex(analog.type);
ui->alarm1LevelCB->setCurrentIndex(analog.alarms[0].level);
ui->alarm1GreaterCB->setCurrentIndex(analog.alarms[0].greater);
ui->alarm2LevelCB->setCurrentIndex(analog.alarms[1].level);
ui->alarm2GreaterCB->setCurrentIndex(analog.alarms[1].greater);
if (!IS_TARANIS(GetEepromInterface()->getBoard())) {
ui->alarm1LevelCB->setCurrentIndex(analog.alarms[0].level);
ui->alarm1GreaterCB->setCurrentIndex(analog.alarms[0].greater);
ui->alarm2LevelCB->setCurrentIndex(analog.alarms[1].level);
ui->alarm2GreaterCB->setCurrentIndex(analog.alarms[1].greater);
}
else {
ui->alarm1LevelCB->hide();
ui->alarm2LevelCB->hide();
ui->alarm1GreaterCB->hide();
ui->alarm2GreaterCB->hide();
ui->alarm1Label->setText(tr("Low Alarm"));
ui->alarm2Label->setText(tr("Critical Alarm"));
}
if (!(GetEepromInterface()->getCapability(Telemetry) & TM_HASOFFSET)) {
ui->CalibSB->hide();
@@ -281,7 +291,7 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model,
for (int c=0; c<GetEepromInterface()->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
fieldsCB[l][c] = new QComboBox(this);
fieldsCB[l][c]->setProperty("index", c + (l<<8));
populateCustomScreenFieldCB(fieldsCB[l][c], screen.body.lines[l].source[c], (l<4), model.frsky.usrProto);
populateTelemetrySourceCB(fieldsCB[l][c], screen.body.lines[l].source[c], l==3, model.frsky.usrProto);
ui->screenNumsLayout->addWidget(fieldsCB[l][c], l, c, 1, 1);
connect(fieldsCB[l][c], SIGNAL(currentIndexChanged(int)), this, SLOT(customFieldChanged(int)));
}
@@ -290,7 +300,7 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model,
for (int l=0; l<4; l++) {
barsCB[l] = new QComboBox(this);
barsCB[l]->setProperty("index", l);
populateCustomScreenFieldCB(barsCB[l], screen.body.bars[l].source, false, model.frsky.usrProto);
populateTelemetrySourceCB(barsCB[l], screen.body.bars[l].source, false, model.frsky.usrProto);
connect(barsCB[l], SIGNAL(currentIndexChanged(int)), this, SLOT(barSourceChanged(int)));
ui->screenBarsLayout->addWidget(barsCB[l], l, 0, 1, 1);
@@ -316,6 +326,31 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model,
update();
}
void TelemetryCustomScreen::populateTelemetrySourceCB(QComboBox *b, unsigned int value, bool last, int hubproto)
{
int telem_hub[] = {0,0,0,0,0,0,0,0,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,0,0,2,2,1,1,1,1,1,1};
b->clear();
b->addItem(RawSource(SOURCE_TYPE_NONE, 0).toString());
for (unsigned int i = 0; i < (last ? TELEMETRY_SOURCES_STATUS_COUNT : TELEMETRY_SOURCES_DISPLAY_COUNT); i++) {
b->addItem(RawSource(SOURCE_TYPE_TELEMETRY, i).toString());
if (!(i>=sizeof(telem_hub)/sizeof(int) || telem_hub[i]==0 || ((telem_hub[i]>=hubproto) && hubproto!=0))) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
}
}
if (value>=sizeof(telem_hub)/sizeof(int))
b->setCurrentIndex(0);
else if (telem_hub[value]==0 || ((telem_hub[value]>=hubproto) && hubproto!=0)) {
b->setCurrentIndex(value);
}
b->setMaxVisibleItems(10);
}
TelemetryCustomScreen::~TelemetryCustomScreen()
{
delete ui;
@@ -347,6 +382,8 @@ void TelemetryCustomScreen::update()
void TelemetryCustomScreen::updateBar(int line)
{
lock = true;
int index = screen.body.bars[line].source;
barsCB[line]->setCurrentIndex(index);
if (index) {
@@ -372,6 +409,8 @@ void TelemetryCustomScreen::updateBar(int line)
minSB[line]->setDisabled(true);
maxSB[line]->setDisabled(true);
}
lock = false;
}
void TelemetryCustomScreen::on_screenType_currentIndexChanged(int index)
@@ -393,13 +432,15 @@ void TelemetryCustomScreen::customFieldChanged(int value)
void TelemetryCustomScreen::barSourceChanged(int index)
{
QComboBox * cb = qobject_cast<QComboBox*>(sender());
int line = cb->property("index").toInt();
screen.body.bars[line].source = index;
screen.body.bars[line].barMin = 0;
screen.body.bars[line].barMax = 0;
updateBar(line);
emit modified();
if (!lock) {
QComboBox * cb = qobject_cast<QComboBox*>(sender());
int line = cb->property("index").toInt();
screen.body.bars[line].source = index;
screen.body.bars[line].barMin = 0;
screen.body.bars[line].barMax = 0;
updateBar(line);
emit modified();
}
}
void TelemetryCustomScreen::barMinChanged(double value)
@@ -467,8 +508,16 @@ void TelemetryPanel::setup()
}
ui->rssiAlarm1SB->setValue(model.frsky.rssiAlarms[0].value);
ui->rssiAlarm2SB->setValue(model.frsky.rssiAlarms[1].value);
ui->rssiAlarm1CB->setCurrentIndex(model.frsky.rssiAlarms[0].level);
ui->rssiAlarm2CB->setCurrentIndex(model.frsky.rssiAlarms[1].level);
if (!IS_TARANIS(GetEepromInterface()->getBoard())) {
ui->rssiAlarm1CB->setCurrentIndex(model.frsky.rssiAlarms[0].level);
ui->rssiAlarm2CB->setCurrentIndex(model.frsky.rssiAlarms[1].level);
}
else {
ui->rssiAlarm1CB->hide();
ui->rssiAlarm2CB->hide();
ui->rssiAlarm1Label->setText(tr("Low Alarm"));
ui->rssiAlarm2Label->setText(tr("Critical Alarm"));
}
if (!GetEepromInterface()->getCapability(HasAltitudeSel)) {
ui->AltitudeGPS_ChkB->hide();
+3
View File
@@ -61,6 +61,9 @@ class TelemetryCustomScreen : public ModelPanel
void barMinChanged(double value);
void barMaxChanged(double value);
protected:
void populateTelemetrySourceCB(QComboBox *b, unsigned int value, bool last, int hubproto);
private:
void updateBar(int line);
Ui::TelemetryCustomScreen * ui;
+2 -2
View File
@@ -77,7 +77,7 @@
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="QLabel" name="label_927">
<widget class="QLabel" name="rssiAlarm1Label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -157,7 +157,7 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_928">
<widget class="QLabel" name="rssiAlarm2Label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
+2 -2
View File
@@ -43,7 +43,7 @@
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_919">
<widget class="QLabel" name="alarm1Label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -106,7 +106,7 @@
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_921">
<widget class="QLabel" name="alarm2Label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>