@@ -99,10 +99,11 @@ void GeneralEdit::on_tabWidget_currentChanged(int index)
|
||||
|
||||
void GeneralEdit::on_calretrieve_PB_clicked()
|
||||
{
|
||||
Board::Type board = getCurrentBoard();
|
||||
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
|
||||
QString calib=g.profile[profile_id].stickPotCalib();
|
||||
int potsnum=getCurrentFirmware()->getCapability(Pots)+getCurrentFirmware()->getCapability(Sliders);
|
||||
int numSwPots=getCurrentFirmware()->getCapability(Switches)+getCurrentFirmware()->getCapability(Pots)+getCurrentFirmware()->getCapability(Sliders);
|
||||
int potsnum=getBoardCapability(board, Board::Pots)+getBoardCapability(board, Board::Sliders);
|
||||
int numSwPots=getBoardCapability(board, Board::Switches)+getBoardCapability(board, Board::Pots)+getBoardCapability(board, Board::Sliders);
|
||||
if (calib.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -162,8 +163,8 @@ void GeneralEdit::on_calretrieve_PB_clicked()
|
||||
qba = controlNames.mid(3*i,3).toLatin1();
|
||||
strcpy(generalSettings.stickName[i], qba.data());
|
||||
}
|
||||
for (int i=0; i<(getCurrentFirmware()->getCapability(Switches)); i++) {
|
||||
Byte=hwtypes.mid(i,1);
|
||||
for (int i=0; i<getBoardCapability(board, Board::Switches); i++) {
|
||||
Byte = hwtypes.mid(i, 1);
|
||||
byte16=(int16_t)Byte.toInt(&ok,16);
|
||||
qba=controlNames.mid(3*(i+CPN_MAX_STICKS),3).toLatin1();
|
||||
if (ok) {
|
||||
@@ -171,8 +172,8 @@ void GeneralEdit::on_calretrieve_PB_clicked()
|
||||
strcpy(generalSettings.switchName[i], qba.data());
|
||||
}
|
||||
}
|
||||
offset = getCurrentFirmware()->getCapability(Switches);
|
||||
for (int i=0; i<(getCurrentFirmware()->getCapability(Pots)); i++) {
|
||||
offset = getBoardCapability(board, Board::Switches);
|
||||
for (int i=0; i<getBoardCapability(board, Board::Pots); i++) {
|
||||
Byte=hwtypes.mid(i+offset,1);
|
||||
byte16=(int16_t)Byte.toInt(&ok,16);
|
||||
qba=controlNames.mid(3*(i+CPN_MAX_STICKS+offset),3).toLatin1();
|
||||
@@ -181,8 +182,8 @@ void GeneralEdit::on_calretrieve_PB_clicked()
|
||||
strcpy(generalSettings.potName[i], qba.data());
|
||||
}
|
||||
}
|
||||
offset += getCurrentFirmware()->getCapability(Pots);
|
||||
for (int i=0; i<(getCurrentFirmware()->getCapability(Sliders)); i++) {
|
||||
offset += getBoardCapability(board, Board::Pots);
|
||||
for (int i=0; i<getBoardCapability(board, Board::Sliders); i++) {
|
||||
Byte=hwtypes.mid(i+offset,1);
|
||||
byte16=(int16_t)Byte.toInt(&ok,16);
|
||||
qba=controlNames.mid(3*(i+CPN_MAX_STICKS+offset),3).toLatin1();
|
||||
@@ -245,7 +246,7 @@ void GeneralEdit::on_calstore_PB_clicked()
|
||||
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
|
||||
|
||||
QString name=g.profile[profile_id].name();
|
||||
int potsnum=getCurrentFirmware()->getCapability(Pots)+getCurrentFirmware()->getCapability(Sliders);
|
||||
int potsnum=getBoardCapability(getCurrentBoard(), Board::Pots)+getBoardCapability(getCurrentBoard(), Board::Sliders);
|
||||
if (name.isEmpty()) {
|
||||
ui->calstore_PB->setDisabled(true);
|
||||
return;
|
||||
@@ -279,15 +280,15 @@ void GeneralEdit::on_calstore_PB_clicked()
|
||||
for (int i=0; i<CPN_MAX_STICKS; i++) {
|
||||
controlNames.append(QString("%1").arg(generalSettings.stickName[i], -3));
|
||||
}
|
||||
for (int i=0; i<(getCurrentFirmware()->getCapability(Switches)); i++) {
|
||||
for (int i=0; i<getBoardCapability(getCurrentBoard(), Board::Switches); i++) {
|
||||
hwtypes.append(QString("%1").arg((uint16_t)generalSettings.switchConfig[i], 1));
|
||||
controlNames.append(QString("%1").arg(generalSettings.switchName[i], -3));
|
||||
}
|
||||
for (int i=0; i<(getCurrentFirmware()->getCapability(Pots)); i++) {
|
||||
for (int i=0; i<getBoardCapability(getCurrentBoard(), Board::Pots); i++) {
|
||||
hwtypes.append(QString("%1").arg((uint16_t)generalSettings.potConfig[i], 1));
|
||||
controlNames.append(QString("%1").arg(generalSettings.potName[i], -3));
|
||||
}
|
||||
for (int i=0; i<(getCurrentFirmware()->getCapability(Sliders)); i++) {
|
||||
for (int i=0; i<getBoardCapability(getCurrentBoard(), Board::Sliders); i++) {
|
||||
hwtypes.append(QString("%1").arg((uint16_t)generalSettings.sliderConfig[i], 1));
|
||||
controlNames.append(QString("%1").arg(generalSettings.sliderName[i], -3));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user