mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 16:25:16 +03:00
Use firmware capability for functions reset list and upd refs
This commit is contained in:
parent
7f358b5dbf
commit
5b49a3a295
2 changed files with 9 additions and 12 deletions
|
@ -126,20 +126,15 @@ void CustomFunctionData::populateResetParams(const ModelData * model, QComboBox
|
|||
b->addItem(tr("REa"), val++);
|
||||
b->addItem(tr("REb"), val++);
|
||||
}
|
||||
if ((int)value < b->count()) {
|
||||
b->setCurrentIndex(value);
|
||||
}
|
||||
if (model) {
|
||||
for (unsigned i=0; i<CPN_MAX_SENSORS; ++i) {
|
||||
for (int i = 0; i < firmware->getCapability(Sensors); ++i) {
|
||||
if (model->sensorData[i].isAvailable()) {
|
||||
RawSource item = RawSource(SOURCE_TYPE_TELEMETRY, 3 * i);
|
||||
b->addItem(item.toString(model), val + i);
|
||||
if (value == val+i) {
|
||||
b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
b->setCurrentIndex(b->findData(value));
|
||||
}
|
||||
|
||||
void CustomFunctionData::populatePlaySoundParams(QStringList & qs)
|
||||
|
|
|
@ -723,7 +723,8 @@ int ModelData::updateReference()
|
|||
updateAssignFunc(cfd);
|
||||
if (!cfd->isEmpty()) {
|
||||
updateSwitchRef(cfd->swtch);
|
||||
if (cfd->func == FuncVolume || cfd->func == FuncBacklight || cfd->func == FuncPlayValue || (cfd->func >= FuncAdjustGV1 && cfd->func <= FuncAdjustGVLast && (cfd->adjustMode == FUNC_ADJUST_GVAR_GVAR || cfd->adjustMode == FUNC_ADJUST_GVAR_SOURCE))) {
|
||||
if (cfd->func == FuncVolume || cfd->func == FuncBacklight || cfd->func == FuncPlayValue ||
|
||||
(cfd->func >= FuncAdjustGV1 && cfd->func <= FuncAdjustGVLast && (cfd->adjustMode == FUNC_ADJUST_GVAR_GVAR || cfd->adjustMode == FUNC_ADJUST_GVAR_SOURCE))) {
|
||||
updateSourceIntRef(cfd->param);
|
||||
if (cfd->param == 0)
|
||||
cfd->clear();
|
||||
|
@ -1387,12 +1388,13 @@ void ModelData::updateResetParam(CustomFunctionData * cfd)
|
|||
const int invalidateRef = -1;
|
||||
int newRef = cfd->param;
|
||||
int idxAdj = 0;
|
||||
Firmware *firmware = getCurrentFirmware();
|
||||
|
||||
switch (updRefInfo.type)
|
||||
{
|
||||
case REF_UPD_TYPE_SENSOR:
|
||||
idxAdj = 5/*3 Timers + Flight + Telemetery*/ + getCurrentFirmware()->getCapability(RotaryEncoders);
|
||||
if (cfd->param < idxAdj)
|
||||
idxAdj = 5/*3 Timers + Flight + Telemetery*/ + firmware->getCapability(RotaryEncoders);
|
||||
if (cfd->param < idxAdj || cfd->param > (idxAdj + firmware->getCapability(Sensors)))
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue