Skip to content

Commit

Permalink
A bunch of commits I should've split apart but weh
Browse files Browse the repository at this point in the history
 - Removes Pico presets (as there never was any real presets for it to begin with)
 - Removes ItsyBitsy Samco 2.0 preset (as it's just the same as the board default)
 - Changes IR Layout to a combobox instead of toggle, making it much clearer what setting corresponds to what.
 - Presets Box in the pins layout tab is now hidden by default, and only unhides when at least one layout exists for the board.
 - Changes Presets Box placeholder text to "Select Layout Preset"
  • Loading branch information
SeongGino authored Jun 25, 2024
1 parent 45a2769 commit 4b98b4b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
10 changes: 5 additions & 5 deletions constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ enum layoutTypes_e {

const uint8_t boardCustomPresetsCount[presetBoardsCount] = {
0, // padding
1, // rpipico
1, // rpipicow
2, // itsybitsy
0, // rpipico
0, // rpipicow
1, // itsybitsy
0, // KB2040
0, // arduinoNano
0, // waveshareZero
Expand All @@ -126,7 +126,6 @@ const QStringList rpipicoPresetsList = {
};

const QStringList adafruitItsyBitsyRP2040PresetsList = {
"SAMCO 2.0",
"SAMCO 1.1"
};

Expand All @@ -153,13 +152,14 @@ const int8_t rpipicoPresets[1][boardInputsCount-1] = {

const int8_t adafruitItsyBitsyRP2040Presets[2][boardInputsCount-1] = {
// SAMCO 2.0
/*
{6, 27, 26, -1, 28, 29,
9, 7, 8, 10, 4, -1,
11, -1, 24, 25, -1, -1,
-1, -1, -1, -1, -1, 2,
3, -1, -1, -1, -1, -1,
-1}
,
,*/
// SAMCO 1.1
{10, 6, 7, -1, -1, -1,
-1, -1, -1, -1, 27, -1,
Expand Down
34 changes: 20 additions & 14 deletions guiwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ QLabel *TLled[PROFILES_COUNT];
QLabel *TRled[PROFILES_COUNT];
QComboBox *irSens[PROFILES_COUNT];
QComboBox *runMode[PROFILES_COUNT];
QCheckBox *layoutMode[PROFILES_COUNT];
QComboBox *layoutMode[PROFILES_COUNT];
QPushButton *color[PROFILES_COUNT];
QPushButton *renameBtn[PROFILES_COUNT];

Expand Down Expand Up @@ -195,23 +195,23 @@ guiWindow::guiWindow(QWidget *parent)
TRled[i] = new QLabel("0");
irSens[i] = new QComboBox();
runMode[i] = new QComboBox();
layoutMode[i] = new QCheckBox();
layoutMode[i] = new QComboBox();
color[i] = new QPushButton();
topOffset[i]->setAlignment(Qt::AlignHCenter);
bottomOffset[i]->setAlignment(Qt::AlignHCenter);
leftOffset[i]->setAlignment(Qt::AlignHCenter);
rightOffset[i]->setAlignment(Qt::AlignHCenter);
TLled[i]->setAlignment(Qt::AlignHCenter);
TRled[i]->setAlignment(Qt::AlignHCenter);
topOffset[i]->setAlignment(Qt::AlignCenter);
bottomOffset[i]->setAlignment(Qt::AlignCenter);
leftOffset[i]->setAlignment(Qt::AlignCenter);
rightOffset[i]->setAlignment(Qt::AlignCenter);
TLled[i]->setAlignment(Qt::AlignCenter);
TRled[i]->setAlignment(Qt::AlignCenter);
irSens[i]->addItem("Default");
irSens[i]->addItem("Higher");
irSens[i]->addItem("Highest");
connect(irSens[i], SIGNAL(activated(int)), this, SLOT(irBoxes_activated(int)));
runMode[i]->addItem("Normal");
runMode[i]->addItem("1-Frame Avg");
runMode[i]->addItem("2-Frame Avg");
layoutMode[i]->setToolTip("Unticked is for the default double lightbar 'square' IR arrangement.\nTicked is for the GUN4IR-compatible 'diamond' IR arrangement.");
connect(layoutMode[i], SIGNAL(stateChanged(int)), this, SLOT(layoutToggles_stateChanged(int)));
layoutMode[i]->addItems({"Square", "Diamond"});
connect(layoutMode[i], SIGNAL(activated(int)), this, SLOT(layoutBoxes_activated(int)));
connect(runMode[i], SIGNAL(activated(int)), this, SLOT(runModeBoxes_activated(int)));
color[i]->setFixedWidth(32);
connect(color[i], SIGNAL(clicked()), this, SLOT(colorBoxes_clicked()));
Expand Down Expand Up @@ -297,6 +297,9 @@ guiWindow::guiWindow(QWidget *parent)
// hiding tUSB elements by default since this can't be done from default
ui->tUSBLayoutAdvanced->setVisible(false);

// set hidden by default until a board with presets is loaded
ui->presetsBox->setHidden(true);

// Finally get to the thing!
aliveTimer = new QTimer();
connect(aliveTimer, &QTimer::timeout, this, &guiWindow::aliveTimer_timeout);
Expand Down Expand Up @@ -407,7 +410,7 @@ void guiWindow::SerialLoad()
TRled[i]->setText(buffer[5]), profilesTable[i].TRled = buffer[5].toFloat(), profilesTable_orig[i].TRled = profilesTable[i].TRled;
profilesTable[i].irSensitivity = buffer[6].toInt(), profilesTable_orig[i].irSensitivity = profilesTable[i].irSensitivity, irSens[i]->setCurrentIndex(profilesTable[i].irSensitivity), irSensOldIndex[i] = profilesTable[i].irSensitivity;
profilesTable[i].runMode = buffer[7].toInt(), profilesTable_orig[i].runMode = profilesTable[i].runMode, runMode[i]->setCurrentIndex(profilesTable[i].runMode), runModeOldIndex[i] = profilesTable[i].runMode;
layoutMode[i]->setChecked(buffer[8].toInt()), profilesTable[i].layoutType = buffer[8].toInt(), profilesTable_orig[i].layoutType = profilesTable[i].layoutType;
layoutMode[i]->setCurrentIndex(buffer[8].toInt()), profilesTable[i].layoutType = buffer[8].toInt(), profilesTable_orig[i].layoutType = profilesTable[i].layoutType;
color[i]->setStyleSheet(QString("background-color: #%1").arg(buffer[9].toLong(), 6, 16, QLatin1Char('0'))), profilesTable[i].color = buffer[9].toLong(), profilesTable_orig[i].color = profilesTable[i].color;
selectedProfile[i]->setText(buffer[10]), profilesTable[i].profName = buffer[10], profilesTable_orig[i].profName = profilesTable[i].profName;
}
Expand Down Expand Up @@ -1405,8 +1408,9 @@ void guiWindow::BoxesFill()
pinBoxes[i]->insertSeparator(periphSCL);
}
}
ui->presetsBox->clear();
if(boardCustomPresetsCount[board.type]) {
ui->presetsBox->clear();
ui->presetsBox->setHidden(false);
switch(board.type) {
case rpipico:
case rpipicow:
Expand All @@ -1420,6 +1424,8 @@ void guiWindow::BoxesFill()
default:
ui->presetsBox->setEnabled(false);
}
} else {
ui->presetsBox->setHidden(true);
}
BoxesUpdate();
}
Expand Down Expand Up @@ -1596,9 +1602,9 @@ void guiWindow::colorBoxes_clicked()
}


void guiWindow::layoutToggles_stateChanged(int arg1)
void guiWindow::layoutBoxes_activated(int arg1)
{
// Demultiplexing to figure out which tick we're using.
// Demultiplexing to figure out which box we're using.
uint8_t slot;
QObject* obj = sender();
for(uint8_t i = 0;;i++) {
Expand Down
2 changes: 1 addition & 1 deletion guiwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private slots:

void colorBoxes_clicked();

void layoutToggles_stateChanged(int arg1);
void layoutBoxes_activated(int arg1);

void irBoxes_activated(int index);

Expand Down
2 changes: 1 addition & 1 deletion guiwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
<bool>false</bool>
</property>
<property name="placeholderText">
<string>Preset Layouts</string>
<string>Select Layout Preset</string>
</property>
</widget>
</item>
Expand Down

0 comments on commit 4b98b4b

Please sign in to comment.