mirror of
https://github.com/EdgeTX/edgetx.git
synced 2025-07-24 00:35:14 +03:00
S3 Configuration inside Companion
This commit is contained in:
parent
cdde00286a
commit
dccfbb61d7
8 changed files with 189 additions and 108 deletions
|
@ -791,115 +791,122 @@ QString FuncSwData::repeatToString()
|
|||
GeneralSettings::GeneralSettings()
|
||||
{
|
||||
memset(this, 0, sizeof(GeneralSettings));
|
||||
|
||||
contrast = 25;
|
||||
vBatWarn = 90;
|
||||
for (int i=0; i<(NUM_STICKS+C9X_NUM_POTS ); ++i) {
|
||||
|
||||
for (int i=0; i<NUM_STICKS+C9X_NUM_POTS; ++i) {
|
||||
calibMid[i] = 0x200;
|
||||
calibSpanNeg[i] = 0x180;
|
||||
calibSpanPos[i] = 0x180;
|
||||
}
|
||||
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
potsType[0] = 1;
|
||||
potsType[1] = 1;
|
||||
}
|
||||
|
||||
templateSetup = g.profile[g.id()].channelOrder();
|
||||
stickMode = g.profile[g.id()].defaultMode();
|
||||
|
||||
QString t_calib=g.profile[g.id()].stickPotCalib();
|
||||
int potsnum=GetEepromInterface()->getCapability(Pots);
|
||||
if (t_calib.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
QString t_trainercalib=g.profile[g.id()].trainerCalib();
|
||||
int8_t t_vBatCalib=(int8_t)g.profile[g.id()].vBatCalib();
|
||||
int8_t t_currentCalib=(int8_t)g.profile[g.id()].currentCalib();
|
||||
int8_t t_PPM_Multiplier=(int8_t)g.profile[g.id()].ppmMultiplier();
|
||||
uint8_t t_stickMode=(uint8_t)g.profile[g.id()].gsStickMode();
|
||||
uint8_t t_vBatWarn=(uint8_t)g.profile[g.id()].vBatWarn();
|
||||
QString t_DisplaySet=g.profile[g.id()].display();
|
||||
QString t_BeeperSet=g.profile[g.id()].beeper();
|
||||
QString t_HapticSet=g.profile[g.id()].haptic();
|
||||
QString t_SpeakerSet=g.profile[g.id()].speaker();
|
||||
QString t_CountrySet=g.profile[g.id()].countryCode();
|
||||
QString t_calib=g.profile[g.id()].stickPotCalib();
|
||||
int potsnum=GetEepromInterface()->getCapability(Pots);
|
||||
if (t_calib.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
QString t_trainercalib=g.profile[g.id()].trainerCalib();
|
||||
int8_t t_vBatCalib=(int8_t)g.profile[g.id()].vBatCalib();
|
||||
int8_t t_currentCalib=(int8_t)g.profile[g.id()].currentCalib();
|
||||
int8_t t_PPM_Multiplier=(int8_t)g.profile[g.id()].ppmMultiplier();
|
||||
uint8_t t_stickMode=(uint8_t)g.profile[g.id()].gsStickMode();
|
||||
uint8_t t_vBatWarn=(uint8_t)g.profile[g.id()].vBatWarn();
|
||||
QString t_DisplaySet=g.profile[g.id()].display();
|
||||
QString t_BeeperSet=g.profile[g.id()].beeper();
|
||||
QString t_HapticSet=g.profile[g.id()].haptic();
|
||||
QString t_SpeakerSet=g.profile[g.id()].speaker();
|
||||
QString t_CountrySet=g.profile[g.id()].countryCode();
|
||||
|
||||
if ((t_calib.length()==(NUM_STICKS+potsnum)*12) && (t_trainercalib.length()==16)) {
|
||||
QString Byte;
|
||||
int16_t byte16;
|
||||
bool ok;
|
||||
for (int i=0; i<(NUM_STICKS+potsnum); i++) {
|
||||
Byte=t_calib.mid(i*12,4);
|
||||
byte16=(int16_t)Byte.toInt(&ok,16);
|
||||
if (ok)
|
||||
calibMid[i]=byte16;
|
||||
Byte=t_calib.mid(4+i*12,4);
|
||||
byte16=(int16_t)Byte.toInt(&ok,16);
|
||||
if (ok)
|
||||
calibSpanNeg[i]=byte16;
|
||||
Byte=t_calib.mid(8+i*12,4);
|
||||
byte16=(int16_t)Byte.toInt(&ok,16);
|
||||
if (ok)
|
||||
calibSpanPos[i]=byte16;
|
||||
}
|
||||
for (int i=0; i<4; i++) {
|
||||
Byte=t_trainercalib.mid(i*4,4);
|
||||
byte16=(int16_t)Byte.toInt(&ok,16);
|
||||
if (ok)
|
||||
trainer.calib[i]=byte16;
|
||||
}
|
||||
currentCalib=t_currentCalib;
|
||||
vBatCalib=t_vBatCalib;
|
||||
vBatWarn=t_vBatWarn;
|
||||
PPM_Multiplier=t_PPM_Multiplier;
|
||||
stickMode = t_stickMode;
|
||||
if ((t_calib.length()==(NUM_STICKS+potsnum)*12) && (t_trainercalib.length()==16)) {
|
||||
QString Byte;
|
||||
int16_t byte16;
|
||||
bool ok;
|
||||
for (int i=0; i<(NUM_STICKS+potsnum); i++) {
|
||||
Byte=t_calib.mid(i*12,4);
|
||||
byte16=(int16_t)Byte.toInt(&ok,16);
|
||||
if (ok)
|
||||
calibMid[i]=byte16;
|
||||
Byte=t_calib.mid(4+i*12,4);
|
||||
byte16=(int16_t)Byte.toInt(&ok,16);
|
||||
if (ok)
|
||||
calibSpanNeg[i]=byte16;
|
||||
Byte=t_calib.mid(8+i*12,4);
|
||||
byte16=(int16_t)Byte.toInt(&ok,16);
|
||||
if (ok)
|
||||
calibSpanPos[i]=byte16;
|
||||
}
|
||||
if ((t_DisplaySet.length()==6) && (t_BeeperSet.length()==4) && (t_HapticSet.length()==6) && (t_SpeakerSet.length()==6)) {
|
||||
uint8_t byte8u;
|
||||
int8_t byte8;
|
||||
bool ok;
|
||||
byte8=(int8_t)t_DisplaySet.mid(0,2).toInt(&ok,16);
|
||||
for (int i=0; i<4; i++) {
|
||||
Byte=t_trainercalib.mid(i*4,4);
|
||||
byte16=(int16_t)Byte.toInt(&ok,16);
|
||||
if (ok)
|
||||
optrexDisplay=(byte8==1 ? true : false);
|
||||
byte8u=(uint8_t)t_DisplaySet.mid(2,2).toUInt(&ok,16);
|
||||
trainer.calib[i]=byte16;
|
||||
}
|
||||
currentCalib=t_currentCalib;
|
||||
vBatCalib=t_vBatCalib;
|
||||
vBatWarn=t_vBatWarn;
|
||||
PPM_Multiplier=t_PPM_Multiplier;
|
||||
stickMode = t_stickMode;
|
||||
}
|
||||
if ((t_DisplaySet.length()==6) && (t_BeeperSet.length()==4) && (t_HapticSet.length()==6) && (t_SpeakerSet.length()==6)) {
|
||||
uint8_t byte8u;
|
||||
int8_t byte8;
|
||||
bool ok;
|
||||
byte8=(int8_t)t_DisplaySet.mid(0,2).toInt(&ok,16);
|
||||
if (ok)
|
||||
optrexDisplay=(byte8==1 ? true : false);
|
||||
byte8u=(uint8_t)t_DisplaySet.mid(2,2).toUInt(&ok,16);
|
||||
if (ok)
|
||||
contrast=byte8u;
|
||||
byte8u=(uint8_t)t_DisplaySet.mid(4,2).toUInt(&ok,16);
|
||||
if (ok)
|
||||
backlightBright=byte8u;
|
||||
byte8=(int8_t)t_BeeperSet.mid(0,2).toUInt(&ok,16);
|
||||
if (ok)
|
||||
beeperMode=(BeeperMode)byte8;
|
||||
byte8=(int8_t)t_BeeperSet.mid(2,2).toInt(&ok,16);
|
||||
if (ok)
|
||||
beeperLength=byte8;
|
||||
byte8=(int8_t)t_HapticSet.mid(0,2).toUInt(&ok,16);
|
||||
if (ok)
|
||||
hapticMode=(BeeperMode)byte8;
|
||||
byte8u=(uint8_t)t_HapticSet.mid(2,2).toUInt(&ok,16);
|
||||
if (ok)
|
||||
hapticStrength=byte8u;
|
||||
byte8=(int8_t)t_HapticSet.mid(4,2).toInt(&ok,16);
|
||||
if (ok)
|
||||
hapticLength=byte8;
|
||||
byte8u=(uint8_t)t_SpeakerSet.mid(0,2).toUInt(&ok,16);
|
||||
if (ok)
|
||||
speakerMode=byte8u;
|
||||
byte8u=(uint8_t)t_SpeakerSet.mid(2,2).toUInt(&ok,16);
|
||||
if (ok)
|
||||
speakerPitch=byte8u;
|
||||
byte8u=(uint8_t)t_SpeakerSet.mid(4,2).toUInt(&ok,16);
|
||||
if (ok)
|
||||
speakerVolume=byte8u;
|
||||
if (t_CountrySet.length()==6) {
|
||||
byte8u=(uint8_t)t_CountrySet.mid(0,2).toUInt(&ok,16);
|
||||
if (ok)
|
||||
contrast=byte8u;
|
||||
byte8u=(uint8_t)t_DisplaySet.mid(4,2).toUInt(&ok,16);
|
||||
countryCode=byte8u;
|
||||
byte8u=(uint8_t)t_CountrySet.mid(2,2).toUInt(&ok,16);
|
||||
if (ok)
|
||||
backlightBright=byte8u;
|
||||
byte8=(int8_t)t_BeeperSet.mid(0,2).toUInt(&ok,16);
|
||||
if (ok)
|
||||
beeperMode=(BeeperMode)byte8;
|
||||
byte8=(int8_t)t_BeeperSet.mid(2,2).toInt(&ok,16);
|
||||
if (ok)
|
||||
beeperLength=byte8;
|
||||
byte8=(int8_t)t_HapticSet.mid(0,2).toUInt(&ok,16);
|
||||
if (ok)
|
||||
hapticMode=(BeeperMode)byte8;
|
||||
byte8u=(uint8_t)t_HapticSet.mid(2,2).toUInt(&ok,16);
|
||||
if (ok)
|
||||
hapticStrength=byte8u;
|
||||
byte8=(int8_t)t_HapticSet.mid(4,2).toInt(&ok,16);
|
||||
if (ok)
|
||||
hapticLength=byte8;
|
||||
byte8u=(uint8_t)t_SpeakerSet.mid(0,2).toUInt(&ok,16);
|
||||
if (ok)
|
||||
speakerMode=byte8u;
|
||||
byte8u=(uint8_t)t_SpeakerSet.mid(2,2).toUInt(&ok,16);
|
||||
if (ok)
|
||||
speakerPitch=byte8u;
|
||||
byte8u=(uint8_t)t_SpeakerSet.mid(4,2).toUInt(&ok,16);
|
||||
if (ok)
|
||||
speakerVolume=byte8u;
|
||||
if (t_CountrySet.length()==6) {
|
||||
byte8u=(uint8_t)t_CountrySet.mid(0,2).toUInt(&ok,16);
|
||||
if (ok)
|
||||
countryCode=byte8u;
|
||||
byte8u=(uint8_t)t_CountrySet.mid(2,2).toUInt(&ok,16);
|
||||
if (ok)
|
||||
imperial=byte8u;
|
||||
QString chars=t_CountrySet.mid(4,2);
|
||||
ttsLanguage[0]=chars[0].toAscii();
|
||||
ttsLanguage[1]=chars[1].toAscii();
|
||||
}
|
||||
imperial=byte8u;
|
||||
QString chars=t_CountrySet.mid(4,2);
|
||||
ttsLanguage[0]=chars[0].toAscii();
|
||||
ttsLanguage[1]=chars[1].toAscii();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
RawSource GeneralSettings::getDefaultSource(unsigned int channel)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue