Merge pull request #8253 from opentx/8252_countdownStart
Timer countdown start missing in companion and 128 (fix #8252)
This commit is contained in:
@@ -70,6 +70,8 @@ class TimerData {
|
||||
unsigned int countdownBeep;
|
||||
unsigned int val;
|
||||
unsigned int persistent;
|
||||
int countdownStart;
|
||||
unsigned int direction;
|
||||
int pvalue;
|
||||
void clear() { memset(reinterpret_cast<void *>(this), 0, sizeof(TimerData)); mode = RawSwitch(SWITCH_TYPE_TIMER_MODE, 0); }
|
||||
void convert(RadioDataConversionState & cstate);
|
||||
|
||||
@@ -2311,7 +2311,8 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, Board::Type board, unsig
|
||||
internalField.Append(new UnsignedField<2>(this, modelData.timers[i].countdownBeep));
|
||||
internalField.Append(new BoolField<1>(this, modelData.timers[i].minuteBeep));
|
||||
internalField.Append(new UnsignedField<2>(this, modelData.timers[i].persistent));
|
||||
internalField.Append(new SpareBitsField<3>(this));
|
||||
internalField.Append(new SignedField<2>(this, modelData.timers[i].countdownStart));
|
||||
internalField.Append(new UnsignedField<1>(this, modelData.timers[i].direction));
|
||||
if (HAS_LARGE_LCD(board))
|
||||
internalField.Append(new ZCharField<8>(this, modelData.timers[i].name, "Timer name"));
|
||||
else
|
||||
|
||||
@@ -73,13 +73,20 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, Ge
|
||||
ui->persistent->addItem(tr("Not persistent"), 0);
|
||||
ui->persistent->addItem(tr("Persistent (flight)"), 1);
|
||||
ui->persistent->addItem(tr("Persistent (manual reset)"), 2);
|
||||
|
||||
ui->countdownStart->setField(timer.countdownStart, this);
|
||||
ui->countdownStart->addItem("5s", 1);
|
||||
ui->countdownStart->addItem("10s", 0);
|
||||
ui->countdownStart->addItem("20s", -1);
|
||||
ui->countdownStart->addItem("30s", -2);
|
||||
|
||||
disableMouseScrolling();
|
||||
QWidget::setTabOrder(prevFocus, ui->name);
|
||||
QWidget::setTabOrder(ui->name, ui->value);
|
||||
QWidget::setTabOrder(ui->value, ui->mode);
|
||||
QWidget::setTabOrder(ui->mode, ui->countdownBeep);
|
||||
QWidget::setTabOrder(ui->countdownBeep, ui->minuteBeep);
|
||||
QWidget::setTabOrder(ui->countdownBeep, ui->countdownStart);
|
||||
QWidget::setTabOrder(ui->countdownStart, ui->minuteBeep);
|
||||
QWidget::setTabOrder(ui->minuteBeep, ui->persistent);
|
||||
|
||||
update();
|
||||
@@ -121,6 +128,7 @@ void TimerPanel::update()
|
||||
ui->countdownBeep->updateValue();
|
||||
ui->minuteBeep->setChecked(timer.minuteBeep);
|
||||
ui->persistent->updateValue();
|
||||
ui->countdownStart->updateValue();
|
||||
lock = false;
|
||||
}
|
||||
|
||||
@@ -129,6 +137,14 @@ QWidget * TimerPanel::getLastFocus()
|
||||
return ui->persistent;
|
||||
}
|
||||
|
||||
void TimerPanel::on_countdownBeep_currentIndexChanged(int index)
|
||||
{
|
||||
if(index == TimerData::COUNTDOWN_SILENT)
|
||||
ui->countdownStart->hide();
|
||||
else
|
||||
ui->countdownStart->show();
|
||||
}
|
||||
|
||||
void TimerPanel::on_value_editingFinished()
|
||||
{
|
||||
if (!lock) {
|
||||
|
||||
@@ -51,6 +51,7 @@ class TimerPanel : public ModelPanel
|
||||
void onModeChanged(int index);
|
||||
void on_value_editingFinished();
|
||||
void on_minuteBeep_toggled(bool checked);
|
||||
void on_countdownBeep_currentIndexChanged(int index);
|
||||
void on_name_editingFinished();
|
||||
void onItemModelAboutToBeUpdated();
|
||||
void onItemModelUpdateComplete();
|
||||
|
||||
@@ -20,7 +20,16 @@
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@@ -59,6 +68,9 @@
|
||||
<item>
|
||||
<widget class="AutoComboBox" name="countdownBeep"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="AutoComboBox" name="countdownStart"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="minuteBeep">
|
||||
<property name="text">
|
||||
|
||||
@@ -236,7 +236,8 @@ inline uint8_t MODULE_SUBTYPE_ROWS(int moduleIdx)
|
||||
}
|
||||
|
||||
#define POT_WARN_ROWS ((g_model.potsWarnMode) ? (uint8_t)(NUM_POTS+NUM_SLIDERS) : (uint8_t)0)
|
||||
#define TIMER_ROWS 2, 0, 0, 0, 0
|
||||
#define TIMER_ROWS(x) 2, 0, 0, 0, g_model.timers[x].countdownBeep != COUNTDOWN_SILENT ? (uint8_t)1 : (uint8_t)0
|
||||
#define TIMERS_ROWS TIMER_ROWS(0), TIMER_ROWS(1), TIMER_ROWS(2)
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
#define EXTRA_MODULE_ROWS LABEL(ExtraModule), 1, 2,
|
||||
@@ -306,6 +307,27 @@ void onBluetoothConnectMenu(const char * result)
|
||||
}
|
||||
#endif
|
||||
|
||||
void editTimerCountdown(int timerIdx, coord_t y, LcdFlags attr, event_t event)
|
||||
{
|
||||
TimerData & timer = g_model.timers[timerIdx];
|
||||
lcdDrawTextAlignedLeft(y, STR_BEEPCOUNTDOWN);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VBEEPCOUNTDOWN, timer.countdownBeep, (menuHorizontalPosition == 0 ? attr : 0));
|
||||
if (timer.countdownBeep != COUNTDOWN_SILENT) {
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN + 6 * FW, y, TIMER_COUNTDOWN_START(timerIdx), (menuHorizontalPosition == 1 ? attr : 0) | LEFT);
|
||||
lcdDrawChar(lcdLastRightPos, y, 's');
|
||||
}
|
||||
if (attr && s_editMode > 0) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, timer.countdownBeep, COUNTDOWN_SILENT, COUNTDOWN_COUNT - 1);
|
||||
break;
|
||||
case 1:
|
||||
timer.countdownStart = -checkIncDecModel(event, -timer.countdownStart, -1, +2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "common/stdlcd/model_setup_pxx1.cpp"
|
||||
|
||||
#if defined(PXX2)
|
||||
@@ -375,9 +397,7 @@ void menuModelSetup(event_t event)
|
||||
MENU_TAB({
|
||||
HEADER_LINE_COLUMNS
|
||||
0,
|
||||
TIMER_ROWS,
|
||||
TIMER_ROWS,
|
||||
TIMER_ROWS,
|
||||
TIMERS_ROWS,
|
||||
0, // Extended limits
|
||||
1, // Extended trims
|
||||
0, // Show trims
|
||||
@@ -489,7 +509,7 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
|
||||
LcdFlags blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||
LcdFlags blink = ((s_editMode > 0) ? BLINK|INVERS : INVERS);
|
||||
LcdFlags attr = (sub == k ? blink : 0);
|
||||
|
||||
switch (k) {
|
||||
@@ -520,7 +540,7 @@ void menuModelSetup(event_t event)
|
||||
timerMode += TMRMODE_COUNT-1;
|
||||
timer->mode = timerMode;
|
||||
#if defined(AUTOSWITCH)
|
||||
if (s_editMode>0) {
|
||||
if (s_editMode > 0) {
|
||||
int8_t val = timer->mode - (TMRMODE_COUNT-1);
|
||||
int8_t switchVal = checkIncDecMovedSwitch(val);
|
||||
if (val != switchVal) {
|
||||
@@ -568,8 +588,7 @@ void menuModelSetup(event_t event)
|
||||
case ITEM_MODEL_SETUP_TIMER2_COUNTDOWN_BEEP:
|
||||
case ITEM_MODEL_SETUP_TIMER3_COUNTDOWN_BEEP:
|
||||
{
|
||||
TimerData * timer = &g_model.timers[k>=ITEM_MODEL_SETUP_TIMER3 ? 2 : (k>=ITEM_MODEL_SETUP_TIMER2 ? 1 : 0)];
|
||||
timer->countdownBeep = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, STR_VBEEPCOUNTDOWN, timer->countdownBeep, COUNTDOWN_SILENT, COUNTDOWN_COUNT-1, attr, event);
|
||||
editTimerCountdown(k>=ITEM_MODEL_SETUP_TIMER3 ? 2 : (k>=ITEM_MODEL_SETUP_TIMER2 ? 1 : 0), y, attr, event);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user