Fix X7 R9M power line not enabled (#5973)
[opentx.git] / companion / src / modeledit / telemetry.h
blob09758d38b684d0b011b60b4c4bbc9b63b96d6841
1 /*
2 * Copyright (C) OpenTX
4 * Based on code named
5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #ifndef _TELEMETRY_H_
22 #define _TELEMETRY_H_
24 #include "modeledit.h"
25 #include "eeprominterface.h"
27 class AutoComboBox;
28 class TimerEdit;
30 namespace Ui {
31 class TelemetryAnalog;
32 class TelemetryCustomScreen;
33 class TelemetrySensor;
34 class Telemetry;
37 class TelemetryAnalog: public ModelPanel
39 Q_OBJECT
41 friend class TelemetryPanel;
43 public:
44 TelemetryAnalog(QWidget *parent, FrSkyChannelData & analog, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware);
45 virtual ~TelemetryAnalog();
47 signals:
48 void modified();
50 private slots:
51 void on_UnitCB_currentIndexChanged(int index);
52 void on_RatioSB_editingFinished();
53 void on_RatioSB_valueChanged();
54 void on_CalibSB_editingFinished();
55 void on_alarm1LevelCB_currentIndexChanged(int index);
56 void on_alarm1GreaterCB_currentIndexChanged(int index);
57 void on_alarm1ValueSB_editingFinished();
58 void on_alarm2LevelCB_currentIndexChanged(int index);
59 void on_alarm2GreaterCB_currentIndexChanged(int index);
60 void on_alarm2ValueSB_editingFinished();
62 private:
63 Ui::TelemetryAnalog *ui;
64 FrSkyChannelData & analog;
65 bool lock;
67 void update();
70 class TelemetryCustomScreen: public ModelPanel
72 Q_OBJECT
74 public:
75 TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings, Firmware * firmware);
76 ~TelemetryCustomScreen();
77 void update();
79 private slots:
80 void on_screenType_currentIndexChanged(int index);
81 void scriptNameEdited();
82 void customFieldChanged(int index);
83 void barSourceChanged(int index);
84 void barMinChanged(double value);
85 void barMaxChanged(double value);
86 void barTimeChanged();
88 protected:
89 void populateTelemetrySourceCB(QComboBox * b, RawSource & source, bool last=false);
91 private:
92 void updateBar(int line);
93 Ui::TelemetryCustomScreen * ui;
94 FrSkyScreenData & screen;
95 QComboBox * fieldsCB[4][3];
96 QComboBox * barsCB[4];
97 QDoubleSpinBox * minSB[4];
98 QDoubleSpinBox * maxSB[4];
99 TimerEdit * minTime[4];
100 TimerEdit * maxTime[4];
103 class TelemetrySensorPanel: public ModelPanel
105 Q_OBJECT
107 public:
108 TelemetrySensorPanel(QWidget *parent, SensorData & sensor, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware);
109 ~TelemetrySensorPanel();
110 void update();
112 signals:
113 void dataModified();
115 protected slots:
116 void on_name_editingFinished();
117 void on_type_currentIndexChanged(int index);
118 void on_formula_currentIndexChanged(int index);
119 void on_unit_currentIndexChanged(int index);
120 void on_prec_valueChanged(double value);
122 protected:
123 void updateSourcesComboBox(AutoComboBox * cb, bool negative);
125 private:
126 Ui::TelemetrySensor * ui;
127 SensorData & sensor;
128 bool lock;
131 class TelemetryPanel : public ModelPanel
133 Q_OBJECT
135 public:
136 TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, Firmware * firmware);
137 virtual ~TelemetryPanel();
138 virtual void update();
140 private slots:
141 void on_telemetryProtocol_currentIndexChanged(int index);
142 void onModified();
143 void on_frskyProtoCB_currentIndexChanged(int index);
144 void on_bladesCount_editingFinished();
145 void on_rssiAlarmWarningCB_currentIndexChanged(int index);
146 void on_rssiAlarmCriticalCB_currentIndexChanged(int index);
147 void on_rssiAlarmWarningSB_editingFinished();
148 void on_rssiAlarmCriticalSB_editingFinished();
149 void on_varioLimitMin_DSB_editingFinished();
150 void on_varioLimitMax_DSB_editingFinished();
151 void on_varioLimitCenterMin_DSB_editingFinished();
152 void on_varioLimitCenterMax_DSB_editingFinished();
153 void on_fasOffset_DSB_editingFinished();
154 void on_mahCount_SB_editingFinished();
155 void on_mahCount_ChkB_toggled(bool checked);
157 private:
158 Ui::Telemetry *ui;
159 TelemetryAnalog * analogs[4];
160 TelemetryCustomScreen * telemetryCustomScreens[4];
161 TelemetrySensorPanel * sensorPanels[CPN_MAX_SENSORS];
163 void setup();
164 void telBarUpdate();
165 void populateVoltsSource();
166 void populateCurrentSource();
167 void populateVarioSource();
170 #endif // _TELEMETRY_H_