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