diff --git a/CREDITS.txt b/CREDITS.txt
index 6ea0e45a2..c9f3d46c8 100644
--- a/CREDITS.txt
+++ b/CREDITS.txt
@@ -2,6 +2,7 @@ Bertrand Songis
Romolo Manfredini
André Bernet
Michael Blandford
+Rob Thomson
Bryan J. Rentoul (aka Gruvin)
Cameron Weeks
Martin Hotař
@@ -17,4 +18,4 @@ Severino Anedda (splash screens)
Grootwitbaas - 9xforums.com (mac)
Adrian Amberg (splash screens)
Wallaguest1 - 9xforums.com (splash screens)
-HC1969 - 9xforums.com (splash screens)
\ No newline at end of file
+HC1969 - 9xforums.com (splash screens)
diff --git a/DONATIONS.txt b/DONATIONS.txt
index 49eab321a..fef01b05d 100644
--- a/DONATIONS.txt
+++ b/DONATIONS.txt
@@ -166,7 +166,7 @@ Heiko Polig
Andrew Fernie
Marco Lange
Nick McMillan
-Michel Baily (mensual)
+Michel Baily (monthly)
Patrick Mullen
Scott Campbell
Erich Roeder
@@ -272,3 +272,19 @@ Kenneth Lilja (monthly)
R Wells
Uwe Jordt
Harald Wilczak
+Bernhard Lohmann
+Ferenc Koller
+Robert Ferguson
+Daniel Byers
+Tyler Darby
+Miguel Villalpando
+Kim Dong Hoon
+Terry McKinley
+Walter Bell
+wsTech - http://wstech.de
+Clinton Linck
+Gordon Stahl
+Josep Clodas Sola
+Thierry Martin
+Peter Mauro
+Mitchell Brenner
diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt
index 318a65524..8ec853eaa 100644
--- a/companion/src/CMakeLists.txt
+++ b/companion/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-PROJECT( companion9x )
+PROJECT( companion )
SET( C9X_VERSION_MAJOR "1" )
SET( C9X_VERSION_MINOR "51" )
@@ -109,7 +109,9 @@ add_custom_command(
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/firmwares/ersky9x/ersky9xsimulator.cpp
)
-SET( companion9x_SRCS
+add_subdirectory(modeledit)
+
+SET( companion_SRCS
eeprominterface.cpp
hexinterface.cpp
flashinterface.cpp
@@ -124,28 +126,24 @@ SET( companion9x_SRCS
${ER9X_CHECKOUT_DIRECTORY}/er9xsimulator.cpp
firmwares/gruvin9x/gruvin9xeeprom.cpp
firmwares/gruvin9x/gruvin9xinterface.cpp
- firmwares/opentx/open9xeeprom.cpp
+ firmwares/opentx/opentxeeprom.cpp
firmwares/opentx/open9xStockeeprom.cpp
- firmwares/opentx/open9xinterface.cpp
firmwares/opentx/open9xGruvin9xeeprom.cpp
firmwares/opentx/open9xSky9xeeprom.cpp
+ firmwares/opentx/opentxinterface.cpp
firmwares/opentx/opentxTaranisSimulator.cpp
- firmwares/opentx/open9xSky9xsimulator.cpp
- firmwares/opentx/open9xGruvin9xsimulator.cpp
- firmwares/opentx/open9xM128simulator.cpp
- firmwares/opentx/open9xsimulator.cpp
+ firmwares/opentx/opentxSky9xsimulator.cpp
+ firmwares/opentx/opentxGruvin9xsimulator.cpp
+ firmwares/opentx/opentxM128simulator.cpp
+ firmwares/opentx/opentxsimulator.cpp
firmwares/ersky9x/ersky9xeeprom.cpp
firmwares/ersky9x/ersky9xinterface.cpp
${ERSKY9X_CHECKOUT_DIRECTORY}/ersky9xsimulator.cpp
- node.cpp
- edge.cpp
helpers.cpp
mdichild.cpp
generaledit.cpp
- modeledit.cpp
modelslist.cpp
mountlist.cpp
- mixerslist.cpp
avroutputdialog.cpp
preferencesdialog.cpp
burnconfigdialog.cpp
@@ -155,8 +153,6 @@ SET( companion9x_SRCS
burndialog.cpp
printdialog.cpp
fusesdialog.cpp
- expodialog.cpp
- mixerdialog.cpp
logsdialog.cpp
downloaddialog.cpp
simulatordialog.cpp
@@ -168,16 +164,14 @@ SET( companion9x_SRCS
qcustomplot.cpp
)
-SET( companion9x_MOC_HDRS
+SET( companion_MOC_HDRS
avroutputdialog.h
preferencesdialog.h
burnconfigdialog.h
comparedialog.h
printdialog.h
fusesdialog.h
- mixerdialog.h
logsdialog.h
- expodialog.h
contributorsdialog.h
customizesplashdialog.h
splashlibrary.h
@@ -191,31 +185,27 @@ SET( companion9x_MOC_HDRS
xmenuwidget.h
xsimulatordialog.h
generaledit.h
- modeledit.h
modelslist.h
- mixerslist.h
mdichild.h
mainwindow.h
myslider.h
modelconfigdialog.h
qcustomplot.h
+ helpers.h
)
-SET( companion9x_UIS
+SET( companion_UIS
mdichild.ui
avroutputdialog.ui
comparedialog.ui
fusesdialog.ui
- expodialog.ui
logsdialog.ui
- mixerdialog.ui
preferencesdialog.ui
simulatordialog.ui
xsimulatordialog.ui
burnconfigdialog.ui
downloaddialog.ui
generaledit.ui
- modeledit.ui
printdialog.ui
contributorsdialog.ui
customizesplashdialog.ui
@@ -225,25 +215,25 @@ SET( companion9x_UIS
)
IF ( SDL_FOUND )
- SET( companion9x_SRCS
- ${companion9x_SRCS}
+ SET( companion_SRCS
+ ${companion_SRCS}
joystick.cpp
joystickdialog.cpp
)
- SET( companion9x_MOC_HDRS
- ${companion9x_MOC_HDRS}
+ SET( companion_MOC_HDRS
+ ${companion_MOC_HDRS}
joystick.h
joystickdialog.h
)
- SET( companion9x_UIS
- ${companion9x_UIS}
+ SET( companion_UIS
+ ${companion_UIS}
joystickdialog.ui
)
ENDIF( )
-SET( companion9x_RCS
+SET( companion_RCS
companion9x.qrc
${CMAKE_CURRENT_BINARY_DIR}/translations.qrc
)
@@ -286,7 +276,7 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/firmwares/opentx/stamp-opentx.h.in ${
SET( PATCH_FLAGS "--binary" )
IF( WIN32 )
- SET( companion9x_SRCS ${companion9x_SRCS} icon.rc )
+ SET( companion_SRCS ${companion_SRCS} icon.rc )
IF ( NOT MSVC )
SET(CMAKE_EXE_LINKER_FLAGS -mwindows)
ENDIF( )
@@ -298,28 +288,33 @@ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} )
SET( LANGUAGES he pt ru de fr it sv cs )
FOREACH( language ${LANGUAGES} )
- SET( companion9x_TS ${companion9x_TS} translations/companion9x_${language}.ts )
+ SET( companion_TS ${companion_TS} translations/companion_${language}.ts )
ENDFOREACH( language )
-QT4_WRAP_UI( companion9x_SRCS ${companion9x_UIS} )
-QT4_WRAP_CPP( companion9x_SRCS ${companion9x_MOC_HDRS} )
-QT4_ADD_TRANSLATION( companion9x_QM ${companion9x_TS} )
-QT4_ADD_RESOURCES( companion9x_SRCS ${companion9x_RCS} )
+QT4_WRAP_UI( companion_SRCS ${companion_UIS} )
+QT4_WRAP_CPP( companion_SRCS ${companion_MOC_HDRS} )
+QT4_ADD_TRANSLATION( companion_QM ${companion_TS} )
+QT4_ADD_RESOURCES( companion_SRCS ${companion_RCS} )
ADD_DEFINITIONS( -DQT_TRANSLATIONS_DIR="${QT_TRANSLATIONS_DIR}" )
IF( APPLE )
- ADD_EXECUTABLE( ${PROJECT_NAME} MACOSX_BUNDLE ${companion9x_SRCS} ${companion9x_QM} )
+ ADD_EXECUTABLE( ${PROJECT_NAME} MACOSX_BUNDLE ${companion_SRCS} ${companion_QM} )
ELSE( )
- ADD_EXECUTABLE( ${PROJECT_NAME} WIN32 ${companion9x_SRCS} ${companion9x_QM} )
+ ADD_EXECUTABLE( ${PROJECT_NAME} WIN32 ${companion_SRCS} ${companion_QM} )
ENDIF( )
-TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${XERCESC_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS} )
+TARGET_LINK_LIBRARIES( ${PROJECT_NAME} modeledit ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${XERCESC_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS} )
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
INSTALL( TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin )
- INSTALL( FILES companion9x.desktop DESTINATION share/applications )
- INSTALL( FILES companion9x.png DESTINATION share/icons )
+ INSTALL( FILES companion.desktop DESTINATION share/applications )
+ INSTALL( FILES images/linuxicons/32x32/companion.png DESTINATION /usr/share/icons/hicolor/32x32/apps )
+ INSTALL( FILES images/linuxicons/48x48/companion.png DESTINATION /usr/share/icons/hicolor/48x48/apps )
+ INSTALL( FILES images/linuxicons/128x128/companion.png DESTINATION /usr/share/icons/hicolor/128x128/apps )
+ INSTALL( FILES images/linuxicons/256x256/companion.png DESTINATION /usr/share/icons/hicolor/256x256/apps )
+ INSTALL( FILES images/linuxicons/512x512/companion.png DESTINATION /usr/share/icons/hicolor/512x512/apps )
+ INSTALL( FILES images/linuxicons/scalable/companion.svg DESTINATION /usr/share/icons/hicolor/scalable/apps )
INSTALL( FILES ../targets/linux/45-taranis.rules DESTINATION /etc/udev/rules.d/ )
# Linux specific code
SET(OperatingSystem "Linux")
@@ -329,13 +324,13 @@ ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
IF( WIN32 )
IF( MSVC )
- SET( NSI_IN_FILE companion9x-vs.nsi.in )
+ SET( NSI_IN_FILE companion-vs.nsi.in )
ELSE( )
- SET( NSI_IN_FILE companion9x-msys.nsi.in )
+ SET( NSI_IN_FILE companion-msys.nsi.in )
ENDIF( )
SET( SYSDIR "$ENV{windir}/system32" )
- CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/../targets/windows/${NSI_IN_FILE} ${CMAKE_CURRENT_BINARY_DIR}/companion9x.nsi @ONLY)
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/../targets/windows/${NSI_IN_FILE} ${CMAKE_CURRENT_BINARY_DIR}/companion.nsi @ONLY)
FIND_PROGRAM(NSIS_EXE makensis.exe PATHS
"C:/Program Files/NSIS"
@@ -343,14 +338,14 @@ IF( WIN32 )
"C:/Programs/NSIS"
)
- ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/companion9xInstall.exe
- COMMAND "${NSIS_EXE}" ARGS companion9x.nsi
- DEPENDS ${PROJECT_NAME} ${PROJECT_BINARY_DIR}/companion9x.nsi
+ ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/companionInstall.exe
+ COMMAND "${NSIS_EXE}" ARGS companion.nsi
+ DEPENDS ${PROJECT_NAME} ${PROJECT_BINARY_DIR}/companion.nsi
COMMENT "Windows NSIS Installer")
ADD_CUSTOM_TARGET( installer
- DEPENDS ${PROJECT_BINARY_DIR}/companion9xInstall.exe
- SOURCES ${PROJECT_BINARY_DIR}/companion9x.nsi)
+ DEPENDS ${PROJECT_BINARY_DIR}/companionInstall.exe
+ SOURCES ${PROJECT_BINARY_DIR}/companion.nsi)
ENDIF( )
IF( APPLE )
@@ -362,36 +357,36 @@ IF( APPLE )
ENDIF()
ADD_CUSTOM_TARGET( addframeworks ALL
- COMMAND mkdir -p companion9x.app/Contents/Frameworks
- COMMAND mkdir -p companion9x.app/Contents/Resources
- COMMAND mkdir -p companion9x.app/Contents/translations
- COMMAND rsync ${PROJECT_SOURCE_DIR}/images/${MACOSX_BUNDLE_ICON_FILE} companion9x.app/Contents/Resources/${MACOSX_BUNDLE_ICON_FILE} # Copy the icon files
- COMMAND rsync ${PROJECT_SOURCE_DIR}/../macbuild/lib* companion9x.app/Contents/Frameworks
- #COMMAND rsync ${PROJECT_SOURCE_DIR}/../macbuild/libcrypto.1.0.0.dylib companion9x.app/Contents/Frameworks
- COMMAND rsync -r --exclude=.svn ${PROJECT_SOURCE_DIR}/../macbuild/qt_menu.nib companion9x.app/Contents/Resources/
- COMMAND rsync ${PROJECT_BINARY_DIR}/*.qm companion9x.app/Contents/translations
- COMMAND ${QT_BINARY_DIR}/macdeployqt companion9x.app
+ COMMAND mkdir -p companion.app/Contents/Frameworks
+ COMMAND mkdir -p companion.app/Contents/Resources
+ COMMAND mkdir -p companion.app/Contents/translations
+ COMMAND rsync ${PROJECT_SOURCE_DIR}/images/${MACOSX_BUNDLE_ICON_FILE} companion.app/Contents/Resources/${MACOSX_BUNDLE_ICON_FILE} # Copy the icon files
+ COMMAND rsync ${PROJECT_SOURCE_DIR}/../targets/mac/lib* companion.app/Contents/Frameworks
+ #COMMAND rsync ${PROJECT_SOURCE_DIR}/../targets/mac/libcrypto.1.0.0.dylib companion.app/Contents/Frameworks
+ COMMAND rsync -r --exclude=.svn ${PROJECT_SOURCE_DIR}/../targets/mac/qt_menu.nib companion.app/Contents/Resources/
+ COMMAND rsync ${PROJECT_BINARY_DIR}/*.qm companion.app/Contents/translations
+ COMMAND ${QT_BINARY_DIR}/macdeployqt companion.app
WORKING_DIRECTORY ${WORK_DIR}
DEPENDS ${PROJECT_NAME} )
ADD_CUSTOM_TARGET( makedmg
- COMMAND ${QT_BINARY_DIR}/macdeployqt companion9x.app -dmg -no-plugins
+ COMMAND ${QT_BINARY_DIR}/macdeployqt companion.app -dmg -no-plugins
WORKING_DIRECTORY ${WORK_DIR}
DEPENDS addframeworks )
ENDIF( )
ADD_CUSTOM_TARGET( stamp
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/version.h ${CMAKE_SOURCE_DIR}/../companion9x.stamp
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/version.h ${CMAKE_SOURCE_DIR}/../companion.stamp
DEPENDS ${CMAKE_BINARY_DIR}/version.h )
ADD_CUSTOM_TARGET( translations
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
- COMMAND lupdate-qt4 ${CMAKE_SOURCE_DIR} -ts ${companion9x_TS} )
+ COMMAND lupdate-qt4 ${CMAKE_SOURCE_DIR} -ts ${companion_TS} )
-SET(CPACK_PACKAGE_NAME "COMPANION9X")
-SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "EEPROM Editor for the openTx open source firmware")
+SET(CPACK_PACKAGE_NAME "COMPANION")
+SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Models and settings editor for the OpenTx open source firmware")
string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_PACKAGE_NAME_LOWERCASE)
find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems")
if(DPKG_PROGRAM)
diff --git a/companion/src/avroutputdialog.cpp b/companion/src/avroutputdialog.cpp
index a125d8e99..8680d39a7 100644
--- a/companion/src/avroutputdialog.cpp
+++ b/companion/src/avroutputdialog.cpp
@@ -58,7 +58,7 @@ avrOutputDialog::avrOutputDialog(QWidget *parent, QString prog, QStringList arg,
QFile exec;
winTitle=wTitle;
if (!(exec.exists(prog))) {
- QMessageBox::critical(this, "companion9x", getProgrammer() + " " + tr("executable not found"));
+ QMessageBox::critical(this, "Companion", getProgrammer() + " " + tr("executable not found"));
closeOpt = AVR_DIALOG_FORCE_CLOSE;
QTimer::singleShot(0, this, SLOT(forceClose()));
} else {
@@ -315,10 +315,10 @@ void avrOutputDialog::errorWizard()
}
}
if (fwexist==false) {
- QMessageBox::warning(this, "companion9x - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease check advanced burn options to set the correct cpu type.").arg(DeviceStr));
+ QMessageBox::warning(this, "Companion - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease check advanced burn options to set the correct cpu type.").arg(DeviceStr));
} else {
FirmwareInfo *firmware = GetCurrentFirmware();
- QMessageBox::warning(this, "companion9x - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease select an appropriate firmware type to program it.").arg(DeviceStr)+FwStr+tr("\nYou are currently using:\n %1").arg(firmware->name));
+ QMessageBox::warning(this, "Companion - Tip of the day", tr("Your radio uses a %1 CPU!!!\n\nPlease select an appropriate firmware type to program it.").arg(DeviceStr)+FwStr+tr("\nYou are currently using:\n %1").arg(firmware->name));
}
}
}
@@ -416,24 +416,24 @@ void avrOutputDialog::doFinished(int code=0)
if (hasErrors || code) {
if (!cmdLine.isEmpty()) {
if (getProgrammer()!="AVRDUDE") {
- QMessageBox::critical(this, "companion9x", getProgrammer() + " " + tr("did not finish correctly"));
+ QMessageBox::critical(this, "Companion", getProgrammer() + " " + tr("did not finish correctly"));
} else {
- int res = QMessageBox::question(this, "companion9x",getProgrammer() + " " + tr("did not finish correctly!\nDo you want some help ?"),QMessageBox::Yes | QMessageBox::No);
+ int res = QMessageBox::question(this, "Companion",getProgrammer() + " " + tr("did not finish correctly!\nDo you want some help ?"),QMessageBox::Yes | QMessageBox::No);
if (res != QMessageBox::No) {
errorWizard();
}
}
} else {
- QMessageBox::critical(this, "companion9x", tr("Copy did not finish correctly"));
+ QMessageBox::critical(this, "Companion", tr("Copy did not finish correctly"));
}
// reject();
} else {
if (!cmdLine.isEmpty()) {
ui->progressBar->setValue(100);
- QMessageBox::information(this, "companion9x", getProgrammer() + " " + tr("finished correctly"));
+ QMessageBox::information(this, "Companion", getProgrammer() + " " + tr("finished correctly"));
accept();
} else {
- QMessageBox::information(this, "companion9x", tr("Copy finished correctly"));
+ QMessageBox::information(this, "Companion", tr("Copy finished correctly"));
accept();
}
}
diff --git a/companion/src/burnconfigdialog.cpp b/companion/src/burnconfigdialog.cpp
index 71887d4da..f4440b05f 100644
--- a/companion/src/burnconfigdialog.cpp
+++ b/companion/src/burnconfigdialog.cpp
@@ -325,7 +325,7 @@ void burnConfigDialog::restFuses(bool eeProtect)
QMessageBox::StandardButton ret = QMessageBox::No;
- ret = QMessageBox::warning(this, tr("companion9x"),
+ ret = QMessageBox::warning(this, tr("Companion"),
tr("WARNING!
This will reset the fuses of %1 to the factory settings.
Writing fuses can mess up your radio.
Do this only if you are sure they are wrong!
Are you sure you want to continue?").arg(avrMCU),
QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::Yes)
@@ -394,7 +394,7 @@ void burnConfigDialog::on_advCtrChkB_toggled(bool checked)
} else {
ui->label_av3->show();
ui->avrdude_mcu->show();
- QMessageBox::warning(this, tr("companion9x"),
+ QMessageBox::warning(this, tr("Companion"),
tr("WARNING!
Normally CPU type is automatically selected according to the chosen firmware.
If you change the CPU type the resulting eeprom could be inconsistent."),
QMessageBox::Ok);
}
diff --git a/companion/src/burndialog.cpp b/companion/src/burndialog.cpp
index 54b37d7a2..c601b23cf 100644
--- a/companion/src/burndialog.cpp
+++ b/companion/src/burndialog.cpp
@@ -292,7 +292,7 @@ bool burnDialog::checkeEprom(QString fileName)
uint8_t eeprom[EESIZE_RLC_MAX];
int eeprom_size = HexInterface(inputStream).load(eeprom, EESIZE_RLC_MAX);
if (!eeprom_size) {
- int res = QMessageBox::question(this, "companion9x",tr("Invalid binary Models and Settings File %1, Proceed anyway ?").arg(fileName),QMessageBox::Yes | QMessageBox::No);
+ int res = QMessageBox::question(this, "Companion",tr("Invalid binary Models and Settings File %1, Proceed anyway ?").arg(fileName),QMessageBox::Yes | QMessageBox::No);
if (res == QMessageBox::No) {
return false;
}
@@ -302,7 +302,7 @@ bool burnDialog::checkeEprom(QString fileName)
}
file.close();
if (!LoadEeprom(radioData, eeprom, eeprom_size)) {
- int res = QMessageBox::question(this, "companion9x",tr("Invalid binary Models and Settings File %1, Proceed anyway ?").arg(fileName),QMessageBox::Yes | QMessageBox::No);
+ int res = QMessageBox::question(this, "Companion",tr("Invalid binary Models and Settings File %1, Proceed anyway ?").arg(fileName),QMessageBox::Yes | QMessageBox::No);
if (res == QMessageBox::No) {
return false;
}
@@ -325,7 +325,7 @@ bool burnDialog::checkeEprom(QString fileName)
return false;
}
if (!LoadEeprom(radioData, eeprom, eeprom_size)) {
- int res = QMessageBox::question(this, "companion9x",tr("Invalid binary Models and Settings File %1, Proceed anyway ?").arg(fileName),QMessageBox::Yes | QMessageBox::No);
+ int res = QMessageBox::question(this, "Companion",tr("Invalid binary Models and Settings File %1, Proceed anyway ?").arg(fileName),QMessageBox::Yes | QMessageBox::No);
if (res == QMessageBox::No) {
return false;
}
diff --git a/companion/src/burndialog.ui b/companion/src/burndialog.ui
index d9c51ec35..7c739d0a1 100644
--- a/companion/src/burndialog.ui
+++ b/companion/src/burndialog.ui
@@ -273,7 +273,7 @@
- Allows companion9x to write to older version of the firmware
+ Allows Companion to write to older version of the firmware
Check Firmware compatibility
diff --git a/companion/src/companion.desktop b/companion/src/companion.desktop
new file mode 100644
index 000000000..df19a4a80
--- /dev/null
+++ b/companion/src/companion.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Type=Application
+Encoding=UTF-8
+Name=Companion
+GenericName=Transmitter Companion App
+Comment=The Ultimate Transmitter Companion
+Icon=companion
+Exec='companion'
+Terminal=false
+StartupNotify=false
+Categories=Application
diff --git a/companion/src/companion9x.desktop b/companion/src/companion9x.desktop
deleted file mode 100644
index e50e1551a..000000000
--- a/companion/src/companion9x.desktop
+++ /dev/null
@@ -1,11 +0,0 @@
-[Desktop Entry]
-Type=Application
-Encoding=UTF-8
-Name=companion9x
-GenericName=COMPANION9X
-Comment=9x EeProm Editor
-Icon=/usr/share/icons/companion9x.png
-Exec='companion9x'
-Terminal=false
-StartupNotify=false
-Categories=Application
\ No newline at end of file
diff --git a/companion/src/companion9x.png b/companion/src/companion9x.png
deleted file mode 100644
index 90a961731..000000000
Binary files a/companion/src/companion9x.png and /dev/null differ
diff --git a/companion/src/companion9x.qrc b/companion/src/companion9x.qrc
index 8a8409172..6cd5e7faa 100644
--- a/companion/src/companion9x.qrc
+++ b/companion/src/companion9x.qrc
@@ -48,7 +48,7 @@
images/screenshot.png
images/splash.png
images/splasht.png
- images/companion9x-title.png
+ images/companion-title.png
images/read_eeprom.png
images/write_eeprom.png
images/write_flash.png
diff --git a/companion/src/comparedialog.cpp b/companion/src/comparedialog.cpp
index ded52c41c..48ed3f9f5 100644
--- a/companion/src/comparedialog.cpp
+++ b/companion/src/comparedialog.cpp
@@ -21,7 +21,7 @@ public:
}
bool general_settings;
uint8_t models_count;
- uint8_t models[C9XMAX_MODELS];
+ uint8_t models[C9X_MAX_MODELS];
};
compareDialog::compareDialog(QWidget *parent, GeneralSettings *gg) :
@@ -342,7 +342,7 @@ void compareDialog::printPhases()
gvars=1;
}
if (gvars==1) {
- gvarnum=GetEepromInterface()->getCapability(GvarsNum);
+ gvarnum=GetEepromInterface()->getCapability(Gvars);
}
if ((gvars==1 && GetEepromInterface()->getCapability(GvarsFlightPhases)) || GetEepromInterface()->getCapability(RotaryEncoders)) {
str.append("
");
@@ -564,7 +564,7 @@ void compareDialog::printGvars()
int gvarnum=0;
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT ) || (!GetEepromInterface()->getCapability(HasVariants) && GetEepromInterface()->getCapability(Gvars))) {
gvars=1;
- gvarnum=GetEepromInterface()->getCapability(GvarsNum);
+ gvarnum=GetEepromInterface()->getCapability(Gvars);
}
if (!GetEepromInterface()->getCapability(GvarsFlightPhases) && (gvars==1 && GetEepromInterface()->getCapability(Gvars))) {
@@ -649,7 +649,8 @@ void compareDialog::printExpos()
};
str += tr("Weight") + QString("%1").arg(getGVarString(ed->weight)).rightJustified(6, ' ');
- str += " " + tr("Expo") + QString("%1").arg(getGVarString(ed->expo)).rightJustified(7, ' ');
+ str += ed->curve.toString().replace("<", "<").replace(">", ">");
+
if (GetEepromInterface()->getCapability(FlightPhases)) {
if(ed->phases) {
if (ed->phases!=(unsigned int)(1<getCapability(FlightPhases))-1) {
@@ -681,16 +682,14 @@ void compareDialog::printExpos()
mask <<=1;
}
str += QString(")");
- } else {
+ }
+ else {
str += tr("DISABLED")+QString(" !!!");
}
}
}
if (ed->swtch.type)
str += " " + tr("Switch") + QString("(%1)").arg(ed->swtch.toString());
- if (ed->curveMode)
- if (ed->curveParam)
- str += " " + tr("Curve") + QString("(%1)").arg(getCurveStr(ed->curveParam).replace("<", "<").replace(">", ">"));
str += "";
}
}
@@ -728,7 +727,8 @@ void compareDialog::printExpos()
}
str += tr("Weight") + QString("%1").arg(getGVarString(ed->weight)).rightJustified(6, ' ');
- str += " " + tr("Expo") + QString("%1").arg(getGVarString(ed->expo)).rightJustified(7, ' ');
+ str += ed->curve.toString().replace("<", "<").replace(">", ">");
+
if (GetEepromInterface()->getCapability(FlightPhases)) {
if(ed->phases) {
if (ed->phases!=(unsigned int)(1<getCapability(FlightPhases))-1) {
@@ -767,9 +767,7 @@ void compareDialog::printExpos()
}
if (ed->swtch.type)
str += " " + tr("Switch") + QString("(%1)").arg(ed->swtch.toString());
- if (ed->curveMode)
- if (ed->curveParam)
- str += " " + tr("Curve") + QString("(%1)").arg(getCurveStr(ed->curveParam).replace("<", "<").replace(">", ">"));
+
str += "";
}
}
@@ -824,13 +822,8 @@ void compareDialog::printMixers()
str += md->srcRaw.toString();
if (md->swtch.type) str += " " + tr("Switch") + QString("(%1)").arg(md->swtch.toString());
if (md->carryTrim) str += " " + tr("noTrim");
- if(GetEepromInterface()->getCapability(MixFmTrim) && md->enableFmTrim==1){
- if (md->sOffset) str += " "+ tr("FMTrim") + QString(" (%1%)").arg(md->sOffset);
- } else {
- if (md->sOffset) str += " "+ tr("Offset") + QString(" (%1%)").arg(getGVarString(md->sOffset));
- }
- if (md->differential) str += " "+ tr("Diff") + QString(" (%1%)").arg(getGVarString(md->differential));
- if (md->curve) str += " " + tr("Curve") + QString("(%1)").arg(getCurveStr(md->curve).replace("<", "<").replace(">", ">"));
+ if (md->sOffset) str += " "+ tr("Offset") + QString(" (%1%)").arg(getGVarString(md->sOffset));
+ str += md->curve.toString().replace("<", "<").replace(">", ">");
if (md->delayDown || md->delayUp) str += tr(" Delay(u%1:d%2)").arg(md->delayUp/scale).arg(md->delayDown/scale);
if (md->speedDown || md->speedUp) str += tr(" Slow(u%1:d%2)").arg(md->speedUp/scale).arg(md->speedDown/scale);
if (md->mixWarn) str += " "+tr("Warn")+QString("(%1)").arg(md->mixWarn);
@@ -907,13 +900,9 @@ void compareDialog::printMixers()
str += md->srcRaw.toString();
if (md->swtch.type) str += " " + tr("Switch") + QString("(%1)").arg(md->swtch.toString());
if (md->carryTrim) str += " " + tr("noTrim");
- if(GetEepromInterface()->getCapability(MixFmTrim) && md->enableFmTrim==1){
- if (md->sOffset) str += " "+ tr("FMTrim") + QString(" (%1%)").arg(getGVarString(md->sOffset));
- } else {
- if (md->sOffset) str += " "+ tr("Offset") + QString(" (%1%)").arg(getGVarString(md->sOffset));
- }
- if (md->differential) str += " "+ tr("Diff") + QString(" (%1%)").arg(getGVarString(md->differential));
- if (md->curve) str += " " + tr("Curve") + QString("(%1)").arg(getCurveStr(md->curve).replace("<", "<").replace(">", ">"));
+ if (md->sOffset) str += " "+ tr("Offset") + QString(" (%1%)").arg(getGVarString(md->sOffset));
+ // TODO if (md->differential) str += " "+ tr("Diff") + QString(" (%1%)").arg(getGVarString(md->differential));
+ // TODO if (md->curve) str += " " + tr("Curve") + QString("(%1)").arg(getCurveStr(md->curve).replace("<", "<").replace(">", ">"));
if (md->delayDown || md->delayUp) str += tr(" Delay(u%1:d%2)").arg(md->delayUp/scale).arg(md->delayDown/scale);
if (md->speedDown || md->speedUp) str += tr(" Slow(u%1:d%2)").arg(md->speedUp/scale).arg(md->speedDown/scale);
if (md->mixWarn) str += " "+tr("Warn")+QString("(%1)").arg(md->mixWarn);
diff --git a/companion/src/contributorsdialog.cpp b/companion/src/contributorsdialog.cpp
index d60a682db..02eb30041 100644
--- a/companion/src/contributorsdialog.cpp
+++ b/companion/src/contributorsdialog.cpp
@@ -26,7 +26,8 @@ contributorsDialog::contributorsDialog(QWidget *parent, int contest, QString rnu
ui->textBrowser->insertPlainText(file2.readAll());
}
ui->textBrowser->insertPlainText("\n\n\n");
- ui->textBrowser->insertPlainText(tr("Honors go to Rafal Tomczak (RadioClone) and Thomas Husterer (th9x) \nof course. Also to Erez Raviv (er9x) and it's fantastic eePe, from which\ncompanion9x was forked out."));
+ ui->textBrowser->insertPlainText(tr(
+"Honors go to Rafal Tomczak (RadioClone) and Thomas Husterer (th9x) \nof course. Also to Erez Raviv (er9x) and the fantastic eePe program \nwhich was the staring point for OpenTX Companion."));
ui->textBrowser->insertPlainText("\n\n");
ui->textBrowser->insertPlainText(tr("Thank you all !!!"));
ui->textBrowser->setReadOnly(true);
@@ -42,7 +43,7 @@ contributorsDialog::contributorsDialog(QWidget *parent, int contest, QString rnu
}
ui->textBrowser->setReadOnly(true);
ui->textBrowser->verticalScrollBar()->setValue(0);
- this->setWindowTitle(tr("Companion9x Release Notes"));
+ this->setWindowTitle(tr("Companion Release Notes"));
}
break;
case 2:{
diff --git a/companion/src/downloaddialog.cpp b/companion/src/downloaddialog.cpp
index 83da451bd..bfd425619 100644
--- a/companion/src/downloaddialog.cpp
+++ b/companion/src/downloaddialog.cpp
@@ -21,7 +21,7 @@ downloadDialog::downloadDialog(QWidget *parent, QString src, QString tgt) :
file = new QFile(tgt);
if (!file->open(QIODevice::WriteOnly)) {
- QMessageBox::critical(this, "companion9x",
+ QMessageBox::critical(this, "Companion",
tr("Unable to save the file %1: %2.")
.arg(tgt).arg(file->errorString()));
QTimer::singleShot(0, this, SLOT(fileError()));
@@ -51,7 +51,7 @@ void downloadDialog::httpFinished()
if (reply->error())
{
file->remove();
- QMessageBox::information(this, tr("companion9x"),
+ QMessageBox::information(this, tr("Companion"),
tr("Download failed: %1.")
.arg(reply->errorString()));
ok = false;
diff --git a/companion/src/eepromimportexport.h b/companion/src/eepromimportexport.h
index 370287851..ed5ab9ff5 100644
--- a/companion/src/eepromimportexport.h
+++ b/companion/src/eepromimportexport.h
@@ -74,7 +74,10 @@ class DataField {
QByteArray bytes = bitsToBytes(bits);
int result = (offset+bits.count()) % 8;
for (int i=0; iDump(level+1, offset);
}
@@ -547,6 +550,7 @@ class ConversionField: public TransformedField {
_field(0),
table(table),
shift(0),
+ scale(1),
min(INT_MIN),
max(INT_MAX),
exportFunc(NULL),
@@ -562,6 +566,7 @@ class ConversionField: public TransformedField {
_field(0),
table(table),
shift(0),
+ scale(0),
min(INT_MIN),
max(INT_MAX),
exportFunc(NULL),
@@ -577,6 +582,7 @@ class ConversionField: public TransformedField {
_field(0),
table(NULL),
shift(0),
+ scale(0),
min(INT_MIN),
max(INT_MAX),
exportFunc(exportFunc),
@@ -585,13 +591,14 @@ class ConversionField: public TransformedField {
{
}
- ConversionField(int & field, int shift, int min=INT_MIN, int max=INT_MAX, const char *name = "Signed shifted"):
+ ConversionField(int & field, int shift, int scale=0, int min=INT_MIN, int max=INT_MAX, const char *name = "Signed shifted"):
TransformedField(internalField),
internalField(_field, name),
field(field),
_field(0),
table(NULL),
shift(shift),
+ scale(scale),
min(min),
max(max),
exportFunc(NULL),
@@ -600,13 +607,14 @@ class ConversionField: public TransformedField {
{
}
- ConversionField(unsigned int & field, int shift):
+ ConversionField(unsigned int & field, int shift, int scale=0):
TransformedField(internalField),
internalField((unsigned int &)_field),
field((int &)field),
_field(0),
table(NULL),
shift(shift),
+ scale(scale),
min(INT_MIN),
max(INT_MAX),
exportFunc(NULL),
@@ -617,19 +625,25 @@ class ConversionField: public TransformedField {
virtual void beforeExport()
{
+ int val = field;
+
+ if (scale) {
+ val /= scale;
+ }
+
if (table) {
- if (table->exportValue(field, _field))
+ if (table->exportValue(val, _field))
return;
if (!error.isEmpty())
EEPROMWarnings += error + "\n";
}
else if (shift) {
- if (field < min) _field = min + shift;
- else if (field > max) _field = max + shift;
- else _field = field + shift;
+ if (val < min) _field = min + shift;
+ else if (val > max) _field = max + shift;
+ else _field = val + shift;
}
else {
- _field = exportFunc(field);
+ _field = exportFunc(val);
}
}
@@ -645,6 +659,10 @@ class ConversionField: public TransformedField {
else {
field = importFunc(_field);
}
+
+ if (scale) {
+ field *= scale;
+ }
}
protected:
@@ -653,6 +671,7 @@ class ConversionField: public TransformedField {
int _field;
ConversionTable * table;
int shift;
+ int scale;
int min;
int max;
int (*exportFunc)(int);
diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp
index 497149ca2..998e8d9bf 100644
--- a/companion/src/eeprominterface.cpp
+++ b/companion/src/eeprominterface.cpp
@@ -4,12 +4,16 @@
#include "firmwares/er9x/er9xinterface.h"
#include "firmwares/th9x/th9xinterface.h"
#include "firmwares/gruvin9x/gruvin9xinterface.h"
-#include "firmwares/opentx/open9xinterface.h"
+#include "firmwares/opentx/opentxinterface.h"
#include "firmwares/ersky9x/ersky9xinterface.h"
#include "qsettings.h"
+#include "helpers.h"
QString EEPROMWarnings;
+const char * switches9X[] = { "3POS", "THR", "RUD", "ELE", "AIL", "GEA", "TRN" };
+const char * switchesX9D[] = { "SA", "SB", "SC", "SD", "SE", "SF", "SG", "SH" };
+
void setEEPROMString(char *dst, const char *src, int size)
{
memcpy(dst, src, size);
@@ -244,27 +248,28 @@ double RawSource::getStep(const ModelData & Model)
}
}
+QString AnalogString(int index)
+{
+ static const QString sticks[] = { QObject::tr("Rud"), QObject::tr("Ele"), QObject::tr("Thr"), QObject::tr("Ail") };
+ static const QString pots9X[] = { QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3") };
+ static const QString potsX9D[] = { QObject::tr("S1"), QObject::tr("S2"), QObject::tr("LS"), QObject::tr("RS") };
+
+ if (index < 4)
+ return CHECK_IN_ARRAY(sticks, index);
+ else
+ return (IS_TARANIS(GetEepromInterface()->getBoard()) ? CHECK_IN_ARRAY(potsX9D, index-4) : CHECK_IN_ARRAY(pots9X, index-4));
+}
+
+QString RotaryEncoderString(int index)
+{
+ static const QString rotary[] = { QObject::tr("REa"), QObject::tr("REb") };
+ return CHECK_IN_ARRAY(rotary, index);
+}
+
QString RawSource::toString()
{
- static const QString sticks[] = { QObject::tr("Rud"), QObject::tr("Ele"), QObject::tr("Thr"), QObject::tr("Ail") };
-
static const QString trims[] = { QObject::tr("TrmR"), QObject::tr("TrmE"), QObject::tr("TrmT"), QObject::tr("TrmA")};
- static const QString pots9X[] = { QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3") };
-
- static const QString potsX9D[] = { QObject::tr("S1"), QObject::tr("S2"), QObject::tr("LS"), QObject::tr("RS") };
-
- static const QString rotary[] = { QObject::tr("REa"), QObject::tr("REb") };
-
- static const QString switches9X[] = { QObject::tr("3POS"),
- QObject::tr("THR"), QObject::tr("RUD"), QObject::tr("ELE"),
- QObject::tr("AIL"), QObject::tr("GEA"), QObject::tr("TRN"),
- };
-
- static const QString switchesX9D[] = { QObject::tr("SA"), QObject::tr("SB"), QObject::tr("SC"), QObject::tr("SD"),
- QObject::tr("SE"), QObject::tr("SF"), QObject::tr("SG"), QObject::tr("SH"),
- };
-
static const QString telemetry[] = { QObject::tr("Batt"), QObject::tr("Timer1"), QObject::tr("Timer2"),
(IS_TARANIS(GetEepromInterface()->getBoard()) ? QObject::tr("SWR") : QObject::tr("Tx")), (IS_TARANIS(GetEepromInterface()->getBoard()) ? QObject::tr("RSSI") : QObject::tr("Rx")), QObject::tr("A1"), QObject::tr("A2"), QObject::tr("Alt"), QObject::tr("Rpm"), QObject::tr("Fuel"), QObject::tr("T1"),
QObject::tr("T2"), QObject::tr("Speed"), QObject::tr("Dist"), QObject::tr("GPS Alt"), QObject::tr("Cell"), QObject::tr("Cels"), QObject::tr("Vfas"), QObject::tr("Curr"),
@@ -284,14 +289,11 @@ QString RawSource::toString()
}
switch(type) {
case SOURCE_TYPE_STICK:
- if (index < 4)
- return CHECK_IN_ARRAY(sticks, index);
- else
- return (IS_TARANIS(GetEepromInterface()->getBoard()) ? CHECK_IN_ARRAY(potsX9D, index-4) : CHECK_IN_ARRAY(pots9X, index-4));
+ return AnalogString(index);
case SOURCE_TYPE_TRIM:
return CHECK_IN_ARRAY(trims, index);
case SOURCE_TYPE_ROTARY_ENCODER:
- return CHECK_IN_ARRAY(rotary, index);
+ return RotaryEncoderString(index);
case SOURCE_TYPE_MAX:
return QObject::tr("MAX");
case SOURCE_TYPE_SWITCH:
@@ -407,6 +409,25 @@ QString RawSwitch::toString()
return QObject::tr("----");
}
+QString CurveReference::toString()
+{
+ if (value == 0) {
+ return "----";
+ }
+ else {
+ switch(type) {
+ case CURVE_REF_DIFF:
+ return QObject::tr("Diff(%1)").arg(getGVarString(value));
+ case CURVE_REF_EXPO:
+ return QObject::tr("Expo(%1)").arg(getGVarString(value));
+ case CURVE_REF_FUNC:
+ return QObject::tr("Function(%1)").arg(QString("x>0" "x<0" "|x|" "f>0" "f<0" "|f|").mid(3*(value-1), 3));
+ default:
+ return QString(value > 0 ? QObject::tr("Curve(%1)") : QObject::tr("!Curve(%1)")).arg(abs(value));
+ }
+ }
+}
+
GeneralSettings::GeneralSettings()
{
memset(this, 0, sizeof(GeneralSettings));
@@ -534,6 +555,18 @@ ModelData::ModelData()
clear();
}
+void ModelData::clearInputs()
+{
+ for (int i=0; igetCapability(CustomCurves);
for (int i=0; i=8)
- curves[i].clear(9);
- else
- curves[i].clear(5);
+ curves[i].clear(5);
}
swashRingData.clear();
@@ -617,13 +644,13 @@ ModelData ModelData::removeGlobalVars()
for (int i=0; i t LIMIT(t mi, t x, t ma) { return std::min(std::max(mi, x), ma
enum BoardEnum {
BOARD_STOCK,
BOARD_M128,
+ BOARD_MEGA2560,
BOARD_GRUVIN9X,
BOARD_SKY9X,
BOARD_TARANIS,
BOARD_TARANIS_REV4a
};
+
#define IS_STOCK(board) (board==BOARD_STOCK || board==BOARD_M128)
-#define IS_ARM(board) (board==BOARD_SKY9X || board==BOARD_TARANIS || board==BOARD_TARANIS_REV4a)
-#define IS_TARANIS(board) (board==BOARD_TARANIS || board==BOARD_TARANIS_REV4a)
+#define IS_2560(board) (board==BOARD_GRUVIN9X || board==BOARD_MEGA2560)
+#define IS_ARM(board) (board==BOARD_SKY9X || board==BOARD_TARANIS || board==BOARD_TARANIS_REV4a)
+#define IS_TARANIS(board) (board==BOARD_TARANIS || board==BOARD_TARANIS_REV4a)
const uint8_t modn12x3[4][4]= {
{1, 2, 3, 4},
@@ -59,13 +62,14 @@ const uint8_t modn12x3[4][4]= {
{4, 2, 3, 1},
{4, 3, 2, 1} };
-#define C9XMAX_MODELS 60
+#define C9X_MAX_MODELS 60
#define C9X_MAX_PHASES 9
#define C9X_MAX_MIXERS 64
-#define C9X_MAX_EXPOS 32
-#define C9X_MAX_CURVES 16
-#define MAX_POINTS 17
-#define C9X_MAX_GVARS 9
+#define C9X_MAX_EXPOS 64
+#define C9X_MAX_CURVES 32
+#define C9X_MAX_POINTS 17
+#define C9X_MAX_GVARS 9
+#define C9X_MAX_ENCODERS 2
#define NUM_SAFETY_CHNOUT 16
#define C9X_NUM_CHNOUT 32 // number of real output channels
#define C9X_NUM_CSW 32 // number of custom switches
@@ -107,6 +111,18 @@ const uint8_t chout_ar[] = { //First number is 0..23 -> template setup, Second
3,1,2,4 , 3,1,4,2 , 3,2,1,4 , 3,2,4,1 , 3,4,1,2 , 3,4,2,1,
4,1,2,3 , 4,1,3,2 , 4,2,1,3 , 4,2,3,1 , 4,3,1,2 , 4,3,2,1 }; // TODO delete it?
+// Beep center bits
+#define BC_BIT_RUD (0x01)
+#define BC_BIT_ELE (0x02)
+#define BC_BIT_THR (0x04)
+#define BC_BIT_AIL (0x08)
+#define BC_BIT_P1 (0x10)
+#define BC_BIT_P2 (0x20)
+#define BC_BIT_P3 (0x40)
+#define BC_BIT_P4 (0x80)
+#define BC_BIT_REA (0x80)
+#define BC_BIT_REB (0x100)
+
// TODO remove this enum!
enum EnumKeys {
KEY_MENU,
@@ -185,10 +201,13 @@ enum HeliSwashTypes {
#define NUM_CAL_PPM 4
#define NUM_PPM 8
#define NUM_CYC 3
-#define C9X_NUM_SWITCHES 10
-#define C9X_NUM_KEYS 6
+#define C9X_NUM_SWITCHES 10
+#define C9X_NUM_KEYS 6
#define C9X_MAX_TIMERS 2
+extern const char * switches9X[];
+extern const char * switchesX9D[];
+
enum TelemetrySource {
TELEMETRY_SOURCE_TX_BATT,
TELEMETRY_SOURCE_TIMER1,
@@ -241,6 +260,8 @@ enum TelemetrySource {
enum RawSourceType {
SOURCE_TYPE_NONE,
+ SOURCE_TYPE_VIRTUAL_INPUT,
+ SOURCE_TYPE_LUA_INPUT,
SOURCE_TYPE_STICK, // and POTS
SOURCE_TYPE_ROTARY_ENCODER,
SOURCE_TYPE_TRIM,
@@ -254,8 +275,12 @@ enum RawSourceType {
SOURCE_TYPE_TELEMETRY,
MAX_SOURCE_TYPE
};
+
class ModelData;
+QString AnalogString(int index);
+QString RotaryEncoderString(int index);
+
class RawSource {
public:
RawSource():
@@ -404,7 +429,6 @@ class GeneralSettings {
int timezone;
bool optrexDisplay;
unsigned int inactivityTimer;
- bool throttleReversed;
bool minuteBeep;
bool preBeep;
bool flashBeep;
@@ -451,17 +475,44 @@ class GeneralSettings {
unsigned int switchUnlockStates;
};
+class CurveReference {
+ public:
+ enum CurveRefType {
+ CURVE_REF_DIFF,
+ CURVE_REF_EXPO,
+ CURVE_REF_FUNC,
+ CURVE_REF_CUSTOM
+ };
+
+ CurveReference() { clear(); }
+
+ CurveReference(CurveRefType type, int value):
+ type(type),
+ value(value)
+ {
+ }
+
+ void clear() { memset(this, 0, sizeof(CurveReference)); }
+
+ CurveRefType type;
+ int value;
+
+ QString toString();
+};
+
class ExpoData {
public:
ExpoData() { clear(); }
+ RawSource srcRaw;
+ unsigned int scale;
unsigned int mode; // 0=end, 1=pos, 2=neg, 3=both
unsigned int chn;
RawSwitch swtch;
unsigned int phases; // -5=!FP4, 0=normal, 5=FP4
int weight;
- int expo;
- unsigned int curveMode;
- int curveParam;
+ int offset;
+ CurveReference curve;
+ int carryTrim;
char name[10+1];
void clear() { memset(this, 0, sizeof(ExpoData)); }
};
@@ -474,11 +525,19 @@ class CurvePoint {
class CurveData {
public:
+ enum CurveType {
+ CURVE_TYPE_STANDARD,
+ CURVE_TYPE_CUSTOM,
+ CURVE_TYPE_LAST = CURVE_TYPE_CUSTOM
+ };
+
CurveData() { clear(5); }
- bool custom; // 0=end, 1=pos, 2=neg, 3=both
- uint8_t count;
- CurvePoint points[MAX_POINTS];
- char name[6+1];
+
+ CurveType type;
+ bool smooth;
+ int count;
+ CurvePoint points[C9X_MAX_POINTS];
+ char name[6+1];
void clear(int count) { memset(this, 0, sizeof(CurveData)); this->count = count; }
};
@@ -492,6 +551,7 @@ class LimitData {
int ppmCenter;
bool symetrical;
char name[6+1];
+ CurveReference curve;
void clear() { memset(this, 0, sizeof(LimitData)); min = -100; max = +100; }
};
@@ -501,7 +561,6 @@ enum MltpxValue {
MLTPX_REP=2
};
-
class MixData {
public:
MixData() { clear(); }
@@ -509,9 +568,8 @@ class MixData {
RawSource srcRaw;
unsigned int srcVariant;
int weight;
- int differential;
RawSwitch swtch;
- int curve; //0=symmetrisch
+ CurveReference curve; //0=symmetrisch
unsigned int delayUp;
unsigned int delayDown;
unsigned int speedUp; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
@@ -520,9 +578,7 @@ class MixData {
bool noExpo;
MltpxValue mltpx; // multiplex method 0=+ 1=* 2=replace
unsigned int mixWarn; // mixer warning
- unsigned int enableFmTrim;
unsigned int phases; // -5=!FP4, 0=normal, 5=FP4
- unsigned int lateOffset;
int sOffset;
char name[10+1];
@@ -572,10 +628,7 @@ enum AssignFunc {
FuncBackgroundMusic,
FuncBackgroundMusicPause,
FuncAdjustGV1,
- FuncAdjustGV2,
- FuncAdjustGV3,
- FuncAdjustGV4,
- FuncAdjustGV5,
+ FuncAdjustGVLast = FuncAdjustGV1+C9X_MAX_GVARS-1,
FuncCount
};
@@ -602,7 +655,7 @@ class PhaseData {
unsigned int fadeIn;
unsigned int fadeOut;
int rotaryEncoders[2];
- int gvars[5];
+ int gvars[C9X_MAX_GVARS];
void clear() { memset(this, 0, sizeof(PhaseData)); for (int i=0; isetupUi(this);
- QLabel * lb_fp[] = {ui->lb_FP0,ui->lb_FP1,ui->lb_FP2,ui->lb_FP3,ui->lb_FP4,ui->lb_FP5,ui->lb_FP6,ui->lb_FP7,ui->lb_FP8 };
- QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
-
- setWindowTitle(tr("DEST -> %1").arg(getStickStr(ed->chn)));
- QRegExp rx(CHAR_FOR_NAMES_REGEX);
-
- if (GetEepromInterface()->getCapability(GvarsAsWeight)) {
- int gvars=0;
- if (GetEepromInterface()->getCapability(HasVariants)) {
- if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
- gvars=1;
- }
- } else {
- gvars=1;
- }
- if (gvars==0) {
- ui->expoGV->setDisabled(true);
- ui->weightGV->setDisabled(true);
- ui->expoCurveGV->setDisabled(true);
- if (ed->expo>100) {
- ed->expo=0;
- }
- if (ed->weight>100 || ed->weight<-100) {
- ed->weight=100;
- }
- if (ed->curveParam>100 || ed->curveParam<-100) {
- ed->curveParam=0;
- }
- }
- populateGVCB(ui->expoCB,ed->expo);
- populateGVCB(ui->weightCB,ed->weight);
- populateGVCB(ui->expoCurveCB,ed->curveParam);
-
- ui->weightSB->setMinimum(0);
- ui->weightSB->setMaximum(100);
- if (ed->weight>100 || ed->weight<0) {
- ui->weightGV->setChecked(true);
- ui->weightSB->hide();
- ui->weightCB->show();
- } else {
- ui->weightGV->setChecked(false);
- ui->weightSB->setValue(ed->weight);
- ui->weightSB->show();
- ui->weightCB->hide();
- }
-
- ui->expoSB->setMinimum(-100);
- ui->expoSB->setMaximum(100);
- if (ed->expo>100 || ed->expo<-100) {
- ui->expoGV->setChecked(true);
- ui->expoSB->hide();
- ui->expoCB->show();
- } else {
- ui->expoGV->setChecked(false);
- ui->expoSB->setValue(ed->expo);
- ui->expoSB->show();
- ui->expoCB->hide();
- }
-
- ui->expoCurveSB->setMinimum(-100);
- ui->expoCurveSB->setMaximum(100);
- if (ed->curveParam>100 || ed->curveParam<-100) {
- ui->expoCurveGV->setChecked(true);
- ui->expoCurveSB->hide();
- ui->expoCurveCB->show();
- } else {
- ui->expoCurveGV->setChecked(false);
- ui->expoCurveSB->setValue(ed->curveParam);
- ui->expoCurveSB->show();
- ui->expoCurveCB->hide();
- }
- } else {
- ui->expoGV->hide();
- ui->weightGV->hide();
- ui->expoCurveGV->hide();
- ui->expoSB->setMinimum(-100);
- ui->expoSB->setMaximum(100);
- ui->expoSB->setValue(ed->expo);
- ui->expoCurveSB->setMinimum(-100);
- ui->expoCurveSB->setMaximum(100);
- ui->expoCurveSB->setValue(ed->curveParam);
- ui->weightSB->setMinimum(0);
- ui->weightSB->setMaximum(100);
- ui->weightSB->setValue(ed->weight);
- }
- populateSwitchCB(ui->switchesCB,ed->swtch);
- if (ed->curveMode==0) {
- populateExpoCurvesCB(ui->curvesCB,0); // TODO capacity for er9x
- } else {
- populateExpoCurvesCB(ui->curvesCB,ed->curveParam); // TODO capacity for er9x
- }
- ui->modeCB->setCurrentIndex(ed->mode-1);
- if (!GetEepromInterface()->getCapability(HasExpoCurves)) {
- ui->label_curves->hide();
- ui->curvesCB->hide();
- ed->curveMode=1;
- }
- if (!GetEepromInterface()->getCapability(ExpoIsCurve)) {
- ui->expoCurveCB->hide();
- ui->expoCurveSB->hide();
- ui->expoCurveGV->hide();
- ui->label_curves->setText(tr("Curve"));
- } else {
- ui->label_expo->hide();
- ui->expoCB->hide();
- ui->expoGV->hide();
- ui->expoSB->hide();
- }
- if (!GetEepromInterface()->getCapability(FlightPhases)) {
- ui->label_phases->hide();
- for (int i=0; i<9; i++) {
- lb_fp[i]->hide();
- cb_fp[i]->hide();
- }
- } else {
- int mask=1;
- for (int i=0; i<9 ; i++) {
- if ((ed->phases & mask)==0) {
- cb_fp[i]->setChecked(true);
- }
- mask <<= 1;
- }
- for (int i=GetEepromInterface()->getCapability(FlightPhases); i<9;i++) {
- lb_fp[i]->hide();
- cb_fp[i]->hide();
- }
- }
- int expolength=GetEepromInterface()->getCapability(HasExpoNames);
- if (!expolength) {
- ui->label_name->hide();
- ui->expoName->hide();
- } else {
- ui->expoName->setMaxLength(expolength);
- }
- ui->expoName->setValidator(new QRegExpValidator(rx, this));
- ui->expoName->setText(ed->name);
- valuesChanged();
- connect(ui->expoName,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
- connect(ui->expoCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
- connect(ui->expoSB,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
- connect(ui->expoCurveCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
- connect(ui->expoCurveSB,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
- connect(ui->weightCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
- connect(ui->weightSB,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
- connect(ui->switchesCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
- connect(ui->curvesCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
- connect(ui->modeCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
- connect(ui->expoGV,SIGNAL(stateChanged(int)),this,SLOT(widgetChanged()));
- connect(ui->expoCurveGV,SIGNAL(stateChanged(int)),this,SLOT(widgetChanged()));
- connect(ui->weightGV,SIGNAL(stateChanged(int)),this,SLOT(widgetChanged()));
- for (int i=0; i<9; i++) {
- connect(cb_fp[i],SIGNAL(toggled(bool)),this,SLOT(valuesChanged()));
- }
- QTimer::singleShot(0, this, SLOT(shrink()));
-}
-
-ExpoDialog::~ExpoDialog()
-{
- delete ui;
-}
-
-void ExpoDialog::changeEvent(QEvent *e)
-{
- QDialog::changeEvent(e);
- switch (e->type()) {
- case QEvent::LanguageChange:
- ui->retranslateUi(this);
- break;
- default:
- break;
- }
-}
-
-void ExpoDialog::widgetChanged()
-{
- if (GetEepromInterface()->getCapability(GvarsAsWeight)) {
- int gvars=0;
- if (GetEepromInterface()->getCapability(HasVariants)) {
- if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
- gvars=1;
- }
- } else {
- gvars=1;
- }
- if (gvars==1) {
- if (!GetEepromInterface()->getCapability(ExpoIsCurve)) {
- if (ui->expoGV->isChecked()) {
- ui->expoCB->show();
- ui->expoSB->hide();
- } else {
- ui->expoCB->hide();
- ui->expoSB->show();
- }
- } else {
- if (ui->expoCurveGV->isChecked()) {
- ui->expoCurveCB->show();
- ui->expoCurveSB->hide();
- } else {
- ui->expoCurveCB->hide();
- ui->expoCurveSB->show();
- }
- }
- if (ui->weightGV->isChecked()) {
- ui->weightCB->show();
- ui->weightSB->hide();
- } else {
- ui->weightCB->hide();
- ui->weightSB->show();
- }
- }
- valuesChanged();
- QTimer::singleShot(0, this, SLOT(shrink()));
- }
-}
-
-
-void ExpoDialog::valuesChanged()
-{
- QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
- if (ui->curvesCB->currentIndex()==0) {
- if (GetEepromInterface()->getCapability(ExpoIsCurve)) {
- ed->curveMode = 0;
- ui->expoCurveGV->show();
- if (ui->expoCurveGV->isChecked()) {
- ui->expoCurveCB->show();
- ui->expoCurveSB->hide();
- ed->curveParam = ui->expoCurveCB->itemData(ui->expoCurveCB->currentIndex()).toInt();
- } else {
- ui->expoCurveCB->hide();
- ui->expoCurveSB->show();
- ed->curveParam = ui->expoCurveSB->value();
- }
- ed->expo = ed->curveParam;
- } else {
- ui->expoCurveCB->hide();
- ui->expoCurveSB->hide();
- ui->expoCurveGV->hide();
- ed->curveMode = 0;
- if (ui->expoGV->isChecked()) {
- ed->expo = ui->expoCB->itemData(ui->expoCB->currentIndex()).toInt();
- } else {
- ed->expo = ui->expoSB->value();
- }
- ed->curveParam = ed->expo;
- }
- } else {
- if (!GetEepromInterface()->getCapability(ExpoIsCurve)) {
- ed->curveMode = 1;
- ed->curveParam = ui->curvesCB->currentIndex();
- if (ui->expoGV->isChecked()) {
- ed->expo = ui->expoCB->itemData(ui->expoCB->currentIndex()).toInt();
- } else {
- ed->expo = ui->expoSB->value();
- }
- } else {
- ed->curveMode = 1;
- ed->curveParam = ui->curvesCB->currentIndex();
- ed->expo = 0;
- }
- ui->expoCurveCB->hide();
- ui->expoCurveSB->hide();
- ui->expoCurveGV->hide();
- }
- if (ui->weightGV->isChecked()) {
- ed->weight = ui->weightCB->itemData(ui->weightCB->currentIndex()).toInt();
- } else {
- ed->weight = ui->weightSB->value();
- }
- ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
- ed->mode = ui->modeCB->currentIndex() + 1;
- int i=0;
- for (i=0; iexpoName->text().toAscii().length(); i++) {
- ed->name[i]=ui->expoName->text().toAscii().at(i);
- }
- ed->name[i]=0;
- ed->phases=0;
- for (int i=8; i>=0 ; i--) {
- if (!cb_fp[i]->checkState()) {
- ed->phases+=1;
- }
- ed->phases<<=1;
- }
- ed->phases>>=1;
- if (GetEepromInterface()->getCapability(FlightPhases)) {
- int zeros=0;
- int ones=0;
- int phtemp=ed->phases;
- for (int i=0; igetCapability(FlightPhases); i++) {
- if (phtemp & 1) {
- ones++;
- }
- else {
- zeros++;
- }
- phtemp >>=1;
- }
- if (zeros==1) {
- phtemp=ed->phases;
- for (int i=0; igetCapability(FlightPhases); i++) {
- if ((phtemp & 1)==0) {
- break;
- }
- phtemp >>=1;
- }
- }
- else if (ones==1) {
- phtemp=ed->phases;
- for (int i=0; igetCapability(FlightPhases); i++) {
- if (phtemp & 1) {
- break;
- }
- phtemp >>=1;
- }
- }
- } else {
- ed->phases=0;
- }
-}
-
-void ExpoDialog::shrink()
-{
- resize(0,0);
-}
diff --git a/companion/src/file.cpp b/companion/src/file.cpp
index 10c918cf3..404a40db8 100644
--- a/companion/src/file.cpp
+++ b/companion/src/file.cpp
@@ -323,7 +323,10 @@ unsigned int EFile::readRlc12(uint8_t *buf, unsigned int i_len, bool rlc2)
if (read(&m_bRlc, 1) !=1) break; //read how many bytes to read
- assert(m_bRlc & 0x7f);
+ if (!(m_bRlc & 0x7f)) {
+ qDebug() << "RLC decoding error!";
+ return 0;
+ }
if (rlc2) {
if(m_bRlc&0x80){ // if contains high byte
diff --git a/companion/src/firmwares/er9x/er9xeeprom.cpp b/companion/src/firmwares/er9x/er9xeeprom.cpp
index 335121706..f07716e72 100644
--- a/companion/src/firmwares/er9x/er9xeeprom.cpp
+++ b/companion/src/firmwares/er9x/er9xeeprom.cpp
@@ -3,26 +3,6 @@
#include "helpers.h"
#include
-int8_t er9xFromSwitch(const RawSwitch & sw)
-{
- switch (sw.type) {
- case SWITCH_TYPE_SWITCH:
- return sw.index;
- case SWITCH_TYPE_VIRTUAL:
- return sw.index > 0 ? (9 + sw.index) : (-9 + sw.index);
- case SWITCH_TYPE_ON:
- return 22;
- case SWITCH_TYPE_OFF:
- return -22;
- case SWITCH_TYPE_MOMENT_SWITCH:
- return sw.index > 0 ? (22 + sw.index) : (-22 + sw.index);
- case SWITCH_TYPE_MOMENT_VIRTUAL:
- return sw.index > 0 ? (31 + sw.index) : (-31 + sw.index);
- default:
- return 0;
- }
-}
-
RawSwitch er9xToSwitch(int8_t sw)
{
uint8_t swa = abs(sw);
@@ -47,15 +27,6 @@ t_Er9xTrainerMix::t_Er9xTrainerMix()
memset(this, 0, sizeof(t_Er9xTrainerMix));
}
-t_Er9xTrainerMix::t_Er9xTrainerMix(TrainerMix &c9x)
-{
- memset(this, 0, sizeof(t_Er9xTrainerMix));
- srcChn = c9x.src;
- swtch = er9xFromSwitch(c9x.swtch);
- studWeight = (8 * c9x.weight) / 25;
- mode = c9x.mode;
-}
-
t_Er9xTrainerMix::operator TrainerMix()
{
TrainerMix c9x;
@@ -71,15 +42,6 @@ t_Er9xTrainerData::t_Er9xTrainerData()
memset(this, 0, sizeof(t_Er9xTrainerData));
}
-t_Er9xTrainerData::t_Er9xTrainerData(TrainerData &c9x)
-{
- memset(this, 0, sizeof(t_Er9xTrainerData));
- for (int i=0; i125) {
- if (c9x.weight>0) {
- int index=abs(c9x.weight)-10000;
- int gvar=125+index;
- if (gvar>127) {
- gvar-=256;
- }
- weight = gvar;
- } else {
- EEPROMWarnings += ::QObject::tr("er9x doesn't have negative gvars as weight") + "\n";
- weight=0;
- }
- } else {
- weight = c9x.weight;
- }
-
- if (abs(c9x.sOffset)>125) {
- if (c9x.sOffset>0) {
- int index=abs(c9x.sOffset)-10000;
- int gvar=125+index;
- if (gvar>127) {
- gvar-=256;
- }
- sOffset = gvar;
- } else {
- EEPROMWarnings += ::QObject::tr("er9x doesn't have negative gvars as offset") + "\n";
- sOffset=0;
- }
- } else {
- sOffset = c9x.sOffset;
- }
-
- if (c9x.curve!=0) {
- curve = c9x.curve;
- differential=0;
- } else {
- if (c9x.differential!=0) {
- curve=c9x.differential;
- differential=1;
- } else {
- curve=0;
- differential=0;
- }
- }
- lateOffset=c9x.lateOffset;
- delayUp = c9x.delayUp;
- delayDown = c9x.delayDown;
- speedUp = c9x.speedUp;
- speedDown = c9x.speedDown;
- if (c9x.carryTrim<0) {
- EEPROMWarnings += ::QObject::tr("er9x doesn't have swappable trims") + "\n";
- carryTrim=1;
- } else {
- carryTrim = c9x.carryTrim;
- }
- mltpx = (MltpxValue)c9x.mltpx;
- mixWarn = c9x.mixWarn;
- enableFmTrim=c9x.enableFmTrim;
-
-}
-
t_Er9xMixData::operator MixData ()
{
MixData c9x;
@@ -434,14 +215,21 @@ t_Er9xMixData::operator MixData ()
else {
c9x.srcRaw = RawSource(SOURCE_TYPE_GVAR, srcRaw-38);
}
+
if (differential==1) {
- c9x.differential=curve;
- c9x.curve=0;
- } else {
- c9x.differential=0;
- c9x.curve=curve;
+ c9x.curve.type = CurveReference::CURVE_REF_DIFF;
+ c9x.curve.value = differential;
}
- c9x.lateOffset=lateOffset;
+ else if (curve > 6) {
+ c9x.curve.type = CurveReference::CURVE_REF_CUSTOM;
+ c9x.curve.value = curve - 6;
+ }
+ else if (curve > 0) {
+ c9x.curve.type = CurveReference::CURVE_REF_FUNC;
+ c9x.curve.value = curve;
+ }
+
+ // c9x.lateOffset=lateOffset;
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
c9x.speedUp = speedUp;
@@ -449,32 +237,10 @@ t_Er9xMixData::operator MixData ()
c9x.carryTrim = carryTrim;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
- c9x.enableFmTrim=enableFmTrim;
+ // c9x.enableFmTrim=enableFmTrim;
return c9x;
}
-int8_t er9xFromSource(RawSource source)
-{
- int v1 = 0;
- if (source.type == SOURCE_TYPE_STICK)
- v1 = 1+source.index;
- else if (source.type == SOURCE_TYPE_ROTARY_ENCODER) {
- EEPROMWarnings += ::QObject::tr("er9x on this board doesn't have Rotary Encoders") + "\n";
- v1 = 5+source.index;
- }
- else if (source.type == SOURCE_TYPE_MAX)
- v1 = 8;
- else if (source.type == SOURCE_TYPE_CYC)
- v1 = 10+source.index;
- else if (source.type == SOURCE_TYPE_PPM)
- v1 = 13+source.index;
- else if (source.type == SOURCE_TYPE_CH)
- v1 = 21+source.index;
- else if (source.type == SOURCE_TYPE_TELEMETRY)
- v1 = 36+source.index;
- return v1;
-}
-
RawSource er9xToSource(int8_t value)
{
if (value == 0) {
@@ -503,33 +269,6 @@ RawSource er9xToSource(int8_t value)
}
}
-t_Er9xCustomSwData::t_Er9xCustomSwData(CustomSwData &c9x)
-{
- func = c9x.func;
- v1 = c9x.val1;
- v2 = c9x.val2;
-
- if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
- v1 = er9xFromSource(RawSource(c9x.val1));
- }
-
- if (c9x.func >= CS_FN_EQUAL) {
- v2 = er9xFromSource(RawSource(c9x.val2));
- }
-
- if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
- v1 = er9xFromSwitch(RawSwitch(c9x.val1));
- v2 = er9xFromSwitch(RawSwitch(c9x.val2));
- }
-
- if (func>ER9X_MAX_CSFUNC ) {
- EEPROMWarnings += ::QObject::tr("er9x does not support Custom Switch function %1").arg(getFuncName(func)) + "\n";
- func=0;
- v1=0;
- v2=0;
- }
-}
-
Er9xCustomSwData::operator CustomSwData ()
{
CustomSwData c9x;
@@ -559,13 +298,6 @@ t_Er9xSafetySwData::t_Er9xSafetySwData()
memset(this, 0, sizeof(t_Er9xSafetySwData));
}
-t_Er9xSafetySwData::t_Er9xSafetySwData(SafetySwData &c9x)
-{
- memset(this, 0, sizeof(t_Er9xSafetySwData));
- swtch = er9xFromSwitch(c9x.swtch);
- val = c9x.val;
-}
-
t_Er9xSafetySwData::operator SafetySwData ()
{
SafetySwData c9x;
@@ -574,35 +306,11 @@ t_Er9xSafetySwData::operator SafetySwData ()
return c9x;
}
-
t_Er9xFrSkyChannelData::t_Er9xFrSkyChannelData()
{
memset(this, 0, sizeof(t_Er9xFrSkyChannelData));
}
-t_Er9xFrSkyChannelData::t_Er9xFrSkyChannelData(FrSkyChannelData &c9x)
-{
- memset(this, 0, sizeof(t_Er9xFrSkyChannelData));
- ratio = c9x.ratio;
- alarms_value[0] = c9x.alarms[0].value;
- alarms_value[1] = c9x.alarms[1].value;
- alarms_level = (c9x.alarms[1].level << 2) + c9x.alarms[0].level;
- alarms_greater = (c9x.alarms[1].greater << 1) + c9x.alarms[0].greater;
- if (c9x.type==0) {
- if (c9x.multiplier==0) {
- type = 0;
- } else if (c9x.multiplier==1) {
- type = 2;
- } else {
- EEPROMWarnings += ::QObject::tr("er9x does not support this range for A1/A2") + "\n";
- }
- } else if (c9x.type==1 || c9x.type==3) {
- type=c9x.type;
- } else {
- EEPROMWarnings += ::QObject::tr("er9x does not support this telemetry units") + "\n";
- }
-}
-
t_Er9xFrSkyChannelData::operator FrSkyChannelData ()
{
FrSkyChannelData c9x;
@@ -622,19 +330,11 @@ t_Er9xFrSkyChannelData::operator FrSkyChannelData ()
return c9x;
}
-
t_Er9xFrSkyData::t_Er9xFrSkyData()
{
memset(this, 0, sizeof(t_Er9xFrSkyData));
}
-t_Er9xFrSkyData::t_Er9xFrSkyData(FrSkyData &c9x)
-{
- memset(this, 0, sizeof(t_Er9xFrSkyData));
- channels[0] = c9x.channels[0];
- channels[1] = c9x.channels[1];
-}
-
t_Er9xFrSkyData::operator FrSkyData ()
{
FrSkyData c9x;
@@ -643,24 +343,6 @@ t_Er9xFrSkyData::operator FrSkyData ()
return c9x;
}
-int setEr9xTimerMode(TimerMode mode)
-{
- if (mode == TMRMODE_OFF || mode == TMRMODE_ABS)
- return mode;
- else if (mode == TMRMODE_THs || mode == TMRMODE_THp)
- return mode + 4;
- else if (mode >= TMRMODE_FIRST_MOMENT_SWITCH)
- return 37+mode-TMRMODE_FIRST_MOMENT_SWITCH;
- else if (mode >= TMRMODE_FIRST_SWITCH)
- return 16+mode-TMRMODE_FIRST_SWITCH;
- else if (mode <= TMRMODE_FIRST_NEG_MOMENT_SWITCH)
- return -37+mode-TMRMODE_FIRST_NEG_MOMENT_SWITCH;
- else if (mode <= TMRMODE_FIRST_NEG_SWITCH)
- return -16+mode-TMRMODE_FIRST_NEG_SWITCH;
- else
- return 0;
-}
-
TimerMode getEr9xTimerMode(int mode)
{
if (mode <= -33)
@@ -675,162 +357,6 @@ TimerMode getEr9xTimerMode(int mode)
return TimerMode(TMRMODE_FIRST_MOMENT_SWITCH+(mode-16-21));
}
-t_Er9xModelData::t_Er9xModelData(ModelData &c9x)
-{
- memset(this, 0, sizeof(t_Er9xModelData));
-
- if (c9x.used) {
- setEEPROMString(name, c9x.name, sizeof(name));
- modelVoice=c9x.modelVoice;
- tmrMode = setEr9xTimerMode(c9x.timers[0].mode);
- tmrModeB = c9x.timers[0].modeB;
- tmrDir = c9x.timers[0].dir;
- tmrVal = c9x.timers[0].val;
- switch(c9x.moduleData[0].protocol) {
- case PPM:
- protocol = 0;
- break;
- case PXX_DJT:
- protocol = 1;
- break;
- case DSM2:
- protocol = 2;
- break;
- case PPM16:
- protocol = 3;
- break;
- default:
- protocol = 0;
- EEPROMWarnings += QObject::tr("Er9x doesn't accept this protocol") + "\n";
- // TODO more explicit warning for each protocol
- break;
- }
- traineron = c9x.traineron;
- t2throttle = c9x.t2throttle;
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- ppmNCH = (c9x.moduleData[0].channelsCount - 8) / 2;
- thrTrim = c9x.thrTrim;
- thrExpo = c9x.thrExpo;
- trimInc = c9x.trimInc;
- ppmDelay = (c9x.moduleData[0].ppmDelay - 300) / 50;
- for (unsigned int i=0; iEeFsCreate(eeprom, getEEpromSize(), BOARD_STOCK);
-
- Er9xGeneral er9xGeneral(radioData.generalSettings);
- int sz = efile->writeRlc1(FILE_GENERAL, FILE_TYP_GENERAL, (uint8_t*)&er9xGeneral, sizeof(Er9xGeneral));
- if(sz != sizeof(Er9xGeneral)) {
- return 0;
- }
-
- for (int i=0; iwriteRlc1(FILE_MODEL(i), FILE_TYP_MODEL, (uint8_t*)&er9xModel, sizeof(Er9xModelData));
- if(sz != sizeof(Er9xModelData)) {
- return 0;
- }
- }
- }
-
- return getEEpromSize();
+ return 0;
}
int Er9xInterface::getSize(ModelData &model)
{
- if (model.isempty())
- return 0;
-
- uint8_t tmp[2*EESIZE_STOCK];
- efile->EeFsCreate(tmp, getEEpromSize(), BOARD_STOCK);
-
- Er9xModelData er9xModel(model);
- int sz = efile->writeRlc1(0, FILE_TYP_MODEL, (uint8_t*)&er9xModel, sizeof(Er9xModelData));
- if(sz != sizeof(Er9xModelData)) {
- return -1;
- }
- return efile->size(0);
+ return 0;
}
int Er9xInterface::getSize(GeneralSettings &settings)
{
- uint8_t tmp[2*EESIZE_STOCK];
- efile->EeFsCreate(tmp, getEEpromSize(), BOARD_STOCK);
-
- Er9xGeneral er9xGeneral(settings);
- int sz = efile->writeRlc1(0, FILE_TYP_GENERAL, (uint8_t*)&er9xGeneral, sizeof(Er9xGeneral));
- if(sz != sizeof(Er9xGeneral)) {
- return -1;
- }
- return efile->size(0);
+ return 0;
}
int Er9xInterface::getCapability(const Capability capability)
@@ -244,12 +207,6 @@ int Er9xInterface::getCapability(const Capability capability)
return 4;
case Mixes:
return ER9X_MAX_MIXERS;
- case NumCurves5:
- return ER9X_MAX_CURVE5;
- case NumCurves9:
- return ER9X_MAX_CURVE5;
- case MixFmTrim:
- return 1;
case PPMExtCtrl:
return 1;
case ModelTrainerEnable:
@@ -286,10 +243,6 @@ int Er9xInterface::getCapability(const Capability capability)
return 12;
case CustomAndSwitches:
return 5;
- case GvarsNum:
- return 7;
- case GvarsOfsNum:
- return 5;
case CSFunc:
return 13;
case Outputs:
@@ -306,8 +259,6 @@ int Er9xInterface::getCapability(const Capability capability)
return TM_HASTELEMETRY|TM_HASWSHH;
case TelemetryUnits:
return 1;
- case TimerTriggerB:
- return 1;
case TelemetryMaxMultiplier:
return 2;
case MaxVolume:
@@ -325,17 +276,13 @@ int Er9xInterface::getCapability(const Capability capability)
case HasStickScroll:
case HasAltitudeSel:
case HasContrast:
- case InstantTrimSW:
case HasVolume:
case HasBlInvert:
case ModelVoice:
- case DiffMixers:
- case HasNegCurves:
- case HasFixOffset:
case Gvars:
+ return 7;
case GvarsHaveSources:
case GvarsAsSources:
- case GvarsAsWeight:
return 1;
case GetThrSwitch:
return DSW_THR;
diff --git a/companion/src/firmwares/ersky9x/ersky9xeeprom.cpp b/companion/src/firmwares/ersky9x/ersky9xeeprom.cpp
index f21688f20..1247c795a 100644
--- a/companion/src/firmwares/ersky9x/ersky9xeeprom.cpp
+++ b/companion/src/firmwares/ersky9x/ersky9xeeprom.cpp
@@ -3,19 +3,8 @@
#include "ersky9xeeprom.h"
#include
-extern int8_t er9xFromSwitch(const RawSwitch & sw);
extern RawSwitch er9xToSwitch(int8_t sw);
-int setErSky9xTimerMode(TimerMode mode)
-{
- if (mode == TMRMODE_OFF || mode == TMRMODE_ABS || mode == TMRMODE_THs || mode == TMRMODE_THp)
- return mode;
- else if (mode >= TMRMODE_FIRST_CHPERC)
- return 4+mode-TMRMODE_FIRST_CHPERC;
- else
- return 0;
-}
-
TimerMode getErSky9xTimerMode(int mode)
{
if (mode<4)
@@ -26,26 +15,6 @@ TimerMode getErSky9xTimerMode(int mode)
return TimerMode(0);
}
-int8_t ersky9xFromSwitch(const RawSwitch & sw)
-{
- switch (sw.type) {
- case SWITCH_TYPE_SWITCH:
- return sw.index;
- case SWITCH_TYPE_VIRTUAL:
- return sw.index > 0 ? (9 + sw.index) : (-9 + sw.index);
- case SWITCH_TYPE_ON:
- return 34;
- case SWITCH_TYPE_OFF:
- return -34;
- case SWITCH_TYPE_MOMENT_SWITCH:
- return sw.index > 0 ? (34 + sw.index) : (-34 + sw.index);
- case SWITCH_TYPE_MOMENT_VIRTUAL:
- return sw.index > 0 ? (31 + sw.index) : (-31 + sw.index);
- default:
- return 0;
- }
-}
-
RawSwitch ersky9xToSwitch(int8_t sw)
{
uint8_t swa = abs(sw);
@@ -65,21 +34,11 @@ RawSwitch ersky9xToSwitch(int8_t sw)
return RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, sw > 0 ? sw-34-9 : sw+34+9);
}
-
t_Ersky9xTrainerMix::t_Ersky9xTrainerMix()
{
memset(this, 0, sizeof(t_Ersky9xTrainerMix));
}
-t_Ersky9xTrainerMix::t_Ersky9xTrainerMix(TrainerMix &c9x)
-{
- memset(this, 0, sizeof(t_Ersky9xTrainerMix));
- srcChn = c9x.src;
- swtch = er9xFromSwitch(c9x.swtch);
- studWeight = (8 * c9x.weight) / 25;
- mode = c9x.mode;
-}
-
t_Ersky9xTrainerMix::operator TrainerMix()
{
TrainerMix c9x;
@@ -95,15 +54,6 @@ t_Ersky9xTrainerData::t_Ersky9xTrainerData()
memset(this, 0, sizeof(t_Ersky9xTrainerData));
}
-t_Ersky9xTrainerData::t_Ersky9xTrainerData(TrainerData &c9x)
-{
- memset(this, 0, sizeof(t_Ersky9xTrainerData));
- for (int i=0; i 6) {
+ c9x.curve.type = CurveReference::CURVE_REF_CUSTOM;
+ c9x.curve.value = curve - 6;
+ }
+ else if (curve > 0) {
+ c9x.curve.type = CurveReference::CURVE_REF_FUNC;
+ c9x.curve.value = curve;
+ }
+
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
c9x.speedUp = speedUp;
@@ -398,7 +221,7 @@ t_Ersky9xMixData_v10::operator MixData ()
c9x.carryTrim = carryTrim;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
- c9x.enableFmTrim=enableFmTrim;
+ // c9x.enableFmTrim=enableFmTrim;
c9x.sOffset = sOffset;
return c9x;
}
@@ -409,67 +232,6 @@ t_Ersky9xMixData_v11::t_Ersky9xMixData_v11()
memset(this, 0, sizeof(t_Ersky9xMixData_v11));
}
-t_Ersky9xMixData_v11::t_Ersky9xMixData_v11(MixData &c9x)
-{
- memset(this, 0, sizeof(t_Ersky9xMixData_v11));
- destCh = c9x.destCh;
- swtch = ersky9xFromSwitch(c9x.swtch);
- if (c9x.srcRaw.type == SOURCE_TYPE_NONE) {
- srcRaw = 0;
- swtch = 0;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_STICK) {
- srcRaw = 1 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_ROTARY_ENCODER) {
- EEPROMWarnings += ::QObject::tr("ersky9x doesn't have Rotary Encoders") + "\n";
- srcRaw = 5 + c9x.srcRaw.index; // use pots instead
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_MAX) {
- srcRaw = 8; // MAX
- }
- /* else if (c9x.srcRaw.type == SOURCE_TYPE_3POS) {
- srcRaw = 45;
- } */
- else if (c9x.srcRaw.type == SOURCE_TYPE_GVAR) {
- srcRaw = 46+c9x.srcRaw.index; // MAX
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_SWITCH) {
- srcRaw = 9; // FULL
- swtch = ersky9xFromSwitch(RawSwitch(c9x.srcRaw.index));
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CYC) {
- srcRaw = 10 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_PPM) {
- srcRaw = 13 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CH) {
- srcRaw = 21 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_TRIM) {
- EEPROMWarnings += ::QObject::tr("ersky9x doesn't have trims as source") + "\n";
- srcRaw = 0; // use pots instead
- }
-
- weight = c9x.weight;
- curve = c9x.curve;
- delayUp = c9x.delayUp;
- delayDown = c9x.delayDown;
- speedUp = c9x.speedUp;
- speedDown = c9x.speedDown;
- if (c9x.carryTrim<0) {
- EEPROMWarnings += ::QObject::tr("er9x doesn't have swappable trims") + "\n";
- carryTrim=1;
- } else {
- carryTrim = c9x.carryTrim;
- }
- mltpx = (MltpxValue)c9x.mltpx;
- mixWarn = c9x.mixWarn;
- enableFmTrim=c9x.enableFmTrim;
- sOffset = c9x.sOffset;
-}
-
t_Ersky9xMixData_v11::operator MixData ()
{
MixData c9x;
@@ -516,7 +278,15 @@ t_Ersky9xMixData_v11::operator MixData ()
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-21);
}
- c9x.curve = curve;
+ if (curve > 6) {
+ c9x.curve.type = CurveReference::CURVE_REF_CUSTOM;
+ c9x.curve.value = curve - 6;
+ }
+ else if (curve > 0) {
+ c9x.curve.type = CurveReference::CURVE_REF_FUNC;
+ c9x.curve.value = curve;
+ }
+
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
c9x.speedUp = speedUp;
@@ -524,60 +294,11 @@ t_Ersky9xMixData_v11::operator MixData ()
c9x.carryTrim = carryTrim;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
- c9x.enableFmTrim=enableFmTrim;
+ // c9x.enableFmTrim=enableFmTrim;
c9x.sOffset = sOffset;
return c9x;
}
-int8_t ersky9xFromSource_v10(RawSource source)
-{
- int v1 = 0;
- if (source.type == SOURCE_TYPE_STICK)
- v1 = 1+source.index;
- else if (source.type == SOURCE_TYPE_ROTARY_ENCODER) {
- EEPROMWarnings += ::QObject::tr("er9x on this board doesn't have Rotary Encoders") + "\n";
- v1 = 5+source.index;
- }
- else if (source.type == SOURCE_TYPE_MAX)
- v1 = 8;
- /* else if (source.type == SOURCE_TYPE_3POS)
- v1 = 0; */
- else if (source.type == SOURCE_TYPE_CYC)
- v1 = 10+source.index;
- else if (source.type == SOURCE_TYPE_PPM)
- v1 = 13+source.index;
- else if (source.type == SOURCE_TYPE_CH)
- v1 = 21+source.index;
- else if (source.type == SOURCE_TYPE_TELEMETRY)
- v1 = 36+source.index;
- return v1;
-}
-
-int8_t ersky9xFromSource_v11(RawSource source)
-{
- int v1 = 0;
- if (source.type == SOURCE_TYPE_STICK)
- v1 = 1+source.index;
- else if (source.type == SOURCE_TYPE_ROTARY_ENCODER) {
- EEPROMWarnings += ::QObject::tr("er9x on this board doesn't have Rotary Encoders") + "\n";
- v1 = 5+source.index;
- }
- else if (source.type == SOURCE_TYPE_MAX)
- v1 = 8;
- /* else if (source.type == SOURCE_TYPE_3POS)
- v1 = 0; */
- else if (source.type == SOURCE_TYPE_CYC)
- v1 = 10+source.index;
- else if (source.type == SOURCE_TYPE_PPM)
- v1 = 13+source.index;
- else if (source.type == SOURCE_TYPE_CH)
- v1 = 21+source.index;
- else if (source.type == SOURCE_TYPE_TELEMETRY)
- v1 = 36+source.index;
- return v1;
-}
-
-
RawSource ersky9xToSource_v10(int8_t value)
{
if (value == 0) {
@@ -634,33 +355,6 @@ RawSource ersky9xToSource_v11(int8_t value)
}
}
-t_Ersky9xCustomSwData_v10::t_Ersky9xCustomSwData_v10(CustomSwData &c9x)
-{
- func = c9x.func;
- v1 = c9x.val1;
- v2 = c9x.val2;
-
- if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
- v1 = ersky9xFromSource_v10(RawSource(c9x.val1));
- }
-
- if (c9x.func >= CS_FN_EQUAL) {
- v2 = ersky9xFromSource_v10(RawSource(c9x.val2));
- }
-
- if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
- v1 = er9xFromSwitch(RawSwitch(c9x.val1));
- v2 = er9xFromSwitch(RawSwitch(c9x.val2));
- }
-
- if (func>ERSKY9X_MAX_CSFUNC ) {
- EEPROMWarnings += ::QObject::tr("ersky9x does not support Custom Switch function %1").arg(getFuncName(func)) + "\n";
- func=0;
- v1=0;
- v2=0;
- }
-}
-
Ersky9xCustomSwData_v10::operator CustomSwData ()
{
CustomSwData c9x;
@@ -684,33 +378,6 @@ Ersky9xCustomSwData_v10::operator CustomSwData ()
return c9x;
}
-t_Ersky9xCustomSwData_v11::t_Ersky9xCustomSwData_v11(CustomSwData &c9x)
-{
- func = c9x.func;
- v1 = c9x.val1;
- v2 = c9x.val2;
-
- if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
- v1 = ersky9xFromSource_v11(RawSource(c9x.val1));
- }
-
- if (c9x.func >= CS_FN_EQUAL) {
- v2 = ersky9xFromSource_v11(RawSource(c9x.val2));
- }
-
- if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
- v1 = er9xFromSwitch(RawSwitch(c9x.val1));
- v2 = er9xFromSwitch(RawSwitch(c9x.val2));
- }
-
- if (func>ERSKY9X_MAX_CSFUNC ) {
- EEPROMWarnings += ::QObject::tr("ersky9x does not support Custom Switch function %1").arg(getFuncName(func)) + "\n";
- func=0;
- v1=0;
- v2=0;
- }
-}
-
Ersky9xCustomSwData_v11::operator CustomSwData ()
{
CustomSwData c9x;
@@ -739,13 +406,6 @@ t_Ersky9xSafetySwData_v10::t_Ersky9xSafetySwData_v10()
memset(this, 0, sizeof(t_Ersky9xSafetySwData_v10));
}
-t_Ersky9xSafetySwData_v10::t_Ersky9xSafetySwData_v10(SafetySwData &c9x)
-{
- memset(this, 0, sizeof(t_Ersky9xSafetySwData_v10));
- swtch = er9xFromSwitch(c9x.swtch);
- val = c9x.val;
-}
-
t_Ersky9xSafetySwData_v10::operator SafetySwData ()
{
SafetySwData c9x;
@@ -759,13 +419,6 @@ t_Ersky9xSafetySwData_v11::t_Ersky9xSafetySwData_v11()
memset(this, 0, sizeof(t_Ersky9xSafetySwData_v11));
}
-t_Ersky9xSafetySwData_v11::t_Ersky9xSafetySwData_v11(SafetySwData &c9x)
-{
- memset(this, 0, sizeof(t_Ersky9xSafetySwData_v11));
- opt.ss.swtch = ersky9xFromSwitch(c9x.swtch);
- opt.ss.val = c9x.val;
-}
-
t_Ersky9xSafetySwData_v11::operator SafetySwData ()
{
SafetySwData c9x;
@@ -779,29 +432,6 @@ t_Ersky9xFrSkyChannelData_v10::t_Ersky9xFrSkyChannelData_v10()
memset(this, 0, sizeof(t_Ersky9xFrSkyChannelData_v10));
}
-t_Ersky9xFrSkyChannelData_v10::t_Ersky9xFrSkyChannelData_v10(FrSkyChannelData &c9x)
-{
- memset(this, 0, sizeof(t_Ersky9xFrSkyChannelData_v10));
- ratio = c9x.ratio;
- alarms_value[0] = c9x.alarms[0].value;
- alarms_value[1] = c9x.alarms[1].value;
- alarms_level = (c9x.alarms[1].level << 2) + c9x.alarms[0].level;
- alarms_greater = (c9x.alarms[1].greater << 1) + c9x.alarms[0].greater;
- if (c9x.type==0) {
- if (c9x.multiplier==0) {
- type = 0;
- } else if (c9x.multiplier==1) {
- type = 2;
- } else {
- EEPROMWarnings += ::QObject::tr("er9x does not support this range for A1/A2") + "\n";
- }
- } else if (c9x.type==1 || c9x.type==3) {
- type=c9x.type;
- } else {
- EEPROMWarnings += ::QObject::tr("er9x does not support this telemetry units") + "\n";
- }
-}
-
t_Ersky9xFrSkyChannelData_v10::operator FrSkyChannelData ()
{
FrSkyChannelData c9x;
@@ -826,29 +456,6 @@ t_Ersky9xFrSkyChannelData_v11::t_Ersky9xFrSkyChannelData_v11()
memset(this, 0, sizeof(t_Ersky9xFrSkyChannelData_v11));
}
-t_Ersky9xFrSkyChannelData_v11::t_Ersky9xFrSkyChannelData_v11(FrSkyChannelData &c9x)
-{
- memset(this, 0, sizeof(t_Ersky9xFrSkyChannelData_v11));
- ratio = c9x.ratio;
- alarms_value[0] = c9x.alarms[0].value;
- alarms_value[1] = c9x.alarms[1].value;
- alarms_level = (c9x.alarms[1].level << 2) + c9x.alarms[0].level;
- alarms_greater = (c9x.alarms[1].greater << 1) + c9x.alarms[0].greater;
- if (c9x.type==0) {
- if (c9x.multiplier==0) {
- type = 0;
- } else if (c9x.multiplier==1) {
- type = 2;
- } else {
- EEPROMWarnings += ::QObject::tr("er9x does not support this range for A1/A2") + "\n";
- }
- } else if (c9x.type==1 || c9x.type==3) {
- type=c9x.type;
- } else {
- EEPROMWarnings += ::QObject::tr("er9x does not support this telemetry units") + "\n";
- }
-}
-
t_Ersky9xFrSkyChannelData_v11::operator FrSkyChannelData ()
{
FrSkyChannelData c9x;
@@ -873,13 +480,6 @@ t_Ersky9xFrSkyData_v10::t_Ersky9xFrSkyData_v10()
memset(this, 0, sizeof(t_Ersky9xFrSkyData_v10));
}
-t_Ersky9xFrSkyData_v10::t_Ersky9xFrSkyData_v10(FrSkyData &c9x)
-{
- memset(this, 0, sizeof(t_Ersky9xFrSkyData_v10));
- channels[0] = c9x.channels[0];
- channels[1] = c9x.channels[1];
-}
-
t_Ersky9xFrSkyData_v10::operator FrSkyData ()
{
FrSkyData c9x;
@@ -893,13 +493,6 @@ t_Ersky9xFrSkyData_v11::t_Ersky9xFrSkyData_v11()
memset(this, 0, sizeof(t_Ersky9xFrSkyData_v11));
}
-t_Ersky9xFrSkyData_v11::t_Ersky9xFrSkyData_v11(FrSkyData &c9x)
-{
- memset(this, 0, sizeof(t_Ersky9xFrSkyData_v11));
- channels[0] = c9x.channels[0];
- channels[1] = c9x.channels[1];
-}
-
t_Ersky9xFrSkyData_v11::operator FrSkyData ()
{
FrSkyData c9x;
@@ -908,168 +501,6 @@ t_Ersky9xFrSkyData_v11::operator FrSkyData ()
return c9x;
}
-t_Ersky9xModelData_v10::t_Ersky9xModelData_v10(ModelData &c9x)
-{
- memset(this, 0, sizeof(t_Ersky9xModelData_v10));
-
- if (c9x.used) {
- setEEPROMString(name, c9x.name, sizeof(name));
- reserved_spare = 0;
- spare21 = 0;
- sparex = 0;
- spare22 = 0;
- for (int i=0; i<2; i++) {
- timer[i].tmrModeA = setErSky9xTimerMode(c9x.timers[i].mode);
- timer[i].tmrModeB = c9x.timers[i].modeB;
- timer[i].tmrDir = c9x.timers[i].dir;
- timer[i].tmrVal = c9x.timers[i].val;
- }
- switch(c9x.moduleData[0].protocol) {
- case PPM:
- protocol = 0;
- break;
- case PXX_DJT:
- protocol = 1;
- break;
- case DSM2:
- protocol = 2;
- break;
- case PPM16:
- protocol = 3;
- break;
- default:
- protocol = 0;
- EEPROMWarnings += QObject::tr("Ersky9x doesn't accept this protocol") + "\n";
- // TODO more explicit warning for each protocol
- break;
- }
- traineron = c9x.traineron;
- // t2throttle = c9x.t2throttle;
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- ppmNCH = (c9x.moduleData[0].channelsCount - 8) / 2;
- thrTrim = c9x.thrTrim;
- thrExpo = c9x.thrExpo;
- trimInc = c9x.trimInc;
- ppmDelay = (c9x.moduleData[0].ppmDelay - 300) / 50;
- for (unsigned int i=0; iEeFsCreate(eeprom, EESIZE_SKY9X, BOARD_SKY9X);
-
- Ersky9xGeneral ersky9xGeneral(radioData.generalSettings);
- int sz = efile->writeRlc2(FILE_GENERAL, FILE_TYP_GENERAL, (uint8_t*)&ersky9xGeneral, sizeof(Ersky9xGeneral));
- if(sz != sizeof(Ersky9xGeneral)) {
- return 0;
- }
-
- for (int i=0; iwriteRlc2(FILE_MODEL(i), FILE_TYP_MODEL, (uint8_t*)&ersky9xModel, sizeof(Ersky9xModelData_v11));
- if(sz != sizeof(Ersky9xModelData_v11)) {
- return 0;
- }
- }
- }
-
- if (!EEPROMWarnings.isEmpty())
- QMessageBox::warning(NULL,
- QObject::tr("Warning"),
- QObject::tr("EEPROM saved with these warnings:") + "\n- " + EEPROMWarnings.remove(EEPROMWarnings.length()-1, 1).replace("\n", "\n- "));
-
- return EESIZE_SKY9X;
+ return 0;
}
int Ersky9xInterface::getSize(ModelData &model)
@@ -272,12 +249,6 @@ int Ersky9xInterface::getCapability(const Capability capability)
switch (capability) {
case Mixes:
return ERSKY9X_MAX_MIXERS_V11;
- case NumCurves5:
- return ERSKY9X_MAX_CURVE5;
- case NumCurves9:
- return ERSKY9X_MAX_CURVE9;
- case MixFmTrim:
- return 1;
case PPMExtCtrl:
return 1;
case ModelTrainerEnable:
@@ -306,10 +277,8 @@ int Ersky9xInterface::getCapability(const Capability capability)
return 2;
case Pots:
return 3;
- case GvarsNum:
+ case Gvars:
return 7;
- case GvarsOfsNum:
- return 5;
case Switches:
return 7;
case SwitchesPositions:
@@ -338,8 +307,6 @@ int Ersky9xInterface::getCapability(const Capability capability)
return 1;
case OptrexDisplay:
return 1;
- case TimerTriggerB:
- return 2;
case HasAltitudeSel:
case HasCurrentCalibration:
case HasVolume:
@@ -350,12 +317,8 @@ int Ersky9xInterface::getCapability(const Capability capability)
return 125;
case MaxVolume:
return 23;
- case Gvars:
case GvarsHaveSources:
case GvarsAsSources:
- case GvarsAsWeight:
- return 1;
- case InstantTrimSW:
return 1;
case TelemetryMaxMultiplier:
return 2;
diff --git a/companion/src/firmwares/gruvin9x/gruvin9xeeprom.cpp b/companion/src/firmwares/gruvin9x/gruvin9xeeprom.cpp
index c1c740efb..429899ab5 100644
--- a/companion/src/firmwares/gruvin9x/gruvin9xeeprom.cpp
+++ b/companion/src/firmwares/gruvin9x/gruvin9xeeprom.cpp
@@ -6,7 +6,6 @@
#define EEPROM_VER 106
-extern void setEEPROMZString(char *dst, const char *src, int size);
extern void getEEPROMZString(char *dst, const char *src, int size);
RawSwitch gruvin9xToSwitch(int8_t sw)
@@ -19,18 +18,6 @@ RawSwitch gruvin9xToSwitch(int8_t sw)
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-9 : sw+9);
}
-int8_t gruvin9xFromSwitch(const RawSwitch & sw)
-{
- switch (sw.type) {
- case SWITCH_TYPE_SWITCH:
- return sw.index;
- case SWITCH_TYPE_VIRTUAL:
- return sw.index > 0 ? (9 + sw.index) : (-9 + sw.index);
- default:
- return 0;
- }
-}
-
t_Gruvin9xTrainerMix_v103::operator TrainerMix()
{
TrainerMix c9x;
@@ -50,14 +37,6 @@ t_Gruvin9xTrainerMix_v104::operator TrainerMix()
return c9x;
}
-t_Gruvin9xTrainerMix_v104::t_Gruvin9xTrainerMix_v104(TrainerMix &c9x)
-{
- memset(this, 0, sizeof(t_Gruvin9xTrainerMix_v104));
- srcChn = c9x.src;
- studWeight = c9x.weight;
- mode = c9x.mode;
-}
-
t_Gruvin9xTrainerData_v103::operator TrainerData ()
{
TrainerData c9x;
@@ -78,16 +57,6 @@ t_Gruvin9xTrainerData_v104::operator TrainerData ()
return c9x;
}
-t_Gruvin9xTrainerData_v104::t_Gruvin9xTrainerData_v104(TrainerData &c9x)
-{
- memset(this, 0, sizeof(t_Gruvin9xTrainerData_v104));
- for (int i=0; i>=1;
- }
- if (zeros==G9X_MAX_PHASES || zeros==0) {
- phase=0;
- negPhase=0;
- } else if (zeros==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=ph+1;
- negPhase=0;
- } else if (ones==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=(ph+1);
- negPhase=1;
- } else {
- phase=0;
- EEPROMWarnings += ::QObject::tr("Flight modes settings on expos not exported") + "\n";
- }
- weight = c9x.weight;
- expo = c9x.expo;
-}
-
t_Gruvin9xExpoData::operator ExpoData ()
{
ExpoData c9x;
c9x.mode = mode;
c9x.chn = chn;
- c9x.curveParam = curve;
- c9x.curveMode=1;
c9x.swtch = gruvin9xToSwitch(swtch);
if (negPhase) {
c9x.phases= 1 << (phase -1);
@@ -325,7 +180,18 @@ t_Gruvin9xExpoData::operator ExpoData ()
c9x.phases &= ~(1 << (phase -1));
}
c9x.weight = weight;
- c9x.expo = expo;
+ if (expo) {
+ c9x.curve.type = CurveReference::CURVE_REF_EXPO;
+ c9x.curve.value = expo;
+ }
+ else if (curve > 6) {
+ c9x.curve.type = CurveReference::CURVE_REF_CUSTOM;
+ c9x.curve.value = curve - 6;
+ }
+ else if (curve > 0) {
+ c9x.curve.type = CurveReference::CURVE_REF_FUNC;
+ c9x.curve.value = curve;
+ }
return c9x;
}
@@ -334,14 +200,6 @@ t_Gruvin9xLimitData::t_Gruvin9xLimitData()
memset(this, 0, sizeof(t_Gruvin9xLimitData));
}
-t_Gruvin9xLimitData::t_Gruvin9xLimitData(LimitData &c9x)
-{
- min = c9x.min+100;
- max = c9x.max-100;
- revert = c9x.revert;
- offset = c9x.offset;
-}
-
t_Gruvin9xLimitData::operator LimitData ()
{
LimitData c9x;
@@ -352,67 +210,11 @@ t_Gruvin9xLimitData::operator LimitData ()
return c9x;
}
-
t_Gruvin9xMixData::t_Gruvin9xMixData()
{
memset(this, 0, sizeof(t_Gruvin9xMixData));
}
-t_Gruvin9xMixData::t_Gruvin9xMixData(MixData &c9x)
-{
- destCh = c9x.destCh;
- mixWarn = c9x.mixWarn;
- swtch = gruvin9xFromSwitch(c9x.swtch);
-
- if (c9x.srcRaw.type == SOURCE_TYPE_NONE) {
- srcRaw = 0;
- swtch = 0;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_STICK) {
- srcRaw = 1 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_ROTARY_ENCODER) {
- EEPROMWarnings += ::QObject::tr("Open9x on this board doesn't have Rotary Encoders") + "\n";
- srcRaw = 5 + c9x.srcRaw.index; // use pots instead
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_MAX) {
- srcRaw = 8; // MAX
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_SWITCH) {
- srcRaw = 9; // FULL
- swtch = c9x.srcRaw.index+1;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CYC) {
- srcRaw = 10 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_PPM) {
- srcRaw = 13 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CH) {
- srcRaw = 21 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_TRIM) {
- EEPROMWarnings += ::QObject::tr("gruvin9x doesn't have trims as source") + "\n";
- srcRaw = 0; // use pots instead
- }
-
- weight = c9x.weight;
- curve = c9x.curve;
- delayUp = c9x.delayUp;
- delayDown = c9x.delayDown;
- speedUp = c9x.speedUp;
- speedDown = c9x.speedDown;
- if (c9x.carryTrim<0) {
- EEPROMWarnings += ::QObject::tr("gruvin9x doesn't have swappable trims") + "\n";
- carryTrim=1;
- } else {
- carryTrim = c9x.carryTrim;
- }
- mltpx = (MltpxValue)c9x.mltpx;
-// phase = c9x.phase;
- sOffset = c9x.sOffset;
-}
-
t_Gruvin9xMixData::operator MixData ()
{
MixData c9x;
@@ -450,7 +252,6 @@ t_Gruvin9xMixData::operator MixData ()
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-21);
}
- c9x.curve = curve;
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
c9x.speedUp = speedUp;
@@ -458,34 +259,18 @@ t_Gruvin9xMixData::operator MixData ()
c9x.carryTrim = carryTrim;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
- // c9x.phase = phase;
c9x.sOffset = sOffset;
- return c9x;
-}
-
-int8_t gruvin9xFromSource(RawSource source)
-{
- int v1 = 0;
- if (source.type == SOURCE_TYPE_STICK)
- v1 = 1+source.index;
- else if (source.type == SOURCE_TYPE_ROTARY_ENCODER) {
- EEPROMWarnings += ::QObject::tr("gruvin9x on this board doesn't have Rotary Encoders") + "\n";
- v1 = 5+source.index;
+ if (curve > 6) {
+ c9x.curve.type = CurveReference::CURVE_REF_CUSTOM;
+ c9x.curve.value = curve - 6;
}
- else if (source.type == SOURCE_TYPE_MAX)
- v1 = 8;
- /* else if (source.type == SOURCE_TYPE_3POS)
- v1 = 0; */
- else if (source.type == SOURCE_TYPE_CYC)
- v1 = 10+source.index;
- else if (source.type == SOURCE_TYPE_PPM)
- v1 = 13+source.index;
- else if (source.type == SOURCE_TYPE_CH)
- v1 = 21+source.index;
- else if (source.type == SOURCE_TYPE_TELEMETRY)
- v1 = 36+source.index;
- return v1;
+ else if (curve > 0) {
+ c9x.curve.type = CurveReference::CURVE_REF_FUNC;
+ c9x.curve.value = curve;
+ }
+
+ return c9x;
}
RawSource gruvin9xToSource(int8_t value)
@@ -516,33 +301,6 @@ RawSource gruvin9xToSource(int8_t value)
}
}
-t_Gruvin9xCustomSwData::t_Gruvin9xCustomSwData(CustomSwData &c9x)
-{
- func = c9x.func;
- v1 = c9x.val1;
- v2 = c9x.val2;
-
- if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
- v1 = gruvin9xFromSource(RawSource(c9x.val1));
- }
-
- if (c9x.func >= CS_FN_EQUAL) {
- v2 = gruvin9xFromSource(RawSource(c9x.val2));
- }
-
- if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
- v1 = gruvin9xFromSwitch(RawSwitch(c9x.val1));
- v2 = gruvin9xFromSwitch(RawSwitch(c9x.val2));
- }
-
- if (func>GR9X_MAX_CSFUNC ) {
- EEPROMWarnings += ::QObject::tr("gruvin9x does not support Custom Switch function %1").arg(getFuncName(func)) + "\n";
- func=0;
- v1=0;
- v2=0;
- }
-}
-
Gruvin9xCustomSwData::operator CustomSwData ()
{
CustomSwData c9x;
@@ -566,12 +324,6 @@ Gruvin9xCustomSwData::operator CustomSwData ()
return c9x;
}
-t_Gruvin9xFuncSwData::t_Gruvin9xFuncSwData(FuncSwData &c9x)
-{
- swtch = gruvin9xFromSwitch(c9x.swtch);
- func = c9x.func - G9X_NUM_CHNOUT;
-}
-
Gruvin9xFuncSwData::operator FuncSwData ()
{
FuncSwData c9x;
@@ -580,12 +332,6 @@ Gruvin9xFuncSwData::operator FuncSwData ()
return c9x;
}
-t_Gruvin9xSafetySwData::t_Gruvin9xSafetySwData(SafetySwData &c9x)
-{
- swtch = gruvin9xFromSwitch(c9x.swtch);
- val = c9x.val;
-}
-
t_Gruvin9xSafetySwData::operator SafetySwData ()
{
SafetySwData c9x;
@@ -599,16 +345,6 @@ t_Gruvin9xSwashRingData::t_Gruvin9xSwashRingData()
memset(this, 0, sizeof(t_Gruvin9xSwashRingData));
}
-t_Gruvin9xSwashRingData::t_Gruvin9xSwashRingData(SwashRingData &c9x)
-{
- invertELE = c9x.invertELE;
- invertAIL = c9x.invertAIL;
- invertCOL = c9x.invertCOL;
- type = c9x.type;
- collectiveSource = gruvin9xFromSource(c9x.collectiveSource);
- value = c9x.value;
-}
-
t_Gruvin9xSwashRingData::operator SwashRingData ()
{
SwashRingData c9x;
@@ -645,21 +381,7 @@ t_Gruvin9xPhaseData_v106::operator PhaseData ()
return c9x;
}
-t_Gruvin9xPhaseData_v106::t_Gruvin9xPhaseData_v106(PhaseData &c9x)
-{
- trim_ext = 0;
- for (int i=0; i> 2);
- trim_ext = (trim_ext & ~(0x03 << (2*i))) + (((c9x.trim[i] & 0x03) << (2*i)));
- }
- swtch = gruvin9xFromSwitch(c9x.swtch);
- setEEPROMZString(name, c9x.name, sizeof(name));
- fadeIn = c9x.fadeIn;
- fadeOut = c9x.fadeOut;
-}
-
extern TimerMode getEr9xTimerMode(int mode);
-extern int setEr9xTimerMode(TimerMode mode);
t_Gruvin9xTimerData::operator TimerData ()
{
@@ -670,29 +392,11 @@ t_Gruvin9xTimerData::operator TimerData ()
return c9x;
}
-t_Gruvin9xTimerData::t_Gruvin9xTimerData(TimerData &c9x)
-{
- mode = setEr9xTimerMode(c9x.mode);
- val = c9x.val;
- dir = c9x.dir;
-}
-
t_Gruvin9xFrSkyChannelData::t_Gruvin9xFrSkyChannelData()
{
memset(this, 0, sizeof(t_Gruvin9xFrSkyChannelData));
}
-t_Gruvin9xFrSkyChannelData::t_Gruvin9xFrSkyChannelData(FrSkyChannelData &c9x)
-{
- memset(this, 0, sizeof(t_Gruvin9xFrSkyChannelData));
- ratio = c9x.ratio;
- alarms_value[0] = c9x.alarms[0].value;
- alarms_value[1] = c9x.alarms[1].value;
- alarms_level = (c9x.alarms[1].level << 2) + c9x.alarms[0].level;
- alarms_greater = (c9x.alarms[1].greater << 1) + c9x.alarms[0].greater;
- type = c9x.type;
-}
-
t_Gruvin9xFrSkyChannelData::operator FrSkyChannelData ()
{
FrSkyChannelData c9x;
@@ -707,19 +411,11 @@ t_Gruvin9xFrSkyChannelData::operator FrSkyChannelData ()
return c9x;
}
-
t_Gruvin9xFrSkyData::t_Gruvin9xFrSkyData()
{
memset(this, 0, sizeof(t_Gruvin9xFrSkyData));
}
-t_Gruvin9xFrSkyData::t_Gruvin9xFrSkyData(FrSkyData &c9x)
-{
- memset(this, 0, sizeof(t_Gruvin9xFrSkyData));
- channels[0] = c9x.channels[0];
- channels[1] = c9x.channels[1];
-}
-
t_Gruvin9xFrSkyData::operator FrSkyData ()
{
FrSkyData c9x;
@@ -728,7 +424,6 @@ t_Gruvin9xFrSkyData::operator FrSkyData ()
return c9x;
}
-
t_Gruvin9xModelData_v102::operator ModelData ()
{
ModelData c9x;
@@ -778,7 +473,6 @@ t_Gruvin9xModelData_v102::operator ModelData ()
c9x.expoData[i] = expoData[i];
for (int i=0; i= 0) {
- phase.trim[j] = 501 + phase.trimRef[j] - (phase.trimRef[j] >= i ? 1 : 0);
- }
- else {
- phase.trim[j] = std::max(-500, std::min(500, phase.trim[j]));
- }
- }
- phaseData[i] = phase;
- }
- frsky = c9x.frsky;
- }
- else {
- memset(this, 0, sizeof(t_Gruvin9xModelData_v106));
- }
-}
-
diff --git a/companion/src/firmwares/gruvin9x/gruvin9xeeprom.h b/companion/src/firmwares/gruvin9x/gruvin9xeeprom.h
index f2e0cf1e2..410e96e08 100644
--- a/companion/src/firmwares/gruvin9x/gruvin9xeeprom.h
+++ b/companion/src/firmwares/gruvin9x/gruvin9xeeprom.h
@@ -38,8 +38,6 @@ PACK(typedef struct t_Gruvin9xTrainerMix_v104 {
operator TrainerMix();
t_Gruvin9xTrainerMix_v104() { memset(this, 0, sizeof(t_Gruvin9xTrainerMix_v104)); }
- t_Gruvin9xTrainerMix_v104(TrainerMix&);
-
}) Gruvin9xTrainerMix_v104; //
PACK(typedef struct t_Gruvin9xTrainerData_v103 {
@@ -55,8 +53,6 @@ PACK(typedef struct t_Gruvin9xTrainerData_v104 {
operator TrainerData();
t_Gruvin9xTrainerData_v104() { memset(this, 0, sizeof(t_Gruvin9xTrainerData_v104)); }
- t_Gruvin9xTrainerData_v104(TrainerData&);
-
}) Gruvin9xTrainerData_v104;
PACK(typedef struct t_Gruvin9xFrSkyRSSIAlarm {
@@ -136,8 +132,6 @@ PACK(typedef struct t_Gruvin9xGeneral_v104 {
operator GeneralSettings();
t_Gruvin9xGeneral_v104() { memset(this, 0, sizeof(t_Gruvin9xGeneral_v104)); }
- t_Gruvin9xGeneral_v104(GeneralSettings&);
-
}) Gruvin9xGeneral_v104;
typedef Gruvin9xGeneral_v104 Gruvin9xGeneral;
@@ -156,8 +150,6 @@ PACK(typedef struct t_Gruvin9xExpoData {
operator ExpoData();
t_Gruvin9xExpoData();
- t_Gruvin9xExpoData(ExpoData&);
-
}) Gruvin9xExpoData;
PACK(typedef struct t_Gruvin9xLimitData {
@@ -168,8 +160,6 @@ PACK(typedef struct t_Gruvin9xLimitData {
operator LimitData();
t_Gruvin9xLimitData();
- t_Gruvin9xLimitData(LimitData&);
-
}) Gruvin9xLimitData;
#define MLTPX_ADD 0
@@ -194,8 +184,6 @@ PACK(typedef struct t_Gruvin9xMixData {
operator MixData();
t_Gruvin9xMixData();
- t_Gruvin9xMixData(MixData&);
-
}) Gruvin9xMixData;
PACK(typedef struct t_Gruvin9xCustomSwData { // Custom Switches data
@@ -205,8 +193,6 @@ PACK(typedef struct t_Gruvin9xCustomSwData { // Custom Switches data
operator CustomSwData();
t_Gruvin9xCustomSwData() { memset(this, 0, sizeof(t_Gruvin9xCustomSwData)); }
- t_Gruvin9xCustomSwData(CustomSwData&);
-
}) Gruvin9xCustomSwData;
PACK(typedef struct t_Gruvin9xSafetySwData { // Safety Switches data
@@ -215,8 +201,6 @@ PACK(typedef struct t_Gruvin9xSafetySwData { // Safety Switches data
operator SafetySwData();
t_Gruvin9xSafetySwData() { memset(this, 0, sizeof(t_Gruvin9xSafetySwData)); }
- t_Gruvin9xSafetySwData(SafetySwData&);
-
}) Gruvin9xSafetySwData;
PACK(typedef struct t_Gruvin9xFuncSwData { // Function Switches data
@@ -225,8 +209,6 @@ PACK(typedef struct t_Gruvin9xFuncSwData { // Function Switches data
operator FuncSwData();
t_Gruvin9xFuncSwData() { memset(this, 0, sizeof(t_Gruvin9xFuncSwData)); }
- t_Gruvin9xFuncSwData(FuncSwData&);
-
}) Gruvin9xFuncSwData;
PACK(typedef struct t_Gruvin9xFrSkyChannelData {
@@ -242,17 +224,13 @@ PACK(typedef struct t_Gruvin9xFrSkyChannelData {
operator FrSkyChannelData();
t_Gruvin9xFrSkyChannelData();
- t_Gruvin9xFrSkyChannelData(FrSkyChannelData&);
-
}) Gruvin9xFrSkyChannelData;
PACK(typedef struct t_Gruvin9xFrSkyData {
- Gruvin9xFrSkyChannelData channels[2];
-
- operator FrSkyData();
- t_Gruvin9xFrSkyData();
- t_Gruvin9xFrSkyData(FrSkyData&);
+ Gruvin9xFrSkyChannelData channels[2];
+ operator FrSkyData();
+ t_Gruvin9xFrSkyData();
}) Gruvin9xFrSkyData;
PACK(typedef struct t_Gruvin9xSwashRingData { // Swash Ring data
@@ -265,8 +243,6 @@ PACK(typedef struct t_Gruvin9xSwashRingData { // Swash Ring data
operator SwashRingData();
t_Gruvin9xSwashRingData();
- t_Gruvin9xSwashRingData(SwashRingData&);
-
}) Gruvin9xSwashRingData;
PACK(typedef struct t_Gruvin9xPhaseData_v102 {
@@ -291,7 +267,6 @@ PACK(typedef struct t_Gruvin9xPhaseData_v106 {
operator PhaseData();
t_Gruvin9xPhaseData_v106() { memset(this, 0, sizeof(t_Gruvin9xPhaseData_v106)); }
- t_Gruvin9xPhaseData_v106(PhaseData &eepe);
}) Gruvin9xPhaseData_v106;
PACK(typedef struct t_Gruvin9xTimerData {
@@ -301,7 +276,6 @@ PACK(typedef struct t_Gruvin9xTimerData {
operator TimerData();
t_Gruvin9xTimerData() { memset(this, 0, sizeof(t_Gruvin9xTimerData)); }
- t_Gruvin9xTimerData(TimerData &eepe);
}) Gruvin9xTimerData;
#define G9X_MAX_PHASES 5
@@ -410,8 +384,6 @@ PACK(typedef struct t_Gruvin9xModelData_v105 {
operator ModelData();
t_Gruvin9xModelData_v105() { memset(this, 0, sizeof(t_Gruvin9xModelData_v105)); }
- t_Gruvin9xModelData_v105(ModelData&);
-
}) Gruvin9xModelData_v105;
PACK(typedef struct t_Gruvin9xModelData_v106 {
@@ -443,11 +415,8 @@ PACK(typedef struct t_Gruvin9xModelData_v106 {
operator ModelData();
t_Gruvin9xModelData_v106() { memset(this, 0, sizeof(t_Gruvin9xModelData_v106)); }
- t_Gruvin9xModelData_v106(ModelData&);
-
}) Gruvin9xModelData_v106;
typedef Gruvin9xModelData_v106 Gruvin9xModelData;
#endif
-/*eof*/
diff --git a/companion/src/firmwares/gruvin9x/gruvin9xinterface.cpp b/companion/src/firmwares/gruvin9x/gruvin9xinterface.cpp
index 114fd3bee..cdb6d4124 100644
--- a/companion/src/firmwares/gruvin9x/gruvin9xinterface.cpp
+++ b/companion/src/firmwares/gruvin9x/gruvin9xinterface.cpp
@@ -200,62 +200,20 @@ bool Gruvin9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int es
int Gruvin9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
{
- EEPROMWarnings.clear();
+ std::cout << "NO!\n";
+ // TODO an error
- int size = getEEpromSize();
-
- efile->EeFsCreate(eeprom, size, BOARD_STOCK);
-
- Gruvin9xGeneral gruvin9xGeneral(radioData.generalSettings);
- int sz = efile->writeRlc2(FILE_GENERAL, FILE_TYP_GENERAL, (uint8_t*)&gruvin9xGeneral, sizeof(Gruvin9xGeneral));
- if(sz != sizeof(Gruvin9xGeneral)) {
- return 0;
- }
-
- for (int i=0; iwriteRlc2(FILE_MODEL(i), FILE_TYP_MODEL, (uint8_t*)&gruvin9xModel, sizeof(Gruvin9xModelData));
- if(sz != sizeof(Gruvin9xModelData)) {
- return 0;
- }
- }
- }
-
- return size;
+ return 0;
}
int Gruvin9xInterface::getSize(ModelData &model)
{
- if (model.isempty())
- return 0;
-
- uint8_t tmp[EESIZE_GRUVIN9X];
- efile->EeFsCreate(tmp, EESIZE_GRUVIN9X, BOARD_STOCK);
-
- Gruvin9xModelData gruvin9xModel(model);
- int sz = efile->writeRlc2(0, FILE_TYP_MODEL, (uint8_t*)&gruvin9xModel, sizeof(Gruvin9xModelData));
- if(sz != sizeof(Gruvin9xModelData)) {
- return -1;
- }
- return efile->size(0);
+ return 0;
}
int Gruvin9xInterface::getSize(GeneralSettings &settings)
{
- uint8_t tmp[EESIZE_GRUVIN9X];
- efile->EeFsCreate(tmp, EESIZE_GRUVIN9X, BOARD_STOCK);
-
- Gruvin9xGeneral gruvin9xGeneral(settings);
- int sz = efile->writeRlc1(0, FILE_TYP_GENERAL, (uint8_t*)&gruvin9xGeneral, sizeof(gruvin9xGeneral));
- if(sz != sizeof(gruvin9xGeneral)) {
- return -1;
- }
- return efile->size(0);
+ return 0;
}
int Gruvin9xInterface::getCapability(const Capability capability)
@@ -263,10 +221,6 @@ int Gruvin9xInterface::getCapability(const Capability capability)
switch (capability) {
case OwnerName:
return 0;
- case NumCurves5:
- return G9X_MAX_CURVE5;
- case NumCurves9:
- return G9X_MAX_CURVE9;
case Mixes:
return G9X_MAX_MIXERS;
case FlightPhases:
@@ -297,7 +251,6 @@ int Gruvin9xInterface::getCapability(const Capability capability)
return true;
case OffsetWeight:
return 125;
- case HasExpoCurves:
case HasContrast:
return true;
case Telemetry:
diff --git a/companion/src/firmwares/opentx/open9xGruvin9xeeprom.cpp b/companion/src/firmwares/opentx/open9xGruvin9xeeprom.cpp
index 74d4d0074..d18939827 100644
--- a/companion/src/firmwares/opentx/open9xGruvin9xeeprom.cpp
+++ b/companion/src/firmwares/opentx/open9xGruvin9xeeprom.cpp
@@ -5,10 +5,7 @@
#include
#include
-extern void setEEPROMZString(char *dst, const char *src, int size);
extern void getEEPROMZString(char *dst, const char *src, int size);
-
-extern int8_t open9xStockFromSwitch(const RawSwitch & sw);
extern RawSwitch open9xStockToSwitch(int8_t sw);
t_Open9xGruvin9xPhaseData_v207::operator PhaseData ()
@@ -25,21 +22,6 @@ t_Open9xGruvin9xPhaseData_v207::operator PhaseData ()
return c9x;
}
-t_Open9xGruvin9xPhaseData_v207::t_Open9xGruvin9xPhaseData_v207(PhaseData &c9x)
-{
- trim_ext = 0;
- for (int i=0; i> 2);
- trim_ext = (trim_ext & ~(0x03 << (2*i))) + (((c9x.trim[i] & 0x03) << (2*i)));
- }
- swtch = open9xStockFromSwitch(c9x.swtch);
- setEEPROMZString(name, c9x.name, sizeof(name));
- fadeIn = c9x.fadeIn;
- fadeOut = c9x.fadeOut;
- for (int i=0; i<2; i++)
- rotaryEncoders[i] = c9x.rotaryEncoders[i];
-}
-
t_Open9xGruvin9xPhaseData_v208::operator PhaseData ()
{
PhaseData c9x;
@@ -54,107 +36,6 @@ t_Open9xGruvin9xPhaseData_v208::operator PhaseData ()
return c9x;
}
-t_Open9xGruvin9xPhaseData_v208::t_Open9xGruvin9xPhaseData_v208(PhaseData &c9x)
-{
- for (int i=0; i>=1;
- }
- if (zeros==O9X_MAX_PHASES || zeros==0) {
- phase=0;
- } else if (zeros==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=ph+1;
- } else if (ones==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=-(ph+1);
- } else {
- phase=0;
- EEPROMWarnings += ::QObject::tr("Flight mode settings on mixers not exported") + "\n";
- }
- sOffset = c9x.sOffset;
- }
- else {
- memset(this, 0, sizeof(t_Open9xGruvin9xMixData_v207));
- }
-}
-
t_Open9xGruvin9xMixData_v207::operator MixData ()
{
MixData c9x;
@@ -188,9 +69,15 @@ t_Open9xGruvin9xMixData_v207::operator MixData ()
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-44);
}
c9x.weight = weight;
- c9x.differential = differential*2;
+
+ if (differential) {
+ c9x.curve = CurveReference(CurveReference::CURVE_REF_DIFF, differential*2);
+ }
+ else {
+ // TODO c9x.curve = curve;
+ }
+
c9x.swtch = open9xStockToSwitch(swtch);
- c9x.curve = curve;
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
c9x.speedUp = speedUp;
@@ -198,12 +85,14 @@ t_Open9xGruvin9xMixData_v207::operator MixData ()
c9x.carryTrim = carryTrim;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
-// c9x.phase = phase;
+
if (phase<0) {
c9x.phases= 1 << (-phase -1);
- } else if (phase==0) {
+ }
+ else if (phase==0) {
c9x.phases=0;
- } else {
+ }
+ else {
c9x.phases=63;
c9x.phases &= ~(1 << (phase -1));
}
@@ -212,98 +101,6 @@ t_Open9xGruvin9xMixData_v207::operator MixData ()
return c9x;
}
-t_Open9xGruvin9xMixData_v209::t_Open9xGruvin9xMixData_v209(MixData &c9x)
-{
- if (c9x.destCh) {
- destCh = c9x.destCh-1;
- mixWarn = c9x.mixWarn;
- swtch = open9xStockFromSwitch(c9x.swtch);
- if (c9x.srcRaw.type == SOURCE_TYPE_NONE) {
- srcRaw = 0;
- swtch = 0;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_STICK) {
- srcRaw = 1 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_ROTARY_ENCODER) {
- srcRaw = 8 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_TRIM) {
- srcRaw = 10 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_MAX) {
- srcRaw = 14;
- }
- /* else if (c9x.srcRaw.type == SOURCE_TYPE_3POS) {
- srcRaw = 15;
- } */
- else if (c9x.srcRaw.type == SOURCE_TYPE_SWITCH) {
- srcRaw = 15 + open9xStockFromSwitch(RawSwitch(c9x.srcRaw.index));
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CYC) {
- srcRaw = 37 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_PPM) {
- srcRaw = 40 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CH) {
- srcRaw = 48 + c9x.srcRaw.index;
- }
- weight = c9x.weight;
- differential = c9x.differential/2;
- curve = c9x.curve;
- delayUp = c9x.delayUp;
- delayDown = c9x.delayDown;
- speedUp = c9x.speedUp;
- speedDown = c9x.speedDown;
- carryTrim = c9x.carryTrim;
- mltpx = (MltpxValue)c9x.mltpx;
- int zeros=0;
- int ones=0;
- int phtemp=c9x.phases;
- for (int i=0; i>=1;
- }
- if (zeros==O9X_MAX_PHASES || zeros==0) {
- phase=0;
- } else if (zeros==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=ph+1;
- } else if (ones==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=-(ph+1);
- } else {
- phase=0;
- EEPROMWarnings += ::QObject::tr("Flight mode settings on mixers not exported") + "\n";
- }
- sOffset = c9x.sOffset;
- }
- else {
- memset(this, 0, sizeof(t_Open9xGruvin9xMixData_v207));
- }
-}
-
t_Open9xGruvin9xMixData_v209::operator MixData ()
{
MixData c9x;
@@ -340,9 +137,15 @@ t_Open9xGruvin9xMixData_v209::operator MixData ()
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-48);
}
c9x.weight = weight;
- c9x.differential = differential*2;
+
+ if (differential) {
+ c9x.curve = CurveReference(CurveReference::CURVE_REF_DIFF, differential*2);
+ }
+ else {
+ // TODO c9x.curve = curve;
+ }
+
c9x.swtch = open9xStockToSwitch(swtch);
- c9x.curve = curve;
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
c9x.speedUp = speedUp;
@@ -350,12 +153,14 @@ t_Open9xGruvin9xMixData_v209::operator MixData ()
c9x.carryTrim = carryTrim;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
- // c9x.phase = phase;
+
if (phase<0) {
c9x.phases= 1 << (-phase -1);
- } else if (phase==0) {
+ }
+ else if (phase==0) {
c9x.phases=0;
- } else {
+ }
+ else {
c9x.phases=63;
c9x.phases &= ~(1 << (phase -1));
}
@@ -364,66 +169,6 @@ t_Open9xGruvin9xMixData_v209::operator MixData ()
return c9x;
}
-t_Open9xGruvin9xMixData_v211::t_Open9xGruvin9xMixData_v211(MixData &c9x)
-{
- if (c9x.destCh) {
- destCh = c9x.destCh-1;
- mixWarn = c9x.mixWarn;
- swtch = open9xStockFromSwitch(c9x.swtch);
- if (c9x.srcRaw.type == SOURCE_TYPE_NONE) {
- srcRaw = 0;
- swtch = 0;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_STICK) {
- srcRaw = 1 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_ROTARY_ENCODER) {
- srcRaw = 8 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_TRIM) {
- srcRaw = 10 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_MAX) {
- srcRaw = 14;
- }
- /* else if (c9x.srcRaw.type == SOURCE_TYPE_3POS) {
- srcRaw = 15;
- } */
- else if (c9x.srcRaw.type == SOURCE_TYPE_SWITCH) {
- srcRaw = 15 + open9xStockFromSwitch(RawSwitch(c9x.srcRaw.index));
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CYC) {
- srcRaw = 37 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_PPM) {
- srcRaw = 40 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CH) {
- srcRaw = 48 + c9x.srcRaw.index;
- }
- weight = c9x.weight;
- if (c9x.curve==0) {
- curveMode=0;
- curveParam=c9x.differential;
- } else {
- curveMode=1;
- curveParam = c9x.curve;
- }
- delayUp = c9x.delayUp;
- delayDown = c9x.delayDown;
- speedUp = c9x.speedUp;
- speedDown = c9x.speedDown;
- carryTrim = c9x.carryTrim;
- noExpo = c9x.noExpo;
- mltpx = (MltpxValue)c9x.mltpx;
- phases = c9x.phases;
- sOffset = c9x.sOffset;
- }
- else {
- memset(this, 0, sizeof(t_Open9xGruvin9xMixData_v211));
- }
-}
-
t_Open9xGruvin9xMixData_v211::operator MixData ()
{
MixData c9x;
@@ -461,12 +206,14 @@ t_Open9xGruvin9xMixData_v211::operator MixData ()
}
c9x.weight = weight;
c9x.swtch = open9xStockToSwitch(swtch);
+
if (curveMode==0) {
- c9x.differential = curveParam;
- c9x.curve=0;
- } else {
- c9x.curve=curveParam;
- }
+ c9x.curve = CurveReference(CurveReference::CURVE_REF_DIFF, curveParam);
+ }
+ else {
+ // TODO c9x.curve = curve;
+ }
+
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
c9x.speedUp = speedUp;
@@ -481,28 +228,6 @@ t_Open9xGruvin9xMixData_v211::operator MixData ()
return c9x;
}
-int8_t open9xV4207FromSource(RawSource source)
-{
- int v1 = 0;
- if (source.type == SOURCE_TYPE_STICK)
- v1 = 1+source.index;
- else if (source.type == SOURCE_TYPE_ROTARY_ENCODER)
- v1 = 8+source.index;
- else if (source.type == SOURCE_TYPE_MAX)
- v1 = 10;
- /* else if (source.type == SOURCE_TYPE_3POS)
- v1 = 11; */
- else if (source.type == SOURCE_TYPE_CYC)
- v1 = 12+source.index;
- else if (source.type == SOURCE_TYPE_PPM)
- v1 = 15+source.index;
- else if (source.type == SOURCE_TYPE_CH)
- v1 = 23+source.index;
- else if (source.type == SOURCE_TYPE_TELEMETRY)
- v1 = 38+source.index;
- return v1;
-}
-
RawSource open9xV4207ToSource(int8_t value)
{
if (value == 0) {
@@ -534,30 +259,6 @@ RawSource open9xV4207ToSource(int8_t value)
}
}
-int8_t open9xV4209FromSource(RawSource source)
-{
- int v1 = 0;
- if (source.type == SOURCE_TYPE_STICK)
- v1 = 1+source.index;
- else if (source.type == SOURCE_TYPE_ROTARY_ENCODER)
- v1 = 8+source.index;
- if (source.type == SOURCE_TYPE_TRIM)
- v1 = 10+source.index;
- else if (source.type == SOURCE_TYPE_MAX)
- v1 = 14;
- /* else if (source.type == SOURCE_TYPE_3POS)
- v1 = 15; */
- else if (source.type == SOURCE_TYPE_CYC)
- v1 = 16+source.index;
- else if (source.type == SOURCE_TYPE_PPM)
- v1 = 19+source.index;
- else if (source.type == SOURCE_TYPE_CH)
- v1 = 27+source.index;
- else if (source.type == SOURCE_TYPE_TELEMETRY)
- v1 = 42+source.index;
- return v1;
-}
-
RawSource open9xV4209ToSource(int8_t value)
{
if (value == 0) {
@@ -592,33 +293,6 @@ RawSource open9xV4209ToSource(int8_t value)
}
}
-t_Open9xGruvin9xCustomSwData_v207::t_Open9xGruvin9xCustomSwData_v207(CustomSwData &c9x)
-{
- func = c9x.func;
- v1 = c9x.val1;
- v2 = c9x.val2;
-
- if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
- v1 = open9xV4207FromSource(RawSource(c9x.val1));
- }
-
- if (c9x.func >= CS_FN_EQUAL) {
- v2 = open9xV4207FromSource(RawSource(c9x.val2));
- }
-
- if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
- v1 = open9xStockFromSwitch(RawSwitch(c9x.val1));
- v2 = open9xStockFromSwitch(RawSwitch(c9x.val2));
- }
-
- if (func>O9X_V4_MAX_CSFUNCOLD ) {
- EEPROMWarnings += ::QObject::tr("This version of open9x does not support Custom Switch function %1").arg(getFuncName(func)) + "\n";
- func=0;
- v1=0;
- v2=0;
- }
-}
-
Open9xGruvin9xCustomSwData_v207::operator CustomSwData ()
{
CustomSwData c9x;
@@ -642,26 +316,6 @@ Open9xGruvin9xCustomSwData_v207::operator CustomSwData ()
return c9x;
}
-t_Open9xGruvin9xCustomSwData_v209::t_Open9xGruvin9xCustomSwData_v209(CustomSwData &c9x)
-{
- func = c9x.func;
- v1 = c9x.val1;
- v2 = c9x.val2;
-
- if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
- v1 = open9xV4209FromSource(RawSource(c9x.val1));
- }
-
- if (c9x.func >= CS_FN_EQUAL && c9x.func <= CS_FN_ELESS) {
- v2 = open9xV4209FromSource(RawSource(c9x.val2));
- }
-
- if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
- v1 = open9xStockFromSwitch(RawSwitch(c9x.val1));
- v2 = open9xStockFromSwitch(RawSwitch(c9x.val2));
- }
-}
-
Open9xGruvin9xCustomSwData_v209::operator CustomSwData ()
{
CustomSwData c9x;
@@ -685,45 +339,6 @@ Open9xGruvin9xCustomSwData_v209::operator CustomSwData ()
return c9x;
}
-t_Open9xGruvin9xFuncSwData_v203::t_Open9xGruvin9xFuncSwData_v203(FuncSwData &c9x)
-{
- swtch = open9xStockFromSwitch(c9x.swtch);
- if (c9x.func <= FuncSafetyCh16) {
- param = ((c9x.param>>1)<<1);
- param |=(c9x.enabled & 0x01);
- func = c9x.func;
- } else {
- param = c9x.param;
- if (c9x.func <= FuncTrainerAIL)
- func = 16 + c9x.func - FuncTrainer;
- else if (c9x.func == FuncInstantTrim)
- func = 21;
- else if (c9x.func == FuncPlaySound)
- func = 22;
- else if (c9x.func == FuncPlayHaptic)
- func = 23;
- else if (c9x.func == FuncReset)
- func = 24;
- else if (c9x.func == FuncVario)
- func = 25;
- else if (c9x.func == FuncPlayPrompt)
- func = 26;
- else if (c9x.func == FuncPlayValue)
- func = 27;
- else if (c9x.func == FuncLogs)
- func = 28;
- else if (c9x.func == FuncBacklight)
- func = 29;
- else if (c9x.func >= FuncAdjustGV1 && c9x.func <= FuncAdjustGV5)
- func = 30 + c9x.func - FuncAdjustGV1;
- else {
- swtch = 0;
- func = 0;
- param = 0;
- }
- }
-}
-
t_Open9xGruvin9xFuncSwData_v203::operator FuncSwData ()
{
FuncSwData c9x;
@@ -763,37 +378,6 @@ t_Open9xGruvin9xFuncSwData_v203::operator FuncSwData ()
return c9x;
}
-t_Open9xGruvin9xFuncSwData_v210::t_Open9xGruvin9xFuncSwData_v210(FuncSwData &c9x)
-{
- swtch = open9xStockFromSwitch(c9x.swtch);
- param = c9x.param;
- if (c9x.func <= FuncInstantTrim) {
- func = (uint8_t)c9x.func;
- delay = c9x.enabled;
- }
- else if (c9x.func == FuncPlaySound)
- func = 22;
- else if (c9x.func == FuncPlayHaptic)
- func = 23;
- else if (c9x.func == FuncReset)
- func = 24;
- else if (c9x.func == FuncVario)
- func = 25;
- else if (c9x.func == FuncPlayPrompt)
- func = 26;
- else if (c9x.func == FuncPlayValue)
- func = 27;
- else if (c9x.func == FuncLogs)
- func = 28;
- else if (c9x.func == FuncBacklight)
- func = 29;
- else {
- swtch = 0;
- func = 0;
- param = 0;
- }
-}
-
t_Open9xGruvin9xFuncSwData_v210::operator FuncSwData ()
{
FuncSwData c9x;
@@ -823,16 +407,6 @@ t_Open9xGruvin9xFuncSwData_v210::operator FuncSwData ()
return c9x;
}
-t_Open9xGruvin9xSwashRingData_v208::t_Open9xGruvin9xSwashRingData_v208(SwashRingData &c9x)
-{
- invertELE = c9x.invertELE;
- invertAIL = c9x.invertAIL;
- invertCOL = c9x.invertCOL;
- type = c9x.type;
- collectiveSource = open9xV4207FromSource(c9x.collectiveSource);
- value = c9x.value;
-}
-
t_Open9xGruvin9xSwashRingData_v208::operator SwashRingData ()
{
SwashRingData c9x;
@@ -845,16 +419,6 @@ t_Open9xGruvin9xSwashRingData_v208::operator SwashRingData ()
return c9x;
}
-t_Open9xGruvin9xSwashRingData_v209::t_Open9xGruvin9xSwashRingData_v209(SwashRingData &c9x)
-{
- invertELE = c9x.invertELE;
- invertAIL = c9x.invertAIL;
- invertCOL = c9x.invertCOL;
- type = c9x.type;
- collectiveSource = open9xV4209FromSource(c9x.collectiveSource);
- value = c9x.value;
-}
-
t_Open9xGruvin9xSwashRingData_v209::operator SwashRingData ()
{
SwashRingData c9x;
@@ -915,7 +479,6 @@ t_Open9xGruvin9xModelData_v207::operator ModelData ()
c9x.expoData[i] = expoData[i];
for (int i=0; i= 0) {
- phase.trim[j] = 501 + phase.trimRef[j] - (phase.trimRef[j] >= i ? 1 : 0);
- }
- else {
- phase.trim[j] = std::max(-500, std::min(500, phase.trim[j]));
- }
- }
- phaseData[i] = phase;
- }
- frsky = c9x.frsky;
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- thrTraceSrc = c9x.thrTraceSrc;
- modelId = c9x.modelId;
- frskyLinesXtra=0;
- for (int j=0; j<4; j++) {
- frskyLines[j] = 0;
- for (int k=0; k<2; k++) {
- int value = c9x.frsky.screens[1].body.lines[j].source[k];
- frskyLines[j] |= (k==0 ? (value & 0x0f) : ((value & 0x0f) << 4));
- frskyLinesXtra |= (value / 16) << (4*j+2*k);
- }
- }
- }
- else {
- memset(this, 0, sizeof(t_Open9xGruvin9xModelData_v207));
- }
-}
-
-
t_Open9xGruvin9xModelData_v208::operator ModelData ()
{
ModelData c9x;
@@ -1104,7 +563,6 @@ t_Open9xGruvin9xModelData_v208::operator ModelData ()
for (int i=0; i= 0) {
- phase.trim[j] = 501 + phase.trimRef[j] - (phase.trimRef[j] >= i ? 1 : 0);
- }
- else {
- phase.trim[j] = std::max(-500, std::min(500, phase.trim[j]));
- }
- }
- phaseData[i] = phase;
- }
- frsky = c9x.frsky;
- varioSource = c9x.frsky.varioSource;
- varioSpeedUpMin = c9x.frsky.varioCenterMax;
- varioSpeedDownMin = c9x.frsky.varioCenterMin;
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- thrTraceSrc = c9x.thrTraceSrc;
- modelId = c9x.modelId;
- frskyLinesXtra=0;
- for (int j=0; j<4; j++) {
- frskyLines[j] = 0;
- for (int k=0; k<2; k++) {
- int value = c9x.frsky.screens[1].body.lines[j].source[k];
- frskyLines[j] |= (k==0 ? (value & 0x0f) : ((value & 0x0f) << 4));
- frskyLinesXtra |= (value / 16) << (4*j+2*k);
- }
- }
- for (int i=0; i= 0) {
- phase.trim[j] = 501 + phase.trimRef[j] - (phase.trimRef[j] >= i ? 1 : 0);
- }
- else {
- phase.trim[j] = std::max(-500, std::min(500, phase.trim[j]));
- }
- }
- phaseData[i] = phase;
- }
- frsky = c9x.frsky;
- varioSource = c9x.frsky.varioSource;
- varioSpeedUpMin = c9x.frsky.varioCenterMax;
- varioSpeedDownMin = c9x.frsky.varioCenterMin;
- switchWarningStates = c9x.switchWarningStates;
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- thrTraceSrc = c9x.thrTraceSrc;
- modelId = c9x.modelId;
- frskyLinesXtra=0;
- for (int j=0; j<4; j++) {
- frskyLines[j] = 0;
- for (int k=0; k<2; k++) {
- int value = c9x.frsky.screens[1].body.lines[j].source[k];
- frskyLines[j] |= (k==0 ? (value & 0x0f) : ((value & 0x0f) << 4));
- frskyLinesXtra |= (value / 16) << (4*j+2*k);
- }
- }
- for (int i=0; i O9X_NUM_POINTS - 5 * O9X_MAX_CURVES) {
- EEPROMWarnings += ::QObject::tr("open9x only accepts %1 points in all curves").arg(O9X_NUM_POINTS) + "\n";
- break;
- }
- curves[i] = offset;
- for (int j=0; j= 0) {
- phase.trim[j] = 501 + phase.trimRef[j] - (phase.trimRef[j] >= i ? 1 : 0);
- }
- else {
- phase.trim[j] = std::max(-500, std::min(500, phase.trim[j]));
- }
- }
- phaseData[i] = phase;
- }
- frsky = c9x.frsky;
- switchWarningStates = c9x.switchWarningStates;
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- thrTraceSrc = c9x.thrTraceSrc;
- modelId = c9x.modelId;
- for (int i=0; i O9X_NUM_POINTS - 5 * O9X_MAX_CURVES) {
- EEPROMWarnings += ::QObject::tr("open9x only accepts %1 points in all curves").arg(O9X_NUM_POINTS) + "\n";
- break;
- }
- curves[i] = offset;
- for (int j=0; j= 0) {
- phase.trim[j] = 501 + phase.trimRef[j] - (phase.trimRef[j] >= i ? 1 : 0);
- }
- else {
- phase.trim[j] = std::max(-500, std::min(500, phase.trim[j]));
- }
- }
- phaseData[i] = phase;
- }
- frsky = c9x.frsky;
- switchWarningStates = c9x.switchWarningStates;
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- thrTraceSrc = c9x.thrTraceSrc;
- modelId = c9x.modelId;
- }
-}
-
diff --git a/companion/src/firmwares/opentx/open9xGruvin9xeeprom.h b/companion/src/firmwares/opentx/open9xGruvin9xeeprom.h
index a37ed3d9d..c95dc6742 100644
--- a/companion/src/firmwares/opentx/open9xGruvin9xeeprom.h
+++ b/companion/src/firmwares/opentx/open9xGruvin9xeeprom.h
@@ -32,7 +32,6 @@ PACK(typedef struct t_Open9xGruvin9xPhaseData_v207 {
int16_t rotaryEncoders[2];
operator PhaseData();
t_Open9xGruvin9xPhaseData_v207() { memset(this, 0, sizeof(t_Open9xGruvin9xPhaseData_v207)); }
- t_Open9xGruvin9xPhaseData_v207(PhaseData &eepe);
}) Open9xGruvin9xPhaseData_v207;
PACK(typedef struct t_Open9xGruvin9xPhaseData_v208 {
@@ -44,7 +43,6 @@ PACK(typedef struct t_Open9xGruvin9xPhaseData_v208 {
int16_t rotaryEncoders[2];
operator PhaseData();
t_Open9xGruvin9xPhaseData_v208() { memset(this, 0, sizeof(t_Open9xGruvin9xPhaseData_v208)); }
- t_Open9xGruvin9xPhaseData_v208(PhaseData &eepe);
}) Open9xGruvin9xPhaseData_v208;
PACK(typedef struct t_Open9xGruvin9xMixData_v207 {
@@ -66,8 +64,6 @@ PACK(typedef struct t_Open9xGruvin9xMixData_v207 {
operator MixData();
t_Open9xGruvin9xMixData_v207() { memset(this, 0, sizeof(t_Open9xGruvin9xMixData_v207)); }
- t_Open9xGruvin9xMixData_v207(MixData&);
-
}) Open9xGruvin9xMixData_v207;
PACK(typedef struct t_Open9xGruvin9xMixData_v209 {
@@ -89,8 +85,6 @@ PACK(typedef struct t_Open9xGruvin9xMixData_v209 {
operator MixData();
t_Open9xGruvin9xMixData_v209() { memset(this, 0, sizeof(t_Open9xGruvin9xMixData_v209)); }
- t_Open9xGruvin9xMixData_v209(MixData&);
-
}) Open9xGruvin9xMixData_v209;
PACK(typedef struct t_Open9xGruvin9xMixData_v211 {
@@ -114,8 +108,6 @@ PACK(typedef struct t_Open9xGruvin9xMixData_v211 {
operator MixData();
t_Open9xGruvin9xMixData_v211() { memset(this, 0, sizeof(t_Open9xGruvin9xMixData_v211)); }
- t_Open9xGruvin9xMixData_v211(MixData&);
-
}) Open9xGruvin9xMixData_v211;
PACK(typedef struct t_Open9xGruvin9xCustomSwData_v207 { // Custom Switches data
@@ -125,10 +117,8 @@ PACK(typedef struct t_Open9xGruvin9xCustomSwData_v207 { // Custom Switches data
operator CustomSwData();
t_Open9xGruvin9xCustomSwData_v207() { memset(this, 0, sizeof(t_Open9xGruvin9xCustomSwData_v207)); }
- t_Open9xGruvin9xCustomSwData_v207(CustomSwData&);
int8_t fromSource(RawSource source);
RawSource toSource(int8_t value);
-
}) Open9xGruvin9xCustomSwData_v207;
PACK(typedef struct t_Open9xGruvin9xCustomSwData_v209 { // Custom Switches data
@@ -138,10 +128,8 @@ PACK(typedef struct t_Open9xGruvin9xCustomSwData_v209 { // Custom Switches data
operator CustomSwData();
t_Open9xGruvin9xCustomSwData_v209() { memset(this, 0, sizeof(t_Open9xGruvin9xCustomSwData_v209)); }
- t_Open9xGruvin9xCustomSwData_v209(CustomSwData&);
int8_t fromSource(RawSource source);
RawSource toSource(int8_t value);
-
}) Open9xGruvin9xCustomSwData_v209;
PACK(typedef struct t_Open9xGruvin9xFuncSwData_v203 { // Function Switches data
@@ -151,8 +139,6 @@ PACK(typedef struct t_Open9xGruvin9xFuncSwData_v203 { // Function Switches data
operator FuncSwData();
t_Open9xGruvin9xFuncSwData_v203() { memset(this, 0, sizeof(t_Open9xGruvin9xFuncSwData_v203)); }
- t_Open9xGruvin9xFuncSwData_v203(FuncSwData&);
-
}) Open9xGruvin9xFuncSwData_v203;
PACK(typedef struct t_Open9xGruvin9xFuncSwData_v210 { // Function Switches data
@@ -163,8 +149,6 @@ PACK(typedef struct t_Open9xGruvin9xFuncSwData_v210 { // Function Switches data
operator FuncSwData();
t_Open9xGruvin9xFuncSwData_v210() { memset(this, 0, sizeof(t_Open9xGruvin9xFuncSwData_v210)); }
- t_Open9xGruvin9xFuncSwData_v210(FuncSwData&);
-
}) Open9xGruvin9xFuncSwData_v210;
PACK(typedef struct t_Open9xGruvin9xSwashRingData_v208 { // Swash Ring data
@@ -177,8 +161,6 @@ PACK(typedef struct t_Open9xGruvin9xSwashRingData_v208 { // Swash Ring data
operator SwashRingData();
t_Open9xGruvin9xSwashRingData_v208() { memset(this, 0, sizeof(t_Open9xGruvin9xSwashRingData_v208)); }
- t_Open9xGruvin9xSwashRingData_v208(SwashRingData&);
-
}) Open9xGruvin9xSwashRingData_v208;
PACK(typedef struct t_Open9xGruvin9xSwashRingData_v209 { // Swash Ring data
@@ -191,8 +173,6 @@ PACK(typedef struct t_Open9xGruvin9xSwashRingData_v209 { // Swash Ring data
operator SwashRingData();
t_Open9xGruvin9xSwashRingData_v209() { memset(this, 0, sizeof(t_Open9xGruvin9xSwashRingData_v209)); }
- t_Open9xGruvin9xSwashRingData_v209(SwashRingData&);
-
}) Open9xGruvin9xSwashRingData_v209;
PACK(typedef struct t_Open9xGruvin9xModelData_v207 {
@@ -227,8 +207,6 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v207 {
operator ModelData();
t_Open9xGruvin9xModelData_v207() { memset(this, 0, sizeof(t_Open9xGruvin9xModelData_v207)); }
- t_Open9xGruvin9xModelData_v207(ModelData&);
-
}) Open9xGruvin9xModelData_v207;
PACK(typedef struct t_Open9xGruvin9xModelData_v208 {
@@ -268,8 +246,6 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v208 {
operator ModelData();
t_Open9xGruvin9xModelData_v208() { memset(this, 0, sizeof(t_Open9xGruvin9xModelData_v208)); }
- t_Open9xGruvin9xModelData_v208(ModelData&);
-
}) Open9xGruvin9xModelData_v208;
PACK(typedef struct t_Open9xGruvin9xModelData_v209 {
@@ -310,8 +286,6 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v209 {
operator ModelData();
t_Open9xGruvin9xModelData_v209() { memset(this, 0, sizeof(t_Open9xGruvin9xModelData_v209)); }
- t_Open9xGruvin9xModelData_v209(ModelData&);
-
}) Open9xGruvin9xModelData_v209;
PACK(typedef struct t_Open9xGruvin9xModelData_v210 {
@@ -350,8 +324,6 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v210 {
operator ModelData();
t_Open9xGruvin9xModelData_v210() { memset(this, 0, sizeof(t_Open9xGruvin9xModelData_v210)); }
- t_Open9xGruvin9xModelData_v210(ModelData&);
-
}) Open9xGruvin9xModelData_v210;
PACK(typedef struct t_Open9xGruvin9xModelData_v211 {
@@ -388,8 +360,6 @@ PACK(typedef struct t_Open9xGruvin9xModelData_v211 {
operator ModelData();
t_Open9xGruvin9xModelData_v211() { memset(this, 0, sizeof(t_Open9xGruvin9xModelData_v211)); }
- t_Open9xGruvin9xModelData_v211(ModelData&);
-
}) Open9xGruvin9xModelData_v211;
#endif
diff --git a/companion/src/firmwares/opentx/open9xSky9xeeprom.cpp b/companion/src/firmwares/opentx/open9xSky9xeeprom.cpp
index afa897700..524d55fee 100644
--- a/companion/src/firmwares/opentx/open9xSky9xeeprom.cpp
+++ b/companion/src/firmwares/opentx/open9xSky9xeeprom.cpp
@@ -5,31 +5,8 @@
#include
#include
-extern void setEEPROMZString(char *dst, const char *src, int size);
extern void getEEPROMZString(char *dst, const char *src, int size);
-int8_t open9xArmFromSwitch(const RawSwitch & sw)
-{
- switch (sw.type) {
- case SWITCH_TYPE_SWITCH:
- return sw.index;
- case SWITCH_TYPE_VIRTUAL:
- return sw.index > 0 ? (9 + sw.index) : (-9 + sw.index);
- case SWITCH_TYPE_ON:
- return 42;
- case SWITCH_TYPE_OFF:
- return -42;
- case SWITCH_TYPE_MOMENT_SWITCH:
- return sw.index > 0 ? (42 + sw.index) : (-42 + sw.index);
- case SWITCH_TYPE_MOMENT_VIRTUAL:
- return sw.index > 0 ? (51 + sw.index) : (-51 + sw.index);
- case SWITCH_TYPE_ONM:
- return 84;
- default:
- return 0;
- }
-}
-
RawSwitch open9xArmToSwitch(int8_t sw)
{
uint8_t swa = abs(sw);
@@ -51,30 +28,6 @@ RawSwitch open9xArmToSwitch(int8_t sw)
return RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, sw > 0 ? sw-42-9 : sw+42+9);
}
-int8_t open9xArm208FromSource(RawSource source)
-{
- int v1 = 0;
- if (source.type == SOURCE_TYPE_STICK)
- v1 = 1+source.index;
- else if (source.type == SOURCE_TYPE_ROTARY_ENCODER) {
- EEPROMWarnings += ::QObject::tr("Open9x on this board doesn't have Rotary Encoders") + "\n";
- v1 = 5+source.index;
- }
- else if (source.type == SOURCE_TYPE_MAX)
- v1 = 8;
- /* else if (source.type == SOURCE_TYPE_3POS)
- v1 = 9; */
- else if (source.type == SOURCE_TYPE_CYC)
- v1 = 10+source.index;
- else if (source.type == SOURCE_TYPE_PPM)
- v1 = 13+source.index;
- else if (source.type == SOURCE_TYPE_CH)
- v1 = 21+source.index;
- else if (source.type == SOURCE_TYPE_TELEMETRY)
- v1 = 52+source.index;
- return v1;
-}
-
RawSource open9xArm208ToSource(int8_t value)
{
if (value == 0) {
@@ -103,32 +56,6 @@ RawSource open9xArm208ToSource(int8_t value)
}
}
-int8_t open9xArm209FromSource(RawSource source)
-{
- int v1 = 0;
- if (source.type == SOURCE_TYPE_STICK)
- v1 = 1+source.index;
- else if (source.type == SOURCE_TYPE_ROTARY_ENCODER) {
- EEPROMWarnings += ::QObject::tr("Open9x on this board doesn't have Rotary Encoders") + "\n";
- v1 = 5+source.index;
- }
- else if (source.type == SOURCE_TYPE_TRIM)
- v1 = 8 + source.index;
- else if (source.type == SOURCE_TYPE_MAX)
- v1 = 12;
- /* else if (source.type == SOURCE_TYPE_3POS)
- v1 = 13; */
- else if (source.type == SOURCE_TYPE_CYC)
- v1 = 14+source.index;
- else if (source.type == SOURCE_TYPE_PPM)
- v1 = 17+source.index;
- else if (source.type == SOURCE_TYPE_CH)
- v1 = 25+source.index;
- else if (source.type == SOURCE_TYPE_TELEMETRY)
- v1 = 56+source.index;
- return v1;
-}
-
RawSource open9xArm209ToSource(int8_t value)
{
if (value == 0) {
@@ -160,30 +87,6 @@ RawSource open9xArm209ToSource(int8_t value)
}
}
-int8_t open9xArm210FromSource(RawSource source)
-{
- int v1 = 0;
- if (source.type == SOURCE_TYPE_STICK)
- v1 = 1+source.index;
- else if (source.type == SOURCE_TYPE_ROTARY_ENCODER)
- v1 = 8;
- else if (source.type == SOURCE_TYPE_TRIM)
- v1 = 9 + source.index;
- else if (source.type == SOURCE_TYPE_MAX)
- v1 = 13;
- /* else if (source.type == SOURCE_TYPE_3POS)
- v1 = 14; */
- else if (source.type == SOURCE_TYPE_CYC)
- v1 = 15+source.index;
- else if (source.type == SOURCE_TYPE_PPM)
- v1 = 18+source.index;
- else if (source.type == SOURCE_TYPE_CH)
- v1 = 26+source.index;
- else if (source.type == SOURCE_TYPE_TELEMETRY)
- v1 = 57+source.index;
- return v1;
-}
-
RawSource open9xArm210ToSource(int8_t value)
{
if (value == 0) {
@@ -239,88 +142,6 @@ t_Open9xArmTimerData_v202::operator TimerData ()
return c9x;
}
-t_Open9xArmTimerData_v202::t_Open9xArmTimerData_v202(TimerData &c9x)
-{
- val = c9x.val;
-
- if (c9x.mode >= TMRMODE_OFF && c9x.mode <= TMRMODE_THt)
- mode = 0+c9x.mode-TMRMODE_OFF;
- else if (c9x.mode >= TMRMODE_FIRST_MOMENT_SWITCH)
- mode = 46+c9x.mode-TMRMODE_FIRST_MOMENT_SWITCH;
- else if (c9x.mode >= TMRMODE_FIRST_SWITCH)
- mode = 5+c9x.mode-TMRMODE_FIRST_SWITCH;
- else if (c9x.mode <= TMRMODE_FIRST_NEG_MOMENT_SWITCH)
- mode = -42+c9x.mode-TMRMODE_FIRST_NEG_MOMENT_SWITCH;
- else if (c9x.mode <= TMRMODE_FIRST_NEG_SWITCH)
- mode = -1+c9x.mode-TMRMODE_FIRST_NEG_SWITCH;
- else
- mode = 0;
-}
-
-t_Open9xArmExpoData_v208::t_Open9xArmExpoData_v208(ExpoData &c9x)
-{
- mode = c9x.mode;
- chn = c9x.chn;
- // 0=no curve, 1-6=std curves, 7-10=CV1-CV4, 11-15=CV9-CV13
- curve = 0;
- expo = 0;
- if (c9x.curveMode==1) {
- if (c9x.curveParam >=0 && c9x.curveParam <= 10)
- curve = c9x.curveParam;
- else if (c9x.curveParam >= 15 && c9x.curveParam <= 19)
- curve = c9x.curveParam - 4;
- else
- EEPROMWarnings += ::QObject::tr("Open9x doesn't allow Curve%1 in expos").arg(c9x.curveParam-6) + "\n";
- }
- else {
- expo=c9x.curveParam;
- }
-
- swtch = open9xArmFromSwitch(c9x.swtch);
- int zeros=0;
- int ones=0;
- int phtemp=c9x.phases;
- for (int i=0; i>=1;
- }
- if (zeros==O9X_MAX_PHASES || zeros==0) {
- phase=0;
- } else if (zeros==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=ph+1;
- } else if (ones==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=-(ph+1);
- } else {
- phase=0;
- EEPROMWarnings += ::QObject::tr("Flight modes settings on expos not exported") + "\n";
- }
-
- weight = c9x.weight;
- expo = c9x.expo;
-}
-
t_Open9xArmExpoData_v208::operator ExpoData ()
{
ExpoData c9x;
@@ -332,14 +153,10 @@ t_Open9xArmExpoData_v208::operator ExpoData ()
}
else {
if (curve == 0) {
- c9x.curveMode=0;
- c9x.curveParam=expo;
- } else {
- c9x.curveMode=1;
- if (curve <= 10)
- c9x.curveParam = curve;
- else
- c9x.curveParam = curve + 4;
+ c9x.curve = CurveReference(CurveReference::CURVE_REF_EXPO, expo);
+ }
+ else {
+ // TODO
}
}
c9x.swtch = open9xArmToSwitch(swtch);
@@ -355,70 +172,6 @@ t_Open9xArmExpoData_v208::operator ExpoData ()
return c9x;
}
-t_Open9xArmExpoData_v210::t_Open9xArmExpoData_v210(ExpoData &c9x)
-{
- mode = c9x.mode;
- chn = c9x.chn;
- // 0=no curve, 1-6=std curves, 7-10=CV1-CV4, 11-15=CV9-CV13
- curve = 0;
- expo = 0;
- if (c9x.curveMode==1) {
- if (c9x.curveParam >=0 && c9x.curveParam <= 10)
- curve = c9x.curveParam;
- else if (c9x.curveParam >= 15 && c9x.curveParam <= 19)
- curve = c9x.curveParam - 4;
- else
- EEPROMWarnings += ::QObject::tr("Open9x doesn't allow Curve%1 in expos").arg(c9x.curveParam-6) + "\n";
- }
- else {
- expo=c9x.curveParam;
- }
-
- swtch = open9xArmFromSwitch(c9x.swtch);
- int zeros=0;
- int ones=0;
- int phtemp=c9x.phases;
- for (int i=0; i>=1;
- }
- if (zeros==O9X_MAX_PHASES || zeros==0) {
- phase=0;
- } else if (zeros==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=ph+1;
- } else if (ones==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=-(ph+1);
- } else {
- phase=0;
- EEPROMWarnings += ::QObject::tr("Flight modes settings on expos not exported") + "\n";
- }
- weight = c9x.weight;
- expo = c9x.expo;
- setEEPROMZString(name, c9x.name, sizeof(name));
-}
-
t_Open9xArmExpoData_v210::operator ExpoData ()
{
ExpoData c9x;
@@ -430,53 +183,36 @@ t_Open9xArmExpoData_v210::operator ExpoData ()
}
else {
if (curve == 0) {
- c9x.curveMode=0;
- c9x.curveParam=expo;
+ c9x.curve = CurveReference(CurveReference::CURVE_REF_EXPO, expo);
}
else {
- c9x.curveMode=1;
- if (curve <= 10)
- c9x.curveParam = curve;
- else
- c9x.curveParam = curve + 4;
+ // TODO
}
}
c9x.swtch = open9xArmToSwitch(swtch);
if (phase<0) {
c9x.phases= 1 << (-phase -1);
- } else if (phase==0) {
+ }
+ else if (phase==0) {
c9x.phases=0;
- } else {
+ }
+ else {
c9x.phases=63;
c9x.phases &= ~(1 << (phase -1));
}
c9x.weight = weight;
- c9x.expo = expo;
getEEPROMZString(c9x.name, name, sizeof(name));
return c9x;
}
-t_Open9xArmExpoData_v212::t_Open9xArmExpoData_v212(ExpoData &c9x)
-{
- mode = c9x.mode;
- chn = c9x.chn;
- // 0=no curve, 1-6=std curves, 7-10=CV1-CV4, 11-15=CV9-CV13
- curveParam=c9x.curveParam;
- curveMode=c9x.curveMode;
- swtch = open9xArmFromSwitch(c9x.swtch);
- phases=c9x.phases;
- weight = c9x.weight;
- setEEPROMZString(name, c9x.name, sizeof(name));
-}
-
t_Open9xArmExpoData_v212::operator ExpoData ()
{
ExpoData c9x;
c9x.mode = mode;
c9x.chn = chn;
- c9x.curveMode=curveMode;
- c9x.curveParam=curveParam;
+ // TODO c9x.curveMode=curveMode;
+ // c9x.curveParam=curveParam;
c9x.swtch = open9xArmToSwitch(swtch);
c9x.phases= phases;
c9x.weight = weight;
@@ -496,16 +232,6 @@ t_Open9xArmPhaseData_v208::operator PhaseData ()
return c9x;
}
-t_Open9xArmPhaseData_v208::t_Open9xArmPhaseData_v208(PhaseData &c9x)
-{
- for (int i=0; i>=1;
- }
- if (zeros==O9X_ARM_MAX_PHASES || zeros==0) {
- phase=0;
- } else if (zeros==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=ph+1;
- } else if (ones==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=-(ph+1);
- } else {
- phase=0;
- EEPROMWarnings += ::QObject::tr("Flight modes settings on mixers not exported") + "\n";
- }
- sOffset = c9x.sOffset;
- }
- else {
- memset(this, 0, sizeof(t_Open9xArmMixData_v208));
- }
-}
-
t_Open9xArmMixData_v208::operator MixData ()
{
MixData c9x;
@@ -646,9 +275,15 @@ t_Open9xArmMixData_v208::operator MixData ()
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-10-9-O9X_ARM_NUM_CSW-NUM_CYC-NUM_PPM);
}
c9x.weight = weight;
- c9x.differential = differential*2;
c9x.swtch = open9xArmToSwitch(swtch);
- c9x.curve = curve;
+
+ if (differential) {
+ c9x.curve = CurveReference(CurveReference::CURVE_REF_DIFF, differential*2);
+ }
+ else {
+ // TODO c9x.curve = curve;
+ }
+
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
c9x.speedUp = speedUp;
@@ -656,109 +291,23 @@ t_Open9xArmMixData_v208::operator MixData ()
c9x.carryTrim = carryTrim;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
-// c9x.phase = phase;
+
if (phase<0) {
c9x.phases= 1 << (-phase -1);
- } else if (phase==0) {
+ }
+ else if (phase==0) {
c9x.phases=0;
- } else {
+ }
+ else {
c9x.phases=511;
c9x.phases &= ~(1 << (phase -1));
- }
+ }
+
c9x.sOffset = sOffset;
}
return c9x;
}
-t_Open9xArmMixData_v209::t_Open9xArmMixData_v209(MixData &c9x)
-{
- if (c9x.destCh) {
- destCh = c9x.destCh-1;
- mixWarn = c9x.mixWarn;
- swtch = open9xArmFromSwitch(c9x.swtch);
- if (c9x.srcRaw.type == SOURCE_TYPE_NONE) {
- srcRaw = 0;
- swtch = 0;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_STICK) {
- srcRaw = 1 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_MAX) {
- srcRaw = 8;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_TRIM) {
- srcRaw = 9 + c9x.srcRaw.index;
- }
- /* else if (c9x.srcRaw.type == SOURCE_TYPE_3POS) {
- srcRaw = 13;
- } */
- else if (c9x.srcRaw.type == SOURCE_TYPE_SWITCH) {
- srcRaw = 13 + open9xArmFromSwitch(RawSwitch(c9x.srcRaw.index));
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CYC) {
- srcRaw = 14+9+O9X_ARM_NUM_CSW + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_PPM) {
- srcRaw = 14+9+O9X_ARM_NUM_CSW+NUM_CYC + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CH) {
- srcRaw = 14+9+O9X_ARM_NUM_CSW+NUM_CYC+NUM_PPM + c9x.srcRaw.index;
- }
- weight = c9x.weight;
- differential = c9x.differential/2;
- curve = c9x.curve;
- delayUp = c9x.delayUp;
- delayDown = c9x.delayDown;
- speedUp = c9x.speedUp;
- speedDown = c9x.speedDown;
- carryTrim = c9x.carryTrim;
- mltpx = (MltpxValue)c9x.mltpx;
- int zeros=0;
- int ones=0;
- int phtemp=c9x.phases;
- for (int i=0; i>=1;
- }
- if (zeros==O9X_ARM_MAX_PHASES || zeros==0) {
- phase=0;
- } else if (zeros==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=ph+1;
- } else if (ones==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=-(ph+1);
- } else {
- phase=0;
- EEPROMWarnings += ::QObject::tr("Flight modes settings on mixers not exported") + "\n";
- }
- sOffset = c9x.sOffset;
- }
- else {
- memset(this, 0, sizeof(t_Open9xArmMixData_v209));
- }
-}
-
t_Open9xArmMixData_v209::operator MixData ()
{
MixData c9x;
@@ -792,9 +341,15 @@ t_Open9xArmMixData_v209::operator MixData ()
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-14-9-O9X_ARM_NUM_CSW-NUM_CYC-NUM_PPM);
}
c9x.weight = weight;
- c9x.differential = differential*2;
+
+ if (differential) {
+ c9x.curve = CurveReference(CurveReference::CURVE_REF_DIFF, differential*2);
+ }
+ else {
+ // TODO c9x.curve = curve;
+ }
+
c9x.swtch = open9xArmToSwitch(swtch);
- c9x.curve = curve;
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
c9x.speedUp = speedUp;
@@ -802,110 +357,23 @@ t_Open9xArmMixData_v209::operator MixData ()
c9x.carryTrim = carryTrim;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
- // c9x.phase = phase;
+
if (phase<0) {
c9x.phases= 1 << (-phase -1);
- } else if (phase==0) {
+ }
+ else if (phase==0) {
c9x.phases=0;
- } else {
+ }
+ else {
c9x.phases=511;
c9x.phases &= ~(1 << (phase -1));
- }
+ }
+
c9x.sOffset = sOffset;
}
return c9x;
}
-t_Open9xArmMixData_v210::t_Open9xArmMixData_v210(MixData &c9x)
-{
- if (c9x.destCh) {
- destCh = c9x.destCh-1;
- mixWarn = c9x.mixWarn;
- swtch = open9xArmFromSwitch(c9x.swtch);
- if (c9x.srcRaw.type == SOURCE_TYPE_NONE) {
- srcRaw = 0;
- swtch = 0;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_STICK) {
- srcRaw = 1 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_TRIM) {
- srcRaw = 8 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_MAX) {
- srcRaw = 12;
- }
- /* else if (c9x.srcRaw.type == SOURCE_TYPE_3POS) {
- srcRaw = 13;
- } */
- else if (c9x.srcRaw.type == SOURCE_TYPE_SWITCH) {
- srcRaw = 13 + open9xArmFromSwitch(RawSwitch(c9x.srcRaw.index));
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CYC) {
- srcRaw = 14+9+O9X_ARM_NUM_CSW + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_PPM) {
- srcRaw = 14+9+O9X_ARM_NUM_CSW+NUM_CYC + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CH) {
- srcRaw = 14+9+O9X_ARM_NUM_CSW+NUM_CYC+NUM_PPM + c9x.srcRaw.index;
- }
- weight = c9x.weight;
- differential = c9x.differential/2;
- curve = c9x.curve;
- delayUp = c9x.delayUp;
- delayDown = c9x.delayDown;
- speedUp = c9x.speedUp;
- speedDown = c9x.speedDown;
- carryTrim = c9x.carryTrim;
- mltpx = (MltpxValue)c9x.mltpx;
- int zeros=0;
- int ones=0;
- int phtemp=c9x.phases;
- for (int i=0; i>=1;
- }
- if (zeros==O9X_ARM_MAX_PHASES || zeros==0) {
- phase=0;
- } else if (zeros==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=ph+1;
- } else if (ones==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=-(ph+1);
- } else {
- phase=0;
- EEPROMWarnings += ::QObject::tr("Flight modes settings on mixers not exported") + "\n";
- }
- sOffset = c9x.sOffset;
- setEEPROMZString(name, c9x.name, sizeof(name));
- }
- else {
- memset(this, 0, sizeof(t_Open9xArmMixData_v210));
- }
-}
-
t_Open9xArmMixData_v210::operator MixData ()
{
MixData c9x;
@@ -939,9 +407,15 @@ t_Open9xArmMixData_v210::operator MixData ()
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-14-9-O9X_ARM_NUM_CSW-NUM_CYC-NUM_PPM);
}
c9x.weight = weight;
- c9x.differential = differential*2;
+
+ if (differential) {
+ c9x.curve = CurveReference(CurveReference::CURVE_REF_DIFF, differential*2);
+ }
+ else {
+ // TODO c9x.curve = curve;
+ }
+
c9x.swtch = open9xArmToSwitch(swtch);
- c9x.curve = curve;
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
c9x.speedUp = speedUp;
@@ -949,82 +423,24 @@ t_Open9xArmMixData_v210::operator MixData ()
c9x.carryTrim = carryTrim;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
- // c9x.phase = phase;
+
if (phase<0) {
c9x.phases= 1 << (-phase -1);
- } else if (phase==0) {
+ }
+ else if (phase==0) {
c9x.phases=0;
- } else {
+ }
+ else {
c9x.phases=511;
c9x.phases &= ~(1 << (phase -1));
}
+
c9x.sOffset = sOffset;
getEEPROMZString(c9x.name, name, sizeof(name));
}
return c9x;
}
-t_Open9xArmMixData_v212::t_Open9xArmMixData_v212(MixData &c9x)
-{
- if (c9x.destCh) {
- destCh = c9x.destCh-1;
- mixWarn = c9x.mixWarn;
- swtch = open9xArmFromSwitch(c9x.swtch);
- if (c9x.srcRaw.type == SOURCE_TYPE_NONE) {
- srcRaw = 0;
- swtch = 0;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_STICK) {
- srcRaw = 1 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_ROTARY_ENCODER) {
- srcRaw = 8;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_TRIM) {
- srcRaw = 9 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_MAX) {
- srcRaw = 13;
- }
- /* else if (c9x.srcRaw.type == SOURCE_TYPE_3POS) {
- srcRaw = 14;
- } */
- else if (c9x.srcRaw.type == SOURCE_TYPE_SWITCH) {
- srcRaw = 14 + open9xArmFromSwitch(RawSwitch(c9x.srcRaw.index));
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CYC) {
- srcRaw = 15+9+O9X_ARM_NUM_CSW + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_PPM) {
- srcRaw = 15+9+O9X_ARM_NUM_CSW+NUM_CYC + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CH) {
- srcRaw = 15+9+O9X_ARM_NUM_CSW+NUM_CYC+NUM_PPM + c9x.srcRaw.index;
- }
- weight = c9x.weight;
- if (c9x.curve==0) {
- curveMode=0;
- curveParam=c9x.differential;
- } else {
- curveMode=1;
- curveParam = c9x.curve;
- }
- delayUp = c9x.delayUp;
- delayDown = c9x.delayDown;
- speedUp = c9x.speedUp;
- speedDown = c9x.speedDown;
- carryTrim = c9x.carryTrim;
- noExpo = c9x.noExpo;
- mltpx = (MltpxValue)c9x.mltpx;
- phases = c9x.phases;
- sOffset = c9x.sOffset;
- setEEPROMZString(name, c9x.name, sizeof(name));
- }
- else {
- memset(this, 0, sizeof(t_Open9xArmMixData_v210));
- }
-}
-
t_Open9xArmMixData_v212::operator MixData ()
{
MixData c9x;
@@ -1061,12 +477,14 @@ t_Open9xArmMixData_v212::operator MixData ()
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-15-9-O9X_ARM_NUM_CSW-NUM_CYC-NUM_PPM);
}
c9x.weight = weight;
+
if (curveMode==0) {
- c9x.differential = curveParam;
- c9x.curve=0;
- } else {
- c9x.curve=curveParam;
- }
+ c9x.curve = CurveReference(CurveReference::CURVE_REF_DIFF, curveParam);
+ }
+ else {
+ // TODO
+ }
+
c9x.swtch = open9xArmToSwitch(swtch);
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
@@ -1083,33 +501,6 @@ t_Open9xArmMixData_v212::operator MixData ()
return c9x;
}
-t_Open9xArmCustomSwData_v208::t_Open9xArmCustomSwData_v208(CustomSwData &c9x)
-{
- func = c9x.func;
- v1 = c9x.val1;
- v2 = c9x.val2;
-
- if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
- v1 = open9xArm208FromSource(RawSource(c9x.val1));
- }
-
- if (c9x.func >= CS_FN_EQUAL) {
- v2 = open9xArm208FromSource(RawSource(c9x.val2));
- }
-
- if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
- v1 = open9xArmFromSwitch(RawSwitch(c9x.val1));
- v2 = open9xArmFromSwitch(RawSwitch(c9x.val2));
- }
-
- if (func>O9X_ARM_MAX_CSFUNCOLD ) {
- EEPROMWarnings += ::QObject::tr("This version of open9x does not support Custom Switch function %1").arg(getFuncName(func)) + "\n";
- func=0;
- v1=0;
- v2=0;
- }
-}
-
t_Open9xArmCustomSwData_v208::operator CustomSwData ()
{
CustomSwData c9x;
@@ -1133,33 +524,6 @@ t_Open9xArmCustomSwData_v208::operator CustomSwData ()
return c9x;
}
-t_Open9xArmCustomSwData_v209::t_Open9xArmCustomSwData_v209(CustomSwData &c9x)
-{
- func = c9x.func;
- v1 = c9x.val1;
- v2 = c9x.val2;
-
- if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
- v1 = open9xArm209FromSource(RawSource(c9x.val1));
- }
-
- if (c9x.func >= CS_FN_EQUAL) {
- v2 = open9xArm209FromSource(RawSource(c9x.val2));
- }
-
- if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
- v1 = open9xArmFromSwitch(RawSwitch(c9x.val1));
- v2 = open9xArmFromSwitch(RawSwitch(c9x.val2));
- }
-
- if (func>O9X_ARM_MAX_CSFUNCOLD ) {
- EEPROMWarnings += ::QObject::tr("This version of open9x does not support Custom Switch function %1").arg(getFuncName(func)) + "\n";
- func=0;
- v1=0;
- v2=0;
- }
-}
-
t_Open9xArmCustomSwData_v209::operator CustomSwData ()
{
CustomSwData c9x;
@@ -1183,28 +547,6 @@ t_Open9xArmCustomSwData_v209::operator CustomSwData ()
return c9x;
}
-t_Open9xArmCustomSwData_v210::t_Open9xArmCustomSwData_v210(CustomSwData &c9x)
-{
- func = c9x.func;
- v1 = c9x.val1;
- v2 = c9x.val2;
-
- delay = c9x.delay;
- duration = c9x.duration;
- if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
- v1 = open9xArm210FromSource(RawSource(c9x.val1));
- }
-
- if (c9x.func >= CS_FN_EQUAL && c9x.func <= CS_FN_ELESS) {
- v2 = open9xArm210FromSource(RawSource(c9x.val2));
- }
-
- if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
- v1 = open9xArmFromSwitch(RawSwitch(c9x.val1));
- v2 = open9xArmFromSwitch(RawSwitch(c9x.val2));
- }
-}
-
t_Open9xArmCustomSwData_v210::operator CustomSwData ()
{
CustomSwData c9x;
@@ -1230,21 +572,6 @@ t_Open9xArmCustomSwData_v210::operator CustomSwData ()
return c9x;
}
-t_Open9xArmFuncSwData_v208::t_Open9xArmFuncSwData_v208(FuncSwData &c9x)
-{
- swtch = open9xArmFromSwitch(c9x.swtch);
- if (c9x.func <= FuncSafetyCh16) {
- param = ((c9x.param>>1)<<1);
- param |=(c9x.enabled & 0x01);
- } else {
- param = c9x.param;
- if ((c9x.func == FuncPlayValue || c9x.func == FuncVolume) && param > 7) {
- param -= -2;
- }
- }
- func = c9x.func;
-}
-
t_Open9xArmFuncSwData_v208::operator FuncSwData ()
{
FuncSwData c9x;
@@ -1263,29 +590,6 @@ t_Open9xArmFuncSwData_v208::operator FuncSwData ()
return c9x;
}
-t_Open9xArmFuncSwData_v210::t_Open9xArmFuncSwData_v210(FuncSwData &c9x)
-{
- swtch = open9xArmFromSwitch(c9x.swtch);
- uint32_t value;
- if (c9x.func <= FuncInstantTrim) {
- value = ((c9x.param>>1)<<1);
- value |=(c9x.enabled & 0x01);
- }
- else {
- if (c9x.func == FuncPlayPrompt || c9x.func == FuncBackgroundMusic) {
- memcpy(param, c9x.paramarm, sizeof(param));
- }
- else {
- value = c9x.param;
- if ((c9x.func == FuncPlayValue || c9x.func == FuncVolume) && value > 7) {
- value-=2;
- }
- *((uint32_t *)param) = value;
- }
- }
- func = c9x.func;
-}
-
t_Open9xArmFuncSwData_v210::operator FuncSwData ()
{
FuncSwData c9x;
@@ -1310,30 +614,6 @@ t_Open9xArmFuncSwData_v210::operator FuncSwData ()
return c9x;
}
-t_Open9xArmFuncSwData_v211::t_Open9xArmFuncSwData_v211(FuncSwData &c9x)
-{
- swtch = open9xArmFromSwitch(c9x.swtch);
- uint32_t value;
- if (c9x.func <= FuncInstantTrim) {
- value = c9x.param;
- *((uint32_t *)param) = value;
- delay=(c9x.enabled & 0x01);
- }
- else {
- if (c9x.func == FuncPlayPrompt || c9x.func == FuncBackgroundMusic) {
- memcpy(param, c9x.paramarm, sizeof(param));
- }
- else {
- value = c9x.param;
- if ((c9x.func == FuncPlayValue || c9x.func == FuncVolume || (c9x.func >= FuncAdjustGV1 && c9x.func <= FuncAdjustGV5)) && value > 7) {
- value--;
- }
- *((uint32_t *)param) = value;
- }
- }
- func = c9x.func;
-}
-
t_Open9xArmFuncSwData_v211::operator FuncSwData ()
{
FuncSwData c9x;
@@ -1350,7 +630,7 @@ t_Open9xArmFuncSwData_v211::operator FuncSwData ()
}
else {
c9x.param = value;
- if ((c9x.func == FuncPlayValue || c9x.func == FuncVolume || (c9x.func >= FuncAdjustGV1 && c9x.func <= FuncAdjustGV5)) && value > 7) {
+ if ((c9x.func == FuncPlayValue || c9x.func == FuncVolume || (c9x.func >= FuncAdjustGV1 && c9x.func <= FuncAdjustGVLast)) && value > 7) {
c9x.param++;
}
}
@@ -1358,16 +638,6 @@ t_Open9xArmFuncSwData_v211::operator FuncSwData ()
return c9x;
}
-t_Open9xArmSwashRingData_v208::t_Open9xArmSwashRingData_v208(SwashRingData &c9x)
-{
- invertELE = c9x.invertELE;
- invertAIL = c9x.invertAIL;
- invertCOL = c9x.invertCOL;
- type = c9x.type;
- collectiveSource = open9xArm208FromSource(c9x.collectiveSource);
- value = c9x.value;
-}
-
t_Open9xArmSwashRingData_v208::operator SwashRingData ()
{
SwashRingData c9x;
@@ -1380,16 +650,6 @@ t_Open9xArmSwashRingData_v208::operator SwashRingData ()
return c9x;
}
-t_Open9xArmSwashRingData_v209::t_Open9xArmSwashRingData_v209(SwashRingData &c9x)
-{
- invertELE = c9x.invertELE;
- invertAIL = c9x.invertAIL;
- invertCOL = c9x.invertCOL;
- type = c9x.type;
- collectiveSource = open9xArm209FromSource(c9x.collectiveSource);
- value = c9x.value;
-}
-
t_Open9xArmSwashRingData_v209::operator SwashRingData ()
{
SwashRingData c9x;
@@ -1402,16 +662,6 @@ t_Open9xArmSwashRingData_v209::operator SwashRingData ()
return c9x;
}
-t_Open9xArmSwashRingData_v210::t_Open9xArmSwashRingData_v210(SwashRingData &c9x)
-{
- invertELE = c9x.invertELE;
- invertAIL = c9x.invertAIL;
- invertCOL = c9x.invertCOL;
- type = c9x.type;
- collectiveSource = open9xArm210FromSource(c9x.collectiveSource);
- value = c9x.value;
-}
-
t_Open9xArmSwashRingData_v210::operator SwashRingData ()
{
SwashRingData c9x;
@@ -1452,31 +702,6 @@ t_Open9xArmFrSkyData_v210::operator FrSkyData ()
return c9x;
}
-t_Open9xArmFrSkyData_v210::t_Open9xArmFrSkyData_v210(FrSkyData &c9x)
-{
- memset(this, 0, sizeof(t_Open9xArmFrSkyData_v210));
- channels[0] = c9x.channels[0];
- channels[1] = c9x.channels[1];
- usrProto = c9x.usrProto;
- voltsSource = c9x.voltsSource;
- blades = c9x.blades;
- currentSource=c9x.currentSource;
- for (int i=0; i<4; i++) {
- bars[i].source = c9x.screens[0].body.bars[i].source;
- bars[i].barMin = c9x.screens[0].body.bars[i].barMin;
- bars[i].barMax = c9x.screens[0].body.bars[i].barMax;
- }
- for (int line=0; line<4; line++) {
- for (int col=0; col<2; col++) {
- int i=line*2+col;
- lines[i]=c9x.screens[1].body.lines[line].source[col];
- }
- }
- rssiAlarms[0] = Open9xFrSkyRSSIAlarm(0, c9x.rssiAlarms[0]);
- rssiAlarms[1] = Open9xFrSkyRSSIAlarm(1, c9x.rssiAlarms[1]);
-}
-
-
t_Open9xArmFrSkyData_v211::operator FrSkyData ()
{
FrSkyData c9x;
@@ -1509,33 +734,6 @@ t_Open9xArmFrSkyData_v211::operator FrSkyData ()
return c9x;
}
-t_Open9xArmFrSkyData_v211::t_Open9xArmFrSkyData_v211(FrSkyData &c9x)
-{
- memset(this, 0, sizeof(t_Open9xArmFrSkyData_v211));
- channels[0] = c9x.channels[0];
- channels[1] = c9x.channels[1];
- usrProto = c9x.usrProto;
- voltsSource = c9x.voltsSource;
- blades = c9x.blades;
- currentSource=c9x.currentSource;
- for (int i=0; i<4; i++) {
- bars[i].source = c9x.screens[0].body.bars[i].source;
- bars[i].barMin = c9x.screens[0].body.bars[i].barMin;
- bars[i].barMax = c9x.screens[0].body.bars[i].barMax;
- }
- for (int line=0; line<4; line++) {
- for (int col=0; col<2; col++) {
- int i=line*2+col;
- lines[i]=c9x.screens[1].body.lines[line].source[col];
- }
- }
- rssiAlarms[0] = Open9xFrSkyRSSIAlarm(0, c9x.rssiAlarms[0]);
- rssiAlarms[1] = Open9xFrSkyRSSIAlarm(1, c9x.rssiAlarms[1]);
- varioSource = c9x.varioSource;
- varioSpeedUpMin = c9x.varioCenterMax;
- varioSpeedDownMin = c9x.varioCenterMin;
-}
-
t_Open9xArmModelData_v208::operator ModelData ()
{
ModelData c9x;
@@ -1587,7 +785,6 @@ t_Open9xArmModelData_v208::operator ModelData ()
for (int i=0; i= 0) {
- phase.trim[j] = 501 + phase.trimRef[j] - (phase.trimRef[j] >= i ? 1 : 0);
- }
- else {
- phase.trim[j] = std::max(-500, std::min(500, phase.trim[j]));
- }
- }
- phaseData[i] = phase;
- }
- frsky = c9x.frsky;
- varioSource = c9x.frsky.varioSource;
- varioSpeedUpMin = c9x.frsky.varioCenterMax;
- varioSpeedDownMin = c9x.frsky.varioCenterMin;
-
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- thrTraceSrc = c9x.thrTraceSrc;
- modelId = c9x.modelId;
- frskyLinesXtra=0;
- for (int j=0; j<4; j++) {
- frskyLines[j] = 0;
- for (int k=0; k<2; k++) {
- int value = c9x.frsky.screens[1].body.lines[j].source[k];
- frskyLines[j] |= (k==0 ? (value & 0x0f) : ((value & 0x0f) << 4));
- frskyLinesXtra |= (value / 16) << (4*j+2*k);
- }
- }
- for (int i=0; i= 0) {
- phase.trim[j] = 501 + phase.trimRef[j] - (phase.trimRef[j] >= i ? 1 : 0);
- }
- else {
- phase.trim[j] = std::max(-500, std::min(500, phase.trim[j]));
- }
- }
- phaseData[i] = phase;
- }
- frsky = c9x.frsky;
- varioSource = c9x.frsky.varioSource;
- varioSpeedUpMin = c9x.frsky.varioCenterMax;
- varioSpeedDownMin = c9x.frsky.varioCenterMin;
- switchWarningStates = c9x.switchWarningStates;
-
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- thrTraceSrc = c9x.thrTraceSrc;
- modelId = c9x.modelId;
- frskyLinesXtra=0;
- for (int j=0; j<4; j++) {
- frskyLines[j] = 0;
- for (int k=0; k<2; k++) {
- int value = c9x.frsky.screens[1].body.lines[j].source[k];
- frskyLines[j] |= (k==0 ? (value & 0x0f) : ((value & 0x0f) << 4));
- frskyLinesXtra |= (value / 16) << (4*j+2*k);
- }
- }
- for (int i=0; i= 0) {
- phase.trim[j] = 501 + phase.trimRef[j] - (phase.trimRef[j] >= i ? 1 : 0);
- }
- else {
- phase.trim[j] = std::max(-500, std::min(500, phase.trim[j]));
- }
- }
- phaseData[i] = phase;
- }
- frsky = c9x.frsky;
- varioSource = c9x.frsky.varioSource;
- varioSpeedUpMin = c9x.frsky.varioCenterMax;
- varioSpeedDownMin = c9x.frsky.varioCenterMin;
- switchWarningStates = c9x.switchWarningStates;
-
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- thrTraceSrc = c9x.thrTraceSrc;
- modelId = c9x.modelId;
-
- for (int i=0; i O9X_ARM_NUM_POINTS - 5 * O9X_ARM_MAX_CURVES) {
- EEPROMWarnings += ::QObject::tr("open9x only accepts %1 points in all curves").arg(O9X_ARM_NUM_POINTS) + "\n";
- break;
- }
- curves[i] = offset;
- for (int j=0; j= 0) {
- phase.trim[j] = 501 + phase.trimRef[j] - (phase.trimRef[j] >= i ? 1 : 0);
- }
- else {
- phase.trim[j] = std::max(-500, std::min(500, phase.trim[j]));
- }
- }
- phaseData[i] = phase;
- }
- frsky = c9x.frsky;
- switchWarningStates = c9x.switchWarningStates;
-
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- thrTraceSrc = c9x.thrTraceSrc;
- modelId = c9x.modelId;
-
- for (int i=0; i O9X_ARM_NUM_POINTS - 5 * O9X_ARM_MAX_CURVES) {
- EEPROMWarnings += ::QObject::tr("open9x only accepts %1 points in all curves").arg(O9X_ARM_NUM_POINTS) + "\n";
- break;
- }
- curves[i] = offset;
- for (int j=0; j= 0) {
- phase.trim[j] = 501 + phase.trimRef[j] - (phase.trimRef[j] >= i ? 1 : 0);
- }
- else {
- phase.trim[j] = std::max(-500, std::min(500, phase.trim[j]));
- }
- }
- phaseData[i] = phase;
- }
- frsky = c9x.frsky;
- switchWarningStates = c9x.switchWarningStates;
-
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- thrTraceSrc = c9x.thrTraceSrc;
- modelId = c9x.modelId;
- }
-}
diff --git a/companion/src/firmwares/opentx/open9xSky9xeeprom.h b/companion/src/firmwares/opentx/open9xSky9xeeprom.h
index 1c28d6d18..b313169b8 100644
--- a/companion/src/firmwares/opentx/open9xSky9xeeprom.h
+++ b/companion/src/firmwares/opentx/open9xSky9xeeprom.h
@@ -36,7 +36,6 @@ PACK(typedef struct t_Open9xArmTimerData_v202 {
operator TimerData();
t_Open9xArmTimerData_v202() { memset(this, 0, sizeof(t_Open9xArmTimerData_v202)); }
- t_Open9xArmTimerData_v202(TimerData &eepe);
}) Open9xArmTimerData_v202;
PACK(typedef struct t_Open9xArmExpoData_v208 {
@@ -50,8 +49,6 @@ PACK(typedef struct t_Open9xArmExpoData_v208 {
operator ExpoData();
t_Open9xArmExpoData_v208() { memset(this, 0, sizeof(t_Open9xArmExpoData_v208)); }
- t_Open9xArmExpoData_v208(ExpoData&);
-
}) Open9xArmExpoData_v208;
PACK(typedef struct t_Open9xArmExpoData_v210 {
@@ -67,8 +64,6 @@ PACK(typedef struct t_Open9xArmExpoData_v210 {
operator ExpoData();
t_Open9xArmExpoData_v210() { memset(this, 0, sizeof(t_Open9xArmExpoData_v210)); }
- t_Open9xArmExpoData_v210(ExpoData&);
-
}) Open9xArmExpoData_v210;
PACK(typedef struct t_Open9xArmExpoData_v212 {
@@ -83,8 +78,6 @@ PACK(typedef struct t_Open9xArmExpoData_v212 {
operator ExpoData();
t_Open9xArmExpoData_v212() { memset(this, 0, sizeof(t_Open9xArmExpoData_v212)); }
- t_Open9xArmExpoData_v212(ExpoData&);
-
}) Open9xArmExpoData_v212;
PACK(typedef struct t_Open9xArmMixData_v208 {
@@ -106,8 +99,6 @@ PACK(typedef struct t_Open9xArmMixData_v208 {
operator MixData();
t_Open9xArmMixData_v208() { memset(this, 0, sizeof(t_Open9xArmMixData_v208)); }
- t_Open9xArmMixData_v208(MixData&);
-
}) Open9xArmMixData_v208;
PACK(typedef struct t_Open9xArmMixData_v209 {
@@ -129,8 +120,6 @@ PACK(typedef struct t_Open9xArmMixData_v209 {
operator MixData();
t_Open9xArmMixData_v209() { memset(this, 0, sizeof(t_Open9xArmMixData_v209)); }
- t_Open9xArmMixData_v209(MixData&);
-
}) Open9xArmMixData_v209;
PACK(typedef struct t_Open9xArmMixData_v210 {
@@ -154,8 +143,6 @@ PACK(typedef struct t_Open9xArmMixData_v210 {
operator MixData();
t_Open9xArmMixData_v210() { memset(this, 0, sizeof(t_Open9xArmMixData_v210)); }
- t_Open9xArmMixData_v210(MixData&);
-
}) Open9xArmMixData_v210;
PACK(typedef struct t_Open9xArmMixData_v212 {
@@ -180,8 +167,6 @@ PACK(typedef struct t_Open9xArmMixData_v212 {
operator MixData();
t_Open9xArmMixData_v212() { memset(this, 0, sizeof(t_Open9xArmMixData_v212)); }
- t_Open9xArmMixData_v212(MixData&);
-
}) Open9xArmMixData_v212;
PACK(typedef struct t_Open9xArmPhaseData_v208 {
@@ -192,7 +177,6 @@ PACK(typedef struct t_Open9xArmPhaseData_v208 {
uint8_t fadeOut:4;
operator PhaseData();
t_Open9xArmPhaseData_v208() { memset(this, 0, sizeof(t_Open9xArmPhaseData_v208)); }
- t_Open9xArmPhaseData_v208(PhaseData &eepe);
}) Open9xArmPhaseData_v208;
PACK(typedef struct t_Open9xArmPhaseData_v212 {
@@ -204,7 +188,6 @@ PACK(typedef struct t_Open9xArmPhaseData_v212 {
int16_t rotaryEncoders[1];
operator PhaseData();
t_Open9xArmPhaseData_v212() { memset(this, 0, sizeof(t_Open9xArmPhaseData_v212)); }
- t_Open9xArmPhaseData_v212(PhaseData &eepe);
}) Open9xArmPhaseData_v212;
PACK(typedef struct t_Open9xArmCustomSwData_v208 { // Custom Switches data
@@ -214,7 +197,6 @@ PACK(typedef struct t_Open9xArmCustomSwData_v208 { // Custom Switches data
operator CustomSwData();
t_Open9xArmCustomSwData_v208() { memset(this, 0, sizeof(t_Open9xArmCustomSwData_v208)); }
- t_Open9xArmCustomSwData_v208(CustomSwData&);
}) Open9xArmCustomSwData_v208;
PACK(typedef struct t_Open9xArmCustomSwData_v209 { // Custom Switches data
@@ -224,7 +206,6 @@ PACK(typedef struct t_Open9xArmCustomSwData_v209 { // Custom Switches data
operator CustomSwData();
t_Open9xArmCustomSwData_v209() { memset(this, 0, sizeof(t_Open9xArmCustomSwData_v209)); }
- t_Open9xArmCustomSwData_v209(CustomSwData&);
}) Open9xArmCustomSwData_v209;
PACK(typedef struct t_Open9xArmCustomSwData_v210 { // Custom Switches data
@@ -236,7 +217,6 @@ PACK(typedef struct t_Open9xArmCustomSwData_v210 { // Custom Switches data
operator CustomSwData();
t_Open9xArmCustomSwData_v210() { memset(this, 0, sizeof(t_Open9xArmCustomSwData_v210)); }
- t_Open9xArmCustomSwData_v210(CustomSwData&);
}) Open9xArmCustomSwData_v210;
PACK(typedef struct t_Open9xArmFuncSwData_v208 { // Function Switches data
@@ -246,8 +226,6 @@ PACK(typedef struct t_Open9xArmFuncSwData_v208 { // Function Switches data
operator FuncSwData();
t_Open9xArmFuncSwData_v208() { memset(this, 0, sizeof(t_Open9xArmFuncSwData_v208)); }
- t_Open9xArmFuncSwData_v208(FuncSwData&);
-
}) Open9xArmFuncSwData_v208;
PACK(typedef struct t_Open9xArmFuncSwData_v210 { // Function Switches data
@@ -257,8 +235,6 @@ PACK(typedef struct t_Open9xArmFuncSwData_v210 { // Function Switches data
operator FuncSwData();
t_Open9xArmFuncSwData_v210() { memset(this, 0, sizeof(t_Open9xArmFuncSwData_v210)); }
- t_Open9xArmFuncSwData_v210(FuncSwData&);
-
}) Open9xArmFuncSwData_v210;
PACK(typedef struct t_Open9xArmFuncSwData_v211 { // Function Switches data
@@ -270,8 +246,6 @@ PACK(typedef struct t_Open9xArmFuncSwData_v211 { // Function Switches data
operator FuncSwData();
t_Open9xArmFuncSwData_v211() { memset(this, 0, sizeof(t_Open9xArmFuncSwData_v211)); }
- t_Open9xArmFuncSwData_v211(FuncSwData&);
-
}) Open9xArmFuncSwData_v211;
PACK(typedef struct t_Open9xArmSwashRingData_v208 { // Swash Ring data
@@ -284,8 +258,6 @@ PACK(typedef struct t_Open9xArmSwashRingData_v208 { // Swash Ring data
operator SwashRingData();
t_Open9xArmSwashRingData_v208() { memset(this, 0, sizeof(t_Open9xArmSwashRingData_v208)); }
- t_Open9xArmSwashRingData_v208(SwashRingData&);
-
}) Open9xArmSwashRingData_v208;
PACK(typedef struct t_Open9xArmSwashRingData_v209 { // Swash Ring data
@@ -298,8 +270,6 @@ PACK(typedef struct t_Open9xArmSwashRingData_v209 { // Swash Ring data
operator SwashRingData();
t_Open9xArmSwashRingData_v209() { memset(this, 0, sizeof(t_Open9xArmSwashRingData_v209)); }
- t_Open9xArmSwashRingData_v209(SwashRingData&);
-
}) Open9xArmSwashRingData_v209;
PACK(typedef struct t_Open9xArmSwashRingData_v210 { // Swash Ring data
@@ -312,8 +282,6 @@ PACK(typedef struct t_Open9xArmSwashRingData_v210 { // Swash Ring data
operator SwashRingData();
t_Open9xArmSwashRingData_v210() { memset(this, 0, sizeof(t_Open9xArmSwashRingData_v210)); }
- t_Open9xArmSwashRingData_v210(SwashRingData&);
-
}) Open9xArmSwashRingData_v210;
@@ -336,7 +304,6 @@ PACK(typedef struct t_Open9xArmFrSkyData_v210 {
operator FrSkyData();
t_Open9xArmFrSkyData_v210() { memset(this, 0, sizeof(t_Open9xArmFrSkyData_v210)); }
- t_Open9xArmFrSkyData_v210(FrSkyData&);
}) Open9xArmFrSkyData_v210;
PACK(typedef struct t_Open9xArmFrSkyData_v211 {
@@ -355,7 +322,6 @@ PACK(typedef struct t_Open9xArmFrSkyData_v211 {
operator FrSkyData();
t_Open9xArmFrSkyData_v211() { memset(this, 0, sizeof(t_Open9xArmFrSkyData_v211)); }
- t_Open9xArmFrSkyData_v211(FrSkyData&);
}) Open9xArmFrSkyData_v211;
PACK(typedef struct t_Open9xArmModelData_v208 {
@@ -395,8 +361,6 @@ PACK(typedef struct t_Open9xArmModelData_v208 {
operator ModelData();
t_Open9xArmModelData_v208() { memset(this, 0, sizeof(t_Open9xArmModelData_v208)); }
- t_Open9xArmModelData_v208(ModelData&);
-
}) Open9xArmModelData_v208;
PACK(typedef struct t_Open9xArmModelData_v209 {
@@ -437,8 +401,6 @@ PACK(typedef struct t_Open9xArmModelData_v209 {
operator ModelData();
t_Open9xArmModelData_v209() { memset(this, 0, sizeof(t_Open9xArmModelData_v209)); }
- t_Open9xArmModelData_v209(ModelData&);
-
}) Open9xArmModelData_v209;
PACK(typedef struct t_Open9xArmModelData_v210 {
@@ -477,7 +439,6 @@ PACK(typedef struct t_Open9xArmModelData_v210 {
operator ModelData();
t_Open9xArmModelData_v210() { memset(this, 0, sizeof(t_Open9xArmModelData_v210)); }
- t_Open9xArmModelData_v210(ModelData&);
}) Open9xArmModelData_v210;
@@ -517,8 +478,6 @@ PACK(typedef struct t_Open9xArmModelData_v211 {
operator ModelData();
t_Open9xArmModelData_v211() { memset(this, 0, sizeof(t_Open9xArmModelData_v211)); }
- t_Open9xArmModelData_v211(ModelData&);
-
}) Open9xArmModelData_v211;
PACK(typedef struct t_Open9xArmModelData_v212 {
@@ -555,8 +514,6 @@ PACK(typedef struct t_Open9xArmModelData_v212 {
operator ModelData();
t_Open9xArmModelData_v212() { memset(this, 0, sizeof(t_Open9xArmModelData_v212)); }
- t_Open9xArmModelData_v212(ModelData&);
-
}) Open9xArmModelData_v212;
#endif
diff --git a/companion/src/firmwares/opentx/open9xStockeeprom.cpp b/companion/src/firmwares/opentx/open9xStockeeprom.cpp
index 274e91be9..0fc602e04 100644
--- a/companion/src/firmwares/opentx/open9xStockeeprom.cpp
+++ b/companion/src/firmwares/opentx/open9xStockeeprom.cpp
@@ -62,28 +62,6 @@ void getEEPROMZString(char *dst, const char *src, int size)
}
}
-int8_t open9xStockFromSwitch(const RawSwitch & sw)
-{
- switch (sw.type) {
- case SWITCH_TYPE_SWITCH:
- return sw.index;
- case SWITCH_TYPE_VIRTUAL:
- return sw.index > 0 ? (9 + sw.index) : (-9 + sw.index);
- case SWITCH_TYPE_ON:
- return 22;
- case SWITCH_TYPE_OFF:
- return -22;
- case SWITCH_TYPE_MOMENT_SWITCH:
- return sw.index > 0 ? (22 + sw.index) : (-22 + sw.index);
- case SWITCH_TYPE_MOMENT_VIRTUAL:
- return sw.index > 0 ? (31 + sw.index) : (-31 + sw.index);
- case SWITCH_TYPE_ONM:
- return 44;
- default:
- return 0;
- }
-}
-
RawSwitch open9xStockToSwitch(int8_t sw)
{
uint8_t swa = abs(sw);
@@ -105,70 +83,6 @@ RawSwitch open9xStockToSwitch(int8_t sw)
return RawSwitch(SWITCH_TYPE_MOMENT_VIRTUAL, sw > 0 ? sw-22-9 : sw+22+9);
}
-t_Open9xExpoData_v201::t_Open9xExpoData_v201(ExpoData &c9x)
-{
- mode = c9x.mode;
- chn = c9x.chn;
- // 0=no curve, 1-6=std curves, 7-10=CV1-CV4, 11-15=CV9-CV13
- curve = 0;
- expo = 0;
- if (c9x.curveMode == 1) {
- if (c9x.curveParam >=0 && c9x.curveParam <= 10)
- curve = c9x.curveParam;
- else if (c9x.curveParam >= 15 && c9x.curveParam <= 19)
- curve = c9x.curveParam - 4;
- else
- EEPROMWarnings += ::QObject::tr("Open9x doesn't allow Curve%1 in expos").arg(c9x.curveParam-6) + "\n";
- }
- else {
- expo=c9x.expo;
- }
- swtch = open9xStockFromSwitch(c9x.swtch);
- int zeros=0;
- int ones=0;
- int phtemp=c9x.phases;
- for (int i=0; i>=1;
- }
- if (zeros==O9X_MAX_PHASES || zeros==0) {
- phase=0;
- negPhase=0;
- } else if (zeros==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=ph+1;
- negPhase=0;
- } else if (ones==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=(ph+1);
- negPhase=1;
- } else {
- phase=0;
- EEPROMWarnings += ::QObject::tr("Flight modes settings on expos not exported") + "\n";
- }
- weight = c9x.weight;
-}
-
t_Open9xExpoData_v201::operator ExpoData ()
{
ExpoData c9x;
@@ -179,15 +93,10 @@ t_Open9xExpoData_v201::operator ExpoData ()
}
else {
if (curve == 0) {
- c9x.curveMode = 0;
- c9x.curveParam = expo;
+ c9x.curve = CurveReference(CurveReference::CURVE_REF_EXPO, expo);
}
else {
- c9x.curveMode = 1;
- if (curve <= 10)
- c9x.curveParam = curve;
- else
- c9x.curveParam = curve + 4;
+ // TODO
}
}
c9x.swtch = open9xStockToSwitch(swtch);
@@ -205,40 +114,18 @@ t_Open9xExpoData_v201::operator ExpoData ()
return c9x;
}
-t_Open9xExpoData_v211::t_Open9xExpoData_v211(ExpoData &c9x)
-{
- mode = c9x.mode;
- chn = c9x.chn;
- // 0=no curve, 1-6=std curves, 7-10=CV1-CV4, 11-15=CV9-CV13
-
- swtch = open9xStockFromSwitch(c9x.swtch);
- phases = c9x.phases;
- weight = c9x.weight;
- curveMode = c9x.curveMode;
- curveParam = c9x.curveParam;
-}
-
t_Open9xExpoData_v211::operator ExpoData ()
{
ExpoData c9x;
c9x.mode = mode;
c9x.chn = chn;
- c9x.curveMode = curveMode;
- c9x.curveParam = curveParam;
+ // TODO c9x.curve
c9x.swtch = open9xStockToSwitch(swtch);
c9x.phases = phases;
c9x.weight = weight;
return c9x;
}
-t_Open9xLimitData_v201::t_Open9xLimitData_v201(LimitData &c9x)
-{
- min = c9x.min+100;
- max = c9x.max-100;
- revert = c9x.revert;
- offset = c9x.offset;
-}
-
t_Open9xLimitData_v201::operator LimitData ()
{
LimitData c9x;
@@ -249,16 +136,6 @@ t_Open9xLimitData_v201::operator LimitData ()
return c9x;
}
-t_Open9xLimitData_v211::t_Open9xLimitData_v211(LimitData &c9x)
-{
- min = c9x.min+100;
- max = c9x.max-100;
- revert = c9x.revert;
- offset = c9x.offset;
- ppmCenter = c9x.ppmCenter;
- symetrical = c9x.symetrical;
-}
-
t_Open9xLimitData_v211::operator LimitData ()
{
LimitData c9x;
@@ -271,90 +148,6 @@ t_Open9xLimitData_v211::operator LimitData ()
return c9x;
}
-t_Open9xMixData_v201::t_Open9xMixData_v201(MixData &c9x)
-{
- destCh = c9x.destCh;
- mixWarn = c9x.mixWarn;
- swtch = open9xStockFromSwitch(c9x.swtch);
-
- if (c9x.srcRaw.type == SOURCE_TYPE_NONE) {
- srcRaw = 0;
- swtch = 0;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_STICK) {
- srcRaw = 1 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_ROTARY_ENCODER) {
- EEPROMWarnings += ::QObject::tr("open9x on this board doesn't have Rotary Encoders") + "\n";
- srcRaw = 5 + c9x.srcRaw.index; // use pots instead
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_MAX) {
- srcRaw = 8; // MAX
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_SWITCH) {
- srcRaw = 9; // FULL
- swtch = open9xStockFromSwitch(RawSwitch(c9x.srcRaw.index));
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CYC) {
- srcRaw = 10 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_PPM) {
- srcRaw = 13 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CH) {
- srcRaw = 21 + c9x.srcRaw.index;
- }
-
- weight = c9x.weight;
- curve = c9x.curve;
- delayUp = c9x.delayUp;
- delayDown = c9x.delayDown;
- speedUp = c9x.speedUp;
- speedDown = c9x.speedDown;
- carryTrim = c9x.carryTrim;
- mltpx = (MltpxValue)c9x.mltpx;
- int zeros=0;
- int ones=0;
- int phtemp=c9x.phases;
- for (int i=0; i>=1;
- }
- if (zeros==O9X_MAX_PHASES || zeros==0) {
- phase=0;
- } else if (zeros==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=ph+1;
- } else if (ones==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=-(ph+1);
- } else {
- phase=0;
- EEPROMWarnings += ::QObject::tr("Flight modes settings on mixers not exported") + "\n";
- }
- sOffset = c9x.sOffset;
-}
-
t_Open9xMixData_v201::operator MixData ()
{
MixData c9x;
@@ -395,7 +188,7 @@ t_Open9xMixData_v201::operator MixData ()
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-21);
}
- c9x.curve = curve;
+ // TODO c9x.curve = curve;
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
c9x.speedUp = speedUp;
@@ -403,7 +196,7 @@ t_Open9xMixData_v201::operator MixData ()
c9x.carryTrim = carryTrim;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
-// c9x.phase = phase;
+
if (phase<0) {
c9x.phases= 1 << (-phase -1);
} else if (phase==0) {
@@ -416,90 +209,6 @@ t_Open9xMixData_v201::operator MixData ()
return c9x;
}
-t_Open9xMixData_v203::t_Open9xMixData_v203(MixData &c9x)
-{
- destCh = c9x.destCh;
- mixWarn = c9x.mixWarn;
- swtch = open9xStockFromSwitch(c9x.swtch);
-
- if (c9x.srcRaw.type == SOURCE_TYPE_NONE) {
- srcRaw = 0;
- swtch = 0;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_STICK) {
- srcRaw = 1 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_ROTARY_ENCODER) {
- EEPROMWarnings += ::QObject::tr("open9x on this board doesn't have Rotary Encoders") + "\n";
- srcRaw = 5 + c9x.srcRaw.index; // use pots instead
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_MAX) {
- srcRaw = 8; // MAX
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_SWITCH) {
- srcRaw = 9; // FULL
- swtch = open9xStockFromSwitch(RawSwitch(c9x.srcRaw.index));
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CYC) {
- srcRaw = 10 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_PPM) {
- srcRaw = 13 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CH) {
- srcRaw = 21 + c9x.srcRaw.index;
- }
-
- weight = c9x.weight;
- curve = c9x.curve;
- delayUp = c9x.delayUp;
- delayDown = c9x.delayDown;
- speedUp = c9x.speedUp;
- speedDown = c9x.speedDown;
- carryTrim = c9x.carryTrim;
- mltpx = (MltpxValue)c9x.mltpx;
- int zeros=0;
- int ones=0;
- int phtemp=c9x.phases;
- for (int i=0; i>=1;
- }
- if (zeros==O9X_MAX_PHASES || zeros==0) {
- phase=0;
- } else if (zeros==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=ph+1;
- } else if (ones==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=-(ph+1);
- } else {
- phase=0;
- EEPROMWarnings += ::QObject::tr("Flight modes settings on mixers not exported") + "\n";
- }
- sOffset = c9x.sOffset;
-}
-
t_Open9xMixData_v203::operator MixData ()
{
MixData c9x;
@@ -540,7 +249,7 @@ t_Open9xMixData_v203::operator MixData ()
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-21);
}
- c9x.curve = curve;
+ // TODO c9x.curve = curve;
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
c9x.speedUp = speedUp;
@@ -548,7 +257,7 @@ t_Open9xMixData_v203::operator MixData ()
c9x.carryTrim = carryTrim;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
- // c9x.phase = phase;
+
if (phase<0) {
c9x.phases= 1 << (-phase -1);
} else if (phase==0) {
@@ -561,98 +270,6 @@ t_Open9xMixData_v203::operator MixData ()
return c9x;
}
-t_Open9xMixData_v205::t_Open9xMixData_v205(MixData &c9x)
-{
- if (c9x.destCh) {
- destCh = c9x.destCh-1;
- mixWarn = c9x.mixWarn;
- swtch = open9xStockFromSwitch(c9x.swtch);
-
- if (c9x.srcRaw.type == SOURCE_TYPE_NONE) {
- srcRaw = 0;
- swtch = 0;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_STICK) {
- srcRaw = 1 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_ROTARY_ENCODER) {
- EEPROMWarnings += ::QObject::tr("Open9x on this board doesn't have Rotary Encoders") + "\n";
- srcRaw = 5 + c9x.srcRaw.index; // use pots instead
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_MAX) {
- srcRaw = 8; // MAX
- }
- /* else if (c9x.srcRaw.type == SOURCE_TYPE_3POS) {
- srcRaw = 9;
- } */
- else if (c9x.srcRaw.type == SOURCE_TYPE_SWITCH) {
- srcRaw = 9 + open9xStockFromSwitch(RawSwitch(c9x.srcRaw.index));
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CYC) {
- srcRaw = 31 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_PPM) {
- srcRaw = 34 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CH) {
- srcRaw = 42 + c9x.srcRaw.index;
- }
-
- weight = c9x.weight;
- differential = c9x.differential/2;
- curve = c9x.curve;
- delayUp = c9x.delayUp;
- delayDown = c9x.delayDown;
- speedUp = c9x.speedUp;
- speedDown = c9x.speedDown;
- carryTrim = c9x.carryTrim;
- mltpx = (MltpxValue)c9x.mltpx;
- int zeros=0;
- int ones=0;
- int phtemp=c9x.phases;
- for (int i=0; i>=1;
- }
- if (zeros==O9X_MAX_PHASES || zeros==0) {
- phase=0;
- } else if (zeros==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=ph+1;
- } else if (ones==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=-(ph+1);
- } else {
- phase=0;
- EEPROMWarnings += ::QObject::tr("Flight modes settings on mixers not exported") + "\n";
- }
- sOffset = c9x.sOffset;
- }
- else {
- memset(this, 0, sizeof(t_Open9xMixData_v205));
- }
-}
-
t_Open9xMixData_v205::operator MixData ()
{
MixData c9x;
@@ -686,8 +303,14 @@ t_Open9xMixData_v205::operator MixData ()
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-42);
}
c9x.weight = weight;
- c9x.differential = differential*2;
- c9x.curve = curve;
+
+ if (differential) {
+ c9x.curve = CurveReference(CurveReference::CURVE_REF_DIFF, differential*2);
+ }
+ else {
+ // TODO c9x.curve = curve;
+ }
+
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
c9x.speedUp = speedUp;
@@ -695,12 +318,14 @@ t_Open9xMixData_v205::operator MixData ()
c9x.carryTrim = carryTrim;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
- // c9x.phase = phase;
+
if (phase<0) {
c9x.phases= 1 << (-phase -1);
- } else if (phase==0) {
+ }
+ else if (phase==0) {
c9x.phases=0;
- } else {
+ }
+ else {
c9x.phases=63;
c9x.phases &= ~(1 << (phase -1));
}
@@ -709,101 +334,6 @@ t_Open9xMixData_v205::operator MixData ()
return c9x;
}
-t_Open9xMixData_v209::t_Open9xMixData_v209(MixData &c9x)
-{
- if (c9x.destCh) {
- destCh = c9x.destCh-1;
- mixWarn = c9x.mixWarn;
- swtch = open9xStockFromSwitch(c9x.swtch);
-
- if (c9x.srcRaw.type == SOURCE_TYPE_NONE) {
- srcRaw = 0;
- swtch = 0;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_STICK) {
- srcRaw = 1 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_ROTARY_ENCODER) {
- EEPROMWarnings += ::QObject::tr("Open9x on this board doesn't have Rotary Encoders") + "\n";
- srcRaw = 5 + c9x.srcRaw.index; // use pots instead
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_TRIM) {
- srcRaw = 8 + c9x.srcRaw.index; // use pots instead
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_MAX) {
- srcRaw = 12; // MAX
- }
- /* else if (c9x.srcRaw.type == SOURCE_TYPE_3POS) {
- srcRaw = 13;
- } */
- else if (c9x.srcRaw.type == SOURCE_TYPE_SWITCH) {
- srcRaw = 13 + open9xStockFromSwitch(RawSwitch(c9x.srcRaw.index));
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CYC) {
- srcRaw = 35 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_PPM) {
- srcRaw = 38 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CH) {
- srcRaw = 46 + c9x.srcRaw.index;
- }
-
- weight = c9x.weight;
- differential = c9x.differential/2;
- curve = c9x.curve;
- delayUp = c9x.delayUp;
- delayDown = c9x.delayDown;
- speedUp = c9x.speedUp;
- speedDown = c9x.speedDown;
- carryTrim = c9x.carryTrim;
- mltpx = (MltpxValue)c9x.mltpx;
- int zeros=0;
- int ones=0;
- int phtemp=c9x.phases;
- for (int i=0; i>=1;
- }
- if (zeros==O9X_MAX_PHASES || zeros==0) {
- phase=0;
- } else if (zeros==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=ph+1;
- } else if (ones==1) {
- int phtemp=c9x.phases;
- int ph=0;
- for (int i=0; i>=1;
- }
- phase=-(ph+1);
- } else {
- phase=0;
- EEPROMWarnings += ::QObject::tr("Flight modes settings on mixers not exported") + "\n";
- }
- sOffset = c9x.sOffset;
- }
- else {
- memset(this, 0, sizeof(t_Open9xMixData_v209));
- }
-}
-
t_Open9xMixData_v209::operator MixData ()
{
MixData c9x;
@@ -840,8 +370,14 @@ t_Open9xMixData_v209::operator MixData ()
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-46);
}
c9x.weight = weight;
- c9x.differential = differential*2;
- c9x.curve = curve;
+
+ if (differential) {
+ c9x.curve = CurveReference(CurveReference::CURVE_REF_DIFF, differential*2);
+ }
+ else {
+ // TODO c9x.curve = curve;
+ }
+
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
c9x.speedUp = speedUp;
@@ -849,12 +385,14 @@ t_Open9xMixData_v209::operator MixData ()
c9x.carryTrim = carryTrim;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
- // c9x.phase = phase;
+
if (phase<0) {
c9x.phases= 1 << (-phase -1);
- } else if (phase==0) {
+ }
+ else if (phase==0) {
c9x.phases=0;
- } else {
+ }
+ else {
c9x.phases=63;
c9x.phases &= ~(1 << (phase -1));
}
@@ -863,70 +401,6 @@ t_Open9xMixData_v209::operator MixData ()
return c9x;
}
-t_Open9xMixData_v211::t_Open9xMixData_v211(MixData &c9x)
-{
- if (c9x.destCh) {
- destCh = c9x.destCh-1;
- mixWarn = c9x.mixWarn;
- swtch = open9xStockFromSwitch(c9x.swtch);
-
- if (c9x.srcRaw.type == SOURCE_TYPE_NONE) {
- srcRaw = 0;
- swtch = 0;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_STICK) {
- srcRaw = 1 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_ROTARY_ENCODER) {
- EEPROMWarnings += ::QObject::tr("Open9x on this board doesn't have Rotary Encoders") + "\n";
- srcRaw = 5 + c9x.srcRaw.index; // use pots instead
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_TRIM) {
- srcRaw = 8 + c9x.srcRaw.index; // use pots instead
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_MAX) {
- srcRaw = 12; // MAX
- }
- /* else if (c9x.srcRaw.type == SOURCE_TYPE_3POS) {
- srcRaw = 13;
- } */
- else if (c9x.srcRaw.type == SOURCE_TYPE_SWITCH) {
- srcRaw = 13 + open9xStockFromSwitch(RawSwitch(c9x.srcRaw.index));
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CYC) {
- srcRaw = 35 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_PPM) {
- srcRaw = 38 + c9x.srcRaw.index;
- }
- else if (c9x.srcRaw.type == SOURCE_TYPE_CH) {
- srcRaw = 46 + c9x.srcRaw.index;
- }
-
- weight = c9x.weight;
- if (c9x.curve==0) {
- curveMode = 0;
- curveParam = c9x.differential;
- }
- else {
- curveMode = 1;
- curveParam = c9x.curve;
- }
- delayUp = c9x.delayUp;
- delayDown = c9x.delayDown;
- speedUp = c9x.speedUp;
- speedDown = c9x.speedDown;
- carryTrim = c9x.carryTrim;
- noExpo = c9x.noExpo;
- mltpx = (MltpxValue)c9x.mltpx;
- phases = c9x.phases;
- sOffset = c9x.sOffset;
- }
- else {
- memset(this, 0, sizeof(t_Open9xMixData_v211));
- }
-}
-
t_Open9xMixData_v211::operator MixData ()
{
MixData c9x;
@@ -963,12 +437,14 @@ t_Open9xMixData_v211::operator MixData ()
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-46);
}
c9x.weight = weight;
+
if (curveMode==0) {
- c9x.differential = curveParam;
- c9x.curve=0;
- } else {
- c9x.curve=curveParam;
+ c9x.curve = CurveReference(CurveReference::CURVE_REF_DIFF, curveParam);
+ }
+ else {
+ // TODO c9x.curve = curve;
}
+
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
c9x.speedUp = speedUp;
@@ -983,30 +459,6 @@ t_Open9xMixData_v211::operator MixData ()
return c9x;
}
-int8_t open9x208FromSource(RawSource source)
-{
- int v1 = 0;
- if (source.type == SOURCE_TYPE_STICK)
- v1 = 1+source.index;
- else if (source.type == SOURCE_TYPE_ROTARY_ENCODER) {
- EEPROMWarnings += ::QObject::tr("Open9x on this board doesn't have Rotary Encoders") + "\n";
- v1 = 5+source.index;
- }
- else if (source.type == SOURCE_TYPE_MAX)
- v1 = 8;
- /* else if (source.type == SOURCE_TYPE_3POS)
- v1 = 9; */
- else if (source.type == SOURCE_TYPE_CYC)
- v1 = 10+source.index;
- else if (source.type == SOURCE_TYPE_PPM)
- v1 = 13+source.index;
- else if (source.type == SOURCE_TYPE_CH)
- v1 = 21+source.index;
- else if (source.type == SOURCE_TYPE_TELEMETRY)
- v1 = 36+source.index;
- return v1;
-}
-
RawSource open9x208ToSource(int8_t value)
{
if (value == 0) {
@@ -1035,32 +487,6 @@ RawSource open9x208ToSource(int8_t value)
}
}
-int8_t open9xStock209FromSource(RawSource source)
-{
- int v1 = 0;
- if (source.type == SOURCE_TYPE_STICK)
- v1 = 1+source.index;
- else if (source.type == SOURCE_TYPE_ROTARY_ENCODER) {
- EEPROMWarnings += ::QObject::tr("Open9x on this board doesn't have Rotary Encoders") + "\n";
- v1 = 5+source.index;
- }
- else if (source.type == SOURCE_TYPE_TRIM)
- v1 = 8+source.index;
- else if (source.type == SOURCE_TYPE_MAX)
- v1 = 12;
- /* else if (source.type == SOURCE_TYPE_3POS)
- v1 = 13; */
- else if (source.type == SOURCE_TYPE_CYC)
- v1 = 14+source.index;
- else if (source.type == SOURCE_TYPE_PPM)
- v1 = 17+source.index;
- else if (source.type == SOURCE_TYPE_CH)
- v1 = 25+source.index;
- else if (source.type == SOURCE_TYPE_TELEMETRY)
- v1 = 40+source.index;
- return v1;
-}
-
RawSource open9xStock209ToSource(int8_t value)
{
if (value == 0) {
@@ -1092,33 +518,6 @@ RawSource open9xStock209ToSource(int8_t value)
}
}
-t_Open9xCustomSwData_v208::t_Open9xCustomSwData_v208(CustomSwData &c9x)
-{
- func = c9x.func;
- v1 = c9x.val1;
- v2 = c9x.val2;
-
- if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
- v1 = open9x208FromSource(RawSource(c9x.val1));
- }
-
- if (c9x.func >= CS_FN_EQUAL) {
- v2 = open9x208FromSource(RawSource(c9x.val2));
- }
-
- if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
- v1 = open9xStockFromSwitch(RawSwitch(c9x.val1));
- v2 = open9xStockFromSwitch(RawSwitch(c9x.val2));
- }
-
- if (func>O9X_MAX_CSFUNCOLD ) {
- EEPROMWarnings += ::QObject::tr("This version of open9x does not support Custom Switch function %1").arg(getFuncName(func)) + "\n";
- func=0;
- v1=0;
- v2=0;
- }
-}
-
Open9xCustomSwData_v208::operator CustomSwData ()
{
CustomSwData c9x;
@@ -1142,26 +541,6 @@ Open9xCustomSwData_v208::operator CustomSwData ()
return c9x;
}
-t_Open9xCustomSwData_v209::t_Open9xCustomSwData_v209(CustomSwData &c9x)
-{
- func = c9x.func;
- v1 = c9x.val1;
- v2 = c9x.val2;
-
- if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
- v1 = open9xStock209FromSource(RawSource(c9x.val1));
- }
-
- if (c9x.func >= CS_FN_EQUAL && c9x.func <= CS_FN_ELESS) {
- v2 = open9xStock209FromSource(RawSource(c9x.val2));
- }
-
- if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
- v1 = open9xStockFromSwitch(RawSwitch(c9x.val1));
- v2 = open9xStockFromSwitch(RawSwitch(c9x.val2));
- }
-}
-
Open9xCustomSwData_v209::operator CustomSwData ()
{
CustomSwData c9x;
@@ -1185,12 +564,6 @@ Open9xCustomSwData_v209::operator CustomSwData ()
return c9x;
}
-t_Open9xFuncSwData_v201::t_Open9xFuncSwData_v201(FuncSwData &c9x)
-{
- swtch = open9xStockFromSwitch(c9x.swtch);
- func = c9x.func - O9X_NUM_CHNOUT;
-}
-
t_Open9xFuncSwData_v201::operator FuncSwData ()
{
FuncSwData c9x;
@@ -1225,37 +598,6 @@ enum Functions {
FUNC_MAX
};
-t_Open9xFuncSwData_v203::t_Open9xFuncSwData_v203(FuncSwData &c9x)
-{
- swtch = open9xStockFromSwitch(c9x.swtch);
- if (c9x.func <= FuncSafetyCh16) {
- param = ((c9x.param>>1)<<1);
- param |=(c9x.enabled & 0x01);
- func = c9x.func;
- } else {
- param = c9x.param;;
- if (c9x.func <= FuncTrainerAIL)
- func = 16 + c9x.func - FuncTrainer;
- else if (c9x.func == FuncInstantTrim)
- func = 21;
- else if (c9x.func == FuncPlaySound)
- func = 22;
- else if (c9x.func == FuncPlayHaptic)
- func = 23;
- else if (c9x.func == FuncReset)
- func = 24;
- else if (c9x.func == FuncVario)
- func = 25;
- else if (c9x.func == FuncBacklight)
- func = 26;
- else {
- swtch = 0;
- func = 0;
- param = 0;
- }
- }
-}
-
t_Open9xFuncSwData_v203::operator FuncSwData ()
{
FuncSwData c9x;
@@ -1286,38 +628,6 @@ t_Open9xFuncSwData_v203::operator FuncSwData ()
return c9x;
}
-t_Open9xFuncSwData_v210::t_Open9xFuncSwData_v210(FuncSwData &c9x)
-{
- swtch = open9xStockFromSwitch(c9x.swtch);
- param = c9x.param;
- if (c9x.func <= FuncInstantTrim) {
- delay = c9x.enabled;
- func = (uint8_t)c9x.func;
- }
- else if (c9x.func == FuncPlaySound)
- func = 22;
- else if (c9x.func == FuncPlayHaptic)
- func = 23;
- else if (c9x.func == FuncReset)
- func = 24;
- else if (c9x.func == FuncVario)
- func = 25;
- else if (c9x.func == FuncPlayPrompt)
- func = 26;
- else if (c9x.func == FuncPlayValue) {
- func = 27;
- if (c9x.param > 7) {
- param -= 2;
- }
- } else if (c9x.func == FuncBacklight)
- func = 28;
- else {
- swtch = 0;
- func = 0;
- param = 0;
- }
-}
-
t_Open9xFuncSwData_v210::operator FuncSwData ()
{
FuncSwData c9x;
@@ -1352,12 +662,6 @@ t_Open9xFuncSwData_v210::operator FuncSwData ()
return c9x;
}
-t_Open9xSafetySwData::t_Open9xSafetySwData(SafetySwData &c9x)
-{
- swtch = open9xStockFromSwitch(c9x.swtch);
- val = c9x.val;
-}
-
t_Open9xSafetySwData::operator SafetySwData ()
{
SafetySwData c9x;
@@ -1366,16 +670,6 @@ t_Open9xSafetySwData::operator SafetySwData ()
return c9x;
}
-t_Open9xSwashRingData_v208::t_Open9xSwashRingData_v208(SwashRingData &c9x)
-{
- invertELE = c9x.invertELE;
- invertAIL = c9x.invertAIL;
- invertCOL = c9x.invertCOL;
- type = c9x.type;
- collectiveSource = open9x208FromSource(c9x.collectiveSource);
- value = c9x.value;
-}
-
t_Open9xSwashRingData_v208::operator SwashRingData ()
{
SwashRingData c9x;
@@ -1388,16 +682,6 @@ t_Open9xSwashRingData_v208::operator SwashRingData ()
return c9x;
}
-t_Open9xSwashRingData_v209::t_Open9xSwashRingData_v209(SwashRingData &c9x)
-{
- invertELE = c9x.invertELE;
- invertAIL = c9x.invertAIL;
- invertCOL = c9x.invertCOL;
- type = c9x.type;
- collectiveSource = open9xStock209FromSource(c9x.collectiveSource);
- value = c9x.value;
-}
-
t_Open9xSwashRingData_v209::operator SwashRingData ()
{
SwashRingData c9x;
@@ -1422,19 +706,6 @@ t_Open9xPhaseData_v201::operator PhaseData ()
return c9x;
}
-t_Open9xPhaseData_v201::t_Open9xPhaseData_v201(PhaseData &c9x)
-{
- trim_ext = 0;
- for (int i=0; i> 2);
- trim_ext = (trim_ext & ~(0x03 << (2*i))) + (((c9x.trim[i] & 0x03) << (2*i)));
- }
- swtch = open9xStockFromSwitch(c9x.swtch);
- setEEPROMZString(name, c9x.name, sizeof(name));
- fadeIn = c9x.fadeIn;
- fadeOut = c9x.fadeOut;
-}
-
t_Open9xTimerData_v201::operator TimerData ()
{
TimerData c9x;
@@ -1466,24 +737,6 @@ t_Open9xTimerData_v202::operator TimerData ()
return c9x;
}
-t_Open9xTimerData_v202::t_Open9xTimerData_v202(TimerData &c9x)
-{
- val = c9x.val;
-
- if (c9x.mode >= TMRMODE_OFF && c9x.mode <= TMRMODE_THt)
- mode = 0+c9x.mode-TMRMODE_OFF;
- else if (c9x.mode >= TMRMODE_FIRST_MOMENT_SWITCH)
- mode = 26+c9x.mode-TMRMODE_FIRST_MOMENT_SWITCH;
- else if (c9x.mode >= TMRMODE_FIRST_SWITCH)
- mode = 5+c9x.mode-TMRMODE_FIRST_SWITCH;
- else if (c9x.mode <= TMRMODE_FIRST_NEG_MOMENT_SWITCH)
- mode = -22+c9x.mode-TMRMODE_FIRST_NEG_MOMENT_SWITCH;
- else if (c9x.mode <= TMRMODE_FIRST_NEG_SWITCH)
- mode = -1+c9x.mode-TMRMODE_FIRST_NEG_SWITCH;
- else
- mode = 0;
-}
-
FrSkyRSSIAlarm t_Open9xFrSkyRSSIAlarm::get(int index)
{
FrSkyRSSIAlarm c9x;
@@ -1492,25 +745,6 @@ FrSkyRSSIAlarm t_Open9xFrSkyRSSIAlarm::get(int index)
return c9x;
}
-t_Open9xFrSkyRSSIAlarm::t_Open9xFrSkyRSSIAlarm(int index, FrSkyRSSIAlarm &c9x)
-{
- memset(this, 0, sizeof(t_Open9xFrSkyRSSIAlarm));
- level = (2+c9x.level-index) % 4;
- value = c9x.value - 50;
-}
-
-t_Open9xFrSkyChannelData_v201::t_Open9xFrSkyChannelData_v201(FrSkyChannelData &c9x)
-{
- memset(this, 0, sizeof(t_Open9xFrSkyChannelData_v201));
- ratio = c9x.ratio;
- alarms_value[0] = c9x.alarms[0].value;
- alarms_value[1] = c9x.alarms[1].value;
- alarms_level = (c9x.alarms[1].level << 2) + c9x.alarms[0].level;
- alarms_greater = (c9x.alarms[1].greater << 1) + c9x.alarms[0].greater;
- type = c9x.type;
- offset = LIMIT(-8, c9x.offset, +7);
-}
-
t_Open9xFrSkyChannelData_v201::operator FrSkyChannelData ()
{
FrSkyChannelData c9x;
@@ -1526,18 +760,6 @@ t_Open9xFrSkyChannelData_v201::operator FrSkyChannelData ()
return c9x;
}
-t_Open9xFrSkyChannelData_v203::t_Open9xFrSkyChannelData_v203(FrSkyChannelData &c9x)
-{
- memset(this, 0, sizeof(t_Open9xFrSkyChannelData_v203));
- ratio = c9x.ratio;
- alarms_value[0] = c9x.alarms[0].value;
- alarms_value[1] = c9x.alarms[1].value;
- alarms_level = (c9x.alarms[1].level << 2) + c9x.alarms[0].level;
- alarms_greater = (c9x.alarms[1].greater << 1) + c9x.alarms[0].greater;
- type = c9x.type;
- offset = c9x.offset;
-}
-
t_Open9xFrSkyChannelData_v203::operator FrSkyChannelData ()
{
FrSkyChannelData c9x;
@@ -1553,20 +775,6 @@ t_Open9xFrSkyChannelData_v203::operator FrSkyChannelData ()
return c9x;
}
-t_Open9xFrSkyChannelData_v204::t_Open9xFrSkyChannelData_v204(FrSkyChannelData &c9x)
-{
- memset(this, 0, sizeof(t_Open9xFrSkyChannelData_v204));
- ratio = c9x.ratio;
- type = c9x.type;
- multiplier = c9x.multiplier;
- alarms_value[0] = c9x.alarms[0].value;
- alarms_value[1] = c9x.alarms[1].value;
- alarms_level = (c9x.alarms[1].level << 2) + c9x.alarms[0].level;
- alarms_greater = (c9x.alarms[1].greater << 1) + c9x.alarms[0].greater;
- // TODO multiplier = c9x.multiplier;
- offset = c9x.offset;
-}
-
t_Open9xFrSkyChannelData_v204::operator FrSkyChannelData ()
{
FrSkyChannelData c9x;
@@ -1584,20 +792,6 @@ t_Open9xFrSkyChannelData_v204::operator FrSkyChannelData ()
return c9x;
}
-t_Open9xFrSkyChannelData_v208::t_Open9xFrSkyChannelData_v208(FrSkyChannelData &c9x)
-{
- memset(this, 0, sizeof(t_Open9xFrSkyChannelData_v208));
- ratio = c9x.ratio;
- type = c9x.type;
- multiplier = c9x.multiplier;
- alarms_value[0] = c9x.alarms[0].value;
- alarms_value[1] = c9x.alarms[1].value;
- alarms_level = (c9x.alarms[1].level << 2) + c9x.alarms[0].level;
- alarms_greater = (c9x.alarms[1].greater << 1) + c9x.alarms[0].greater;
- // TODO multiplier = c9x.multiplier;
- offset = c9x.offset;
-}
-
t_Open9xFrSkyChannelData_v208::operator FrSkyChannelData ()
{
FrSkyChannelData c9x;
@@ -1632,14 +826,6 @@ t_Open9xFrSkyData_v202::operator FrSkyData ()
return c9x;
}
-t_Open9xFrSkyData_v202::t_Open9xFrSkyData_v202(FrSkyData &c9x)
-{
- memset(this, 0, sizeof(t_Open9xFrSkyData_v202));
- channels[0] = c9x.channels[0];
- channels[1] = c9x.channels[1];
- usrProto = c9x.usrProto;
-}
-
t_Open9xFrSkyData_v203::operator FrSkyData ()
{
FrSkyData c9x;
@@ -1649,14 +835,6 @@ t_Open9xFrSkyData_v203::operator FrSkyData ()
return c9x;
}
-t_Open9xFrSkyData_v203::t_Open9xFrSkyData_v203(FrSkyData &c9x)
-{
- memset(this, 0, sizeof(t_Open9xFrSkyData_v203));
- channels[0] = c9x.channels[0];
- channels[1] = c9x.channels[1];
- usrProto = c9x.usrProto;
-}
-
t_Open9xFrSkyBarData_v204::operator FrSkyBarData ()
{
FrSkyBarData c9x;
@@ -1666,14 +844,6 @@ t_Open9xFrSkyBarData_v204::operator FrSkyBarData ()
return c9x;
}
-t_Open9xFrSkyBarData_v204::t_Open9xFrSkyBarData_v204(FrSkyBarData &c9x)
-{
- memset(this, 0, sizeof(t_Open9xFrSkyBarData_v204));
- source = c9x.source;
- barMin = c9x.barMin;
- barMax = c9x.barMax;
-}
-
t_Open9xFrSkyData_v204::operator FrSkyData ()
{
FrSkyData c9x;
@@ -1688,18 +858,6 @@ t_Open9xFrSkyData_v204::operator FrSkyData ()
return c9x;
}
-t_Open9xFrSkyData_v204::t_Open9xFrSkyData_v204(FrSkyData &c9x)
-{
- memset(this, 0, sizeof(t_Open9xFrSkyData_v204));
- channels[0] = c9x.channels[0];
- channels[1] = c9x.channels[1];
- usrProto = c9x.usrProto;
- imperial = c9x.imperial;
- blades = c9x.blades;
- for (int i=0; i<4; i++)
- bars[i] = c9x.screens[0].body.bars[i];
-}
-
t_Open9xFrSkyData_v205::operator FrSkyData ()
{
FrSkyData c9x;
@@ -1716,21 +874,6 @@ t_Open9xFrSkyData_v205::operator FrSkyData ()
return c9x;
}
-t_Open9xFrSkyData_v205::t_Open9xFrSkyData_v205(FrSkyData &c9x)
-{
- memset(this, 0, sizeof(t_Open9xFrSkyData_v205));
- channels[0] = c9x.channels[0];
- channels[1] = c9x.channels[1];
- usrProto = c9x.usrProto;
- imperial = c9x.imperial;
- blades = c9x.blades;
- for (int i=0; i<4; i++)
- bars[i] = c9x.screens[0].body.bars[i];
- rssiAlarms[0] = Open9xFrSkyRSSIAlarm(0, c9x.rssiAlarms[0]);
- rssiAlarms[1] = Open9xFrSkyRSSIAlarm(1, c9x.rssiAlarms[1]);
-}
-
-
t_Open9xFrSkyData_v208::operator FrSkyData ()
{
FrSkyData c9x;
@@ -1748,21 +891,6 @@ t_Open9xFrSkyData_v208::operator FrSkyData ()
return c9x;
}
-t_Open9xFrSkyData_v208::t_Open9xFrSkyData_v208(FrSkyData &c9x)
-{
- memset(this, 0, sizeof(t_Open9xFrSkyData_v208));
- channels[0] = c9x.channels[0];
- channels[1] = c9x.channels[1];
- usrProto = c9x.usrProto;
- voltsSource = c9x.voltsSource;
- blades = c9x.blades;
- currentSource=c9x.currentSource;
- for (int i=0; i<4; i++)
- bars[i] = c9x.screens[0].body.bars[i];
- rssiAlarms[0] = Open9xFrSkyRSSIAlarm(0, c9x.rssiAlarms[0]);
- rssiAlarms[1] = Open9xFrSkyRSSIAlarm(1, c9x.rssiAlarms[1]);
-}
-
t_Open9xFrSkyData_v210::operator FrSkyData ()
{
FrSkyData c9x;
@@ -1798,40 +926,6 @@ t_Open9xFrSkyData_v210::operator FrSkyData ()
return c9x;
}
-t_Open9xFrSkyData_v210::t_Open9xFrSkyData_v210(FrSkyData &c9x)
-{
- memset(this, 0, sizeof(t_Open9xFrSkyData_v210));
- channels[0] = c9x.channels[0];
- channels[1] = c9x.channels[1];
- usrProto = c9x.usrProto;
- voltsSource = c9x.voltsSource;
- blades = c9x.blades;
- currentSource=c9x.currentSource;
-
- for (int scr=0; scr<2; scr++) {
- if (c9x.screens[scr].type == 1) {
- for (int i=0; i<4; i++)
- bars[i] = c9x.screens[scr].body.bars[i];
- }
- else {
- linesXtra=0;
- for (int j=0; j<4; j++) {
- lines[j] = 0;
- for (int k=0; k<2; k++) {
- int value = c9x.screens[scr].body.lines[j].source[k];
- lines[j] |= (k==0 ? (value & 0x0f) : ((value & 0x0f) << 4));
- linesXtra |= (value / 16) << (4*j+2*k);
- }
- }
- }
- }
- rssiAlarms[0] = Open9xFrSkyRSSIAlarm(0, c9x.rssiAlarms[0]);
- rssiAlarms[1] = Open9xFrSkyRSSIAlarm(1, c9x.rssiAlarms[1]);
- varioSource = c9x.varioSource;
- varioSpeedUpMin = c9x.varioCenterMax;
- varioSpeedDownMin = c9x.varioCenterMin;
-}
-
t_Open9xModelData_v201::operator ModelData ()
{
ModelData c9x;
@@ -1881,7 +975,6 @@ t_Open9xModelData_v201::operator ModelData ()
c9x.expoData[i] = expoData[i];
for (int i=0; i= 0) {
- phase.trim[j] = 501 + phase.trimRef[j] - (phase.trimRef[j] >= i ? 1 : 0);
- }
- else {
- phase.trim[j] = std::max(-500, std::min(500, phase.trim[j]));
- }
- }
- phaseData[i] = phase;
- }
- frsky = c9x.frsky;
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- thrTraceSrc = c9x.thrTraceSrc;
- modelId=c9x.modelId;
- }
- else {
- memset(this, 0, sizeof(t_Open9xModelData_v202));
- }
-}
-
t_Open9xModelData_v203::operator ModelData ()
{
ModelData c9x;
@@ -2115,7 +1125,6 @@ t_Open9xModelData_v203::operator ModelData ()
c9x.expoData[i] = expoData[i];
for (int i=0; i= 0) {
- phase.trim[j] = 501 + phase.trimRef[j] - (phase.trimRef[j] >= i ? 1 : 0);
- }
- else {
- phase.trim[j] = std::max(-500, std::min(500, phase.trim[j]));
- }
- }
- phaseData[i] = phase;
- }
- frsky = c9x.frsky;
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- thrTraceSrc = c9x.thrTraceSrc;
- modelId = c9x.modelId;
- }
- else {
- memset(this, 0, sizeof(t_Open9xModelData_v203));
- }
-}
-
t_Open9xModelData_v204::operator ModelData ()
{
ModelData c9x;
@@ -2281,7 +1199,6 @@ t_Open9xModelData_v204::operator ModelData ()
c9x.expoData[i] = expoData[i];
for (int i=0; i= 0) {
- phase.trim[j] = 501 + phase.trimRef[j] - (phase.trimRef[j] >= i ? 1 : 0);
- }
- else {
- phase.trim[j] = std::max(-500, std::min(500, phase.trim[j]));
- }
- }
- phaseData[i] = phase;
- }
- frsky = c9x.frsky;
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- thrTraceSrc = c9x.thrTraceSrc;
- modelId = c9x.modelId;
- frskyRssiAlarms[0] = Open9xFrSkyRSSIAlarm(0, c9x.frsky.rssiAlarms[0]);
- frskyRssiAlarms[1] = Open9xFrSkyRSSIAlarm(1, c9x.frsky.rssiAlarms[1]);
- }
- else {
- memset(this, 0, sizeof(t_Open9xModelData_v204));
- }
-}
-
t_Open9xModelData_v205::operator ModelData ()
{
ModelData c9x;
@@ -2454,7 +1278,6 @@ t_Open9xModelData_v205::operator ModelData ()
c9x.expoData[i] = expoData[i];
for (int i=0; i= 0) {
- phase.trim[j] = 501 + phase.trimRef[j] - (phase.trimRef[j] >= i ? 1 : 0);
- }
- else {
- phase.trim[j] = std::max(-500, std::min(500, phase.trim[j]));
- }
- }
- phaseData[i] = phase;
- }
- frsky = c9x.frsky;
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- thrTraceSrc = c9x.thrTraceSrc;
- modelId = c9x.modelId;
- frskyLinesXtra=0;
- for (int j=0; j<4; j++) {
- frskyLines[j] = 0;
- for (int k=0; k<2; k++) {
- int value = c9x.frsky.screens[1].body.lines[j].source[k];
- frskyLines[j] |= (k==0 ? (value & 0x0f) : ((value & 0x0f) << 4));
- frskyLinesXtra |= (value / 16) << (4*j+2*k);
- }
- }
- }
- else {
- memset(this, 0, sizeof(t_Open9xModelData_v205));
- }
-}
-
-
t_Open9xModelData_v208::operator ModelData ()
{
ModelData c9x;
@@ -2645,7 +1364,6 @@ t_Open9xModelData_v208::operator ModelData ()
c9x.expoData[i] = expoData[i];
for (int i=0; i= 0) {
- phase.trim[j] = 501 + phase.trimRef[j] - (phase.trimRef[j] >= i ? 1 : 0);
- }
- else {
- phase.trim[j] = std::max(-500, std::min(500, phase.trim[j]));
- }
- }
- phaseData[i] = phase;
- }
- frsky = c9x.frsky;
- varioSource = c9x.frsky.varioSource;
- varioSpeedUpMin = c9x.frsky.varioCenterMax;
- varioSpeedDownMin = c9x.frsky.varioCenterMin;
-
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- thrTraceSrc = c9x.thrTraceSrc;
- modelId = c9x.modelId;
- frskyLinesXtra=0;
- for (int j=0; j<4; j++) {
- frskyLines[j] = 0;
- for (int k=0; k<2; k++) {
- int value = c9x.frsky.screens[1].body.lines[j].source[k];
- frskyLines[j] |= (k==0 ? (value & 0x0f) : ((value & 0x0f) << 4));
- frskyLinesXtra |= (value / 16) << (4*j+2*k);
- }
- }
-
- for (int i=0; i= 0) {
- phase.trim[j] = 501 + phase.trimRef[j] - (phase.trimRef[j] >= i ? 1 : 0);
- }
- else {
- phase.trim[j] = std::max(-500, std::min(500, phase.trim[j]));
- }
- }
- phaseData[i] = phase;
- }
- frsky = c9x.frsky;
- varioSource = c9x.frsky.varioSource;
- varioSpeedUpMin = c9x.frsky.varioCenterMax;
- varioSpeedDownMin = c9x.frsky.varioCenterMin;
- switchWarningStates = c9x.switchWarningStates;
-
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- thrTraceSrc = c9x.thrTraceSrc;
- modelId = c9x.modelId;
- frskyLinesXtra=0;
- for (int j=0; j<4; j++) {
- frskyLines[j] = 0;
- for (int k=0; k<2; k++) {
- int value = c9x.frsky.screens[1].body.lines[j].source[k];
- frskyLines[j] |= (k==0 ? (value & 0x0f) : ((value & 0x0f) << 4));
- frskyLinesXtra |= (value / 16) << (4*j+2*k);
- }
- }
-
- for (int i=0; i O9X_NUM_POINTS - 5 * O9X_MAX_CURVES) {
- EEPROMWarnings += ::QObject::tr("open9x only accepts %1 points in all curves").arg(O9X_NUM_POINTS) + "\n";
- break;
- }
- curves[i] = offset;
- for (int j=0; j= 0) {
- phase.trim[j] = 501 + phase.trimRef[j] - (phase.trimRef[j] >= i ? 1 : 0);
- }
- else {
- phase.trim[j] = std::max(-500, std::min(500, phase.trim[j]));
- }
- }
- phaseData[i] = phase;
- }
- frsky = c9x.frsky;
-
- switchWarningStates = c9x.switchWarningStates;
-
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- thrTraceSrc = c9x.thrTraceSrc;
- modelId = c9x.modelId;
-
- for (int i=0; i O9X_NUM_POINTS - 5 * O9X_MAX_CURVES) {
- EEPROMWarnings += ::QObject::tr("open9x only accepts %1 points in all curves").arg(O9X_NUM_POINTS) + "\n";
- break;
- }
- curves[i] = offset;
- for (int j=0; j= 0) {
- phase.trim[j] = 501 + phase.trimRef[j] - (phase.trimRef[j] >= i ? 1 : 0);
- }
- else {
- phase.trim[j] = std::max(-500, std::min(500, phase.trim[j]));
- }
- }
- phaseData[i] = phase;
- }
- frsky = c9x.frsky;
-
- switchWarningStates = c9x.switchWarningStates;
-
- ppmFrameLength = c9x.moduleData[0].ppmFrameLength;
- thrTraceSrc = c9x.thrTraceSrc;
- modelId = c9x.modelId;
- }
-}
diff --git a/companion/src/firmwares/opentx/open9xStockeeprom.h b/companion/src/firmwares/opentx/open9xStockeeprom.h
index 46178281f..59bee09a9 100644
--- a/companion/src/firmwares/opentx/open9xStockeeprom.h
+++ b/companion/src/firmwares/opentx/open9xStockeeprom.h
@@ -65,7 +65,6 @@ PACK(typedef struct t_Open9xFrSkyRSSIAlarm {
int8_t value:6;
FrSkyRSSIAlarm get(int index);
t_Open9xFrSkyRSSIAlarm() { memset(this, 0, sizeof(t_Open9xFrSkyRSSIAlarm)); }
- t_Open9xFrSkyRSSIAlarm(int index, FrSkyRSSIAlarm&);
}) Open9xFrSkyRSSIAlarm;
PACK(typedef struct t_Open9xExpoData_v201 {
@@ -80,8 +79,6 @@ PACK(typedef struct t_Open9xExpoData_v201 {
operator ExpoData();
t_Open9xExpoData_v201() { memset(this, 0, sizeof(t_Open9xExpoData_v201)); }
- t_Open9xExpoData_v201(ExpoData&);
-
}) Open9xExpoData_v201;
PACK(typedef struct t_Open9xExpoData_v211 {
@@ -95,8 +92,6 @@ PACK(typedef struct t_Open9xExpoData_v211 {
operator ExpoData();
t_Open9xExpoData_v211() { memset(this, 0, sizeof(t_Open9xExpoData_v211)); }
- t_Open9xExpoData_v211(ExpoData&);
-
}) Open9xExpoData_v211;
PACK(typedef struct t_Open9xLimitData_v201 {
@@ -107,8 +102,6 @@ PACK(typedef struct t_Open9xLimitData_v201 {
operator LimitData();
t_Open9xLimitData_v201() { memset(this, 0, sizeof(t_Open9xLimitData_v201)); }
- t_Open9xLimitData_v201(LimitData&);
-
}) Open9xLimitData_v201;
PACK(typedef struct t_Open9xLimitData_v211 {
@@ -121,8 +114,6 @@ PACK(typedef struct t_Open9xLimitData_v211 {
operator LimitData();
t_Open9xLimitData_v211() { memset(this, 0, sizeof(t_Open9xLimitData_v211)); }
- t_Open9xLimitData_v211(LimitData&);
-
}) Open9xLimitData_v211;
PACK(typedef struct t_Open9xMixData_v201 {
@@ -143,8 +134,6 @@ PACK(typedef struct t_Open9xMixData_v201 {
operator MixData();
t_Open9xMixData_v201() { memset(this, 0, sizeof(t_Open9xMixData_v201)); }
- t_Open9xMixData_v201(MixData&);
-
}) Open9xMixData_v201;
PACK(typedef struct t_Open9xMixData_v203 {
@@ -165,8 +154,6 @@ PACK(typedef struct t_Open9xMixData_v203 {
operator MixData();
t_Open9xMixData_v203() { memset(this, 0, sizeof(t_Open9xMixData_v203)); }
- t_Open9xMixData_v203(MixData&);
-
}) Open9xMixData_v203;
PACK(typedef struct t_Open9xMixData_v205 {
@@ -188,8 +175,6 @@ PACK(typedef struct t_Open9xMixData_v205 {
operator MixData();
t_Open9xMixData_v205() { memset(this, 0, sizeof(t_Open9xMixData_v205)); }
- t_Open9xMixData_v205(MixData&);
-
}) Open9xMixData_v205;
PACK(typedef struct t_Open9xMixData_v209 {
@@ -211,8 +196,6 @@ PACK(typedef struct t_Open9xMixData_v209 {
operator MixData();
t_Open9xMixData_v209() { memset(this, 0, sizeof(t_Open9xMixData_v209)); }
- t_Open9xMixData_v209(MixData&);
-
}) Open9xMixData_v209;
PACK(typedef struct t_Open9xMixData_v211 {
@@ -236,8 +219,6 @@ PACK(typedef struct t_Open9xMixData_v211 {
operator MixData();
t_Open9xMixData_v211() { memset(this, 0, sizeof(t_Open9xMixData_v211)); }
- t_Open9xMixData_v211(MixData&);
-
}) Open9xMixData_v211;
PACK(typedef struct t_Open9xCustomSwData_v208 { // Custom Switches data
@@ -257,7 +238,6 @@ PACK(typedef struct t_Open9xCustomSwData_v209 { // Custom Switches data
operator CustomSwData();
t_Open9xCustomSwData_v209() { memset(this, 0, sizeof(t_Open9xCustomSwData_v209)); }
- t_Open9xCustomSwData_v209(CustomSwData&);
}) Open9xCustomSwData_v209;
PACK(typedef struct t_Open9xSafetySwData { // Safety Switches data
@@ -266,8 +246,6 @@ PACK(typedef struct t_Open9xSafetySwData { // Safety Switches data
operator SafetySwData();
t_Open9xSafetySwData() { memset(this, 0, sizeof(t_Open9xSafetySwData)); }
- t_Open9xSafetySwData(SafetySwData&);
-
}) Open9xSafetySwData;
PACK(typedef struct t_Open9xFuncSwData_v201 { // Function Switches data
@@ -276,8 +254,6 @@ PACK(typedef struct t_Open9xFuncSwData_v201 { // Function Switches data
operator FuncSwData();
t_Open9xFuncSwData_v201() { memset(this, 0, sizeof(t_Open9xFuncSwData_v201)); }
- t_Open9xFuncSwData_v201(FuncSwData&);
-
}) Open9xFuncSwData_v201;
PACK(typedef struct t_Open9xFuncSwData_v203 { // Function Switches data
@@ -287,8 +263,6 @@ PACK(typedef struct t_Open9xFuncSwData_v203 { // Function Switches data
operator FuncSwData();
t_Open9xFuncSwData_v203() { memset(this, 0, sizeof(t_Open9xFuncSwData_v203)); }
- t_Open9xFuncSwData_v203(FuncSwData&);
-
}) Open9xFuncSwData_v203;
PACK(typedef struct t_Open9xFuncSwData_v210 { // Function Switches data
@@ -299,8 +273,6 @@ PACK(typedef struct t_Open9xFuncSwData_v210 { // Function Switches data
operator FuncSwData();
t_Open9xFuncSwData_v210() { memset(this, 0, sizeof(t_Open9xFuncSwData_v210)); }
- t_Open9xFuncSwData_v210(FuncSwData&);
-
}) Open9xFuncSwData_v210;
PACK(typedef struct t_Open9xFrSkyChannelData_v201 {
@@ -316,8 +288,6 @@ PACK(typedef struct t_Open9xFrSkyChannelData_v201 {
operator FrSkyChannelData();
t_Open9xFrSkyChannelData_v201() { memset(this, 0, sizeof(t_Open9xFrSkyChannelData_v201)); }
- t_Open9xFrSkyChannelData_v201(FrSkyChannelData&);
-
}) Open9xFrSkyChannelData_v201;
PACK(typedef struct t_Open9xFrSkyChannelData_v203 {
@@ -333,8 +303,6 @@ PACK(typedef struct t_Open9xFrSkyChannelData_v203 {
operator FrSkyChannelData();
t_Open9xFrSkyChannelData_v203() { memset(this, 0, sizeof(t_Open9xFrSkyChannelData_v203)); }
- t_Open9xFrSkyChannelData_v203(FrSkyChannelData&);
-
}) Open9xFrSkyChannelData_v203;
PACK(typedef struct t_Open9xFrSkyChannelData_v204 {
@@ -348,8 +316,6 @@ PACK(typedef struct t_Open9xFrSkyChannelData_v204 {
operator FrSkyChannelData();
t_Open9xFrSkyChannelData_v204() { memset(this, 0, sizeof(t_Open9xFrSkyChannelData_v204)); }
- t_Open9xFrSkyChannelData_v204(FrSkyChannelData&);
-
}) Open9xFrSkyChannelData_v204;
PACK(typedef struct t_Open9xFrSkyChannelData_v208 {
@@ -363,37 +329,30 @@ PACK(typedef struct t_Open9xFrSkyChannelData_v208 {
operator FrSkyChannelData();
t_Open9xFrSkyChannelData_v208() { memset(this, 0, sizeof(t_Open9xFrSkyChannelData_v208)); }
- t_Open9xFrSkyChannelData_v208(FrSkyChannelData&);
-
}) Open9xFrSkyChannelData_v208;
PACK(typedef struct t_Open9xFrSkyData_v201 {
- Open9xFrSkyChannelData_v201 channels[2];
-
- operator FrSkyData();
- t_Open9xFrSkyData_v201() { memset(this, 0, sizeof(t_Open9xFrSkyData_v201)); }
+ Open9xFrSkyChannelData_v201 channels[2];
+ operator FrSkyData();
+ t_Open9xFrSkyData_v201() { memset(this, 0, sizeof(t_Open9xFrSkyData_v201)); }
}) Open9xFrSkyData_v201;
PACK(typedef struct t_Open9xFrSkyData_v202 {
- Open9xFrSkyChannelData_v201 channels[2];
- uint8_t usrProto:2; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
- uint8_t spare:6;
-
- operator FrSkyData();
- t_Open9xFrSkyData_v202() { memset(this, 0, sizeof(t_Open9xFrSkyData_v202)); }
- t_Open9xFrSkyData_v202(FrSkyData&);
+ Open9xFrSkyChannelData_v201 channels[2];
+ uint8_t usrProto:2; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
+ uint8_t spare:6;
+ operator FrSkyData();
+ t_Open9xFrSkyData_v202() { memset(this, 0, sizeof(t_Open9xFrSkyData_v202)); }
}) Open9xFrSkyData_v202;
PACK(typedef struct t_Open9xFrSkyData_v203 {
- Open9xFrSkyChannelData_v203 channels[2];
- uint8_t usrProto; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
-
- operator FrSkyData();
- t_Open9xFrSkyData_v203() { memset(this, 0, sizeof(t_Open9xFrSkyData_v203)); }
- t_Open9xFrSkyData_v203(FrSkyData&);
+ Open9xFrSkyChannelData_v203 channels[2];
+ uint8_t usrProto; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
+ operator FrSkyData();
+ t_Open9xFrSkyData_v203() { memset(this, 0, sizeof(t_Open9xFrSkyData_v203)); }
}) Open9xFrSkyData_v203;
PACK(typedef struct t_Open9xFrSkyBarData_v204 {
@@ -403,8 +362,6 @@ PACK(typedef struct t_Open9xFrSkyBarData_v204 {
operator FrSkyBarData();
t_Open9xFrSkyBarData_v204() { memset(this, 0, sizeof(t_Open9xFrSkyBarData_v204)); }
- t_Open9xFrSkyBarData_v204(FrSkyBarData&);
-
}) Open9xFrSkyBarData_v204;
PACK(typedef struct t_Open9xFrSkyData_v204 {
@@ -417,7 +374,6 @@ PACK(typedef struct t_Open9xFrSkyData_v204 {
operator FrSkyData();
t_Open9xFrSkyData_v204() { memset(this, 0, sizeof(t_Open9xFrSkyData_v204)); }
- t_Open9xFrSkyData_v204(FrSkyData&);
}) Open9xFrSkyData_v204;
PACK(typedef struct t_Open9xFrSkyData_v205 {
@@ -431,7 +387,6 @@ PACK(typedef struct t_Open9xFrSkyData_v205 {
operator FrSkyData();
t_Open9xFrSkyData_v205() { memset(this, 0, sizeof(t_Open9xFrSkyData_v205)); }
- t_Open9xFrSkyData_v205(FrSkyData&);
}) Open9xFrSkyData_v205;
PACK(typedef struct t_Open9xFrSkyData_v208 {
@@ -445,7 +400,6 @@ PACK(typedef struct t_Open9xFrSkyData_v208 {
operator FrSkyData();
t_Open9xFrSkyData_v208() { memset(this, 0, sizeof(t_Open9xFrSkyData_v208)); }
- t_Open9xFrSkyData_v208(FrSkyData&);
}) Open9xFrSkyData_v208;
PACK(typedef struct t_Open9xFrSkyData_v210 {
@@ -466,7 +420,6 @@ PACK(typedef struct t_Open9xFrSkyData_v210 {
operator FrSkyData();
t_Open9xFrSkyData_v210() { memset(this, 0, sizeof(t_Open9xFrSkyData_v210)); }
- t_Open9xFrSkyData_v210(FrSkyData&);
}) Open9xFrSkyData_v210;
PACK(typedef struct t_Open9xSwashRingData_v208 { // Swash Ring data
@@ -479,8 +432,6 @@ PACK(typedef struct t_Open9xSwashRingData_v208 { // Swash Ring data
operator SwashRingData();
t_Open9xSwashRingData_v208() { memset(this, 0, sizeof(t_Open9xSwashRingData_v208)); }
- t_Open9xSwashRingData_v208(SwashRingData&);
-
}) Open9xSwashRingData_v208;
PACK(typedef struct t_Open9xSwashRingData_v209 { // Swash Ring data
@@ -493,8 +444,6 @@ PACK(typedef struct t_Open9xSwashRingData_v209 { // Swash Ring data
operator SwashRingData();
t_Open9xSwashRingData_v209() { memset(this, 0, sizeof(t_Open9xSwashRingData_v209)); }
- t_Open9xSwashRingData_v209(SwashRingData&);
-
}) Open9xSwashRingData_v209;
PACK(typedef struct t_Open9xPhaseData_v201 {
@@ -507,7 +456,6 @@ PACK(typedef struct t_Open9xPhaseData_v201 {
operator PhaseData();
t_Open9xPhaseData_v201() { memset(this, 0, sizeof(t_Open9xPhaseData_v201)); }
- t_Open9xPhaseData_v201(PhaseData &eepe);
}) Open9xPhaseData_v201;
PACK(typedef struct t_Open9xTimerData_v201 {
@@ -526,7 +474,6 @@ PACK(typedef struct t_Open9xTimerData_v202 {
operator TimerData();
t_Open9xTimerData_v202() { memset(this, 0, sizeof(t_Open9xTimerData_v202)); }
- t_Open9xTimerData_v202(TimerData &eepe);
}) Open9xTimerData_v202;
PACK(typedef struct t_Open9xTimerDataExtra {
@@ -579,8 +526,6 @@ PACK(typedef struct t_Open9xModelData_v201 {
operator ModelData();
t_Open9xModelData_v201() { memset(this, 0, sizeof(t_Open9xModelData_v201)); }
- t_Open9xModelData_v201(ModelData&);
-
}) Open9xModelData_v201;
PACK(typedef struct t_Open9xModelData_v202 {
@@ -615,8 +560,6 @@ PACK(typedef struct t_Open9xModelData_v202 {
operator ModelData();
t_Open9xModelData_v202() { memset(this, 0, sizeof(t_Open9xModelData_v202)); }
- t_Open9xModelData_v202(ModelData&);
-
}) Open9xModelData_v202;
PACK(typedef struct t_Open9xModelData_v203 {
@@ -650,8 +593,6 @@ PACK(typedef struct t_Open9xModelData_v203 {
operator ModelData();
t_Open9xModelData_v203() { memset(this, 0, sizeof(t_Open9xModelData_v203)); }
- t_Open9xModelData_v203(ModelData&);
-
}) Open9xModelData_v203;
PACK(typedef struct t_Open9xModelData_v204 {
@@ -686,8 +627,6 @@ PACK(typedef struct t_Open9xModelData_v204 {
operator ModelData();
t_Open9xModelData_v204() { memset(this, 0, sizeof(t_Open9xModelData_v204)); }
- t_Open9xModelData_v204(ModelData&);
-
}) Open9xModelData_v204;
PACK(typedef struct t_Open9xModelData_v205 {
@@ -723,8 +662,6 @@ PACK(typedef struct t_Open9xModelData_v205 {
operator ModelData();
t_Open9xModelData_v205() { memset(this, 0, sizeof(t_Open9xModelData_v205)); }
- t_Open9xModelData_v205(ModelData&);
-
}) Open9xModelData_v205;
PACK(typedef struct t_Open9xModelData_v208 {
@@ -764,8 +701,6 @@ PACK(typedef struct t_Open9xModelData_v208 {
operator ModelData();
t_Open9xModelData_v208() { memset(this, 0, sizeof(t_Open9xModelData_v208)); }
- t_Open9xModelData_v208(ModelData&);
-
}) Open9xModelData_v208;
PACK(typedef struct t_Open9xModelData_v209 {
@@ -806,8 +741,6 @@ PACK(typedef struct t_Open9xModelData_v209 {
operator ModelData();
t_Open9xModelData_v209() { memset(this, 0, sizeof(t_Open9xModelData_v209)); }
- t_Open9xModelData_v209(ModelData&);
-
}) Open9xModelData_v209;
PACK(typedef struct t_Open9xModelData_v210 {
@@ -846,8 +779,6 @@ PACK(typedef struct t_Open9xModelData_v210 {
operator ModelData();
t_Open9xModelData_v210() { memset(this, 0, sizeof(t_Open9xModelData_v210)); }
- t_Open9xModelData_v210(ModelData&);
-
}) Open9xModelData_v210;
PACK(typedef struct t_Open9xModelData_v211 {
@@ -884,8 +815,6 @@ PACK(typedef struct t_Open9xModelData_v211 {
operator ModelData();
t_Open9xModelData_v211() { memset(this, 0, sizeof(t_Open9xModelData_v211)); }
- t_Open9xModelData_v211(ModelData&);
-
}) Open9xModelData_v211;
#endif
diff --git a/companion/src/firmwares/opentx/open9xGruvin9xsimulator.cpp b/companion/src/firmwares/opentx/opentxGruvin9xsimulator.cpp
similarity index 95%
rename from companion/src/firmwares/opentx/open9xGruvin9xsimulator.cpp
rename to companion/src/firmwares/opentx/opentxGruvin9xsimulator.cpp
index 9cb478b16..0d2f07771 100644
--- a/companion/src/firmwares/opentx/open9xGruvin9xsimulator.cpp
+++ b/companion/src/firmwares/opentx/opentxGruvin9xsimulator.cpp
@@ -14,9 +14,9 @@
*
*/
-#include "open9xGruvin9xsimulator.h"
-#include "open9xinterface.h"
-#include "open9xeeprom.h"
+#include "opentxGruvin9xsimulator.h"
+#include "opentxinterface.h"
+#include "opentxeeprom.h"
#define SIMU
#define SIMU_EXCEPTIONS
@@ -98,7 +98,7 @@ bool hasExtendedTrims()
uint8_t getStickMode()
{
- return g_eeGeneral.stickMode;
+ return limit(0, g_eeGeneral.stickMode, 3);
}
}
@@ -160,7 +160,7 @@ void Open9xGruvin9xSimulator::setValues(TxInputs &inputs)
void Open9xGruvin9xSimulator::setTrim(unsigned int idx, int value)
{
- idx = Open9xGruvin9x::modn12x3[4*getStickMode() + idx] - 1;
+ idx = Open9xGruvin9x::modn12x3[4*getStickMode() + idx];
uint8_t phase = getTrimFlightPhase(getFlightPhase(), idx);
setTrimValue(phase, idx, value);
}
@@ -174,7 +174,7 @@ void Open9xGruvin9xSimulator::getTrims(Trims & trims)
}
for (int i=0; i<2; i++) {
- uint8_t idx = Open9xGruvin9x::modn12x3[4*getStickMode() + i] - 1;
+ uint8_t idx = Open9xGruvin9x::modn12x3[4*getStickMode() + i];
int16_t tmp = trims.values[i];
trims.values[i] = trims.values[idx];
trims.values[idx] = tmp;
diff --git a/companion/src/firmwares/opentx/open9xGruvin9xsimulator.h b/companion/src/firmwares/opentx/opentxGruvin9xsimulator.h
similarity index 100%
rename from companion/src/firmwares/opentx/open9xGruvin9xsimulator.h
rename to companion/src/firmwares/opentx/opentxGruvin9xsimulator.h
diff --git a/companion/src/firmwares/opentx/open9xM128simulator.cpp b/companion/src/firmwares/opentx/opentxM128simulator.cpp
similarity index 94%
rename from companion/src/firmwares/opentx/open9xM128simulator.cpp
rename to companion/src/firmwares/opentx/opentxM128simulator.cpp
index a82b53b0c..f169a10d3 100644
--- a/companion/src/firmwares/opentx/open9xM128simulator.cpp
+++ b/companion/src/firmwares/opentx/opentxM128simulator.cpp
@@ -14,9 +14,9 @@
*
*/
-#include "open9xM128simulator.h"
-#include "open9xinterface.h"
-#include "open9xeeprom.h"
+#include "opentxM128simulator.h"
+#include "opentxinterface.h"
+#include "opentxeeprom.h"
#define SIMU
#define SIMU_EXCEPTIONS
@@ -96,7 +96,7 @@ bool hasExtendedTrims()
uint8_t getStickMode()
{
- return g_eeGeneral.stickMode;
+ return limit(0, g_eeGeneral.stickMode, 3);
}
}
@@ -154,7 +154,7 @@ void Open9xM128Simulator::setValues(TxInputs &inputs)
void Open9xM128Simulator::setTrim(unsigned int idx, int value)
{
- idx = Open9xM128::modn12x3[4*getStickMode() + idx] - 1;
+ idx = Open9xM128::modn12x3[4*getStickMode() + idx];
uint8_t phase = getTrimFlightPhase(getFlightPhase(), idx);
setTrimValue(phase, idx, value);
}
@@ -168,7 +168,7 @@ void Open9xM128Simulator::getTrims(Trims & trims)
}
for (int i=0; i<2; i++) {
- uint8_t idx = Open9xM128::modn12x3[4*getStickMode() + i] - 1;
+ uint8_t idx = Open9xM128::modn12x3[4*getStickMode() + i];
int16_t tmp = trims.values[i];
trims.values[i] = trims.values[idx];
trims.values[idx] = tmp;
diff --git a/companion/src/firmwares/opentx/open9xM128simulator.h b/companion/src/firmwares/opentx/opentxM128simulator.h
similarity index 100%
rename from companion/src/firmwares/opentx/open9xM128simulator.h
rename to companion/src/firmwares/opentx/opentxM128simulator.h
diff --git a/companion/src/firmwares/opentx/open9xSky9xsimulator.cpp b/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp
similarity index 95%
rename from companion/src/firmwares/opentx/open9xSky9xsimulator.cpp
rename to companion/src/firmwares/opentx/opentxSky9xsimulator.cpp
index d724028ec..9f444c808 100644
--- a/companion/src/firmwares/opentx/open9xSky9xsimulator.cpp
+++ b/companion/src/firmwares/opentx/opentxSky9xsimulator.cpp
@@ -14,8 +14,8 @@
*
*/
-#include "open9xSky9xsimulator.h"
-#include "open9xinterface.h"
+#include "opentxSky9xsimulator.h"
+#include "opentxinterface.h"
#define SIMU
#define SIMU_EXCEPTIONS
@@ -125,7 +125,7 @@ bool hasExtendedTrims()
uint8_t getStickMode()
{
- return g_eeGeneral.stickMode;
+ return limit(0, g_eeGeneral.stickMode, 3);
}
}
@@ -193,7 +193,7 @@ void Open9xSky9xSimulator::setValues(TxInputs &inputs)
void Open9xSky9xSimulator::setTrim(unsigned int idx, int value)
{
- idx = Open9xSky9x::modn12x3[4*getStickMode() + idx] - 1;
+ idx = Open9xSky9x::modn12x3[4*getStickMode() + idx];
uint8_t phase = getTrimFlightPhase(getFlightPhase(), idx);
setTrimValue(phase, idx, value);
}
@@ -207,7 +207,7 @@ void Open9xSky9xSimulator::getTrims(Trims & trims)
}
for (int i=0; i<2; i++) {
- uint8_t idx = Open9xSky9x::modn12x3[4*getStickMode() + i] - 1;
+ uint8_t idx = Open9xSky9x::modn12x3[4*getStickMode() + i];
int16_t tmp = trims.values[i];
trims.values[i] = trims.values[idx];
trims.values[idx] = tmp;
diff --git a/companion/src/firmwares/opentx/open9xSky9xsimulator.h b/companion/src/firmwares/opentx/opentxSky9xsimulator.h
similarity index 100%
rename from companion/src/firmwares/opentx/open9xSky9xsimulator.h
rename to companion/src/firmwares/opentx/opentxSky9xsimulator.h
diff --git a/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp b/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp
index 6f216273a..ae4424797 100644
--- a/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp
+++ b/companion/src/firmwares/opentx/opentxTaranisSimulator.cpp
@@ -15,7 +15,7 @@
*/
#include "opentxTaranisSimulator.h"
-#include "open9xinterface.h"
+#include "opentxinterface.h"
#define SIMU
#define SIMU_EXCEPTIONS
@@ -128,7 +128,7 @@ bool hasExtendedTrims()
uint8_t getStickMode()
{
- return g_eeGeneral.stickMode;
+ return limit(0, g_eeGeneral.stickMode, 3);
}
void resetTrims()
@@ -200,7 +200,7 @@ void OpentxTaranisSimulator::setValues(TxInputs &inputs)
void OpentxTaranisSimulator::setTrim(unsigned int idx, int value)
{
- idx = Open9xX9D::modn12x3[4*getStickMode() + idx] - 1;
+ idx = Open9xX9D::modn12x3[4*getStickMode() + idx];
uint8_t phase = getTrimFlightPhase(getFlightPhase(), idx);
setTrimValue(phase, idx, value);
}
@@ -214,7 +214,7 @@ void OpentxTaranisSimulator::getTrims(Trims & trims)
}
for (int i=0; i<2; i++) {
- uint8_t idx = Open9xX9D::modn12x3[4*getStickMode() + i] - 1;
+ uint8_t idx = Open9xX9D::modn12x3[4*getStickMode() + i];
int16_t tmp = trims.values[i];
trims.values[i] = trims.values[idx];
trims.values[idx] = tmp;
diff --git a/companion/src/firmwares/opentx/open9xeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp
similarity index 86%
rename from companion/src/firmwares/opentx/open9xeeprom.cpp
rename to companion/src/firmwares/opentx/opentxeeprom.cpp
index 9601cb35a..b723ac0a2 100644
--- a/companion/src/firmwares/opentx/open9xeeprom.cpp
+++ b/companion/src/firmwares/opentx/opentxeeprom.cpp
@@ -1,7 +1,7 @@
#include
#include
#include "helpers.h"
-#include "open9xeeprom.h"
+#include "opentxeeprom.h"
#include
#define IS_DBLEEPROM(board, version) ((board==BOARD_GRUVIN9X || board==BOARD_M128) && version >= 213)
@@ -18,10 +18,11 @@
#define MAX_PHASES(board, version) (IS_ARM(board) ? 9 : (IS_DBLRAM(board, version) ? 6 : 5))
#define MAX_MIXERS(board, version) (IS_ARM(board) ? 64 : 32)
#define MAX_CHANNELS(board, version) (IS_ARM(board) ? 32 : 16)
-#define MAX_EXPOS(board, version) (IS_ARM(board) ? 32 : (IS_DBLRAM(board, version) ? 16 : 14))
+#define MAX_EXPOS(board, version) (IS_ARM(board) ? ((IS_TARANIS(board) && version >= 216) ? 64 : 32) : (IS_DBLRAM(board, version) ? 16 : 14))
#define MAX_CUSTOM_SWITCHES(board, version) (IS_ARM(board) ? 32 : (IS_DBLEEPROM(board, version) ? 15 : 12))
#define MAX_CUSTOM_FUNCTIONS(board, version) (IS_ARM(board) ? 32 : (IS_DBLEEPROM(board, version) ? 24 : 16))
-#define MAX_CURVES(board) (IS_ARM(board) ? O9X_ARM_MAX_CURVES : O9X_MAX_CURVES)
+#define MAX_CURVES(board, version) (IS_ARM(board) ? ((IS_TARANIS(board) && version >= 216) ? 32 : 16) : O9X_MAX_CURVES)
+#define MAX_GVARS(board, version) ((IS_ARM(board) && version >= 216) ? 9 : 5)
#define IS_RELEASE_21_MARCH_2013(board, version) (version >= 214 || (!IS_ARM(board) && version >= 213))
#define IS_RELEASE_23_MARCH_2013(board, version) (version >= 214 || (board==BOARD_STOCK && version >= 213))
@@ -134,6 +135,16 @@ class SourcesConversionTable: public ConversionTable {
addConversion(RawSource(SOURCE_TYPE_NONE), val++);
}
+ if (IS_TARANIS(board) && version >= 216) {
+ for (int i=0; i<32; i++)
+ addConversion(RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i), val++);
+ for (int i=0; i<3; i++) {
+ for (int j=0; j<6; j++) {
+ addConversion(RawSource(SOURCE_TYPE_LUA_INPUT, i*16+j), val++);
+ }
+ }
+ }
+
for (int i=0; i<4+MAX_POTS(board); i++)
addConversion(RawSource(SOURCE_TYPE_STICK, i), val++);
@@ -352,6 +363,36 @@ class SourceField: public ConversionField< UnsignedField > {
unsigned int _source;
};
+class CurveReferenceField: public TransformedField {
+ public:
+ CurveReferenceField(CurveReference & curve, BoardEnum board, unsigned int version):
+ TransformedField(internalField),
+ curve(curve),
+ _curve_type(0)
+ {
+ internalField.Append(new UnsignedField<8>(_curve_type));
+ internalField.Append(new SignedField<8>(curve.value));
+ }
+
+ virtual void beforeExport()
+ {
+ if (curve.value != 0)
+ _curve_type = (unsigned int)curve.type;
+ else
+ _curve_type = 0;
+ }
+
+ virtual void afterImport()
+ {
+ curve.type = (CurveReference::CurveRefType)_curve_type;
+ }
+
+ protected:
+ StructField internalField;
+ CurveReference & curve;
+ unsigned int _curve_type;
+};
+
class HeliField: public StructField {
public:
HeliField(SwashRingData & heli, BoardEnum board, unsigned int version, unsigned int variant)
@@ -409,7 +450,7 @@ class PhaseField: public TransformedField {
}
if (board != BOARD_STOCK && (board != BOARD_M128 || version < 215)) {
- for (int i=0; i(phase.gvars[i]));
}
}
@@ -595,7 +636,25 @@ class MixField: public TransformedField {
board(board),
version(version)
{
- if (IS_ARM(board)) {
+ if (IS_TARANIS(board) && version >= 216) {
+ internalField.Append(new UnsignedField<8>(_destCh));
+ internalField.Append(new UnsignedField<16>(mix.phases));
+ internalField.Append(new UnsignedField<8>((unsigned int &)mix.mltpx));
+ internalField.Append(new SignedField<16>(_weight));
+ internalField.Append(new SwitchField<8>(mix.swtch, board, version));
+ internalField.Append(new CurveReferenceField(mix.curve, board, version));
+ internalField.Append(new UnsignedField<4>(mix.mixWarn));
+ internalField.Append(new UnsignedField<4>(mix.srcVariant));
+ internalField.Append(new UnsignedField<8>(mix.delayUp));
+ internalField.Append(new UnsignedField<8>(mix.delayDown));
+ internalField.Append(new UnsignedField<8>(mix.speedUp));
+ internalField.Append(new UnsignedField<8>(mix.speedDown));
+ internalField.Append(new SourceField<8>(mix.srcRaw, board, version, FLAG_NOTELEMETRY));
+ internalField.Append(new SignedField<16>(_offset));
+ internalField.Append(new ZCharField<8>(mix.name));
+ internalField.Append(new SpareBitsField<8>());
+ }
+ else if (IS_ARM(board)) {
internalField.Append(new UnsignedField<8>(_destCh));
internalField.Append(new UnsignedField<16>(mix.phases));
internalField.Append(new BoolField<1>(_curveMode));
@@ -680,8 +739,18 @@ class MixField: public TransformedField {
{
if (mix.destCh && mix.srcRaw.type != SOURCE_TYPE_NONE) {
_destCh = mix.destCh - 1;
- _curveMode = mix.curve;
- _curveParam = (mix.curve ? mix.curve : smallGvarToEEPROM(mix.differential));
+ if (mix.curve.type == CurveReference::CURVE_REF_CUSTOM) {
+ _curveMode = true;
+ _curveParam = 6 + mix.curve.value;
+ }
+ else if (mix.curve.type == CurveReference::CURVE_REF_FUNC) {
+ _curveMode = true;
+ _curveParam = mix.curve.value;
+ }
+ else if (mix.curve.type == CurveReference::CURVE_REF_DIFF) {
+ _curveMode = 0;
+ _curveParam = smallGvarToEEPROM(mix.curve.value);
+ }
}
else {
mix.clear();
@@ -707,12 +776,14 @@ class MixField: public TransformedField {
{
if (mix.srcRaw.type != SOURCE_TYPE_NONE) {
mix.destCh = _destCh + 1;
- mix.curve = 0;
- mix.differential = 0;
- if (_curveMode)
- mix.curve = _curveParam;
- else
- mix.differential = smallGvarToC9x(_curveParam);
+ if (!IS_ARM(board) || version < 216) {
+ if (!_curveMode)
+ mix.curve = CurveReference(CurveReference::CURVE_REF_DIFF, smallGvarToC9x(_curveParam));
+ else if (_curveParam > 6)
+ mix.curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, _curveParam-6);
+ else
+ mix.curve = CurveReference(CurveReference::CURVE_REF_FUNC, _curveParam);
+ }
}
if (IS_ARM(board)) {
@@ -748,9 +819,23 @@ class ExpoField: public TransformedField {
TransformedField(internalField),
internalField("Expo"),
expo(expo),
- board(board)
+ board(board),
+ version(version)
{
- if (IS_ARM(board)) {
+ if (IS_TARANIS(board) && version >= 216) {
+ internalField.Append(new SourceField<8>(expo.srcRaw, board, version, 0));
+ internalField.Append(new UnsignedField<16>(expo.scale));
+ internalField.Append(new UnsignedField<8>(expo.chn, "Channel"));
+ internalField.Append(new SwitchField<8>(expo.swtch, board, version));
+ internalField.Append(new UnsignedField<16>(expo.phases));
+ internalField.Append(new SignedField<8>(_weight, "Weight"));
+ internalField.Append(new SignedField<8>(expo.carryTrim));
+ internalField.Append(new ZCharField<8>(expo.name));
+ internalField.Append(new SignedField<8>(expo.offset, "Offset"));
+ internalField.Append(new CurveReferenceField(expo.curve, board, version));
+ internalField.Append(new SpareBitsField<8>());
+ }
+ else if (IS_ARM(board)) {
internalField.Append(new UnsignedField<8>(expo.mode));
internalField.Append(new UnsignedField<8>(expo.chn));
internalField.Append(new SwitchField<8>(expo.swtch, board, version));
@@ -789,22 +874,41 @@ class ExpoField: public TransformedField {
virtual void beforeExport()
{
- _curveMode = (expo.curveMode && expo.curveParam);
_weight = smallGvarToEEPROM(expo.weight);
- _curveParam = smallGvarToEEPROM(expo.curveParam);
+ if (!IS_TARANIS(board) || version < 216) {
+ if (expo.curve.type==CurveReference::CURVE_REF_FUNC && expo.curve.value) {
+ _curveMode = true;
+ _curveParam = expo.curve.value;
+ }
+ else if (expo.curve.type==CurveReference::CURVE_REF_CUSTOM && expo.curve.value) {
+ _curveMode = true;
+ _curveParam = expo.curve.value+6;
+ }
+ else {
+ _curveMode = false;
+ _curveParam = smallGvarToEEPROM(expo.curve.value);
+ }
+ }
}
virtual void afterImport()
{
- expo.curveMode = _curveMode;
expo.weight = smallGvarToC9x(_weight);
- expo.curveParam = smallGvarToC9x(_curveParam);
+ if (!IS_TARANIS(board) || version < 216) {
+ if (!_curveMode)
+ expo.curve = CurveReference(CurveReference::CURVE_REF_EXPO, smallGvarToC9x(_curveParam));
+ else if (_curveParam > 6)
+ expo.curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, _curveParam-6);
+ else
+ expo.curve = CurveReference(CurveReference::CURVE_REF_FUNC, _curveParam);
+ }
}
protected:
StructField internalField;
ExpoData & expo;
BoardEnum board;
+ unsigned int version;
bool _curveMode;
int _weight;
int _curveParam;
@@ -812,36 +916,56 @@ class ExpoField: public TransformedField {
class LimitField: public StructField {
public:
- LimitField(LimitData & limit, BoardEnum board):
+ LimitField(LimitData & limit, BoardEnum board, unsigned int version):
StructField("Limit")
{
- Append(new ConversionField< SignedField<8> >(limit.min, +100));
- Append(new ConversionField< SignedField<8> >(limit.max, -100));
+ if (IS_ARM(board) && version >= 216) {
+ Append(new ConversionField< SignedField<16> >(limit.min, +1000));
+ Append(new ConversionField< SignedField<16> >(limit.max, -1000));
+ }
+ else {
+ Append(new ConversionField< SignedField<8> >(limit.min, +100, 10));
+ Append(new ConversionField< SignedField<8> >(limit.max, -100, 10));
+ }
Append(new SignedField<8>(limit.ppmCenter));
Append(new SignedField<14>(limit.offset));
Append(new BoolField<1>(limit.symetrical));
Append(new BoolField<1>(limit.revert));
- if (HAS_LARGE_LCD(board))
+ if (HAS_LARGE_LCD(board)) {
Append(new ZCharField<6>(limit.name));
+ }
+ if (IS_TARANIS(board) && version >= 216) {
+ Append(new SignedField<8>(limit.curve.value));
+ }
}
};
class CurvesField: public TransformedField {
public:
- CurvesField(CurveData * curves, BoardEnum board):
+ CurvesField(CurveData * curves, BoardEnum board, unsigned int version):
TransformedField(internalField),
internalField("Curves"),
curves(curves),
board(board),
- maxCurves(MAX_CURVES(board)),
+ version(version),
+ maxCurves(MAX_CURVES(board, version)),
maxPoints(IS_ARM(board) ? O9X_ARM_NUM_POINTS : O9X_NUM_POINTS)
{
for (int i=0; i= 216) {
+ internalField.Append(new UnsignedField<3>((unsigned int &)curves[i].type));
+ internalField.Append(new BoolField<1>(curves[i].smooth));
+ internalField.Append(new SpareBitsField<4>());
+ internalField.Append(new ConversionField< SignedField<8> >(curves[i].count, -5));
+ }
+ else if (IS_ARM(board)) {
internalField.Append(new SignedField<16>(_curves[i]));
- else
+ }
+ else {
internalField.Append(new SignedField<8>(_curves[i]));
+ }
}
+
for (int i=0; i(_points[i]));
}
@@ -853,46 +977,56 @@ class CurvesField: public TransformedField {
int * cur = &_points[0];
int offset = 0;
+
for (int i=0; icustom ? curve->count * 2 - 2 : curve->count) - 5;
- if (offset > maxPoints - 5 * maxCurves) {
+ int size = (curve->type == CurveData::CURVE_TYPE_CUSTOM ? curve->count * 2 - 2 : curve->count);
+ if (offset+size > maxPoints) {
EEPROMWarnings += ::QObject::tr("openTx only accepts %1 points in all curves").arg(maxPoints) + "\n";
break;
}
- _curves[i] = offset;
+ if (!IS_TARANIS(board) || version < 216) {
+ _curves[i] = offset - (5*i);
+ }
for (int j=0; jcount; j++) {
*cur++ = curve->points[j].y;
}
- if (curve->custom) {
+ if (curve->type == CurveData::CURVE_TYPE_CUSTOM) {
for (int j=1; jcount-1; j++) {
*cur++ = curve->points[j].x;
}
}
+ offset += size;
}
}
virtual void afterImport()
{
+ int * cur = &_points[0];
+
for (int i=0; icount = (size / 2) + 1;
- curve->custom = true;
+ if (!IS_TARANIS(board) || version < 216) {
+ int * next = &_points[5*(i+1) + _curves[i]];
+ int size = next - cur;
+ if (size % 2 == 0) {
+ curve->count = (size / 2) + 1;
+ curve->type = CurveData::CURVE_TYPE_CUSTOM;
+ }
+ else {
+ curve->count = size;
+ curve->type = CurveData::CURVE_TYPE_STANDARD;
+ }
}
- else {
- curve->count = size;
- curve->custom = false;
+
+ for (int j=0; jcount; j++) {
+ curve->points[j].y = *cur++;
}
- for (int j=0; jcount; j++)
- curve->points[j].y = cur[j];
- if (curve->custom) {
+
+ if (curve->type == CurveData::CURVE_TYPE_CUSTOM) {
curve->points[0].x = -100;
for (int j=1; jcount-1; j++)
- curve->points[j].x = cur[curve->count+j-1];
+ curve->points[j].x = *cur++;
curve->points[curve->count-1].x = +100;
}
else {
@@ -906,10 +1040,11 @@ class CurvesField: public TransformedField {
StructField internalField;
CurveData *curves;
BoardEnum board;
+ unsigned int version;
int maxCurves;
int maxPoints;
- int _curves[O9X_ARM_MAX_CURVES];
- int _points[O9X_ARM_NUM_POINTS];
+ int _curves[C9X_MAX_CURVES];
+ int _points[C9X_MAX_CURVES*C9X_MAX_POINTS*2];
};
class CustomSwitchesFunctionsTable: public ConversionTable {
@@ -1238,7 +1373,7 @@ class CustomFunctionField: public TransformedField {
else if (fn.func == FuncPlayPrompt || fn.func == FuncBackgroundMusic) {
memcpy(_arm_param, fn.paramarm, sizeof(_arm_param));
}
- else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGV5) {
+ else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) {
unsigned int value;
if (version >= 214) {
_mode = fn.adjustMode;
@@ -1268,7 +1403,7 @@ class CustomFunctionField: public TransformedField {
/* the default behavior */
_param = fn.param;
_union_param = (fn.enabled ? 1 : 0);
- if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGV5) {
+ if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) {
if (version >= 213) {
_union_param += (fn.adjustMode << 1);
if (fn.adjustMode == 1)
@@ -1321,7 +1456,7 @@ class CustomFunctionField: public TransformedField {
else if (fn.func == FuncVolume) {
sourcesConversionTable->importValue(value, (int &)fn.param);
}
- else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGV5) {
+ else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) {
if (version >= 214) {
fn.adjustMode = _mode;
if (fn.adjustMode == 1)
@@ -1350,7 +1485,7 @@ class CustomFunctionField: public TransformedField {
if (version >= 213) {
fn.enabled = (_union_param & 0x01);
}
- if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGV5) {
+ if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) {
if (version >= 213) {
fn.adjustMode = ((_union_param >> 1) & 0x03);
if (fn.adjustMode == 1)
@@ -1551,7 +1686,14 @@ class FrskyField: public StructField {
Append(new UnsignedField<8>(frsky.channels[i].multiplier, 0, 5, "Multiplier"));
}
Append(new UnsignedField<8>(frsky.usrProto));
- Append(new UnsignedField<8>(frsky.voltsSource));
+ if (version >= 216) {
+ Append(new UnsignedField<7>(frsky.voltsSource));
+ // TODO altitude displayed
+ Append(new SpareBitsField<1>());
+ }
+ else {
+ Append(new UnsignedField<8>(frsky.voltsSource));
+ }
Append(new UnsignedField<8>(frsky.blades));
Append(new UnsignedField<8>(frsky.currentSource));
@@ -1575,6 +1717,12 @@ class FrskyField: public StructField {
Append(new ConversionField< UnsignedField<2> >(frsky.rssiAlarms[i].level, &rssiConversionTable[i], "RSSI"));
Append(new ConversionField< SignedField<6> >(frsky.rssiAlarms[i].value, -45+i*3));
}
+ if (version >= 216) {
+ // TODO uint16_t mAhPersistent:1;
+ // uint16_t storedMah:15;
+ // int8_t fasOffset;
+ Append(new SpareBitsField<24>());
+ }
}
else {
for (int i=0; i<2; i++) {
@@ -1598,7 +1746,7 @@ class FrskyField: public StructField {
Append(new SignedField<4>(frsky.varioMax));
for (int i=0; i<2; i++) {
Append(new ConversionField< UnsignedField<2> >(frsky.rssiAlarms[i].level, &rssiConversionTable[i], "RSSI level"));
- Append(new ConversionField< SignedField<6> >(frsky.rssiAlarms[i].value, -45+i*3, 0, 100, "RSSI value"));
+ Append(new ConversionField< SignedField<6> >(frsky.rssiAlarms[i].value, -45+i*3, 0, 0, 100, "RSSI value"));
}
for (int i=0; i<2; i++) {
Append(new FrskyScreenField(frsky.screens[i], board, version));
@@ -1607,6 +1755,10 @@ class FrskyField: public StructField {
Append(new SignedField<5>(frsky.varioCenterMin));
Append(new UnsignedField<3>(frsky.currentSource));
Append(new SignedField<8>(frsky.varioCenterMax));
+ if (version >= 216) {
+ // TODO int8_t fasOffset;
+ Append(new SpareBitsField<8>());
+ }
}
}
@@ -1658,9 +1810,16 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
for (int i=0; i= 216) {
+ internalField.Append(new UnsignedField<16>(modelData.timers[i].val));
+ internalField.Append(new BoolField<2>(modelData.timers[i].countdownBeep));
+ internalField.Append(new BoolField<1>(modelData.timers[i].minuteBeep));
+ internalField.Append(new BoolField<1>(modelData.timers[i].persistent));
+ internalField.Append(new SpareBitsField<4>());
+ internalField.Append(new SignedField<16>(modelData.timers[i].pvalue));
+ }
+ else if (release21March2013) {
internalField.Append(new UnsignedField<12>(modelData.timers[i].val));
-
internalField.Append(new BoolField<1>(modelData.timers[i].countdownBeep));
internalField.Append(new BoolField<1>(modelData.timers[i].minuteBeep));
if (HAS_PERSISTENT_TIMERS(board)) {
@@ -1688,7 +1847,7 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
internalField.Append(new BoolField<1>(modelData.thrTrim));
- if (IS_TARANIS(board))
+ if (IS_TARANIS(board) || (IS_ARM(board) && version >= 216))
internalField.Append(new SpareBitsField<4>());
else
internalField.Append(new ConversionField< SignedField<4> >(modelData.moduleData[0].channelsCount, &channelsConversionTable, "Channels number", ::QObject::tr("OpenTX doesn't allow this number of channels")));
@@ -1696,7 +1855,7 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
internalField.Append(new UnsignedField<3>(modelData.trimInc));
internalField.Append(new BoolField<1>(modelData.disableThrottleWarning));
- if (IS_TARANIS(board))
+ if (IS_TARANIS(board) || (IS_ARM(board) && version >= 216))
internalField.Append(new SpareBitsField<1>());
else
internalField.Append(new BoolField<1>(modelData.moduleData[0].ppmPulsePol));
@@ -1704,7 +1863,10 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
internalField.Append(new BoolField<1>(modelData.extendedLimits));
internalField.Append(new BoolField<1>(modelData.extendedTrims));
internalField.Append(new BoolField<1>(modelData.throttleReversed));
- internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[0].ppmDelay, exportPpmDelay, importPpmDelay));
+
+ if (!IS_ARM(board) || version < 216) {
+ internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[0].ppmDelay, exportPpmDelay, importPpmDelay));
+ }
if (IS_ARM(board) || board==BOARD_GRUVIN9X)
internalField.Append(new UnsignedField<16>(modelData.beepANACenter));
@@ -1714,10 +1876,10 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
for (int i=0; i(modelData.moduleData[0].ppmFrameLength));
+
+ if (!IS_ARM(board) || version < 216) {
+ internalField.Append(new SignedField<8>(modelData.moduleData[0].ppmFrameLength));
+ }
+
internalField.Append(new UnsignedField<8>(modelData.thrTraceSrc));
- if (!release21March2013)
+ if (!release21March2013) {
internalField.Append(new UnsignedField<8>(modelData.modelId));
+ }
if (IS_TARANIS(board))
internalField.Append(new UnsignedField<16>(modelData.switchWarningStates));
@@ -1737,15 +1904,19 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
internalField.Append(new SwitchesWarningField<8>(modelData.switchWarningStates, board, version));
if ((board == BOARD_STOCK || (board == BOARD_M128 && version >= 215)) && (variant & GVARS_VARIANT)) {
- for (int i=0; i(modelData.phaseData[0].gvars[i]));
}
}
if (board != BOARD_STOCK && (board != BOARD_M128 || version < 215)) {
- for (int i=0; i(modelData.gvars_names[i]));
+ if (version >= 216) {
+ internalField.Append(new BoolField<1>(modelData.gvars_popups[i]));
+ internalField.Append(new SpareBitsField<7>());
+ }
}
}
@@ -1783,15 +1954,23 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
}
if (IS_TARANIS(board)) {
- for (int i=0; i(modelData.curves[i].name));
}
}
+
+ if (IS_TARANIS(board) && version >= 216) {
+ // TODO ScriptData scriptsData[MAX_SCRIPTS];
+ internalField.Append(new SpareBitsField<720>());
+ // TODO char inputNames[MAX_INPUTS][4];
+ internalField.Append(new SpareBitsField<1024>());
+ }
}
void Open9xModelDataNew::beforeExport()
{
// qDebug() << QString("before export model") << modelData.name;
+
for (int module=0; module<3; module++) {
if (modelData.moduleData[module].protocol >= PXX_XJT_X16 && modelData.moduleData[module].protocol <= PXX_XJT_LR12)
subprotocols[module] = modelData.moduleData[module].protocol - PXX_XJT_X16;
@@ -1802,7 +1981,7 @@ void Open9xModelDataNew::beforeExport()
void Open9xModelDataNew::afterImport()
{
- // qDebug() << QString("after import model") << modelData.name;
+ // qDebug() << QString("after import model") << modelData.name ;
for (int module=0; module<3; module++) {
if (modelData.moduleData[module].protocol == PXX_XJT_X16) {
@@ -1866,8 +2045,9 @@ Open9xGeneralDataNew::Open9xGeneralDataNew(GeneralSettings & generalData, BoardE
internalField.Append(new UnsignedField<8>(generalData.inactivityTimer));
if (IS_STOCK(board) && version >= 215) {
internalField.Append(new UnsignedField<3>(generalData.mavbaud));
- } else {
- internalField.Append(new BoolField<1>(generalData.throttleReversed));
+ }
+ else {
+ internalField.Append(new SpareBitsField<1>());
internalField.Append(new BoolField<1>(generalData.minuteBeep));
internalField.Append(new BoolField<1>(generalData.preBeep));
}
@@ -1892,9 +2072,9 @@ Open9xGeneralDataNew::Open9xGeneralDataNew(GeneralSettings & generalData, BoardE
internalField.Append(new UnsignedField<8>(generalData.speakerPitch));
if (IS_ARM(board))
- internalField.Append(new ConversionField< SignedField<8> >(generalData.speakerVolume, -12, 0, 23, "Volume"));
+ internalField.Append(new ConversionField< SignedField<8> >(generalData.speakerVolume, -12, 0, 0, 23, "Volume"));
else
- internalField.Append(new ConversionField< SignedField<8> >(generalData.speakerVolume, -7, 0, 7, "Volume"));
+ internalField.Append(new ConversionField< SignedField<8> >(generalData.speakerVolume, -7, 0, 0, 7, "Volume"));
if (version >= 214 || (!IS_ARM(board) && version >= 213)) {
internalField.Append(new SignedField<8>(generalData.vBatMin));
diff --git a/companion/src/firmwares/opentx/open9xeeprom.h b/companion/src/firmwares/opentx/opentxeeprom.h
similarity index 98%
rename from companion/src/firmwares/opentx/open9xeeprom.h
rename to companion/src/firmwares/opentx/opentxeeprom.h
index 29385f66b..363c46677 100644
--- a/companion/src/firmwares/opentx/open9xeeprom.h
+++ b/companion/src/firmwares/opentx/opentxeeprom.h
@@ -42,7 +42,6 @@
#define O9X_NUM_FSW 16 // number of functions assigned to switches
#define O9X_MAX_CURVES 8
#define O9X_NUM_POINTS (112-O9X_MAX_CURVES)
-#define O9X_MAX_GVARS 5
#define O9X_ARM_MAX_PHASES 9
#define O9X_ARM_MAX_MIXERS 64
@@ -50,7 +49,6 @@
#define O9X_ARM_NUM_CHNOUT 32 // number of real output channels CH1-CH16
#define O9X_ARM_NUM_CSW 32 // number of custom switches
#define O9X_ARM_NUM_FSW 32 // number of functions assigned to switches
-#define O9X_ARM_MAX_CURVES 16
#define O9X_ARM_NUM_POINTS 512
#define O9X_ARM_MAX_CSFUNCOLD 13
#define O9X_ARM_MAX_CSFUNC 15
diff --git a/companion/src/firmwares/opentx/open9xinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp
similarity index 91%
rename from companion/src/firmwares/opentx/open9xinterface.cpp
rename to companion/src/firmwares/opentx/opentxinterface.cpp
index f5e9ce787..73738e0b4 100644
--- a/companion/src/firmwares/opentx/open9xinterface.cpp
+++ b/companion/src/firmwares/opentx/opentxinterface.cpp
@@ -16,14 +16,14 @@
#include
#include
-#include "open9xinterface.h"
-#include "open9xeeprom.h"
+#include "opentxinterface.h"
+#include "opentxeeprom.h"
#include "open9xGruvin9xeeprom.h"
#include "open9xSky9xeeprom.h"
-#include "open9xsimulator.h"
-#include "open9xM128simulator.h"
-#include "open9xGruvin9xsimulator.h"
-#include "open9xSky9xsimulator.h"
+#include "opentxsimulator.h"
+#include "opentxM128simulator.h"
+#include "opentxGruvin9xsimulator.h"
+#include "opentxSky9xsimulator.h"
#include "opentxTaranisSimulator.h"
#include "file.h"
@@ -278,15 +278,7 @@ bool Open9xInterface::saveGeneral(GeneralSettings &settings, BoardEnum board, ui
}
template
-bool Open9xInterface::saveModel(unsigned int index, ModelData &model)
-{
- T open9xModel(model);
- int sz = efile->writeRlc2(FILE_MODEL(index), FILE_TYP_MODEL, (uint8_t*)&open9xModel, sizeof(T));
- return (sz == sizeof(T));
-}
-
-template
-bool Open9xInterface::saveModelVariant(unsigned int index, ModelData &model, unsigned int version, unsigned int variant)
+bool Open9xInterface::saveModel(unsigned int index, ModelData &model, unsigned int version, unsigned int variant)
{
T open9xModel(model, board, version, variant);
// open9xModel.Dump();
@@ -371,16 +363,16 @@ int Open9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t varian
case BOARD_TARANIS:
case BOARD_TARANIS_REV4a:
case BOARD_SKY9X:
- version = 215;
+ version = 216;
break;
case BOARD_GRUVIN9X:
- version = 214;
+ version = 216;
break;
case BOARD_M128:
- version = 215;
+ version = 216;
break;
case BOARD_STOCK:
- version = 213;
+ version = 216;
break;
}
}
@@ -389,81 +381,21 @@ int Open9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t varian
efile->EeFsCreate(eeprom, size, board);
- int result = 0;
-
if (board == BOARD_M128) {
variant |= M128_VARIANT;
}
- result = saveGeneral(radioData.generalSettings, board, version, variant);
-
- if (!result)
+ int result = saveGeneral(radioData.generalSettings, board, version, variant);
+ if (!result) {
return 0;
+ }
for (int i=0; i(i, radioData.models[i]);
- break;
- case 203:
- result = saveModel(i, radioData.models[i]);
- break;
- case 204:
- result = saveModel(i, radioData.models[i]);
- break;
- case 205:
- result = saveModel(i, radioData.models[i]);
- break;
- case 207:
- if (board == BOARD_GRUVIN9X)
- result = saveModel(i, radioData.models[i]);
- break;
- case 208:
- if (board == BOARD_GRUVIN9X)
- result = saveModel(i, radioData.models[i]);
- else if (board == BOARD_SKY9X)
- result = saveModel(i, radioData.models[i]);
- else
- result = saveModel(i, radioData.models[i]);
- break;
- case 209:
- if (board == BOARD_GRUVIN9X)
- result = saveModel(i, radioData.models[i]);
- else if (board == BOARD_SKY9X)
- result = saveModel(i, radioData.models[i]);
- else
- result = saveModel(i, radioData.models[i]);
- break;
- case 210:
- if (board == BOARD_GRUVIN9X)
- result = saveModel(i, radioData.models[i]);
- else if (board == BOARD_SKY9X)
- result = saveModel(i, radioData.models[i]);
- else
- result = saveModel(i, radioData.models[i]);
- break;
- case 211:
- if (board == BOARD_GRUVIN9X)
- result = saveModel(i, radioData.models[i]);
- else if (board == BOARD_SKY9X)
- result = saveModel(i, radioData.models[i]);
- else
- result = saveModel(i, radioData.models[i]);
- break;
- case 212:
- if (board == BOARD_SKY9X)
- result = saveModel(i, radioData.models[i]);
- else
- result = saveModelVariant(i, radioData.models[i], version, variant);
- break;
- default:
- result = saveModelVariant(i, radioData.models[i], version, variant);
- break;
+ result = saveModel(i, radioData.models[i], version, variant);
+ if (!result) {
+ return 0;
}
- if (!result)
- return false;
}
}
@@ -488,7 +420,6 @@ int Open9xInterface::getSize(ModelData &model)
efile->EeFsCreate(tmp, EESIZE_RLC_MAX, board);
Open9xModelDataNew open9xModel(model, board, 255, GetCurrentFirmwareVariant());
- // open9xModel.Dump();
QByteArray eeprom;
open9xModel.Export(eeprom);
@@ -562,12 +493,14 @@ int Open9xInterface::getCapability(const Capability capability)
return 6;
else
return 5;
- case FlightPhasesAreNamed:
case FlightPhasesHaveFades:
+ return 1;
case Gvars:
+ return IS_ARM(board) ? 9 : 5;
+ case FlightModesName:
+ case GvarsName:
+ return (IS_TARANIS(board) ? 10 : 6);
case GvarsInCS:
- case GvarsAsWeight:
- case ExpoIsCurve:
case HasFAIMode:
return 1;
case GvarsAreNamed:
@@ -663,13 +596,6 @@ int Open9xInterface::getCapability(const Capability capability)
return 0;
case ExtraInputs:
return 1;
- case HasNegCurves:
- return 1;
- case HasExpoCurves:
- return true;
- case ExpoCurve5:
- case ExpoCurve9:
- return 4;
case ExtendedTrims:
return 500;
case ExtraTrims:
@@ -680,10 +606,6 @@ int Open9xInterface::getCapability(const Capability capability)
return 1;
case FSSwitch:
return 1;
- case HasTTrace:
- return 1;
- case CustomCurves:
- return 1;
case MixesWithoutExpo:
return 1;
case NumCurves:
@@ -692,14 +614,10 @@ int Open9xInterface::getCapability(const Capability capability)
return (IS_ARM(board) ? (IS_TARANIS(board) ? 8 : 6) : false);
case HasExpoNames:
return (IS_ARM(board) ? (IS_TARANIS(board) ? 8 : 6) : false);
- case HasChNames:
- return (IS_TARANIS(board) ? 1 : 0);
+ case ChannelsName:
+ return (IS_TARANIS(board) ? 6 : 0);
case HasCvNames:
return (IS_TARANIS(board) ? 1 : 0);
- case NoTimerDirs:
- return 1;
- case NoThrExpo:
- return 1;
case Telemetry:
return TM_HASTELEMETRY|TM_HASOFFSET|TM_HASWSHH;
case TelemetryBars:
@@ -734,8 +652,6 @@ int Open9xInterface::getCapability(const Capability capability)
return 1;
case TelemetryMaxMultiplier:
return (IS_ARM(board) ? 32 : 8);
- case DiffMixers:
- return 1;
case PPMCenter:
return 1;
case SYMLimits:
@@ -766,10 +682,6 @@ int Open9xInterface::getCapability(const Capability capability)
case HasBrightness:
return (IS_ARM(board) ? true : false);
case PerModelTimers:
- case PerModelThrottleWarning:
- case PerModelThrottleInvert:
- return 1;
- case pmSwitchMask:
return 1;
case SlowScale:
return (IS_ARM(board) ? 10 : 2);
@@ -777,15 +689,18 @@ int Open9xInterface::getCapability(const Capability capability)
return (IS_ARM(board) ? 250 : 15);
case CSFunc:
return 18;
- case GvarsNum:
- case GvarsOfsNum:
- return 5;
case HasSDLogs:
return ((board == BOARD_GRUVIN9X || IS_ARM(board)) ? true : false);
case LCDWidth:
return (IS_TARANIS(board) ? 212 : 128) ;
case GetThrSwitch:
- return (IS_TARANIS(board) ?DSW_SF1 : DSW_THR) ;
+ return (IS_TARANIS(board) ? DSW_SF1 : DSW_THR) ;
+ case VirtualInputs:
+ case LuaInputs:
+ case LimitsPer1000:
+ case EnhancedCurves:
+ case TelemetryInternalAlarms:
+ return IS_TARANIS(board);
default:
return 0;
}
@@ -814,12 +729,15 @@ int Open9xInterface::isAvailable(Protocol proto, int port)
case PXX_XJT_D8:
case PXX_XJT_LR12:
case PXX_DJT:
+ case LP45:
+ case DSM2:
+ case DSMX:
return 1;
default:
return 0;
}
break;
- case 2:
+ case -1:
switch (proto) {
case PPM:
return 1;
@@ -954,6 +872,9 @@ bool Open9xInterface::checkVersion(unsigned int version)
case 215:
// M128 revert because too much RAM used!
break;
+ case 216:
+ // A lot of things (first github release)
+ break;
default:
return false;
}
diff --git a/companion/src/firmwares/opentx/open9xinterface.h b/companion/src/firmwares/opentx/opentxinterface.h
similarity index 95%
rename from companion/src/firmwares/opentx/open9xinterface.h
rename to companion/src/firmwares/opentx/opentxinterface.h
index 351b1ba53..82e8c7671 100644
--- a/companion/src/firmwares/opentx/open9xinterface.h
+++ b/companion/src/firmwares/opentx/opentxinterface.h
@@ -67,10 +67,7 @@ class Open9xInterface : public EEPROMInterface
bool loadModel(uint8_t version, ModelData &model, uint8_t *data, int index, unsigned int variant, unsigned int stickMode=0);
template
- bool saveModel(unsigned int index, ModelData &model);
-
- template
- bool saveModelVariant(unsigned int index, ModelData &model, unsigned int version, unsigned int variant);
+ bool saveModel(unsigned int index, ModelData &model, unsigned int version, unsigned int variant);
template
bool loadGeneral(GeneralSettings &settings, unsigned int version);
diff --git a/companion/src/firmwares/opentx/open9xsimulator.cpp b/companion/src/firmwares/opentx/opentxsimulator.cpp
similarity index 94%
rename from companion/src/firmwares/opentx/open9xsimulator.cpp
rename to companion/src/firmwares/opentx/opentxsimulator.cpp
index 252ee6ecc..9037afa86 100644
--- a/companion/src/firmwares/opentx/open9xsimulator.cpp
+++ b/companion/src/firmwares/opentx/opentxsimulator.cpp
@@ -14,9 +14,9 @@
*
*/
-#include "open9xsimulator.h"
-#include "open9xinterface.h"
-#include "open9xeeprom.h"
+#include "opentxsimulator.h"
+#include "opentxinterface.h"
+#include "opentxeeprom.h"
#define HELI
#define SIMU
@@ -100,7 +100,7 @@ bool hasExtendedTrims()
uint8_t getStickMode()
{
- return g_eeGeneral.stickMode;
+ return limit(0, g_eeGeneral.stickMode, 3);
}
}
@@ -162,7 +162,7 @@ void Open9xSimulator::setValues(TxInputs &inputs)
void Open9xSimulator::setTrim(unsigned int idx, int value)
{
- idx = Open9x::modn12x3[4*getStickMode() + idx] - 1;
+ idx = Open9x::modn12x3[4*getStickMode() + idx];
uint8_t phase = getTrimFlightPhase(getFlightPhase(), idx);
setTrimValue(phase, idx, value);
}
@@ -176,7 +176,7 @@ void Open9xSimulator::getTrims(Trims & trims)
}
for (int i=0; i<2; i++) {
- uint8_t idx = Open9x::modn12x3[4*getStickMode() + i] - 1;
+ uint8_t idx = Open9x::modn12x3[4*getStickMode() + i];
int16_t tmp = trims.values[i];
trims.values[i] = trims.values[idx];
trims.values[idx] = tmp;
diff --git a/companion/src/firmwares/opentx/open9xsimulator.h b/companion/src/firmwares/opentx/opentxsimulator.h
similarity index 100%
rename from companion/src/firmwares/opentx/open9xsimulator.h
rename to companion/src/firmwares/opentx/opentxsimulator.h
diff --git a/companion/src/firmwares/th9x/th9xeeprom.cpp b/companion/src/firmwares/th9x/th9xeeprom.cpp
index d09eb979b..8df98e04b 100644
--- a/companion/src/firmwares/th9x/th9xeeprom.cpp
+++ b/companion/src/firmwares/th9x/th9xeeprom.cpp
@@ -29,15 +29,6 @@ t_Th9xTrainerMix::t_Th9xTrainerMix()
memset(this, 0, sizeof(t_Th9xTrainerMix));
}
-t_Th9xTrainerMix::t_Th9xTrainerMix(TrainerMix &c9x)
-{
- memset(this, 0, sizeof(t_Th9xTrainerMix));
- srcChn = c9x.src;
- swtch = th9xFromSwitch(c9x.swtch);
- studWeight = (8 * c9x.weight) / 25;
- mode = c9x.mode;
-}
-
t_Th9xTrainerMix::operator TrainerMix()
{
TrainerMix c9x;
@@ -53,15 +44,6 @@ t_Th9xTrainerData::t_Th9xTrainerData()
memset(this, 0, sizeof(t_Th9xTrainerData));
}
-t_Th9xTrainerData::t_Th9xTrainerData(TrainerData &c9x)
-{
- memset(this, 0, sizeof(t_Th9xTrainerData));
- for (int i=0; i 6) {
+ c9x.curve.type = CurveReference::CURVE_REF_CUSTOM;
+ c9x.curve.value = curve - 6;
+ }
+ else if (curve > 0) {
+ c9x.curve.type = CurveReference::CURVE_REF_FUNC;
+ c9x.curve.value = curve;
+ }
c9x.mode = mode3;
c9x.weight = weight6;
c9x.chn = chn;
c9x.swtch = th9xToSwitch(drSw);
- if (curve) {
- c9x.curveMode=1;
- c9x.curveParam = curve;
- } else {
- c9x.curveMode = 0;
- c9x.curveParam = exp5;
- }
return c9x;
}
@@ -206,15 +134,6 @@ t_Th9xLimitData::t_Th9xLimitData()
memset(this, 0, sizeof(t_Th9xLimitData));
}
-t_Th9xLimitData::t_Th9xLimitData(LimitData &c9x)
-{
- memset(this, 0, sizeof(t_Th9xLimitData));
- min = c9x.min+100;
- max = c9x.max-100;
- revert = c9x.revert;
- offset = c9x.offset;
-}
-
t_Th9xLimitData::operator LimitData ()
{
LimitData c9x;
@@ -225,36 +144,11 @@ t_Th9xLimitData::operator LimitData ()
return c9x;
}
-
t_Th9xMixData::t_Th9xMixData()
{
memset(this, 0, sizeof(t_Th9xMixData));
}
-t_Th9xMixData::t_Th9xMixData(MixData &c9x)
-{
- memset(this, 0, sizeof(t_Th9xMixData));
- destCh = c9x.destCh;
- mixMode = c9x.mltpx;
- if (c9x.srcRaw.type == SOURCE_TYPE_STICK)
- srcRaw = c9x.srcRaw.index;
- else if (c9x.srcRaw.type == SOURCE_TYPE_MAX)
- srcRaw = 10;
- else if (c9x.srcRaw.type == SOURCE_TYPE_PPM)
- srcRaw = 24 + c9x.srcRaw.index;
- else if (c9x.srcRaw.type == SOURCE_TYPE_CH)
- srcRaw = 12 + c9x.srcRaw.index;
- else
- srcRaw = 0; // TODO
- switchMode = 1;
- curveNeg = 0;
- weight = c9x.weight;
- swtch = th9xFromSwitch(c9x.swtch);
- curve = c9x.curve;
- speedUp = c9x.speedUp;
- speedDown = c9x.speedDown;
-}
-
t_Th9xMixData::operator MixData ()
{
MixData c9x;
@@ -273,41 +167,20 @@ t_Th9xMixData::operator MixData ()
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-24);
c9x.weight = weight;
c9x.swtch = th9xToSwitch(swtch);
- c9x.curve = curve;
+ if (curve > 6) {
+ c9x.curve.type = CurveReference::CURVE_REF_CUSTOM;
+ c9x.curve.value = curve - 6;
+ }
+ else if (curve > 0) {
+ c9x.curve.type = CurveReference::CURVE_REF_FUNC;
+ c9x.curve.value = curve;
+ }
c9x.speedUp = speedUp;
c9x.speedDown = speedDown;
c9x.mltpx = (MltpxValue)mixMode;
return c9x;
}
-
-t_Th9xCustomSwData::t_Th9xCustomSwData(CustomSwData &c9x)
-{
- opCmp = c9x.func;
- val1 = c9x.val1;
- val2 = c9x.val2;
-
- if ((c9x.func >= CS_FN_VPOS && c9x.func <= CS_FN_ANEG) || c9x.func >= CS_FN_EQUAL) {
- val1 = fromSource(RawSource(c9x.val1));
- }
-
- if (c9x.func >= CS_FN_EQUAL) {
- val2 = fromSource(RawSource(c9x.val2));
- }
-
- if (c9x.func >= CS_FN_AND && c9x.func <= CS_FN_XOR) {
- val1 = th9xFromSwitch(RawSwitch(c9x.val1));
- val2 = th9xFromSwitch(RawSwitch(c9x.val2));
- }
-
- if (opCmp>TH9X_MAX_CSFUNC ) {
- EEPROMWarnings += ::QObject::tr("th9x does not support Custom Switch function %1").arg(getFuncName(opCmp)) + "\n";
- opCmp=0;
- val1=0;
- val2=0;
- }
-}
-
t_Th9xCustomSwData::operator CustomSwData ()
{
CustomSwData c9x;
@@ -388,76 +261,6 @@ t_Th9xModelData::t_Th9xModelData()
memset(this, 0, sizeof(t_Th9xModelData));
}
-t_Th9xModelData::t_Th9xModelData(ModelData &c9x)
-{
- memset(this, 0, sizeof(t_Th9xModelData));
-
- if (c9x.used) {
- setEEPROMString(name, c9x.name, sizeof(name));
- mdVers = MDVERS;
- if (c9x.timers[0].mode == TMRMODE_ABS)
- tmrMode = 1;
- if (c9x.timers[0].mode == TMRMODE_THs)
- tmrMode = 2;
- if (c9x.timers[0].mode == TMRMODE_THp)
- tmrMode = 3;
- else
- tmrMode = 0;
-
- // TODO tmrDir = c9x.timers[0].dir;
- tmrVal = c9x.timers[0].val;
- //protocol = c9x.protocol;
- /*
- ppmNCH = (c9x.moduleData[0].channelsCount - 8) / 2;
- thrTrim = c9x.thrTrim;
- thrExpo = c9x.thrExpo;
- trimInc = c9x.trimInc;
- ppmDelay = (c9x.moduleData[0].ppmDelay - 300) / 50;
- for (unsigned int i=0; i 1*4
operator ModelData();
t_Th9xModelData();
- t_Th9xModelData(ModelData&);
}) Th9xModelData;
-
#endif
-/*eof*/
diff --git a/companion/src/firmwares/th9x/th9xinterface.cpp b/companion/src/firmwares/th9x/th9xinterface.cpp
index 624b077a8..d86065ddb 100644
--- a/companion/src/firmwares/th9x/th9xinterface.cpp
+++ b/companion/src/firmwares/th9x/th9xinterface.cpp
@@ -124,56 +124,20 @@ bool Th9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize,
int Th9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
{
- EEPROMWarnings.clear();
+ std::cout << "NO!\n";
+ // TODO a warning
- efile->EeFsCreate(eeprom, getEEpromSize(), BOARD_STOCK);
-
- Th9xGeneral th9xGeneral(radioData.generalSettings);
- int sz = efile->writeRlc2(FILE_GENERAL, FILE_TYP_GENERAL, (uint8_t*)&th9xGeneral, sizeof(Th9xGeneral));
- if(sz != sizeof(Th9xGeneral)) {
- return 0;
- }
-
- for (int i=0; iwriteRlc2(FILE_MODEL(i), FILE_TYP_MODEL, (uint8_t*)&th9xModel, sizeof(Th9xModelData));
- if(sz != sizeof(Th9xModelData)) {
- return 0;
- }
- }
- }
-
- return getEEpromSize();
+ return 0;
}
int Th9xInterface::getSize(ModelData &model)
{
- if (model.isempty())
- return 0;
-
- uint8_t tmp[2*EESIZE_STOCK];
- efile->EeFsCreate(tmp, getEEpromSize(), BOARD_STOCK);
-
- Th9xModelData th9xModel(model);
- int sz = efile->writeRlc2(0, FILE_TYP_MODEL, (uint8_t*)&th9xModel, sizeof(Th9xModelData));
- if(sz != sizeof(Th9xModelData)) {
- return -1;
- }
- return efile->size(0);
+ return 0;
}
int Th9xInterface::getSize(GeneralSettings &settings)
{
- uint8_t tmp[2*EESIZE_STOCK];
- efile->EeFsCreate(tmp, getEEpromSize(), BOARD_STOCK);
-
- Th9xGeneral th9xGeneral(settings);
- int sz = efile->writeRlc2(0, FILE_TYP_GENERAL, (uint8_t*)&th9xGeneral, sizeof(Th9xGeneral));
- if(sz != sizeof(th9xGeneral)) {
- return -1;
- }
- return efile->size(0);
+ return 0;
}
int Th9xInterface::getCapability(const Capability capability)
@@ -181,12 +145,6 @@ int Th9xInterface::getCapability(const Capability capability)
switch (capability) {
case Mixes:
return TH9X_MAX_MIXERS;
- case NumCurves3:
- return TH9X_MAX_CURVES3;
- case NumCurves5:
- return TH9X_MAX_CURVES5;
- case NumCurves9:
- return TH9X_MAX_CURVES9;
case OwnerName:
return 0;
case Timers:
diff --git a/companion/src/generaledit.cpp b/companion/src/generaledit.cpp
index 1f5b179bb..0758f5e22 100644
--- a/companion/src/generaledit.cpp
+++ b/companion/src/generaledit.cpp
@@ -170,22 +170,10 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->crosstrimChkB->hide();
ui->crosstrimLB->hide();
}
- if (!GetEepromInterface()->getCapability(HasPPMSim)) {
+ if (!GetEepromInterface()->getCapability(HasPPMSim)) {
ui->PPMSimLB->hide();
ui->PPMSimChkB->hide();
}
-
- if (GetEepromInterface()->getCapability(PerModelThrottleWarning)) {
- ui->thrwarnChkB->setDisabled(true);
- ui->thrwarnChkB->hide();
- ui->thrwarnLabel->hide();
- }
- if (GetEepromInterface()->getCapability(pmSwitchMask)) {
- ui->swwarn_label->hide();
- ui->swtchWarnCB->hide();
- ui->swtchWarnChkB->hide();
- layout()->removeItem(ui->swwarn_layout);
- }
if (!GetEepromInterface()->getCapability( HasPxxCountry)) {
ui->countrycode_label->hide();
ui->countrycode_CB->hide();
@@ -322,11 +310,8 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->swID0ChkB->hide();
ui->swID1ChkB->hide();
ui->swID2ChkB->hide();
- ui->swtchWarnChkB->hide();
this->layout()->removeItem(ui->switchMaskLayout);
} else {
- ui->swtchWarnCB->setDisabled(true);
- ui->swtchWarnCB->hide();
setSwitchDefPos();
}
if (!GetEepromInterface()->getCapability(TelemetryAlarm)) {
@@ -340,12 +325,6 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
} else {
populateRotEncCB(ui->re_CB, g_eeGeneral.reNavigation, renumber);
}
- if (GetEepromInterface()->getCapability(PerModelThrottleInvert)) {
- ui->label_thrrev->hide();
- ui->thrrevChkB->hide();
- } else {
- ui->thrrevChkB->setChecked(g_eeGeneral.throttleReversed);
- }
ui->telalarmsChkB->setChecked(g_eeGeneral.enableTelemetryAlarm);
ui->PotScrollEnableChkB->setChecked(!g_eeGeneral.disablePotScroll);
ui->BandGapEnableChkB->setChecked(!g_eeGeneral.disableBG);
@@ -359,9 +338,6 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->StickScrollChkB->setChecked(g_eeGeneral.stickScroll);
ui->PPMSimChkB->setChecked(g_eeGeneral.enablePpmsim);
ui->inputfilterCB->setCurrentIndex(g_eeGeneral.filterInput);
- ui->thrwarnChkB->setChecked(!g_eeGeneral.disableThrottleWarning); //Default is zero=checked
- ui->swtchWarnChkB->setChecked(g_eeGeneral.switchWarning == -1);
- ui->swtchWarnCB->setCurrentIndex(g_eeGeneral.switchWarning == -1 ? 2 : g_eeGeneral.switchWarning);
ui->memwarnChkB->setChecked(!g_eeGeneral.disableMemoryWarning); //Default is zero=checked
ui->alarmwarnChkB->setChecked(!g_eeGeneral.disableAlarmWarning);//Default is zero=checked
ui->enableTelemetryAlarmChkB->setChecked(g_eeGeneral.enableTelemetryAlarm);
@@ -622,36 +598,12 @@ void GeneralEdit::on_inactimerSB_editingFinished()
updateSettings();
}
-void GeneralEdit::on_thrrevChkB_stateChanged(int )
-{
- g_eeGeneral.throttleReversed = ui->thrrevChkB->isChecked() ? 1 : 0;
- updateSettings();
-}
-
void GeneralEdit::on_inputfilterCB_currentIndexChanged(int index)
{
g_eeGeneral.filterInput = index;
updateSettings();
}
-void GeneralEdit::on_thrwarnChkB_stateChanged(int )
-{
- g_eeGeneral.disableThrottleWarning = ui->thrwarnChkB->isChecked() ? 0 : 1;
- updateSettings();
-}
-
-void GeneralEdit::on_swtchWarnCB_currentIndexChanged(int index)
-{
- g_eeGeneral.switchWarning = (index == 2 ? -1 : index);
- updateSettings();
-}
-
-void GeneralEdit::on_swtchWarnChkB_stateChanged(int )
-{
- g_eeGeneral.switchWarning = ui->swtchWarnChkB->isChecked() ? -1 : 0;
- updateSettings();
-}
-
void GeneralEdit::on_memwarnChkB_stateChanged(int )
{
g_eeGeneral.disableMemoryWarning = ui->memwarnChkB->isChecked() ? 0 : 1;
@@ -1074,7 +1026,7 @@ void GeneralEdit::on_blinvert_cb_stateChanged(int )
void GeneralEdit::on_faimode_CB_stateChanged(int )
{
if (ui->faimode_CB->isChecked()) {
- int ret = QMessageBox::question(this, "companion9x",
+ int ret = QMessageBox::question(this, "Companion",
tr("If you enable FAI, you loose the vario, the play functions, the telemetry screen.\nThis function cannot be disabled by the radio.\nAre you sure ?") ,
QMessageBox::Yes | QMessageBox::No);
if (ret==QMessageBox::Yes) {
@@ -1375,7 +1327,7 @@ void GeneralEdit::on_calstore_PB_clicked()
} else {
QString calib=settings.value("StickPotCalib","").toString();
if (!(calib.isEmpty())) {
- int ret = QMessageBox::question(this, "companion9x",
+ int ret = QMessageBox::question(this, "Companion",
tr("Do you want to store calibration in %1 profile
overwriting existing calibration?").arg(name) ,
QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::No) {
@@ -1408,7 +1360,7 @@ void GeneralEdit::on_calstore_PB_clicked()
settings.setValue("countryCode",QString("%1%2%3").arg((uint8_t)g_eeGeneral.countryCode, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.imperial, 2, 16, QChar('0')).arg(g_eeGeneral.ttsLanguage));
settings.endGroup();
settings.endGroup();
- QMessageBox::information(this, "companion9x", tr("Calibration and HW parameters saved."));
+ QMessageBox::information(this, "Companion", tr("Calibration and HW parameters saved."));
}
}
diff --git a/companion/src/generaledit.h b/companion/src/generaledit.h
index ac6b12cbc..eb6895d13 100644
--- a/companion/src/generaledit.h
+++ b/companion/src/generaledit.h
@@ -123,12 +123,8 @@ private slots:
void on_channelorderCB_currentIndexChanged(int index);
void on_beeperCB_currentIndexChanged(int index);
void on_memwarnChkB_stateChanged(int );
- void on_swtchWarnCB_currentIndexChanged(int index);
- void on_swtchWarnChkB_stateChanged(int );
void on_telalarmsChkB_stateChanged(int );
- void on_thrwarnChkB_stateChanged(int );
void on_inputfilterCB_currentIndexChanged(int index);
- void on_thrrevChkB_stateChanged(int );
void on_inactimerSB_editingFinished();
void on_backlightautoSB_editingFinished();
void on_backlightswCB_currentIndexChanged(int index);
diff --git a/companion/src/generaledit.ui b/companion/src/generaledit.ui
index 8ac09986a..d47781a69 100644
--- a/companion/src/generaledit.ui
+++ b/companion/src/generaledit.ui
@@ -117,6 +117,13 @@ These will be relevant for all models in the same EEPROM.
Setup
+ -
+
+
+
+
+
+
-
@@ -130,7 +137,7 @@ These will be relevant for all models in the same EEPROM.
- -
+
-
-
@@ -160,13 +167,6 @@ These will be relevant for all models in the same EEPROM.
- -
-
-
-
-
-
-
-
@@ -174,7 +174,7 @@ These will be relevant for all models in the same EEPROM.
- -
+
-
-
@@ -188,49 +188,7 @@ These will be relevant for all models in the same EEPROM.
- -
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 100
- 16777215
-
-
-
-
-
- Off
-
-
- -
-
- Switches Up
-
-
- -
-
- Switches Down
-
-
-
-
- -
-
-
-
-
-
-
-
-
- -
+
-
Measurement Units
@@ -476,13 +434,6 @@ p, li { white-space: pre-wrap; }
- -
-
-
- Reverse Throttle Operation
-
-
-
-
@@ -490,7 +441,7 @@ p, li { white-space: pre-wrap; }
- -
+
-
@@ -551,26 +502,40 @@ Mode 4:
- -
-
+
-
+
- Beeper Mode
+
- -
-
-
- sec
+
-
+
+
+ LCD Display Type
+
+
+
+ -
+
+
+
+ 0
+ 0
+
- 600
-
-
5
+ -
+
+
+ BackLight On Stick Move
+
+
+
-
@@ -598,23 +563,37 @@ p, li { white-space: pre-wrap; }
- -
-
-
- Reverse throttle operation.
-If this is checked the throttle will be reversed. Idle will be forward, trim will also be reversed and the throttle warning will be reversed as well.
-
-
+
-
+
+
+ sec
-
-
+
+ 600
+
+
+ 5
- -
-
+
-
+
- BackLight On Stick Move
+ Beeper Mode
+
+
+
+ -
+
+
+ Timeshift from UTC
+
+
+
+ -
+
+
+ RotEnc Navigation
@@ -637,47 +616,6 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
- -
-
-
- RotEnc Navigation
-
-
-
- -
-
-
- Timeshift from UTC
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- 5
-
-
-
- -
-
-
-
-
-
-
- -
-
-
- LCD Display Type
-
-
-
-
@@ -685,14 +623,7 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
- -
-
-
- Throttle Startup Warning
-
-
-
- -
+
-
-
@@ -775,7 +706,7 @@ p, li { white-space: pre-wrap; }
- -
+
-
-
@@ -800,7 +731,7 @@ p, li { white-space: pre-wrap; }
- -
+
-
If you enable FAI, you loose the vario, the play functions, the telemetry screen. This function cannot be disabled by the radio.
@@ -810,7 +741,7 @@ p, li { white-space: pre-wrap; }
- -
+
-
@@ -948,48 +879,6 @@ This is used by the templated to determine which channel goes to what number out
- -
-
-
- Alarm Warning
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 16777215
-
-
-
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">Warnings</span></p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">These will define startup warnings.</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Throttle warning - will alert if the throttle is not at idle during startup</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Switch warning - will alert if switches are not in their defaul position</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Memory warning - will alert if there's not a lot of memory left</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Silent mode warning - will alert you if the beeper is set to quiet (0)</p></body></html>
-
-
-
-
-
- true
-
-
-
-
@@ -1046,7 +935,7 @@ p, li { white-space: pre-wrap; }
- -
+
-
FAI Mode
@@ -1163,7 +1052,7 @@ p, li { white-space: pre-wrap; }
- -
+
-
-14
@@ -1176,7 +1065,7 @@ p, li { white-space: pre-wrap; }
- -
+
-
-
@@ -1190,7 +1079,7 @@ p, li { white-space: pre-wrap; }
- -
+
-
@@ -1203,7 +1092,7 @@ p, li { white-space: pre-wrap; }
- -
+
-
Stick Mode
@@ -1247,41 +1136,6 @@ p, li { white-space: pre-wrap; }
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 16777215
-
-
-
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">Warnings</span></p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">These will define startup warnings.</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Throttle warning - will alert if the throttle is not at idle during startup</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Switch warning - will alert if switches are not in their defaul position</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Memory warning - will alert if there's not a lot of memory left</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Silent mode warning - will alert you if the beeper is set to quiet (0)</p></body></html>
-
-
-
-
-
- true
-
-
-
-
-
@@ -1345,13 +1199,6 @@ p, li { white-space: pre-wrap; }
- -
-
-
- Memory Startup Warning
-
-
-
-
@@ -1532,32 +1379,6 @@ p, li { white-space: pre-wrap; }
- -
-
-
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">Warnings</span></p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">These will define startup warnings.</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Throttle warning - will alert if the throttle is not at idle during startup</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Switch warning - will alert if switches are not in their defaul position</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Memory warning - will alert if there's not a lot of memory left</p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Silent mode warning - will alert you if the beeper is set to quiet (0)</p></body></html>
-
-
-
-
-
- true
-
-
- false
-
-
-
-
@@ -1565,7 +1386,7 @@ p, li { white-space: pre-wrap; }
- -
+
-
Qt::Vertical
@@ -1684,7 +1505,7 @@ Acceptable values are 5v..10v
- -
+
-
Readonly Unlock
@@ -1726,13 +1547,6 @@ Acceptable values are 5v..10v
- -
-
-
- Switch Startup Warning
-
-
-
-
@@ -1740,7 +1554,7 @@ Acceptable values are 5v..10v
- -
+
-
QLayout::SetMinimumSize
@@ -2268,6 +2082,90 @@ Acceptable values are 5v..10v
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">Warnings</span></p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">These will define startup warnings.</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Throttle warning - will alert if the throttle is not at idle during startup</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Switch warning - will alert if switches are not in their defaul position</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Memory warning - will alert if there's not a lot of memory left</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Silent mode warning - will alert you if the beeper is set to quiet (0)</p></body></html>
+
+
+
+
+
+ true
+
+
+
+ -
+
+
+ Alarm Warning
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">Warnings</span></p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">These will define startup warnings.</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Throttle warning - will alert if the throttle is not at idle during startup</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Switch warning - will alert if switches are not in their defaul position</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Memory warning - will alert if there's not a lot of memory left</p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Silent mode warning - will alert you if the beeper is set to quiet (0)</p></body></html>
+
+
+
+
+
+ true
+
+
+
+ -
+
+
+ Memory Startup Warning
+
+
+
@@ -3607,8 +3505,6 @@ p, li { white-space: pre-wrap; }
beepMinuteChkB
beepCountDownChkB
beepFlashChkB
- swtchWarnCB
- swtchWarnChkB
swTHRChkB
swRUDChkB
swELEChkB
diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp
index 30f2a9c6f..7c5046b31 100644
--- a/companion/src/helpers.cpp
+++ b/companion/src/helpers.cpp
@@ -155,16 +155,8 @@ QString getFuncName(unsigned int val)
return QObject::tr("Background Music");
else if (val == FuncBackgroundMusicPause)
return QObject::tr("Background Music Pause");
- else if (val == FuncAdjustGV1)
- return QObject::tr("Adjust GV1");
- else if (val == FuncAdjustGV2)
- return QObject::tr("Adjust GV2");
- else if (val == FuncAdjustGV3)
- return QObject::tr("Adjust GV3");
- else if (val == FuncAdjustGV4)
- return QObject::tr("Adjust GV4");
- else if (val == FuncAdjustGV5)
- return QObject::tr("Adjust GV5");
+ else if (val >= FuncAdjustGV1 && val <= FuncAdjustGVLast)
+ return QObject::tr("Adjust GV%1").arg(val-FuncAdjustGV1+1);
else {
return QString("???"); // Highlight unknown functions with output of question marks.(BTW should not happen that we do not know what a function is)
}
@@ -424,7 +416,7 @@ void populateFuncParamCB(QComboBox *b, uint function, unsigned int value, unsign
else if (function==FuncPlayValue) {
populateSourceCB(b, RawSource(value), POPULATE_SOURCES|POPULATE_SWITCHES|POPULATE_GVARS|POPULATE_TRIMS|POPULATE_TELEMETRYEXT);
}
- else if (function>=FuncAdjustGV1 && function<=FuncAdjustGV5 ) {
+ else if (function>=FuncAdjustGV1 && function<=FuncAdjustGVLast) {
switch (adjustmode) {
case 1:
populateSourceCB(b, RawSource(value), POPULATE_SOURCES|POPULATE_TRIMS|POPULATE_SWITCHES);
@@ -440,7 +432,6 @@ void populateFuncParamCB(QComboBox *b, uint function, unsigned int value, unsign
break;
}
}
-
else {
b->hide();
}
@@ -480,68 +471,133 @@ void populatePhasesCB(QComboBox *b, int value)
b->setCurrentIndex(value + GetEepromInterface()->getCapability(FlightPhases));
}
-void populateCurvesCB(QComboBox *b, int value)
+CurveGroup::CurveGroup(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueSB, CurveReference & curve, unsigned int flags):
+ QObject(),
+ curveTypeCB(curveTypeCB),
+ curveGVarCB(curveGVarCB),
+ curveValueCB(curveValueCB),
+ curveValueSB(curveValueSB),
+ curve(curve),
+ flags(flags),
+ lock(false),
+ lastType(-1)
{
- b->clear();
- int numcurves=GetEepromInterface()->getCapability(NumCurves);
- if (numcurves==0) {
- numcurves=16;
- }
- for (int i = -(numcurves)*GetEepromInterface()->getCapability(HasNegCurves); i < CURVE_BASE + numcurves; i++) {
- if ((i==0) && GetEepromInterface()->getCapability(DiffMixers)) {
- b->addItem(QObject::tr("Diff"));
- } else {
- b->addItem(getCurveStr(i));
- }
- }
- b->setCurrentIndex(value+numcurves*GetEepromInterface()->getCapability(HasNegCurves));
- b->setMaxVisibleItems(10);
+ curveTypeCB->addItem(tr("Diff"));
+ curveTypeCB->addItem(tr("Expo"));
+ curveTypeCB->addItem(tr("Func"));
+ curveTypeCB->addItem(tr("Curve"));
+
+ curveValueCB->setMaxVisibleItems(10);
+
+ connect(curveTypeCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
+ connect(curveGVarCB, SIGNAL(stateChanged(int)), this, SLOT(gvarCBChanged(int)));
+ connect(curveValueCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
+ connect(curveValueSB, SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
+
+ update();
}
-void populateExpoCurvesCB(QComboBox *b, int value)
+void CurveGroup::update()
{
- b->clear();
- int numcurves=GetEepromInterface()->getCapability(NumCurves);
- if (numcurves==0) {
- numcurves=16;
- }
- if (GetEepromInterface()->getCapability(ExpoIsCurve)) {
- b->addItem(QObject::tr("Expo"));
- } else {
- b->addItem(getCurveStr(0));
- }
- for (int i = 1; i < CURVE_BASE + numcurves; i++)
- b->addItem(getCurveStr(i));
- b->setCurrentIndex(value);
- b->setMaxVisibleItems(10);
- /* TODO
- if (GetEepromInterface()->getCapability(ExpoCurve5)) {
- int curve5=GetEepromInterface()->getCapability(ExpoCurve5);
- for (int i=CURVE_BASE+curve5; i < CURVE_BASE + MAX_CURVE5; i++) {
- // Get the index of the value to disable
- QModelIndex index = b->model()->index(i, 0);
+ lock = true;
- // This is the effective 'disable' flag
- QVariant v(0);
+ curveTypeCB->setCurrentIndex(curve.type);
- //the magic
- b->model()->setData(index, v, Qt::UserRole - 1);
+ if (curve.type == CurveReference::CURVE_REF_DIFF || curve.type == CurveReference::CURVE_REF_EXPO) {
+ curveGVarCB->show();
+ if (curve.value > 100 || curve.value < -100) {
+ curveGVarCB->setChecked(true);
+ if (lastType != CurveReference::CURVE_REF_DIFF && lastType != CurveReference::CURVE_REF_EXPO) {
+ lastType = curve.type;
+ populateGVCB(curveValueCB, curve.value);
+ }
+ curveValueCB->show();
+ curveValueSB->hide();
+ }
+ else {
+ curveGVarCB->setChecked(false);
+ curveValueSB->setMinimum(-100);
+ curveValueSB->setMaximum(100);
+ curveValueSB->setValue(curve.value);
+ curveValueSB->show();
+ curveValueCB->hide();
}
}
- if (GetEepromInterface()->getCapability(ExpoCurve9)) {
- int curve9=GetEepromInterface()->getCapability(ExpoCurve9);
- for (int i=CURVE_BASE+MAX_CURVE5+curve9; i < CURVE_BASE + MAX_CURVE5+ MAX_CURVE9; i++) {
- // Get the index of the value to disable
- QModelIndex index = b->model()->index(i, 0);
-
- // This is the effective 'disable' flag
- QVariant v(0);
-
- //the magic
- b->model()->setData(index, v, Qt::UserRole - 1);
+ else {
+ curveGVarCB->hide();
+ curveValueSB->hide();
+ curveValueCB->show();
+ switch (curve.type) {
+ case CurveReference::CURVE_REF_FUNC:
+ if (lastType != curve.type) {
+ lastType = curve.type;
+ curveValueCB->clear();
+ for (int i=0; i<=6/*TODO constant*/; i++) {
+ curveValueCB->addItem(CurveReference(CurveReference::CURVE_REF_FUNC, i).toString());
+ }
+ }
+ curveValueCB->setCurrentIndex(curve.value);
+ break;
+ case CurveReference::CURVE_REF_CUSTOM:
+ {
+ int numcurves = GetEepromInterface()->getCapability(NumCurves);
+ if (lastType != curve.type) {
+ lastType = curve.type;
+ curveValueCB->clear();
+ for (int i=-numcurves; iaddItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, i).toString());
+ }
+ }
+ curveValueCB->setCurrentIndex(curve.value+numcurves);
+ break;
+ }
+ default:
+ break;
}
}
- */
+
+ lock = false;
+}
+
+void CurveGroup::gvarCBChanged(int state)
+{
+ if (!lock) {
+ if (state) {
+ curve.value = 10000; // TODO constant in EEpromInterface ...
+ }
+ else {
+ curve.value = 0; // TODO could be better
+ }
+
+ update();
+ }
+}
+
+void CurveGroup::valuesChanged()
+{
+ if (!lock) {
+ switch (curveTypeCB->currentIndex()) {
+ case 0:
+ case 1:
+ {
+ int value;
+ if (curveGVarCB->isChecked())
+ value = curveValueCB->itemData(curveValueCB->currentIndex()).toInt();
+ else
+ value = curveValueSB->value();
+ curve = CurveReference(curveTypeCB->currentIndex() == 0 ? CurveReference::CURVE_REF_DIFF : CurveReference::CURVE_REF_EXPO, value);
+ break;
+ }
+ case 2:
+ curve = CurveReference(CurveReference::CURVE_REF_FUNC, curveValueCB->currentIndex());
+ break;
+ case 3:
+ curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, curveValueCB->currentIndex() - GetEepromInterface()->getCapability(NumCurves));
+ break;
+ }
+
+ update();
+ }
}
void populateTrimUseCB(QComboBox *b, unsigned int phase)
@@ -560,73 +616,29 @@ void populateTrimUseCB(QComboBox *b, unsigned int phase)
void populateGvarUseCB(QComboBox *b, unsigned int phase)
{
b->addItem(QObject::tr("Own value"));
- unsigned int num_phases = GetEepromInterface()->getCapability(FlightPhases);
- if (num_phases>0) {
- for (unsigned int i = 0; i < num_phases; i++) {
- if (i != phase) {
- b->addItem(QObject::tr("Flight mode %1 value").arg(i));
- }
+ for (int i=0; igetCapability(FlightPhases); i++) {
+ if (i != (int)phase) {
+ b->addItem(QObject::tr("Flight mode %1 value").arg(i));
}
}
}
-void populateTimerSwitchCB(QComboBox *b, int value, int extrafields)
+void populateTimerSwitchCB(QComboBox *b, int value)
{
b->clear();
- uint8_t endvalue=128;
uint8_t count=0;
- if (extrafields==2)
- endvalue=192;
- for (int i=-128; iaddItem(getTimerMode(i), i);
if (i==value)
b->setCurrentIndex(b->count()-1);
- if (extrafields==2 && (i<0 || (i>3 && i model()->index(count, 0);
- // This is the effective 'disable' flag
- QVariant v(0);
- //the magic
- b->model()->setData(index, v, Qt::UserRole - 1);
- }
count++;
}
}
b->setMaxVisibleItems(10);
}
-void populateTimerSwitchBCB(QComboBox *b, int value, int extrafields)
-{
- b->clear();
- if (extrafields!=2) {
- int startvalue=-128;
- int endvalue=128;
- if (extrafields==1) {
- startvalue=-25;
- endvalue=26;
- }
- for (int i=startvalue; iaddItem(getTimerMode(i), i);
- if (i==value)
- b->setCurrentIndex(b->count()-1);
- }
- }
- } else {
- for (int i=-33; i<66; i++) {
- QString timerMode = getTimerModeB(i);
- if (!timerMode.isEmpty()) {
- b->addItem(timerMode, i);
- if (i==value)
- b->setCurrentIndex(b->count()-1);
- }
- }
- }
- b->setMaxVisibleItems(10);
-}
-
QString getTimerMode(int tm) {
QString stt = "OFFABSTHsTH%THt";
@@ -868,8 +880,10 @@ void populateGVCB(QComboBox *b, int value)
{
int selected=0;
int nullitem;
+
b->clear();
- int pgvars=GetEepromInterface()->getCapability(GvarsOfsNum);
+
+ int pgvars = GetEepromInterface()->getCapability(Gvars);
for (int i=-pgvars; i<=-1; i++) {
int16_t gval = (int16_t)(-10000+i);
b->addItem(QObject::tr("-GV%1").arg(-i), gval);
@@ -878,12 +892,15 @@ void populateGVCB(QComboBox *b, int value)
selected=1;
}
}
+
b->addItem("---", 0);
+
nullitem=b->count()-1;
if (value == 0) {
b->setCurrentIndex(b->count()-1);
selected=1;
}
+
for (int i=1; i<=pgvars; i++) {
int16_t gval = (int16_t)(10000+i);
b->addItem(QObject::tr("GV%1").arg(i), gval);
@@ -892,6 +909,7 @@ void populateGVCB(QComboBox *b, int value)
selected=1;
}
}
+
if (selected==0)
b->setCurrentIndex(nullitem);
}
@@ -983,7 +1001,7 @@ void populateSourceCB(QComboBox *b, const RawSource &source, unsigned int flags)
}
if (flags & POPULATE_GVARS) {
- for (int i=0; igetCapability(GvarsNum); i++) {
+ for (int i=0; igetCapability(Gvars); i++) {
item = RawSource(SOURCE_TYPE_GVAR, i);
b->addItem(item.toString(), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
@@ -1061,25 +1079,20 @@ QString getSignedStr(int value)
return value > 0 ? QString("+%1").arg(value) : QString("%1").arg(value);
}
-QString getCurveStr(int curve)
-{
- QString crvStr = "!c16!c15!c14!c13!c12!c11!c10!c9 !c8 !c7 !c6 !c5 !c4 !c3 !c2 !c1 ----x>0 x<0 |x| f>0 f<0 |f| c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 ";
- return crvStr.mid((curve+C9X_MAX_CURVES) * 4, 4).remove(' ').replace("c", QObject::tr("Curve") + " ");
-}
-
QString getGVarString(int16_t val, bool sign)
{
- if (val >= -10000 && val <= 10000)
+ if (val >= -10000 && val <= 10000) {
if (sign)
- return QString("(%1%)").arg(getSignedStr(val));
+ return QString("%1%").arg(getSignedStr(val));
else
- return QString("(%1%)").arg(val);
- else
- if (val<0) {
- return QObject::tr("(-GV%1)").arg(-val-10000);
- } else {
- return QObject::tr("(GV%1)").arg(val-10000);
- }
+ return QString("%1%").arg(val);
+ }
+ else {
+ if (val<0)
+ return QObject::tr("-GV%1").arg(-val-10000);
+ else
+ return QObject::tr("GV%1").arg(val-10000);
+ }
}
QString image2qstring(QImage image)
@@ -1141,12 +1154,6 @@ int findmult(float value, float base)
return mult;
}
-bool checkbit(int value, int bit)
-{
- return ((value & (1<getCapability(FlightPhases);
+
+ if (numphases && phases) {
+ QString str;
+ int count = 0;
+ if (phases == (unsigned int)(1< 0) str += QString(", ");
+ str += getPhaseName(i+1, model.phaseData[i].name);
+ }
+ }
+ }
+ if (count > 1)
+ return QObject::tr("Flight modes(%1)").arg(str);
+ else
+ return QObject::tr("Flight mode(%1)").arg(str);
+ }
+ else {
+ return "";
+ }
+}
+
float c9xexpou(float point, float coeff)
{
float x=point*1024.0/100.0;
diff --git a/companion/src/helpers.h b/companion/src/helpers.h
index d37b8f8bd..bc61e2894 100644
--- a/companion/src/helpers.h
+++ b/companion/src/helpers.h
@@ -6,10 +6,10 @@
#define TMR_NUM_OPTION (TMR_VAROFS+2*9+2*GetEepromInterface()->getCapability(CustomSwitches)-1)
-//convert from mode 1 to mode g_eeGeneral.stickMode
+//convert from mode 1 to mode generalSettings.stickMode
//NOTICE! => 1..4 -> 1..4
-#define CONVERT_MODE(x) (((x)<=4) ? modn12x3[g_eeGeneral.stickMode][((x)-1)] : (x))
-#define CHANNEL_ORDER(x) (chout_ar[g_eeGeneral.templateSetup*4 + (x)-1])
+#define CONVERT_MODE(x) (((x)<=4) ? modn12x3[generalSettings.stickMode][((x)-1)] : (x))
+#define CHANNEL_ORDER(x) (chout_ar[generalSettings.templateSetup*4 + (x)-1])
#define CURVE_BASE 7
#define CH(x) (SRC_CH1+(x)-1-(SRC_SWC-SRC_3POS))
@@ -29,6 +29,29 @@ void populateTTraceCB(QComboBox *b, int value);
void populateRotEncCB(QComboBox *b, int value, int renumber);
void populateBacklightCB(QComboBox *b, const uint8_t value);
+class CurveGroup : public QObject {
+
+ Q_OBJECT
+
+ public:
+ CurveGroup(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueSB, CurveReference & curve, unsigned int flags=0);
+ void update();
+
+ protected slots:
+ void gvarCBChanged(int);
+ void valuesChanged();
+
+ protected:
+ QComboBox *curveTypeCB;
+ QCheckBox *curveGVarCB;
+ QComboBox *curveValueCB;
+ QSpinBox *curveValueSB;
+ CurveReference & curve;
+ unsigned int flags;
+ bool lock;
+ int lastType;
+};
+
#define POPULATE_ONOFF 0x01
#define POPULATE_MSWITCHES 0x02
#define POPULATE_AND_SWITCHES 0x04
@@ -42,13 +65,11 @@ void populateFuncParamArmTCB(QComboBox *b, ModelData * g_model, char * value, QS
void populatePhasesCB(QComboBox *b, int value);
void populateTrimUseCB(QComboBox *b, unsigned int phase);
void populateGvarUseCB(QComboBox *b, unsigned int phase);
-void populateCurvesCB(QComboBox *b, int value);
void populateCustomScreenFieldCB(QComboBox *b, unsigned int value, bool last, int hubproto);
-void populateExpoCurvesCB(QComboBox *b, int value);
-void populateTimerSwitchCB(QComboBox *b, int value, int extrafields=0);
-void populateTimerSwitchBCB(QComboBox *b, int value, int extrafields=0);
+void populateTimerSwitchCB(QComboBox *b, int value);
QString getCustomSwitchStr(CustomSwData * customSw, const ModelData & model);
QString getProtocolStr(const int proto);
+QString getPhasesStr(unsigned int phases, ModelData & model);
#define POPULATE_SOURCES 1
#define POPULATE_TRIMS 2
@@ -72,12 +93,10 @@ QString getCSWFunc(int val);
QString getFuncName(unsigned int val);
QString getRepeatString(unsigned int val);
QString getSignedStr(int value);
-QString getCurveStr(int curve);
QString getGVarString(int16_t val, bool sign=false);
QString image2qstring(QImage image);
QImage qstring2image(QString imagestr);
int findmult(float value, float base);
-bool checkbit(int value, int bit);
QString getTrimInc(ModelData * g_model);
QString getTimerStr(TimerData & timer);
@@ -95,4 +114,5 @@ float getBarValue(int barId, int value, FrSkyData *fd);
float c9xexpou(float point, float coeff);
float ValToTim(int value);
int TimToVal(float value);
+
#endif // HELPERS_H
diff --git a/companion/src/icon.ico b/companion/src/icon.ico
index 2453af4ff..bb088b1ae 100644
Binary files a/companion/src/icon.ico and b/companion/src/icon.ico differ
diff --git a/companion/src/icon.png b/companion/src/icon.png
index 90a961731..6ceee4f23 100644
Binary files a/companion/src/icon.png and b/companion/src/icon.png differ
diff --git a/companion/src/icon.svg b/companion/src/icon.svg
deleted file mode 100644
index c36f00f53..000000000
--- a/companion/src/icon.svg
+++ /dev/null
@@ -1,157 +0,0 @@
-
-
-
-
diff --git a/companion/src/images/9CX.png b/companion/src/images/9CX.png
deleted file mode 100644
index 3c1b8e453..000000000
Binary files a/companion/src/images/9CX.png and /dev/null differ
diff --git a/companion/src/images/9xdb-bl.png b/companion/src/images/9xdb-bl.png
index 654e2d5ae..ba1dfbd4c 100644
Binary files a/companion/src/images/9xdb-bl.png and b/companion/src/images/9xdb-bl.png differ
diff --git a/companion/src/images/9xdb-gr.png b/companion/src/images/9xdb-gr.png
index e474dc0dd..89778a54f 100644
Binary files a/companion/src/images/9xdb-gr.png and b/companion/src/images/9xdb-gr.png differ
diff --git a/companion/src/images/9xdb-or.png b/companion/src/images/9xdb-or.png
index 20bc45640..c61b410ab 100644
Binary files a/companion/src/images/9xdb-or.png and b/companion/src/images/9xdb-or.png differ
diff --git a/companion/src/images/9xdb-rd.png b/companion/src/images/9xdb-rd.png
index ace3657d4..2d18d84af 100644
Binary files a/companion/src/images/9xdb-rd.png and b/companion/src/images/9xdb-rd.png differ
diff --git a/companion/src/images/9xdb-yl.png b/companion/src/images/9xdb-yl.png
index e1e9f1e6a..158f1e94e 100644
Binary files a/companion/src/images/9xdb-yl.png and b/companion/src/images/9xdb-yl.png differ
diff --git a/companion/src/images/9xdb.png b/companion/src/images/9xdb.png
index 602bc9955..e6198c2a7 100644
Binary files a/companion/src/images/9xdb.png and b/companion/src/images/9xdb.png differ
diff --git a/companion/src/images/companion-title.png b/companion/src/images/companion-title.png
new file mode 100644
index 000000000..cbaa0d13b
Binary files /dev/null and b/companion/src/images/companion-title.png differ
diff --git a/companion/src/images/companion9x-title.png b/companion/src/images/companion9x-title.png
deleted file mode 100644
index 358bc8826..000000000
Binary files a/companion/src/images/companion9x-title.png and /dev/null differ
diff --git a/companion/src/images/customize.png b/companion/src/images/customize.png
index 96259b922..078d0af75 100644
Binary files a/companion/src/images/customize.png and b/companion/src/images/customize.png differ
diff --git a/companion/src/images/iconmac.icns b/companion/src/images/iconmac.icns
index 3c26785d6..0e20c9fe3 100644
Binary files a/companion/src/images/iconmac.icns and b/companion/src/images/iconmac.icns differ
diff --git a/companion/src/images/linuxicons/128x128/companion.png b/companion/src/images/linuxicons/128x128/companion.png
new file mode 100644
index 000000000..6f1616ca2
Binary files /dev/null and b/companion/src/images/linuxicons/128x128/companion.png differ
diff --git a/companion/src/images/linuxicons/256x256/companion.png b/companion/src/images/linuxicons/256x256/companion.png
new file mode 100644
index 000000000..684517666
Binary files /dev/null and b/companion/src/images/linuxicons/256x256/companion.png differ
diff --git a/companion/src/images/linuxicons/32x32/companion.png b/companion/src/images/linuxicons/32x32/companion.png
new file mode 100644
index 000000000..df79707a5
Binary files /dev/null and b/companion/src/images/linuxicons/32x32/companion.png differ
diff --git a/companion/src/images/linuxicons/48x48/companion.png b/companion/src/images/linuxicons/48x48/companion.png
new file mode 100644
index 000000000..99357930d
Binary files /dev/null and b/companion/src/images/linuxicons/48x48/companion.png differ
diff --git a/companion/src/images/linuxicons/512x512/companion.png b/companion/src/images/linuxicons/512x512/companion.png
new file mode 100644
index 000000000..7e9078b2e
Binary files /dev/null and b/companion/src/images/linuxicons/512x512/companion.png differ
diff --git a/companion/src/images/linuxicons/scalable/companion.svg b/companion/src/images/linuxicons/scalable/companion.svg
new file mode 100644
index 000000000..40a99a3b0
--- /dev/null
+++ b/companion/src/images/linuxicons/scalable/companion.svg
@@ -0,0 +1,104 @@
+
+
+
\ No newline at end of file
diff --git a/companion/src/images/originals/9CX.xcf b/companion/src/images/originals/9CX.xcf
new file mode 100644
index 000000000..167a1ad10
Binary files /dev/null and b/companion/src/images/originals/9CX.xcf differ
diff --git a/companion/src/images/originals/9xdb-bl.xcf b/companion/src/images/originals/9xdb-bl.xcf
new file mode 100644
index 000000000..8b09f5c82
Binary files /dev/null and b/companion/src/images/originals/9xdb-bl.xcf differ
diff --git a/companion/src/images/originals/9xdb-gr.xcf b/companion/src/images/originals/9xdb-gr.xcf
new file mode 100644
index 000000000..416ea3f50
Binary files /dev/null and b/companion/src/images/originals/9xdb-gr.xcf differ
diff --git a/companion/src/images/originals/9xdb-or.xcf b/companion/src/images/originals/9xdb-or.xcf
new file mode 100644
index 000000000..0bbe3113b
Binary files /dev/null and b/companion/src/images/originals/9xdb-or.xcf differ
diff --git a/companion/src/images/originals/9xdb-rd.xcf b/companion/src/images/originals/9xdb-rd.xcf
new file mode 100644
index 000000000..b1a389465
Binary files /dev/null and b/companion/src/images/originals/9xdb-rd.xcf differ
diff --git a/companion/src/images/originals/9xdb-yl.xcf b/companion/src/images/originals/9xdb-yl.xcf
new file mode 100644
index 000000000..6fc4e7883
Binary files /dev/null and b/companion/src/images/originals/9xdb-yl.xcf differ
diff --git a/companion/src/images/originals/9xdb.xcf b/companion/src/images/originals/9xdb.xcf
new file mode 100644
index 000000000..d0ed54593
Binary files /dev/null and b/companion/src/images/originals/9xdb.xcf differ
diff --git a/companion/src/images/originals/companion9x-title.xcf b/companion/src/images/originals/companion9x-title.xcf
new file mode 100644
index 000000000..808d8f4bc
Binary files /dev/null and b/companion/src/images/originals/companion9x-title.xcf differ
diff --git a/companion/src/images/originals/customize.xcf b/companion/src/images/originals/customize.xcf
new file mode 100644
index 000000000..d5ef01df8
Binary files /dev/null and b/companion/src/images/originals/customize.xcf differ
diff --git a/companion/src/images/originals/splash.xcf b/companion/src/images/originals/splash.xcf
new file mode 100644
index 000000000..4130570dd
Binary files /dev/null and b/companion/src/images/originals/splash.xcf differ
diff --git a/companion/src/images/originals/splasht.xcf b/companion/src/images/originals/splasht.xcf
new file mode 100644
index 000000000..66466d2cc
Binary files /dev/null and b/companion/src/images/originals/splasht.xcf differ
diff --git a/companion/src/images/originals/vector-logo.odg b/companion/src/images/originals/vector-logo.odg
new file mode 100644
index 000000000..a4c4278c8
Binary files /dev/null and b/companion/src/images/originals/vector-logo.odg differ
diff --git a/companion/src/images/originals/vector-logo.svg b/companion/src/images/originals/vector-logo.svg
new file mode 100644
index 000000000..40a99a3b0
--- /dev/null
+++ b/companion/src/images/originals/vector-logo.svg
@@ -0,0 +1,104 @@
+
+
+
\ No newline at end of file
diff --git a/companion/src/images/originals/windows-icon.xcf b/companion/src/images/originals/windows-icon.xcf
new file mode 100644
index 000000000..7cf9bcf71
Binary files /dev/null and b/companion/src/images/originals/windows-icon.xcf differ
diff --git a/companion/src/images/splash-2012.png b/companion/src/images/splash-2012.png
deleted file mode 100644
index f5afdbafa..000000000
Binary files a/companion/src/images/splash-2012.png and /dev/null differ
diff --git a/companion/src/images/splash-2013.png b/companion/src/images/splash-2013.png
deleted file mode 100644
index 0afa87174..000000000
Binary files a/companion/src/images/splash-2013.png and /dev/null differ
diff --git a/companion/src/images/splash-ambroise.png b/companion/src/images/splash-ambroise.png
deleted file mode 100644
index e7df433b5..000000000
Binary files a/companion/src/images/splash-ambroise.png and /dev/null differ
diff --git a/companion/src/images/splash-hb.png b/companion/src/images/splash-hb.png
deleted file mode 100644
index aadacc645..000000000
Binary files a/companion/src/images/splash-hb.png and /dev/null differ
diff --git a/companion/src/images/splash-old.png b/companion/src/images/splash-old.png
deleted file mode 100644
index 44a0bab1c..000000000
Binary files a/companion/src/images/splash-old.png and /dev/null differ
diff --git a/companion/src/images/splash.png b/companion/src/images/splash.png
index 601c590d9..8c55b1551 100644
Binary files a/companion/src/images/splash.png and b/companion/src/images/splash.png differ
diff --git a/companion/src/images/splasht.png b/companion/src/images/splasht.png
index 96f1eb7ce..25cdc0871 100644
Binary files a/companion/src/images/splasht.png and b/companion/src/images/splasht.png differ
diff --git a/companion/src/logsdialog.cpp b/companion/src/logsdialog.cpp
index 4334da516..e1b415ce9 100644
--- a/companion/src/logsdialog.cpp
+++ b/companion/src/logsdialog.cpp
@@ -687,7 +687,7 @@ bool logsDialog::cvsFileParse()
file.close();
if (errors>1) {
- QMessageBox::warning(this, "companion9x", tr("The selected logfile contains %1 invalid lines out of %2 total lines").arg(errors).arg(lines));
+ QMessageBox::warning(this, "Companion", tr("The selected logfile contains %1 invalid lines out of %2 total lines").arg(errors).arg(lines));
}
plotLock=true;
int n=csvlog.count();
diff --git a/companion/src/logsdialog.ui b/companion/src/logsdialog.ui
index deee92d6b..4d0c91939 100644
--- a/companion/src/logsdialog.ui
+++ b/companion/src/logsdialog.ui
@@ -11,7 +11,7 @@
- Companion9x log viewer
+ Companion Log Viewer
diff --git a/companion/src/main.cpp b/companion/src/main.cpp
index 04a20ec84..65d4a861e 100644
--- a/companion/src/main.cpp
+++ b/companion/src/main.cpp
@@ -89,7 +89,7 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(companion9x);
QApplication app(argc, argv);
- app.setApplicationName("Companion9x");
+ app.setApplicationName("OpenTX Companion");
#ifdef __APPLE__
app.setStyle(new MyProxyStyle);
#endif
@@ -100,13 +100,13 @@ int main(int argc, char *argv[])
QString locale = settings.value("locale",QLocale::system().name()).toString();
bool showSplash = settings.value("show_splash", true).toBool();
- QTranslator companion9xTranslator;
- companion9xTranslator.load(":/companion9x_" + locale);
+ QTranslator companionTranslator;
+ companionTranslator.load(":/companion_" + locale);
QTranslator qtTranslator;
qtTranslator.load((QString)"qt_" + locale.left(2), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
// qDebug() << locale;
// qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
- app.installTranslator(&companion9xTranslator);
+ app.installTranslator(&companionTranslator);
app.installTranslator(&qtTranslator);
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp
index 058218ec7..5b0d0bd64 100644
--- a/companion/src/mainwindow.cpp
+++ b/companion/src/mainwindow.cpp
@@ -59,7 +59,7 @@
#include "burndialog.h"
#include "hexinterface.h"
#include "warnings.h"
-#include "firmwares/opentx/open9xinterface.h" // TODO get rid of this include
+#include "firmwares/opentx/opentxinterface.h" // TODO get rid of this include
#define DONATE_STR "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QUZ48K4SEXDP2"
#ifdef __APPLE__
@@ -103,9 +103,9 @@ downloadDialog_forWait(NULL)
readSettings();
FirmwareInfo *firmware = GetCurrentFirmware();
if (ActiveProfile) {
- setWindowTitle(tr("companion9x - Models and Settings Editor - %1 - profile %2").arg(firmware->name).arg(ActiveProfileName));
+ setWindowTitle(tr("Companion - Models and Settings Editor - %1 - profile %2").arg(firmware->name).arg(ActiveProfileName));
} else {
- setWindowTitle(tr("companion9x - Models and Settings Editor - %1").arg(firmware->name));
+ setWindowTitle(tr("Companion - Models and Settings Editor - %1").arg(firmware->name));
}
setUnifiedTitleAndToolBarOnMac(true);
this->setWindowIcon(QIcon(":/icon.png"));
@@ -172,11 +172,11 @@ void MainWindow::displayWarnings()
if (warnId0) {
- QMessageBox::warning(this, "companion9x", WARNING);
- res = QMessageBox::question(this, "companion9x",tr("Display previous warning again at startup ?"),QMessageBox::Yes | QMessageBox::No);
+ QMessageBox::warning(this, "Companion", WARNING);
+ res = QMessageBox::question(this, "Companion",tr("Display previous warning again at startup ?"),QMessageBox::Yes | QMessageBox::No);
} else {
- QMessageBox::about(this, "companion9x", WARNING);
- res = QMessageBox::question(this, "companion9x",tr("Display previous message again at startup ?"),QMessageBox::Yes | QMessageBox::No);
+ QMessageBox::about(this, "Companion", WARNING);
+ res = QMessageBox::question(this, "Companion",tr("Display previous message again at startup ?"),QMessageBox::Yes | QMessageBox::No);
}
if (res == QMessageBox::No) {
settings.setValue("warningId", WARNING_ID);
@@ -249,7 +249,7 @@ void MainWindow::checkForUpdateFinished(QNetworkReply * reply)
QString version = qba.mid(i+14, 4);
if (version.isNull()) {
- QMessageBox::warning(this, "companion9x", tr("Unable to check for updates."));
+ QMessageBox::warning(this, "Companion", tr("Unable to check for updates."));
return;
}
double vnum=version.toDouble();
@@ -263,7 +263,7 @@ void MainWindow::checkForUpdateFinished(QNetworkReply * reply)
if (c9xver< vnum) {
#if defined WIN32 || !defined __GNUC__ // || defined __APPLE__ // OSX should only notify of updates since no update packages are available.
showcheckForUpdatesResult = false; // update is available - do not show dialog
- int ret = QMessageBox::question(this, "companion9x", tr("A new version of companion9x is available (version %1)
"
+ int ret = QMessageBox::question(this, "Companion", tr("A new version of Companion is available (version %1)
"
"Would you like to download it?").arg(version) ,
QMessageBox::Yes | QMessageBox::No);
@@ -284,21 +284,21 @@ void MainWindow::checkForUpdateFinished(QNetworkReply * reply)
}
}
#else
- QMessageBox::warning(this, tr("New release available"), tr("A new release of companion is available please check the repository"));
+ QMessageBox::warning(this, tr("New release available"), tr("A new release of Companion is available please check the repository"));
#endif
} else {
if (showcheckForUpdatesResult && check1done && check2done)
- QMessageBox::information(this, "companion9x", tr("No updates available at this time."));
+ QMessageBox::information(this, "Companion", tr("No updates available at this time."));
}
} else {
if(check1done && check2done)
- QMessageBox::warning(this, "companion9x", tr("Unable to check for updates."));
+ QMessageBox::warning(this, "Companion", tr("Unable to check for updates."));
}
}
void MainWindow::updateDownloaded()
{
- int ret = QMessageBox::question(this, "companion9x", tr("Would you like to launch the installer?") ,
+ int ret = QMessageBox::question(this, "Companion", tr("Would you like to launch the installer?") ,
QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::Yes) {
if(QDesktopServices::openUrl(QUrl::fromLocalFile(installer_fileName)))
@@ -362,7 +362,7 @@ void MainWindow::reply1Accepted()
errormsg=tr("Compilation server too busy, try later");
break;
case 4:
- errormsg=tr("Compilation server requires registration, please check opentx web site");
+ errormsg=tr("Compilation server requires registration, please check OpenTX web site");
break;
default:
errormsg=tr("Unknown server failure, try later");
@@ -402,7 +402,7 @@ void MainWindow::reply1Accepted()
errormsg=tr("Compilation server too busy, try later");
break;
case 4:
- errormsg=tr("Compilation server requires registration, please check opentx web site");
+ errormsg=tr("Compilation server requires registration, please check OpenTX web site");
break;
default:
errormsg=tr("Unknown server failure, try later");
@@ -433,7 +433,7 @@ void MainWindow::reply1Accepted()
}
settings.setValue(downloadedFW, currentFWrev);
if (autoflash) {
- int ret = QMessageBox::question(this, "companion9x", tr("Do you want to write the firmware to the transmitter now ?"), QMessageBox::Yes | QMessageBox::No);
+ int ret = QMessageBox::question(this, "Companion", tr("Do you want to write the firmware to the transmitter now ?"), QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::Yes) {
burnToFlash(downloadedFWFilename);
}
@@ -470,7 +470,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
QString newrev=qba.mid(k).replace('"', "").trimmed();
if(!cres) {
- QMessageBox::warning(this, "companion9x", tr("Unable to check for updates."));
+ QMessageBox::warning(this, "Companion", tr("Unable to check for updates."));
int server = settings.value("fwserver",0).toInt();
server++;
settings.setValue("fwserver",server);
@@ -490,6 +490,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
showcheckForUpdatesResult = false; // update is available - do not show dialog
QString rn = GetFirmware(fwToUpdate)->rnurl;
QAbstractButton *rnButton;
+ msgBox.setWindowTitle("Companion");
msgBox.setInformativeText(tr("Firmware %1 does not seem to have ever been downloaded.\nVersion %2 is available.\nDo you want to download it now ?").arg(fwToUpdate).arg(NewFwRev));
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
msgBox.addButton(trUtf8("No"), QMessageBox::NoRole);
@@ -502,7 +503,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
if( msgBox.clickedButton() == rnButton ) {
contributorsDialog *cd = new contributorsDialog(this,2,rn);
cd->exec();
- int ret2 = QMessageBox::question(this, "companion9x", tr("Do you want to download release %1 now ?").arg(NewFwRev),
+ int ret2 = QMessageBox::question(this, "Companion", tr("Do you want to download release %1 now ?").arg(NewFwRev),
QMessageBox::Yes | QMessageBox::No);
if (ret2 == QMessageBox::Yes) {
download = true;
@@ -518,7 +519,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
showcheckForUpdatesResult = false; // update is available - do not show dialog
QString rn = GetFirmware(fwToUpdate)->rnurl;
QAbstractButton *rnButton;
- msgBox.setText("companion9x");
+ msgBox.setText("Companion");
msgBox.setInformativeText(tr("A new version of %1 firmware is available (current %2 - newer %3).\nDo you want to download it now ?").arg(fwToUpdate).arg(OldFwRev).arg(NewFwRev));
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
msgBox.addButton(trUtf8("No"), QMessageBox::NoRole);
@@ -532,7 +533,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
warning=0;
contributorsDialog *cd = new contributorsDialog(this,2,rn);
cd->exec();
- int ret2 = QMessageBox::question(this, "companion9x", tr("Do you want to download release %1 now ?").arg(NewFwRev),
+ int ret2 = QMessageBox::question(this, "Companion", tr("Do you want to download release %1 now ?").arg(NewFwRev),
QMessageBox::Yes | QMessageBox::No);
if (ret2 == QMessageBox::Yes) {
download = true;
@@ -546,10 +547,10 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
}
} else {
if(showcheckForUpdatesResult && check1done && check2done)
- QMessageBox::information(this, "companion9x", tr("No updates available at this time."));
+ QMessageBox::information(this, "Companion", tr("No updates available at this time."));
}
if (ignore) {
- int res = QMessageBox::question(this, "companion9x",tr("Ignore this version (r%1)?").arg(rev), QMessageBox::Yes | QMessageBox::No);
+ int res = QMessageBox::question(this, "Companion",tr("Ignore this version (r%1)?").arg(rev), QMessageBox::Yes | QMessageBox::No);
if (res==QMessageBox::Yes) {
settings.beginGroup("FwRevisions");
settings.setValue(fwToUpdate, NewFwRev);
@@ -559,7 +560,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
if (warning>0) {
QString rn = GetFirmware(fwToUpdate)->rnurl;
if (!rn.isEmpty()) {
- int ret2 = QMessageBox::warning(this, "companion9x", tr("Release notes contain very important informations. Do you want to see them now ?"), QMessageBox::Yes | QMessageBox::No);
+ int ret2 = QMessageBox::warning(this, "Companion", tr("Release notes contain very important informations. Do you want to see them now ?"), QMessageBox::Yes | QMessageBox::No);
if (ret2 == QMessageBox::Yes) {
contributorsDialog *cd = new contributorsDialog(this,2,rn);
cd->exec();
@@ -592,11 +593,11 @@ void MainWindow::reply1Finished(QNetworkReply * reply)
}
}
} else {
- QMessageBox::warning(this, "companion9x", tr("Unable to check for updates."));
+ QMessageBox::warning(this, "Companion", tr("Unable to check for updates."));
}
} else {
if(check1done && check2done) {
- QMessageBox::warning(this, "companion9x", tr("Unable to check for updates."));
+ QMessageBox::warning(this, "Companion", tr("Unable to check for updates."));
int server = settings.value("fwserver",0).toInt();
server++;
settings.setValue("fwserver",server);
@@ -718,13 +719,13 @@ void MainWindow::loadProfile()
settings.setValue("profileId", profnum);
current_firmware_variant = GetFirmwareVariant(firmware_id);
FirmwareInfo *firmware = GetCurrentFirmware();
- setWindowTitle(tr("companion9x - Models and Settings Editor - %1").arg(firmware->name));
+ setWindowTitle(tr("Companion - Models and Settings Editor - %1").arg(firmware->name));
// settings.setValue("lastDir", QFileInfo(fileName).dir().absolutePath());
foreach (QMdiSubWindow *window, mdiArea->subWindowList()) {
MdiChild *mdiChild = qobject_cast(window->widget());
mdiChild->eepromInterfaceChanged();
}
- setWindowTitle(tr("companion9x - Models and Settings Editor - %1 - profile %2").arg(firmware->name).arg(ActiveProfileName));
+ setWindowTitle(tr("Companion - Models and Settings Editor - %1 - profile %2").arg(firmware->name).arg(ActiveProfileName));
}
}
@@ -735,7 +736,7 @@ void MainWindow::unloadProfile()
QSettings settings("companion9x", "companion9x");
settings.setValue("ActiveProfile",0);
FirmwareInfo *firmware = GetCurrentFirmware();
- setWindowTitle(tr("companion9x - Models and Settings Editor - %1").arg(firmware->name));
+ setWindowTitle(tr("Companion - Models and Settings Editor - %1").arg(firmware->name));
}
void MainWindow::preferences()
@@ -744,9 +745,9 @@ void MainWindow::preferences()
pd->exec();
FirmwareInfo *firmware = GetCurrentFirmware();
if (ActiveProfile) {
- setWindowTitle(tr("companion9x - Models and Settings Editor - %1 - profile %2").arg(firmware->name).arg(ActiveProfileName));
+ setWindowTitle(tr("Companion - Models and Settings Editor - %1 - profile %2").arg(firmware->name).arg(ActiveProfileName));
} else {
- setWindowTitle(tr("companion9x - Models and Settings Editor - %1").arg(firmware->name));
+ setWindowTitle(tr("Companion - Models and Settings Editor - %1").arg(firmware->name));
}
foreach (QMdiSubWindow *window, mdiArea->subWindowList()) {
@@ -1082,10 +1083,10 @@ void MainWindow::burnExtenalToEEPROM()
cd->exec();
if (!fileName.isEmpty()) {
settings.setValue("lastDir", QFileInfo(fileName).dir().absolutePath());
- int ret = QMessageBox::question(this, "companion9x", tr("Write Models and settings from %1 to the Tx?").arg(QFileInfo(fileName).fileName()), QMessageBox::Yes | QMessageBox::No);
+ int ret = QMessageBox::question(this, "Companion", tr("Write Models and settings from %1 to the Tx?").arg(QFileInfo(fileName).fileName()), QMessageBox::Yes | QMessageBox::No);
if (ret != QMessageBox::Yes) return;
if (!isValidEEPROM(fileName))
- ret = QMessageBox::question(this, "companion9x", tr("The file %1\nhas not been recognized as a valid Models and Settings file\nWrite anyway ?").arg(QFileInfo(fileName).fileName()), QMessageBox::Yes | QMessageBox::No);
+ ret = QMessageBox::question(this, "Companion", tr("The file %1\nhas not been recognized as a valid Models and Settings file\nWrite anyway ?").arg(QFileInfo(fileName).fileName()), QMessageBox::Yes | QMessageBox::No);
if (ret != QMessageBox::Yes) return;
bool backupEnable = settings.value("backupEnable", true).toBool();
QString backupPath = settings.value("backupPath", "").toString();
@@ -1489,15 +1490,16 @@ void MainWindow::logFile()
void MainWindow::about()
{
- QString aboutStr = "
";
- aboutStr.append(tr("Copyright") +" Bertrand Songis & Romolo Manfredini © 2011- 2013
");
- aboutStr.append(QString("http://code.google.com/p/companion9x/
")+tr("Version %1 (revision %2), %3").arg(C9X_VERSION).arg(C9X_REVISION).arg(__DATE__)+QString("
"));
- aboutStr.append(tr("The companion9x project was originally forked from eePe")+QString(" http://code.google.com/p/eepe
"));
+ QString aboutStr = "
";
+ aboutStr.append("OpenTX Home Page: http://open-tx.org
");
+ aboutStr.append(tr("The Companion project was originally forked from eePe")+QString(" http://code.google.com/p/eepe
"));
aboutStr.append(tr("If you've found this program useful, please support by"));
aboutStr.append(" ");
- aboutStr.append(tr("donating") + "");
+ aboutStr.append(tr("donating") + "
");
+ aboutStr.append(tr("Version %1 (revision %2), %3").arg(C9X_VERSION).arg(C9X_REVISION).arg(__DATE__)+QString("
"));
+ aboutStr.append(tr("Copyright") +" Bertrand Songis & Romolo Manfredini © 2011- 2014
");
- QMessageBox::about(this, tr("About companion9x"),aboutStr);
+ QMessageBox::about(this, tr("About Companion"),aboutStr);
}
void MainWindow::updateMenus()
@@ -1624,15 +1626,15 @@ void MainWindow::createActions()
connect(preferencesAct, SIGNAL(triggered()), this, SLOT(preferences()));
checkForUpdatesAct = new QAction(QIcon(":/images/update.png"), tr("&Check for updates..."), this);
- checkForUpdatesAct->setStatusTip(tr("Check for new version of companion9x/er9x"));
+ checkForUpdatesAct->setStatusTip(tr("Check for new version of Companion"));
connect(checkForUpdatesAct, SIGNAL(triggered()), this, SLOT(doUpdates()));
contributorsAct = new QAction(QIcon(":/images/contributors.png"), tr("Contributors &List..."), this);
- contributorsAct->setStatusTip(tr("Show companion9x contributors list"));
+ contributorsAct->setStatusTip(tr("Show Companion contributors list"));
connect(contributorsAct, SIGNAL(triggered()), this, SLOT(contributors()));
changelogAct = new QAction(QIcon(":/images/changelog.png"), tr("ChangeLog..."), this);
- changelogAct->setStatusTip(tr("Show companion9x changelog"));
+ changelogAct->setStatusTip(tr("Show Companion changelog"));
connect(changelogAct, SIGNAL(triggered()), this, SLOT(changelog()));
fwchangelogAct = new QAction(QIcon(":/images/changelog.png"), tr("Firmware ChangeLog..."), this);
diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp
index 6fbd16afa..3145cecff 100644
--- a/companion/src/mdichild.cpp
+++ b/companion/src/mdichild.cpp
@@ -44,7 +44,7 @@
#include "xmlinterface.h"
#include "hexinterface.h"
#include "mainwindow.h"
-#include "modeledit.h"
+#include "modeledit/modeledit.h"
#include "generaledit.h"
#include "avroutputdialog.h"
#include "burnconfigdialog.h"
@@ -144,13 +144,16 @@ void MdiChild::on_SimulateTxButton_clicked()
{
if (GetEepromInterface()->getSimulator()) {
if (GetEepromInterface()->getCapability(SimulatorType)==1) {
- xsimulatorDialog sd(this);
- sd.loadParams(radioData);
- sd.exec();
- } else {
- simulatorDialog sd(this);
- sd.loadParams(radioData);
- sd.exec();
+ xsimulatorDialog * sd = new xsimulatorDialog(this);
+ sd->loadParams(radioData);
+ sd->exec();
+ delete sd;
+ }
+ else {
+ simulatorDialog * sd = new simulatorDialog(this);
+ sd->loadParams(radioData);
+ sd->exec();
+ delete sd;
}
}
else {
@@ -179,12 +182,12 @@ void MdiChild::OpenEditWindow(bool wizard=false)
QSettings settings("companion9x", "companion9x");
bool wizardEnable=settings.value("wizardEnable", true).toBool();
if (wizardEnable) {
- ret = QMessageBox::question(this, tr("companion9x"), tr("Do you want to use model wizard? "), QMessageBox::Yes | QMessageBox::No);
+ 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 {
qSleep(500);
- ret = QMessageBox::question(this, tr("companion9x"), tr("Ask this question again ? "), QMessageBox::Yes | QMessageBox::No);
+ ret = QMessageBox::question(this, tr("Companion"), tr("Ask this question again ? "), QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::No) {
settings.setValue("wizardEnable", false);
}
@@ -192,9 +195,9 @@ void MdiChild::OpenEditWindow(bool wizard=false)
}
}
ModelEdit *t = new ModelEdit(radioData, (row - 1), wizard, this);
- if (isNew && !wizard) t->applyBaseTemplate();
+ // TODO if (isNew && !wizard) t->applyBaseTemplate();
t->setWindowTitle(tr("Editing model %1: ").arg(row) + model.name);
- connect(t, SIGNAL(modelValuesChanged()), this, SLOT(setModified()));
+ connect(t, SIGNAL(modified()), this, SLOT(setModified()));
//t->exec();
t->show();
}
@@ -467,7 +470,7 @@ bool MdiChild::maybeSave()
{
if (fileChanged) {
QMessageBox::StandardButton ret;
- ret = QMessageBox::warning(this, tr("companion9x"),
+ ret = QMessageBox::warning(this, tr("Companion"),
tr("%1 has been modified.\n"
"Do you want to save your changes?").arg(userFriendlyCurrentFile()),
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
diff --git a/companion/src/modelconfigdialog.cpp b/companion/src/modelconfigdialog.cpp
index d9e245107..49c4a8df0 100644
--- a/companion/src/modelconfigdialog.cpp
+++ b/companion/src/modelconfigdialog.cpp
@@ -9,7 +9,7 @@ modelConfigDialog::modelConfigDialog(RadioData &radioData, uint64_t * result, QW
ui(new Ui::modelConfigDialog),
radioData(radioData),
result(result),
- g_eeGeneral(radioData.generalSettings)
+ generalSettings(radioData.generalSettings)
{
ui->setupUi(this);
rxLock=false;
@@ -930,4 +930,4 @@ void modelConfigDialog::asUpdate()
ui->asspo2_CB->hide();
}
rxLock=false;
-}
\ No newline at end of file
+}
diff --git a/companion/src/modelconfigdialog.h b/companion/src/modelconfigdialog.h
index e5418a8a5..f8f508c71 100644
--- a/companion/src/modelconfigdialog.h
+++ b/companion/src/modelconfigdialog.h
@@ -23,7 +23,7 @@ private:
int ModelType;
RadioData &radioData;
uint64_t * result;
- GeneralSettings g_eeGeneral;
+ GeneralSettings generalSettings;
QStringList ruddercolor;
QStringList aileroncolor;
QStringList elevatorcolor;
diff --git a/companion/src/modeledit.cpp b/companion/src/modeledit.cpp
deleted file mode 100644
index b6b5aade1..000000000
--- a/companion/src/modeledit.cpp
+++ /dev/null
@@ -1,7433 +0,0 @@
-#include "modeledit.h"
-#include "ui_modeledit.h"
-#include "helpers.h"
-#include "edge.h"
-#include "node.h"
-#include "expodialog.h"
-#include "mixerdialog.h"
-#include "simulatordialog.h"
-#include "xsimulatordialog.h"
-#include "modelconfigdialog.h"
-#include
-#include
-#include
-
-#define BC_BIT_RUD (0x01)
-#define BC_BIT_ELE (0x02)
-#define BC_BIT_THR (0x04)
-#define BC_BIT_AIL (0x08)
-#define BC_BIT_P1 (0x10)
-#define BC_BIT_P2 (0x20)
-#define BC_BIT_P3 (0x40)
-#define BC_BIT_P4 (0x80)
-#define BC_BIT_REA (0x80)
-#define BC_BIT_REB (0x100)
-
-#define RUD (1)
-#define ELE (2)
-#define THR (3)
-#define AIL (4)
-
-#define GFX_MARGIN 16
-
-ModelEdit::ModelEdit(RadioData &radioData, uint8_t id, bool openWizard, bool isNew, QWidget *parent) :
- QDialog(parent),
- redrawCurve(true),
- openWizard(openWizard),
- isNew(isNew),
- ui(new Ui::ModelEdit),
- radioData(radioData),
- id_model(id),
- g_model(radioData.models[id]),
- g_eeGeneral(radioData.generalSettings)
-{
- ui->setupUi(this);
-
- setupMixerListWidget();
- setupExposListWidget();
-
- QSettings settings("companion9x", "companion9x");
- ui->tabWidget->setCurrentIndex(settings.value("modelEditTab", 0).toInt());
-
- QRegExp rx(CHAR_FOR_NAMES_REGEX);
- ui->modelNameLE->setValidator(new QRegExpValidator(rx, this));
- ui->phase0Name->setValidator(new QRegExpValidator(rx, this));
- ui->phase1Name->setValidator(new QRegExpValidator(rx, this));
- ui->phase2Name->setValidator(new QRegExpValidator(rx, this));
- ui->phase3Name->setValidator(new QRegExpValidator(rx, this));
- ui->phase4Name->setValidator(new QRegExpValidator(rx, this));
- ui->phase5Name->setValidator(new QRegExpValidator(rx, this));
- ui->phase6Name->setValidator(new QRegExpValidator(rx, this));
- ui->phase7Name->setValidator(new QRegExpValidator(rx, this));
- ui->phase8Name->setValidator(new QRegExpValidator(rx, this));
- ui->cname_LE->setValidator(new QRegExpValidator(rx, this));
- #ifdef PHONON
- phononLock=false;
- clickObject = new Phonon::MediaObject(this);
- clickOutput = new Phonon::AudioOutput(Phonon::NoCategory, this);
- Phonon::createPath(clickObject, clickOutput);
- connect(clickObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(mediaPlayer_state(Phonon::State,Phonon::State)));
- #endif
-
- tabModelEditSetup();
- tabPhases();
- tabExpos();
- tabMixes();
- tabLimits();
- tabCurves();
- tabCustomSwitches();
- selectedSwitch=0;
- int telTab=10;
- int fswTab=9;
-
- if (GetEepromInterface()->getCapability(FSSwitch)) {
- ui->tabSafetySwitches->setDisabled(true);
- ui->tabWidget->removeTab(8);
- telTab--;
- fswTab--;
- } else {
- tabSafetySwitches();
- }
-
- if (GetEepromInterface()->getCapability(CustomFunctions)==0 ) {
- ui->tabCustomFunctions->setDisabled(true);
- ui->tabWidget->removeTab(fswTab);
- telTab--;
- } else {
- tabCustomFunctions();
- selectedFunction=0;
- }
- tabTemplates();
- tabHeli();
- if (GetEepromInterface()->getCapability(Telemetry) & TM_HASTELEMETRY) {
- tabTelemetry();
- } else {
- ui->tabTelemetry->setDisabled(true);
- ui->tabWidget->removeTab(telTab);
- }
- ui->tabWidget->setCurrentIndex(0);
- ui->curvePreview->setMinimumWidth(240);
- ui->curvePreview->setMinimumHeight(240);
- resizeEvent();
- QTimer::singleShot(0, this, SLOT(shrink()));
- if (openWizard) {
- QTimer::singleShot(1, this, SLOT(wizard()));
- }
-}
-
-ModelEdit::~ModelEdit()
-{
- delete ui;
-}
-
-
-float ModelEdit::getBarStep(int barId)
-{
- switch (barId-1) {
- case TELEMETRY_SOURCE_TX_BATT:
- return 0.1;
- break;
- case TELEMETRY_SOURCE_TIMER1:
- case TELEMETRY_SOURCE_TIMER2:
- return 3;
- break;
- case TELEMETRY_SOURCE_A1:
- case TELEMETRY_SOURCE_A1_MIN:
- return (ui->a1RatioSB->value()/255);
- break;
- case TELEMETRY_SOURCE_A2:
- case TELEMETRY_SOURCE_A2_MIN:
- return (ui->a2RatioSB->value()/255);
- break;
- case TELEMETRY_SOURCE_ALT:
- case TELEMETRY_SOURCE_GPS_ALT:
- case TELEMETRY_SOURCE_ALT_MAX:
- case TELEMETRY_SOURCE_ALT_MIN:
- return 8;
- break;
- case TELEMETRY_SOURCE_RPM:
- case TELEMETRY_SOURCE_RPM_MAX:
- return 50;
- break;
- case TELEMETRY_SOURCE_CELLS_SUM:
- case TELEMETRY_SOURCE_VFAS:
- return 0.1;
- break;
- case TELEMETRY_SOURCE_CELL:
- return 0.02;
- break;
- case TELEMETRY_SOURCE_HDG:
- return 2;
- break;
- case TELEMETRY_SOURCE_DIST:
- case TELEMETRY_SOURCE_DIST_MAX:
- return 8;
- break;
- case TELEMETRY_SOURCE_CURRENT_MAX:
- case TELEMETRY_SOURCE_CURRENT:
- return 0.5;
- break;
- case TELEMETRY_SOURCE_POWER:
- return 5;
- break;
- case TELEMETRY_SOURCE_CONSUMPTION:
- return 20;
- break;
- case TELEMETRY_SOURCE_SPEED:
- case TELEMETRY_SOURCE_SPEED_MAX:
- if (g_model.frsky.imperial==1) {
- return 1;
- } else {
- return 1.852;
- }
- break;
- default:
- return 1;
- break;
- }
-}
-
-void ModelEdit::setupExposListWidget()
-{
- ExposlistWidget = new MixersList(this, true);
- QPushButton * qbUp = new QPushButton(this);
- QPushButton * qbDown = new QPushButton(this);
- QPushButton * qbClear = new QPushButton(this);
-
- qbUp->setText(tr("Move Up"));
- qbUp->setIcon(QIcon(":/images/moveup.png"));
- qbUp->setShortcut(QKeySequence(tr("Ctrl+Up")));
- qbDown->setText(tr("Move Down"));
- qbDown->setIcon(QIcon(":/images/movedown.png"));
- qbDown->setShortcut(QKeySequence(tr("Ctrl+Down")));
- qbClear->setText(tr("Clear Expo Settings"));
- qbClear->setIcon(QIcon(":/images/clear.png"));
-
- ui->exposLayout->addWidget(ExposlistWidget,1,1,1,3);
- ui->exposLayout->addWidget(qbUp,2,1);
- ui->exposLayout->addWidget(qbClear,2,2);
- ui->exposLayout->addWidget(qbDown,2,3);
-
- connect(ExposlistWidget,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(expolistWidget_customContextMenuRequested(QPoint)));
- connect(ExposlistWidget,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(expolistWidget_doubleClicked(QModelIndex)));
- connect(ExposlistWidget,SIGNAL(mimeDropped(int,const QMimeData*,Qt::DropAction)),this,SLOT(mimeExpoDropped(int,const QMimeData*,Qt::DropAction)));
-
- connect(qbUp,SIGNAL(pressed()),SLOT(moveExpoUp()));
- connect(qbDown,SIGNAL(pressed()),SLOT(moveExpoDown()));
- connect(qbClear,SIGNAL(pressed()),SLOT(clearExpos()));
-
- connect(ExposlistWidget,SIGNAL(keyWasPressed(QKeyEvent*)), this, SLOT(expolistWidget_KeyPress(QKeyEvent*)));
-}
-
-void ModelEdit::setupMixerListWidget()
-{
- MixerlistWidget = new MixersList(this, false); // TODO enum
- QPushButton * qbUp = new QPushButton(this);
- QPushButton * qbDown = new QPushButton(this);
- QPushButton * qbClear = new QPushButton(this);
-
- qbUp->setText(tr("Move Up"));
- qbUp->setIcon(QIcon(":/images/moveup.png"));
- qbUp->setShortcut(QKeySequence(tr("Ctrl+Up")));
- qbDown->setText(tr("Move Down"));
- qbDown->setIcon(QIcon(":/images/movedown.png"));
- qbDown->setShortcut(QKeySequence(tr("Ctrl+Down")));
- qbClear->setText(tr("Clear Mixes"));
- qbClear->setIcon(QIcon(":/images/clear.png"));
-
- ui->mixersLayout->addWidget(MixerlistWidget,1,1,1,3);
- ui->mixersLayout->addWidget(qbUp,2,1);
- ui->mixersLayout->addWidget(qbClear,2,2);
- ui->mixersLayout->addWidget(qbDown,2,3);
-
- connect(MixerlistWidget,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(mixerlistWidget_customContextMenuRequested(QPoint)));
- connect(MixerlistWidget,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(mixerlistWidget_doubleClicked(QModelIndex)));
- connect(MixerlistWidget,SIGNAL(mimeDropped(int,const QMimeData*,Qt::DropAction)),this,SLOT(mimeMixerDropped(int,const QMimeData*,Qt::DropAction)));
-
- connect(qbUp,SIGNAL(pressed()),SLOT(moveMixUp()));
- connect(qbDown,SIGNAL(pressed()),SLOT(moveMixDown()));
- connect(qbClear,SIGNAL(pressed()),SLOT(clearMixes()));
-
- connect(MixerlistWidget,SIGNAL(keyWasPressed(QKeyEvent*)), this, SLOT(mixerlistWidget_KeyPress(QKeyEvent*)));
-}
-
-void ModelEdit::resizeEvent(QResizeEvent *event)
-{
-
- if(ui->curvePreview->scene())
- {
- QRect qr = ui->curvePreview->contentsRect();
- ui->curvePreview->scene()->setSceneRect(GFX_MARGIN, GFX_MARGIN, qr.width()-GFX_MARGIN*2, qr.height()-GFX_MARGIN*2);
- drawCurve();
- }
-
- QDialog::resizeEvent(event);
-
-}
-
-void ModelEdit::applyBaseTemplate()
-{
- clearMixes(false);
- applyTemplate(0);
- updateSettings();
- tabMixes();
-}
-
-void ModelEdit::updateSettings()
-{
- radioData.models[id_model] = g_model;
- emit modelValuesChanged();
-}
-
-void ModelEdit::on_tabWidget_currentChanged(int index)
-{
- QSettings settings("companion9x", "companion9x");
- settings.setValue("modelEditTab",index);//ui->tabWidget->currentIndex());
- resizeEvent();
-}
-
-void ModelEdit::fssldValueChanged()
-{
- if (fsLock)
- return;
- fsLock=true;
- QSpinBox * fssb1[] = { ui->fsm1SB_1, ui->fsm1SB_2,ui->fsm1SB_3,ui->fsm1SB_4,ui->fsm1SB_5,ui->fsm1SB_6,ui->fsm1SB_7,ui->fsm1SB_8,
- ui->fsm1SB_9, ui->fsm1SB_10,ui->fsm1SB_11,ui->fsm1SB_12,ui->fsm1SB_13,ui->fsm1SB_14,ui->fsm1SB_15,ui->fsm1SB_16, NULL };
- QSpinBox * fssb2[] = { ui->fsm2SB_1, ui->fsm2SB_2,ui->fsm2SB_3,ui->fsm2SB_4,ui->fsm2SB_5,ui->fsm2SB_6,ui->fsm2SB_7,ui->fsm2SB_8,
- ui->fsm2SB_9, ui->fsm2SB_10,ui->fsm2SB_11,ui->fsm2SB_12,ui->fsm2SB_13,ui->fsm2SB_14,ui->fsm2SB_15,ui->fsm2SB_16, NULL };
- QSlider *sl = qobject_cast(sender());
- int fsId=sl->objectName().mid(sl->objectName().lastIndexOf("_")+1).toInt()-1;
- int moduleid=sl->objectName().mid(3,1).toInt();
- if (moduleid==1) {
- fssb1[fsId]->setValue(sl->value());
- } else {
- fssb2[fsId]->setValue(sl->value());
- }
- fsLock=false;
-}
-
-void ModelEdit::fssbValueChanged()
-{
- if (fsLock)
- return;
- fsLock=true;
- QSlider * fssld1[] = { ui->fsm1SL_1, ui->fsm1SL_2,ui->fsm1SL_3,ui->fsm1SL_4,ui->fsm1SL_5,ui->fsm1SL_6,ui->fsm1SL_7,ui->fsm1SL_8,
- ui->fsm1SL_9, ui->fsm1SL_10,ui->fsm1SL_11,ui->fsm1SL_12,ui->fsm1SL_13,ui->fsm1SL_14,ui->fsm1SL_15,ui->fsm1SL_16, NULL };
- QSlider * fssld2[] = { ui->fsm2SL_1, ui->fsm2SL_2,ui->fsm2SL_3,ui->fsm2SL_4,ui->fsm2SL_5,ui->fsm2SL_6,ui->fsm2SL_7,ui->fsm2SL_8,
- ui->fsm2SL_9, ui->fsm2SL_10,ui->fsm2SL_11,ui->fsm2SL_12,ui->fsm2SL_13,ui->fsm2SL_14,ui->fsm2SL_15,ui->fsm2SL_16, NULL };
- QSpinBox *sb = qobject_cast(sender());
- int fsId=sb->objectName().mid(sb->objectName().lastIndexOf("_")+1).toInt()-1;
- int moduleid=sb->objectName().mid(3,1).toInt();
- if (moduleid==1) {
- fssld1[fsId]->setValue(sb->value());
- } else {
- fssld2[fsId]->setValue(sb->value());
- }
- fsLock=false;
-}
-
-void ModelEdit::fssldEdited()
-{
- QSlider *sl = qobject_cast(sender());
- int fsId=sl->objectName().mid(sl->objectName().lastIndexOf("_")+1).toInt()-1;
- int moduleid=sl->objectName().mid(3,1).toInt();
- if (moduleid==1) {
- g_model.moduleData[0].failsafeChannels[fsId]=sl->value();
- } else {
- g_model.moduleData[1].failsafeChannels[fsId]=sl->value();
- }
- updateSettings();
-}
-
-void ModelEdit::fssbEdited()
-{
- QSpinBox *sb = qobject_cast(sender());
- int fsId=sb->objectName().mid(sb->objectName().lastIndexOf("_")+1).toInt()-1;
- int moduleid=sb->objectName().mid(3,1).toInt();
- if (moduleid==1) {
- g_model.moduleData[0].failsafeChannels[fsId]=sb->value();
- } else {
- g_model.moduleData[1].failsafeChannels[fsId]=sb->value();
- }
- updateSettings();
-}
-
-void ModelEdit::tabModelEditSetup()
-{
- //name
- QLabel * pmsl[] = {ui->swwarn_label, ui->swwarn0_label, ui->swwarn4_label, NULL};
- QCheckBox * pmchkb[] = {ui->swwarn1_ChkB,ui->swwarn2_ChkB,ui->swwarn3_ChkB,ui->swwarn5_ChkB,ui->swwarn6_ChkB, NULL};
- QSlider * tpmsld[] = {ui->chkSA, ui->chkSB, ui->chkSC, ui->chkSD, ui->chkSE, ui->chkSF, ui->chkSG, NULL};
- QSlider * fssld1[] = { ui->fsm1SL_1, ui->fsm1SL_2,ui->fsm1SL_3,ui->fsm1SL_4,ui->fsm1SL_5,ui->fsm1SL_6,ui->fsm1SL_7,ui->fsm1SL_8,
- ui->fsm1SL_9, ui->fsm1SL_10,ui->fsm1SL_11,ui->fsm1SL_12,ui->fsm1SL_13,ui->fsm1SL_14,ui->fsm1SL_15,ui->fsm1SL_16, NULL };
- QSlider * fssld2[] = { ui->fsm2SL_1, ui->fsm2SL_2,ui->fsm2SL_3,ui->fsm2SL_4,ui->fsm2SL_5,ui->fsm2SL_6,ui->fsm2SL_7,ui->fsm2SL_8,
- ui->fsm2SL_9, ui->fsm2SL_10,ui->fsm2SL_11,ui->fsm2SL_12,ui->fsm2SL_13,ui->fsm2SL_14,ui->fsm2SL_15,ui->fsm2SL_16, NULL };
- QSpinBox * fssb1[] = { ui->fsm1SB_1, ui->fsm1SB_2,ui->fsm1SB_3,ui->fsm1SB_4,ui->fsm1SB_5,ui->fsm1SB_6,ui->fsm1SB_7,ui->fsm1SB_8,
- ui->fsm1SB_9, ui->fsm1SB_10,ui->fsm1SB_11,ui->fsm1SB_12,ui->fsm1SB_13,ui->fsm1SB_14,ui->fsm1SB_15,ui->fsm1SB_16, NULL };
- QSpinBox * fssb2[] = { ui->fsm2SB_1, ui->fsm2SB_2,ui->fsm2SB_3,ui->fsm2SB_4,ui->fsm2SB_5,ui->fsm2SB_6,ui->fsm2SB_7,ui->fsm2SB_8,
- ui->fsm2SB_9, ui->fsm2SB_10,ui->fsm2SB_11,ui->fsm2SB_12,ui->fsm2SB_13,ui->fsm2SB_14,ui->fsm2SB_15,ui->fsm2SB_16, NULL };
- if (IS_TARANIS(GetEepromInterface()->getBoard())) {
- ui->modelNameLE->setMaxLength(12);
- } else {
- ui->modelNameLE->setMaxLength(10);
- }
- ui->modelNameLE->setText(g_model.name);
- fsLock=true;
- if (GetEepromInterface()->getCapability(NumModules)<2) {
- ui->rf2_GB->hide();
- }
-
- if (!GetEepromInterface()->getCapability(HasFailsafe)) {
- ui->FSGB_1 ->hide();
- ui->FSGB_2->hide();
- ui->ModelSetupTab->setTabEnabled(1,0);
- } else {
- if (GetEepromInterface()->getCapability(HasFailsafe)<32) {
- ui->FSGB_2->hide();
- }
-
- for (int i=0; fssld1[i]; i++) {
- fssld1[i]->setValue(g_model.moduleData[0].failsafeChannels[i]);
- fssld2[i]->setValue(g_model.moduleData[1].failsafeChannels[i]);
- fssb1[i]->setValue(g_model.moduleData[0].failsafeChannels[i]);
- fssb2[i]->setValue(g_model.moduleData[1].failsafeChannels[i]);
- connect(fssld1[i],SIGNAL(valueChanged(int)),this,SLOT(fssldValueChanged()));
- connect(fssld2[i],SIGNAL(valueChanged(int)),this,SLOT(fssldValueChanged()));
- connect(fssb1[i],SIGNAL(valueChanged(int)),this,SLOT(fssbValueChanged()));
- connect(fssb2[i],SIGNAL(valueChanged(int)),this,SLOT(fssbValueChanged()));
- connect(fssld1[i],SIGNAL(sliderReleased()),this,SLOT(fssldEdited()));
- connect(fssld2[i],SIGNAL(sliderReleased()),this,SLOT(fssldEdited()));
- connect(fssb1[i],SIGNAL(editingFinished()),this,SLOT(fssbEdited()));
- connect(fssb2[i],SIGNAL(editingFinished()),this,SLOT(fssbEdited()));
- }
- }
- fsLock=false;
- //timer1 mode direction value
- populateTimerSwitchCB(ui->timer1ModeCB,g_model.timers[0].mode,GetEepromInterface()->getCapability(TimerTriggerB));
- int min = g_model.timers[0].val/60;
- int sec = g_model.timers[0].val%60;
- ui->timer1ValTE->setTime(QTime(0,min,sec));
- ui->timer1DirCB->setCurrentIndex(g_model.timers[0].dir);
- if (!GetEepromInterface()->getCapability(ModelVoice)) {
- ui->modelVoice_SB->hide();
- ui->modelVoice_label->hide();
- } else {
- ui->modelVoice_SB->setValue(g_model.modelVoice+260);
- }
- if (!GetEepromInterface()->getCapability(PerModelThrottleInvert)) {
- ui->label_thrrev->hide();
- ui->thrrevChkB->hide();
- } else {
- ui->thrrevChkB->setChecked(g_model.throttleReversed);
- }
- if (!GetEepromInterface()->getCapability(ModelImage)) {
- ui->modelImage_CB->hide();
- ui->modelImage_label->hide();
- ui->modelImage_image->hide();
- } else {
- modelImageLock=true;
- QStringList items;
- items.append("");
- QSettings settings("companion9x", "companion9x");
- QString path=settings.value("sdPath", ".").toString();
- path.append("/BMP/");
- QDir qd(path);
- int vml= GetEepromInterface()->getCapability(VoicesMaxLength)+4;
- if (qd.exists()) {
- QStringList filters;
- filters << "*.bmp" << "*.bmp";
- foreach ( QString file, qd.entryList(filters, QDir::Files) ) {
- QFileInfo fi(file);
- QString temp=fi.completeBaseName();
- if (!items.contains(temp) && temp.length()<=vml) {
- items.append(temp);
- }
- }
- }
- if (!items.contains(g_model.bitmap)) {
- items.append(g_model.bitmap);
- }
- items.sort();
- ui->modelImage_CB->clear();
- foreach ( QString file, items ) {
- ui->modelImage_CB->addItem(file);
- if (file==g_model.bitmap) {
- ui->modelImage_CB->setCurrentIndex(ui->modelImage_CB->count()-1);
- QString fileName=path;
- fileName.append(g_model.bitmap);
- fileName.append(".bmp");
- QImage image(fileName);
- if (image.isNull()) {
- fileName=path;
- fileName.append(g_model.bitmap);
- fileName.append(".BMP");
- image.load(fileName);
- }
- if (!image.isNull()) {
- ui->modelImage_image->setPixmap(QPixmap::fromImage(image.scaled( 64,32)));;
- }
- }
- }
- modelImageLock=false;
- }
-
- if (!GetEepromInterface()->getCapability(pmSwitchMask)) {
- for (int i=0; pmsl[i]; i++) {
- pmsl[i]->hide();
- }
- for (int i=0; pmchkb[i]; i++) {
- pmchkb[i]->hide();
- }
- ui->tswwarn0_CB->hide();
- for (int i=0; tpmsld[i]; i++) {
- tpmsld[i]->hide();
- }
- ui->swwarn0_line->hide();
- ui->swwarn0_line->hide();
- ui->swwarn0_CB->hide();
- ui->swwarn4_CB->hide();
- ui->swwarn_line0->hide();
- ui->swwarn_line1->hide();
- ui->swwarn_line2->hide();
- ui->swwarn_line3->hide();
- ui->swwarn_line4->hide();
- ui->swwarn_line5->hide();
- ui->tswwarn0_label->hide();
- ui->tswwarn1_label->hide();
- ui->tswwarn2_label->hide();
- ui->tswwarn3_label->hide();
- ui->tswwarn4_label->hide();
- ui->tswwarn5_label->hide();
- ui->tswwarn6_label->hide();
- ui->tswwarn7_label->hide();
- } else {
- if (GetEepromInterface()->getCapability(Pots)==3) {
- ui->swwarn0_CB->setCurrentIndex(g_model.switchWarningStates & 0x01);
- ui->swwarn1_ChkB->setChecked(checkbit(g_model.switchWarningStates, 1));
- ui->swwarn2_ChkB->setChecked(checkbit(g_model.switchWarningStates, 2));
- ui->swwarn3_ChkB->setChecked(checkbit(g_model.switchWarningStates, 3));
- ui->swwarn4_CB->setCurrentIndex((g_model.switchWarningStates & 0x30)>>4);
- ui->swwarn5_ChkB->setChecked(checkbit(g_model.switchWarningStates, 6));
- ui->swwarn6_ChkB->setChecked(checkbit(g_model.switchWarningStates, 7));
- for (int i=0; pmchkb[i]; i++) {
- connect(pmchkb[i], SIGNAL(stateChanged(int)),this,SLOT(startupSwitchEdited()));
- }
- connect(ui->swwarn0_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(startupSwitchEdited()));
- connect(ui->swwarn4_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(startupSwitchEdited()));
- } else {
- ui->tswwarn0_CB->setCurrentIndex(g_model.switchWarningStates & 0x01);
- uint16_t switchstate=(g_model.switchWarningStates>>1);
- ui->chkSA->setValue(switchstate & 0x3);
- switchstate >>= 2;
- ui->chkSB->setValue(switchstate & 0x3);
- switchstate >>= 2;
- ui->chkSC->setValue(switchstate & 0x3);
- switchstate >>= 2;
- ui->chkSD->setValue(switchstate & 0x3);
- switchstate >>= 2;
- ui->chkSE->setValue(switchstate & 0x3);
- switchstate >>= 2;
- ui->chkSF->setValue((switchstate & 0x3)/2);
- switchstate >>= 2;
- ui->chkSG->setValue(switchstate & 0x3);
- connect(ui->tswwarn0_CB,SIGNAL(currentIndexChanged(int)),this,SLOT(startupSwitchEdited()));
- for (int i=0; tpmsld[i]; i++) {
- connect(tpmsld[i], SIGNAL(valueChanged(int)),this,SLOT(startupSwitchEdited()));
- }
- }
- }
- int ppmmax=GetEepromInterface()->getCapability(PPMFrameLength);
- if (ppmmax>0) {
- ui->ppmFrameLengthDSB->setMaximum(ppmmax);
- }
- if (!GetEepromInterface()->getCapability(InstantTrimSW)) {
- ui->instantTrim_label->hide();
- ui->instantTrim_CB->setDisabled(true);
- ui->instantTrim_CB->hide();
- } else {
- switchEditLock=true;
- int found=false;
- for (int i=0; i< C9X_MAX_CUSTOM_FUNCTIONS; i++) {
- if (g_model.funcSw[i].func==FuncInstantTrim) {
- populateSwitchCB(ui->instantTrim_CB,g_model.funcSw[i].swtch,POPULATE_MSWITCHES & POPULATE_ONOFF);
- found=true;
- break;
- }
- }
- if (found==false) {
- populateSwitchCB(ui->instantTrim_CB,RawSwitch(),POPULATE_MSWITCHES & POPULATE_ONOFF);
- }
- switchEditLock=false;
- }
- if (GetEepromInterface()->getCapability(NoTimerDirs)) {
- ui->timer1DirCB->hide();
- ui->timer2DirCB->hide();
- }
- if (GetEepromInterface()->getCapability(NoThrExpo)) {
- ui->label_thrExpo->hide();
- ui->thrExpoChkB->hide();
- }
- if (!(GetEepromInterface()->getCapability(ExtendedTrims)>0)) {
- ui->extendedTrimsChkB->hide();
- ui->extendedTrims_label->hide();
- }
- if (!GetEepromInterface()->getCapability(HasTTrace)) {
- ui->label_ttrace->hide();
- ui->ttraceCB->hide();
- } else {
- populateTTraceCB(ui->ttraceCB,g_model.thrTraceSrc);
- }
- if (GetEepromInterface()->getCapability(RotaryEncoders)==0) {
- ui->bcREaChkB->hide();
- ui->bcREbChkB->hide();
- }
- if (GetEepromInterface()->getCapability(Pots)==3) {
- ui->tswwarn0_CB->hide();
- ui->tswwarn0_label->hide();
- ui->tswwarn1_label->hide();
- ui->tswwarn2_label->hide();
- ui->tswwarn3_label->hide();
- ui->tswwarn4_label->hide();
- ui->tswwarn5_label->hide();
- ui->tswwarn6_label->hide();
- ui->tswwarn7_label->hide();
- ui->chkSA->hide();
- ui->chkSB->hide();
- ui->chkSC->hide();
- ui->chkSD->hide();
- ui->chkSE->hide();
- ui->chkSF->hide();
- ui->chkSG->hide();
- this->layout()->removeItem(ui->TaranisSwitchStartup);
- ui->bcP4ChkB->hide();
- } else {
- ui->swwarn0_CB->hide();
- ui->swwarn0_label->hide();
- ui->swwarn0_line->hide();
- ui->swwarn1_ChkB->hide();
- ui->swwarn1_line->hide();
- ui->swwarn2_ChkB->hide();
- ui->swwarn3_ChkB->hide();
- ui->swwarn4_CB->hide();
- ui->swwarn4_label->hide();
- ui->swwarn5_ChkB->hide();
- ui->swwarn6_ChkB->hide();
- ui->swwarn_line0->hide();
- ui->swwarn_line1->hide();
- ui->swwarn_line2->hide();
- ui->swwarn_line3->hide();
- ui->swwarn_line4->hide();
- ui->swwarn_line5->hide();
- this->layout()->removeItem(ui->StockSwitchStartup);
- ui->bcP1ChkB->setText(tr("S1"));
- ui->bcP2ChkB->setText(tr("S2"));
- ui->bcP3ChkB->setText(tr("LS"));
- }
-
- if (!GetEepromInterface()->getCapability(PerModelThrottleWarning)) {
- ui->thrwarnChkB->setDisabled(true);
- ui->thrwarnChkB->hide();
- ui->thrwarnLabel->hide();
- } else {
- switchEditLock=true;
- ui->thrwarnChkB->setChecked(g_model.disableThrottleWarning);
- switchEditLock=false;
- }
- if (!GetEepromInterface()->getCapability(TimerTriggerB)) {
- ui->timer1ModeBCB->hide();
- ui->timer1ModeB_label->hide();
- ui->timer2ModeBCB->hide();
- ui->timer2ModeB_label->hide();
- } else {
- populateTimerSwitchBCB(ui->timer1ModeBCB,g_model.timers[0].modeB,GetEepromInterface()->getCapability(TimerTriggerB));
- populateTimerSwitchBCB(ui->timer2ModeBCB,g_model.timers[1].modeB,GetEepromInterface()->getCapability(TimerTriggerB));
- }
-
- int index=0;
- int selindex;
- int selindex2;
- protocolEditLock=true;
- protocol2EditLock=true;
- ui->protocolCB->clear();
- for (int i=0; iisAvailable((Protocol)i)) {
- ui->protocolCB->addItem(getProtocolStr(i), (QVariant)i);
- if (g_model.moduleData[0].protocol == i) {
- selindex = index;
- }
- index++;
- }
- }
- if (GetEepromInterface()->getCapability(NumModules)>1) {
- index=0;
- ui->protocolCB_2->clear();
- for (int i=0; iisAvailable((Protocol)i, 1)) {
- ui->protocolCB_2->addItem(getProtocolStr(i), (QVariant)i);
- if (g_model.moduleData[1].protocol == i) {
- selindex2 = index;
- }
- index++;
- }
- }
- }
- if (GetEepromInterface()->getCapability(ModelTrainerEnable)) {
- trainerEditLock=true;
- if (!(g_model.trainerMode||g_model.traineron)) {
- ui->protocolCB_3->setCurrentIndex(0);
- ui->label_PPM_3->hide();
- ui->ppmDelaySB_3->hide();
- ui->label_PPMCH_3->hide();
- ui->label_pulsePol_3->hide();
- ui->pulsePolCB_3->hide();
- ui->numChannelsSB_3->hide();
- ui->label_ppmFrameLength_3->hide();
- ui->ppmFrameLengthDSB_3->hide();
- ui->label_numChannelsStart_3->hide();
- ui->numChannelsStart_3->hide();
- } else {
- ui->protocolCB_3->setCurrentIndex(1);
- ui->label_PPM_3->show();
- ui->ppmDelaySB_3->show();
- ui->label_PPMCH_3->show();
- ui->label_pulsePol_3->show();
- ui->pulsePolCB_3->show();
- ui->numChannelsSB_3->show();
- ui->label_ppmFrameLength_3->show();
- ui->ppmFrameLengthDSB_3->show();
- ui->label_numChannelsStart_3->show();
- ui->numChannelsStart_3->show();
- }
- trainerEditLock=false;
- on_protocolCB_3_currentIndexChanged(g_model.traineron||g_model.trainerMode);
- } else {
- ui->rf3_GB->hide();
- }
-
- ui->label_PPM->hide();
- ui->ppmDelaySB->hide();
- ui->label_PPMCH->hide();
- ui->label_pulsePol->hide();
- ui->pulsePolCB->hide();
- ui->numChannelsSB->hide();
- ui->label_ppmFrameLength->hide();
- ui->ppmFrameLengthDSB->hide();
- ui->label_DSM->hide();
- ui->DSM_Type->hide();
- ui->label_PXX->hide();
- ui->pxxRxNum->hide();
- ui->label_numChannelsStart->hide();
- ui->numChannelsStart->hide();
- ui->pxxRxNum->setEnabled(false);
- ui->protocolCB->setCurrentIndex(selindex);
- protocolEditLock=false;
- on_protocolCB_currentIndexChanged(selindex);
- if (GetEepromInterface()->getCapability(NumModules)>1) {
- ui->label_PPM_2->hide();
- ui->ppmDelaySB_2->hide();
- ui->label_PPMCH_2->hide();
- ui->label_pulsePol_2->hide();
- ui->pulsePolCB_2->hide();
- ui->numChannelsSB_2->hide();
- ui->label_ppmFrameLength_2->hide();
- ui->ppmFrameLengthDSB_2->hide();
- ui->label_DSM_2->hide();
- ui->DSM_Type_2->hide();
- ui->label_PXX_2->hide();
- ui->pxxRxNum_2->hide();
- ui->label_numChannelsStart_2->hide();
- ui->numChannelsStart_2->hide();
- ui->pxxRxNum_2->setEnabled(false);
- ui->protocolCB_2->setCurrentIndex(selindex2);
- protocol2EditLock=false;
- on_protocolCB_2_currentIndexChanged(selindex2);
- }
-
- //timer2 mode direction value
- if (GetEepromInterface()->getCapability(Timers)<2) {
- ui->timer2DirCB->hide();
- ui->timer2ValTE->hide();
- ui->timer2DirCB->hide();
- ui->timer2ModeCB->hide();
- ui->timer2ModeBCB->hide();
- ui->timer2ModeB_label->hide();
- ui->label_timer2->hide();
- } else {
- populateTimerSwitchCB(ui->timer2ModeCB,g_model.timers[1].mode,GetEepromInterface()->getCapability(TimerTriggerB));
- min = g_model.timers[1].val/60;
- sec = g_model.timers[1].val%60;
- ui->timer2ValTE->setTime(QTime(0,min,sec));
- ui->timer2DirCB->setCurrentIndex(g_model.timers[1].dir);
- }
- if (!GetEepromInterface()->getCapability(PermTimers)) {
- ui->timer1Perm->hide();
- ui->timer2Perm->hide();
- ui->timer1PermValue->hide();
- ui->timer2PermValue->hide();
- } else {
- int sign=1;
- int pvalue=g_model.timers[0].pvalue;
- if (pvalue<0) {
- pvalue=-pvalue;
- sign=-1;
- }
- int hours=pvalue/3600;
- pvalue-=hours*3600;
- int minutes = pvalue/60;
- int seconds = pvalue%60;
- ui->timer1PermValue->setText(QString(" %1(%2:%3:%4)").arg(sign<0 ? "-" :" ").arg(hours,2,10,QLatin1Char('0')).arg(minutes,2,10,QLatin1Char('0')).arg(seconds,2,10,QLatin1Char('0')));
- // QString QString::arg ( int a, int fieldWidth = 0, int base = 10, const QChar & fillChar = QLatin1Char( ' ' ) ) const
- sign=1;
- pvalue=g_model.timers[1].pvalue;
- if (pvalue<0) {
- pvalue=-pvalue;
- sign=-1;
- }
- hours=pvalue/3600;
- pvalue-=hours*3600;
- minutes = pvalue/60;
- seconds = pvalue%60;
- ui->timer2PermValue->setText(QString(" %1(%2:%3:%4)").arg(sign<0 ? "-" :" ").arg(hours,2,10,QLatin1Char('0')).arg(minutes,2,10,QLatin1Char('0')).arg(seconds,2,10,QLatin1Char('0')));
- ui->timer1Perm->setChecked(g_model.timers[0].persistent);
- ui->timer2Perm->setChecked(g_model.timers[1].persistent);
- }
- if (!GetEepromInterface()->getCapability(minuteBeep)) {
- ui->timer1Minute->hide();
- ui->timer2Minute->hide();
- } else {
- ui->timer1Minute->setChecked(g_model.timers[0].minuteBeep);
- ui->timer2Minute->setChecked(g_model.timers[1].minuteBeep);
- }
-
- if (!GetEepromInterface()->getCapability(countdownBeep)) {
- ui->timer1CountDownBeep->hide();
- ui->timer2CountDownBeep->hide();
- } else {
- ui->timer1CountDownBeep->setChecked(g_model.timers[0].countdownBeep);
- ui->timer2CountDownBeep->setChecked(g_model.timers[1].countdownBeep);
- }
-
- //trim inc, thro trim, thro expo, instatrim
- ui->trimIncCB->setCurrentIndex(g_model.trimInc);
- ui->thrExpoChkB->setChecked(g_model.thrExpo);
- ui->thrTrimChkB->setChecked(g_model.thrTrim);
-
- //center beep
- ui->bcRUDChkB->setChecked(g_model.beepANACenter & BC_BIT_RUD);
- ui->bcELEChkB->setChecked(g_model.beepANACenter & BC_BIT_ELE);
- ui->bcTHRChkB->setChecked(g_model.beepANACenter & BC_BIT_THR);
- ui->bcAILChkB->setChecked(g_model.beepANACenter & BC_BIT_AIL);
- ui->bcP1ChkB->setChecked(g_model.beepANACenter & BC_BIT_P1);
- ui->bcP2ChkB->setChecked(g_model.beepANACenter & BC_BIT_P2);
- ui->bcP3ChkB->setChecked(g_model.beepANACenter & BC_BIT_P3);
- ui->bcP4ChkB->setChecked(g_model.beepANACenter & BC_BIT_P4);
- ui->bcREaChkB->setChecked(g_model.beepANACenter & BC_BIT_REA);
- ui->bcREbChkB->setChecked(g_model.beepANACenter & BC_BIT_REB);
-
- // PPM settings fields
- ui->ppmDelaySB->setEnabled(g_model.moduleData[0].protocol == PPM);
- ui->pulsePolCB->setCurrentIndex(g_model.moduleData[0].ppmPulsePol);
- ui->ppmDelaySB->setEnabled(g_model.moduleData[0].protocol == PPM);
- ui->ppmDelaySB->setValue(g_model.moduleData[0].ppmDelay);
- // TODO? ui->numChannelsSB->setEnabled(g_model.moduleData[0].protocol == PPM);
-
- ui->extendedLimitsChkB->setChecked(g_model.extendedLimits);
- ui->T2ThrTrgChkB->setChecked(g_model.t2throttle);
- if (!GetEepromInterface()->getCapability(Timer2ThrTrig)) {
- ui->T2ThrTrg->hide();
- ui->T2ThrTrgChkB->hide();
- }
- ui->ppmFrameLengthDSB->setValue(22.5+((double)g_model.moduleData[0].ppmFrameLength)*0.5);
- if (!GetEepromInterface()->getCapability(PPMExtCtrl)) {
- ui->ppmFrameLengthDSB->hide();
- ui->label_ppmFrameLength->hide();
- }
- switch (g_model.moduleData[0].protocol) {
- case PXX_DJT:
- case PXX_XJT_X16:
- case PXX_XJT_D8:
- case PXX_XJT_LR12:
- ui->pxxRxNum->setMinimum(0);
- ui->pxxRxNum->setValue((g_model.modelId));
- break;
- case DSM2:
- if (!GetEepromInterface()->getCapability(DSM2Indexes)) {
- ui->pxxRxNum->setValue(1);
- }
- else {
- ui->pxxRxNum->setMinimum(0);
- ui->pxxRxNum->setValue((g_model.modelId));
- }
- ui->numChannelsSB->setValue(8);
- break;
- default:
- ui->label_DSM->hide();
- ui->DSM_Type->hide();
- ui->DSM_Type->setEnabled(false);
- ui->label_PXX->hide();
- ui->pxxRxNum->hide();
- ui->pxxRxNum->setEnabled(false);
- ui->numChannelsSB->setValue(g_model.moduleData[0].channelsCount);
- break;
- }
-}
-
-void ModelEdit::on_modelVoice_SB_editingFinished()
-{
- g_model.modelVoice=ui->modelVoice_SB->value()-260;
- updateSettings();
-}
-
-void ModelEdit::on_timer1Perm_toggled(bool checked)
-{
- g_model.timers[0].persistent=checked;
- updateSettings();
-}
-
-void ModelEdit::on_timer2Perm_toggled(bool checked)
-{
- g_model.timers[1].persistent=checked;
- updateSettings();
-}
-
-void ModelEdit::on_timer1Minute_toggled(bool checked)
-{
- g_model.timers[0].minuteBeep=checked;
- updateSettings();
-}
-
-void ModelEdit::on_timer2Minute_toggled(bool checked)
-{
- g_model.timers[1].minuteBeep=checked;
- updateSettings();
-}
-
-void ModelEdit::on_timer1CountDownBeep_toggled(bool checked)
-{
- g_model.timers[0].countdownBeep=checked;
- updateSettings();
-}
-
-void ModelEdit::on_timer2CountDownBeep_toggled(bool checked)
-{
- g_model.timers[1].countdownBeep=checked;
- updateSettings();
-}
-
-void ModelEdit::displayOnePhaseOneTrim(unsigned int phase_idx, unsigned int chn, QComboBox *trimUse, QSpinBox *trimVal, QSlider *trimSlider)
-{
- PhaseData *phase = &g_model.phaseData[phase_idx];
- int trim = phase->trim[chn];
- if (trimUse) populateTrimUseCB(trimUse, phase_idx);
- if (phase->trimRef[chn] >= 0) {
- if (trimUse) trimUse->setCurrentIndex(1 + phase->trimRef[chn] - (phase->trimRef[chn] >= (int)phase_idx ? 1 : 0));
- trim = g_model.phaseData[g_model.getTrimFlightPhase(chn, phase_idx)].trim[chn];
- trimVal->setEnabled(false);
- trimSlider->setEnabled(false);
- } else {
- trimVal->setEnabled(true);
- trimSlider->setEnabled(true);
- if (trimUse) trimUse->setCurrentIndex(0);
- }
- int trimsMax = GetEepromInterface()->getCapability(ExtendedTrims);
- if (trimsMax == 0 || !g_model.extendedTrims) {
- trimsMax = 125;
- }
- /*else if (trimsMax == 500)
- trimSlider->setTickInterval(50);*/
- trimSlider->setRange(-trimsMax, +trimsMax);
- trimVal->setRange(-trimsMax, +trimsMax);
- trimVal->setValue(trim);
- trimSlider->setValue(trim);
- if (chn == 2 && g_eeGeneral.throttleReversed)
- trimSlider->setInvertedAppearance(true);
-}
-
-void ModelEdit::displayOnePhase(unsigned int phase_idx, QLineEdit *name, QComboBox *sw, QDoubleSpinBox *fadeIn, QDoubleSpinBox *fadeOut,
- QComboBox *trim1Use, QSpinBox *trim1, QLabel *trim1Label, QSlider *trim1Slider,
- QComboBox *trim2Use, QSpinBox *trim2, QLabel *trim2Label, QSlider *trim2Slider,
- QComboBox *trim3Use, QSpinBox *trim3, QLabel *trim3Label, QSlider *trim3Slider,
- QComboBox *trim4Use, QSpinBox *trim4, QLabel *trim4Label, QSlider *trim4Slider,
- QLabel *gv1Label, QComboBox *gv1Use,QSpinBox *gv1Value,
- QLabel *gv2Label, QComboBox *gv2Use,QSpinBox *gv2Value,
- QLabel *gv3Label, QComboBox *gv3Use,QSpinBox *gv3Value,
- QLabel *gv4Label, QComboBox *gv4Use,QSpinBox *gv4Value,
- QLabel *gv5Label, QComboBox *gv5Use,QSpinBox *gv5Value,
- QLabel *re1Label, QComboBox *re1Use,QSpinBox *re1Value,
- QLabel *re2Label, QComboBox *re2Use,QSpinBox *re2Value,bool doConnect=false)
-{
- phasesLock=true;
- PhaseData *phase = &g_model.phaseData[phase_idx];
- if (IS_TARANIS(GetEepromInterface()->getBoard())) {
- if (name) name->setMaxLength(10);
- } else {
- if (name) name->setMaxLength(6);
- }
-
- if (name) name->setText(phase->name);
- if (sw) populateSwitchCB(sw, phase->swtch);
-
- int scale=GetEepromInterface()->getCapability(SlowScale);
- float range=GetEepromInterface()->getCapability(SlowRange);
- int fades=GetEepromInterface()->getCapability(FlightPhasesHaveFades);
- if (fades && fadeIn) {
- fadeIn->setEnabled(true);
- fadeOut->setEnabled(true);
- fadeIn->setMaximum(range/scale);
- fadeIn->setSingleStep(1.0/scale);
- fadeIn->setDecimals((scale==1 ? 0 :1) );
- if (fadeIn) {
- fadeIn->setValue((double)phase->fadeIn/scale);
- }
- fadeOut->setMaximum(range/scale);
- fadeOut->setSingleStep(1.0/scale);
- fadeOut->setDecimals((scale==1 ? 0 :1));
- if (fadeOut) {
- fadeOut->setValue((double)phase->fadeOut/scale);
- }
- } else if ( fadeIn ) {
- fadeIn->setDisabled(true);
- fadeOut->setDisabled(true);
- }
- displayOnePhaseOneTrim(phase_idx, CONVERT_MODE(1)-1, trim1Use, trim1, trim1Slider);
- displayOnePhaseOneTrim(phase_idx, CONVERT_MODE(2)-1, trim2Use, trim2, trim2Slider);
- displayOnePhaseOneTrim(phase_idx, CONVERT_MODE(3)-1, trim3Use, trim3, trim3Slider);
- displayOnePhaseOneTrim(phase_idx, CONVERT_MODE(4)-1, trim4Use, trim4, trim4Slider);
-
- if (gv1Use) {
- populateGvarUseCB(gv1Use, phase_idx);
- if (phase->gvars[0]>1024) {
- gv1Use->setCurrentIndex(phase->gvars[0]-1024);
- }
- }
- gv1Value->setMinimum(-1024);
- gv1Value->setMaximum(1024);
- if (phase->gvars[0]<1024) {
- gv1Value->setValue(phase->gvars[0]);
- gv1Value->setEnabled(true);
- } else {
- uint index=phase->gvars[0]-1025;
- if (index>=phase_idx) {
- index++;
- }
- PhaseData *phasegvar = &g_model.phaseData[index];
- gv1Value->setValue(phasegvar->gvars[0]);
- gv1Value->setDisabled(true);
- }
- if (gv2Use) {
- populateGvarUseCB(gv2Use, phase_idx);
- if (phase->gvars[1]>1024) {
- gv2Use->setCurrentIndex(phase->gvars[1]-1024);
- }
- }
- gv2Value->setMinimum(-1024);
- gv2Value->setMaximum(1024);
- if (phase->gvars[1]<1024) {
- gv2Value->setValue(phase->gvars[1]);
- gv2Value->setEnabled(true);
- } else {
- uint index=phase->gvars[1]-1025;
- if (index>=phase_idx) {
- index++;
- }
- PhaseData *phasegvar = &g_model.phaseData[index];
- gv2Value->setValue(phasegvar->gvars[1]);
- gv2Value->setDisabled(true);
- }
- if (gv3Use) {
- populateGvarUseCB(gv3Use, phase_idx);
- if (phase->gvars[2]>1024) {
- gv3Use->setCurrentIndex(phase->gvars[2]-1024);
- }
- }
- gv3Value->setMinimum(-1024);
- gv3Value->setMaximum(1024);
- if (phase->gvars[2]<1024) {
- gv3Value->setValue(phase->gvars[2]);
- gv3Value->setEnabled(true);
- } else {
- uint index=phase->gvars[2]-1025;
- if (index>=phase_idx) {
- index++;
- }
- PhaseData *phasegvar = &g_model.phaseData[index];
- gv3Value->setValue(phasegvar->gvars[2]);
- gv3Value->setDisabled(true);
- }
- if (gv4Use) {
- populateGvarUseCB(gv4Use, phase_idx);
- if (phase->gvars[3]>1024) {
- gv4Use->setCurrentIndex(phase->gvars[3]-1024);
- }
- }
- gv4Value->setMinimum(-1024);
- gv4Value->setMaximum(1024);
- if (phase->gvars[3]<1024) {
- gv4Value->setValue(phase->gvars[3]);
- gv4Value->setEnabled(true);
- } else {
- uint index=phase->gvars[3]-1025;
- if (index>=phase_idx) {
- index++;
- }
- PhaseData *phasegvar = &g_model.phaseData[index];
- gv4Value->setValue(phasegvar->gvars[3]);
- gv4Value->setDisabled(true);
- }
- if (gv5Use) {
- populateGvarUseCB(gv5Use, phase_idx);
- if (phase->gvars[4]>1024) {
- gv5Use->setCurrentIndex(phase->gvars[4]-1024);
- }
- }
- gv5Value->setMinimum(-1024);
- gv5Value->setMaximum(1024);
- if (phase->gvars[4]<1024) {
- gv5Value->setValue(phase->gvars[4]);
- gv5Value->setEnabled(true);
- } else {
- uint index=phase->gvars[4]-1025;
- if (index>=phase_idx) {
- index++;
- }
- PhaseData *phasegvar = &g_model.phaseData[index];
- gv5Value->setValue(phasegvar->gvars[4]);
- gv5Value->setDisabled(true);
- }
- if (re1Value) {
- re1Value->setMinimum(-1024);
- re1Value->setMaximum(1024);
- }
- if (re2Value) {
- re2Value->setMinimum(-1024);
- re2Value->setMaximum(1024);
- }
- if (re1Use) {
- populateGvarUseCB(re1Use, phase_idx);
- if (phase->rotaryEncoders[0]>1024) {
- re1Use->setCurrentIndex(phase->rotaryEncoders[0]-1024);
- }
- }
- if (phase->rotaryEncoders[0]<1024) {
- re1Value->setValue(phase->rotaryEncoders[0]);
- re1Value->setEnabled(true);
- } else {
- uint index=phase->rotaryEncoders[0]-1025;
- if (index>=phase_idx) {
- index++;
- }
- PhaseData *phasegvar = &g_model.phaseData[index];
- re1Value->setValue(phasegvar->rotaryEncoders[0]);
- re1Value->setDisabled(true);
- }
- if (re2Use) {
- populateGvarUseCB(re2Use, phase_idx);
- if (phase->rotaryEncoders[0]>1024) {
- re1Use->setCurrentIndex(phase->rotaryEncoders[0]-1024);
- }
- }
- if (phase->rotaryEncoders[1]<1024) {
- re2Value->setValue(phase->rotaryEncoders[1]);
- re2Value->setEnabled(true);
- } else {
- uint index=phase->rotaryEncoders[1]-1025;
- if (index>=phase_idx) {
- index++;
- }
- PhaseData *phasegvar = &g_model.phaseData[index];
- re2Value->setValue(phasegvar->rotaryEncoders[1]);
- re2Value->setDisabled(true);
- }
- if (GetEepromInterface()->getCapability(RotaryEncoders)<2) {
- if (re2Label)
- re2Label->hide();
- if (re2Use)
- re2Use->hide();
- re2Value->hide();
- }
- if (GetEepromInterface()->getCapability(RotaryEncoders)<1) {
- if (re1Label)
- re1Label->hide();
- if (re1Use)
- re1Use->hide();
- re1Value->hide();
- }
- QString labels[] = { tr("Rud"), tr("Ele"), tr("Thr"), tr("Ail") };
- if (trim1Label) {
- trim1Label->setText(labels[CONVERT_MODE(1)-1]);
- trim2Label->setText(labels[CONVERT_MODE(2)-1]);
- trim3Label->setText(labels[CONVERT_MODE(3)-1]);
- trim4Label->setText(labels[CONVERT_MODE(4)-1]);
- }
- // the connects
- if (doConnect) {
- connect(name, SIGNAL(editingFinished()), this, SLOT(phaseName_editingFinished()));
- if (sw!=NULL) {
- connect(sw,SIGNAL(currentIndexChanged(int)),this,SLOT(phaseSwitch_currentIndexChanged()));
- connect(trim1Use,SIGNAL(currentIndexChanged(int)),this,SLOT(phaseTrimUse_currentIndexChanged()));
- connect(trim2Use,SIGNAL(currentIndexChanged(int)),this,SLOT(phaseTrimUse_currentIndexChanged()));
- connect(trim3Use,SIGNAL(currentIndexChanged(int)),this,SLOT(phaseTrimUse_currentIndexChanged()));
- connect(trim4Use,SIGNAL(currentIndexChanged(int)),this,SLOT(phaseTrimUse_currentIndexChanged()));
- }
- if (gv1Use) connect(gv1Use,SIGNAL(currentIndexChanged(int)),this,SLOT(phaseGVUse_currentIndexChanged()));
- if (gv2Use) connect(gv2Use,SIGNAL(currentIndexChanged(int)),this,SLOT(phaseGVUse_currentIndexChanged()));
- if (gv3Use) connect(gv3Use,SIGNAL(currentIndexChanged(int)),this,SLOT(phaseGVUse_currentIndexChanged()));
- if (gv4Use) connect(gv4Use,SIGNAL(currentIndexChanged(int)),this,SLOT(phaseGVUse_currentIndexChanged()));
- if (gv5Use) connect(gv5Use,SIGNAL(currentIndexChanged(int)),this,SLOT(phaseGVUse_currentIndexChanged()));
- if (re1Use) connect(re1Use,SIGNAL(currentIndexChanged(int)),this,SLOT(phaseREUse_currentIndexChanged()));
- if (re2Use) connect(re2Use,SIGNAL(currentIndexChanged(int)),this,SLOT(phaseREUse_currentIndexChanged()));
- connect(gv1Value,SIGNAL(editingFinished()),this,SLOT(phaseGVValue_editingFinished()));
- connect(gv2Value,SIGNAL(editingFinished()),this,SLOT(phaseGVValue_editingFinished()));
- connect(gv3Value,SIGNAL(editingFinished()),this,SLOT(phaseGVValue_editingFinished()));
- connect(gv4Value,SIGNAL(editingFinished()),this,SLOT(phaseGVValue_editingFinished()));
- connect(gv5Value,SIGNAL(editingFinished()),this,SLOT(phaseGVValue_editingFinished()));
- connect(re1Value,SIGNAL(editingFinished()),this,SLOT(phaseREValue_editingFinished()));
- connect(re2Value,SIGNAL(editingFinished()),this,SLOT(phaseREValue_editingFinished()));
-
- connect(fadeIn,SIGNAL(editingFinished()),this,SLOT(phaseFadeIn_editingFinished()));
- connect(fadeOut,SIGNAL(editingFinished()),this,SLOT(phaseFadeOut_editingFinished()));
- connect(trim1,SIGNAL(valueChanged(int)),this,SLOT(phaseTrim_valueChanged()));
- connect(trim2,SIGNAL(valueChanged(int)),this,SLOT(phaseTrim_valueChanged()));
- connect(trim3,SIGNAL(valueChanged(int)),this,SLOT(phaseTrim_valueChanged()));
- connect(trim4,SIGNAL(valueChanged(int)),this,SLOT(phaseTrim_valueChanged()));
- connect(trim1Slider,SIGNAL(valueChanged(int)),this,SLOT(phaseTrimSlider_valueChanged()));
- connect(trim2Slider,SIGNAL(valueChanged(int)),this,SLOT(phaseTrimSlider_valueChanged()));
- connect(trim3Slider,SIGNAL(valueChanged(int)),this,SLOT(phaseTrimSlider_valueChanged()));
- connect(trim4Slider,SIGNAL(valueChanged(int)),this,SLOT(phaseTrimSlider_valueChanged()));
- phasesLock=false;
- }
-}
-
-void ModelEdit::tabPhases()
-{
- QSpinBox * tmp[9][5]={
- {ui->phase0GV1Value,ui->phase0GV2Value,ui->phase0GV3Value,ui->phase0GV4Value,ui->phase0GV5Value} ,
- {ui->phase1GV1Value,ui->phase1GV2Value,ui->phase1GV3Value,ui->phase1GV4Value,ui->phase1GV5Value} ,
- {ui->phase2GV1Value,ui->phase2GV2Value,ui->phase2GV3Value,ui->phase2GV4Value,ui->phase2GV5Value} ,
- {ui->phase3GV1Value,ui->phase3GV2Value,ui->phase3GV3Value,ui->phase3GV4Value,ui->phase3GV5Value} ,
- {ui->phase4GV1Value,ui->phase4GV2Value,ui->phase4GV3Value,ui->phase4GV4Value,ui->phase4GV5Value} ,
- {ui->phase5GV1Value,ui->phase5GV2Value,ui->phase5GV3Value,ui->phase5GV4Value,ui->phase5GV5Value} ,
- {ui->phase6GV1Value,ui->phase6GV2Value,ui->phase6GV3Value,ui->phase6GV4Value,ui->phase6GV5Value} ,
- {ui->phase7GV1Value,ui->phase7GV2Value,ui->phase7GV3Value,ui->phase7GV4Value,ui->phase7GV5Value} ,
- {ui->phase8GV1Value,ui->phase8GV2Value,ui->phase8GV3Value,ui->phase8GV4Value,ui->phase8GV5Value}
- };
-
- QSpinBox * tmp2[9][2]={
- {ui->phase0RE1Value,ui->phase0RE2Value} ,
- {ui->phase1RE1Value,ui->phase1RE2Value} ,
- {ui->phase2RE1Value,ui->phase2RE2Value} ,
- {ui->phase3RE1Value,ui->phase3RE2Value} ,
- {ui->phase4RE1Value,ui->phase4RE2Value} ,
- {ui->phase5RE1Value,ui->phase5RE2Value} ,
- {ui->phase6RE1Value,ui->phase6RE2Value} ,
- {ui->phase7RE1Value,ui->phase7RE2Value} ,
- {ui->phase8RE1Value,ui->phase8RE2Value} ,
- };
-
- memcpy(gvarsSB, tmp, sizeof(gvarsSB));
- memcpy(reSB, tmp2, sizeof(reSB));
-
- phasesLock = true;
- int gvars=0;
- if (GetEepromInterface()->getCapability(HasVariants)) {
- if (GetCurrentFirmwareVariant() & GVARS_VARIANT)
- gvars=1;
- } else {
- gvars=GetEepromInterface()->getCapability(Gvars);
- }
- if (!GetEepromInterface()->getCapability(RotaryEncoders)) {
- ui->phase0reGB->hide();
- ui->phase1reGB->hide();
- ui->phase2reGB->hide();
- ui->phase3reGB->hide();
- ui->phase4reGB->hide();
- ui->phase5reGB->hide();
- ui->phase6reGB->hide();
- ui->phase7reGB->hide();
- ui->phase8reGB->hide();
- }
- if (!GetEepromInterface()->getCapability(GvarsFlightPhases) || gvars==0) {
- if (!GetEepromInterface()->getCapability(Gvars) || gvars==0) {
- ui->phase0gvGB->hide();
- }
- ui->phase1gvGB->hide();
- ui->phase2gvGB->hide();
- ui->phase3gvGB->hide();
- ui->phase4gvGB->hide();
- ui->phase5gvGB->hide();
- ui->phase6gvGB->hide();
- ui->phase7gvGB->hide();
- ui->phase8gvGB->hide();
- }
-
- if (!GetEepromInterface()->getCapability(GvarsAreNamed)) {
- ui->phase0GV1Name->hide();
- ui->phase0GV2Name->hide();
- ui->phase0GV3Name->hide();
- ui->phase0GV4Name->hide();
- ui->phase0GV5Name->hide();
- ui->phase0GV6Name->hide();
- ui->phase0GV7Name->hide();
- }
-
- if (GetEepromInterface()->getCapability(Gvars) && gvars==1) {
- if (!GetEepromInterface()->getCapability(GvarsHaveSources)) {
- ui->phase0GV1Source->hide();
- ui->phase0GV2Source->hide();
- ui->phase0GV3Source->hide();
- ui->phase0GV4Source->hide();
- ui->phase0GV5Source->hide();
- ui->phase0GV6Source->hide();
- ui->phase0GV7Source->hide();
- } else {
- populateGvSourceCB(ui->phase0GV1Source, g_model.gvsource[0]);
- populateGvSourceCB(ui->phase0GV2Source, g_model.gvsource[1]);
- populateGvSourceCB(ui->phase0GV3Source, g_model.gvsource[2]);
- populateGvSourceCB(ui->phase0GV4Source, g_model.gvsource[3]);
- populateGvSourceCB(ui->phase0GV5Source, g_model.gvsource[4]);
- connect(ui->phase0GV1Source,SIGNAL(currentIndexChanged(int)),this,SLOT(GVSource_currentIndexChanged()));
- connect(ui->phase0GV2Source,SIGNAL(currentIndexChanged(int)),this,SLOT(GVSource_currentIndexChanged()));
- connect(ui->phase0GV3Source,SIGNAL(currentIndexChanged(int)),this,SLOT(GVSource_currentIndexChanged()));
- connect(ui->phase0GV4Source,SIGNAL(currentIndexChanged(int)),this,SLOT(GVSource_currentIndexChanged()));
- connect(ui->phase0GV5Source,SIGNAL(currentIndexChanged(int)),this,SLOT(GVSource_currentIndexChanged()));
- }
- if (IS_TARANIS(GetEepromInterface()->getBoard())) {
- ui->phase0GV1Name->setMaxLength(10);
- ui->phase0GV2Name->setMaxLength(10);
- ui->phase0GV3Name->setMaxLength(10);
- ui->phase0GV4Name->setMaxLength(10);
- ui->phase0GV5Name->setMaxLength(10);
- } else {
- ui->phase0GV1Name->setMaxLength(6);
- ui->phase0GV2Name->setMaxLength(6);
- ui->phase0GV3Name->setMaxLength(6);
- ui->phase0GV4Name->setMaxLength(6);
- ui->phase0GV5Name->setMaxLength(6);
- }
-
- ui->phase0GV1Name->setText(g_model.gvars_names[0]);
- ui->phase0GV2Name->setText(g_model.gvars_names[1]);
- ui->phase0GV3Name->setText(g_model.gvars_names[2]);
- ui->phase0GV4Name->setText(g_model.gvars_names[3]);
- ui->phase0GV5Name->setText(g_model.gvars_names[4]);
- connect(ui->phase0GV1Name,SIGNAL(editingFinished()),this,SLOT(GVName_editingFinished()));
- connect(ui->phase0GV2Name,SIGNAL(editingFinished()),this,SLOT(GVName_editingFinished()));
- connect(ui->phase0GV3Name,SIGNAL(editingFinished()),this,SLOT(GVName_editingFinished()));
- connect(ui->phase0GV4Name,SIGNAL(editingFinished()),this,SLOT(GVName_editingFinished()));
- connect(ui->phase0GV5Name,SIGNAL(editingFinished()),this,SLOT(GVName_editingFinished()));
- }
- if (gvars) {
- if (GetEepromInterface()->getCapability(GvarsNum)<7) {
- ui->phase0GV6Name->hide();
- ui->phase0GV7Name->hide();
- ui->phase0GV6Source->hide();
- ui->phase0GV7Source->hide();
- ui->phase0GV6Value->hide();
- ui->phase0GV7Value->hide();
- ui->phase0GV6_Label->hide();
- ui->phase0GV7_Label->hide();
- } else {
- populateGvSourceCB(ui->phase0GV6Source, g_model.gvsource[5]);
- populateGvSourceCB(ui->phase0GV7Source, g_model.gvsource[6]);
- connect(ui->phase0GV6Source,SIGNAL(currentIndexChanged(int)),this,SLOT(GVSource_currentIndexChanged()));
- connect(ui->phase0GV7Source,SIGNAL(currentIndexChanged(int)),this,SLOT(GVSource_currentIndexChanged()));
- ui->phase0GV6Name->setText(g_model.gvars_names[5]);
- ui->phase0GV7Name->setText(g_model.gvars_names[6]);
- connect(ui->phase0GV6Name,SIGNAL(editingFinished()),this,SLOT(GVName_editingFinished()));
- connect(ui->phase0GV7Name,SIGNAL(editingFinished()),this,SLOT(GVName_editingFinished()));
- ui->phase0GV6Value->setValue(g_model.phaseData[0].gvars[5]);
- ui->phase0GV7Value->setValue(g_model.phaseData[0].gvars[6]);
- connect(ui->phase0GV6Value,SIGNAL(editingFinished()),this,SLOT(phaseGVValue_editingFinished()));
- connect(ui->phase0GV7Value,SIGNAL(editingFinished()),this,SLOT(phaseGVValue_editingFinished()));
- }
- }
-
- displayOnePhase(0, ui->phase0Name, NULL, ui->phase0FadeIn, ui->phase0FadeOut, NULL, ui->phase0Trim1Value, ui->phase0Trim1Label, ui->phase0Trim1Slider, NULL, ui->phase0Trim2Value, ui->phase0Trim2Label, ui->phase0Trim2Slider, NULL, ui->phase0Trim3Value, ui->phase0Trim3Label, ui->phase0Trim3Slider, NULL, ui->phase0Trim4Value, ui->phase0Trim4Label, ui->phase0Trim4Slider, ui->phase0GV1_Label, NULL , ui->phase0GV1Value, ui->phase0GV2_Label, NULL , ui->phase0GV2Value, ui->phase0GV3_Label, NULL , ui->phase0GV3Value, ui->phase0GV4_Label, NULL , ui->phase0GV4Value, ui->phase0GV5_Label, NULL , ui->phase0GV5Value,ui->phase0REA_Label,NULL, ui->phase0RE1Value,ui->phase0REB_Label, NULL, ui->phase0RE2Value, true);
- displayOnePhase(1, ui->phase1Name, ui->phase1Switch, ui->phase1FadeIn, ui->phase1FadeOut, ui->phase1Trim1Use, ui->phase1Trim1Value, ui->phase1Trim1Label, ui->phase1Trim1Slider, ui->phase1Trim2Use, ui->phase1Trim2Value, ui->phase1Trim2Label, ui->phase1Trim2Slider, ui->phase1Trim3Use, ui->phase1Trim3Value, ui->phase1Trim3Label, ui->phase1Trim3Slider, ui->phase1Trim4Use, ui->phase1Trim4Value, ui->phase1Trim4Label, ui->phase1Trim4Slider, ui->phase1GV1_Label, ui->phase1GV1Use, ui->phase1GV1Value, ui->phase1GV2_Label, ui->phase1GV2Use, ui->phase1GV2Value, ui->phase1GV3_Label, ui->phase1GV3Use, ui->phase1GV3Value, ui->phase1GV4_Label, ui->phase1GV4Use, ui->phase1GV4Value, ui->phase1GV5_Label, ui->phase1GV5Use, ui->phase1GV5Value,ui->phase1REA_Label, ui->phase1RE1Use, ui->phase1RE1Value,ui->phase1REB_Label, ui->phase1RE2Use, ui->phase1RE2Value, true);
- displayOnePhase(2, ui->phase2Name, ui->phase2Switch, ui->phase2FadeIn, ui->phase2FadeOut, ui->phase2Trim1Use, ui->phase2Trim1Value, ui->phase2Trim1Label, ui->phase2Trim1Slider, ui->phase2Trim2Use, ui->phase2Trim2Value, ui->phase2Trim2Label, ui->phase2Trim2Slider, ui->phase2Trim3Use, ui->phase2Trim3Value, ui->phase2Trim3Label, ui->phase2Trim3Slider, ui->phase2Trim4Use, ui->phase2Trim4Value, ui->phase2Trim4Label, ui->phase2Trim4Slider, ui->phase2GV1_Label, ui->phase2GV1Use, ui->phase2GV1Value, ui->phase2GV2_Label, ui->phase2GV2Use, ui->phase2GV2Value, ui->phase2GV3_Label, ui->phase2GV3Use, ui->phase2GV3Value, ui->phase2GV4_Label, ui->phase2GV4Use, ui->phase2GV4Value, ui->phase2GV5_Label, ui->phase2GV5Use, ui->phase2GV5Value,ui->phase2REA_Label, ui->phase2RE1Use, ui->phase2RE1Value,ui->phase2REB_Label, ui->phase2RE2Use, ui->phase2RE2Value, true);
- displayOnePhase(3, ui->phase3Name, ui->phase3Switch, ui->phase3FadeIn, ui->phase3FadeOut, ui->phase3Trim1Use, ui->phase3Trim1Value, ui->phase3Trim1Label, ui->phase3Trim1Slider, ui->phase3Trim2Use, ui->phase3Trim2Value, ui->phase3Trim2Label, ui->phase3Trim2Slider, ui->phase3Trim3Use, ui->phase3Trim3Value, ui->phase3Trim3Label, ui->phase3Trim3Slider, ui->phase3Trim4Use, ui->phase3Trim4Value, ui->phase3Trim4Label, ui->phase3Trim4Slider, ui->phase3GV1_Label, ui->phase3GV1Use, ui->phase3GV1Value, ui->phase3GV2_Label, ui->phase3GV2Use, ui->phase3GV2Value, ui->phase3GV3_Label, ui->phase3GV3Use, ui->phase3GV3Value, ui->phase3GV4_Label, ui->phase3GV4Use, ui->phase3GV4Value, ui->phase3GV5_Label, ui->phase3GV5Use, ui->phase3GV5Value,ui->phase3REA_Label, ui->phase3RE1Use, ui->phase3RE1Value,ui->phase3REB_Label, ui->phase3RE2Use, ui->phase3RE2Value, true);
- displayOnePhase(4, ui->phase4Name, ui->phase4Switch, ui->phase4FadeIn, ui->phase4FadeOut, ui->phase4Trim1Use, ui->phase4Trim1Value, ui->phase4Trim1Label, ui->phase4Trim1Slider, ui->phase4Trim2Use, ui->phase4Trim2Value, ui->phase4Trim2Label, ui->phase4Trim2Slider, ui->phase4Trim3Use, ui->phase4Trim3Value, ui->phase4Trim3Label, ui->phase4Trim3Slider, ui->phase4Trim4Use, ui->phase4Trim4Value, ui->phase4Trim4Label, ui->phase4Trim4Slider, ui->phase4GV1_Label, ui->phase4GV1Use, ui->phase4GV1Value, ui->phase4GV2_Label, ui->phase4GV2Use, ui->phase4GV2Value, ui->phase4GV3_Label, ui->phase4GV3Use, ui->phase4GV3Value, ui->phase4GV4_Label, ui->phase4GV4Use, ui->phase4GV4Value, ui->phase4GV5_Label, ui->phase4GV5Use, ui->phase4GV5Value,ui->phase4REA_Label, ui->phase4RE1Use, ui->phase4RE1Value,ui->phase4REB_Label, ui->phase4RE2Use, ui->phase4RE2Value, true);
- displayOnePhase(5, ui->phase5Name, ui->phase5Switch, ui->phase5FadeIn, ui->phase5FadeOut, ui->phase5Trim1Use, ui->phase5Trim1Value, ui->phase5Trim1Label, ui->phase5Trim1Slider, ui->phase5Trim2Use, ui->phase5Trim2Value, ui->phase5Trim2Label, ui->phase5Trim2Slider, ui->phase5Trim3Use, ui->phase5Trim3Value, ui->phase5Trim3Label, ui->phase5Trim3Slider, ui->phase5Trim4Use, ui->phase5Trim4Value, ui->phase5Trim4Label, ui->phase5Trim4Slider, ui->phase5GV1_Label, ui->phase5GV1Use, ui->phase5GV1Value, ui->phase5GV2_Label, ui->phase5GV2Use, ui->phase5GV2Value, ui->phase5GV3_Label, ui->phase5GV3Use, ui->phase5GV3Value, ui->phase5GV4_Label, ui->phase5GV4Use, ui->phase5GV4Value, ui->phase5GV5_Label, ui->phase5GV5Use, ui->phase5GV5Value,ui->phase5REA_Label, ui->phase5RE1Use, ui->phase5RE1Value,ui->phase5REB_Label, ui->phase5RE2Use, ui->phase5RE2Value, true);
- displayOnePhase(6, ui->phase6Name, ui->phase6Switch, ui->phase6FadeIn, ui->phase6FadeOut, ui->phase6Trim1Use, ui->phase6Trim1Value, ui->phase6Trim1Label, ui->phase6Trim1Slider, ui->phase6Trim2Use, ui->phase6Trim2Value, ui->phase6Trim2Label, ui->phase6Trim2Slider, ui->phase6Trim3Use, ui->phase6Trim3Value, ui->phase6Trim3Label, ui->phase6Trim3Slider, ui->phase6Trim4Use, ui->phase6Trim4Value, ui->phase6Trim4Label, ui->phase6Trim4Slider, ui->phase6GV1_Label, ui->phase6GV1Use, ui->phase6GV1Value, ui->phase6GV2_Label, ui->phase6GV2Use, ui->phase6GV2Value, ui->phase6GV3_Label, ui->phase6GV3Use, ui->phase6GV3Value, ui->phase6GV4_Label, ui->phase6GV4Use, ui->phase6GV4Value, ui->phase6GV5_Label, ui->phase6GV5Use, ui->phase6GV5Value,ui->phase6REA_Label, ui->phase6RE1Use, ui->phase6RE1Value,ui->phase6REB_Label, ui->phase6RE2Use, ui->phase6RE2Value, true);
- displayOnePhase(7, ui->phase7Name, ui->phase7Switch, ui->phase7FadeIn, ui->phase7FadeOut, ui->phase7Trim1Use, ui->phase7Trim1Value, ui->phase7Trim1Label, ui->phase7Trim1Slider, ui->phase7Trim2Use, ui->phase7Trim2Value, ui->phase7Trim2Label, ui->phase7Trim2Slider, ui->phase7Trim3Use, ui->phase7Trim3Value, ui->phase7Trim3Label, ui->phase7Trim3Slider, ui->phase7Trim4Use, ui->phase7Trim4Value, ui->phase7Trim4Label, ui->phase7Trim4Slider, ui->phase7GV1_Label, ui->phase7GV1Use, ui->phase7GV1Value, ui->phase7GV2_Label, ui->phase7GV2Use, ui->phase7GV2Value, ui->phase7GV3_Label, ui->phase7GV3Use, ui->phase7GV3Value, ui->phase7GV4_Label, ui->phase7GV4Use, ui->phase7GV4Value, ui->phase7GV5_Label, ui->phase7GV5Use, ui->phase7GV5Value,ui->phase7REA_Label, ui->phase7RE1Use, ui->phase7RE1Value,ui->phase7REB_Label, ui->phase7RE2Use, ui->phase7RE2Value, true);
- displayOnePhase(8, ui->phase8Name, ui->phase8Switch, ui->phase8FadeIn, ui->phase8FadeOut, ui->phase8Trim1Use, ui->phase8Trim1Value, ui->phase8Trim1Label, ui->phase8Trim1Slider, ui->phase8Trim2Use, ui->phase8Trim2Value, ui->phase8Trim2Label, ui->phase8Trim2Slider, ui->phase8Trim3Use, ui->phase8Trim3Value, ui->phase8Trim3Label, ui->phase8Trim3Slider, ui->phase8Trim4Use, ui->phase8Trim4Value, ui->phase8Trim4Label, ui->phase8Trim4Slider, ui->phase8GV1_Label, ui->phase8GV1Use, ui->phase8GV1Value, ui->phase8GV2_Label, ui->phase8GV2Use, ui->phase8GV2Value, ui->phase8GV3_Label, ui->phase8GV3Use, ui->phase8GV3Value, ui->phase8GV4_Label, ui->phase8GV4Use, ui->phase8GV4Value, ui->phase8GV5_Label, ui->phase8GV5Use, ui->phase8GV5Value,ui->phase8REA_Label, ui->phase8RE1Use, ui->phase8RE1Value,ui->phase8REB_Label, ui->phase8RE2Use, ui->phase8RE2Value, true);
-
- QSlider * tmpsliders[9][4]={
- {ui->phase0Trim1Slider,ui->phase0Trim2Slider,ui->phase0Trim3Slider,ui->phase0Trim4Slider},
- {ui->phase1Trim1Slider,ui->phase1Trim2Slider,ui->phase1Trim3Slider,ui->phase1Trim4Slider},
- {ui->phase2Trim1Slider,ui->phase2Trim2Slider,ui->phase2Trim3Slider,ui->phase2Trim4Slider},
- {ui->phase3Trim1Slider,ui->phase3Trim2Slider,ui->phase3Trim3Slider,ui->phase3Trim4Slider},
- {ui->phase4Trim1Slider,ui->phase4Trim2Slider,ui->phase4Trim3Slider,ui->phase4Trim4Slider},
- {ui->phase5Trim1Slider,ui->phase5Trim2Slider,ui->phase5Trim3Slider,ui->phase5Trim4Slider},
- {ui->phase6Trim1Slider,ui->phase6Trim2Slider,ui->phase6Trim3Slider,ui->phase6Trim4Slider},
- {ui->phase7Trim1Slider,ui->phase7Trim2Slider,ui->phase7Trim3Slider,ui->phase7Trim4Slider},
- {ui->phase8Trim1Slider,ui->phase8Trim2Slider,ui->phase8Trim3Slider,ui->phase8Trim4Slider}
- };
- QSpinBox * tmpspinbox[9][4]={
- {ui->phase0Trim1Value,ui->phase0Trim2Value,ui->phase0Trim3Value,ui->phase0Trim4Value},
- {ui->phase1Trim1Value,ui->phase1Trim2Value,ui->phase1Trim3Value,ui->phase1Trim4Value},
- {ui->phase2Trim1Value,ui->phase2Trim2Value,ui->phase2Trim3Value,ui->phase2Trim4Value},
- {ui->phase3Trim1Value,ui->phase3Trim2Value,ui->phase3Trim3Value,ui->phase3Trim4Value},
- {ui->phase4Trim1Value,ui->phase4Trim2Value,ui->phase4Trim3Value,ui->phase4Trim4Value},
- {ui->phase5Trim1Value,ui->phase5Trim2Value,ui->phase5Trim3Value,ui->phase5Trim4Value},
- {ui->phase6Trim1Value,ui->phase6Trim2Value,ui->phase6Trim3Value,ui->phase6Trim4Value},
- {ui->phase7Trim1Value,ui->phase7Trim2Value,ui->phase7Trim3Value,ui->phase7Trim4Value},
- {ui->phase8Trim1Value,ui->phase8Trim2Value,ui->phase8Trim3Value,ui->phase8Trim4Value}
- };
- memcpy(phasesTrimSliders,tmpsliders,sizeof(phasesTrimSliders));
- memcpy(phasesTrimValues,tmpspinbox,sizeof(phasesTrimValues));
-
- int phases = GetEepromInterface()->getCapability(FlightPhases);
- if (phases < 9) {
- ui->phase8->setDisabled(true);
- ui->phases->removeTab(8);
- }
- if (phases < 8) {
- ui->phase7->setDisabled(true);
- ui->phases->removeTab(7);
- }
- if (phases < 7) {
- ui->phase6->setDisabled(true);
- ui->phases->removeTab(6);
- }
- if (phases < 6) {
- ui->phase5->setDisabled(true);
- ui->phases->removeTab(5);
- }
- if (phases < 5) {
- ui->phase4->setDisabled(true);
- ui->phases->removeTab(4);
- }
- if (phases < 4) {
- ui->phase3->setDisabled(true);
- ui->phases->removeTab(3);
- }
- if (phases < 3) {
- ui->phase2->setDisabled(true);
- ui->phases->removeTab(2);
- }
- if (phases < 2) {
- ui->phase1->setDisabled(true);
- ui->phases->removeTab(1);
- ui->phase0Name->setDisabled(true);
- ui->phase0FadeIn->setDisabled(true);
- ui->phase0FadeOut->setDisabled(true);
- }
- if ( GetEepromInterface()->getCapability(FlightPhasesAreNamed) ) {
- for (int i=0; i < phases; i++) {
- QString PhaseName=g_model.phaseData[i].name;
- QString TabName;
- if (i==0) {
- TabName.append(QObject::tr("Flight Mode 0 (Default)"));
- } else {
- TabName.append(QObject::tr("FM %1").arg(i));
- }
- if (!PhaseName.isEmpty()) {
- TabName.append(" (");
- TabName.append(PhaseName);
- TabName.append(")");
- }
- ui->phases->setTabText(i,TabName);
- }
- } else {
- QLineEdit * tmp[]= { ui->phase0Name,ui->phase1Name,ui->phase2Name,ui->phase3Name,ui->phase4Name,ui->phase5Name,ui->phase6Name,ui->phase7Name,ui->phase8Name};
- QLabel * tmp2[] = { ui->label_fm0name,ui->label_fm1name,ui->label_fm2name,ui->label_fm3name,ui->label_fm4name,ui->label_fm5name,ui->label_fm6name,ui->label_fm7name,ui->label_fm8name};
- for (int i=0; i < phases; i++) {
- tmp[i]->hide();
- tmp2[i]->hide();
- }
- }
- ui->phases->setCurrentIndex(0);
- phasesLock = false;
-}
-
-void ModelEdit::on_phases_currentChanged(int index)
-{
- phasesLock = true;
- switch(index) {
- case 1:
- displayOnePhase(1, NULL, NULL, NULL, NULL, NULL, ui->phase1Trim1Value, NULL, ui->phase1Trim1Slider, NULL, ui->phase1Trim2Value, NULL, ui->phase1Trim2Slider, NULL, ui->phase1Trim3Value, NULL, ui->phase1Trim3Slider, NULL, ui->phase1Trim4Value, NULL, ui->phase1Trim4Slider, NULL, NULL, ui->phase1GV1Value, NULL, NULL, ui->phase1GV2Value, NULL, NULL, ui->phase1GV3Value, NULL, NULL, ui->phase1GV4Value, NULL, NULL, ui->phase1GV5Value,NULL,NULL, ui->phase1RE1Value,NULL,NULL, ui->phase1RE2Value);
- break;
- case 2:
- displayOnePhase(2, NULL, NULL, NULL, NULL, NULL, ui->phase2Trim1Value, NULL, ui->phase2Trim1Slider, NULL, ui->phase2Trim2Value, NULL, ui->phase2Trim2Slider, NULL, ui->phase2Trim3Value, NULL, ui->phase2Trim3Slider, NULL, ui->phase2Trim4Value, NULL, ui->phase2Trim4Slider, NULL, NULL, ui->phase2GV1Value, NULL, NULL, ui->phase2GV2Value, NULL, NULL, ui->phase2GV3Value, NULL, NULL, ui->phase2GV4Value, NULL, NULL, ui->phase2GV5Value,NULL,NULL, ui->phase2RE1Value,NULL,NULL, ui->phase2RE2Value);
- break;
- case 3:
- displayOnePhase(3, NULL, NULL, NULL, NULL, NULL, ui->phase3Trim1Value, NULL, ui->phase3Trim1Slider, NULL, ui->phase3Trim2Value, NULL, ui->phase3Trim2Slider, NULL, ui->phase3Trim3Value, NULL, ui->phase3Trim3Slider, NULL, ui->phase3Trim4Value, NULL, ui->phase3Trim4Slider, NULL, NULL, ui->phase3GV1Value, NULL, NULL, ui->phase3GV2Value, NULL, NULL, ui->phase3GV3Value, NULL, NULL, ui->phase3GV4Value, NULL, NULL, ui->phase3GV5Value,NULL,NULL, ui->phase3RE1Value,NULL,NULL, ui->phase3RE2Value);
- break;
- case 4:
- displayOnePhase(4, NULL, NULL, NULL, NULL, NULL, ui->phase4Trim1Value, NULL, ui->phase4Trim1Slider, NULL, ui->phase4Trim2Value, NULL, ui->phase4Trim2Slider, NULL, ui->phase4Trim3Value, NULL, ui->phase4Trim3Slider, NULL, ui->phase4Trim4Value, NULL, ui->phase4Trim4Slider, NULL, NULL, ui->phase4GV1Value, NULL, NULL, ui->phase4GV2Value, NULL, NULL, ui->phase4GV3Value, NULL, NULL, ui->phase4GV4Value, NULL, NULL, ui->phase4GV5Value,NULL,NULL, ui->phase4RE1Value,NULL,NULL, ui->phase4RE2Value);
- break;
- case 5:
- displayOnePhase(5, NULL, NULL, NULL, NULL, NULL, ui->phase5Trim1Value, NULL, ui->phase5Trim1Slider, NULL, ui->phase5Trim2Value, NULL, ui->phase5Trim2Slider, NULL, ui->phase5Trim3Value, NULL, ui->phase5Trim3Slider, NULL, ui->phase5Trim4Value, NULL, ui->phase5Trim4Slider, NULL, NULL, ui->phase5GV1Value, NULL, NULL, ui->phase5GV2Value, NULL, NULL, ui->phase5GV3Value, NULL, NULL, ui->phase5GV4Value, NULL, NULL, ui->phase5GV5Value,NULL,NULL, ui->phase5RE1Value,NULL,NULL, ui->phase5RE2Value);
- break;
- case 6:
- displayOnePhase(6, NULL, NULL, NULL, NULL, NULL, ui->phase6Trim1Value, NULL, ui->phase6Trim1Slider, NULL, ui->phase6Trim2Value, NULL, ui->phase6Trim2Slider, NULL, ui->phase6Trim3Value, NULL, ui->phase6Trim3Slider, NULL, ui->phase6Trim4Value, NULL, ui->phase6Trim4Slider, NULL, NULL, ui->phase6GV1Value, NULL, NULL, ui->phase6GV2Value, NULL, NULL, ui->phase6GV3Value, NULL, NULL, ui->phase6GV4Value, NULL, NULL, ui->phase6GV5Value,NULL,NULL, ui->phase6RE1Value,NULL,NULL, ui->phase6RE2Value);
- break;
- case 7:
- displayOnePhase(7, NULL, NULL, NULL, NULL, NULL, ui->phase7Trim1Value, NULL, ui->phase7Trim1Slider, NULL, ui->phase7Trim2Value, NULL, ui->phase7Trim2Slider, NULL, ui->phase7Trim3Value, NULL, ui->phase7Trim3Slider, NULL, ui->phase7Trim4Value, NULL, ui->phase7Trim4Slider, NULL, NULL, ui->phase7GV1Value, NULL, NULL, ui->phase7GV2Value, NULL, NULL, ui->phase7GV3Value, NULL, NULL, ui->phase7GV4Value, NULL, NULL, ui->phase7GV5Value,NULL,NULL, ui->phase7RE1Value,NULL,NULL, ui->phase7RE2Value);
- break;
- case 8:
- displayOnePhase(8, NULL, NULL, NULL, NULL, NULL, ui->phase8Trim1Value, NULL, ui->phase8Trim1Slider, NULL, ui->phase8Trim2Value, NULL, ui->phase8Trim2Slider, NULL, ui->phase8Trim3Value, NULL, ui->phase8Trim3Slider, NULL, ui->phase8Trim4Value, NULL, ui->phase8Trim4Slider, NULL, NULL, ui->phase8GV1Value, NULL, NULL, ui->phase8GV2Value, NULL, NULL, ui->phase8GV3Value, NULL, NULL, ui->phase8GV4Value, NULL, NULL, ui->phase8GV5Value,NULL,NULL, ui->phase8RE1Value,NULL,NULL, ui->phase8RE2Value);
- break;
- }
- phasesLock = false;
-}
-
-void ModelEdit::tabExpos()
-{
- // curDest -> destination channel
- // i -> mixer number
- QByteArray qba;
- ExposlistWidget->clear();
- int curDest = -1;
-
- for(int i=0; imode==0) break;
- QString str = "";
- while(curDest<(int)md->chn-1) {
- curDest++;
- str = getStickStr(curDest);
- qba.clear();
- qba.append((quint8)-curDest-1);
- QListWidgetItem *itm = new QListWidgetItem(str);
- itm->setData(Qt::UserRole,qba);
- ExposlistWidget->addItem(itm);
- }
-
- if(curDest!=(int)md->chn) {
- str = getStickStr(md->chn);
- curDest = md->chn;
- } else {
- str = " ";
- }
-
- switch (md->mode) {
- case (1): str += " <-"; break;
- case (2): str += " ->"; break;
- default: str += " "; break;
- };
-
- str += tr("Weight") + getGVarString(md->weight).rightJustified(6, ' ');
- if (!GetEepromInterface()->getCapability(ExpoIsCurve)) {
- if (md->expo!=0)
- str += " " + tr("Expo") + getGVarString(md->expo, true).rightJustified(7, ' ');
- } else {
- if (md->curveMode==0 && md->curveParam!=0)
- str += " " + tr("Expo") + getGVarString(md->curveParam, true).rightJustified(7, ' ');
- }
- if (GetEepromInterface()->getCapability(FlightPhases)) {
- if(md->phases) {
- if (md->phases!=(unsigned int)(1<getCapability(FlightPhases))-1) {
- int mask=1;
- int first=0;
- for (int i=0; igetCapability(FlightPhases);i++) {
- if (!(md->phases & mask)) {
- first++;
- }
- mask <<=1;
- }
- if (first>1) {
- str += " " + tr("Flight modes") + QString("(");
- } else {
- str += " " + tr("Flight mode") + QString("(");
- }
- mask=1;
- first=1;
- for (int i=0; igetCapability(FlightPhases);i++) {
- if (!(md->phases & mask)) {
- if (!first) {
- str += QString(", ")+ QString("%1").arg(getPhaseName(i+1, g_model.phaseData[i].name));
- } else {
- str += QString("%1").arg(getPhaseName(i+1,g_model.phaseData[i].name));
- first=0;
- }
- }
- mask <<=1;
- }
- str += QString(")");
- } else {
- str += tr("DISABLED")+QString(" !!!");
- }
- }
- }
- if (md->swtch.type != SWITCH_TYPE_NONE) str += " " + tr("Switch") + QString("(%1)").arg(md->swtch.toString());
- if (md->curveMode)
- if (md->curveParam) str += " " + tr("Curve") + QString("(%1)").arg(getCurveStr(md->curveParam));
- if (GetEepromInterface()->getCapability(HasExpoNames)) {
- QString ExpoName;
- ExpoName.append(md->name);
- if (!ExpoName.isEmpty()) {
- str+=QString("(%1)").arg(ExpoName);
- }
- }
- qba.clear();
- qba.append((quint8)i);
- qba.append((const char*)md, sizeof(ExpoData));
- QListWidgetItem *itm = new QListWidgetItem(str);
- itm->setData(Qt::UserRole,qba); // expo number
- ExposlistWidget->addItem(itm); //(str);
- }
-
- while(curDestsetData(Qt::UserRole,qba); // add new expo
- ExposlistWidget->addItem(itm);
- }
-}
-
-void ModelEdit::exposEdited()
-{
- updateSettings();
-}
-
-void ModelEdit::tabMixes()
-{
- // curDest -> destination channel4
- // i -> mixer number
- QByteArray qba;
- MixerlistWidget->clear();
- unsigned int curDest = 0;
- int i;
- unsigned int outputs = GetEepromInterface()->getCapability(Outputs);
- int showNames=ui->showNames_Ckb->isChecked();
- for(i=0; igetCapability(Mixes); i++) {
- MixData *md = &g_model.mixData[i];
- if ((md->destCh==0) || (md->destCh>outputs+(unsigned int)GetEepromInterface()->getCapability(ExtraChannels))) continue;
- QString str = "";
- while(curDest<(md->destCh-1)) {
- curDest++;
- if (curDest > outputs) {
- str = tr("X%1 ").arg(curDest-outputs);
- } else {
- str = tr("CH%1%2").arg(curDest/10).arg(curDest%10);
- if (GetEepromInterface()->getCapability(HasChNames) && showNames) {
- QString name=g_model.limitData[curDest-1].name;
- if (!name.isEmpty()) {
- name.append(" ");
- str=name.left(6);
- }
- }
- }
- qba.clear();
- qba.append((quint8)-curDest);
- QListWidgetItem *itm = new QListWidgetItem(str);
- itm->setData(Qt::UserRole,qba);
- MixerlistWidget->addItem(itm);
- }
-
- if (md->destCh > outputs) {
- str = tr("X%1 ").arg(md->destCh-outputs);
- } else {
- str = tr("CH%1%2").arg(md->destCh/10).arg(md->destCh%10);
- str.append(" ");
- if (GetEepromInterface()->getCapability(HasChNames) && showNames) {
- QString name=g_model.limitData[md->destCh-1].name;
- if (!name.isEmpty()) {
- name.append(" ");
- str=name.left(6);
- }
- }
- }
- if (curDest != md->destCh) {
- curDest = md->destCh;
- } else {
- str.fill(' ');
- }
-
- switch(md->mltpx) {
- case (1): str += " *"; break;
- case (2): str += " R"; break;
- default: str += " "; break;
- };
-
- str += " " + getGVarString(md->weight, true).rightJustified(6, ' ');
- str += md->srcRaw.toString();
- unsigned int fpCount = GetEepromInterface()->getCapability(FlightPhases);
- if (GetEepromInterface()->getCapability(FlightPhases)) {
- if(md->phases) {
- if (md->phases!=(unsigned int)(1<phases & mask)) {
- first++;
- }
- mask <<=1;
- }
- if (first>1) {
- str += " " + tr("Flight modes") + QString("(");
- } else {
- str += " " + tr("Flight mode") + QString("(");
- }
- mask=1;
- first=1;
- for (unsigned int i=0; iphases & mask)) {
- if (!first) {
- str += QString(", ")+ QString("%1").arg(getPhaseName(i+1, g_model.phaseData[i].name));
- }
- else {
- str += QString("%1").arg(getPhaseName(i+1,g_model.phaseData[i].name));
- first=0;
- }
- }
- mask <<=1;
- }
- str += QString(")");
- } else {
- str += tr("DISABLED")+QString(" !!!");
- }
- }
- }
- if(md->swtch.type != SWITCH_TYPE_NONE) str += " " + tr("Switch") + QString("(%1)").arg(md->swtch.toString());
- if(md->carryTrim>0) {
- str += " " +tr("No Trim");
- } else if (md->carryTrim<0) {
- str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString();
- }
- if(md->noExpo) {
- str += " " +tr("No DR/Expo");
- }
- if (GetEepromInterface()->getCapability(MixFmTrim) && md->enableFmTrim==1) {
- if (md->sOffset) str += " " + tr("FMTrim") + QString("(%1%)").arg(md->sOffset);
- } else {
- if (md->sOffset) str += " " + tr("Offset") + getGVarString(md->sOffset);
- }
- if (md->differential) str += " " + tr("Diff") + getGVarString(md->differential);
- if (md->curve) str += " " + tr("Curve") + QString("(%1)").arg(getCurveStr(md->curve));
- int scale=GetEepromInterface()->getCapability(SlowScale);
- if (scale==0)
- scale=1;
- if (md->delayDown || md->delayUp)
- str += tr(" Delay(u%1:d%2)").arg((double)md->delayUp/scale).arg((double)md->delayDown/scale);
- if (md->speedDown || md->speedUp)
- str += tr(" Slow(u%1:d%2)").arg((double)md->speedUp/scale).arg((double)md->speedDown/scale);
- if (md->mixWarn) str += tr(" Warn(%1)").arg(md->mixWarn);
- if (GetEepromInterface()->getCapability(HasMixerNames)) {
- QString MixerName;
- MixerName.append(md->name);
- if (!MixerName.isEmpty()) {
- str+=QString("(%1)").arg(MixerName);
- }
- }
- qba.clear();
- qba.append((quint8)i);
- qba.append((const char*)md, sizeof(MixData));
- QListWidgetItem *itm = new QListWidgetItem(str);
- itm->setData(Qt::UserRole,qba); // mix number
- MixerlistWidget->addItem(itm);//(str);
- }
-
- while(curDestgetCapability(ExtraChannels)) {
- curDest++;
- QString str;
-
- if (curDest > outputs) {
- str = tr("X%1 ").arg(curDest-outputs);
- } else {
- str = tr("CH%1%2").arg(curDest/10).arg(curDest%10);
- if (GetEepromInterface()->getCapability(HasChNames) && showNames) {
- QString name=g_model.limitData[curDest-1].name;
- if (!name.isEmpty()) {
- name.append(" ");
- str=name.left(6);
- }
- }
- }
- qba.clear();
- qba.append((quint8)-curDest);
- QListWidgetItem *itm = new QListWidgetItem(str);
- itm->setData(Qt::UserRole,qba); // add new mixer
- MixerlistWidget->addItem(itm);
- }
-}
-
-void ModelEdit::mixesEdited()
-{
- updateSettings();
-}
-
-
-void ModelEdit::tabHeli()
-{
- updateHeliTab();
-
- connect(ui->swashTypeCB,SIGNAL(currentIndexChanged(int)),this,SLOT(heliEdited()));
- connect(ui->swashCollectiveCB,SIGNAL(currentIndexChanged(int)),this,SLOT(heliEdited()));
- connect(ui->swashRingValSB,SIGNAL(editingFinished()),this,SLOT(heliEdited()));
- connect(ui->swashInvertELE,SIGNAL(stateChanged(int)),this,SLOT(heliEdited()));
- connect(ui->swashInvertAIL,SIGNAL(stateChanged(int)),this,SLOT(heliEdited()));
- connect(ui->swashInvertCOL,SIGNAL(stateChanged(int)),this,SLOT(heliEdited()));
-}
-
-void ModelEdit::updateHeliTab()
-{
- heliEditLock = true;
-
- ui->swashTypeCB->setCurrentIndex(g_model.swashRingData.type);
- populateSourceCB(ui->swashCollectiveCB, g_model.swashRingData.collectiveSource, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS);
- ui->swashRingValSB->setValue(g_model.swashRingData.value);
- ui->swashInvertELE->setChecked(g_model.swashRingData.invertELE);
- ui->swashInvertAIL->setChecked(g_model.swashRingData.invertAIL);
- ui->swashInvertCOL->setChecked(g_model.swashRingData.invertCOL);
-
- heliEditLock = false;
-}
-
-void ModelEdit::heliEdited()
-{
- if(heliEditLock) return;
- g_model.swashRingData.type = ui->swashTypeCB->currentIndex();
- g_model.swashRingData.collectiveSource = ui->swashCollectiveCB->itemData(ui->swashCollectiveCB->currentIndex()).toInt();
- g_model.swashRingData.value = ui->swashRingValSB->value();
- g_model.swashRingData.invertELE = ui->swashInvertELE->isChecked();
- g_model.swashRingData.invertAIL = ui->swashInvertAIL->isChecked();
- g_model.swashRingData.invertCOL = ui->swashInvertCOL->isChecked();
- updateSettings();
-}
-
-void ModelEdit::tabLimits()
-{
- limitEditLock=true;
- int chnames=GetEepromInterface()->getCapability(HasChNames);
- QRegExp rx(CHAR_FOR_NAMES_REGEX);
- foreach(QLineEdit *le, findChildren(QRegExp("CHName_[0-9]+"))) {
- int len=le->objectName().mid(le->objectName().lastIndexOf("_")+1).toInt()-1;
- if (chnames ) {
- QString name=g_model.limitData[len].name;
- if (name.trimmed().isEmpty()) {
- le->setText(tr("CH %1").arg(len+1));
- } else {
- le->setText(name);
- }
- le->setValidator(new QRegExpValidator(rx, this));
- le->setEnabled(true);
- le->setReadOnly(false);
- connect(le, SIGNAL(editingFinished()), this, SLOT(limitNameEdited()));
- } else {
- le->setText(tr("CH %1").arg(len+1));
- le->setDisabled(true);
- le->setReadOnly(true);
- }
- }
- limitEditLock=false;
- foreach(QDoubleSpinBox *sb, findChildren(QRegExp("offsetDSB_[0-9]+"))) {
- int sbn=sb->objectName().mid(sb->objectName().lastIndexOf("_")+1).toInt()-1;
- sb->setValue(g_model.limitData[sbn].offset/10.0);
- connect(sb, SIGNAL(editingFinished()), this, SLOT(limitOffsetEdited()));
- }
-
- foreach(QSpinBox *sb, findChildren(QRegExp("minSB_[0-9]+"))) {
- int sbn=sb->objectName().mid(sb->objectName().lastIndexOf("_")+1).toInt()-1;
- sb->setValue(g_model.limitData[sbn].min);
- connect(sb, SIGNAL(editingFinished()), this, SLOT(limitEdited()));
- }
-
- foreach(QSpinBox *sb, findChildren(QRegExp("maxSB_[0-9]+"))) {
- int sbn=sb->objectName().mid(sb->objectName().lastIndexOf("_")+1).toInt()-1;
- sb->setValue(g_model.limitData[sbn].max);
- connect(sb, SIGNAL(editingFinished()), this, SLOT(limitEdited()));
- }
-
- foreach(QComboBox *cb, findChildren(QRegExp("chInvCB_[0-9]+"))) {
- int cbn=cb->objectName().mid(cb->objectName().lastIndexOf("_")+1).toInt()-1;
- cb->setCurrentIndex((g_model.limitData[cbn].revert) ? 1 : 0);
- connect(cb, SIGNAL(currentIndexChanged(int)), this, SLOT(limitInvEdited()));
- }
- if (GetEepromInterface()->getCapability(PPMCenter)) {
- foreach(QSpinBox *sb, findChildren(QRegExp("ppmcenter_[0-9]+"))) {
- int sbn=sb->objectName().mid(sb->objectName().lastIndexOf("_")+1).toInt()-1;
- sb->setValue(g_model.limitData[sbn].ppmCenter+1500);
- connect(sb, SIGNAL(editingFinished()), this, SLOT(ppmcenterEdited()));
- }
- } else {
- foreach(QSpinBox *sb, findChildren(QRegExp("ppmcenter_[0-9]+"))) {
- sb->hide();
- }
- ui->ppmc_label1->hide();
- ui->ppmc_label2->hide();
- }
-
- if (GetEepromInterface()->getCapability(SYMLimits)) {
- foreach(QCheckBox *ckb, findChildren(QRegExp("symckb_[0-9]+"))) {
- int ckbn=ckb->objectName().mid(ckb->objectName().lastIndexOf("_")+1).toInt()-1;
- ckb->setChecked(g_model.limitData[ckbn].symetrical);
- connect(ckb, SIGNAL(toggled(bool)), this, SLOT(limitSymEdited()));
- }
- } else {
- foreach(QCheckBox *ckb, findChildren(QRegExp("symckb_[0-9]+"))) {
- ckb->hide();
- }
- ui->label_sym01->hide();
- ui->label_sym02->hide();
- }
-
- if (GetEepromInterface()->getCapability(Outputs)<17) {
- ui->limitGB2->hide();
- }
- setLimitMinMax();
-}
-
-void ModelEdit::updateCurvesTab()
-{
- ControlCurveSignal(true);
- foreach(QCheckBox *ChkB, findChildren(QRegExp("plotCB_[0-9]+"))) {
- int ChkBn=ChkB->objectName().mid(ChkB->objectName().lastIndexOf("_")+1).toInt()-1;
- ChkB->setChecked(plot_curve[ChkBn]);
- }
- ControlCurveSignal(false);
-}
-
-
-void ModelEdit::tabCurves()
-{
- QSpinBox* tmpy[17] = {
- ui->curvePt01_y, ui->curvePt02_y, ui->curvePt03_y, ui->curvePt04_y, ui->curvePt05_y,
- ui->curvePt06_y, ui->curvePt07_y, ui->curvePt08_y, ui->curvePt09_y, ui->curvePt10_y,
- ui->curvePt11_y, ui->curvePt12_y, ui->curvePt13_y, ui->curvePt14_y, ui->curvePt15_y,
- ui->curvePt16_y, ui->curvePt17_y };
- QSpinBox* tmpx[17] = {
- ui->curvePt01_x, ui->curvePt02_x, ui->curvePt03_x, ui->curvePt04_x, ui->curvePt05_x,
- ui->curvePt06_x, ui->curvePt07_x, ui->curvePt08_x, ui->curvePt09_x, ui->curvePt10_x,
- ui->curvePt11_x, ui->curvePt12_x, ui->curvePt13_x, ui->curvePt14_x, ui->curvePt15_x,
- ui->curvePt16_x, ui->curvePt17_x };
-
- QPushButton * editb[16]= {
- ui->curveEdit_1,ui->curveEdit_2,ui->curveEdit_3,ui->curveEdit_4,
- ui->curveEdit_5,ui->curveEdit_6,ui->curveEdit_7,ui->curveEdit_8,
- ui->curveEdit_9,ui->curveEdit_10,ui->curveEdit_11,ui->curveEdit_12,
- ui->curveEdit_13,ui->curveEdit_14,ui->curveEdit_15,ui->curveEdit_16 };
-
- QPushButton * resetb[16]= {
- ui->resetCurve_1,ui->resetCurve_2,ui->resetCurve_3,ui->resetCurve_4,
- ui->resetCurve_5,ui->resetCurve_6,ui->resetCurve_7,ui->resetCurve_8,
- ui->resetCurve_9,ui->resetCurve_10,ui->resetCurve_11,ui->resetCurve_12,
- ui->resetCurve_13,ui->resetCurve_14,ui->resetCurve_15,ui->resetCurve_16 };
-
- QCheckBox * plotcb[16]= {
- ui->plotCB_1,ui->plotCB_2,ui->plotCB_3,ui->plotCB_4,
- ui->plotCB_5,ui->plotCB_6,ui->plotCB_7,ui->plotCB_8,
- ui->plotCB_9,ui->plotCB_10,ui->plotCB_11,ui->plotCB_12,
- ui->plotCB_13,ui->plotCB_14,ui->plotCB_15,ui->plotCB_16 };
-
- memcpy(spny, tmpy, sizeof(spny));
- memcpy(spnx, tmpx, sizeof(spnx));
- int numcurves=GetEepromInterface()->getCapability(NumCurves);
- if (numcurves==0) {
- numcurves=16;
- }
-
- if (!GetEepromInterface()->getCapability(CustomCurves)){
- ui->curvetype_CB->setDisabled(true);
- int count=0;
- for (int i=0; i< GetEepromInterface()->getCapability(NumCurves3); i++) {
- g_model.curves[count].count=3;
- g_model.curves[count].custom=false;
- count++;
- }
- for (int i=0; i< GetEepromInterface()->getCapability(NumCurves5); i++) {
- g_model.curves[count].count=5;
- g_model.curves[count].custom=false;
- count++;
- }
- for (int i=0; i< GetEepromInterface()->getCapability(NumCurves9); i++) {
- g_model.curves[count].count=9;
- g_model.curves[count].custom=false;
- count++;
- }
- for (int i=count; i< 16; i++) {
- editb[i]->hide();
- plotcb[i]->hide();
- resetb[i]->hide();
- }
-
- } else {
- ui->curvetype_CB->setEnabled(true);
- }
- if (!GetEepromInterface()->getCapability(HasCvNames)){
- ui->cname_LE->hide();
- ui->cname_label->hide();
- } else {
- ui->cname_LE->setText(g_model.curves[0].name);
- }
-
- for (int i=numcurves; i<16;i++) {
- editb[i]->hide();
- resetb[i]->hide();
- plotcb[i]->hide();
- }
-
-
- for (int i=0; i<16;i++) {
- plot_curve[i]=FALSE;
- }
- redrawCurve=true;
- drawing=false;
-#ifdef __APPLE__
- ui->curveEdit_1->setStyleSheet("color: #00007f;");
- ui->curveEdit_2->setStyleSheet("color: #007f00;");
- ui->curveEdit_3->setStyleSheet("color: #7f0000;");
- ui->curveEdit_4->setStyleSheet("color: #007f7f;");
- ui->curveEdit_5->setStyleSheet("color: #7f007f;");
- ui->curveEdit_6->setStyleSheet("color: #7f7f00;");
- ui->curveEdit_7->setStyleSheet("color: #7f7f7f;");
- ui->curveEdit_8->setStyleSheet("color: #0000ff;");
- ui->curveEdit_9->setStyleSheet("color: #007fff;");
- ui->curveEdit_10->setStyleSheet("color: #7f00ff;");
- ui->curveEdit_11->setStyleSheet("color: #00ff00;");
- ui->curveEdit_12->setStyleSheet("color: #00ff7f;");
- ui->curveEdit_13->setStyleSheet("color: #7fff00;");
- ui->curveEdit_14->setStyleSheet("color: #ff0000;");
- ui->curveEdit_15->setStyleSheet("color: #ff007f;");
- ui->curveEdit_16->setStyleSheet("color: #ff7f00;");
-#else
- ui->curveEdit_1->setStyleSheet("background-color: #00007f; color: white;");
- ui->curveEdit_2->setStyleSheet("background-color: #007f00; color: white;");
- ui->curveEdit_3->setStyleSheet("background-color: #7f0000; color: white;");
- ui->curveEdit_4->setStyleSheet("background-color: #007f7f; color: white;");
- ui->curveEdit_5->setStyleSheet("background-color: #7f007f; color: white;");
- ui->curveEdit_6->setStyleSheet("background-color: #7f7f00; color: white;");
- ui->curveEdit_7->setStyleSheet("background-color: #7f7f7f; color: white;");
- ui->curveEdit_8->setStyleSheet("background-color: #0000ff; color: white;");
- ui->curveEdit_9->setStyleSheet("background-color: #007fff; color: white;");
- ui->curveEdit_10->setStyleSheet("background-color: #7f00ff; color: white;");
- ui->curveEdit_11->setStyleSheet("background-color: #00ff00; color: white;");
- ui->curveEdit_12->setStyleSheet("background-color: #00ff7f; color: white;");
- ui->curveEdit_13->setStyleSheet("background-color: #7fff00; color: white;");
- ui->curveEdit_14->setStyleSheet("background-color: #ff0000; color: white;");
- ui->curveEdit_15->setStyleSheet("background-color: #ff007f; color: white;");
- ui->curveEdit_16->setStyleSheet("background-color: #ff7f00; color: white;");
-#endif
- updateCurvesTab();
-
- QGraphicsScene *scene = new QGraphicsScene(ui->curvePreview);
- scene->setItemIndexMethod(QGraphicsScene::NoIndex);
- ui->curvePreview->setScene(scene);
- currentCurve = 0;
-
- connect(ui->clearMixesPB,SIGNAL(pressed()),this,SLOT(clearCurves()));
-
- foreach(QSpinBox *sb, findChildren(QRegExp("curvePt[0-9]+"))) {
- connect(sb, SIGNAL(valueChanged(int)), this, SLOT(curvePointEdited()));
- }
-
- foreach(QPushButton *pb, findChildren(QRegExp("resetCurve_[0-9]+"))) {
- connect(pb, SIGNAL(clicked()), this, SLOT(resetCurve()));
- }
-
- foreach(QPushButton *pb, findChildren(QRegExp("curveEdit_[0-9]+"))) {
- connect(pb, SIGNAL(clicked()), this, SLOT(editCurve()));
- }
-
- foreach(QCheckBox *ChkB, findChildren(QRegExp("plotCB_[0-9]+"))) {
- connect(ChkB, SIGNAL(toggled(bool)), this, SLOT(plotCurve(bool)));
- }
- setCurrentCurve(currentCurve);
- ui->ca_coeff_SB->hide();
- ui->ca_coeff_label->hide();
- ui->ca_ymid_SB->hide();
- ui->ca_ymid_label->hide();
-}
-
-void ModelEdit::on_ca_ctype_CB_currentIndexChanged()
-{
- int index=ui->ca_ctype_CB->currentIndex();
- switch (index) {
- case 0:
- ui->ca_coeff_SB->hide();
- ui->ca_coeff_label->hide();
- ui->ca_ymid_SB->hide();
- ui->ca_ymid_label->hide();
- ui->ca_ymin_SB->show();
- ui->ca_ymin_label->show();
- ui->ca_ymin_SB->setValue(-100);
- ui->ca_ymax_SB->setValue(100);
- break;
- case 1:
- ui->ca_coeff_SB->show();
- ui->ca_coeff_label->show();
- ui->ca_ymid_SB->hide();
- ui->ca_ymid_label->hide();
- ui->ca_ymin_SB->show();
- ui->ca_ymin_label->show();
- ui->ca_ymin_SB->setValue(-100);
- ui->ca_ymax_SB->setValue(100);
- break;
- case 2:
- ui->ca_coeff_SB->show();
- ui->ca_coeff_label->show();
- ui->ca_ymid_SB->hide();
- ui->ca_ymid_label->hide();
- ui->ca_ymin_SB->hide();
- ui->ca_ymin_label->hide();
- ui->ca_ymax_SB->setValue(100);
- break;
- case 3:
- ui->ca_coeff_SB->show();
- ui->ca_coeff_label->show();
- ui->ca_ymid_SB->show();
- ui->ca_ymid_label->show();
- ui->ca_ymin_SB->hide();
- ui->ca_ymin_label->hide();
- ui->ca_ymid_SB->setValue(0);
- ui->ca_ymax_SB->setValue(100);
- break;
- }
-}
-
-void ModelEdit::on_ca_apply_PB_clicked()
-{
- int index=ui->ca_ctype_CB->currentIndex();
- float x;
- int y;
- int invert=0;
- float a;
- if (index==0) {
- a=(ui->ca_ymax_SB->value()-ui->ca_ymin_SB->value())/200.0;
- int numpoints=g_model.curves[currentCurve].count;
- for (int i=0; ica_ymin_SB->value()+a*x;
- switch (ui->ca_side_CB->currentIndex()) {
- case 0:
- g_model.curves[currentCurve].points[i].y=y;
- break;
- case 1:
- if (x>=100) {
- g_model.curves[currentCurve].points[i].y=y;
- }
- break;
- case 2:
- if (x<100) {
- g_model.curves[currentCurve].points[i].y=y;
- }
- break;
- }
- }
- } else if (index==1) {
- int numpoints=g_model.curves[currentCurve].count;
- for (int i=0; ica_coeff_SB->value();
- if (a>=0) {
- y=round(c9xexpou(x,a)*(ui->ca_ymax_SB->value()-ui->ca_ymin_SB->value())/100.0+ui->ca_ymin_SB->value());
- } else {
- a=-a;
- x=100-x;
- y=round((100.0-c9xexpou(x,a))*(ui->ca_ymax_SB->value()-ui->ca_ymin_SB->value())/100.0+ui->ca_ymin_SB->value());
- }
- switch (ui->ca_side_CB->currentIndex()) {
- case 0:
- g_model.curves[currentCurve].points[i].y=y;
- break;
- case 1:
- if (x>=50) {
- g_model.curves[currentCurve].points[i].y=y;
- }
- break;
- case 2:
- if (x<50) {
- g_model.curves[currentCurve].points[i].y=y;
- }
- break;
- }
- }
- } else if (index==2) {
- int numpoints=g_model.curves[currentCurve].count;
- for (int i=0; ica_coeff_SB->value();
- if (x<0) {
- x=-x;
- invert=1;
- } else {
- invert=0;
- }
- if (a>=0) {
- y=round(c9xexpou(x,a)*(ui->ca_ymax_SB->value()/100.0));
- } else {
- a=-a;
- x=100-x;
- y=round((100.0-c9xexpou(x,a))*(ui->ca_ymax_SB->value()/100.0));
- }
- switch (ui->ca_side_CB->currentIndex()) {
- case 0:
- if (invert==1) {
- g_model.curves[currentCurve].points[i].y=-y;
- } else {
- g_model.curves[currentCurve].points[i].y=y;
- }
- break;
- case 1:
- if (invert==0) {
- g_model.curves[currentCurve].points[i].y=y;
- }
- break;
- case 2:
- if (invert==1) {
- g_model.curves[currentCurve].points[i].y=-y;
- }
- break;
- }
- }
- } else if (index==3) {
- int numpoints=g_model.curves[currentCurve].count;
- for (int i=0; i=0);
- a=ui->ca_coeff_SB->value();
- if (x<0) {
- x=-x;
- }
- if (a>=0) {
- y=round(c9xexpou(x,a)*((ui->ca_ymax_SB->value()-ui->ca_ymid_SB->value())/100.0)+ui->ca_ymid_SB->value());
- } else {
- a=-a;
- x=100-x;
- y=round((100.0-c9xexpou(x,a))*((ui->ca_ymax_SB->value()-ui->ca_ymid_SB->value())/100.0)+ui->ca_ymid_SB->value());
- }
- switch (ui->ca_side_CB->currentIndex()) {
- case 0:
- g_model.curves[currentCurve].points[i].y=y;
- break;
- case 1:
- if (pos) {
- g_model.curves[currentCurve].points[i].y=y;
- }
- break;
- case 2:
- if (!pos) {
- g_model.curves[currentCurve].points[i].y=y;
- }
- break;
- }
- }
- }
- updateSettings();
- setCurrentCurve(currentCurve);
- drawCurve();
-}
-
-void ModelEdit::limitSymEdited()
-{
- QCheckBox *ckb = qobject_cast(sender());
- int limitId=ckb->objectName().mid(ckb->objectName().lastIndexOf("_")+1).toInt()-1;
- g_model.limitData[limitId].symetrical = (ckb->checkState() ? 1 : 0);
- updateSettings();
-}
-
-void ModelEdit::limitNameEdited()
-{
- if(limitEditLock) return;
- limitEditLock=true;
- QLineEdit *le = qobject_cast(sender());
- int limitId=le->objectName().mid(le->objectName().lastIndexOf("_")+1).toInt()-1;
- int i=0;
- if (le->text()==tr("CH %1").arg(limitId+1)) {
- le->setText("");
- }
- for (i=0; itext().toAscii().length(); i++) {
- g_model.limitData[limitId].name[i]=le->text().toAscii().at(i);
- }
- if (le->text().trimmed().isEmpty()) {
- le->setText(tr("CH %1").arg(limitId+1));
- }
- g_model.limitData[limitId].name[i]=0;
- updateSettings();
- tabMixes();
- limitEditLock=false;
-}
-
-
-void ModelEdit::limitOffsetEdited()
-{
- QDoubleSpinBox *dsb = qobject_cast(sender());
- int limitId=dsb->objectName().mid(dsb->objectName().lastIndexOf("_")+1).toInt()-1;
- g_model.limitData[limitId].offset = round(dsb->value()*10);
- updateSettings();
-}
-
-void ModelEdit::limitEdited()
-{
- QSpinBox *sb = qobject_cast(sender());
- int limitId=sb->objectName().mid(sb->objectName().lastIndexOf("_")+1).toInt()-1;
- if (sb->objectName().indexOf("max")!=-1) {
- g_model.limitData[limitId].max = sb->value();
- }
- else {
- g_model.limitData[limitId].min = sb->value();
- }
- updateSettings();
-}
-
-void ModelEdit::limitInvEdited()
-{
- QComboBox *cb = qobject_cast(sender());
- int limitId=cb->objectName().mid(cb->objectName().lastIndexOf("_")+1).toInt()-1;
- g_model.limitData[limitId].revert = cb->currentIndex();
- updateSettings();
-}
-
-void ModelEdit::ppmcenterEdited()
-{
- QSpinBox *sb = qobject_cast(sender());
- int limitId=sb->objectName().mid(sb->objectName().lastIndexOf("_")+1).toInt()-1;
- g_model.limitData[limitId].ppmCenter = sb->value()-1500;
- updateSettings();
-}
-
-void ModelEdit::startupSwitchEdited()
-{
- if (GetEepromInterface()->getCapability(Pots)==3) {
- uint8_t i= 0;
- i|=(uint8_t)ui->swwarn0_CB->currentIndex();
- if (i==1) {
- ui->swwarn1_ChkB->setDisabled(true) ;
- ui->swwarn2_ChkB->setDisabled(true) ;
- ui->swwarn3_ChkB->setDisabled(true) ;
- ui->swwarn4_CB->setDisabled(true) ;
- ui->swwarn5_ChkB->setDisabled(true) ;
- ui->swwarn6_ChkB->setDisabled(true) ;
- } else {
- ui->swwarn1_ChkB->setEnabled(true) ;
- ui->swwarn2_ChkB->setEnabled(true) ;
- ui->swwarn3_ChkB->setEnabled(true) ;
- ui->swwarn4_CB->setEnabled(true) ;
- ui->swwarn5_ChkB->setEnabled(true) ;
- ui->swwarn6_ChkB->setEnabled(true) ;
- i|=(ui->swwarn1_ChkB->isChecked() ? 1 : 0)<<1;
- i|=(ui->swwarn2_ChkB->isChecked() ? 1 : 0)<<2;
- i|=(ui->swwarn3_ChkB->isChecked() ? 1 : 0)<<3;
- i|=((uint8_t)ui->swwarn4_CB->currentIndex() & 0x03)<<4;
- i|=(ui->swwarn5_ChkB->isChecked() ? 1 : 0)<<6;
- i|=(ui->swwarn6_ChkB->isChecked() ? 1 : 0)<<7;
- }
- g_model.switchWarningStates=i;
- } else {
- uint16_t i= 0;
- i|=(uint16_t)ui->tswwarn0_CB->currentIndex();
- if (i==1) {
- ui->chkSA->setDisabled(true);
- ui->chkSB->setDisabled(true);
- ui->chkSC->setDisabled(true);
- ui->chkSD->setDisabled(true);
- ui->chkSE->setDisabled(true);
- ui->chkSF->setDisabled(true);
- ui->chkSG->setDisabled(true);
- } else {
- ui->chkSA->setEnabled(true);
- ui->chkSB->setEnabled(true);
- ui->chkSC->setEnabled(true);
- ui->chkSD->setEnabled(true);
- ui->chkSE->setEnabled(true);
- ui->chkSF->setEnabled(true);
- ui->chkSG->setEnabled(true);
- i|=(((uint16_t)ui->chkSA->value())<<1);
- i|=(((uint16_t)ui->chkSB->value())<<3);
- i|=(((uint16_t)ui->chkSC->value())<<5);
- i|=(((uint16_t)ui->chkSD->value())<<7);
- i|=(((uint16_t)ui->chkSE->value())<<9);
- i|=(((uint16_t)ui->chkSF->value())<<12);
- i|=(((uint16_t)ui->chkSG->value())<<13);
- }
- g_model.switchWarningStates=i;
- }
- updateSettings();
-}
-
-void ModelEdit::setCurrentCurve(int curveId)
-{
- currentCurve = curveId;
- curvesLock=true;
- QString ss = "QSpinBox { background-color:rgb(255, 255, 127);}";
- for (int i=0; ishow();
- spny[i]->setValue(g_model.curves[currentCurve].points[i].y);
- if (!g_model.curves[currentCurve].custom || i==0 || i==(g_model.curves[currentCurve].count-1)) {
- spnx[i]->hide();
- if (i==0) {
- spnx[i]->setValue(-100);
- }
- if (i==(g_model.curves[currentCurve].count-1)) {
- spnx[i]->setValue(100);
- }
- } else {
- spnx[i]->show();
- spnx[i]->setMaximum(g_model.curves[currentCurve].points[i+1].x-1);
- spnx[i]->setMinimum(g_model.curves[currentCurve].points[i-1].x+1);
- spnx[i]->setValue(g_model.curves[currentCurve].points[i].x);
- }
- }
- for (int i=g_model.curves[currentCurve].count; i<17;i++) {
- spny[i]->hide();
- spnx[i]->hide();
- }
- int index=0;
- if (g_model.curves[currentCurve].count==3) {
- index=0;
- } else if (g_model.curves[currentCurve].count==5) {
- index=2;
- } else if (g_model.curves[currentCurve].count==9) {
- index=4;
- } else if (g_model.curves[currentCurve].count==17) {
- index=6;
- }
- if (g_model.curves[currentCurve].custom) {
- index++;
- }
- if (!GetEepromInterface()->getCapability(HasCvNames)){
- ui->cname_LE->hide();
- ui->cname_label->hide();
- } else {
- ui->cname_LE->setText(g_model.curves[currentCurve].name);
- }
-
- ui->curvetype_CB->setCurrentIndex(index);
- curvesLock=false;
-}
-
-void ModelEdit::curvePointEdited()
-{
- if (curvesLock) {
- return;
- }
- /* for (int i=1; i< g_model.curves[currentCurve].count-1; i++) {
- if (g_model.curves[currentCurve].points[i].x>(100-g_model.curves[currentCurve].count+i)) {
- g_model.curves[currentCurve].points[i].x=(100-g_model.curves[currentCurve].count+i);
- }
- if (g_model.curves[currentCurve].points[i].x<=g_model.curves[currentCurve].points[i-1].x) {
- spnx[i]->setValue(spnx[i-1]->value()+1);
- }
- }
- */
- for (int i=0; i< 17; i++) {
- g_model.curves[currentCurve].points[i].x=spnx[i]->value();
- g_model.curves[currentCurve].points[i].y=spny[i]->value();
- }
- if (redrawCurve)
- drawCurve();
- updateSettings();
-}
-
-
-void ModelEdit::setSwitchWidgetVisibility(int i)
-{
- RawSource source=RawSource(g_model.customSw[i].val1);
- switch (getCSFunctionFamily(g_model.customSw[i].func))
- {
- case CS_FAMILY_VOFS:
- cswitchSource1[i]->setVisible(true);
- cswitchSource2[i]->setVisible(false);
- cswitchValue[i]->setVisible(false);
- cswitchOffset[i]->setVisible(true);
- populateSourceCB(cswitchSource1[i], source, POPULATE_SOURCES | (GetEepromInterface()->getCapability(ExtraTrims) ? POPULATE_TRIMS : 0) | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
- cswitchOffset[i]->setDecimals(source.getDecimals(g_model));
- cswitchOffset[i]->setSingleStep(source.getStep(g_model));
- if (g_model.customSw[i].func>CS_FN_ELESS && g_model.customSw[i].funcsetMinimum(source.getStep(g_model)*-127);
- cswitchOffset[i]->setMaximum(source.getStep(g_model)*127);
- cswitchOffset[i]->setValue(source.getStep(g_model)*g_model.customSw[i].val2);
- } else {
- cswitchOffset[i]->setMinimum(source.getMin(g_model));
- cswitchOffset[i]->setMaximum(source.getMax(g_model));
- cswitchOffset[i]->setValue(source.getStep(g_model)*(g_model.customSw[i].val2+source.getRawOffset(g_model))+source.getOffset(g_model));
- }
- break;
- case CS_FAMILY_VBOOL:
- cswitchSource1[i]->setVisible(true);
- cswitchSource2[i]->setVisible(true);
- cswitchValue[i]->setVisible(false);
- cswitchOffset[i]->setVisible(false);
- populateSwitchCB(cswitchSource1[i], RawSwitch(g_model.customSw[i].val1));
- populateSwitchCB(cswitchSource2[i], RawSwitch(g_model.customSw[i].val2));
- break;
- case CS_FAMILY_VCOMP:
- cswitchSource1[i]->setVisible(true);
- cswitchSource2[i]->setVisible(true);
- cswitchValue[i]->setVisible(false);
- cswitchOffset[i]->setVisible(false);
- populateSourceCB(cswitchSource1[i], RawSource(g_model.customSw[i].val1), POPULATE_SOURCES | (GetEepromInterface()->getCapability(ExtraTrims) ? POPULATE_TRIMS : 0) | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
- populateSourceCB(cswitchSource2[i], RawSource(g_model.customSw[i].val2), POPULATE_SOURCES | (GetEepromInterface()->getCapability(ExtraTrims) ? POPULATE_TRIMS : 0) | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
- break;
- case CS_FAMILY_TIMERS:
- cswitchSource1[i]->setVisible(false);
- cswitchSource2[i]->setVisible(false);
- cswitchValue[i]->setVisible(true);
- cswitchOffset[i]->setVisible(true);
- cswitchOffset[i]->setDecimals(1);
- cswitchOffset[i]->setMinimum(0.1);
- cswitchOffset[i]->setMaximum(175);
- float value=ValToTim(g_model.customSw[i].val2);
- cswitchOffset[i]->setSingleStep(0.1);
- if (value>60) {
- cswitchOffset[i]->setSingleStep(1);
- } else if (value>2) {
- cswitchOffset[i]->setSingleStep(0.5);
- }
- cswitchOffset[i]->setValue(value);
-
- cswitchValue[i]->setDecimals(1);
- cswitchValue[i]->setMinimum(0.1);
- cswitchValue[i]->setMaximum(175);
- value=ValToTim(g_model.customSw[i].val1);
- cswitchValue[i]->setSingleStep(0.1);
- if (value>60) {
- cswitchValue[i]->setSingleStep(1);
- } else if (value>2) {
- cswitchValue[i]->setSingleStep(0.5);
- }
- cswitchValue[i]->setValue(value);
- break;
- }
- cswitchAnd[i]->setVisible(true);
- populateSwitchCB(cswitchAnd[i], RawSwitch(g_model.customSw[i].andsw), POPULATE_AND_SWITCHES);
- if (GetEepromInterface()->getCapability(CustomSwitchesExt)) {
- cswitchDuration[i]->setVisible(true);
- cswitchDuration[i]->setValue(g_model.customSw[i].duration/2.0);
- cswitchDelay[i]->setVisible(true);
- cswitchDelay[i]->setValue(g_model.customSw[i].delay/2.0);
- }
-}
-
-void ModelEdit::updateSwitchesTab()
-{
- switchEditLock = true;
- int num_csw=GetEepromInterface()->getCapability(CustomSwitches);
- for (int i=0; i< num_csw; i++) {
- populateCSWCB(csw[i], g_model.customSw[i].func);
- setSwitchWidgetVisibility(i);
- }
- switchEditLock = false;
-}
-
-void ModelEdit::tabCustomSwitches()
-{
- switchEditLock = true;
- QComboBox* tmpcsw[C9X_NUM_CSW] = {ui->cswitchFunc_1, ui->cswitchFunc_2, ui->cswitchFunc_3, ui->cswitchFunc_4,
- ui->cswitchFunc_5, ui->cswitchFunc_6, ui->cswitchFunc_7, ui->cswitchFunc_8,
- ui->cswitchFunc_9, ui->cswitchFunc_10, ui->cswitchFunc_11, ui->cswitchFunc_12,
- ui->cswitchFunc_13, ui->cswitchFunc_14, ui->cswitchFunc_15, ui->cswitchFunc_16,
- ui->cswitchFunc_17, ui->cswitchFunc_18, ui->cswitchFunc_19, ui->cswitchFunc_20,
- ui->cswitchFunc_21, ui->cswitchFunc_22, ui->cswitchFunc_23, ui->cswitchFunc_24,
- ui->cswitchFunc_25, ui->cswitchFunc_26, ui->cswitchFunc_27, ui->cswitchFunc_28,
- ui->cswitchFunc_29, ui->cswitchFunc_30, ui->cswitchFunc_31, ui->cswitchFunc_32 };
- QLabel* cswlabel[C9X_NUM_CSW] = { ui->cswlabel_01, ui->cswlabel_02, ui->cswlabel_03, ui->cswlabel_04,
- ui->cswlabel_05, ui->cswlabel_06, ui->cswlabel_07, ui->cswlabel_08,
- ui->cswlabel_09, ui->cswlabel_10, ui->cswlabel_11, ui->cswlabel_12,
- ui->cswlabel_13, ui->cswlabel_14, ui->cswlabel_15, ui->cswlabel_16,
- ui->cswlabel_17, ui->cswlabel_18, ui->cswlabel_19, ui->cswlabel_20,
- ui->cswlabel_21, ui->cswlabel_22, ui->cswlabel_23, ui->cswlabel_24,
- ui->cswlabel_25, ui->cswlabel_26, ui->cswlabel_27, ui->cswlabel_28,
- ui->cswlabel_29, ui->cswlabel_30, ui->cswlabel_31, ui->cswlabel_32};
-
- memcpy(csw, tmpcsw, sizeof(csw));
- int num_csw=GetEepromInterface()->getCapability(CustomSwitches);
- for(int i=0; i<16; i++) {
- if (isetProperty("index",i);
- cswitchSource1[i] = new QComboBox(this);
- cswitchSource1[i]->setProperty("index",i);
- connect(cswitchSource1[i],SIGNAL(currentIndexChanged(int)),this,SLOT(customSwitchesEdited()));
- ui->gridLayout_21->addWidget(cswitchSource1[i],i+1,2);
- cswitchSource1[i]->setVisible(false);
- cswitchValue[i] = new QDoubleSpinBox(this);
- cswitchValue[i]->setMaximum(125);
- cswitchValue[i]->setMinimum(-125);
- cswitchValue[i]->setAccelerated(true);
- cswitchValue[i]->setDecimals(0);
- cswitchValue[i]->setProperty("index",i);
- connect(cswitchValue[i],SIGNAL(editingFinished()),this,SLOT(customSwitchesEdited()));
- ui->gridLayout_21->addWidget(cswitchValue[i],i+1,2);
- cswitchValue[i]->setVisible(false);
-
- cswitchSource2[i] = new QComboBox(this);
- cswitchSource2[i]->setProperty("index",i);
- connect(cswitchSource2[i],SIGNAL(currentIndexChanged(int)),this,SLOT(customSwitchesEdited()));
- ui->gridLayout_21->addWidget(cswitchSource2[i],i+1,3);
- cswitchSource2[i]->setVisible(false);
-
- cswitchOffset[i] = new QDoubleSpinBox(this);
- cswitchOffset[i]->setProperty("index",i);
- cswitchOffset[i]->setMaximum(125);
- cswitchOffset[i]->setMinimum(-125);
- cswitchOffset[i]->setAccelerated(true);
- cswitchOffset[i]->setDecimals(0);
- connect(cswitchOffset[i],SIGNAL(editingFinished()),this,SLOT(customSwitchesEdited()));
- ui->gridLayout_21->addWidget(cswitchOffset[i],i+1,3);
- cswitchOffset[i]->setVisible(false);
- cswitchAnd[i] = new QComboBox(this);
- cswitchAnd[i]->setProperty("index",i);
- connect(cswitchAnd[i],SIGNAL(currentIndexChanged(int)),this,SLOT(customSwitchesEdited()));
- ui->gridLayout_21->addWidget(cswitchAnd[i],i+1,4);
- cswitchAnd[i]->setVisible(false);
- if (GetEepromInterface()->getCapability(CustomSwitchesExt)) {
- cswitchDuration[i] = new QDoubleSpinBox(this);
- cswitchDuration[i]->setProperty("index",i);
- cswitchDuration[i]->setSingleStep(0.5);
- cswitchDuration[i]->setMaximum(50);
- cswitchDuration[i]->setMinimum(0);
- cswitchDuration[i]->setAccelerated(true);
- cswitchDuration[i]->setDecimals(1);
- connect(cswitchDuration[i],SIGNAL(editingFinished()),this,SLOT(customSwitchesEdited()));
- ui->gridLayout_21->addWidget(cswitchDuration[i],i+1,5);
- cswitchDuration[i]->setVisible(false);
-
- cswitchDelay[i] = new QDoubleSpinBox(this);
- cswitchDelay[i]->setProperty("index",i);
- cswitchDelay[i]->setSingleStep(0.5);
- cswitchDelay[i]->setMaximum(50);
- cswitchDelay[i]->setMinimum(0);
- cswitchDelay[i]->setAccelerated(true);
- cswitchDelay[i]->setDecimals(1);
- connect(cswitchDelay[i],SIGNAL(editingFinished()),this,SLOT(customSwitchesEdited()));
- ui->gridLayout_21->addWidget(cswitchDelay[i],i+1,6);
- cswitchDelay[i]->setVisible(false);
- } else {
- ui->cswCol3->hide();
- ui->cswCol4->hide();
- }
- connect(cswlabel[i],SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(csw_customContextMenuRequested(QPoint)));
- } else {
- csw[i]->hide();
- cswlabel[i]->hide();
- }
- }
- if (num_csw>16) {
- for(int i=16; i<32; i++) {
- if (i<=num_csw) {
- tmpcsw[i]->setProperty("index",i);
- cswitchSource1[i] = new QComboBox(this);
- cswitchSource1[i]->setProperty("index",i);
- connect(cswitchSource1[i],SIGNAL(currentIndexChanged(int)),this,SLOT(customSwitchesEdited()));
- ui->gridLayout_22->addWidget(cswitchSource1[i],i-15,2);
- cswitchSource1[i]->setVisible(false);
- cswitchValue[i] = new QDoubleSpinBox(this);
- cswitchValue[i]->setProperty("index",i);
- cswitchValue[i]->setMaximum(125);
- cswitchValue[i]->setMinimum(-125);
- cswitchValue[i]->setAccelerated(true);
- cswitchValue[i]->setDecimals(0);
- connect(cswitchValue[i],SIGNAL(editingFinished()),this,SLOT(customSwitchesEdited()));
- ui->gridLayout_22->addWidget(cswitchValue[i],i-15,2);
- cswitchValue[i]->setVisible(false);
-
- cswitchSource2[i] = new QComboBox(this);
- cswitchSource2[i]->setProperty("index",i);
- connect(cswitchSource2[i],SIGNAL(currentIndexChanged(int)),this,SLOT(customSwitchesEdited()));
- ui->gridLayout_22->addWidget(cswitchSource2[i],i-15,3);
- cswitchSource2[i]->setVisible(false);
-
- cswitchOffset[i] = new QDoubleSpinBox(this);
- cswitchOffset[i]->setProperty("index",i);
- cswitchOffset[i]->setMaximum(125);
- cswitchOffset[i]->setMinimum(-125);
- cswitchOffset[i]->setAccelerated(true);
- cswitchOffset[i]->setDecimals(0);
- connect(cswitchOffset[i],SIGNAL(editingFinished()),this,SLOT(customSwitchesEdited()));
- ui->gridLayout_22->addWidget(cswitchOffset[i],i-15,3);
- cswitchOffset[i]->setVisible(false);
- cswitchAnd[i] = new QComboBox(this);
- cswitchAnd[i]->setProperty("index",i);
- connect(cswitchAnd[i],SIGNAL(currentIndexChanged(int)),this,SLOT(customSwitchesEdited()));
- ui->gridLayout_22->addWidget(cswitchAnd[i],i-15,4);
- cswitchAnd[i]->setVisible(false);
- if (GetEepromInterface()->getCapability(CustomSwitchesExt)) {
- cswitchDuration[i] = new QDoubleSpinBox(this);
- cswitchDuration[i]->setProperty("index",i);
- cswitchDuration[i]->setSingleStep(0.5);
- cswitchDuration[i]->setMaximum(50);
- cswitchDuration[i]->setMinimum(0);
- cswitchDuration[i]->setAccelerated(true);
- cswitchDuration[i]->setDecimals(1);
- connect(cswitchDuration[i],SIGNAL(editingFinished()),this,SLOT(customSwitchesEdited()));
- ui->gridLayout_22->addWidget(cswitchDuration[i],i-15,5);
- cswitchDuration[i]->setVisible(false);
-
- cswitchDelay[i] = new QDoubleSpinBox(this);
- cswitchDelay[i]->setProperty("index",i);
- cswitchDelay[i]->setSingleStep(0.5);
- cswitchDelay[i]->setMaximum(50);
- cswitchDelay[i]->setMinimum(0);
- cswitchDelay[i]->setAccelerated(true);
- cswitchDelay[i]->setDecimals(1);
- connect(cswitchDelay[i],SIGNAL(editingFinished()),this,SLOT(customSwitchesEdited()));
- ui->gridLayout_22->addWidget(cswitchDelay[i],i-15,6);
- cswitchDelay[i]->setVisible(false);
- } else {
- ui->cswCol3_2->hide();
- ui->cswCol4_2->hide();
- }
- connect(cswlabel[i],SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(csw_customContextMenuRequested(QPoint)));
- } else {
- csw[i]->hide();
- cswlabel[i]->hide();
- }
- }
- } else {
- ui->cswitchGB2->hide();
- }
- updateSwitchesTab();
- //connects
- for (int i=0; igetCapability(CustomFunctions);
-
- QStringList paramarmList;
- if (!GetEepromInterface()->getCapability(VoicesAsNumbers)) {
- for (int i=0; igetCapability(VoicesMaxLength)+4;
- if (qd.exists()) {
- QStringList filters;
- filters << "*.wav" << "*.WAV";
- foreach ( QString file, qd.entryList(filters, QDir::Files) ) {
- QFileInfo fi(file);
- QString temp=fi.completeBaseName();
- if (!paramarmList.contains(temp) && temp.length()<=vml) {
- paramarmList.append(temp);
- }
- }
- }
- }
-
- for (int i=0; i= 16 ? ui->fswitchlayout2 : ui->fswitchlayout1;
-
- fswLabel[i] = new QLabel(this);
- fswLabel[i]->setFrameStyle(QFrame::Panel | QFrame::Raised);
- fswLabel[i]->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Fixed);
- fswLabel[i]->setContextMenuPolicy(Qt::CustomContextMenu);
- fswLabel[i]->setMouseTracking(true);
- fswLabel[i]->setProperty("FunctionId", i+1);
- fswLabel[i]->setText(tr("CF%1").arg(i+1));
- layout->addWidget(fswLabel[i],(i%16)+1,0);
- connect(fswLabel[i],SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(fsw_customContextMenuRequested(QPoint)));
-
- fswtchSwtch[i] = new QComboBox(this);
- fswtchSwtch[i]->setProperty("functionIndex", i);
- connect(fswtchSwtch[i],SIGNAL(currentIndexChanged(int)),this,SLOT(customFunctionEdited()));
- layout->addWidget(fswtchSwtch[i],(i%16)+1,1);
- populateSwitchCB(fswtchSwtch[i], g_model.funcSw[i].swtch, POPULATE_MSWITCHES|POPULATE_ONOFF);
-
- fswtchFunc[i] = new QComboBox(this);
- fswtchFunc[i]->setProperty("functionIndex", i);
- connect(fswtchFunc[i],SIGNAL(currentIndexChanged(int)),this,SLOT(customFunctionEdited()));
- layout->addWidget(fswtchFunc[i],(i%16)+1,2);
- populateFuncCB(fswtchFunc[i], g_model.funcSw[i].func);
-
- QHBoxLayout *paramLayout = new QHBoxLayout();
- layout->addLayout(paramLayout, (i%16)+1, 3);
-
- fswtchGVmode[i] = new QComboBox(this);
- fswtchGVmode[i]->setProperty("functionIndex", i);
- connect(fswtchGVmode[i],SIGNAL(currentIndexChanged(int)),this,SLOT(customFunctionEdited()));
- paramLayout->addWidget(fswtchGVmode[i]);
- populateGVmodeCB(fswtchGVmode[i], g_model.funcSw[i].adjustMode);
-
- fswtchParamGV[i] = new QCheckBox(this);
- fswtchParamGV[i]->setProperty("functionIndex", i);
- fswtchParamGV[i]->setText("GV");
- fswtchParamGV[i]->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
- connect(fswtchParamGV[i],SIGNAL(stateChanged(int)),this,SLOT(customFunctionEdited()));
- paramLayout->addWidget(fswtchParamGV[i]);
-
- fswtchParam[i] = new QDoubleSpinBox(this);
- fswtchParam[i]->setProperty("functionIndex", i);
- fswtchParam[i]->setAccelerated(true);
- fswtchParam[i]->setDecimals(0);
- connect(fswtchParam[i],SIGNAL(editingFinished()),this,SLOT(customFunctionEdited()));
- paramLayout->addWidget(fswtchParam[i]);
-
- fswtchParamT[i] = new QComboBox(this);
- fswtchParamT[i]->setProperty("functionIndex", i);
- paramLayout->addWidget(fswtchParamT[i]);
- populateFuncParamCB(fswtchParamT[i], func, g_model.funcSw[i].param, g_model.funcSw[i].adjustMode);
- connect(fswtchParamT[i],SIGNAL(currentIndexChanged(int)),this,SLOT(customFunctionEdited()));
-
- fswtchParamArmT[i] = new QComboBox(this);
- fswtchParamArmT[i]->setProperty("functionIndex", i);
- populateFuncParamArmTCB(fswtchParamArmT[i],&g_model, g_model.funcSw[i].paramarm, paramarmList);
- fswtchParamArmT[i]->setEditable(true);
- paramLayout->addWidget(fswtchParamArmT[i]);
-
- connect(fswtchParamArmT[i],SIGNAL(currentIndexChanged(int)),this,SLOT(customFunctionEdited()));
- connect(fswtchParamArmT[i],SIGNAL(editTextChanged ( const QString)),this,SLOT(customFunctionEdited()));
-
-#ifdef PHONON
- playBT[i] = new QPushButton(this);
- playBT[i]->setObjectName(QString("play_%1").arg(i));
- playBT[i]->setIcon(QIcon(":/images/play.png"));
- paramLayout->addWidget(playBT[i]);
- connect(playBT[i],SIGNAL(pressed()),this,SLOT(playMusic()));
-#endif
-
- QHBoxLayout *repeatLayout = new QHBoxLayout();
- layout->addLayout(repeatLayout, (i%16)+1, 4);
-
- fswtchRepeat[i] = new QComboBox(this);
- fswtchRepeat[i]->setProperty("functionIndex", i);
- connect(fswtchRepeat[i],SIGNAL(currentIndexChanged(int)),this,SLOT(customFunctionEdited()));
- repeatLayout->addWidget(fswtchRepeat[i],(i%16)+1);
- populateRepeatCB(fswtchRepeat[i], g_model.funcSw[i].repeatParam);
-
- fswtchEnable[i] = new QCheckBox(this);
- fswtchEnable[i]->setProperty("functionIndex", i);
- fswtchEnable[i]->setText(tr("ON"));
- repeatLayout->addWidget(fswtchEnable[i],(i%16)+1);
- fswtchEnable[i]->setChecked(g_model.funcSw[i].enabled);
- connect(fswtchEnable[i],SIGNAL(stateChanged(int)),this,SLOT(customFunctionEdited()));
-
- refreshCustomFunction(i);
- }
-
- if (num_fsw <= 16) {
- ui->FSwitchGB2->hide();
- }
-
- switchEditLock = false;
-}
-
-void ModelEdit::tabSafetySwitches()
-{
- for(int i=0; igrid_tabSafetySwitches->addWidget(safetySwitchSwtch[i],i+1,1);
- connect(safetySwitchSwtch[i],SIGNAL(currentIndexChanged(int)),this,SLOT(safetySwitchesEdited()));
-
- safetySwitchValue[i] = new QSpinBox(this);
- safetySwitchValue[i]->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
- safetySwitchValue[i]->setMaximum(125);
- safetySwitchValue[i]->setMinimum(-125);
- safetySwitchValue[i]->setAccelerated(true);
- safetySwitchValue[i]->setValue(g_model.safetySw[i].val);
- ui->grid_tabSafetySwitches->addWidget(safetySwitchValue[i],i+1,2);
- connect(safetySwitchValue[i],SIGNAL(editingFinished()),this,SLOT(safetySwitchesEdited()));
- }
-}
-
-void ModelEdit::customFieldEdited()
-{
- if (telemetryLock) return;
- int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
- if (cols==0) cols=2;
-
- for (int i=0; igetCapability(TelemetryCSFields); i++) {
- int screen=i/(4*cols);
- int r=((i%(4*cols))%4);
- int c=((i%(4*cols))/4);
- if (g_model.frsky.screens[screen].type==0) {
- g_model.frsky.screens[screen].body.lines[r].source[c]=csf[i]->currentIndex();
- }
- }
- updateSettings();
-}
-
-void ModelEdit::customSwitchesEdited()
-{
- if(switchEditLock) return;
-
- switchEditLock = true;
- int i=-1;
- QString indextext=sender()->property("index").toString();
- if (!indextext.isEmpty()) {
- i=indextext.toInt();
- } else {
- // should not happen
- switchEditLock = false;
- return;
- }
- bool chAr;
- float value, step;
- int newval;
- chAr = (getCSFunctionFamily(g_model.customSw[i].func) != getCSFunctionFamily(csw[i]->itemData(csw[i]->currentIndex()).toInt()));
- g_model.customSw[i].func = csw[i]->itemData(csw[i]->currentIndex()).toInt();
- if(chAr) {
- if (getCSFunctionFamily(g_model.customSw[i].func)==CS_FAMILY_TIMERS) {
- g_model.customSw[i].val1 = -119;
- g_model.customSw[i].val2 = -119;
- } else {
- g_model.customSw[i].val1 = 0;
- g_model.customSw[i].val2 = 0;
- }
- g_model.customSw[i].andsw = 0;
- setSwitchWidgetVisibility(i);
- }
- if (GetEepromInterface()->getCapability(CustomSwitchesExt)) {
- g_model.customSw[i].duration= (uint8_t)round(cswitchDuration[i]->value()*2);
- g_model.customSw[i].delay= (uint8_t)round(cswitchDelay[i]->value()*2);
- }
- RawSource source;
- switch (getCSFunctionFamily(g_model.customSw[i].func))
- {
- case (CS_FAMILY_VOFS):
- if (g_model.customSw[i].val1 != cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt()) {
- source=RawSource(g_model.customSw[i].val1);
- g_model.customSw[i].val1 = cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt();
- RawSource newSource = RawSource(g_model.customSw[i].val1);
- if (newSource.type == SOURCE_TYPE_TELEMETRY) {
- if (g_model.customSw[i].func>CS_FN_ELESS && g_model.customSw[i].funcCS_FN_ELESS && g_model.customSw[i].funcvalue()/source.getStep(g_model));
- } else {
- g_model.customSw[i].val2 = ((cswitchOffset[i]->value()-source.getOffset(g_model))/source.getStep(g_model))-source.getRawOffset(g_model);
- }
- }
- setSwitchWidgetVisibility(i);
- } else {
- source=RawSource(g_model.customSw[i].val1);
- if (g_model.customSw[i].func>CS_FN_ELESS && g_model.customSw[i].funcvalue()/source.getStep(g_model));
- cswitchOffset[i]->setValue(g_model.customSw[i].val2*source.getStep(g_model));
- } else {
- g_model.customSw[i].val2 = ((cswitchOffset[i]->value()-source.getOffset(g_model))/source.getStep(g_model))-source.getRawOffset(g_model);
- cswitchOffset[i]->setValue((g_model.customSw[i].val2 +source.getRawOffset(g_model))*source.getStep(g_model)+source.getOffset(g_model));
- }
- }
- break;
- case (CS_FAMILY_TIMERS): {
- value=cswitchOffset[i]->value();
- newval=TimToVal(value);
- if (newval>g_model.customSw[i].val2) {
- if (value >=60) {
- value=round(value);
- step=1;
- } else if (value>=2) {
- value=(round(value*2.0)/2);
- step=0.5;
- } else {
- step=0.1;
- }
- } else {
- if (value <=2) {
- step=0.1;
- } else if (value<=60) {
- value=(round(value*2.0)/2);
- step=0.5;
- } else {
- value=round(value);
- step=1;
- }
- }
- g_model.customSw[i].val2=TimToVal(value);
- value=ValToTim(g_model.customSw[i].val2);
- cswitchOffset[i]->setValue(value);
- cswitchOffset[i]->setSingleStep(step);
-
- value=cswitchValue[i]->value();
- newval=TimToVal(value);
- if (newval>g_model.customSw[i].val1) {
- if (value >=60) {
- value=round(value);
- step=1;
- } else if (value>=2) {
- value=(round(value*2.0)/2);
- step=0.5;
- } else {
- step=0.1;
- }
- } else {
- if (value <=2) {
- step=0.1;
- } else if (value<=60) {
- value=(round(value*2.0)/2);
- step=0.5;
- } else {
- value=round(value);
- step=1;
- }
- }
- g_model.customSw[i].val1=TimToVal(value);
- value=ValToTim(g_model.customSw[i].val1);
- cswitchValue[i]->setValue(value);
- cswitchValue[i]->setSingleStep(step);
- break;
- }
- case (CS_FAMILY_VBOOL):
- case (CS_FAMILY_VCOMP):
- g_model.customSw[i].val1 = cswitchSource1[i]->itemData(cswitchSource1[i]->currentIndex()).toInt();
- g_model.customSw[i].val2 = cswitchSource2[i]->itemData(cswitchSource2[i]->currentIndex()).toInt();
- break;
- }
- g_model.customSw[i].andsw = cswitchAnd[i]->itemData(cswitchAnd[i]->currentIndex()).toInt();
- updateSettings();
- switchEditLock = false;
-}
-
-#ifdef PHONON
-
-void ModelEdit::mediaPlayer_state(Phonon::State newState, Phonon::State oldState)
-{
- if (phononLock)
- return;
- phononLock=true;
- if ((newState==Phonon::StoppedState || newState==Phonon::PausedState) && oldState==Phonon::PlayingState) {
- clickObject->stop();
- clickObject->clearQueue();
- clickObject->clear();
- for (int i=0; igetCapability(CustomFunctions); i++) {
- playBT[i]->setObjectName(QString("play_%1").arg(i));
- playBT[i]->setIcon(QIcon(":/images/play.png"));
- }
- }
- if (newState==Phonon::ErrorState) {
- clickObject->stop();
- clickObject->clearQueue();
- clickObject->clear();
- for (int i=0; igetCapability(CustomFunctions); i++) {
- playBT[i]->setObjectName(QString("play_%1").arg(i));
- playBT[i]->setIcon(QIcon(":/images/play.png"));
- }
- }
-
- phononLock=false;
-}
-#endif
-
-void ModelEdit::playMusic()
-{
- QPushButton *playButton = qobject_cast(sender());
- int index=playButton->objectName().mid(5,2).toInt();
- QString function=playButton->objectName().left(4);
- QSettings settings("companion9x", "companion9x");
- QString path=settings.value("sdPath", ".").toString();
- QDir qd(path);
- QString track;
- if (qd.exists()) {
- if (GetEepromInterface()->getCapability(VoicesAsNumbers)) {
- track=path+QString("/%1.wav").arg(int(fswtchParam[index]->value()),4,10,(const QChar)'0');
- } else {
- path.append("/SOUNDS/");
- QString lang=radioData.generalSettings.ttsLanguage;
- if (lang.isEmpty())
- lang="en";
- path.append(lang);
- if (fswtchParamArmT[index]->currentText()!="----") {
- track=path+"/"+fswtchParamArmT[index]->currentText()+".wav";
- }
- }
- QFile file(track);
- if (!file.exists()) {
- QMessageBox::critical(this, tr("Error"), tr("Unable to find sound file %1!").arg(track));
- track.clear();
- }
-#ifdef PHONON
- if (function=="play" && !track.isEmpty()) {
- clickObject->clear();
- clickObject->setCurrentSource(Phonon::MediaSource(track));
- clickObject->play();
- playBT[index]->setObjectName(QString("stop_%1").arg(index));
- playBT[index]->setIcon(QIcon(":/images/stop.png"));
- } else {
- clickObject->stop();
- clickObject->clear();
- playBT[index]->setObjectName(QString("play_%1").arg(index));
- playBT[index]->setIcon(QIcon(":/images/play.png"));
- }
-#endif
- }
-}
-
-#define CUSTOM_FUNCTION_NUMERIC_PARAM (1<<0)
-#define CUSTOM_FUNCTION_SOURCE_PARAM (1<<1)
-#define CUSTOM_FUNCTION_FILE_PARAM (1<<2)
-#define CUSTOM_FUNCTION_GV_MODE (1<<3)
-#define CUSTOM_FUNCTION_GV_TOOGLE (1<<4)
-#define CUSTOM_FUNCTION_ENABLE (1<<5)
-#define CUSTOM_FUNCTION_REPEAT (1<<6)
-#define CUSTOM_FUNCTION_PLAY (1<<7)
-
-void ModelEdit::customFunctionEdited()
-{
- if (switchEditLock) return;
- switchEditLock = true;
-
- int index = sender()->property("functionIndex").toInt();
- refreshCustomFunction(index, true);
-
- updateSettings();
- switchEditLock = false;
-}
-
-void ModelEdit::refreshCustomFunction(int i, bool modified)
-{
- unsigned int widgetsMask = 0;
- if (modified) {
- g_model.funcSw[i].swtch = RawSwitch(fswtchSwtch[i]->itemData(fswtchSwtch[i]->currentIndex()).toInt());
- g_model.funcSw[i].func = (AssignFunc)fswtchFunc[i]->currentIndex();
- g_model.funcSw[i].enabled =fswtchEnable[i]->isChecked();
- g_model.funcSw[i].repeatParam = (AssignFunc)fswtchRepeat[i]->currentIndex();
- g_model.funcSw[i].adjustMode = (AssignFunc)fswtchGVmode[i]->currentIndex();
- }
-
- int index = fswtchFunc[i]->currentIndex();
-
- if (index>=FuncSafetyCh1 && index<=FuncSafetyCh16) {
- fswtchParam[i]->setDecimals(0);
- fswtchParam[i]->setSingleStep(1);
- fswtchParam[i]->setMinimum(-125);
- fswtchParam[i]->setMaximum(125);
- if (modified) {
- g_model.funcSw[i].param = fswtchParam[i]->value();
- }
- fswtchParam[i]->setValue(g_model.funcSw[i].param);
- widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM + CUSTOM_FUNCTION_ENABLE;
- } else if (index==FuncLogs) {
- fswtchParam[i]->setDecimals(1);
- fswtchParam[i]->setMinimum(0);
- fswtchParam[i]->setMaximum(25.5);
- fswtchParam[i]->setSingleStep(0.1);
- if (modified) g_model.funcSw[i].param = fswtchParam[i]->value()*10.0;
- fswtchParam[i]->setValue(g_model.funcSw[i].param/10.0);
- widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM + CUSTOM_FUNCTION_ENABLE;
- } else if (index>=FuncAdjustGV1 && index<=FuncAdjustGV5) {
- if (modified) g_model.funcSw[i].adjustMode = fswtchGVmode[i]->currentIndex();
- widgetsMask |= CUSTOM_FUNCTION_GV_MODE + CUSTOM_FUNCTION_ENABLE;
- if (g_model.funcSw[i].adjustMode==0) {
- if (modified) g_model.funcSw[i].param = fswtchParam[i]->value();
- fswtchParam[i]->setDecimals(0);
- fswtchParam[i]->setSingleStep(1);
- fswtchParam[i]->setMinimum(-125);
- fswtchParam[i]->setMaximum(125);
- fswtchParam[i]->setValue(g_model.funcSw[i].param);
- widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM;
- } else {
- if (modified) g_model.funcSw[i].param = fswtchParamT[i]->itemData(fswtchParamT[i]->currentIndex()).toInt();
- populateFuncParamCB(fswtchParamT[i], index, g_model.funcSw[i].param, g_model.funcSw[i].adjustMode);
- widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM;
- }
- } else if (index==FuncReset) {
- if (modified) g_model.funcSw[i].param = (uint8_t)fswtchParamT[i]->currentIndex();
- populateFuncParamCB(fswtchParamT[i], index, g_model.funcSw[i].param);
- widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM;
- } else if (index==FuncVolume) {
- if (modified) g_model.funcSw[i].param = fswtchParamT[i]->itemData(fswtchParamT[i]->currentIndex()).toInt();
- populateFuncParamCB(fswtchParamT[i], index, g_model.funcSw[i].param);
- widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM + CUSTOM_FUNCTION_ENABLE;
- } else if (index==FuncPlaySound || index==FuncPlayHaptic || index==FuncPlayValue || index==FuncPlayPrompt || index==FuncPlayBoth || index==FuncBackgroundMusic) {
- if (modified) g_model.funcSw[i].repeatParam = fswtchRepeat[i]->itemData(fswtchRepeat[i]->currentIndex()).toInt();
- if (index != FuncBackgroundMusic) {
- if (GetEepromInterface()->getCapability(HasFuncRepeat)) {
- widgetsMask |= CUSTOM_FUNCTION_REPEAT;
- }
- }
- if (index==FuncPlayValue) {
- if (modified) g_model.funcSw[i].param = fswtchParamT[i]->itemData(fswtchParamT[i]->currentIndex()).toInt();
- populateFuncParamCB(fswtchParamT[i], index, g_model.funcSw[i].param);
- widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM + CUSTOM_FUNCTION_REPEAT;
- } else if (index==FuncPlayPrompt || index==FuncPlayBoth) {
- if (GetEepromInterface()->getCapability(VoicesAsNumbers)) {
- fswtchParam[i]->setDecimals(0);
- fswtchParam[i]->setSingleStep(1);
- fswtchParam[i]->setMinimum(0);
- if (index==FuncPlayPrompt) {
- widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM + CUSTOM_FUNCTION_REPEAT + CUSTOM_FUNCTION_GV_TOOGLE;
- } else {
- widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM + CUSTOM_FUNCTION_REPEAT;
- fswtchParamGV[i]->setChecked(false);
- }
- fswtchParam[i]->setMaximum(index==FuncPlayBoth ? 254 : 255);
- if (modified) {
- if (fswtchParamGV[i]->isChecked()) {
- fswtchParam[i]->setMinimum(1);
- g_model.funcSw[i].param = std::min(fswtchParam[i]->value(),5.0)+(fswtchParamGV[i]->isChecked() ? 250 : 0);
- } else {
- g_model.funcSw[i].param = fswtchParam[i]->value();
- }
- }
- if (g_model.funcSw[i].param>250 && (index!=FuncPlayBoth)) {
- fswtchParamGV[i]->setChecked(true);
- fswtchParam[i]->setValue(g_model.funcSw[i].param-250);
- fswtchParam[i]->setMaximum(5);
- } else {
- fswtchParamGV[i]->setChecked(false);
- fswtchParam[i]->setValue(g_model.funcSw[i].param);
- }
- if (g_model.funcSw[i].param < 251)
- widgetsMask |= CUSTOM_FUNCTION_PLAY;
- } else {
- widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
- if (modified) {
- memset(g_model.funcSw[i].paramarm, 0, sizeof(g_model.funcSw[i].paramarm));
- int vml=GetEepromInterface()->getCapability(VoicesMaxLength);
- if (fswtchParamArmT[i]->currentText() != "----") {
- widgetsMask |= CUSTOM_FUNCTION_PLAY;
- for (int j=0; jcurrentText().length(),vml); j++) {
- g_model.funcSw[i].paramarm[j] = fswtchParamArmT[i]->currentText().toAscii().at(j);
- }
- }
- }
- }
- } else if (index==FuncBackgroundMusic) {
- widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
- if (modified) {
- memset(g_model.funcSw[i].paramarm, 0, sizeof(g_model.funcSw[i].paramarm));
- int vml=GetEepromInterface()->getCapability(VoicesMaxLength);
- if (fswtchParamArmT[i]->currentText() != "----") {
- widgetsMask |= CUSTOM_FUNCTION_PLAY;
- for (int j=0; jcurrentText().length(),vml); j++) {
- g_model.funcSw[i].paramarm[j] = fswtchParamArmT[i]->currentText().toAscii().at(j);
- }
- }
- }
- } else if (index==FuncPlaySound) {
- if (modified) g_model.funcSw[i].param = (uint8_t)fswtchParamT[i]->currentIndex();
- populateFuncParamCB(fswtchParamT[i], index, g_model.funcSw[i].param);
- widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM;
- } else if (index==FuncPlayHaptic) {
- if (modified) g_model.funcSw[i].param = (uint8_t)fswtchParamT[i]->currentIndex();
- populateFuncParamCB(fswtchParamT[i], index, g_model.funcSw[i].param);
- widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM;
- }
- } else if (g_model.funcSw[i].swtch.type!=SWITCH_TYPE_NONE) {
- if (modified) g_model.funcSw[i].param = fswtchParam[i]->value();
- fswtchParam[i]->setDecimals(0);
- fswtchParam[i]->setSingleStep(1);
- fswtchParam[i]->setValue(g_model.funcSw[i].param);
- if (index<=FuncInstantTrim) {
- widgetsMask |= CUSTOM_FUNCTION_ENABLE;
- }
- }
-
- fswtchParam[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_NUMERIC_PARAM);
- fswtchParamGV[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_GV_TOOGLE);
- fswtchParamT[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_SOURCE_PARAM);
- fswtchParamArmT[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_FILE_PARAM);
- fswtchEnable[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_ENABLE);
- if (!(widgetsMask & CUSTOM_FUNCTION_ENABLE)) fswtchEnable[i]->setChecked(false);
- fswtchRepeat[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_REPEAT);
- fswtchGVmode[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_GV_MODE);
-#ifdef PHONON
- playBT[i]->setVisible(widgetsMask & CUSTOM_FUNCTION_PLAY);
-#endif
-}
-
-void ModelEdit::tabTelemetry()
-{
- QSettings settings("companion9x", "companion9x");
- QString firmware_id = settings.value("firmware", default_firmware_variant.id).toString();
- float a1ratio;
- float a2ratio;
-
- QGroupBox* barsgb[3] = { ui->CS1Bars, ui->CS2Bars, ui->CS3Bars };
- QGroupBox* numsgb[3] = { ui->CS1Nums, ui->CS2Nums, ui->CS3Nums };
-
- QComboBox* barscb[12] = { ui->telBarCS1B1_CB, ui->telBarCS1B2_CB, ui->telBarCS1B3_CB, ui->telBarCS1B4_CB,
- ui->telBarCS2B1_CB, ui->telBarCS2B2_CB, ui->telBarCS2B3_CB, ui->telBarCS2B4_CB,
- ui->telBarCS3B1_CB, ui->telBarCS3B2_CB, ui->telBarCS3B3_CB, ui->telBarCS3B4_CB};
- QDoubleSpinBox* minsb[12] = { ui->telMinCS1SB1, ui->telMinCS1SB2, ui->telMinCS1SB3, ui->telMinCS1SB4,
- ui->telMinCS2SB1, ui->telMinCS2SB2, ui->telMinCS2SB3, ui->telMinCS2SB4,
- ui->telMinCS3SB1, ui->telMinCS3SB2, ui->telMinCS3SB3, ui->telMinCS3SB4};
- QDoubleSpinBox* maxsb[12] = { ui->telMaxCS1SB1, ui->telMaxCS1SB2, ui->telMaxCS1SB3, ui->telMaxCS1SB4,
- ui->telMaxCS2SB1, ui->telMaxCS2SB2, ui->telMaxCS2SB3, ui->telMaxCS2SB4,
- ui->telMaxCS3SB1, ui->telMaxCS3SB2, ui->telMaxCS3SB3, ui->telMaxCS3SB4};
- QComboBox* tmp[36] = { ui->telemetryCS1F1_CB, ui->telemetryCS1F2_CB, ui->telemetryCS1F3_CB, ui->telemetryCS1F4_CB, ui->telemetryCS1F5_CB, ui->telemetryCS1F6_CB, ui->telemetryCS1F7_CB, ui->telemetryCS1F8_CB, ui->telemetryCS1F9_CB, ui->telemetryCS1F10_CB, ui->telemetryCS1F11_CB, ui->telemetryCS1F12_CB,
- ui->telemetryCS2F1_CB, ui->telemetryCS2F2_CB, ui->telemetryCS2F3_CB, ui->telemetryCS2F4_CB, ui->telemetryCS2F5_CB, ui->telemetryCS2F6_CB, ui->telemetryCS2F7_CB, ui->telemetryCS2F8_CB, ui->telemetryCS2F9_CB, ui->telemetryCS2F10_CB, ui->telemetryCS2F11_CB, ui->telemetryCS2F12_CB,
- ui->telemetryCS3F1_CB, ui->telemetryCS3F2_CB, ui->telemetryCS3F3_CB, ui->telemetryCS3F4_CB, ui->telemetryCS3F5_CB, ui->telemetryCS3F6_CB, ui->telemetryCS3F7_CB, ui->telemetryCS3F8_CB, ui->telemetryCS3F9_CB, ui->telemetryCS3F10_CB, ui->telemetryCS3F11_CB, ui->telemetryCS3F12_CB};
-
- memcpy(barsGB, barsgb, sizeof(barsGB));
- memcpy(numsGB, numsgb, sizeof(numsGB));
- memcpy(barsCB, barscb, sizeof(barsCB));
- memcpy(maxSB, maxsb, sizeof(maxSB));
- memcpy(minSB, minsb, sizeof(minSB));
- memcpy(csf, tmp, sizeof(csf));
-
- telemetryLock=true;
- ui->telemetryCSType1->setCurrentIndex(g_model.frsky.screens[0].type);
- ui->telemetryCSType2->setCurrentIndex(g_model.frsky.screens[1].type);
- ui->telemetryCSType3->setCurrentIndex(g_model.frsky.screens[2].type);
-
- for (int i=0; i<3; i++) {
- bool isNum = (g_model.frsky.screens[i].type==0);
- barsGB[i]->setVisible(!isNum);
- numsGB[i]->setVisible(isNum);
- }
-
- connect(ui->telemetryCSType1,SIGNAL(currentIndexChanged(int)),this,SLOT(ScreenTypeCBcurrentIndexChanged(int)));
- connect(ui->telemetryCSType2,SIGNAL(currentIndexChanged(int)),this,SLOT(ScreenTypeCBcurrentIndexChanged(int)));
- connect(ui->telemetryCSType3,SIGNAL(currentIndexChanged(int)),this,SLOT(ScreenTypeCBcurrentIndexChanged(int)));
-
- //frsky Settings
- if (!GetEepromInterface()->getCapability(TelemetryRSSIModel) ) {
- ui->RSSIGB->hide();
- }
- ui->rssiAlarm1SB->setValue(g_model.frsky.rssiAlarms[0].value);
- ui->rssiAlarm2SB->setValue(g_model.frsky.rssiAlarms[1].value);
- ui->rssiAlarm1CB->setCurrentIndex(g_model.frsky.rssiAlarms[0].level);
- ui->rssiAlarm2CB->setCurrentIndex(g_model.frsky.rssiAlarms[1].level);
-
- if (!GetEepromInterface()->getCapability(HasAltitudeSel)) {
- ui->AltitudeGPS_ChkB->hide();
- } else {
- ui->AltitudeGPS_ChkB->setChecked(g_model.frsky.FrSkyGpsAlt);
- }
- int varioCap=GetEepromInterface()->getCapability(HasVario);
- // if (IS_TARANIS(GetEepromInterface()->getBoard())) {
- if (false) {
- ui->AltitudeToolbar_ChkB->setChecked(g_model.frsky.altitudeDisplayed);
- } else {
- ui->AltitudeToolbar_ChkB->hide();
- }
- if (!varioCap) {
- ui->varioLimitMax_DSB->hide();
- ui->varioLimitMinOff_ChkB->hide();
- ui->varioLimitMin_DSB->hide();
- ui->varioLimitCenterMin_DSB->hide();
- ui->varioLimitCenterMax_DSB->hide();
- ui->varioLimit_label->hide();
- ui->VarioLabel_1->hide();
- ui->VarioLabel_2->hide();
- ui->VarioLabel_3->hide();
- ui->VarioLabel_4->hide();
- ui->varioSourceCB->hide();
- ui->varioSource_label->hide();
- } else {
- if (!GetEepromInterface()->getCapability(HasVarioSink)) {
- ui->varioLimitMinOff_ChkB->hide();
- ui->varioLimitMin_DSB->hide();
- ui->varioLimitCenterMin_DSB->hide();
- ui->VarioLabel_1->hide();
- ui->VarioLabel_2->hide();
- }
- ui->varioLimitMin_DSB->setValue(g_model.frsky.varioMin-10);
- ui->varioLimitMax_DSB->setValue(g_model.frsky.varioMax+10);
- ui->varioLimitCenterMax_DSB->setValue((g_model.frsky.varioCenterMax/10.0)+0.5);
- ui->varioSourceCB->setCurrentIndex(g_model.frsky.varioSource);
- if (g_model.frsky.varioCenterMin==-16) {
- ui->varioLimitMinOff_ChkB->setChecked(true);
- ui->varioLimitCenterMin_DSB->setValue(-2.0);
- ui->varioLimitCenterMin_DSB->setDisabled(true);
- } else {
- ui->varioLimitMinOff_ChkB->setChecked(false);
- ui->varioLimitCenterMin_DSB->setValue((g_model.frsky.varioCenterMin/10.0)-0.5);
- }
- int mask=1;
- for (int i=0; i< ui->varioSourceCB->count(); i++) {
- if (!(varioCap&mask)) {
- QModelIndex index = ui->varioSourceCB->model()->index(i, 0);
- QVariant v(0);
- ui->varioSourceCB->model()->setData(index, v, Qt::UserRole - 1);
- }
- mask <<=1;
- }
- }
-
- if (!(GetEepromInterface()->getCapability(HasAltitudeSel)||GetEepromInterface()->getCapability(HasVario))) {
- ui->altimetryGB->hide();
- }
- if (GetEepromInterface()->getCapability(NoTelemetryProtocol)) {
- g_model.frsky.usrProto=1;
- ui->frskyProtoCB->setDisabled(true);
- } else {
- ui->frskyProtoCB->setEnabled(true);
- }
-
- if (GetEepromInterface()->getCapability(TelemetryCSFields)==0) {
- ui->groupBox_5->hide();
- } else {
- if (GetEepromInterface()->getCapability(TelemetryCSFields)==8) {
- ui->tabCsView->removeTab(1);
- ui->tabCsView->removeTab(2);
- }
- if (GetEepromInterface()->getCapability(TelemetryCSFields)==16) {
- ui->tabCsView->removeTab(2);
- }
- int cols=GetEepromInterface()->getCapability(TelemetryColsCSFields);
- if (cols==0) cols=2;
- for (int screen=0; screen<(GetEepromInterface()->getCapability(TelemetryCSFields)/(4*cols)); screen++) {
- for (int c=0; chide();
- }
- }
- }
- }
-
- if (!GetEepromInterface()->getCapability(TelemetryUnits)) {
- ui->frskyUnitsCB->setDisabled(true);
- int index=0;
- if (firmware_id.contains("imperial")) {
- index=1;
- }
- ui->frskyUnitsCB->setCurrentIndex(index);
- }
- if ((GetEepromInterface()->getCapability(Telemetry)&TM_HASWSHH)) {
- ui->frskyProtoCB->addItem(tr("Winged Shadow How High"));
- } else {
- ui->frskyProtoCB->addItem(tr("Winged Shadow How High (not supported)"));
- }
- ui->a1UnitCB->setCurrentIndex(g_model.frsky.channels[0].type);
- if (g_model.frsky.channels[0].type==0 || g_model.frsky.channels[0].type==1 || g_model.frsky.channels[0].type==2) {
- a1ratio=(g_model.frsky.channels[0].ratio<a1RatioSB->setDecimals(1);
- ui->a1RatioSB->setMaximum(25.5*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
- } else {
- a1ratio=g_model.frsky.channels[0].ratio<a1RatioSB->setDecimals(0);
- ui->a1RatioSB->setMaximum(255*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
- }
- ui->a1RatioSB->setValue(a1ratio);
-
- updateA1Fields();
-
- if (g_model.frsky.channels[1].type==0 || g_model.frsky.channels[1].type==1 || g_model.frsky.channels[1].type==2) {
- a2ratio=(g_model.frsky.channels[1].ratio<a2RatioSB->setDecimals(1);
- ui->a2RatioSB->setMaximum(25.5*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
- } else {
- a2ratio=g_model.frsky.channels[1].ratio<a2RatioSB->setDecimals(0);
- ui->a2RatioSB->setMaximum(255*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
- }
- ui->a2RatioSB->setValue(a2ratio);
- updateA2Fields();
-
- ui->a11LevelCB->setCurrentIndex(g_model.frsky.channels[0].alarms[0].level);
- ui->a11GreaterCB->setCurrentIndex(g_model.frsky.channels[0].alarms[0].greater);
- ui->a12LevelCB->setCurrentIndex(g_model.frsky.channels[0].alarms[1].level);
- ui->a12GreaterCB->setCurrentIndex(g_model.frsky.channels[0].alarms[1].greater);
- ui->a2UnitCB->setCurrentIndex(g_model.frsky.channels[1].type);
- ui->a21LevelCB->setCurrentIndex(g_model.frsky.channels[1].alarms[0].level);
- ui->a21GreaterCB->setCurrentIndex(g_model.frsky.channels[1].alarms[0].greater);
- ui->a22LevelCB->setCurrentIndex(g_model.frsky.channels[1].alarms[1].level);
- ui->a22GreaterCB->setCurrentIndex(g_model.frsky.channels[1].alarms[1].greater);
- if (!(GetEepromInterface()->getCapability(Telemetry)&TM_HASOFFSET)) {
- ui->a1CalibSB->hide();
- ui->a2CalibSB->hide();
- ui->a1CalibLabel->hide();
- ui->a2CalibLabel->hide();
- } else {
- ui->label_A1Max->setText(tr("Range"));
- ui->label_A2Max->setText(tr("Range"));
- }
- ui->frskyProtoCB->setCurrentIndex(g_model.frsky.usrProto);
- ui->frskyUnitsCB->setCurrentIndex(g_model.frsky.imperial);
- ui->frskyBladesCB->setCurrentIndex(g_model.frsky.blades);
- ui->frskyCurrentCB->setCurrentIndex(g_model.frsky.currentSource);
- ui->frskyVoltCB->setCurrentIndex(g_model.frsky.voltsSource);
-
- for (int screen=0; screen<2;screen++) {
- for (int rows=0; rows<4; rows++) {
- for (int cols=0; cols<3; cols++) {
- int index=screen*12+cols*4+rows;
- populateCustomScreenFieldCB(csf[index], g_model.frsky.screens[screen].body.lines[rows].source[cols], (rows<4), g_model.frsky.usrProto);
- }
- }
- }
-
- for (int j=0; j<12; j++) {
- int screen = j/4;
- int field = j%4;
- populateCustomScreenFieldCB(barsCB[j], g_model.frsky.screens[screen].body.bars[field].source, false, g_model.frsky.usrProto);
- switch (g_model.frsky.screens[screen].body.bars[field].source-1) {
- case TELEMETRY_SOURCE_TX_BATT:
- case TELEMETRY_SOURCE_A1:
- case TELEMETRY_SOURCE_A1_MIN:
- case TELEMETRY_SOURCE_A2:
- case TELEMETRY_SOURCE_A2_MIN:
- case TELEMETRY_SOURCE_CELLS_SUM:
- case TELEMETRY_SOURCE_VFAS:
- case TELEMETRY_SOURCE_CURRENT_MAX:
- case TELEMETRY_SOURCE_CURRENT:
- minsb[j]->setDecimals(1);
- maxsb[j]->setDecimals(1);
- break;
- case TELEMETRY_SOURCE_CELL:
- minsb[j]->setDecimals(2);
- maxsb[j]->setDecimals(2);
- break;
- default:
- minsb[j]->setDecimals(0);
- maxsb[j]->setDecimals(0);
- }
- minsb[j]->setMinimum(getBarValue(g_model.frsky.screens[screen].body.bars[field].source, 0, &g_model.frsky));
- minsb[j]->setMaximum(getBarValue(g_model.frsky.screens[screen].body.bars[field].source, 255, &g_model.frsky));
- minsb[j]->setSingleStep(getBarStep(g_model.frsky.screens[screen].body.bars[field].source));
- minsb[j]->setValue(getBarValue(g_model.frsky.screens[screen].body.bars[field].source, g_model.frsky.screens[screen].body.bars[field].barMin, &g_model.frsky));
- maxsb[j]->setMinimum(getBarValue(g_model.frsky.screens[screen].body.bars[field].source, 0, &g_model.frsky));
- maxsb[j]->setMaximum(getBarValue(g_model.frsky.screens[screen].body.bars[field].source, 255, &g_model.frsky));
- maxsb[j]->setSingleStep(getBarStep(g_model.frsky.screens[screen].body.bars[field].source));
- maxsb[j]->setValue(getBarValue(g_model.frsky.screens[screen].body.bars[field].source, (255-g_model.frsky.screens[screen].body.bars[field].barMax), &g_model.frsky));
-
- if (g_model.frsky.screens[screen].body.bars[field].source==0 || g_model.frsky.screens[screen].type==0) {
- minsb[j]->setDisabled(true);
- maxsb[j]->setDisabled(true);
- }
- connect(barsCB[j],SIGNAL(currentIndexChanged(int)),this,SLOT(telBarCBcurrentIndexChanged(int)));
- connect(maxSB[j],SIGNAL(editingFinished()),this,SLOT(telMaxSBeditingFinished()));
- connect(minSB[j],SIGNAL(editingFinished()),this,SLOT(telMinSBeditingFinished()));
- }
- telemetryLock=false;
-}
-
-void ModelEdit::updateA1Fields()
-{
- float a1ratio,a11value, a12value;
- if (g_model.frsky.channels[0].ratio==0) {
- ui->a11ValueSB->setMinimum(0);
- ui->a11ValueSB->setMaximum(0);
- ui->a12ValueSB->setMinimum(0);
- ui->a12ValueSB->setMaximum(0);
- ui->a1CalibSB->setMinimum(0);
- ui->a1CalibSB->setMaximum(0);
- ui->a1CalibSB->setValue(0);
- ui->a11ValueSB->setValue(0);
- ui->a12ValueSB->setValue(0);
- return;
- }
-
- if (g_model.frsky.channels[0].type==0 || g_model.frsky.channels[0].type==1 || g_model.frsky.channels[0].type==2) {
- a1ratio=(g_model.frsky.channels[0].ratio<a11ValueSB->setDecimals(2);
- ui->a11ValueSB->setSingleStep(a1ratio/255.0);
- ui->a12ValueSB->setDecimals(2);
- ui->a12ValueSB->setSingleStep(a1ratio/255.0);
- ui->a11ValueSB->setMinimum((g_model.frsky.channels[0].ratio*1.0*g_model.frsky.channels[0].offset)/2550.0);
- ui->a11ValueSB->setMaximum(a1ratio+(g_model.frsky.channels[0].ratio*1.0*g_model.frsky.channels[0].offset)/2550.0);
- ui->a12ValueSB->setMinimum((g_model.frsky.channels[0].offset*1.0*g_model.frsky.channels[0].ratio)/2550.0);
- ui->a12ValueSB->setMaximum(a1ratio+(g_model.frsky.channels[0].offset*1.0*g_model.frsky.channels[0].ratio)/2550.0);
- } else {
- a1ratio=g_model.frsky.channels[0].ratio<a11ValueSB->setDecimals(2);
- ui->a11ValueSB->setSingleStep(a1ratio/255.0);
- ui->a12ValueSB->setDecimals(2);
- ui->a12ValueSB->setSingleStep(a1ratio/255.0);
- ui->a11ValueSB->setMinimum((g_model.frsky.channels[0].offset*1.0*g_model.frsky.channels[0].ratio)/255.0);
- ui->a11ValueSB->setMaximum(a1ratio+(g_model.frsky.channels[0].offset*1.0*g_model.frsky.channels[0].ratio)/255.0);
- ui->a12ValueSB->setMinimum((g_model.frsky.channels[0].offset*1.0*g_model.frsky.channels[0].ratio)/255.0);
- ui->a12ValueSB->setMaximum(a1ratio+(g_model.frsky.channels[0].offset*1.0*g_model.frsky.channels[0].ratio)/255.0);
- }
- ui->a1CalibSB->setDecimals(2);
- ui->a1CalibSB->setMaximum((a1ratio*127)/255.0);
- ui->a1CalibSB->setMinimum((-a1ratio*128)/255.0);
- ui->a1CalibSB->setSingleStep(a1ratio/255.0);
- ui->a1CalibSB->setValue((g_model.frsky.channels[0].offset*a1ratio)/255);
- a11value=a1ratio*(g_model.frsky.channels[0].alarms[0].value/255.0+g_model.frsky.channels[0].offset/255.0);
- a12value=a1ratio*(g_model.frsky.channels[0].alarms[1].value/255.0+g_model.frsky.channels[0].offset/255.0);;
- ui->a11ValueSB->setValue(a11value);
- ui->a12ValueSB->setValue(a12value);
-}
-
-void ModelEdit::updateA2Fields()
-{
- float a2ratio,a21value, a22value;
- if (g_model.frsky.channels[1].ratio==0) {
- ui->a21ValueSB->setMinimum(0);
- ui->a21ValueSB->setMaximum(0);
- ui->a22ValueSB->setMinimum(0);
- ui->a22ValueSB->setMaximum(0);
- ui->a2CalibSB->setMinimum(0);
- ui->a2CalibSB->setMaximum(0);
- ui->a2CalibSB->setValue(0);
- ui->a21ValueSB->setValue(0);
- ui->a22ValueSB->setValue(0);
- return;
- }
- if (g_model.frsky.channels[1].type==0) {
- a2ratio=g_model.frsky.channels[1].ratio/10.0;
- ui->a21ValueSB->setDecimals(2);
- ui->a21ValueSB->setSingleStep(a2ratio/255.0);
- ui->a22ValueSB->setDecimals(2);
- ui->a22ValueSB->setSingleStep(a2ratio/255.0);
- ui->a21ValueSB->setMinimum((g_model.frsky.channels[1].offset*1.0*g_model.frsky.channels[1].ratio)/2550.0);
- ui->a21ValueSB->setMaximum(a2ratio+(g_model.frsky.channels[1].offset*1.0*g_model.frsky.channels[1].ratio)/2550.0);
- ui->a22ValueSB->setMinimum((g_model.frsky.channels[1].offset*1.0*g_model.frsky.channels[1].ratio*1.0)/2550.0);
- ui->a22ValueSB->setMaximum(a2ratio+(g_model.frsky.channels[1].offset*1.0*g_model.frsky.channels[1].ratio)/2550.0);
- } else {
- a2ratio=g_model.frsky.channels[1].ratio;
- ui->a21ValueSB->setDecimals(2);
- ui->a21ValueSB->setSingleStep(a2ratio/255.0);
- ui->a22ValueSB->setDecimals(2);
- ui->a22ValueSB->setSingleStep(a2ratio/255.0);
- ui->a21ValueSB->setMinimum((g_model.frsky.channels[1].offset*1.0*g_model.frsky.channels[1].ratio)/255.0);
- ui->a21ValueSB->setMaximum(a2ratio+(g_model.frsky.channels[1].offset*1.0*g_model.frsky.channels[1].ratio)/255.0);
- ui->a22ValueSB->setMinimum((g_model.frsky.channels[1].offset*1.0*g_model.frsky.channels[1].ratio)/255.0);
- ui->a22ValueSB->setMaximum(a2ratio+(g_model.frsky.channels[1].offset*1.0*g_model.frsky.channels[1].ratio)/255.0);
- }
- ui->a2CalibSB->setDecimals(2);
- ui->a2CalibSB->setMaximum((a2ratio*127)/255.0);
- ui->a2CalibSB->setMinimum((-a2ratio*128)/255.0);
- ui->a2CalibSB->setSingleStep(a2ratio/255.0);
- ui->a2CalibSB->setValue((g_model.frsky.channels[1].offset*a2ratio)/255.0);
- a21value=a2ratio*(g_model.frsky.channels[1].alarms[0].value/255.0+g_model.frsky.channels[1].offset/255.0);
- a22value=a2ratio*(g_model.frsky.channels[1].alarms[1].value/255.0+g_model.frsky.channels[1].offset/255.0);
- ui->a21ValueSB->setValue(a21value);
- ui->a22ValueSB->setValue(a22value);
-}
-
-void ModelEdit::tabTemplates()
-{
- ui->templateList->clear();
- ui->templateList->addItem(tr("Simple 4-CH"));
- ui->templateList->addItem(tr("T-Cut"));
- ui->templateList->addItem(tr("Sticky T-Cut"));
- ui->templateList->addItem(tr("V-Tail"));
- ui->templateList->addItem(tr("Elevon\\Delta"));
- ui->templateList->addItem(tr("Heli Setup"));
- ui->templateList->addItem(tr("Heli Setup with gyro gain control"));
- ui->templateList->addItem(tr("Gyro gain control"));
- ui->templateList->addItem(tr("Heli Setup (Futaba's channel assignment style)"));
- ui->templateList->addItem(tr("Heli Setup with gyro gain control (Futaba's channel assignment style)"));
- ui->templateList->addItem(tr("Gyro gain control (Futaba's channel assignment style)"));
- ui->templateList->addItem(tr("Servo Test"));
- ui->templateList->addItem(tr("MultiCopter"));
- ui->templateList->addItem(tr("Use Model Config Wizard"));
-}
-
-void ModelEdit::on_modelNameLE_editingFinished()
-{
- int length=ui->modelNameLE->maxLength();
- strncpy(g_model.name, ui->modelNameLE->text().toAscii(), length);
- updateSettings();
-}
-
-void ModelEdit::on_modelImage_CB_currentIndexChanged(int index)
-{
- if (modelImageLock)
- return;
- strncpy(g_model.bitmap, ui->modelImage_CB->currentText().toAscii(), GetEepromInterface()->getCapability(VoicesMaxLength));
- QSettings settings("companion9x", "companion9x");
- QString path=settings.value("sdPath", ".").toString();
- path.append("/BMP/");
- QDir qd(path);
- if (qd.exists()) {
- QString fileName=path;
- fileName.append(g_model.bitmap);
- fileName.append(".bmp");
- QImage image(fileName);
- if (image.isNull()) {
- fileName=path;
- fileName.append(g_model.bitmap);
- fileName.append(".BMP");
- image.load(fileName);
- }
- if (!image.isNull()) {
- ui->modelImage_image->setPixmap(QPixmap::fromImage(image.scaled( 64,32)));;
- } else {
- ui->modelImage_image->clear();
- }
- } else {
- ui->modelImage_image->clear();
- }
- updateSettings();
-}
-
-void ModelEdit::phaseName_editingFinished()
-{
- QLineEdit *lineEdit = qobject_cast(sender());
- int phase = lineEdit->objectName().mid(5,1).toInt();
- QString PhaseName=lineEdit->text();
- QString TabName;
- if (phase==0) {
- TabName.append(QObject::tr("Flight Mode 0 (Default)"));
- } else {
- TabName.append(QObject::tr("FM %1").arg(phase));
- }
-
- if (!PhaseName.isEmpty()) {
- TabName.append(" (");
- TabName.append(PhaseName);
- TabName.append(")");
- }
- ui->phases->setTabText(phase,TabName);
- int length=lineEdit->maxLength();
- strncpy(g_model.phaseData[phase].name, lineEdit->text().toAscii(), length);
- updateSettings();
-}
-
-void ModelEdit::phaseSwitch_currentIndexChanged()
-{
- QComboBox *comboBox = qobject_cast(sender());
- int phase = comboBox->objectName().mid(5,1).toInt();
- g_model.phaseData[phase].swtch = RawSwitch(comboBox->itemData(comboBox->currentIndex()).toInt());
- updateSettings();
-}
-
-void ModelEdit::phaseFadeIn_editingFinished()
-{
- QDoubleSpinBox *spinBox = qobject_cast(sender());
- int phase = spinBox->objectName().mid(5,1).toInt();
- int scale=GetEepromInterface()->getCapability(SlowScale);
- g_model.phaseData[phase].fadeIn = round(spinBox->value()*scale);
- updateSettings();
-}
-
-void ModelEdit::phaseFadeOut_editingFinished()
-{
- QDoubleSpinBox *spinBox = qobject_cast(sender());
- int phase = spinBox->objectName().mid(5,1).toInt();
- int scale=GetEepromInterface()->getCapability(SlowScale);
- g_model.phaseData[phase].fadeOut = round(spinBox->value()*scale);
- updateSettings();
-}
-
-void ModelEdit::on_timer1ModeCB_currentIndexChanged(int index)
-{
- g_model.timers[0].mode = TimerMode(ui->timer1ModeCB->itemData(index).toInt());
- updateSettings();
-}
-
-void ModelEdit::on_timer1DirCB_currentIndexChanged(int index)
-{
- g_model.timers[0].dir = index;
- updateSettings();
-}
-
-void ModelEdit::on_timer1ValTE_editingFinished()
-{
- g_model.timers[0].val = ui->timer1ValTE->time().minute()*60 + ui->timer1ValTE->time().second();
- updateSettings();
-}
-
-void ModelEdit::on_timer1ModeBCB_currentIndexChanged(int index)
-{
- g_model.timers[0].modeB = ui->timer1ModeBCB->itemData(index).toInt();
- updateSettings();
-}
-
-void ModelEdit::on_timer2ModeCB_currentIndexChanged(int index)
-{
- g_model.timers[1].mode = TimerMode(ui->timer2ModeCB->itemData(index).toInt());
- updateSettings();
-}
-
-void ModelEdit::on_timer2DirCB_currentIndexChanged(int index)
-{
- g_model.timers[1].dir = index;
- updateSettings();
-}
-
-void ModelEdit::on_timer2ValTE_editingFinished()
-{
- g_model.timers[1].val = ui->timer2ValTE->time().minute()*60 + ui->timer2ValTE->time().second();
- updateSettings();
-}
-
-void ModelEdit::on_timer2ModeBCB_currentIndexChanged(int index)
-{
- g_model.timers[1].modeB = ui->timer2ModeBCB->itemData(index).toInt();
- updateSettings();
-}
-
-void ModelEdit::on_trimIncCB_currentIndexChanged(int index)
-{
- g_model.trimInc = index;
- updateSettings();
-}
-
-void ModelEdit::on_ttraceCB_currentIndexChanged(int index)
-{
- g_model.thrTraceSrc = index;
- updateSettings();
-}
-
-void ModelEdit::on_pulsePolCB_currentIndexChanged(int index)
-{
- g_model.moduleData[0].ppmPulsePol = index;
- updateSettings();
-}
-
-void ModelEdit::on_pulsePolCB_2_currentIndexChanged(int index)
-{
- g_model.moduleData[1].ppmPulsePol = index;
- updateSettings();
-}
-
-void ModelEdit::on_pulsePolCB_3_currentIndexChanged(int index)
-{
- g_model.moduleData[2].ppmPulsePol = index;
- updateSettings();
-}
-
-void ModelEdit::on_protocolCB_currentIndexChanged(int index)
-{
- if (!protocolEditLock) {
- protocolEditLock=true;
-
- g_model.moduleData[0].protocol=(Protocol)ui->protocolCB->itemData(index).toInt();
- int protocol=g_model.moduleData[0].protocol;
- // g_model.protocol = (Protocol)index;
- if (protocol==PXX_XJT_D8 || protocol==OFF) {
- ui->FSGB_1->hide();
- } else {
- ui->fsm1CB->setCurrentIndex(g_model.moduleData[0].failsafeMode);
- on_fsm1CB_currentIndexChanged(g_model.moduleData[0].failsafeMode);
- ui->FSGB_1->show();
- }
- updateSettings();
-
- ui->ppmDelaySB->setEnabled(!protocol);
- ui->numChannelsSB->setEnabled(!protocol);
-
- if (GetEepromInterface()->getCapability(HasPPMStart)) {
- ui->numChannelsSB->setSingleStep(1);
- } else {
- ui->numChannelsSB->setSingleStep(2);
- }
-
- switch (protocol) {
- case OFF:
- ui->label_PPM->hide();
- ui->ppmDelaySB->hide();
- ui->label_PPMCH->hide();
- ui->label_pulsePol->hide();
- ui->pulsePolCB->hide();
- ui->numChannelsSB->hide();
- ui->label_ppmFrameLength->hide();
- ui->ppmFrameLengthDSB->hide();
- ui->label_DSM->hide();
- ui->DSM_Type->hide();
- ui->label_PXX->hide();
- ui->pxxRxNum->hide();
- ui->label_numChannelsStart->hide();
- ui->numChannelsStart->hide();
- break;
- case PXX_XJT_X16:
- case PXX_XJT_D8:
- case PXX_XJT_LR12:
- case PXX_DJT:
- ui->label_PPM->hide();
- ui->ppmDelaySB->hide();
- ui->ppmDelaySB->setEnabled(false);
- ui->label_PPMCH->show();
- ui->label_pulsePol->hide();
- ui->pulsePolCB->hide();
- ui->numChannelsSB->show();
- ui->numChannelsSB->setEnabled(true);
- ui->label_ppmFrameLength->hide();
- ui->ppmFrameLengthDSB->hide();
- ui->ppmFrameLengthDSB->setEnabled(false);
- ui->label_DSM->hide();
- ui->DSM_Type->hide();
- ui->DSM_Type->setEnabled(false);
- ui->label_PXX->show();
- ui->pxxRxNum->setMinimum(0);
- ui->pxxRxNum->show();
- ui->pxxRxNum->setEnabled(true);
- ui->pxxRxNum->setValue((g_model.moduleData[0].channelsCount-8)/2+1);
- ui->label_numChannelsStart->show();
- ui->numChannelsStart->show();
- ui->numChannelsStart->setValue(g_model.moduleData[0].channelsStart+1);
- ui->numChannelsSB->setMinimum(g_model.moduleData[0].channelsStart+4);
- ui->numChannelsSB->setValue(g_model.moduleData[0].channelsStart+g_model.moduleData[0].channelsCount);
- break;
- case LP45:
- case DSM2:
- case DSMX:
- ui->label_pulsePol->hide();
- ui->pulsePolCB->hide();
- ui->label_PPM->hide();
- ui->ppmDelaySB->hide();
- ui->ppmDelaySB->setEnabled(false);
- ui->label_PPMCH->hide();
- ui->label_numChannelsStart->hide();
- ui->numChannelsStart->hide();
- ui->numChannelsSB->hide();
- ui->numChannelsSB->setEnabled(false);
- ui->label_ppmFrameLength->hide();
- ui->ppmFrameLengthDSB->hide();
- ui->ppmFrameLengthDSB->setEnabled(false);
- if (!GetEepromInterface()->getCapability(DSM2Indexes)) {
- ui->label_PXX->hide();
- ui->pxxRxNum->hide();
- ui->pxxRxNum->setEnabled(false);
- }
- else {
- ui->pxxRxNum->setMinimum(0);
- ui->pxxRxNum->setValue(g_model.modelId);
- ui->label_PXX->show();
- ui->pxxRxNum->show();
- ui->pxxRxNum->setEnabled(true);
- }
- ui->DSM_Type->setEnabled(false);
- ui->label_DSM->hide();
- ui->DSM_Type->hide();
- break;
- default:
- if (GetEepromInterface()->getCapability(HasPPMStart)) {
- ui->label_numChannelsStart->show();
- ui->numChannelsStart->show();
- }
- else {
- ui->label_numChannelsStart->hide();
- ui->numChannelsStart->hide();
- }
- ui->numChannelsStart->setValue(g_model.moduleData[0].channelsStart+1);
- ui->numChannelsSB->setMinimum(g_model.moduleData[0].channelsStart+4);
- ui->numChannelsSB->setValue(g_model.moduleData[0].channelsStart + g_model.moduleData[0].channelsCount);
- ui->label_pulsePol->show();
- ui->pulsePolCB->show();
- ui->label_DSM->hide();
- ui->DSM_Type->hide();
- ui->DSM_Type->setEnabled(false);
- ui->label_PXX->hide();
- ui->pxxRxNum->hide();
- ui->pxxRxNum->setEnabled(false);
- ui->label_PPM->show();
- ui->ppmDelaySB->show();
- ui->ppmDelaySB->setEnabled(true);
- ui->label_PPMCH->show();
- ui->numChannelsSB->show();
- ui->numChannelsSB->setEnabled(true);
- ui->ppmFrameLengthDSB->setEnabled(true);
- ui->ppmFrameLengthDSB->setMinimum(g_model.moduleData[0].channelsCount*(g_model.extendedLimits ? 2.250 :2)+3.5);
- if (GetEepromInterface()->getCapability(PPMExtCtrl)) {
- ui->ppmFrameLengthDSB->show();
- ui->label_ppmFrameLength->show();
- }
-
- break;
- }
- protocolEditLock=false;
- }
-}
-
-void ModelEdit::on_protocolCB_2_currentIndexChanged(int index)
-{
- if (!protocol2EditLock) {
- protocol2EditLock=true;
-
- g_model.moduleData[1].protocol=(Protocol)ui->protocolCB_2->itemData(index).toInt();
- int protocol=g_model.moduleData[1].protocol;
- if (protocol==PXX_XJT_X16 || protocol==PXX_XJT_LR12) {
- ui->FSGB_2->show();
- ui->fsm2CB->setCurrentIndex(g_model.moduleData[1].failsafeMode);
- on_fsm2CB_currentIndexChanged(g_model.moduleData[1].failsafeMode);
- } else {
- ui->FSGB_2->hide();
- }
- // g_model.protocol = (Protocol)index;
- updateSettings();
-
- ui->ppmDelaySB_2->setEnabled(!protocol);
- ui->numChannelsSB_2->setEnabled(!protocol);
-
- if (GetEepromInterface()->getCapability(HasPPMStart)) {
- ui->numChannelsSB_2->setSingleStep(1);
- } else {
- ui->numChannelsSB_2->setSingleStep(2);
- }
-
- switch (protocol) {
- case OFF:
- ui->label_PPM_2->hide();
- ui->ppmDelaySB_2->hide();
- ui->label_PPMCH_2->hide();
- ui->label_pulsePol_2->hide();
- ui->pulsePolCB_2->hide();
- ui->numChannelsSB_2->hide();
- ui->label_ppmFrameLength_2->hide();
- ui->ppmFrameLengthDSB_2->hide();
- ui->label_DSM_2->hide();
- ui->DSM_Type_2->hide();
- ui->label_PXX_2->hide();
- ui->pxxRxNum_2->hide();
- ui->label_numChannelsStart_2->hide();
- ui->numChannelsStart_2->hide();
- break;
- case PXX_XJT_X16:
- case PXX_XJT_D8:
- case PXX_XJT_LR12:
- case PXX_DJT:
- ui->label_PPM_2->hide();
- ui->ppmDelaySB_2->hide();
- ui->ppmDelaySB_2->setEnabled(false);
- ui->label_PPMCH_2->show();
- ui->label_pulsePol_2->hide();
- ui->pulsePolCB_2->hide();
- ui->numChannelsSB_2->show();
- ui->numChannelsSB_2->setEnabled(true);
- ui->label_ppmFrameLength_2->hide();
- ui->ppmFrameLengthDSB_2->hide();
- ui->ppmFrameLengthDSB_2->setEnabled(false);
- ui->label_DSM_2->hide();
- ui->DSM_Type_2->hide();
- ui->DSM_Type_2->setEnabled(false);
- ui->label_PXX_2->show();
- ui->pxxRxNum_2->setMinimum(0);
- ui->pxxRxNum_2->show();
- ui->pxxRxNum_2->setEnabled(true);
- ui->pxxRxNum_2->setValue(g_model.modelId);
- ui->label_numChannelsStart_2->show();
- ui->numChannelsStart_2->show();
- ui->numChannelsStart_2->setValue(g_model.moduleData[1].channelsStart+1);
- ui->numChannelsSB_2->setMinimum(g_model.moduleData[1].channelsStart+4);
- ui->numChannelsSB_2->setValue(g_model.moduleData[1].channelsStart+g_model.moduleData[1].channelsCount);
- break;
- case LP45:
- case DSM2:
- case DSMX:
- ui->label_pulsePol_2->hide();
- ui->pulsePolCB_2->hide();
- ui->label_PPM_2->hide();
- ui->ppmDelaySB_2->hide();
- ui->ppmDelaySB_2->setEnabled(false);
- ui->label_PPMCH_2->hide();
- ui->numChannelsSB_2->hide();
- ui->numChannelsSB_2->setEnabled(false);
- ui->label_ppmFrameLength_2->hide();
- ui->ppmFrameLengthDSB_2->hide();
- ui->ppmFrameLengthDSB_2->setEnabled(false);
- if (!GetEepromInterface()->getCapability(DSM2Indexes)) {
- ui->label_PXX_2->hide();
- ui->pxxRxNum_2->hide();
- ui->pxxRxNum_2->setEnabled(false);
- } else {
- ui->pxxRxNum_2->setMinimum(0);
- ui->pxxRxNum_2->setValue(g_model.modelId);
- ui->label_PXX_2->show();
- ui->pxxRxNum_2->show();
- ui->pxxRxNum_2->setEnabled(true);
- }
- ui->DSM_Type_2->setEnabled(false);
- ui->label_DSM_2->hide();
- ui->DSM_Type_2->hide();
- break;
- default:
- if (GetEepromInterface()->getCapability(HasPPMStart)) {
- ui->label_numChannelsStart_2->show();
- ui->numChannelsStart_2->show();
- } else {
- ui->label_numChannelsStart_2->hide();
- ui->numChannelsStart_2->hide();
- }
- ui->numChannelsStart_2->setValue(g_model.moduleData[1].channelsStart+1);
- ui->numChannelsSB_2->setMinimum(g_model.moduleData[1].channelsStart+4);
- ui->numChannelsSB_2->setValue(g_model.moduleData[1].channelsStart+g_model.moduleData[1].channelsCount);
- ui->label_pulsePol_2->show();
- ui->pulsePolCB_2->show();
- ui->pulsePolCB_2->setCurrentIndex(g_model.moduleData[1].ppmPulsePol);
- ui->label_DSM_2->hide();
- ui->DSM_Type_2->hide();
- ui->DSM_Type_2->setEnabled(false);
- ui->label_PXX_2->hide();
- ui->pxxRxNum_2->hide();
- ui->pxxRxNum_2->setEnabled(false);
- ui->label_PPM_2->show();
- ui->ppmDelaySB_2->show();
- ui->ppmDelaySB_2->setEnabled(true);
- ui->ppmDelaySB_2->setValue(g_model.moduleData[1].ppmDelay);
- ui->label_PPMCH_2->show();
- ui->numChannelsSB_2->show();
- ui->numChannelsSB_2->setEnabled(true);
- ui->ppmFrameLengthDSB_2->setEnabled(true);
- ui->ppmFrameLengthDSB_2->setMinimum(g_model.moduleData[1].channelsCount*(g_model.extendedLimits ? 2.250 :2)+3.5);
- if (GetEepromInterface()->getCapability(PPMExtCtrl)) {
- ui->ppmFrameLengthDSB_2->show();
- ui->label_ppmFrameLength_2->show();
- ui->ppmFrameLengthDSB_2->setValue(g_model.moduleData[1].ppmFrameLength/2.0+22.5);
- }
- break;
- }
- protocol2EditLock=false;
- }
-}
-
-void ModelEdit::on_protocolCB_3_currentIndexChanged(int index)
-{
- if (!trainerEditLock) {
- trainerEditLock=true;
-
- g_model.moduleData[2].protocol=ui->protocolCB_3->currentIndex();
- g_model.trainerMode=ui->protocolCB_3->currentIndex();
- updateSettings();
- switch (index) {
- case 0:
- ui->label_PPM_3->hide();
- ui->ppmDelaySB_3->hide();
- ui->label_PPMCH_3->hide();
- ui->label_pulsePol_3->hide();
- ui->pulsePolCB_3->hide();
- ui->numChannelsSB_3->hide();
- ui->label_ppmFrameLength_3->hide();
- ui->ppmFrameLengthDSB_3->hide();
- ui->label_numChannelsStart_3->hide();
- ui->numChannelsStart_3->hide();
- break;
- default:
- ui->label_PPM_3->show();
- ui->ppmDelaySB_3->show();
- ui->label_PPMCH_3->show();
- ui->label_pulsePol_3->show();
- ui->pulsePolCB_3->show();
- ui->numChannelsSB_3->show();
- ui->label_ppmFrameLength_3->show();
- ui->ppmFrameLengthDSB_3->show();
- ui->label_numChannelsStart_3->show();
- ui->numChannelsStart_3->show();
- ui->numChannelsStart_3->setValue(g_model.moduleData[2].channelsStart+1);
- ui->numChannelsSB_3->setMinimum(g_model.moduleData[2].channelsStart+4);
- ui->numChannelsSB_3->setValue(g_model.moduleData[2].channelsStart+g_model.moduleData[2].channelsCount);
- ui->pulsePolCB_3->setCurrentIndex(g_model.moduleData[2].ppmPulsePol);
- ui->ppmDelaySB_3->setValue(g_model.moduleData[2].ppmDelay);
- ui->ppmFrameLengthDSB_3->setMinimum(g_model.moduleData[2].channelsCount*(g_model.extendedLimits ? 2.250 :2)+3.5);
- if (GetEepromInterface()->getCapability(PPMExtCtrl)) {
- ui->ppmFrameLengthDSB_3->show();
- ui->label_ppmFrameLength_3->show();
- ui->ppmFrameLengthDSB_3->setValue(g_model.moduleData[2].ppmFrameLength/2.0+22.5);
- }
- break;
- }
- trainerEditLock=false;
- }
-}
-
-
-void ModelEdit::on_numChannelsSB_editingFinished()
-{
- // TODO only accept valid values
- g_model.moduleData[0].channelsCount = 1+ui->numChannelsSB->value()-ui->numChannelsStart->value();
- ui->ppmFrameLengthDSB->setMinimum(g_model.moduleData[0].channelsCount*(g_model.extendedLimits ? 2.250 :2)+3.5);
- updateSettings();
-}
-
-void ModelEdit::on_numChannelsSB_2_editingFinished()
-{
- // TODO only accept valid values
- g_model.moduleData[1].channelsCount = 1+ui->numChannelsSB_2->value()-ui->numChannelsStart_2->value();
- ui->ppmFrameLengthDSB_2->setMinimum(g_model.moduleData[1].channelsCount*(g_model.extendedLimits ? 2.250 :2.0)+3.5);
- updateSettings();
-}
-
-void ModelEdit::on_numChannelsSB_3_editingFinished()
-{
- // TODO only accept valid values
- g_model.moduleData[2].channelsCount = 1+ui->numChannelsSB_3->value()-ui->numChannelsStart_3->value();
- ui->ppmFrameLengthDSB_3->setMinimum(g_model.moduleData[2].channelsCount*(g_model.extendedLimits ? 2.250 :2)+3.5);
- updateSettings();
-}
-
-void ModelEdit::on_numChannelsStart_editingFinished()
-{
- // TODO only accept valid values
- g_model.moduleData[0].channelsStart = ui->numChannelsStart->value()-1;
- ui->numChannelsSB->setMinimum(g_model.moduleData[0].channelsStart+4);
- ui->numChannelsSB->setValue(g_model.moduleData[0].channelsStart+g_model.moduleData[0].channelsCount);
- updateSettings();
-}
-
-void ModelEdit::on_numChannelsStart_2_editingFinished()
-{
- // TODO only accept valid values
- g_model.moduleData[1].channelsStart = ui->numChannelsStart_2->value()-1;
- ui->numChannelsSB_2->setMinimum(g_model.moduleData[1].channelsStart+4);
- ui->numChannelsSB_2->setValue(g_model.moduleData[1].channelsStart+g_model.moduleData[1].channelsCount);
- updateSettings();
-}
-
-void ModelEdit::on_numChannelsStart_3_editingFinished()
-{
- // TODO only accept valid values
- g_model.moduleData[2].channelsStart = ui->numChannelsStart_3->value()-1;
- ui->numChannelsSB_3->setMinimum(g_model.moduleData[2].channelsStart+4);
- ui->numChannelsSB_3->setValue(g_model.moduleData[2].channelsStart+g_model.moduleData[2].channelsCount);
- updateSettings();
-}
-
-void ModelEdit::on_ppmDelaySB_editingFinished()
-{
- if(protocolEditLock) return;
- // TODO only accept valid values
- g_model.moduleData[0].ppmDelay = ui->ppmDelaySB->value();
- updateSettings();
-}
-
-void ModelEdit::on_ppmDelaySB_2_editingFinished()
-{
- if(protocol2EditLock) return;
- // TODO only accept valid values
- g_model.moduleData[1].ppmDelay = ui->ppmDelaySB_2->value();
- updateSettings();
-}
-
-void ModelEdit::on_ppmDelaySB_3_editingFinished()
-{
- if(trainerEditLock) return;
- // TODO only accept valid values
- g_model.moduleData[2].ppmDelay = ui->ppmDelaySB_3->value();
- updateSettings();
-}
-
-void ModelEdit::on_DSM_Type_currentIndexChanged(int index)
-{
- if(protocolEditLock) return;
- // g_model.moduleData[0].channelsCount = (index*2)+8;
- updateSettings();
-}
-
-void ModelEdit::on_DSM_Type_2_currentIndexChanged(int index)
-{
- if(protocol2EditLock) return;
- // g_model.moduleData[1].channelsCount = (index*2)+8;
- updateSettings();
-}
-
-void ModelEdit::on_pxxRxNum_editingFinished()
-{
- if(protocolEditLock)
- return;
-
- if (!GetEepromInterface()->getCapability(DSM2Indexes)) {
- // g_model.moduleData[0].channelsCount = (ui->pxxRxNum->value()-1)*2+8;
- } else {
- g_model.modelId = ui->pxxRxNum->value();
- }
- updateSettings();
-}
-
-void ModelEdit::on_pxxRxNum_2_editingFinished()
-{
- if(protocol2EditLock)
- return;
-
- /* if (!GetEepromInterface()->getCapability(DSM2Indexes)) {
- g_model.moduleData[1].channelsCount = (ui->pxxRxNum_2->value()-1)*2+8;
- } */
- updateSettings();
-}
-
-void ModelEdit::on_ppmFrameLengthDSB_editingFinished()
-{
- g_model.moduleData[0].ppmFrameLength = (ui->ppmFrameLengthDSB->value()-22.5)/0.5;
- updateSettings();
-}
-
-void ModelEdit::on_ppmFrameLengthDSB_2_editingFinished()
-{
- g_model.moduleData[1].ppmFrameLength = (ui->ppmFrameLengthDSB_2->value()-22.5)/0.5;
- updateSettings();
-}
-
-void ModelEdit::on_ppmFrameLengthDSB_3_editingFinished()
-{
- g_model.moduleData[2].ppmFrameLength = (ui->ppmFrameLengthDSB_3->value()-22.5)/0.5;
- updateSettings();
-}
-
-void ModelEdit::on_fsm1CB_currentIndexChanged(int index)
-{
- QSpinBox * fssb[] = { ui->fsm1SB_1, ui->fsm1SB_2,ui->fsm1SB_3,ui->fsm1SB_4,ui->fsm1SB_5,ui->fsm1SB_6,ui->fsm1SB_7,ui->fsm1SB_8,
- ui->fsm1SB_9, ui->fsm1SB_10,ui->fsm1SB_11,ui->fsm1SB_12,ui->fsm1SB_13,ui->fsm1SB_14,ui->fsm1SB_15,ui->fsm1SB_16, NULL };
- QSlider * fssld[] = { ui->fsm1SL_1, ui->fsm1SL_2,ui->fsm1SL_3,ui->fsm1SL_4,ui->fsm1SL_5,ui->fsm1SL_6,ui->fsm1SL_7,ui->fsm1SL_8,
- ui->fsm1SL_9, ui->fsm1SL_10,ui->fsm1SL_11,ui->fsm1SL_12,ui->fsm1SL_13,ui->fsm1SL_14,ui->fsm1SL_15,ui->fsm1SL_16, NULL };
- g_model.moduleData[0].failsafeMode=index;
- for (int i=0; fssb[i]; i++) {
- if (index==1) {
- fssb[i]->setEnabled(true);
- fssld[i]->setEnabled(true);
- } else {
- fssb[i]->setDisabled(true);
- fssld[i]->setDisabled(true);
- }
- }
- updateSettings();
-}
-
-void ModelEdit::on_fsm2CB_currentIndexChanged(int index)
-{
- QSpinBox * fssb[] = { ui->fsm2SB_1, ui->fsm2SB_2,ui->fsm2SB_3,ui->fsm2SB_4,ui->fsm2SB_5,ui->fsm2SB_6,ui->fsm2SB_7,ui->fsm2SB_8,
- ui->fsm2SB_9, ui->fsm2SB_10,ui->fsm2SB_11,ui->fsm2SB_12,ui->fsm2SB_13,ui->fsm2SB_14,ui->fsm2SB_15,ui->fsm2SB_16, NULL };
- QSlider * fssld[] = { ui->fsm2SL_1, ui->fsm2SL_2,ui->fsm2SL_3,ui->fsm2SL_4,ui->fsm2SL_5,ui->fsm2SL_6,ui->fsm2SL_7,ui->fsm2SL_8,
- ui->fsm2SL_9, ui->fsm2SL_10,ui->fsm2SL_11,ui->fsm2SL_12,ui->fsm2SL_13,ui->fsm2SL_14,ui->fsm2SL_15,ui->fsm2SL_16, NULL };
- g_model.moduleData[1].failsafeMode=index;
- for (int i=0; fssb[i]; i++) {
- if (index==1) {
- fssb[i]->setEnabled(true);
- fssld[i]->setEnabled(true);
- } else {
- fssb[i]->setDisabled(true);
- fssld[i]->setDisabled(true);
- }
- }
- updateSettings();
-}
-
-void ModelEdit::on_instantTrim_CB_currentIndexChanged(int index)
-{
- if(switchEditLock) return;
- bool found=false;
- for (int i=0; i< C9X_MAX_CUSTOM_FUNCTIONS; i++) {
- if (g_model.funcSw[i].func==FuncInstantTrim) {
- g_model.funcSw[i].swtch = RawSwitch(ui->instantTrim_CB->itemData(ui->instantTrim_CB->currentIndex()).toInt());
- found=true;
- }
- }
- if (found==false) {
- for (int i=0; i< C9X_MAX_CUSTOM_FUNCTIONS; i++) {
- if (g_model.funcSw[i].swtch==RawSwitch()) {
- g_model.funcSw[i].swtch = RawSwitch(ui->instantTrim_CB->itemData(ui->instantTrim_CB->currentIndex()).toInt());
- g_model.funcSw[i].func = FuncInstantTrim;
- break;
- }
- }
- }
- updateSettings();
-}
-
-void ModelEdit::on_a1UnitCB_currentIndexChanged(int index) {
- float a1ratio;
- g_model.frsky.channels[0].type=index;
- switch (index) {
- case 0:
- case 1:
- case 2:
- ui->a1RatioSB->setDecimals(1);
- ui->a1RatioSB->setMaximum(25.5*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
- a1ratio=(g_model.frsky.channels[0].ratio<a1RatioSB->setDecimals(0);
- ui->a1RatioSB->setMaximum(255*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
- a1ratio=(g_model.frsky.channels[0].ratio<a1RatioSB->setValue(a1ratio);
- updateA1Fields();
- updateSettings();
-}
-
-void ModelEdit::on_a1RatioSB_valueChanged()
-{
- if (telemetryLock) return;
- if (g_model.frsky.channels[0].type==0 || g_model.frsky.channels[0].type==1 || g_model.frsky.channels[0].type==2) {
- g_model.frsky.channels[0].multiplier = findmult(ui->a1RatioSB->value(), 25.5);
- float singlestep =(1<a1RatioSB->setSingleStep(singlestep);
- ui->a1RatioSB->setValue(round(ui->a1RatioSB->value()/singlestep)*singlestep);
- telemetryLock=false;
- } else {
- g_model.frsky.channels[0].multiplier = findmult(ui->a1RatioSB->value(), 255);
- float singlestep =(1<a1RatioSB->setSingleStep(singlestep);
- ui->a1RatioSB->setValue(round(ui->a1RatioSB->value()/singlestep)*singlestep);
- telemetryLock=false;
- }
-}
-
-void ModelEdit::on_a1RatioSB_editingFinished()
-{
- float a1ratio, a1calib, a11value,a12value;
- if (telemetryLock) return;
- if (g_model.frsky.channels[0].type==0 || g_model.frsky.channels[0].type==1 || g_model.frsky.channels[0].type==2) {
- g_model.frsky.channels[0].multiplier = findmult(ui->a1RatioSB->value(), 25.5);
- ui->a1CalibSB->setSingleStep((1<a11ValueSB->setSingleStep((1<a12ValueSB->setSingleStep((1<a1RatioSB->value()*10))/(1 <a1RatioSB->value(), 255);
- ui->a1CalibSB->setSingleStep(1<a11ValueSB->setSingleStep(1<a12ValueSB->setSingleStep(1<a1RatioSB->value()/(1 << g_model.frsky.channels[0].multiplier));
- }
- ui->a1CalibSB->setMaximum((ui->a1RatioSB->value()*127)/255);
- ui->a1CalibSB->setMinimum((ui->a1RatioSB->value()*-128)/255);
- ui->a11ValueSB->setMaximum(ui->a1RatioSB->value());
- ui->a12ValueSB->setMaximum(ui->a1RatioSB->value());
- repaint();
- a1ratio=g_model.frsky.channels[0].ratio * (1 << g_model.frsky.channels[0].multiplier);
- a1calib=ui->a1CalibSB->value();
- a11value=ui->a11ValueSB->value();
- a12value=ui->a12ValueSB->value();
- if (g_model.frsky.channels[0].type==0) {
- a1calib*=10;
- a11value*=10;
- a12value*=10;
- }
- if (a1calib>0) {
- if (a1calib>((a1ratio*127)/255)) {
- g_model.frsky.channels[0].offset=127;
- } else {
- g_model.frsky.channels[0].offset=round(a1calib*255/a1ratio);
- }
- }
- if (a1calib<0) {
- if (a1calib<((a1ratio*-128)/255)) {
- g_model.frsky.channels[0].offset=-128;
- } else {
- g_model.frsky.channels[0].offset=round(a1calib*255/a1ratio);
- }
- }
- g_model.frsky.channels[0].alarms[0].value=round((a11value*255-g_model.frsky.channels[0].offset*(g_model.frsky.channels[0].ratio<a1CalibSB->value()/a1ratio));
- a1calib=a1ratio*g_model.frsky.channels[0].offset/255.0;
- a11value=ui->a11ValueSB->value();
- a12value=ui->a12ValueSB->value();
- if (a11value(a1ratio+a1calib)) {
- a11value=a1ratio+a1calib;
- }
- if (a12value(a1ratio+a1calib)) {
- a12value=a1ratio+a1calib;
- }
- g_model.frsky.channels[0].alarms[0].value=round(((a11value-a1calib)*255)/a1ratio);
- g_model.frsky.channels[0].alarms[1].value=round(((a12value-a1calib)*255)/a1ratio);
- } else {
- g_model.frsky.channels[0].offset=0;
- g_model.frsky.channels[0].alarms[0].value=0;
- g_model.frsky.channels[0].alarms[1].value=0;
- }
- updateA1Fields();
- telBarUpdate();
- updateSettings();
-}
-
-void ModelEdit::on_a11LevelCB_currentIndexChanged(int index)
-{
- g_model.frsky.channels[0].alarms[0].level = index;
- updateSettings();
-}
-
-void ModelEdit::on_frskyUnitsCB_currentIndexChanged(int index)
-{
- g_model.frsky.imperial=index;
- updateSettings();
-}
-
-void ModelEdit::on_frskyBladesCB_currentIndexChanged(int index)
-{
- g_model.frsky.blades=index;
- updateSettings();
-}
-
-void ModelEdit::on_frskyCurrentCB_currentIndexChanged(int index)
-{
- g_model.frsky.currentSource=index;
- updateSettings();
-}
-
-void ModelEdit::on_frskyVoltCB_currentIndexChanged(int index)
-{
- g_model.frsky.voltsSource=index;
- updateSettings();
-}
-
-void ModelEdit::on_frskyProtoCB_currentIndexChanged(int index)
-{
- if (telemetryLock) return;
- int bindex[12];
- telemetryLock=true;
- for (int i=0; i<12; i++) {
- bindex[i]=barsCB[i]->currentIndex();
- g_model.frsky.usrProto=index;
- populateCustomScreenFieldCB(barsCB[i], bindex[i], false, g_model.frsky.usrProto);
- }
- if (!GetEepromInterface()->getCapability(TelemetryCSFields)) {
- ui->groupBox_5->hide();
- } else {
- for (int screen=0; screen<2;screen++) {
- for (int rows=0; rows<4; rows++) {
- for (int cols=0; cols<3; cols++) {
- int index=screen*12+cols*4+rows;
- populateCustomScreenFieldCB(csf[index], g_model.frsky.screens[screen].body.lines[rows].source[cols], (rows<4), g_model.frsky.usrProto);
- }
- }
- }
- }
- telemetryLock=false;
- if (index==0) {
- for (int i=0; i<12; i++) {
- if (bindex[i]>2) {
- barsCB[i]->setCurrentIndex(0);
- } else {
- barsCB[i]->setCurrentIndex(bindex[i]);
- }
- }
- } else if (index==2) {
- for (int i=0; i<12; i++) {
- if (bindex[i]>3) {
- barsCB[i]->setCurrentIndex(0);
- } else {
- barsCB[i]->setCurrentIndex(bindex[i]);
- }
- }
- } else {
- for (int i=0; i<12; i++) {
- barsCB[i]->setCurrentIndex(bindex[i]);
- }
- }
- updateSettings();
-}
-
-void ModelEdit::on_a11GreaterCB_currentIndexChanged(int index)
-{
- g_model.frsky.channels[0].alarms[0].greater = index;
- updateSettings();
-}
-
-void ModelEdit::on_a11ValueSB_editingFinished()
-{
- float a1ratio, a1calib, a11value;
- a1ratio=g_model.frsky.channels[0].ratio<a11ValueSB->value();
- if (g_model.frsky.channels[0].type==0) {
- a1ratio/=10;
- }
- if (a11value<((a1calib*a1ratio)/255)) {
- g_model.frsky.channels[0].alarms[0].value=0;
- } else if (a11value>(a1ratio+(a1calib*a1ratio)/255)) {
- g_model.frsky.channels[0].alarms[0].value=255;
- } else {
- g_model.frsky.channels[0].alarms[0].value = round((a11value-((a1calib*a1ratio)/255))/a1ratio*255);
- }
- updateA1Fields();
- updateSettings();
-}
-
-void ModelEdit::on_a12LevelCB_currentIndexChanged(int index)
-{
- g_model.frsky.channels[0].alarms[1].level = index;
- updateSettings();
-}
-
-void ModelEdit::on_a12GreaterCB_currentIndexChanged(int index)
-{
- g_model.frsky.channels[0].alarms[1].greater = index;
- updateSettings();
-}
-
-void ModelEdit::on_a12ValueSB_editingFinished()
-{
- float a1ratio, a1calib, a12value;
- a1ratio=g_model.frsky.channels[0].ratio<a12ValueSB->value();
- if (g_model.frsky.channels[0].type==0) {
- a1ratio/=10;
- }
- if (a12value<((a1calib*a1ratio)/255)) {
- g_model.frsky.channels[0].alarms[1].value=0;
- } else if (a12value>(a1ratio+(a1calib*a1ratio)/255)) {
- g_model.frsky.channels[0].alarms[1].value=255;
- } else {
- g_model.frsky.channels[0].alarms[1].value = round((a12value-((a1calib*a1ratio)/255))/a1ratio*255);
- }
- updateA1Fields();
- updateSettings();
-}
-
-void ModelEdit::on_a2UnitCB_currentIndexChanged(int index) {
- float a2ratio;
- g_model.frsky.channels[1].type=index;
- switch (index) {
- case 0:
- case 1:
- case 2:
- ui->a2RatioSB->setDecimals(1);
- ui->a2RatioSB->setMaximum(25.5*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
- a2ratio=(g_model.frsky.channels[1].ratio<a2RatioSB->setDecimals(0);
- ui->a2RatioSB->setMaximum(255*GetEepromInterface()->getCapability(TelemetryMaxMultiplier));
- a2ratio=g_model.frsky.channels[1].ratio<a2RatioSB->setValue(a2ratio);
- updateA2Fields();
- updateSettings();
-}
-
-void ModelEdit::on_a2RatioSB_valueChanged()
-{
- if (telemetryLock) return;
- if (g_model.frsky.channels[1].type==0 || g_model.frsky.channels[1].type==1 || g_model.frsky.channels[1].type==2) {
- g_model.frsky.channels[1].multiplier = findmult(ui->a2RatioSB->value(), 25.5);
- float singlestep =(1<a2RatioSB->setSingleStep(singlestep);
- ui->a2RatioSB->setValue(round(ui->a2RatioSB->value()/singlestep)*singlestep);
- telemetryLock=false;
- } else {
- g_model.frsky.channels[1].multiplier = findmult(ui->a2RatioSB->value(), 255);
- float singlestep =(1<