fix(cpn): ADC switch type hardware definition (#5846)

This commit is contained in:
Neil Horne
2025-01-28 10:10:57 +10:00
committed by GitHub
parent 9888ef3074
commit 3e42ed3385
2 changed files with 13 additions and 0 deletions
+12
View File
@@ -51,6 +51,7 @@ static const StringTagMappingTable switchTypesLookupTable = {
{std::to_string(Board::SWITCH_2POS), "2POS"},
{std::to_string(Board::SWITCH_3POS), "3POS"},
{std::to_string(Board::SWITCH_FUNC), "FSWITCH"},
{std::to_string(Board::SWITCH_ADC), "ADC"},
};
static const StringTagMappingTable stickNamesLookupTable = {
@@ -995,6 +996,17 @@ bool BoardJson::loadFile(Board::Type board, QString hwdefn, InputsTable * inputs
sw.display.y = (unsigned int)d.at(1).toInt(0);
}
// special handing for ADC
if (sw.type == Board::SWITCH_ADC) {
if (sw.dflt == Board::SWITCH_TOGGLE) {
// this could be 2 or 3 position toggle so play safe
// it therefore has an impact on configuring hardware, available switches, simulator widget, yaml encode and decode
sw.dflt = Board::SWITCH_3POS;
}
// make the same
sw.type = sw.dflt;
}
switches->insert(switches->end(), sw);
// qDebug() << "tag:" << sw.tag.c_str() << "name:" << sw.name.c_str() << "type:" << sw.type << ">" << Boards::switchTypeToString(sw.type) <<
+1
View File
@@ -119,6 +119,7 @@ namespace Board {
SWITCH_2POS,
SWITCH_3POS,
SWITCH_FUNC,
SWITCH_ADC,
SWITCH_TYPE_COUNT
};