diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp
index cc266de4f..eeceb1d05 100644
--- a/companion/src/eeprominterface.cpp
+++ b/companion/src/eeprominterface.cpp
@@ -928,9 +928,9 @@ GeneralSettings::GeneralSettings()
byte8=(int8_t)t_HapticSet.mid(0,2).toUInt(&ok,16);
if (ok)
hapticMode=(BeeperMode)byte8;
- byte8u=(uint8_t)t_HapticSet.mid(2,2).toUInt(&ok,16);
+ byte8=(int8_t)t_HapticSet.mid(2,2).toInt(&ok,16);
if (ok)
- hapticStrength=byte8u;
+ hapticStrength=byte8;
byte8=(int8_t)t_HapticSet.mid(4,2).toInt(&ok,16);
if (ok)
hapticLength=byte8;
diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h
index a90eef0fa..0666dfd50 100644
--- a/companion/src/eeprominterface.h
+++ b/companion/src/eeprominterface.h
@@ -506,7 +506,7 @@ class GeneralSettings {
bool hideNameOnSplash;
bool enablePpmsim;
unsigned int speakerPitch;
- unsigned int hapticStrength;
+ int hapticStrength;
unsigned int speakerMode;
unsigned int lightOnStickMove; /* er9x / ersky9x only */
char ownerName[10+1];
diff --git a/companion/src/firmwares/er9x/er9xeeprom.cpp b/companion/src/firmwares/er9x/er9xeeprom.cpp
index 8cf91d022..8e4c05636 100644
--- a/companion/src/firmwares/er9x/er9xeeprom.cpp
+++ b/companion/src/firmwares/er9x/er9xeeprom.cpp
@@ -124,7 +124,7 @@ Er9xGeneral::operator GeneralSettings ()
result.PPM_Multiplier = PPM_Multiplier;
getEEPROMString(result.ownerName, ownerName, sizeof(ownerName));
result.speakerPitch = speakerPitch;
- result.hapticStrength = hapticStrength;
+ result.hapticStrength = hapticStrength - 3;
result.speakerMode = speakerMode;
result.switchWarningStates =switchWarningStates;
return result;
diff --git a/companion/src/firmwares/ersky9x/ersky9xeeprom.cpp b/companion/src/firmwares/ersky9x/ersky9xeeprom.cpp
index 2d506243d..6204f8ede 100644
--- a/companion/src/firmwares/ersky9x/ersky9xeeprom.cpp
+++ b/companion/src/firmwares/ersky9x/ersky9xeeprom.cpp
@@ -131,7 +131,7 @@ Ersky9xGeneral::operator GeneralSettings ()
getEEPROMString(result.ownerName, ownerName, sizeof(ownerName));
result.optrexDisplay = optrexDisplay;
result.speakerPitch = speakerPitch;
- result.hapticStrength = hapticStrength;
+ result.hapticStrength = hapticStrength - 3;
result.speakerMode = speakerMode;
result.switchWarningStates = switchWarningStates;
result.speakerVolume = volume;
diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp
index 9aff23c0c..8b39986e1 100644
--- a/companion/src/firmwares/opentx/opentxeeprom.cpp
+++ b/companion/src/firmwares/opentx/opentxeeprom.cpp
@@ -2664,7 +2664,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
}
internalField.Append(new SignedField<3>(generalData.beeperLength));
- internalField.Append(new UnsignedField<3>(generalData.hapticStrength));
+ internalField.Append(new SignedField<3>(generalData.hapticStrength));
internalField.Append(new UnsignedField<1>(generalData.gpsFormat));
internalField.Append(new SpareBitsField<1>()); // unexpectedShutdown
diff --git a/companion/src/generaledit.cpp b/companion/src/generaledit.cpp
index db610616e..25a1cc309 100644
--- a/companion/src/generaledit.cpp
+++ b/companion/src/generaledit.cpp
@@ -200,7 +200,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
}
if (!GetCurrentFirmware()->getCapability(Haptic)) {
- ui->hapticStrengthSB->setDisabled(true);
+ ui->hapticStrength->setDisabled(true);
ui->hapticmodeCB->setDisabled(true);
}
@@ -375,7 +375,7 @@ void GeneralEdit::setValues()
ui->volume_SB->setValue(g_eeGeneral.speakerVolume);
ui->beeperlenCB->setCurrentIndex(g_eeGeneral.beeperLength+2);
ui->speakerPitchSB->setValue(g_eeGeneral.speakerPitch);
- ui->hapticStrengthSB->setValue(g_eeGeneral.hapticStrength);
+ ui->hapticStrength->setValue(g_eeGeneral.hapticStrength);
ui->hapticmodeCB->setCurrentIndex(g_eeGeneral.hapticMode+2);
ui->battCalibDSB->setValue((double)g_eeGeneral.vBatCalib/10);
ui->CurrentCalib_SB->setValue((double)g_eeGeneral.currentCalib);
@@ -914,9 +914,9 @@ void GeneralEdit::on_speakerPitchSB_editingFinished()
updateSettings();
}
-void GeneralEdit::on_hapticStrengthSB_editingFinished()
+void GeneralEdit::on_hapticStrength_valueChanged()
{
- g_eeGeneral.hapticStrength = ui->hapticStrengthSB->value();
+ g_eeGeneral.hapticStrength = ui->hapticStrength->value();
updateSettings();
}
@@ -1018,9 +1018,9 @@ void GeneralEdit::on_calretrieve_PB_clicked()
byte8=(int8_t)HapticSet.mid(0,2).toUInt(&ok,16);
if (ok)
g_eeGeneral.hapticMode=(BeeperMode)byte8;
- byte8u=(uint8_t)HapticSet.mid(2,2).toUInt(&ok,16);
+ byte8=(int8_t)HapticSet.mid(2,2).toInt(&ok,16);
if (ok)
- g_eeGeneral.hapticStrength=byte8u;
+ g_eeGeneral.hapticStrength=byte8;
byte8=(int8_t)HapticSet.mid(4,2).toInt(&ok,16);
if (ok)
g_eeGeneral.hapticLength=byte8;
@@ -1090,7 +1090,7 @@ void GeneralEdit::on_calstore_PB_clicked()
g.profile[profile_id].gsStickMode( g_eeGeneral.stickMode );
g.profile[profile_id].display( QString("%1%2%3").arg((g_eeGeneral.optrexDisplay ? 1:0), 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.contrast, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.backlightBright, 2, 16, QChar('0')) );
g.profile[profile_id].beeper( QString("%1%2").arg(((uint8_t)g_eeGeneral.beeperMode), 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.beeperLength, 2, 16, QChar('0')));
- g.profile[profile_id].haptic( QString("%1%2%3").arg(((uint8_t)g_eeGeneral.hapticMode), 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.hapticStrength, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.hapticLength, 2, 16, QChar('0')));
+ g.profile[profile_id].haptic( QString("%1%2%3").arg(((uint8_t)g_eeGeneral.hapticMode), 2, 16, QChar('0')).arg((int8_t)g_eeGeneral.hapticStrength, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.hapticLength, 2, 16, QChar('0')));
g.profile[profile_id].speaker( QString("%1%2%3").arg((uint8_t)g_eeGeneral.speakerMode, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.speakerPitch, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.speakerVolume, 2, 16, QChar('0')));
g.profile[profile_id].countryCode( QString("%1%2%3").arg((uint8_t)g_eeGeneral.countryCode, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.imperial, 2, 16, QChar('0')).arg(g_eeGeneral.ttsLanguage));
diff --git a/companion/src/generaledit.h b/companion/src/generaledit.h
index f48bb91a0..a383d8fd0 100644
--- a/companion/src/generaledit.h
+++ b/companion/src/generaledit.h
@@ -36,7 +36,7 @@ private slots:
void on_faimode_CB_stateChanged(int );
void on_speakerPitchSB_editingFinished();
void on_timezoneSB_editingFinished();
- void on_hapticStrengthSB_editingFinished();
+ void on_hapticStrength_valueChanged();
void on_soundModeCB_currentIndexChanged(int index);
void on_beeperlenCB_currentIndexChanged(int index);
void on_volume_SB_editingFinished();
diff --git a/companion/src/generaledit.ui b/companion/src/generaledit.ui
index a4a132551..07df3bf7a 100644
--- a/companion/src/generaledit.ui
+++ b/companion/src/generaledit.ui
@@ -113,6 +113,22 @@ These will be relevant for all models in the same EEPROM.
Setup
+ -
+
+
+ -2
+
+
+ 2
+
+
+ 1
+
+
+ Qt::Horizontal
+
+
+
-
-
@@ -421,6 +437,20 @@ Mode 4:
+ -
+
+
-
+
+ Standard
+
+
+ -
+
+ Optrex
+
+
+
+
-
-
@@ -1446,20 +1476,6 @@ Acceptable values are 5v..10v
- -
-
-
-
-
- Standard
-
-
- -
-
- Optrex
-
-
-
-
-
@@ -1723,19 +1739,6 @@ p, li { white-space: pre-wrap; }
- -
-
-
-
- 0
- 0
-
-
-
- 5
-
-
-
-
-
@@ -1836,6 +1839,51 @@ p, li { white-space: pre-wrap; }
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Stick reverse (order as above)
+
+
+
+ -
+
+
-
+
+
+ 1
+
+
+
+ -
+
+
+ 2
+
+
+
+ -
+
+
+ 3
+
+
+
+ -
+
+
+ 4
+
+
+
+
+
-
-
@@ -1932,51 +1980,6 @@ p, li { white-space: pre-wrap; }
- -
-
-
-
- 0
- 0
-
-
-
- Stick reverse (order as above)
-
-
-
- -
-
-
-
-
-
- 1
-
-
-
- -
-
-
- 2
-
-
-
- -
-
-
- 3
-
-
-
- -
-
-
- 4
-
-
-
-
-
diff --git a/radio/src/eeprom_conversions.cpp b/radio/src/eeprom_conversions.cpp
index d37de9cea..c611ad166 100644
--- a/radio/src/eeprom_conversions.cpp
+++ b/radio/src/eeprom_conversions.cpp
@@ -328,6 +328,8 @@ void ConvertGeneralSettings_215_to_216(EEGeneral &settings)
settings.chkSum = evalChkSum();
memcpy(&settings.currModel, &oldSettings.currModel, sizeof(GeneralSettings_v215)-offsetof(GeneralSettings_v215, currModel));
+
+ settings.hapticStrength = 0; // Haptic strength reset
}
int ConvertTelemetrySource_215_to_216(int source)
diff --git a/radio/src/gui/menu_general.cpp b/radio/src/gui/menu_general.cpp
index 6709b81fb..a3639a27b 100644
--- a/radio/src/gui/menu_general.cpp
+++ b/radio/src/gui/menu_general.cpp
@@ -418,11 +418,7 @@ void menuGeneralSetup(uint8_t event)
break;
case ITEM_SETUP_HAPTIC_STRENGTH:
- lcd_putsLeft( y, STR_HAPTICSTRENGTH);
- lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.hapticStrength, attr|LEFT);
- if (attr) {
- CHECK_INCDEC_GENVAR(event, g_eeGeneral.hapticStrength, 0, 5);
- }
+ SLIDER_5POS(y, g_eeGeneral.hapticStrength, STR_HAPTICSTRENGTH, event, attr);
break;
#endif
diff --git a/radio/src/haptic.cpp b/radio/src/haptic.cpp
index ec0139795..abf2a7dd8 100644
--- a/radio/src/haptic.cpp
+++ b/radio/src/haptic.cpp
@@ -55,14 +55,14 @@ void hapticQueue::heartbeat()
if (buzzTimeLeft > 0) {
buzzTimeLeft--; // time gets counted down
#if defined(PCBSKY9X) || (defined(PCBTARANIS) && defined(REVPLUS))
- hapticOn(g_eeGeneral.hapticStrength * 20);
+ hapticOn(HAPTIC_STRENGTH() * 20);
#else
if (hapticTick-- > 0) {
HAPTIC_ON();
}
else {
HAPTIC_OFF();
- hapticTick = g_eeGeneral.hapticStrength;
+ hapticTick = HAPTIC_STRENGTH();
}
#endif
}
diff --git a/radio/src/myeeprom.h b/radio/src/myeeprom.h
index 15686e836..ac4328aca 100644
--- a/radio/src/myeeprom.h
+++ b/radio/src/myeeprom.h
@@ -411,7 +411,7 @@ PACK(typedef struct t_EEGeneral {
N_PCBSTD_FIELD( uint8_t reNavigation)
N_TARANIS_FIELD(uint8_t stickReverse)
int8_t beepLength:3;
- uint8_t hapticStrength:3;
+ int8_t hapticStrength:3;
uint8_t gpsFormat:1;
uint8_t unexpectedShutdown:1;
uint8_t speakerPitch;
@@ -425,6 +425,8 @@ PACK(typedef struct t_EEGeneral {
}) EEGeneral;
+#define HAPTIC_STRENGTH() (3+g_eeGeneral.hapticStrength)
+
#if defined(PCBTARANIS)
#define LEN_MODEL_NAME 12
#define LEN_BITMAP_NAME 10