diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp index 1df1f4e98..d97b8cf1a 100644 --- a/companion/src/eeprominterface.cpp +++ b/companion/src/eeprominterface.cpp @@ -539,9 +539,9 @@ QString LogicalSwitchData::toString(const ModelData & model) if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) { if (delay) - result += QObject::tr(" Delay %1 sec").arg(delay/2.0); + result += QObject::tr(" Delay %1 sec").arg(delay/10.0); if (duration) - result += QObject::tr(" Duration %1 sec").arg(duration/2.0); + result += QObject::tr(" Duration %1 sec").arg(duration/10.0); } return result; diff --git a/companion/src/modeledit/customswitches.cpp b/companion/src/modeledit/customswitches.cpp index cf02f4430..ad418df68 100644 --- a/companion/src/modeledit/customswitches.cpp +++ b/companion/src/modeledit/customswitches.cpp @@ -85,8 +85,8 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model): // Duration cswitchDuration[i] = new QDoubleSpinBox(this); cswitchDuration[i]->setProperty("index", i); - cswitchDuration[i]->setSingleStep(0.5); - cswitchDuration[i]->setMaximum(50); + cswitchDuration[i]->setSingleStep(0.1); + cswitchDuration[i]->setMaximum(25); cswitchDuration[i]->setMinimum(0); cswitchDuration[i]->setAccelerated(true); cswitchDuration[i]->setDecimals(1); @@ -96,8 +96,8 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model): // Delay cswitchDelay[i] = new QDoubleSpinBox(this); cswitchDelay[i]->setProperty("index", i); - cswitchDelay[i]->setSingleStep(0.5); - cswitchDelay[i]->setMaximum(50); + cswitchDelay[i]->setSingleStep(0.1); + cswitchDelay[i]->setMaximum(25); cswitchDelay[i]->setMinimum(0); cswitchDelay[i]->setAccelerated(true); cswitchDelay[i]->setDecimals(1); @@ -164,14 +164,14 @@ void LogicalSwitchesPanel::andEdited(int value) void LogicalSwitchesPanel::durationEdited(double duration) { int index = sender()->property("index").toInt(); - model.customSw[index].duration = (uint8_t)round(duration*2); + model.customSw[index].duration = (uint8_t)round(duration*10); emit modified(); } void LogicalSwitchesPanel::delayEdited(double delay) { int index = sender()->property("index").toInt(); - model.customSw[index].delay = (uint8_t)round(delay*2); + model.customSw[index].delay = (uint8_t)round(delay*10); emit modified(); } @@ -325,8 +325,8 @@ void LogicalSwitchesPanel::update() lock = true; populateAndSwitchCB(cswitchAnd[i], RawSwitch(model.customSw[i].andsw)); if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) { - cswitchDuration[i]->setValue(model.customSw[i].duration/2.0); - cswitchDelay[i]->setValue(model.customSw[i].delay/2.0); + cswitchDuration[i]->setValue(model.customSw[i].duration/10.0); + cswitchDelay[i]->setValue(model.customSw[i].delay/10.0); } lock = false; } diff --git a/radio/src/eeprom_conversions.cpp b/radio/src/eeprom_conversions.cpp index f12353cb0..15abd195e 100644 --- a/radio/src/eeprom_conversions.cpp +++ b/radio/src/eeprom_conversions.cpp @@ -470,8 +470,8 @@ void ConvertModel_215_to_216(ModelData &model) if (sw.func >= LS_FUNC_STAY) sw.func += 1; sw.v1 = oldModel.customSw[i].v1; sw.v2 = oldModel.customSw[i].v2; - sw.delay = oldModel.customSw[i].delay; - sw.duration = oldModel.customSw[i].duration; + sw.delay = oldModel.customSw[i].delay * 5; + sw.duration = oldModel.customSw[i].duration * 5; sw.andsw = ConvertSwitch_215_to_216(oldModel.customSw[i].andsw); #if defined(PCBTARANIS) uint8_t cstate = cswFamily(sw.func); diff --git a/radio/src/gui/menu_model.cpp b/radio/src/gui/menu_model.cpp index d1dd68a46..bb78da5ff 100644 --- a/radio/src/gui/menu_model.cpp +++ b/radio/src/gui/menu_model.cpp @@ -4363,7 +4363,7 @@ void menuModelLogicalSwitchOne(uint8_t event) case LS_FIELD_DURATION: lcd_putsLeft(y, STR_DURATION); if (cs->duration > 0) - lcd_outdezAtt(CSWONE_2ND_COLUMN, y, 5*cs->duration, attr|PREC1|LEFT); + lcd_outdezAtt(CSWONE_2ND_COLUMN, y, cs->duration, attr|PREC1|LEFT); else lcd_putsiAtt(CSWONE_2ND_COLUMN, y, STR_MMMINV, 0, attr); if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, cs->duration, MAX_LS_DURATION); @@ -4371,7 +4371,7 @@ void menuModelLogicalSwitchOne(uint8_t event) case LS_FIELD_DELAY: lcd_putsLeft(y, STR_DELAY); if (cs->delay > 0) - lcd_outdezAtt(CSWONE_2ND_COLUMN, y, 5*cs->delay, attr|PREC1|LEFT); + lcd_outdezAtt(CSWONE_2ND_COLUMN, y, cs->delay, attr|PREC1|LEFT); else lcd_putsiAtt(CSWONE_2ND_COLUMN, y, STR_MMMINV, 0, attr); if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, cs->delay, MAX_LS_DELAY); diff --git a/radio/src/myeeprom.h b/radio/src/myeeprom.h index 94b6cbb9e..dc427485a 100644 --- a/radio/src/myeeprom.h +++ b/radio/src/myeeprom.h @@ -712,8 +712,8 @@ enum LogicalSwitchesFunctions { }; #if defined(CPUARM) -#define MAX_LS_DURATION 120 /*60s*/ -#define MAX_LS_DELAY 120 /*60s*/ +#define MAX_LS_DURATION 250 /*25s*/ +#define MAX_LS_DELAY 250 /*25s*/ #define MAX_LS_ANDSW SWSRC_LAST typedef int16_t ls_telemetry_value_t; PACK(typedef struct t_LogicalSwitchData { // Custom Switches data diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 36d95d213..75e41dd80 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -1589,13 +1589,13 @@ bool getSwitch(int8_t swtch) result = false; } else { - cswDelays[cs_idx] = get_tmr10ms() + (cs->delay*50); + cswDelays[cs_idx] = get_tmr10ms() + (cs->delay*10); } } if (cs->duration) { if (result && !cswStates[cs_idx]) { - cswDurations[cs_idx] = get_tmr10ms() + (cs->duration*50); + cswDurations[cs_idx] = get_tmr10ms() + (cs->duration*10); } cswStates[cs_idx] = result;