Skip to content

Commit

Permalink
Add prefix legacy to trimsourcesLut
Browse files Browse the repository at this point in the history
  • Loading branch information
elecpower committed Feb 1, 2024
1 parent c04b75b commit 301ee07
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions companion/src/firmwares/boards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
#define FSIZE_HORUS (2048*1024)
#define FSIZE_MAX FSIZE_HORUS

static const StringTagMappingTable trimSourcesLut = {
// pre v2.10
static const StringTagMappingTable legacyTrimSourcesLut = {
{std::to_string(TRIM_AXIS_LH), "TrimRud"},
{std::to_string(TRIM_AXIS_LV), "TrimEle"},
{std::to_string(TRIM_AXIS_RV), "TrimThr"},
Expand Down Expand Up @@ -76,7 +77,7 @@ static const StringTagMappingTable trimSwitchesLut = {
using namespace Board;

Boards::Boards(Board::Type board) :
trimSourcesLookupTable(trimSourcesLut),
legacyTrimSourcesLookupTable(legacyTrimSourcesLut),
trimSwitchesLookupTable(trimSwitchesLut),
rawSwitchTypesLookupTable(RawSwitch::getRawSwitchTypesLookupTable()),
rawSourceSpecialTypesLookupTable(RawSource::getSpecialTypesLookupTable()),
Expand Down
4 changes: 2 additions & 2 deletions companion/src/firmwares/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ class Boards
static int getTrimYamlIndex(QString val, int ylt, Board::Type board = Board::BOARD_UNKNOWN);
static QString getTrimYamlName(int index, int ylt, Board::Type board = Board::BOARD_UNKNOWN);

STRINGTAGMAPPINGFUNCS(trimSourcesLookupTable, TrimSource);
STRINGTAGMAPPINGFUNCS(legacyTrimSourcesLookupTable, LegacyTrimSource);
STRINGTAGMAPPINGFUNCS(trimSwitchesLookupTable, TrimSwitch);
STRINGTAGMAPPINGFUNCS(rawSwitchTypesLookupTable, RawSwitchType);
STRINGTAGMAPPINGFUNCS(rawSourceSpecialTypesLookupTable, RawSourceSpecialType);
Expand All @@ -372,7 +372,7 @@ class Boards
Board::Type m_boardType = Board::BOARD_UNKNOWN;
BoardJson* m_boardJson = nullptr;

const StringTagMappingTable trimSourcesLookupTable;
const StringTagMappingTable legacyTrimSourcesLookupTable;
const StringTagMappingTable trimSwitchesLookupTable;
const StringTagMappingTable rawSwitchTypesLookupTable;
const StringTagMappingTable rawSourceSpecialTypesLookupTable;
Expand Down
2 changes: 1 addition & 1 deletion companion/src/firmwares/edgetx/yaml_rawsource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ RawSource YamlRawSourceDecode(const std::string& src_str)
node >> trim_str;

if (radioSettingsVersion < SemanticVersion(QString(CPN_ADC_REFACTOR_VERSION))) {
int idx = b.getTrimSourceIndex(src_str.c_str());
int idx = b.getLegacyTrimSourceIndex(src_str.c_str());
if (idx >= 0)
trim_str = Boards::getTrimYamlName(idx, BoardJson::YLT_REF).toStdString();
}
Expand Down

0 comments on commit 301ee07

Please sign in to comment.