Merge branch 'next' of https://github.com/opentx/opentx into bsongis/Side_back_in_expos_is_it_useful

This commit is contained in:
Andre Bernet
2014-03-20 21:37:29 +01:00
93 changed files with 6181 additions and 1893 deletions
+4 -4
View File
@@ -52,7 +52,7 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac
ui->BurnFlashButton->setDisabled(true);
ui->FWFileName->clear();
ui->DateField->clear();
ui->SVNField->clear();
ui->versionField->clear();
ui->ModField->clear();
ui->FramFWInfo->hide();
ui->SplashFrame->hide();
@@ -132,7 +132,7 @@ void burnDialog::on_FlashLoadButton_clicked()
ui->BurnFlashButton->setDisabled(true);
ui->FWFileName->clear();
ui->DateField->clear();
ui->SVNField->clear();
ui->versionField->clear();
ui->ModField->clear();
ui->FramFWInfo->hide();
ui->SplashFrame->hide();
@@ -192,8 +192,8 @@ void burnDialog::checkFw(QString fileName)
if (flash.isValid()) {
ui->FramFWInfo->show();
ui->DateField->setText(flash.getDate() + " " + flash.getTime());
ui->SVNField->setText(flash.getSvn());
ui->ModField->setText(flash.getBuild());
ui->versionField->setText(flash.getVersion().isEmpty() ? flash.getSvn() : flash.getVersion());
ui->ModField->setText(flash.getEEprom());
ui->SplashFrame->hide();
if (flash.hasSplash()) {
+12 -13
View File
@@ -113,8 +113,15 @@
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="3" column="0">
<widget class="QLabel" name="dateLabel">
<property name="text">
<string>Date &amp; Time</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="SVNField">
<widget class="QLineEdit" name="versionField">
<property name="readOnly">
<bool>true</bool>
</property>
@@ -135,20 +142,13 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="svnLabel">
<widget class="QLabel" name="versionLabel">
<property name="text">
<string>SVN</string>
<string>Version</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="dateLabel">
<property name="text">
<string>Date &amp; Time</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="3" column="1">
<widget class="QLineEdit" name="DateField">
<property name="readOnly">
<bool>true</bool>
@@ -360,8 +360,7 @@
<tabstop>BurnFlashButton</tabstop>
<tabstop>FWFileName</tabstop>
<tabstop>FlashLoadButton</tabstop>
<tabstop>DateField</tabstop>
<tabstop>SVNField</tabstop>
<tabstop>versionField</tabstop>
<tabstop>ModField</tabstop>
<tabstop>useProfileImageCB</tabstop>
<tabstop>useFwImageCB</tabstop>
+100 -93
View File
@@ -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)
+13
View File
@@ -170,6 +170,19 @@ enum HeliSwashTypes {
extern const char * switches9X[];
extern const char * switchesX9D[];
enum ThrottleSource {
THROTTLE_SOURCE_THR,
THROTTLE_SOURCE_P1,
THROTTLE_SOURCE_P2,
THROTTLE_SOURCE_P3,
THROTTLE_SOURCE_S1 = THROTTLE_SOURCE_P1,
THROTTLE_SOURCE_S2,
THROTTLE_SOURCE_S3,
THROTTLE_SOURCE_LS,
THROTTLE_SOURCE_RS,
THROTTLE_SOURCE_FIRST_CHANNEL,
};
enum TelemetrySource {
TELEMETRY_SOURCE_TX_BATT,
TELEMETRY_SOURCE_TIMER1,
@@ -23,7 +23,6 @@
#define PCBTARANIS
#define CPUARM
#define HELI
#define TEMPLATES
#define SPLASH
#define FLIGHT_MODES
#define FRSKY
@@ -103,7 +102,6 @@ inline int geteepromsize() {
#undef SDCARD
#include "radio/src/simpgmspace.cpp"
#define SDCARD
#include "radio/src/templates.cpp"
#include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/telemetry/frsky_sport.cpp"
@@ -294,6 +294,32 @@ class SourcesConversionTable: public ConversionTable {
}
};
ThrottleSourceConversionTable::ThrottleSourceConversionTable(BoardEnum board, unsigned int version)
{
int val=0;
addConversion(THROTTLE_SOURCE_THR, val++);
if (IS_TARANIS(board)) {
addConversion(THROTTLE_SOURCE_S1, val++);
addConversion(THROTTLE_SOURCE_S2, val++);
if (version >= 216)
addConversion(THROTTLE_SOURCE_S3, val++);
addConversion(THROTTLE_SOURCE_LS, val++);
addConversion(THROTTLE_SOURCE_RS, val++);
}
else {
addConversion(THROTTLE_SOURCE_P1, val++);
addConversion(THROTTLE_SOURCE_P2, val++);
addConversion(THROTTLE_SOURCE_P3, val++);
}
for (int i=0; i<MAX_CHANNELS(board, version); i++) {
addConversion(THROTTLE_SOURCE_FIRST_CHANNEL+i, val++);
}
}
template <int N>
class SwitchField: public ConversionField< SignedField<N> > {
public:
@@ -2175,7 +2201,8 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
board(board),
version(version),
variant(variant),
protocolsConversionTable(board)
protocolsConversionTable(board),
throttleSourceConversionTable(board, version)
{
sprintf(name, "Model %s", modelData.name);
@@ -2285,7 +2312,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
internalField.Append(new SignedField<8>(modelData.moduleData[0].ppmFrameLength));
}
internalField.Append(new UnsignedField<8>(modelData.thrTraceSrc));
internalField.Append(new ConversionField< UnsignedField<8> >(modelData.thrTraceSrc, &throttleSourceConversionTable, "Throttle Source"));
if (!afterrelease21March2013) {
internalField.Append(new UnsignedField<8>(modelData.modelId));
@@ -2565,8 +2592,8 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
}
if (IS_TARANIS(board) && version >= 216) {
internalField.Append(new UnsignedField<8>(generalData.hw_uartMode));
for (int i=0; i<8; i++) {
internalField.Append(new UnsignedField<1>(generalData.potsType[i]));
for (int i=0; i<4; i++) {
internalField.Append(new UnsignedField<2>(potsType[i]));
}
}
}
@@ -2585,6 +2612,11 @@ void OpenTxGeneralData::beforeExport()
sum += generalData.calibSpanPos[i];
if (++count == 12) break;
}
for (int i=0; i<4; i++) {
potsType[i] = generalData.potsType[i];
if (i<2 && potsType[i] == 1)
potsType[i] = 0;
}
}
else {
for (int i=0; i<inputsCount; i++)
@@ -2597,4 +2629,8 @@ void OpenTxGeneralData::beforeExport()
void OpenTxGeneralData::afterImport()
{
for (int i=0; i<4; i++) {
if (i<2 && generalData.potsType[i] == 0)
generalData.potsType[i] = 1;
}
}
@@ -65,6 +65,7 @@ class OpenTxGeneralData: public TransformedField {
unsigned int version;
int inputsCount;
unsigned int chkSum;
unsigned int potsType[4];
};
class ProtocolsConversionTable: public ConversionTable
@@ -102,6 +103,12 @@ class ProtocolsConversionTable: public ConversionTable
}
};
class ThrottleSourceConversionTable: public ConversionTable {
public:
ThrottleSourceConversionTable(BoardEnum board, unsigned int version);
};
class ChannelsConversionTable: public ConversionTable
{
public:
@@ -133,6 +140,7 @@ class OpenTxModelData: public TransformedField {
char name[256];
int subprotocols[C9X_NUM_MODULES+1/*trainer*/];
ProtocolsConversionTable protocolsConversionTable;
ThrottleSourceConversionTable throttleSourceConversionTable;
ChannelsConversionTable channelsConversionTable;
};
+43 -157
View File
@@ -13,6 +13,7 @@
* GNU General Public License for more details.
*
*/
#include <QtGui>
#include "hexinterface.h"
#include "splash.h"
@@ -20,192 +21,77 @@
int getFileType(const QString &fullFileName)
{
if(QFileInfo(fullFileName).suffix().toUpper()=="HEX") return FILE_TYPE_HEX;
if(QFileInfo(fullFileName).suffix().toUpper()=="BIN") return FILE_TYPE_BIN;
if(QFileInfo(fullFileName).suffix().toUpper()=="EEPM") return FILE_TYPE_EEPM;
if(QFileInfo(fullFileName).suffix().toUpper()=="EEPE") return FILE_TYPE_EEPE;
if(QFileInfo(fullFileName).suffix().toUpper()=="XML") return FILE_TYPE_XML;
return 0;
QString suffix = QFileInfo(fullFileName).suffix().toUpper();
if (suffix == "HEX")
return FILE_TYPE_HEX;
else if (suffix == "BIN")
return FILE_TYPE_BIN;
else if (suffix == "EEPM")
return FILE_TYPE_EEPM;
else if (suffix == "EEPE")
return FILE_TYPE_EEPE;
else if (suffix == "XML")
return FILE_TYPE_XML;
else
return 0;
}
FlashInterface::FlashInterface(QString fileName)
FlashInterface::FlashInterface(QString fileName):
flash(MAX_FSIZE, 0),
flash_size(0),
isValidFlag(false)
{
char * temp = (char *)malloc(MAX_FSIZE);
date = "";
time = "";
svn = "";
build = "";
isValidFlag = true;
QFile file(fileName);
flash_size=0;
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file
isValidFlag = false;
}
else {
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file
QTextStream inputStream(&file);
flash_size = HexInterface(inputStream).load((uint8_t *)temp, MAX_FSIZE);
flash_size = HexInterface(inputStream).load((uint8_t *)flash.data(), MAX_FSIZE);
file.close();
inputStream.reset();
if (flash_size == 0) {
QFile file(fileName);
file.open(QIODevice::ReadOnly);
char * bin_flash = (char *)malloc(MAX_FSIZE);
flash_size = file.read(bin_flash, MAX_FSIZE);
flash = QByteArray(bin_flash, flash_size);
free(bin_flash);
}
else {
flash = QByteArray(temp, flash_size);
flash_size = file.read((char *)flash.data(), MAX_FSIZE);
}
if (flash_size > 0) {
SeekSvn();
SeekDate();
SeekTime();
SeekBuild();
svn = seekLabel(SVN_MARK);
version = seekLabel(VERS_MARK);
date = seekLabel(DATE_MARK);
time = seekLabel(TIME_MARK);
eeprom = seekLabel(EEPR_MARK);
SeekSplash();
}
else {
isValidFlag = false;
isValidFlag = true;
}
}
free(temp);
}
QString FlashInterface::getDate(void)
QString FlashInterface::seekString(const QString & string)
{
return date;
}
QString result = "";
QString FlashInterface::getTime(void)
{
return time;
}
QString FlashInterface::getSvn(void)
{
return svn;
}
QString FlashInterface::getBuild(void)
{
return build;
}
int FlashInterface::getSize()
{
return flash_size;
}
void FlashInterface::SeekSvn(void)
{
int i, start = -1, end = -1;
start = flash.indexOf(QString(SVN_MARK));
int start = flash.indexOf(string);
if (start > 0) {
start += QString(SVN_MARK).length();
for (i = start; i < (start + 20); i++) {
if (flash.at(i) == 0) {
start += string.length();
int end = -1;
for (int i=start; i<start+20; i++) {
char c = flash.at(i);
if (c == '\0' || c == '\036') {
end = i;
break;
}
}
if (end > 0) {
svn = QString(flash.mid(start, (end - start))).trimmed();
}
else {
svn = QString("");
result = flash.mid(start, (end - start)).trimmed();
}
}
return result;
}
void FlashInterface::SeekDate(void)
QString FlashInterface::seekLabel(const QString & label)
{
int i, start = -1, end = -1, startsvn=0;
startsvn = flash.indexOf(QString(SVN_MARK));
if (startsvn>0) {
start = flash.indexOf(QString(DATE_MARK),startsvn);
} else {
start = flash.indexOf(QString(DATE_MARK));
}
if (start > 0) {
start += QString(DATE_MARK).length();
for (i = start; i < (start + 20); i++) {
if (flash.at(i) == 0) {
end = i;
break;
}
}
if (end > 0) {
date = QString(flash.mid(start, (end - start))).trimmed();
}
else {
date = QString("");
}
}
}
QString result = seekString(label + "\037\033:");
if (!result.isEmpty())
return result;
void FlashInterface::SeekTime(void)
{
int i, start = -1, end = -1, startsvn=0;
startsvn = flash.indexOf(QString(SVN_MARK));
if (startsvn>0) {
start = flash.indexOf(QString(TIME_MARK),startsvn);
} else {
start = flash.indexOf(QString(TIME_MARK));
}
if (start > 0) {
start += QString(TIME_MARK).length();
for (i = start; i < (start + 20); i++) {
if (flash.at(i) == 0) {
end = i;
break;
}
}
if (end > 0) {
time = QString(flash.mid(start, (end - start))).trimmed();
}
else {
time = QString("");
}
}
}
void FlashInterface::SeekBuild(void)
{
int i, start = -1, end = -1;
start = flash.indexOf(QString(BLD_MARK));
if (start > 0) {
start += QString(BLD_MARK).length();
for (i = start; i < (start + 20); i++) {
if (flash.at(i) == 0) {
end = i;
break;
}
}
if (end > 0) {
build = QString(flash.mid(start, (end - start))).trimmed();
}
else {
build = QString("");
}
}
else {
start = flash.indexOf(QString(VAR_MARK));
if (start > 0) {
start += QString(VAR_MARK).length();
for (i = start; i < (start + 20); i++) {
if (flash.at(i) == 0) {
end = i;
break;
}
}
if (end > 0) {
build = QString(flash.mid(start, (end - start))).trimmed();
}
else {
build = QString("");
}
}
}
return seekString(label + ":");
}
void FlashInterface::SeekSplash(void)
+46 -47
View File
@@ -14,6 +14,7 @@
#ifndef FLASHINTERFACE_H
#define FLASHINTERFACE_H
#include <QDialog>
#include <QtGui>
#include <inttypes.h>
@@ -32,12 +33,12 @@
#define ERSKY9X_SPS "SPS"
#define ERSKY9X_SPE "SPE"
#define ERSKY9X_OFFSET (7)
#define VERS_MARK "VERS:"
#define SVN_MARK "SVN:"
#define DATE_MARK "DATE:"
#define TIME_MARK "TIME:"
#define BLD_MARK "BLD:"
#define VAR_MARK "EEPR:"
#define VERS_MARK "VERS"
#define SVN_MARK "SVN"
#define DATE_MARK "DATE"
#define TIME_MARK "TIME"
#define BLD_MARK "BLD"
#define EEPR_MARK "EEPR"
#define FILE_TYPE_BIN 1
#define FILE_TYPE_HEX 2
@@ -49,48 +50,46 @@ int getFileType(const QString &fullFileName);
class FlashInterface
{
public:
FlashInterface(QString filename);
QString getDate();
QString getTime();
QString getSvn();
int getSize();
QString getBuild();
QImage getSplash();
bool setSplash(const QImage & newsplash);
bool hasSplash();
int getSplashWidth();
uint getSplashHeight();
uint getSplashColors();
QImage::Format getSplashFormat();
uint saveFlash(QString fileName);
bool isValid();
public:
FlashInterface(QString filename);
inline QString getDate() { return date; }
inline QString getTime() { return time; }
inline QString getSvn() { return svn; }
int getSize() { return flash_size; }
inline QString getVersion() { return version; }
inline QString getEEprom() { return eeprom; }
QImage getSplash();
bool setSplash(const QImage & newsplash);
bool hasSplash();
int getSplashWidth();
uint getSplashHeight();
uint getSplashColors();
QImage::Format getSplashFormat();
uint saveFlash(QString fileName);
bool isValid();
private:
QByteArray flash;
void SeekVer();
void SeekSvn();
void SeekDate();
void SeekTime();
void SeekBuild();
void SeekSplash();
QString filename;
QString date;
QString time;
QString svn;
QString build;
QByteArray splash;
uint splash_offset;
uint splash_type;
uint splash_size;
uint splash_width;
uint splash_height;
uint splash_colors;
QImage::Format splash_format;
uint flash_size;
protected:
bool isValidFlag;
private:
QByteArray flash;
QString seekString(const QString & string);
QString seekLabel(const QString & label);
void SeekSplash();
QString filename;
QString date;
QString time;
QString svn;
QString version;
QString eeprom;
QByteArray splash;
uint splash_offset;
uint splash_type;
uint splash_size;
uint splash_width;
uint splash_height;
uint splash_colors;
QImage::Format splash_format;
uint flash_size;
bool isValidFlag;
};
#endif /* FLASHINTERFACE_H */
+9
View File
@@ -369,6 +369,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
if (GetEepromInterface()->getCapability(MultiposPots)) {
ui->pot1Type->setCurrentIndex(g_eeGeneral.potsType[0]);
ui->pot2Type->setCurrentIndex(g_eeGeneral.potsType[1]);
ui->pot3Type->setCurrentIndex(g_eeGeneral.potsType[2]);
}
else {
ui->potsTypeSeparator->hide();
@@ -376,6 +377,8 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->pot1TypeLabel->hide();
ui->pot2Type->hide();
ui->pot2TypeLabel->hide();
ui->pot3Type->hide();
ui->pot3TypeLabel->hide();
}
}
@@ -396,6 +399,12 @@ void GeneralEdit::on_pot2Type_currentIndexChanged(int index)
updateSettings();
}
void GeneralEdit::on_pot3Type_currentIndexChanged(int index)
{
g_eeGeneral.potsType[2] = index;
updateSettings();
}
void GeneralEdit::unlockSwitchEdited()
{
int i=0;
+1
View File
@@ -121,6 +121,7 @@ private slots:
void on_pot1Type_currentIndexChanged(int index);
void on_pot2Type_currentIndexChanged(int index);
void on_pot3Type_currentIndexChanged(int index);
void on_stickmodeCB_currentIndexChanged(int index);
void on_channelorderCB_currentIndexChanged(int index);
+54 -3
View File
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>795</width>
<width>804</width>
<height>912</height>
</rect>
</property>
@@ -1555,10 +1555,10 @@ Acceptable values are 5v..10v</string>
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<property name="topMargin">
<property name="verticalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<property name="topMargin">
<number>0</number>
</property>
<item row="0" column="2">
@@ -3520,6 +3520,11 @@ p, li { white-space: pre-wrap; }
3 - Loud.
4 - Extra loud.</string>
</property>
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>Pot (normal)</string>
@@ -3556,6 +3561,11 @@ p, li { white-space: pre-wrap; }
3 - Loud.
4 - Extra loud.</string>
</property>
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>Pot (normal)</string>
@@ -3575,6 +3585,47 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="pot3TypeLabel">
<property name="text">
<string>S3 Type</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QComboBox" name="pot3Type">
<property name="toolTip">
<string/>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string>Beeper volume
0 - Quiet. No beeps at all.
1 - No Keys. Normal beeps but menu keys do not beep.
2 - Normal.
3 - Loud.
4 - Extra loud.</string>
</property>
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>Pot (normal)</string>
</property>
</item>
<item>
<property name="text">
<string>Multipos Switch</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</widget>
-21
View File
@@ -63,27 +63,6 @@ void populateVoiceLangCB(QComboBox *b, QString language)
}
}
void populateTTraceCB(QComboBox *b, int value)
{
const QString strings9x[] = { QObject::tr("THR"), QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3")};
const QString stringstaranis[] = { QObject::tr("THR"), QObject::tr("S1"), QObject::tr("S2"), QObject::tr("LS"), QObject::tr("RS")};
b->clear();
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
for (int i=0; i< 5; i++) {
b->addItem(stringstaranis[i]);
}
} else {
for (int i=0; i< 4; i++) {
b->addItem(strings9x[i]);
}
}
int channels=(IS_ARM(GetEepromInterface()->getBoard()) ? 32 : 16);
for (int i=1; i<= channels; i++) {
b->addItem(QObject::tr("CH%1").arg(i, 2, 10, QChar('0')));
}
b->setCurrentIndex(value);
}
void populateRotEncCB(QComboBox *b, int value, int renumber)
{
QString strings[] = { QObject::tr("No"), QObject::tr("RotEnc A"), QObject::tr("Rot Enc B"), QObject::tr("Rot Enc C"), QObject::tr("Rot Enc D"), QObject::tr("Rot Enc E")};
-1
View File
@@ -27,7 +27,6 @@
void populateGvSourceCB(QComboBox *b, int value);
void populateVoiceLangCB(QComboBox *b, QString language);
void populateTTraceCB(QComboBox *b, int value);
void populateRotEncCB(QComboBox *b, int value, int renumber);
void populateBacklightCB(QComboBox *b, const uint8_t value);
+6 -5
View File
@@ -1251,15 +1251,16 @@ bool MainWindow::convertEEPROM(QString backupFile, QString restoreFile, QString
if ((svnTags.at(0) == "open9x")||(svnTags.at(0) == "opentx")) {
if (revision > 1464) {
QString fwBuild = flash.getBuild();
if (fwBuild.contains("-")) {
QStringList buildTags = fwBuild.split("-", QString::SkipEmptyParts);
QString fwEEprom = flash.getEEprom();
if (fwEEprom.contains("-")) {
QStringList buildTags = fwEEprom.split("-", QString::SkipEmptyParts);
if (buildTags.size() >= 1)
version = buildTags.at(0).toInt();
if (buildTags.size() >= 2)
variant = buildTags.at(1).toInt();
} else {
version = fwBuild.toInt(); // TODO changer le nom de la variable
}
else {
version = fwEEprom.toInt();
}
}
else {
+11 -8
View File
@@ -68,6 +68,7 @@ MdiChild::MdiChild():
fileChanged(false)
{
ui->setupUi(this);
this->setWindowIcon(CompanionIcon("open.png"));
ui->SimulateTxButton->setIcon(CompanionIcon("simulate.png"));
setAttribute(Qt::WA_DeleteOnClose);
@@ -166,7 +167,8 @@ void MdiChild::OpenEditWindow(bool wizard=false)
ret = QMessageBox::question(this, tr("Companion"), tr("Do you want to use model wizard? "), QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::Yes) {
wizard=true;
} else {
}
else {
qSleep(500);
ret = QMessageBox::question(this, tr("Companion"), tr("Ask this question again ? "), QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::No) {
@@ -496,7 +498,8 @@ void MdiChild::writeEeprom() // write to Tx
}
backupEnable=false;
}
} else {
}
else {
backupEnable=false;
}
QString stickCal=g.profile[g.id()].stickPotCalib();
@@ -632,7 +635,8 @@ void MdiChild::print(int model, QString filename)
printDialog *pd = new printDialog(this, &radioData.generalSettings, &radioData.models[model], filename);
pd->show();
} else {
}
else {
if(ui->modelsList->currentRow()<1) return;
printDialog *pd = new printDialog(this, &radioData.generalSettings, &radioData.models[ui->modelsList->currentRow()-1]);
pd->show();
@@ -671,9 +675,8 @@ bool MdiChild::loadBackup()
.arg(file.errorString()));
return false;
}
uint8_t *eeprom = (uint8_t *)malloc(eeprom_size);
memset(eeprom, 0, eeprom_size);
long result = file.read((char*)eeprom, eeprom_size);
QByteArray eeprom(eeprom_size, 0);
long result = file.read((char*)eeprom.data(), eeprom_size);
file.close();
if (result != eeprom_size) {
@@ -685,7 +688,7 @@ bool MdiChild::loadBackup()
return false;
}
if (!LoadBackup(radioData, eeprom, eeprom_size, index)) {
if (!LoadBackup(radioData, (uint8_t *)eeprom.data(), eeprom_size, index)) {
QMessageBox::critical(this, tr("Error"),
tr("Invalid binary backup File %1")
.arg(fileName));
@@ -693,6 +696,6 @@ bool MdiChild::loadBackup()
}
ui->modelsList->refreshList();
free(eeprom);
return true;
}
+38 -3
View File
@@ -500,8 +500,10 @@ void Setup::on_trimIncrement_currentIndexChanged(int index)
void Setup::on_throttleSource_currentIndexChanged(int index)
{
model.thrTraceSrc = index;
emit modified();
if (!lock) {
model.thrTraceSrc = ui->throttleSource->itemData(index).toInt();
emit modified();
}
}
void Setup::on_name_editingFinished()
@@ -543,12 +545,45 @@ void Setup::on_image_currentIndexChanged(int index)
}
}
void Setup::populateThrottleSourceCB()
{
const QString sources9x[] = { QObject::tr("THR"), QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3")};
const QString sourcesTaranis[] = { QObject::tr("THR"), QObject::tr("S1"), QObject::tr("S2"), QObject::tr("S3"), QObject::tr("LS"), QObject::tr("RS")};
unsigned int i;
lock = true;
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
for (i=0; i<6; i++) {
ui->throttleSource->addItem(sourcesTaranis[i], i);
}
}
else {
for (i=0; i<4; i++) {
ui->throttleSource->addItem(sources9x[i], i);
}
}
if (model.thrTraceSrc < i)
ui->throttleSource->setCurrentIndex(model.thrTraceSrc);
int channels = (IS_ARM(GetEepromInterface()->getBoard()) ? 32 : 16);
for (int i=0; i<channels; i++) {
ui->throttleSource->addItem(QObject::tr("CH%1").arg(i+1, 2, 10, QChar('0')), THROTTLE_SOURCE_FIRST_CHANNEL+i);
if (model.thrTraceSrc == unsigned(THROTTLE_SOURCE_FIRST_CHANNEL+i))
ui->throttleSource->setCurrentIndex(ui->throttleSource->count()-1);
}
lock = false;
}
void Setup::update()
{
ui->name->setText(model.name);
ui->throttleReverse->setChecked(model.throttleReversed);
populateTTraceCB(ui->throttleSource, model.thrTraceSrc);
populateThrottleSourceCB();
ui->throttleWarning->setChecked(!model.disableThrottleWarning);
//trim inc, thro trim, thro expo, instatrim
+2
View File
@@ -6,6 +6,7 @@
#include <QCheckBox>
#include <QSlider>
#include <QSpinBox>
#include <QComboBox>
#include <QLabel>
namespace Ui {
@@ -104,6 +105,7 @@ class Setup : public ModelPanel
void updateStartupSwitches();
void updatePotWarnings();
void updateBeepCenter();
void populateThrottleSourceCB();
};
#endif // SETUP_H
File diff suppressed because it is too large Load Diff