From a3344f399b01051eb6a0ba9a449d80e1a5b66432 Mon Sep 17 00:00:00 2001 From: bsongis Date: Wed, 2 Apr 2014 14:21:07 +0200 Subject: [PATCH] Fixes #904 --- companion/src/eeprominterface.h | 1 + .../src/firmwares/opentx/opentxeeprom.cpp | 4 +- companion/src/generaledit.cpp | 15 ++- companion/src/generaledit.h | 3 +- companion/src/generaledit.ui | 106 +++++++++++++----- radio/src/gui/menu_general.cpp | 12 ++ radio/src/myeeprom.h | 4 +- radio/src/opentx.cpp | 2 - radio/src/opentx.h | 8 ++ 9 files changed, 123 insertions(+), 32 deletions(-) diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index 15ee10c48..ef41134d2 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -451,6 +451,7 @@ class GeneralSettings { bool frskyinternalalarm; bool disableBG; unsigned int splashMode; + int splashDuration; uint8_t filterInput; // TODO enum unsigned int backlightDelay; bool blightinv; diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index 5f7d277ac..4135e33ca 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -2573,7 +2573,9 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo internalField.Append(new BoolField<1>(generalData.minuteBeep)); internalField.Append(new BoolField<1>(generalData.preBeep)); } - if (version >= 213 || (!IS_ARM(board) && version >= 212)) + if (version >= 216 && IS_TARANIS(board)) + internalField.Append(new SignedField<3>(generalData.splashDuration)); + else if (version >= 213 || (!IS_ARM(board) && version >= 212)) internalField.Append(new UnsignedField<3>(generalData.splashMode)); // TODO else internalField.Append(new SpareBitsField<3>()); diff --git a/companion/src/generaledit.cpp b/companion/src/generaledit.cpp index 8db6ad4aa..403a4b8e8 100644 --- a/companion/src/generaledit.cpp +++ b/companion/src/generaledit.cpp @@ -226,7 +226,14 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) : ui->memwarnChkB->setChecked(!g_eeGeneral.disableMemoryWarning); //Default is zero=checked ui->alarmwarnChkB->setChecked(!g_eeGeneral.disableAlarmWarning);//Default is zero=checked - ui->splashScreenChkB->setChecked(!g_eeGeneral.splashMode); + if (IS_TARANIS(GetEepromInterface()->getBoard())) { + ui->splashScreenChkB->hide(); + ui->splashScreenDuration->setCurrentIndex(3-g_eeGeneral.splashDuration); + } + else { + ui->splashScreenDuration->hide(); + ui->splashScreenChkB->setChecked(!g_eeGeneral.splashMode); + } ui->trnMode_1->setCurrentIndex(g_eeGeneral.trainer.mix[0].mode); ui->trnChn_1->setCurrentIndex(g_eeGeneral.trainer.mix[0].src); @@ -853,6 +860,12 @@ void GeneralEdit::on_splashScreenChkB_stateChanged(int ) updateSettings(); } +void GeneralEdit::on_splashScreenDuration_currentIndexChanged(int index) +{ + g_eeGeneral.splashDuration = 3-index; + updateSettings(); +} + void GeneralEdit::on_PPM_MultiplierDSB_editingFinished() { g_eeGeneral.PPM_Multiplier = (int)(ui->PPM_MultiplierDSB->value()*10)-10; diff --git a/companion/src/generaledit.h b/companion/src/generaledit.h index 0f0be0fdc..395adc24c 100644 --- a/companion/src/generaledit.h +++ b/companion/src/generaledit.h @@ -43,7 +43,8 @@ private slots: void on_hapticmodeCB_currentIndexChanged(int index); void on_hapticLengthCB_currentIndexChanged(int index); void on_PPM_MultiplierDSB_editingFinished(); - void on_splashScreenChkB_stateChanged(int ); + void on_splashScreenChkB_stateChanged(int); + void on_splashScreenDuration_currentIndexChanged(int index); void on_alarmwarnChkB_stateChanged(int ); void on_gpsFormatCB_currentIndexChanged(int index); void on_tabWidget_currentChanged(int index); diff --git a/companion/src/generaledit.ui b/companion/src/generaledit.ui index 700289578..25c39643e 100644 --- a/companion/src/generaledit.ui +++ b/companion/src/generaledit.ui @@ -106,7 +106,7 @@ These will be relevant for all models in the same EEPROM. - 1 + 0 @@ -1582,31 +1582,6 @@ p, li { white-space: pre-wrap; } - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Show splash screen on startup - - - Show splash screen on startup - - - - - - @@ -1850,6 +1825,85 @@ Acceptable values are 5v..10v + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Show splash screen on startup + + + Show splash screen on startup + + + + + + + + + + + 0 + 0 + + + + + --- + + + + + 2s + + + + + 3s + + + + + 4s + + + + + 6s + + + + + 8s + + + + + 10s + + + + + 15s + + + + + + diff --git a/radio/src/gui/menu_general.cpp b/radio/src/gui/menu_general.cpp index c046506f7..a40969365 100644 --- a/radio/src/gui/menu_general.cpp +++ b/radio/src/gui/menu_general.cpp @@ -546,8 +546,20 @@ void menuGeneralSetup(uint8_t event) #if defined(SPLASH) && !defined(FSPLASH) case ITEM_SETUP_DISABLE_SPLASH: { +#if defined(PCBTARANIS) + lcd_putsLeft(y, STR_SPLASHSCREEN); + if (SPLASH_NEEDED()) { + lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, SPLASH_TIMEOUT/100, attr|LEFT); + lcd_putc(lcdLastPos, y, 's'); + } + else { + lcd_putsiAtt(RADIO_SETUP_2ND_COLUMN, y, STR_MMMINV, 0, attr); + } + if (attr) g_eeGeneral.splashMode = -checkIncDecGen(event, -g_eeGeneral.splashMode, -3, 4); +#else uint8_t b = 1-g_eeGeneral.splashMode; g_eeGeneral.splashMode = 1 - onoffMenuItem(b, RADIO_SETUP_2ND_COLUMN, y, STR_SPLASHSCREEN, attr, event); +#endif break; } #endif diff --git a/radio/src/myeeprom.h b/radio/src/myeeprom.h index 514f730fb..b928c6d10 100644 --- a/radio/src/myeeprom.h +++ b/radio/src/myeeprom.h @@ -339,8 +339,10 @@ enum BacklightMode { #if defined(FSPLASH) #define SPLASH_MODE uint8_t splashMode:3 +#elif defined(PCBTARANIS) + #define SPLASH_MODE int8_t splashMode:3 #else - #define SPLASH_MODE uint8_t splashMode:1; uint8_t spare4:2 + #define SPLASH_MODE uint8_t splashMode:1; uint8_t splashSpare:2 #endif #define XPOTS_MULTIPOS_COUNT 6 diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 02ea5ec12..e7740be1e 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -2238,8 +2238,6 @@ bool readonlyUnlocked() #if defined(SPLASH) -#define SPLASH_NEEDED() (!IS_DSM2_PROTOCOL(g_model.protocol) && !g_eeGeneral.splashMode) - inline void Splash() { lcd_clear(); diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 672008c58..6ad817145 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -523,8 +523,16 @@ enum BaseCurves { #define THRCHK_DEADBAND 16 +#if defined(PCBTARANIS) + #define SPLASH_NEEDED() (g_eeGeneral.splashMode != 3) +#else + #define SPLASH_NEEDED() (!IS_DSM2_PROTOCOL(g_model.protocol) && !g_eeGeneral.splashMode) +#endif + #if defined(FSPLASH) #define SPLASH_TIMEOUT (g_eeGeneral.splashMode == 0 ? 60000/*infinite=10mn*/ : ((4*100) * (g_eeGeneral.splashMode & 0x03))) +#elif defined(PCBTARANIS) + #define SPLASH_TIMEOUT (g_eeGeneral.splashMode==-4 ? 1500 : (g_eeGeneral.splashMode<=0 ? (400-g_eeGeneral.splashMode*200) : (400-g_eeGeneral.splashMode*100))) #else #define SPLASH_TIMEOUT (4*100) // 4 seconds #endif