feat: Convert PPM_UNIT build option to runtime radio setting (#3993)

This commit is contained in:
philmoz
2023-10-10 19:47:50 +10:00
committed by GitHub
parent b05044091a
commit 837677b3ef
58 changed files with 248 additions and 188 deletions
@@ -224,6 +224,7 @@ Node convert<GeneralSettings>::encode(const GeneralSettings& rhs)
node["keysBacklight"] = (int)rhs.keysBacklight;
node["rotEncMode"] = (int)rhs.rotEncMode;
node["imperial"] = rhs.imperial;
node["ppmunit"] = rhs.ppmunit;
node["ttsLanguage"] = rhs.ttsLanguage;
node["beepVolume"] = rhs.beepVolume + 2;
node["wavVolume"] = rhs.wavVolume + 2;
@@ -487,6 +488,7 @@ bool convert<GeneralSettings>::decode(const Node& node, GeneralSettings& rhs)
node["rotEncDirection"] >> rhs.rotEncMode; // PR2045: read old name and
node["rotEncMode"] >> rhs.rotEncMode; // new, but don't write old
node["imperial"] >> rhs.imperial;
node["ppmunit"] >> rhs.ppmunit;
node["ttsLanguage"] >> rhs.ttsLanguage;
node["beepVolume"] >> ioffset_int(rhs.beepVolume, 2);
node["wavVolume"] >> ioffset_int(rhs.wavVolume, 2);
@@ -118,7 +118,6 @@ enum Capability {
HasModuleR9MFlex,
HasModuleR9MMini,
PPMCenter,
PPMUnitMicroseconds,
SYMLimits,
HastxCurrentCalibration,
HasVolume,
@@ -180,6 +180,12 @@ class GeneralSettings {
HATSMODE_COUNT
};
enum PPMUnit {
PPM_PERCENT_PREC0,
PPM_PERCENT_PREC1,
PPM_US
};
GeneralSettings() { clear(); }
void clear();
void init();
@@ -263,6 +269,7 @@ class GeneralSettings {
bool keysBacklight;
unsigned int rotEncMode;
unsigned int imperial;
unsigned int ppmunit;
char ttsLanguage[TTS_LANGUAGE_LEN + 1];
int beepVolume;
int wavVolume;
@@ -619,8 +619,6 @@ int OpenTxFirmware::getCapability(::Capability capability)
return 32;
case PPMCenter:
return (IS_HORUS_OR_TARANIS(board) ? 500 : (id.contains("ppmca") ? 125 : 0));
case PPMUnitMicroseconds:
return id.contains("ppmus") ? 1 : 0;
case SYMLimits:
return 1;
case OptrexDisplay:
@@ -1131,7 +1129,6 @@ void addOpenTxCommonOptions(OpenTxFirmware * firmware)
Firmware::Option("faichoice", Firmware::tr("Possibility to enable FAI MODE (no telemetry) at field")),
Firmware::Option("faimode", Firmware::tr("FAI MODE (no telemetry) always enabled"))
};
firmware->addOption("ppmus", Firmware::tr("Channel values displayed in us"));
firmware->addOptionsGroup(fai_options);
firmware->addOption("nooverridech", Firmware::tr("No OverrideCH functions available"));
}