'next' EEPROM support continued: Timer countdown modes
This commit is contained in:
@@ -788,14 +788,13 @@ enum TimerMode {
|
||||
class TimerData {
|
||||
public:
|
||||
TimerData() { clear(); }
|
||||
TimerMode mode; // timer trigger source -> off, abs, THs, TH%, THt, sw/!sw, !m_sw/!m_sw
|
||||
int8_t modeB;
|
||||
bool minuteBeep;
|
||||
bool countdownBeep;
|
||||
bool dir; // 0=>Count Down, 1=>Count Up
|
||||
TimerMode mode; // timer trigger source -> off, abs, THs, TH%, THt, sw/!sw, !m_sw/!m_sw
|
||||
bool minuteBeep;
|
||||
unsigned int countdownBeep;
|
||||
bool dir; // 0=>Count Down, 1=>Count Up
|
||||
unsigned int val;
|
||||
bool persistent;
|
||||
int pvalue;
|
||||
bool persistent;
|
||||
int pvalue;
|
||||
void clear() { memset(this, 0, sizeof(TimerData)); }
|
||||
};
|
||||
|
||||
@@ -915,8 +914,6 @@ enum Capability {
|
||||
MixesWithoutExpo,
|
||||
Timers,
|
||||
TimeDivisions,
|
||||
minuteBeep,
|
||||
countdownBeep,
|
||||
CustomFunctions,
|
||||
VoicesAsNumbers,
|
||||
VoicesMaxLength,
|
||||
|
||||
@@ -366,9 +366,7 @@ t_Er9xModelData::operator ModelData ()
|
||||
c9x.timers[0].mode = getEr9xTimerMode(tmrMode);
|
||||
c9x.timers[0].dir = tmrDir;
|
||||
c9x.timers[0].val = tmrVal;
|
||||
c9x.timers[0].modeB = tmrModeB;
|
||||
|
||||
switch(protocol) {
|
||||
switch(protocol) {
|
||||
case 1:
|
||||
c9x.moduleData[0].protocol = PXX_DJT;
|
||||
break;
|
||||
|
||||
@@ -508,7 +508,6 @@ t_Ersky9xModelData_v10::operator ModelData ()
|
||||
getEEPROMString(c9x.name, name, sizeof(name));
|
||||
for (int i=0; i<2; i++) {
|
||||
c9x.timers[i].mode = getErSky9xTimerMode(timer[i].tmrModeA);
|
||||
c9x.timers[i].modeB = timer[i].tmrModeB;
|
||||
c9x.timers[i].dir = timer[i].tmrDir;
|
||||
c9x.timers[i].val = timer[i].tmrVal;
|
||||
}
|
||||
@@ -630,7 +629,6 @@ t_Ersky9xModelData_v11::operator ModelData ()
|
||||
getEEPROMString(c9x.name, name, sizeof(name));
|
||||
for (int i=0; i<2; i++) {
|
||||
c9x.timers[i].mode = getErSky9xTimerMode(timer[i].tmrModeA);
|
||||
c9x.timers[i].modeB = timer[i].tmrModeB;
|
||||
c9x.timers[i].dir = timer[i].tmrDir;
|
||||
c9x.timers[i].val = timer[i].tmrVal;
|
||||
}
|
||||
|
||||
@@ -1811,7 +1811,7 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
|
||||
internalField.Append(new TimerModeField(modelData.timers[i].mode, board, version));
|
||||
if ((IS_ARM(board) || IS_2560(board)) && version >= 216) {
|
||||
internalField.Append(new UnsignedField<16>(modelData.timers[i].val));
|
||||
internalField.Append(new BoolField<2>(modelData.timers[i].countdownBeep));
|
||||
internalField.Append(new UnsignedField<2>(modelData.timers[i].countdownBeep));
|
||||
internalField.Append(new BoolField<1>(modelData.timers[i].minuteBeep));
|
||||
internalField.Append(new BoolField<1>(modelData.timers[i].persistent));
|
||||
internalField.Append(new SpareBitsField<4>());
|
||||
@@ -1819,7 +1819,7 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
|
||||
}
|
||||
else if (release21March2013) {
|
||||
internalField.Append(new UnsignedField<12>(modelData.timers[i].val));
|
||||
internalField.Append(new BoolField<1>(modelData.timers[i].countdownBeep));
|
||||
internalField.Append(new BoolField<1>((bool &)modelData.timers[i].countdownBeep));
|
||||
internalField.Append(new BoolField<1>(modelData.timers[i].minuteBeep));
|
||||
if (HAS_PERSISTENT_TIMERS(board)) {
|
||||
internalField.Append(new BoolField<1>(modelData.timers[i].persistent));
|
||||
|
||||
@@ -513,10 +513,6 @@ int Open9xInterface::getCapability(const Capability capability)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
case minuteBeep:
|
||||
return 1;
|
||||
case countdownBeep:
|
||||
return 1;
|
||||
case Pots:
|
||||
return (IS_TARANIS(board) ? 4 : 3);
|
||||
case Switches:
|
||||
|
||||
@@ -19,13 +19,10 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer):
|
||||
ui->persistentValue->hide();
|
||||
}
|
||||
|
||||
if (!GetEepromInterface()->getCapability(minuteBeep)) {
|
||||
ui->minuteBeep->hide();
|
||||
}
|
||||
|
||||
if (!GetEepromInterface()->getCapability(countdownBeep)) {
|
||||
ui->countdownBeep->hide();
|
||||
}
|
||||
ui->countdownBeep->addItem(tr("None"));
|
||||
ui->countdownBeep->addItem(tr("Beeps"));
|
||||
if (IS_ARM(GetEepromInterface()->getBoard()) || IS_2560(GetEepromInterface()->getBoard()))
|
||||
ui->countdownBeep->addItem(tr("Countdown"));
|
||||
}
|
||||
|
||||
TimerPanel::~TimerPanel()
|
||||
@@ -54,13 +51,8 @@ void TimerPanel::update()
|
||||
ui->persistentValue->setText(QString(" %1(%2:%3:%4)").arg(sign<0 ? "-" :" ").arg(hours, 2, 10, QLatin1Char('0')).arg(minutes, 2, 10, QLatin1Char('0')).arg(seconds, 2, 10, QLatin1Char('0')));
|
||||
}
|
||||
|
||||
if (GetEepromInterface()->getCapability(minuteBeep)) {
|
||||
ui->minuteBeep->setChecked(timer.minuteBeep);
|
||||
}
|
||||
|
||||
if (GetEepromInterface()->getCapability(countdownBeep)) {
|
||||
ui->countdownBeep->setChecked(timer.countdownBeep);
|
||||
}
|
||||
ui->countdownBeep->setCurrentIndex(timer.countdownBeep);
|
||||
ui->minuteBeep->setChecked(timer.minuteBeep);
|
||||
}
|
||||
|
||||
void TimerPanel::on_value_editingFinished()
|
||||
@@ -81,15 +73,15 @@ void TimerPanel::on_persistent_toggled(bool checked)
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TimerPanel::on_minuteBeep_toggled(bool checked)
|
||||
void TimerPanel::on_countdownBeep_currentIndexChanged(int index)
|
||||
{
|
||||
timer.minuteBeep = checked;
|
||||
timer.countdownBeep = index;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void TimerPanel::on_countdownBeep_toggled(bool checked)
|
||||
void TimerPanel::on_minuteBeep_toggled(bool checked)
|
||||
{
|
||||
timer.countdownBeep = checked;
|
||||
timer.minuteBeep = checked;
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class TimerPanel : public ModelPanel
|
||||
void on_value_editingFinished();
|
||||
void on_persistent_toggled(bool checked);
|
||||
void on_minuteBeep_toggled(bool checked);
|
||||
void on_countdownBeep_toggled(bool checked);
|
||||
void on_countdownBeep_currentIndexChanged(int index);
|
||||
|
||||
private:
|
||||
TimerData & timer;
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>726</width>
|
||||
<height>54</height>
|
||||
<width>586</width>
|
||||
<height>38</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -33,6 +33,23 @@
|
||||
<item>
|
||||
<widget class="QComboBox" name="mode"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="countdownBeepLabel">
|
||||
<property name="text">
|
||||
<string>Countdown</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="countdownBeep"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="minuteBeep">
|
||||
<property name="text">
|
||||
<string>MinuteBeep</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="persistent">
|
||||
<property name="text">
|
||||
@@ -47,20 +64,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="minuteBeep">
|
||||
<property name="text">
|
||||
<string>MinuteBeep</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="countdownBeep">
|
||||
<property name="text">
|
||||
<string>CountDownBeep</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer">
|
||||
<property name="orientation">
|
||||
|
||||
Reference in New Issue
Block a user