Skip to content

Commit 4b98b4b

Browse files
authored
A bunch of commits I should've split apart but weh
- 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"
1 parent 45a2769 commit 4b98b4b

File tree

4 files changed

+27
-21
lines changed

4 files changed

+27
-21
lines changed

constants.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ enum layoutTypes_e {
112112

113113
const uint8_t boardCustomPresetsCount[presetBoardsCount] = {
114114
0, // padding
115-
1, // rpipico
116-
1, // rpipicow
117-
2, // itsybitsy
115+
0, // rpipico
116+
0, // rpipicow
117+
1, // itsybitsy
118118
0, // KB2040
119119
0, // arduinoNano
120120
0, // waveshareZero
@@ -126,7 +126,6 @@ const QStringList rpipicoPresetsList = {
126126
};
127127

128128
const QStringList adafruitItsyBitsyRP2040PresetsList = {
129-
"SAMCO 2.0",
130129
"SAMCO 1.1"
131130
};
132131

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

154153
const int8_t adafruitItsyBitsyRP2040Presets[2][boardInputsCount-1] = {
155154
// SAMCO 2.0
155+
/*
156156
{6, 27, 26, -1, 28, 29,
157157
9, 7, 8, 10, 4, -1,
158158
11, -1, 24, 25, -1, -1,
159159
-1, -1, -1, -1, -1, 2,
160160
3, -1, -1, -1, -1, -1,
161161
-1}
162-
,
162+
,*/
163163
// SAMCO 1.1
164164
{10, 6, 7, -1, -1, -1,
165165
-1, -1, -1, -1, 27, -1,

guiwindow.cpp

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ QLabel *TLled[PROFILES_COUNT];
8989
QLabel *TRled[PROFILES_COUNT];
9090
QComboBox *irSens[PROFILES_COUNT];
9191
QComboBox *runMode[PROFILES_COUNT];
92-
QCheckBox *layoutMode[PROFILES_COUNT];
92+
QComboBox *layoutMode[PROFILES_COUNT];
9393
QPushButton *color[PROFILES_COUNT];
9494
QPushButton *renameBtn[PROFILES_COUNT];
9595

@@ -195,23 +195,23 @@ guiWindow::guiWindow(QWidget *parent)
195195
TRled[i] = new QLabel("0");
196196
irSens[i] = new QComboBox();
197197
runMode[i] = new QComboBox();
198-
layoutMode[i] = new QCheckBox();
198+
layoutMode[i] = new QComboBox();
199199
color[i] = new QPushButton();
200-
topOffset[i]->setAlignment(Qt::AlignHCenter);
201-
bottomOffset[i]->setAlignment(Qt::AlignHCenter);
202-
leftOffset[i]->setAlignment(Qt::AlignHCenter);
203-
rightOffset[i]->setAlignment(Qt::AlignHCenter);
204-
TLled[i]->setAlignment(Qt::AlignHCenter);
205-
TRled[i]->setAlignment(Qt::AlignHCenter);
200+
topOffset[i]->setAlignment(Qt::AlignCenter);
201+
bottomOffset[i]->setAlignment(Qt::AlignCenter);
202+
leftOffset[i]->setAlignment(Qt::AlignCenter);
203+
rightOffset[i]->setAlignment(Qt::AlignCenter);
204+
TLled[i]->setAlignment(Qt::AlignCenter);
205+
TRled[i]->setAlignment(Qt::AlignCenter);
206206
irSens[i]->addItem("Default");
207207
irSens[i]->addItem("Higher");
208208
irSens[i]->addItem("Highest");
209209
connect(irSens[i], SIGNAL(activated(int)), this, SLOT(irBoxes_activated(int)));
210210
runMode[i]->addItem("Normal");
211211
runMode[i]->addItem("1-Frame Avg");
212212
runMode[i]->addItem("2-Frame Avg");
213-
layoutMode[i]->setToolTip("Unticked is for the default double lightbar 'square' IR arrangement.\nTicked is for the GUN4IR-compatible 'diamond' IR arrangement.");
214-
connect(layoutMode[i], SIGNAL(stateChanged(int)), this, SLOT(layoutToggles_stateChanged(int)));
213+
layoutMode[i]->addItems({"Square", "Diamond"});
214+
connect(layoutMode[i], SIGNAL(activated(int)), this, SLOT(layoutBoxes_activated(int)));
215215
connect(runMode[i], SIGNAL(activated(int)), this, SLOT(runModeBoxes_activated(int)));
216216
color[i]->setFixedWidth(32);
217217
connect(color[i], SIGNAL(clicked()), this, SLOT(colorBoxes_clicked()));
@@ -297,6 +297,9 @@ guiWindow::guiWindow(QWidget *parent)
297297
// hiding tUSB elements by default since this can't be done from default
298298
ui->tUSBLayoutAdvanced->setVisible(false);
299299

300+
// set hidden by default until a board with presets is loaded
301+
ui->presetsBox->setHidden(true);
302+
300303
// Finally get to the thing!
301304
aliveTimer = new QTimer();
302305
connect(aliveTimer, &QTimer::timeout, this, &guiWindow::aliveTimer_timeout);
@@ -407,7 +410,7 @@ void guiWindow::SerialLoad()
407410
TRled[i]->setText(buffer[5]), profilesTable[i].TRled = buffer[5].toFloat(), profilesTable_orig[i].TRled = profilesTable[i].TRled;
408411
profilesTable[i].irSensitivity = buffer[6].toInt(), profilesTable_orig[i].irSensitivity = profilesTable[i].irSensitivity, irSens[i]->setCurrentIndex(profilesTable[i].irSensitivity), irSensOldIndex[i] = profilesTable[i].irSensitivity;
409412
profilesTable[i].runMode = buffer[7].toInt(), profilesTable_orig[i].runMode = profilesTable[i].runMode, runMode[i]->setCurrentIndex(profilesTable[i].runMode), runModeOldIndex[i] = profilesTable[i].runMode;
410-
layoutMode[i]->setChecked(buffer[8].toInt()), profilesTable[i].layoutType = buffer[8].toInt(), profilesTable_orig[i].layoutType = profilesTable[i].layoutType;
413+
layoutMode[i]->setCurrentIndex(buffer[8].toInt()), profilesTable[i].layoutType = buffer[8].toInt(), profilesTable_orig[i].layoutType = profilesTable[i].layoutType;
411414
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;
412415
selectedProfile[i]->setText(buffer[10]), profilesTable[i].profName = buffer[10], profilesTable_orig[i].profName = profilesTable[i].profName;
413416
}
@@ -1405,8 +1408,9 @@ void guiWindow::BoxesFill()
14051408
pinBoxes[i]->insertSeparator(periphSCL);
14061409
}
14071410
}
1411+
ui->presetsBox->clear();
14081412
if(boardCustomPresetsCount[board.type]) {
1409-
ui->presetsBox->clear();
1413+
ui->presetsBox->setHidden(false);
14101414
switch(board.type) {
14111415
case rpipico:
14121416
case rpipicow:
@@ -1420,6 +1424,8 @@ void guiWindow::BoxesFill()
14201424
default:
14211425
ui->presetsBox->setEnabled(false);
14221426
}
1427+
} else {
1428+
ui->presetsBox->setHidden(true);
14231429
}
14241430
BoxesUpdate();
14251431
}
@@ -1596,9 +1602,9 @@ void guiWindow::colorBoxes_clicked()
15961602
}
15971603

15981604

1599-
void guiWindow::layoutToggles_stateChanged(int arg1)
1605+
void guiWindow::layoutBoxes_activated(int arg1)
16001606
{
1601-
// Demultiplexing to figure out which tick we're using.
1607+
// Demultiplexing to figure out which box we're using.
16021608
uint8_t slot;
16031609
QObject* obj = sender();
16041610
for(uint8_t i = 0;;i++) {

guiwindow.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private slots:
5858

5959
void colorBoxes_clicked();
6060

61-
void layoutToggles_stateChanged(int arg1);
61+
void layoutBoxes_activated(int arg1);
6262

6363
void irBoxes_activated(int index);
6464

guiwindow.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
<bool>false</bool>
177177
</property>
178178
<property name="placeholderText">
179-
<string>Preset Layouts</string>
179+
<string>Select Layout Preset</string>
180180
</property>
181181
</widget>
182182
</item>

0 commit comments

Comments
 (0)