RssiPowerOff alarm enabled by default (#5129)

* RssiPowerOff alarm enabled by default
+ Companion support

* Fix continuously toggling RSSI on shutdown setting on X9
This commit is contained in:
Bertrand Songis
2017-08-04 11:01:52 +02:00
committed by Andre Bernet
parent 6304f0daf6
commit 76e72c8a86
12 changed files with 147 additions and 88 deletions
@@ -95,7 +95,6 @@ Er9xGeneral::operator GeneralSettings ()
result.view = std::min((uint8_t)4, view);
result.disableThrottleWarning = disableThrottleWarning;
result.switchWarning = disableSwitchWarning ? 0 : -1;
result.disableMemoryWarning = disableMemoryWarning;
switch (beeperVal) {
@@ -120,7 +120,6 @@ Ersky9xGeneral::operator GeneralSettings ()
result.trainer = trainer;
result.view = std::min((uint8_t)4, view);
result.disableThrottleWarning = disableThrottleWarning;
result.switchWarning = disableSwitchWarning ? 0 : -1;
result.disableMemoryWarning = disableMemoryWarning;
switch (beeperVal) {
@@ -3673,7 +3673,8 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type
internalField.Append(new UnsignedField<1>(this, generalData.imperial));
if (version >= 218) {
internalField.Append(new BoolField<1>(this, generalData.jitterFilter));
internalField.Append(new SpareBitsField<6>(this));
internalField.Append(new BoolField<1>(this, generalData.disableRssiPoweroffAlarm));
internalField.Append(new SpareBitsField<5>(this));
}
else {
internalField.Append(new SpareBitsField<7>(this));
+18 -5
View File
@@ -197,7 +197,7 @@ ui(new Ui::GeneralSetup)
}
int reCount = firmware->getCapability(RotaryEncoders);
if (reCount==0) {
if (reCount == 0) {
ui->re_label->hide();
ui->re_CB->hide();
}
@@ -210,8 +210,15 @@ ui(new Ui::GeneralSetup)
ui->backlightautoSB->setValue(generalSettings.backlightDelay*5);
ui->inactimerSB->setValue(generalSettings.inactivityTimer);
ui->memwarnChkB->setChecked(!generalSettings.disableMemoryWarning); //Default is zero=checked
ui->alarmwarnChkB->setChecked(!generalSettings.disableAlarmWarning);//Default is zero=checked
ui->memwarnChkB->setChecked(!generalSettings.disableMemoryWarning); // Default is zero=checked
ui->alarmwarnChkB->setChecked(!generalSettings.disableAlarmWarning); // Default is zero=checked
if (IS_ARM(firmware->getBoard())) {
ui->rssiPowerOffWarnChkB->setChecked(!generalSettings.disableRssiPoweroffAlarm); // Default is zero=checked
}
else {
ui->rssiPowerOffWarnChkB->hide();
}
if (IS_HORUS(firmware->getBoard())) {
ui->splashScreenChkB->hide();
@@ -607,18 +614,24 @@ void GeneralSetupPanel::on_inactimerSB_editingFinished()
emit modified();
}
void GeneralSetupPanel::on_memwarnChkB_stateChanged(int )
void GeneralSetupPanel::on_memwarnChkB_stateChanged(int)
{
generalSettings.disableMemoryWarning = ui->memwarnChkB->isChecked() ? 0 : 1;
emit modified();
}
void GeneralSetupPanel::on_alarmwarnChkB_stateChanged(int )
void GeneralSetupPanel::on_alarmwarnChkB_stateChanged(int)
{
generalSettings.disableAlarmWarning = ui->alarmwarnChkB->isChecked() ? 0 : 1;
emit modified();
}
void GeneralSetupPanel::on_rssiPowerOffWarnChkB_stateChanged(int)
{
generalSettings.disableRssiPoweroffAlarm = ui->rssiPowerOffWarnChkB->isChecked() ? 0 : 1;
emit modified();
}
void GeneralSetupPanel::on_beeperCB_currentIndexChanged(int index)
{
generalSettings.beeperMode = (GeneralSettings::BeeperMode)(index-2);
+1
View File
@@ -40,6 +40,7 @@ class GeneralSetupPanel : public GeneralPanel
void on_splashScreenChkB_stateChanged(int);
void on_splashScreenDuration_currentIndexChanged(int index);
void on_alarmwarnChkB_stateChanged(int);
void on_rssiPowerOffWarnChkB_stateChanged(int);
void on_gpsFormatCB_currentIndexChanged(int index);
void on_displayTypeCB_currentIndexChanged(int index);
void on_BLBright_SB_editingFinished();
+111 -57
View File
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>782</width>
<height>694</height>
<width>806</width>
<height>801</height>
</rect>
</property>
<property name="windowTitle">
@@ -1121,7 +1121,7 @@ p, li { white-space: pre-wrap; }
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item row="14" column="1">
<item row="15" column="1">
<widget class="QComboBox" name="stickmodeCB">
<property name="toolTip">
<string/>
@@ -1175,7 +1175,7 @@ Mode 4:
</item>
</widget>
</item>
<item row="15" column="1">
<item row="16" column="1">
<widget class="QComboBox" name="channelorderCB">
<property name="toolTip">
<string/>
@@ -1311,14 +1311,14 @@ Mode 4:
</item>
</widget>
</item>
<item row="14" column="0">
<item row="15" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Stick Mode</string>
</property>
</widget>
</item>
<item row="16" column="1">
<item row="17" column="1">
<widget class="QComboBox" name="units_CB">
<item>
<property name="text">
@@ -1332,7 +1332,7 @@ Mode 4:
</item>
</widget>
</item>
<item row="15" column="0">
<item row="16" column="0">
<widget class="QLabel" name="label_13">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
@@ -1345,14 +1345,14 @@ Mode 4:
</property>
</widget>
</item>
<item row="17" column="0">
<item row="18" column="0">
<widget class="QLabel" name="gpsFormatLabel">
<property name="text">
<string>GPS Coordinates</string>
</property>
</widget>
</item>
<item row="18" column="1">
<item row="19" column="1">
<widget class="QSpinBox" name="switchesDelay">
<property name="toolTip">
<string/>
@@ -1462,7 +1462,7 @@ p, li { white-space: pre-wrap; }
</size>
</property>
<property name="text">
<string>Low Memory Warning</string>
<string>Low EEPROM Warning</string>
</property>
</widget>
</item>
@@ -1643,7 +1643,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="13" column="0">
<item row="14" column="0">
<widget class="QLabel" name="mavbaud_label">
<property name="minimumSize">
<size>
@@ -1939,7 +1939,7 @@ Acceptable values are 5v..10v</string>
</item>
</layout>
</item>
<item row="13" column="1" colspan="2">
<item row="14" column="1" colspan="2">
<widget class="QComboBox" name="mavbaud_CB">
<item>
<property name="text">
@@ -2024,6 +2024,20 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="18" column="1">
<widget class="QComboBox" name="gpsFormatCB">
<item>
<property name="text">
<string>hh° (N/S) mm' ss''.dd</string>
</property>
</item>
<item>
<property name="text">
<string>NMEA</string>
</property>
</item>
</widget>
</item>
<item row="12" column="1" colspan="2">
<widget class="QCheckBox" name="memwarnChkB">
<property name="sizePolicy">
@@ -2100,21 +2114,7 @@ p, li { white-space: pre-wrap; }
</item>
</widget>
</item>
<item row="17" column="1">
<widget class="QComboBox" name="gpsFormatCB">
<item>
<property name="text">
<string>hh° (N/S) mm' ss''.dd</string>
</property>
</item>
<item>
<property name="text">
<string>NMEA</string>
</property>
</item>
</widget>
</item>
<item row="18" column="0">
<item row="19" column="0">
<widget class="QLabel" name="switchesDelayLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
@@ -2127,14 +2127,14 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="16" column="0">
<item row="17" column="0">
<widget class="QLabel" name="units_label">
<property name="text">
<string>Measurement Units</string>
</property>
</widget>
</item>
<item row="19" column="0">
<item row="20" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -2185,6 +2185,47 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="beeperlenCB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
<item>
<property name="text">
<string>X-Short</string>
</property>
</item>
<item>
<property name="text">
<string>Short</string>
</property>
</item>
<item>
<property name="text">
<string>Normal</string>
</property>
</item>
<item>
<property name="text">
<string>Long</string>
</property>
</item>
<item>
<property name="text">
<string>X-Long</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_12">
<property name="sizePolicy">
@@ -2255,8 +2296,8 @@ p, li { white-space: pre-wrap; }
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="beeperlenCB">
<item row="13" column="0">
<widget class="QLabel" name="label_15">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
@@ -2266,34 +2307,47 @@ p, li { white-space: pre-wrap; }
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
<height>0</height>
</size>
</property>
<item>
<property name="text">
<string>X-Short</string>
</property>
</item>
<item>
<property name="text">
<string>Short</string>
</property>
</item>
<item>
<property name="text">
<string>Normal</string>
</property>
</item>
<item>
<property name="text">
<string>Long</string>
</property>
</item>
<item>
<property name="text">
<string>X-Long</string>
</property>
</item>
<property name="text">
<string>RSSI Poweroff Warning</string>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QCheckBox" name="rssiPowerOffWarnChkB">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="whatsThis">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; text-decoration: underline;&quot;&gt;Warnings&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;These will define startup warnings.&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Throttle warning - will alert if the throttle is not at idle during startup&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Switch warning - will alert if switches are not in their defaul position&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Memory warning - will alert if there's not a lot of memory left&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Silent mode warning - will alert you if the beeper is set to quiet (0)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
+1 -2
View File
@@ -1168,11 +1168,10 @@ class GeneralSettings {
unsigned int view; // main screen view // TODO enum
bool disableThrottleWarning;
bool fai;
int switchWarning; // -1=down, 0=off, 1=up
bool disableMemoryWarning;
BeeperMode beeperMode;
bool disableAlarmWarning;
bool enableTelemetryAlarm;
bool disableRssiPoweroffAlarm;
BeeperMode hapticMode;
unsigned int stickMode; // TODO enum
int timezone;
+1 -1
View File
@@ -894,7 +894,7 @@ PACK(struct TrainerData {
NOBACKUP(uint8_t countryCode); \
NOBACKUP(uint8_t imperial:1); \
NOBACKUP(uint8_t jitterFilter:1); /* 0 - active */\
NOBACKUP(uint8_t rssiPoweroffAlarm:1); \
NOBACKUP(uint8_t disableRssiPoweroffAlarm:1); \
NOBACKUP(uint8_t spareExtraArm:5); \
NOBACKUP(char ttsLanguage[2]); \
NOBACKUP(int8_t beepVolume:4); \
+3 -2
View File
@@ -383,7 +383,7 @@ void menuRadioSetup(event_t event)
case ITEM_SETUP_ALARM_WARNING:
{
uint8_t b = 1-g_eeGeneral.disableAlarmWarning;
uint8_t b = 1 - g_eeGeneral.disableAlarmWarning;
g_eeGeneral.disableAlarmWarning = 1 - editCheckBox(b, RADIO_SETUP_2ND_COLUMN, y, STR_ALARMWARNING, attr, event);
break;
}
@@ -391,7 +391,8 @@ void menuRadioSetup(event_t event)
#if defined(CPUARM)
case ITEM_SETUP_RSSI_POWEROFF_ALARM:
{
g_eeGeneral.rssiPoweroffAlarm = editCheckBox(g_eeGeneral.rssiPoweroffAlarm, RADIO_SETUP_2ND_COLUMN, y, STR_RSSISHUTDOWNALARM, attr, event);
uint8_t b = 1 - g_eeGeneral.disableRssiPoweroffAlarm;
g_eeGeneral.disableRssiPoweroffAlarm = 1 - editCheckBox(b, RADIO_SETUP_2ND_COLUMN, y, STR_RSSISHUTDOWNALARM, attr, event);
break;
}
#endif
+4 -3
View File
@@ -332,21 +332,22 @@ void menuRadioSetup(event_t event)
case ITEM_SETUP_MEMORY_WARNING:
{
uint8_t b = 1-g_eeGeneral.disableMemoryWarning;
uint8_t b = 1 - g_eeGeneral.disableMemoryWarning;
g_eeGeneral.disableMemoryWarning = 1 - editCheckBox(b, RADIO_SETUP_2ND_COLUMN, y, STR_MEMORYWARNING, attr, event);
break;
}
case ITEM_SETUP_ALARM_WARNING:
{
uint8_t b = 1-g_eeGeneral.disableAlarmWarning;
uint8_t b = 1 - g_eeGeneral.disableAlarmWarning;
g_eeGeneral.disableAlarmWarning = 1 - editCheckBox(b, RADIO_SETUP_2ND_COLUMN, y, STR_ALARMWARNING, attr, event);
break;
}
case ITEM_SETUP_RSSI_POWEROFF_ALARM:
{
g_eeGeneral.rssiPoweroffAlarm = editCheckBox(g_eeGeneral.rssiPoweroffAlarm, RADIO_SETUP_2ND_COLUMN, y, STR_RSSISHUTDOWNALARM, attr, event);
uint8_t b = 1 - g_eeGeneral.disableRssiPoweroffAlarm;
g_eeGeneral.disableRssiPoweroffAlarm = 1 - editCheckBox(b, RADIO_SETUP_2ND_COLUMN, y, STR_RSSISHUTDOWNALARM, attr, event);
break;
}
+3 -12
View File
@@ -331,20 +331,10 @@ bool menuRadioSetup(event_t event)
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.vBatWarn, 40, 120); //4-12V
break;
#if 0
case ITEM_SETUP_MEMORY_WARNING:
{
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MEMORYWARNING);
uint8_t b = 1-g_eeGeneral.disableMemoryWarning;
g_eeGeneral.disableMemoryWarning = 1 - editCheckBox(b, RADIO_SETUP_2ND_COLUMN, y, attr, event);
break;
}
#endif
case ITEM_SETUP_ALARM_WARNING:
{
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_ALARMWARNING);
uint8_t b = 1-g_eeGeneral.disableAlarmWarning;
uint8_t b = 1 - g_eeGeneral.disableAlarmWarning;
g_eeGeneral.disableAlarmWarning = 1 - editCheckBox(b, RADIO_SETUP_2ND_COLUMN, y, attr, event);
break;
}
@@ -352,7 +342,8 @@ bool menuRadioSetup(event_t event)
case ITEM_SETUP_RSSI_POWEROFF_ALARM:
{
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_RSSISHUTDOWNALARM);
g_eeGeneral.rssiPoweroffAlarm = editCheckBox(g_eeGeneral.rssiPoweroffAlarm, RADIO_SETUP_2ND_COLUMN, y, attr, event);
uint8_t b = 1 - g_eeGeneral.disableRssiPoweroffAlarm;
g_eeGeneral.disableRssiPoweroffAlarm = 1 - editCheckBox(b, RADIO_SETUP_2ND_COLUMN, y, attr, event);
break;
}
+3 -3
View File
@@ -2763,7 +2763,7 @@ uint32_t pwrCheck()
}
else if (pwr_press_time == 0) {
pwr_press_time = get_tmr10ms();
if (message && g_eeGeneral.rssiPoweroffAlarm) {
if (message && !g_eeGeneral.disableRssiPoweroffAlarm) {
audioEvent(AU_MODEL_STILL_POWERED);
}
}
@@ -2792,7 +2792,7 @@ uint32_t pwrCheck()
}
}
#else
while ((TELEMETRY_STREAMING() && g_eeGeneral.rssiPoweroffAlarm)) {
while ((TELEMETRY_STREAMING() && !g_eeGeneral.disableRssiPoweroffAlarm)) {
lcdRefreshWait();
lcdClear();
POPUP_CONFIRMATION("Confirm Shutdown");
@@ -2846,7 +2846,7 @@ uint32_t pwrCheck()
}
#endif
if (g_eeGeneral.rssiPoweroffAlarm) {
if (!g_eeGeneral.disableRssiPoweroffAlarm) {
if (TELEMETRY_STREAMING()) {
RAISE_ALERT(STR_MODEL, STR_MODEL_STILL_POWERED, STR_PRESS_ENTER_TO_CONFIRM, AU_MODEL_STILL_POWERED);
while (TELEMETRY_STREAMING()) {