Issue 3473 port to next (#3587)
This commit is contained in:
committed by
Bertrand Songis
parent
13558214a8
commit
dd12d09c92
@@ -1397,7 +1397,7 @@ void ModelData::clear()
|
|||||||
moduleData[1].protocol = PULSES_OFF;
|
moduleData[1].protocol = PULSES_OFF;
|
||||||
}
|
}
|
||||||
for (int i=0; i<C9X_MAX_FLIGHT_MODES; i++) {
|
for (int i=0; i<C9X_MAX_FLIGHT_MODES; i++) {
|
||||||
flightModeData[i].clear();
|
flightModeData[i].clear(i);
|
||||||
}
|
}
|
||||||
clearInputs();
|
clearInputs();
|
||||||
clearMixes();
|
clearMixes();
|
||||||
@@ -1857,3 +1857,16 @@ unsigned int getNumSubtypes(MultiModuleRFProtocols type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FlightModeData::clear(const int phase)
|
||||||
|
{
|
||||||
|
memset(this, 0, sizeof(FlightModeData));
|
||||||
|
if (phase != 0) {
|
||||||
|
for (int idx=0; idx<C9X_MAX_GVARS; idx++) {
|
||||||
|
gvars[idx] = 1025;
|
||||||
|
}
|
||||||
|
for (int idx=0; idx<C9X_MAX_ENCODERS; idx++) {
|
||||||
|
rotaryEncoders[idx] = 1025;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -639,7 +639,7 @@ class CustomFunctionData { // Function Switches data
|
|||||||
|
|
||||||
class FlightModeData {
|
class FlightModeData {
|
||||||
public:
|
public:
|
||||||
FlightModeData() { clear(); }
|
FlightModeData() { clear(0); }
|
||||||
int trimMode[NUM_STICKS];
|
int trimMode[NUM_STICKS];
|
||||||
int trimRef[NUM_STICKS];
|
int trimRef[NUM_STICKS];
|
||||||
int trim[NUM_STICKS];
|
int trim[NUM_STICKS];
|
||||||
@@ -647,9 +647,9 @@ class FlightModeData {
|
|||||||
char name[10+1];
|
char name[10+1];
|
||||||
unsigned int fadeIn;
|
unsigned int fadeIn;
|
||||||
unsigned int fadeOut;
|
unsigned int fadeOut;
|
||||||
int rotaryEncoders[2];
|
int rotaryEncoders[C9X_MAX_ENCODERS];
|
||||||
int gvars[C9X_MAX_GVARS];
|
int gvars[C9X_MAX_GVARS];
|
||||||
void clear() { memset(this, 0, sizeof(FlightModeData)); }
|
void clear(const int phase);
|
||||||
};
|
};
|
||||||
|
|
||||||
class SwashRingData { // Swash Ring data
|
class SwashRingData { // Swash Ring data
|
||||||
|
|||||||
@@ -110,10 +110,10 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
|||||||
reUse[i] = new QComboBox(ui->reGB);
|
reUse[i] = new QComboBox(ui->reGB);
|
||||||
reUse[i]->setProperty("index", i);
|
reUse[i]->setProperty("index", i);
|
||||||
populateGvarUseCB(reUse[i], phaseIdx);
|
populateGvarUseCB(reUse[i], phaseIdx);
|
||||||
connect(reUse[i], SIGNAL(currentIndexChanged(int)), this, SLOT(phaseREUse_currentIndexChanged(int)));
|
|
||||||
if (phase.rotaryEncoders[i] > 1024) {
|
if (phase.rotaryEncoders[i] > 1024) {
|
||||||
reUse[i]->setCurrentIndex(phase.rotaryEncoders[i] - 1024);
|
reUse[i]->setCurrentIndex(phase.rotaryEncoders[i] - 1024);
|
||||||
}
|
}
|
||||||
|
connect(reUse[i], SIGNAL(currentIndexChanged(int)), this, SLOT(phaseREUse_currentIndexChanged(int)));
|
||||||
reLayout->addWidget(reUse[i], i, 1, 1, 1);
|
reLayout->addWidget(reUse[i], i, 1, 1, 1);
|
||||||
}
|
}
|
||||||
// RE value
|
// RE value
|
||||||
@@ -290,8 +290,14 @@ void FlightModePanel::trimUpdate(unsigned int trim)
|
|||||||
trimsUse[trim]->setCurrentIndex(1 + 2*phase.trimRef[chn] + phase.trimMode[chn] - (phase.trimRef[chn] > phaseIdx ? 1 : 0));
|
trimsUse[trim]->setCurrentIndex(1 + 2*phase.trimRef[chn] + phase.trimMode[chn] - (phase.trimRef[chn] > phaseIdx ? 1 : 0));
|
||||||
else
|
else
|
||||||
trimsUse[trim]->setCurrentIndex(phase.trimRef[chn]);
|
trimsUse[trim]->setCurrentIndex(phase.trimRef[chn]);
|
||||||
trimsValue[trim]->setEnabled(true);
|
if (phaseIdx == 0 || phase.trimRef[chn] == phaseIdx || (IS_TARANIS(board) && phase.trimMode[chn] != 0)) {
|
||||||
trimsSlider[trim]->setEnabled(true);
|
trimsValue[trim]->setEnabled(true);
|
||||||
|
trimsSlider[trim]->setEnabled(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
trimsValue[trim]->setEnabled(false);
|
||||||
|
trimsSlider[trim]->setEnabled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lock = false;
|
lock = false;
|
||||||
}
|
}
|
||||||
@@ -443,7 +449,7 @@ void FlightModePanel::fmClear()
|
|||||||
{
|
{
|
||||||
int res = QMessageBox::question(this, "Companion", tr("Clear all current Flight Mode properties?"), QMessageBox::Yes | QMessageBox::No);
|
int res = QMessageBox::question(this, "Companion", tr("Clear all current Flight Mode properties?"), QMessageBox::Yes | QMessageBox::No);
|
||||||
if (res == QMessageBox::Yes) {
|
if (res == QMessageBox::Yes) {
|
||||||
phase.clear();
|
phase.clear(phaseIdx);
|
||||||
if (phaseIdx == 0) {
|
if (phaseIdx == 0) {
|
||||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||||
for (int i=0; i < gvCount; ++i) {
|
for (int i=0; i < gvCount; ++i) {
|
||||||
@@ -459,11 +465,11 @@ void FlightModePanel::fmClear()
|
|||||||
pswtch->setCurrentIndex(pswtch->findText(item.toString()));
|
pswtch->setCurrentIndex(pswtch->findText(item.toString()));
|
||||||
if (gvCount > 0 && (firmware->getCapability(GvarsFlightModes))) {
|
if (gvCount > 0 && (firmware->getCapability(GvarsFlightModes))) {
|
||||||
for (int i=0; i<gvCount; i++) {
|
for (int i=0; i<gvCount; i++) {
|
||||||
gvUse[i]->setCurrentIndex(0);
|
gvUse[i]->setCurrentIndex((phase.gvars[i] > 1024 ? (phase.gvars[i] - 1024) : 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i=0; i<reCount; i++) {
|
for (int i=0; i<reCount; i++) {
|
||||||
reUse[i]->setCurrentIndex(0);
|
reUse[i]->setCurrentIndex((phase.rotaryEncoders[i] > 1024 ? (phase.rotaryEncoders[i] - 1024) : 0));
|
||||||
}
|
}
|
||||||
lock = false;
|
lock = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -452,6 +452,14 @@ void modelDefault(uint8_t id)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(FLIGHT_MODES) && defined(ROTARY_ENCODERS)
|
||||||
|
for (int p=1; p<MAX_FLIGHT_MODES; p++) {
|
||||||
|
for (int i=0; i<ROTARY_ENCODERS; i++) {
|
||||||
|
g_model.flightModeData[p].rotaryEncoders[i] = ROTARY_ENCODER_MAX+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(MAVLINK)
|
#if defined(MAVLINK)
|
||||||
g_model.mavlink.rc_rssi_scale = 15;
|
g_model.mavlink.rc_rssi_scale = 15;
|
||||||
g_model.mavlink.pc_rssi_en = 1;
|
g_model.mavlink.pc_rssi_en = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user