chore(cpn): align general settings naming to radio (#4654)

This commit is contained in:
Neil Horne
2024-02-27 11:33:17 +10:00
committed by GitHub
parent 2bef12996f
commit b3c09dd35a
8 changed files with 43 additions and 27 deletions
+3
View File
@@ -304,6 +304,9 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
case HasExternalModuleSupport: case HasExternalModuleSupport:
return (IS_STM32(board) && !IS_RADIOMASTER_T8(board)); return (IS_STM32(board) && !IS_RADIOMASTER_T8(board));
case HasIMU:
return (IS_FAMILY_HORUS_OR_T16(board) || IS_TARANIS(board));
case HasInternalModuleSupport: case HasInternalModuleSupport:
return (IS_STM32(board) && !IS_TARANIS_X9(board)); return (IS_STM32(board) && !IS_TARANIS_X9(board));
+1
View File
@@ -163,6 +163,7 @@ namespace Board {
HasAudioMuteGPIO, HasAudioMuteGPIO,
HasColorLcd, HasColorLcd,
HasExternalModuleSupport, HasExternalModuleSupport,
HasIMU,
HasInternalModuleSupport, HasInternalModuleSupport,
HasIntModuleHeartbeatGPIO, HasIntModuleHeartbeatGPIO,
HasLedStripGPIO, HasLedStripGPIO,
@@ -165,18 +165,25 @@ Node convert<GeneralSettings>::encode(const GeneralSettings& rhs)
std::string strboard = fw->getFlavour().toStdString(); std::string strboard = fw->getFlavour().toStdString();
node["board"] = strboard; node["board"] = strboard;
if (rhs.manuallyEdited)
node["manuallyEdited"] = (int)rhs.manuallyEdited;
YamlCalibData calib(rhs.inputConfig); YamlCalibData calib(rhs.inputConfig);
node["calib"] = calib; node["calib"] = calib;
node["currModel"] = rhs.currModelIndex;
node["currModelFilename"] = patchFilenameToYaml(rhs.currModelFilename); node["currModelFilename"] = patchFilenameToYaml(rhs.currModelFilename);
node["contrast"] = rhs.contrast;
node["vBatWarn"] = rhs.vBatWarn; node["vBatWarn"] = rhs.vBatWarn;
node["txVoltageCalibration"] = rhs.txVoltageCalibration; node["txVoltageCalibration"] = rhs.txVoltageCalibration;
node["vBatMin"] = rhs.vBatMin + 90; node["vBatMin"] = rhs.vBatMin + 90;
node["vBatMax"] = rhs.vBatMax + 120; node["vBatMax"] = rhs.vBatMax + 120;
if (!Boards::getCapability(board, Board::HasColorLcd)) {
node["backlightColor"] = rhs.backlightColor;
node["contrast"] = rhs.contrast;
node["currModel"] = rhs.currModelIndex;
}
node["backlightMode"] = backlightModeLut << std::abs(rhs.backlightMode); node["backlightMode"] = backlightModeLut << std::abs(rhs.backlightMode);
node["trainer"] = rhs.trainer; node["trainer"] = rhs.trainer;
node["PPM_Multiplier"] = rhs.PPM_Multiplier; node["PPM_Multiplier"] = rhs.PPM_Multiplier;
@@ -184,7 +191,7 @@ Node convert<GeneralSettings>::encode(const GeneralSettings& rhs)
node["fai"] = (int)rhs.fai; node["fai"] = (int)rhs.fai;
node["disableMemoryWarning"] = (int)rhs.disableMemoryWarning; node["disableMemoryWarning"] = (int)rhs.disableMemoryWarning;
node["beepMode"] = rhs.beeperMode; node["beepMode"] = rhs.beeperMode;
node["alarmsFlash"] = (int)rhs.flashBeep; node["alarmsFlash"] = (int)rhs.alarmsFlash;
node["disableAlarmWarning"] = (int)rhs.disableAlarmWarning; node["disableAlarmWarning"] = (int)rhs.disableAlarmWarning;
node["disableRssiPoweroffAlarm"] = (int)rhs.disableRssiPoweroffAlarm; node["disableRssiPoweroffAlarm"] = (int)rhs.disableRssiPoweroffAlarm;
node["USBMode"] = rhs.usbMode; node["USBMode"] = rhs.usbMode;
@@ -255,7 +262,6 @@ Node convert<GeneralSettings>::encode(const GeneralSettings& rhs)
node["serialPort"] = serialPort; node["serialPort"] = serialPort;
node["antennaMode"] = antennaModeLut << rhs.antennaMode; node["antennaMode"] = antennaModeLut << rhs.antennaMode;
node["backlightColor"] = rhs.backlightColor;
node["pwrOnSpeed"] = rhs.pwrOnSpeed; node["pwrOnSpeed"] = rhs.pwrOnSpeed;
node["pwrOffSpeed"] = rhs.pwrOffSpeed; node["pwrOffSpeed"] = rhs.pwrOffSpeed;
@@ -292,9 +298,10 @@ Node convert<GeneralSettings>::encode(const GeneralSettings& rhs)
node["ownerRegistrationID"] = rhs.registrationId; node["ownerRegistrationID"] = rhs.registrationId;
// Gyro (for now only xlites) if (Boards::getCapability(board, Board::HasIMU)) {
node["gyroMax"] = rhs.gyroMax; node["imuMax"] = rhs.imuMax;
node["gyroOffset"] = rhs.gyroOffset; node["imuOffset"] = rhs.imuOffset;
}
// OneBit sampling (X9D only?) // OneBit sampling (X9D only?)
node["uartSampleMode"] = rhs.uartSampleMode; node["uartSampleMode"] = rhs.uartSampleMode;
@@ -419,7 +426,7 @@ bool convert<GeneralSettings>::decode(const Node& node, GeneralSettings& rhs)
node["fai"] >> rhs.fai; node["fai"] >> rhs.fai;
node["disableMemoryWarning"] >> rhs.disableMemoryWarning; node["disableMemoryWarning"] >> rhs.disableMemoryWarning;
node["beepMode"] >> rhs.beeperMode; node["beepMode"] >> rhs.beeperMode;
node["alarmsFlash"] >> rhs.flashBeep; node["alarmsFlash"] >> rhs.alarmsFlash;
node["disableAlarmWarning"] >> rhs.disableAlarmWarning; node["disableAlarmWarning"] >> rhs.disableAlarmWarning;
node["disableRssiPoweroffAlarm"] >> rhs.disableRssiPoweroffAlarm; node["disableRssiPoweroffAlarm"] >> rhs.disableRssiPoweroffAlarm;
node["USBMode"] >> rhs.usbMode; node["USBMode"] >> rhs.usbMode;
@@ -556,9 +563,12 @@ bool convert<GeneralSettings>::decode(const Node& node, GeneralSettings& rhs)
node["ownerRegistrationID"] >> rhs.registrationId; node["ownerRegistrationID"] >> rhs.registrationId;
// Gyro (for now only xlites) // depreciated in 2.11
node["gyroMax"] >> rhs.gyroMax; node["gyroMax"] >> rhs.imuMax;
node["gyroOffset"] >> rhs.gyroOffset; node["gyroOffset"] >> rhs.imuOffset;
node["imuMax"] >> rhs.imuMax;
node["imuOffset"] >> rhs.imuOffset;
// OneBit sampling (X9D only?) // OneBit sampling (X9D only?)
node["uartSampleMode"] >> rhs.uartSampleMode; node["uartSampleMode"] >> rhs.uartSampleMode;
@@ -140,7 +140,7 @@ Ersky9xGeneral::operator GeneralSettings ()
result.inactivityTimer = inactivityTimer + 10; result.inactivityTimer = inactivityTimer + 10;
result.minuteBeep = minuteBeep; result.minuteBeep = minuteBeep;
result.preBeep = preBeep; result.preBeep = preBeep;
result.flashBeep = flashBeep; result.alarmsFlash = alarmsFlash;
result.splashMode = disableSplashScreen; result.splashMode = disableSplashScreen;
result.templateSetup = templateSetup; result.templateSetup = templateSetup;
result.PPM_Multiplier = PPM_Multiplier; result.PPM_Multiplier = PPM_Multiplier;
@@ -40,7 +40,7 @@ extern RawSwitch getEr9xTimerMode(int mode);
#define ERSKY9X_NUM_CHNOUT_V10 16 //number of real outputchannels CH1-CH8 #define ERSKY9X_NUM_CHNOUT_V10 16 //number of real outputchannels CH1-CH8
#define ERSKY9X_NUM_CHNOUT_V11 24 //number of real outputchannels CH1-CH8 #define ERSKY9X_NUM_CHNOUT_V11 24 //number of real outputchannels CH1-CH8
#define ERSKY9X_NUM_CSW_V10 12 //number of custom switches #define ERSKY9X_NUM_CSW_V10 12 //number of custom switches
#define ERSKY9X_NUM_CSW_V11 24 #define ERSKY9X_NUM_CSW_V11 24
#define ERSKY9X_NUM_FSW 16 #define ERSKY9X_NUM_FSW 16
#define ERSKY9X_NUM_VOICE 8 #define ERSKY9X_NUM_VOICE 8
#define ERSKY9X_MAX_GVARS 7 #define ERSKY9X_MAX_GVARS 7
@@ -89,7 +89,7 @@ PACK(typedef struct t_Ersky9xGeneral {
uint8_t throttleReversed:1; uint8_t throttleReversed:1;
uint8_t minuteBeep:1; uint8_t minuteBeep:1;
uint8_t preBeep:1; uint8_t preBeep:1;
uint8_t flashBeep:1; uint8_t alarmsFlash:1;
uint8_t disableSplashScreen:1; uint8_t disableSplashScreen:1;
uint8_t disablePotScroll:1; uint8_t disablePotScroll:1;
uint8_t disableBG:1; uint8_t disableBG:1;
@@ -219,7 +219,7 @@ PACK(typedef struct t_Ersky9xSafetySwData_v10 { // Custom Switches data
PACK(typedef struct t_Ersky9xSafetySwData_v11 { // Custom Switches data PACK(typedef struct t_Ersky9xSafetySwData_v11 { // Custom Switches data
union opt { union opt {
struct ss { struct ss {
int8_t swtch ; int8_t swtch ;
uint8_t mode ; uint8_t mode ;
int8_t val ; int8_t val ;
@@ -279,13 +279,13 @@ PACK(typedef struct t_Ersky9xFrSkyData_v10 {
PACK(typedef struct t_Ersky9xFrSkyChannelData_v11 { PACK(typedef struct t_Ersky9xFrSkyChannelData_v11 {
uint8_t ratio ; // 0.0 means not used, 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc. uint8_t ratio ; // 0.0 means not used, 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
uint8_t offset ; // uint8_t offset ; //
uint8_t gain ; // uint8_t gain ; //
uint8_t alarms_value[2] ; // 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc. uint8_t alarms_value[2] ; // 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
uint8_t alarms_level ; uint8_t alarms_level ;
uint8_t alarms_greater ; // 0=LT(<), 1=GT(>) uint8_t alarms_greater ; // 0=LT(<), 1=GT(>)
uint8_t type ; // 0=volts, 1=raw, 2=volts*2, 3=Amps uint8_t type ; // 0=volts, 1=raw, 2=volts*2, 3=Amps
operator FrSkyChannelData(); operator FrSkyChannelData();
t_Ersky9xFrSkyChannelData_v11(); t_Ersky9xFrSkyChannelData_v11();
}) Ersky9xFrSkyChannelData_v11; }) Ersky9xFrSkyChannelData_v11;
+5 -3
View File
@@ -198,6 +198,8 @@ class GeneralSettings {
int getDefaultChannel(unsigned int stick) const; int getDefaultChannel(unsigned int stick) const;
bool fix6POSCalibration(); bool fix6POSCalibration();
bool manuallyEdited;
char semver[8 + 1]; char semver[8 + 1];
unsigned int version; unsigned int version;
unsigned int variant; unsigned int variant;
@@ -234,7 +236,7 @@ class GeneralSettings {
unsigned int internalModuleBaudrate; unsigned int internalModuleBaudrate;
bool minuteBeep; bool minuteBeep;
bool preBeep; bool preBeep;
bool flashBeep; bool alarmsFlash;
int splashMode; int splashMode;
bool dontPlayHello; bool dontPlayHello;
unsigned int backlightDelay; unsigned int backlightDelay;
@@ -287,8 +289,8 @@ class GeneralSettings {
CustomFunctionData customFn[CPN_MAX_SPECIAL_FUNCTIONS]; CustomFunctionData customFn[CPN_MAX_SPECIAL_FUNCTIONS];
char registrationId[REGISTRATION_ID_LEN + 1]; char registrationId[REGISTRATION_ID_LEN + 1];
int gyroMax; int imuMax;
int gyroOffset; int imuOffset;
int uartSampleMode; int uartSampleMode;
int pwrOnSpeed; int pwrOnSpeed;
@@ -3039,7 +3039,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type
internalField.Append(new SpareBitsField<2>(this)); // TODO buzzerMode? internalField.Append(new SpareBitsField<2>(this)); // TODO buzzerMode?
internalField.Append(new BoolField<1>(this, generalData.fai)); internalField.Append(new BoolField<1>(this, generalData.fai));
internalField.Append(new SignedField<2>(this, (int &)generalData.beeperMode)); internalField.Append(new SignedField<2>(this, (int &)generalData.beeperMode));
internalField.Append(new BoolField<1>(this, generalData.flashBeep)); internalField.Append(new BoolField<1>(this, generalData.alarmsFlash));
internalField.Append(new BoolField<1>(this, generalData.disableMemoryWarning)); internalField.Append(new BoolField<1>(this, generalData.disableMemoryWarning));
internalField.Append(new BoolField<1>(this, generalData.disableAlarmWarning)); internalField.Append(new BoolField<1>(this, generalData.disableAlarmWarning));
@@ -3315,8 +3315,8 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type
} }
if (version >= 219 && IS_TARANIS_XLITES(board)) { if (version >= 219 && IS_TARANIS_XLITES(board)) {
internalField.Append(new SignedField<8>(this, generalData.gyroMax, "Gyro full scale")); internalField.Append(new SignedField<8>(this, generalData.imuMax, "Gyro full scale"));
internalField.Append(new SignedField<8>(this, generalData.gyroOffset, "Gyro Offset")); internalField.Append(new SignedField<8>(this, generalData.imuOffset, "Gyro Offset"));
} }
if (version >= 220) { if (version >= 220) {
+3 -3
View File
@@ -328,7 +328,7 @@ ui(new Ui::GeneralSetup)
} }
ui->switchesDelay->setValue(10*(generalSettings.switchesDelay+15)); ui->switchesDelay->setValue(10*(generalSettings.switchesDelay+15));
ui->blAlarm_ChkB->setChecked(generalSettings.flashBeep); ui->blAlarm_ChkB->setChecked(generalSettings.alarmsFlash);
if (!firmware->getCapability(HasBatMeterRange)) { if (!firmware->getCapability(HasBatMeterRange)) {
ui->batMeterRangeLabel->hide(); ui->batMeterRangeLabel->hide();
@@ -375,7 +375,7 @@ void GeneralSetupPanel::populateVoiceLangCB()
{ {
QComboBox * b = ui->voiceLang_CB; QComboBox * b = ui->voiceLang_CB;
// Note: these align with the radio NOT computer locales - TODO harmonise with ISO and one list!!! // Note: these align with the radio NOT computer locales - TODO harmonise with ISO and one list!!!
static QString strings[][2] = { static QString strings[][2] = {
{ tr("Chinese"), "cn" }, { tr("Chinese"), "cn" },
{ tr("Czech"), "cz" }, { tr("Czech"), "cz" },
{ tr("Danish"), "da" }, { tr("Danish"), "da" },
@@ -868,7 +868,7 @@ void GeneralSetupPanel::unlockSwitchEdited()
void GeneralSetupPanel::on_blAlarm_ChkB_stateChanged() void GeneralSetupPanel::on_blAlarm_ChkB_stateChanged()
{ {
generalSettings.flashBeep = ui->blAlarm_ChkB->isChecked(); generalSettings.alarmsFlash = ui->blAlarm_ChkB->isChecked();
emit modified(); emit modified();
} }