fix(cpn): Handling of the 'show splash' setting for B&W radios in Companion (#3336)

* Fix handling of the 'show splash' setting for B&W radios in Companion.

* Remove 'TODO' comment.
This commit is contained in:
philmoz
2023-03-13 11:05:12 +10:00
committed by GitHub
parent a28e4b2383
commit 6e427615dd
6 changed files with 15 additions and 51 deletions
@@ -146,9 +146,11 @@ Node convert<GeneralSettings>::encode(const GeneralSettings& rhs)
{
Node node;
auto fw = getCurrentFirmware();
node["semver"] = VERSION;
std::string board = getCurrentFirmware()->getFlavour().toStdString();
std::string board = fw->getFlavour().toStdString();
node["board"] = board;
YamlCalibData calib(rhs.calibMid, rhs.calibSpanNeg, rhs.calibSpanPos);
@@ -184,7 +186,9 @@ Node convert<GeneralSettings>::encode(const GeneralSettings& rhs)
node["internalModuleBaudrate"] = internalModuleBaudrate.value;
node["internalModule"] = LookupValue(internalModuleLut, rhs.internalModule);
node["splashMode"] = rhs.splashMode; // TODO: B&W only
if (!IS_FAMILY_HORUS_OR_T16(fw->getBoard())) {
node["splashMode"] = rhs.splashMode;
}
node["lightAutoOff"] = rhs.backlightDelay;
node["templateSetup"] = rhs.templateSetup;
node["hapticLength"] = rhs.hapticLength + 2;
@@ -214,7 +218,7 @@ Node convert<GeneralSettings>::encode(const GeneralSettings& rhs)
node["varioRange"] = rhs.varioRange * 15;
node["varioRepeat"] = rhs.varioRepeat;
node["backgroundVolume"] = rhs.backgroundVolume + 2;
if (Boards::getCapability(getCurrentFirmware()->getBoard(), Board::HasColorLcd)) {
if (Boards::getCapability(fw->getBoard(), Board::HasColorLcd)) {
node["modelQuickSelect"] = (int)rhs.modelQuickSelect;
}
@@ -380,7 +384,9 @@ bool convert<GeneralSettings>::decode(const Node& node, GeneralSettings& rhs)
rhs.internalModule = Boards::getDefaultInternalModules(fw->getBoard());
}
node["splashMode"] >> rhs.splashMode; // TODO: B&W only
if (!IS_FAMILY_HORUS_OR_T16(fw->getBoard())) {
node["splashMode"] >> rhs.splashMode;
}
node["lightAutoOff"] >> rhs.backlightDelay;
node["templateSetup"] >> rhs.templateSetup;
node["hapticLength"] >> ioffset_int(rhs.hapticLength, 2);
+1 -2
View File
@@ -218,8 +218,7 @@ class GeneralSettings {
bool minuteBeep;
bool preBeep;
bool flashBeep;
unsigned int splashMode;
int splashDuration;
int splashMode;
unsigned int backlightDelay;
unsigned int templateSetup; //RETA order according to chout_ar array
int PPM_Multiplier;
@@ -3088,10 +3088,8 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type
internalField.Append(new UnsignedField<3>(this, generalData.internalModuleBaudrate));
if (IS_FAMILY_HORUS_OR_T16(board))
internalField.Append(new SpareBitsField<3>(this));
else if (IS_TARANIS(board))
internalField.Append(new SignedField<3>(this, generalData.splashDuration));
else
internalField.Append(new UnsignedField<3>(this, generalData.splashMode)); // TODO
internalField.Append(new SignedField<3>(this, generalData.splashMode));
internalField.Append(new SignedField<2>(this, (int &)generalData.hapticMode));
internalField.Append(new SignedField<8>(this, generalData.switchesDelay));