@@ -44,7 +44,7 @@ CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSe
|
||||
headerLabels << QObject::tr("Negative span") << QObject::tr("Mid value") << QObject::tr("Positive span");
|
||||
tableWidget->setHorizontalHeaderLabels(headerLabels);
|
||||
|
||||
int rows = CPN_MAX_STICKS + getCurrentFirmware()->getCapability(Pots) + getCurrentFirmware()->getCapability(Sliders);
|
||||
int rows = CPN_MAX_STICKS + getBoardCapability(getCurrentBoard(), Board::Pots) + getBoardCapability(getCurrentBoard(), Board::Sliders);
|
||||
tableWidget->setRowCount(rows);
|
||||
|
||||
for(int i = 0; i < rows; ++i) {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -21,9 +21,10 @@
|
||||
#include "hardware.h"
|
||||
#include "ui_hardware.h"
|
||||
|
||||
void HardwarePanel::setupSwitchType(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type, bool threePos = true)
|
||||
void HardwarePanel::setupSwitchType(int index, QLabel * label, AutoLineEdit * name, AutoComboBox * type, bool threePos = true)
|
||||
{
|
||||
if (IS_STM32(firmware->getBoard()) && index < firmware->getCapability(Switches)) {
|
||||
Board::Type board = getCurrentBoard();
|
||||
if (IS_STM32(board) && index < getBoardCapability(board, Board::Switches)) {
|
||||
type->addItem(tr("None"), Board::SWITCH_NOT_AVAILABLE);
|
||||
type->addItem(tr("2 Positions Toggle"), Board::SWITCH_TOGGLE);
|
||||
type->addItem(tr("2 Positions"), Board::SWITCH_2POS);
|
||||
@@ -40,9 +41,11 @@ void HardwarePanel::setupSwitchType(int index, QLabel *label, AutoLineEdit *name
|
||||
}
|
||||
}
|
||||
|
||||
void HardwarePanel::setupPotType(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type)
|
||||
void HardwarePanel::setupPotType(int index, QLabel * label, AutoLineEdit * name, AutoComboBox * type)
|
||||
{
|
||||
if (IS_STM32(firmware->getBoard()) && index < firmware->getCapability(Pots)) {
|
||||
Board::Type board = firmware->getBoard();
|
||||
|
||||
if (IS_STM32(board) && index < getBoardCapability(board, Board::Pots)) {
|
||||
label->setText(RawSource(SOURCE_TYPE_STICK, CPN_MAX_STICKS+index).toString());
|
||||
type->addItem(tr("None"), Board::POT_NONE);
|
||||
type->addItem(tr("Pot with detent"), Board::POT_WITH_DETENT);
|
||||
@@ -60,8 +63,10 @@ void HardwarePanel::setupPotType(int index, QLabel *label, AutoLineEdit *name, A
|
||||
|
||||
void HardwarePanel::setupSliderType(int index, QLabel *label, AutoLineEdit *name, AutoComboBox *type)
|
||||
{
|
||||
if (IS_STM32(firmware->getBoard()) && index < firmware->getCapability(Sliders)) {
|
||||
label->setText(RawSource(SOURCE_TYPE_STICK, CPN_MAX_STICKS+firmware->getCapability(Pots)+index).toString());
|
||||
Board::Type board = firmware->getBoard();
|
||||
|
||||
if (IS_STM32(board) && index < getBoardCapability(board, Board::Sliders)) {
|
||||
label->setText(RawSource(SOURCE_TYPE_STICK, CPN_MAX_STICKS+getBoardCapability(board, Board::Pots)+index).toString());
|
||||
type->addItem(tr("None"), Board::SLIDER_NONE);
|
||||
type->addItem(tr("Slider with detent"), Board::SLIDER_WITH_DETENT);
|
||||
name->setField(generalSettings.sliderName[index], 3, this);
|
||||
|
||||
Reference in New Issue
Block a user