[Companion] Old EEPROM support removed

This commit is contained in:
Bertrand Songis
2016-11-23 16:40:47 +01:00
parent 9590b5f00e
commit 5f9737fc70
73 changed files with 1309 additions and 9277 deletions
+4 -4
View File
@@ -156,7 +156,7 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
ui->curvesLayout2->addItem(item2,limit+1,1,1,1,0);
}
for (int i=0; i<C9X_MAX_POINTS; i++) {
for (int i=0; i<CPN_MAX_POINTS; i++) {
spnx[i] = new QSpinBox(this);
spnx[i]->setProperty("index", i);
spnx[i]->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
@@ -360,7 +360,7 @@ void Curves::updateCurvePoints()
spnx[i]->hide();
}
}
for (int i=count; i<C9X_MAX_POINTS; i++) {
for (int i=count; i<CPN_MAX_POINTS; i++) {
spny[i]->hide();
spnx[i]->hide();
}
@@ -440,7 +440,7 @@ void Curves::on_curvePoints_currentIndexChanged(int index)
model->curves[currentCurve].count = numpoints;
// TODO something better + reuse!
for (int i=0; i<C9X_MAX_POINTS; i++) {
for (int i=0; i<CPN_MAX_POINTS; i++) {
model->curves[currentCurve].points[i].x = (i >= numpoints-1 ? +100 : -100 + (200*i)/(numpoints-1));
model->curves[currentCurve].points[i].y = 0;
}
@@ -463,7 +463,7 @@ void Curves::on_curveCustom_currentIndexChanged(int index)
model->curves[currentCurve].type = type;
// TODO something better + reuse!
for (int i=0; i<C9X_MAX_POINTS; i++) {
for (int i=0; i<CPN_MAX_POINTS; i++) {
model->curves[currentCurve].points[i].x = (i >= numpoints-1 ? +100 : -100 + (200*i)/(numpoints-1));
model->curves[currentCurve].points[i].y = 0;
}
+3 -3
View File
@@ -55,9 +55,9 @@ class Curves : public ModelPanel
private:
Ui::Curves *ui;
int currentCurve;
bool visibleCurves[C9X_MAX_CURVES];
QSpinBox * spnx[C9X_MAX_POINTS];
QSpinBox * spny[C9X_MAX_POINTS];
bool visibleCurves[CPN_MAX_CURVES];
QSpinBox * spnx[CPN_MAX_POINTS];
QSpinBox * spny[CPN_MAX_POINTS];
QVector<CurveCreatorTemplate> templates;
void setCurrentCurve(int index);
void updateCurve();
+12 -12
View File
@@ -58,18 +58,18 @@ class CustomFunctionsPanel : public GenericPanel
QSet<QString> tracksSet;
QSet<QString> scriptsSet;
int mediaPlayerCurrent;
QComboBox * fswtchSwtch[C9X_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchFunc[C9X_MAX_CUSTOM_FUNCTIONS];
QCheckBox * fswtchParamGV[C9X_MAX_CUSTOM_FUNCTIONS];
QDoubleSpinBox * fswtchParam[C9X_MAX_CUSTOM_FUNCTIONS];
QTimeEdit * fswtchParamTime[C9X_MAX_CUSTOM_FUNCTIONS];
QPushButton * playBT[C9X_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchParamT[C9X_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchParamArmT[C9X_MAX_CUSTOM_FUNCTIONS];
QCheckBox * fswtchEnable[C9X_MAX_CUSTOM_FUNCTIONS];
RepeatComboBox * fswtchRepeat[C9X_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchGVmode[C9X_MAX_CUSTOM_FUNCTIONS];
QSlider * fswtchBLcolor[C9X_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchSwtch[CPN_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchFunc[CPN_MAX_CUSTOM_FUNCTIONS];
QCheckBox * fswtchParamGV[CPN_MAX_CUSTOM_FUNCTIONS];
QDoubleSpinBox * fswtchParam[CPN_MAX_CUSTOM_FUNCTIONS];
QTimeEdit * fswtchParamTime[CPN_MAX_CUSTOM_FUNCTIONS];
QPushButton * playBT[CPN_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchParamT[CPN_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchParamArmT[CPN_MAX_CUSTOM_FUNCTIONS];
QCheckBox * fswtchEnable[CPN_MAX_CUSTOM_FUNCTIONS];
RepeatComboBox * fswtchRepeat[CPN_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchGVmode[CPN_MAX_CUSTOM_FUNCTIONS];
QSlider * fswtchBLcolor[CPN_MAX_CUSTOM_FUNCTIONS];
QMediaPlayer * mediaPlayer;
int selectedFunction;
+1 -1
View File
@@ -78,7 +78,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
ui->trimCB->hide();
}
for(int i=0; i < NUM_STICKS; i++) {
for(int i=0; i < CPN_MAX_STICKS; i++) {
ui->trimCB->addItem(AnalogString(i), i+1);
}
ui->trimCB->setCurrentIndex(1 - ed->carryTrim);
+2 -2
View File
@@ -56,8 +56,8 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
}
// The trims
QString labels[NUM_STICKS];
for(int i=0; i < NUM_STICKS; i++) {
QString labels[CPN_MAX_STICKS];
for(int i=0; i < CPN_MAX_STICKS; i++) {
labels[i] = AnalogString(i);
}
+6 -6
View File
@@ -45,12 +45,12 @@ class FlightModePanel : public ModelPanel
int reCount;
int gvCount;
QVector<QLabel *> trimsLabel;
QLineEdit * gvNames[C9X_MAX_GVARS];
QSpinBox * gvValues[C9X_MAX_GVARS];
QCheckBox * gvPopups[C9X_MAX_GVARS];
QComboBox * gvUse[C9X_MAX_GVARS];
QSpinBox * reValues[C9X_MAX_ENCODERS];
QComboBox * reUse[C9X_MAX_ENCODERS];
QLineEdit * gvNames[CPN_MAX_GVARS];
QSpinBox * gvValues[CPN_MAX_GVARS];
QCheckBox * gvPopups[CPN_MAX_GVARS];
QComboBox * gvUse[CPN_MAX_GVARS];
QSpinBox * reValues[CPN_MAX_ENCODERS];
QComboBox * reUse[CPN_MAX_ENCODERS];
QVector<QComboBox *> trimsUse;
QVector<QSpinBox *> trimsValue;
QVector<QSlider *> trimsSlider;
+8 -8
View File
@@ -9,7 +9,7 @@ InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & g
{
inputsCount = firmware->getCapability(VirtualInputs);
if (inputsCount == 0)
inputsCount = NUM_STICKS;
inputsCount = CPN_MAX_STICKS;
QGridLayout * exposLayout = new QGridLayout(this);
@@ -58,7 +58,7 @@ void InputsPanel::update()
firstLine = true;
int curDest = -1;
for (int i=0; i<C9X_MAX_EXPOS; i++) {
for (int i=0; i<CPN_MAX_EXPOS; i++) {
ExpoData *md = &model->expoData[i];
if (md->mode==0) break;
@@ -162,7 +162,7 @@ QString InputsPanel::getInputText(int dest, bool * new_ch)
bool InputsPanel::gm_insertExpo(int idx)
{
if (idx<0 || idx>=C9X_MAX_EXPOS || model->expoData[C9X_MAX_EXPOS-1].mode > 0) {
if (idx<0 || idx>=CPN_MAX_EXPOS || model->expoData[CPN_MAX_EXPOS-1].mode > 0) {
QMessageBox::information(this, "Companion", tr("Not enough available inputs!"));
return false;
}
@@ -184,7 +184,7 @@ void InputsPanel::gm_deleteExpo(int index)
void InputsPanel::gm_openExpo(int index)
{
if(index<0 || index>=C9X_MAX_EXPOS) return;
if(index<0 || index>=CPN_MAX_EXPOS) return;
ExpoData mixd(model->expoData[index]);
emit modified();
@@ -215,8 +215,8 @@ void InputsPanel::gm_openExpo(int index)
int InputsPanel::getExpoIndex(unsigned int dch)
{
unsigned int i = 0;
while (model->expoData[i].chn<=dch && model->expoData[i].mode && i<C9X_MAX_EXPOS) i++;
if(i==C9X_MAX_EXPOS) return -1;
while (model->expoData[i].chn<=dch && model->expoData[i].mode && i<CPN_MAX_EXPOS) i++;
if(i==CPN_MAX_EXPOS) return -1;
return i;
}
@@ -226,7 +226,7 @@ QList<int> InputsPanel::createExpoListFromSelected()
QList<int> list;
foreach(QListWidgetItem *item, ExposlistWidget->selectedItems()) {
int idx= item->data(Qt::UserRole).toByteArray().at(0);
if(idx>=0 && idx<C9X_MAX_EXPOS) list << idx;
if(idx>=0 && idx<CPN_MAX_EXPOS) list << idx;
}
return list;
}
@@ -424,7 +424,7 @@ void InputsPanel::expolistWidget_KeyPress(QKeyEvent *event)
int InputsPanel::gm_moveExpo(int idx, bool dir) //true=inc=down false=dec=up
{
if(idx>C9X_MAX_EXPOS || (idx==C9X_MAX_EXPOS && dir)) return idx;
if(idx>CPN_MAX_EXPOS || (idx==CPN_MAX_EXPOS && dir)) return idx;
int tdx = dir ? idx+1 : idx-1;
ExpoData temp;
+10 -10
View File
@@ -28,16 +28,16 @@ class LogicalSwitchesPanel : public ModelPanel
void cswCut();
private:
QComboBox * csw[C9X_NUM_CSW];
QDoubleSpinBox * cswitchValue[C9X_NUM_CSW];
QDoubleSpinBox * cswitchOffset[C9X_NUM_CSW];
QDoubleSpinBox * cswitchOffset2[C9X_NUM_CSW];
QTimeEdit * cswitchTOffset[C9X_NUM_CSW];
QComboBox * cswitchAnd[C9X_NUM_CSW];
QDoubleSpinBox * cswitchDuration[C9X_NUM_CSW];
QDoubleSpinBox * cswitchDelay[C9X_NUM_CSW];
QComboBox * cswitchSource1[C9X_NUM_CSW];
QComboBox * cswitchSource2[C9X_NUM_CSW];
QComboBox * csw[CPN_MAX_CSW];
QDoubleSpinBox * cswitchValue[CPN_MAX_CSW];
QDoubleSpinBox * cswitchOffset[CPN_MAX_CSW];
QDoubleSpinBox * cswitchOffset2[CPN_MAX_CSW];
QTimeEdit * cswitchTOffset[CPN_MAX_CSW];
QComboBox * cswitchAnd[CPN_MAX_CSW];
QDoubleSpinBox * cswitchDuration[CPN_MAX_CSW];
QDoubleSpinBox * cswitchDelay[CPN_MAX_CSW];
QComboBox * cswitchSource1[CPN_MAX_CSW];
QComboBox * cswitchSource2[CPN_MAX_CSW];
void setSwitchWidgetVisibility(int i);
int selectedSwitch;
+2 -2
View File
@@ -38,7 +38,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
}
if (!firmware->getCapability(VirtualInputs)) {
for(int i=0; i < NUM_STICKS; i++) {
for(int i=0; i < CPN_MAX_STICKS; i++) {
ui->trimCB->addItem(AnalogString(i));
}
}
@@ -145,7 +145,7 @@ void MixerDialog::valuesChanged()
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
md->srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt());
if (firmware->getCapability(HasNoExpo)) {
bool drVisible = (md->srcRaw.type == SOURCE_TYPE_STICK && md->srcRaw.index < NUM_STICKS);
bool drVisible = (md->srcRaw.type == SOURCE_TYPE_STICK && md->srcRaw.index < CPN_MAX_STICKS);
ui->MixDR_CB->setEnabled(drVisible);
ui->label_MixDR->setEnabled(drVisible);
}
+10 -10
View File
@@ -594,7 +594,7 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
}
QWidget * prevFocus = ui->image;
for (int i=0; i<C9X_MAX_TIMERS; i++) {
for (int i=0; i<CPN_MAX_TIMERS; i++) {
if (i<firmware->getCapability(Timers)) {
timers[i] = new TimerPanel(this, model, model.timers[i], generalSettings, firmware, prevFocus);
ui->gridLayout->addWidget(timers[i], 1+i, 1);
@@ -610,7 +610,7 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
if (firmware->getCapability(HasTopLcd)) {
ui->toplcdTimer->setField(model.toplcdTimer, this);
for (int i=0; i<C9X_MAX_TIMERS; i++) {
for (int i=0; i<CPN_MAX_TIMERS; i++) {
if (i<firmware->getCapability(Timers)) {
ui->toplcdTimer->addItem(tr("Timer %1").arg(i+1), i);
}
@@ -631,7 +631,7 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
// Beep Center checkboxes
prevFocus = ui->trimsDisplay;
int analogs = NUM_STICKS + firmware->getCapability(Pots) + firmware->getCapability(Sliders);
int analogs = CPN_MAX_STICKS + firmware->getCapability(Pots) + firmware->getCapability(Sliders);
for (int i=0; i<analogs+firmware->getCapability(RotaryEncoders); i++) {
QCheckBox * checkbox = new QCheckBox(this);
checkbox->setProperty("index", i);
@@ -641,10 +641,10 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
centerBeepCheckboxes << checkbox;
if (IS_TARANIS(board)) {
RawSource src(SOURCE_TYPE_STICK, i);
if (src.isPot() && !generalSettings.isPotAvailable(i-NUM_STICKS)) {
if (src.isPot() && !generalSettings.isPotAvailable(i-CPN_MAX_STICKS)) {
checkbox->hide();
}
else if (src.isSlider() && !generalSettings.isSliderAvailable(i-NUM_STICKS-firmware->getCapability(Pots))) {
else if (src.isSlider() && !generalSettings.isSliderAvailable(i-CPN_MAX_STICKS-firmware->getCapability(Pots))) {
checkbox->hide();
}
}
@@ -702,7 +702,7 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
ui->potWarningLayout->addWidget(cb, 0, i+1);
connect(cb, SIGNAL(toggled(bool)), this, SLOT(potWarningToggled(bool)));
potWarningCheckboxes << cb;
if (RawSource(SOURCE_TYPE_STICK, NUM_STICKS+i).isPot()) {
if (RawSource(SOURCE_TYPE_STICK, CPN_MAX_STICKS+i).isPot()) {
if (!generalSettings.isPotAvailable(i)) {
cb->hide();
}
@@ -736,9 +736,9 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
}
if (firmware->getCapability(ModelTrainerEnable)) {
modules[C9X_NUM_MODULES] = new ModulePanel(this, model, model.moduleData[C9X_NUM_MODULES], generalSettings, firmware, -1);
ui->modulesLayout->addWidget(modules[C9X_NUM_MODULES]);
connect(modules[C9X_NUM_MODULES], SIGNAL(modified()), this, SLOT(onChildModified()));
modules[CPN_MAX_MODULES] = new ModulePanel(this, model, model.moduleData[CPN_MAX_MODULES], generalSettings, firmware, -1);
ui->modulesLayout->addWidget(modules[CPN_MAX_MODULES]);
connect(modules[CPN_MAX_MODULES], SIGNAL(modified()), this, SLOT(onChildModified()));
}
disableMouseScrolling();
@@ -894,7 +894,7 @@ void SetupPanel::update()
for (int i=0; i<firmware->getCapability(Timers); i++)
timers[i]->update();
for (int i=0; i<C9X_NUM_MODULES+1; i++)
for (int i=0; i<CPN_MAX_MODULES+1; i++)
if (modules[i])
modules[i]->update();
}
+6 -6
View File
@@ -65,10 +65,10 @@ class ModulePanel : public ModelPanel
void on_failsafeMode_currentIndexChanged(int value);
void onFailsafeComboIndexChanged(int index);
void onFailsafeSpinChanged(double value);
void on_multiProtocol_currentIndexChanged(int index);
void on_multiSubType_currentIndexChanged(int index);
void on_autoBind_stateChanged(int state);
void on_lowPower_stateChanged(int state);
void on_multiProtocol_currentIndexChanged(int index);
void on_multiSubType_currentIndexChanged(int index);
void on_autoBind_stateChanged(int state);
void on_lowPower_stateChanged(int state);
private:
ModuleData & module;
@@ -115,8 +115,8 @@ class SetupPanel : public ModelPanel
QVector<QCheckBox *> startupSwitchesCheckboxes;
QVector<QCheckBox *> potWarningCheckboxes;
QVector<QCheckBox *> centerBeepCheckboxes;
ModulePanel * modules[C9X_NUM_MODULES+1];
TimerPanel * timers[C9X_MAX_TIMERS];
ModulePanel * modules[CPN_MAX_MODULES+1];
TimerPanel * timers[CPN_MAX_TIMERS];
void updateStartupSwitches();
void updatePotWarnings();
void updateBeepCenter();
+5 -5
View File
@@ -628,13 +628,13 @@ void populateTelemetrySourcesComboBox(AutoComboBox * cb, const ModelData * model
{
cb->clear();
if (negative) {
for (int i=-C9X_MAX_SENSORS; i<0; ++i) {
for (int i=-CPN_MAX_SENSORS; i<0; ++i) {
if (model->sensorData[-i-1].isAvailable())
cb->addItem(QObject::tr("-%1").arg(model->sensorData[-i-1].label), i);
}
}
cb->addItem("---", 0);
for (int i=1; i<=C9X_MAX_SENSORS; ++i) {
for (int i=1; i<=CPN_MAX_SENSORS; ++i) {
if (model->sensorData[i-1].isAvailable())
cb->addItem(model->sensorData[i-1].label, i);
}
@@ -720,7 +720,7 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin
if (IS_ARM(firmware->getBoard())) {
ui->A1GB->hide();
ui->A2GB->hide();
for (int i=0; i<C9X_MAX_SENSORS; ++i) {
for (int i=0; i<CPN_MAX_SENSORS; ++i) {
TelemetrySensorPanel * panel = new TelemetrySensorPanel(this, model.sensorData[i], model, generalSettings, firmware);
ui->sensorsLayout->addWidget(panel);
sensorPanels[i] = panel;
@@ -782,7 +782,7 @@ void TelemetryPanel::update()
}
if (IS_ARM(firmware->getBoard())) {
for (int i=0; i<C9X_MAX_SENSORS; ++i) {
for (int i=0; i<CPN_MAX_SENSORS; ++i) {
sensorPanels[i]->update();
}
for (int i=0; i<firmware->getCapability(TelemetryCustomScreens); i++) {
@@ -827,7 +827,7 @@ void TelemetryPanel::setup()
}
/*if (IS_ARM(firmware->getBoard())) {
for (int i=0; i<C9X_MAX_SENSORS; ++i) {
for (int i=0; i<CPN_MAX_SENSORS; ++i) {
TelemetrySensorPanel * panel = new TelemetrySensorPanel(this, model->, model, generalSettings, firmware);
ui->sensorsLayout->addWidget(panel);
sensorPanels[i] = panel;
+1 -1
View File
@@ -134,7 +134,7 @@ class TelemetryPanel : public ModelPanel
Ui::Telemetry *ui;
TelemetryAnalog * analogs[4];
TelemetryCustomScreen * telemetryCustomScreens[4];
TelemetrySensorPanel * sensorPanels[C9X_MAX_SENSORS];
TelemetrySensorPanel * sensorPanels[CPN_MAX_SENSORS];
void setup();
void telBarUpdate();