Use ETX instead of OTX (also as a file extension).

This commit is contained in:
rotorman
2021-12-31 10:53:08 +01:00
committed by Raphael Coeffic
parent 20961e460b
commit 89517d8bd8
29 changed files with 103 additions and 99 deletions
+2 -1
View File
@@ -60,8 +60,9 @@
#define DFU_FILES_FILTER "DFU " % CPN_STR_FILES % " (*.dfu);;" #define DFU_FILES_FILTER "DFU " % CPN_STR_FILES % " (*.dfu);;"
#define EEPE_FILES_FILTER "EEPE " % CPN_STR_FILES % " (*.eepe);;" #define EEPE_FILES_FILTER "EEPE " % CPN_STR_FILES % " (*.eepe);;"
#define OTX_FILES_FILTER "OpenTX " % CPN_STR_FILES % " (*.otx);;" #define OTX_FILES_FILTER "OpenTX " % CPN_STR_FILES % " (*.otx);;"
#define ETX_FILES_FILTER "EdgeTX " % CPN_STR_FILES % " (*.etx);;"
#define YML_FILES_FILTER "YAML " % CPN_STR_FILES % " (*.yml);;" #define YML_FILES_FILTER "YAML " % CPN_STR_FILES % " (*.yml);;"
#define EEPROM_FILES_FILTER CPN_STR_RAD_MOD_SETTINGS % " " % CPN_STR_FILES % " (*.otx *.yml *.eepe *.bin *.hex);;" % OTX_FILES_FILTER % YML_FILES_FILTER % EEPE_FILES_FILTER % BIN_FILES_FILTER % HEX_FILES_FILTER #define EEPROM_FILES_FILTER CPN_STR_RAD_MOD_SETTINGS % " " % CPN_STR_FILES % " (*.etx *.otx *.yml *.eepe *.bin *.hex);;" % ETX_FILES_FILTER % OTX_FILES_FILTER % YML_FILES_FILTER % EEPE_FILES_FILTER % BIN_FILES_FILTER % HEX_FILES_FILTER
#define FLASH_FILES_FILTER "FLASH " % CPN_STR_FILES % " (*.bin *.hex *.dfu);;" % BIN_FILES_FILTER % HEX_FILES_FILTER % DFU_FILES_FILTER #define FLASH_FILES_FILTER "FLASH " % CPN_STR_FILES % " (*.bin *.hex *.dfu);;" % BIN_FILES_FILTER % HEX_FILES_FILTER % DFU_FILES_FILTER
#define EXTERNAL_EEPROM_FILES_FILTER "EEPROM " % CPN_STR_FILES % " (*.bin *.hex);;" % BIN_FILES_FILTER % HEX_FILES_FILTER #define EXTERNAL_EEPROM_FILES_FILTER "EEPROM " % CPN_STR_FILES % " (*.bin *.hex);;" % BIN_FILES_FILTER % HEX_FILES_FILTER
#define ER9X_EEPROM_FILE_TYPE "ER9X_EEPROM_FILE" #define ER9X_EEPROM_FILE_TYPE "ER9X_EEPROM_FILE"
+2 -2
View File
@@ -157,7 +157,7 @@ MainWindow::MainWindow():
if (!str.isEmpty()) { if (!str.isEmpty()) {
int fileType = getStorageType(str); int fileType = getStorageType(str);
if (fileType==STORAGE_TYPE_EEPE || fileType==STORAGE_TYPE_EEPM || fileType==STORAGE_TYPE_BIN || fileType==STORAGE_TYPE_OTX) { if (fileType==STORAGE_TYPE_EEPE || fileType==STORAGE_TYPE_EEPM || fileType==STORAGE_TYPE_BIN || fileType==STORAGE_TYPE_ETX) {
MdiChild * child = createMdiChild(); MdiChild * child = createMdiChild();
if (child->loadFile(str)) { if (child->loadFile(str)) {
if (!(printing && model >= 0 && (getCurrentFirmware()->getCapability(Models) == 0 || model<getCurrentFirmware()->getCapability(Models)) && !printfilename.isEmpty())) { if (!(printing && model >= 0 && (getCurrentFirmware()->getCapability(Models) == 0 || model<getCurrentFirmware()->getCapability(Models)) && !printfilename.isEmpty())) {
@@ -908,7 +908,7 @@ void MainWindow::readEeprom()
Board::Type board = getCurrentBoard(); Board::Type board = getCurrentBoard();
QString tempFile; QString tempFile;
if (IS_FAMILY_HORUS_OR_T16(board)) if (IS_FAMILY_HORUS_OR_T16(board))
tempFile = generateProcessUniqueTempFileName("temp.otx"); tempFile = generateProcessUniqueTempFileName("temp.etx");
else else
tempFile = generateProcessUniqueTempFileName("temp.bin"); tempFile = generateProcessUniqueTempFileName("temp.bin");
+3 -3
View File
@@ -1320,7 +1320,7 @@ void MdiChild::newFile(bool createDefaults)
{ {
static int sequenceNumber = 1; static int sequenceNumber = 1;
isUntitled = true; isUntitled = true;
curFile = QString("document%1.otx").arg(sequenceNumber++); curFile = QString("document%1.etx").arg(sequenceNumber++);
updateTitle(); updateTitle();
if (createDefaults && firmware->getCapability(Capability::HasModelCategories)) { if (createDefaults && firmware->getCapability(Capability::HasModelCategories)) {
@@ -1375,7 +1375,7 @@ bool MdiChild::saveAs(bool isNew)
#ifdef __APPLE__ #ifdef __APPLE__
QString filter; QString filter;
#else #else
QString filter(OTX_FILES_FILTER % YML_FILES_FILTER); QString filter(ETX_FILES_FILTER % YML_FILES_FILTER);
#endif #endif
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.eepromDir() + "/" + fi.fileName(), filter); QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.eepromDir() + "/" + fi.fileName(), filter);
@@ -1455,7 +1455,7 @@ void MdiChild::setCurrentFile(const QString & fileName)
void MdiChild::forceNewFilename(const QString & suffix, const QString & ext) void MdiChild::forceNewFilename(const QString & suffix, const QString & ext)
{ {
curFile.replace(QRegExp("\\.(eepe|bin|hex|otx)$"), suffix + "." + ext); curFile.replace(QRegExp("\\.(eepe|bin|hex|etx)$"), suffix + "." + ext);
} }
bool MdiChild::convertStorage(Board::Type from, Board::Type to, bool newFile) bool MdiChild::convertStorage(Board::Type from, Board::Type to, bool newFile)
+1 -1
View File
@@ -179,7 +179,7 @@ class MdiChild : public QWidget
bool maybeSave(); bool maybeSave();
void setCurrentFile(const QString & fileName); void setCurrentFile(const QString & fileName);
void forceNewFilename(const QString & suffix = "", const QString & ext = "otx"); void forceNewFilename(const QString & suffix = "", const QString & ext = "etx");
bool convertStorage(Board::Type from, Board::Type to, bool newFile = false); bool convertStorage(Board::Type from, Board::Type to, bool newFile = false);
void showWarning(const QString & msg); void showWarning(const QString & msg);
int askQuestion(const QString & msg, QMessageBox::StandardButtons buttons = (QMessageBox::Yes | QMessageBox::No), QMessageBox::StandardButton defaultButton = QMessageBox::No); int askQuestion(const QString & msg, QMessageBox::StandardButtons buttons = (QMessageBox::Yes | QMessageBox::No), QMessageBox::StandardButton defaultButton = QMessageBox::No);
@@ -120,7 +120,7 @@ QString SimulatorStartupDialog::radioEepromFileName(const QString & firmwareId,
if (pos > 0) if (pos > 0)
radioId = radioId.mid(pos+1); radioId = radioId.mid(pos+1);
if (usesCategorizedStorage(radioId)) if (usesCategorizedStorage(radioId))
ext = "otx"; ext = "etx";
eepromFileName = QString("eeprom-%1.%2").arg(radioId, ext); eepromFileName = QString("eeprom-%1.%2").arg(radioId, ext);
eepromFileName = QDir(folder).filePath(eepromFileName.toLatin1()); eepromFileName = QDir(folder).filePath(eepromFileName.toLatin1());
+5 -5
View File
@@ -249,9 +249,9 @@ bool SimulatorWidget::setStartupData(const QByteArray & dataSource, bool fromFil
error = store.error(); error = store.error();
} }
else { else {
if (fileName.endsWith(".otx", Qt::CaseInsensitive)) { if (fileName.endsWith(".etx", Qt::CaseInsensitive)) {
// no radios can work with .otx files directly, so we load contents into either // no radios can work with .etx files directly, so we load contents into either
// a temporary folder (Horus) or local data array (other radios) which we'll save back to .otx upon exit // a temporary folder (Horus) or local data array (other radios) which we'll save back to .etx upon exit
if ((ret = setRadioData(&simuData))) { if ((ret = setRadioData(&simuData))) {
startupFromFile = false; startupFromFile = false;
return true; return true;
@@ -365,7 +365,7 @@ bool SimulatorWidget::useTempDataPath(bool deleteOnClose)
if (deleteTempRadioData) if (deleteTempRadioData)
deleteTempData(); deleteTempData();
QTemporaryDir tmpDir(QDir::tempPath() + "/otx-XXXXXX"); QTemporaryDir tmpDir(QDir::tempPath() + "/etx-XXXXXX");
if (tmpDir.isValid()) { if (tmpDir.isValid()) {
setDataPath(tmpDir.path()); setDataPath(tmpDir.path());
tmpDir.setAutoRemove(false); tmpDir.setAutoRemove(false);
@@ -379,7 +379,7 @@ bool SimulatorWidget::useTempDataPath(bool deleteOnClose)
} }
} }
// This will save radio data from temporary folder structure back into an .otx file, eg. for Horus. // This will save radio data from temporary folder structure back into an .etx file, eg. for Horus.
bool SimulatorWidget::saveTempData() bool SimulatorWidget::saveTempData()
{ {
bool ret = false; bool ret = false;
+1 -1
View File
@@ -127,7 +127,7 @@ CommandLineParseResult cliOptions(SimulatorOptions * simOptions, int * profileId
QApplication::translate("SimulatorMain", "type")); QApplication::translate("SimulatorMain", "type"));
cliOptions.addPositionalArgument(QApplication::translate("SimulatorMain", "data-source"), cliOptions.addPositionalArgument(QApplication::translate("SimulatorMain", "data-source"),
QApplication::translate("SimulatorMain", "Radio data (.bin/.eeprom/.otx) image file to use OR data folder path (for Horus-style radios).\n" QApplication::translate("SimulatorMain", "Radio data (.bin/.eeprom/.etx) image file to use OR data folder path (for Horus-style radios).\n"
"NOTE: any existing EEPROM data incompatible with the selected radio type may be overwritten!"), "NOTE: any existing EEPROM data incompatible with the selected radio type may be overwritten!"),
QApplication::translate("SimulatorMain", "[data-source]")); QApplication::translate("SimulatorMain", "[data-source]"));
+1 -1
View File
@@ -12,7 +12,7 @@ set(storage_NAMES
hexeeprom hexeeprom
categorized categorized
sdcard sdcard
otx etx
yaml yaml
) )
@@ -18,13 +18,13 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include "otx.h" #include "etx.h"
#include "miniz.c" #include "miniz.c"
#include <QFile> #include <QFile>
#define MZ_ALLOCATION_SIZE (32*1024) #define MZ_ALLOCATION_SIZE (32*1024)
bool OtxFormat::load(RadioData & radioData) bool EtxFormat::load(RadioData & radioData)
{ {
QFile file(filename); QFile file(filename);
@@ -40,7 +40,7 @@ bool OtxFormat::load(RadioData & radioData)
// open zip file // open zip file
memset(&zip_archive, 0, sizeof(zip_archive)); memset(&zip_archive, 0, sizeof(zip_archive));
if (!mz_zip_reader_init_mem(&zip_archive, archiveContents.data(), archiveContents.size(), 0)) { if (!mz_zip_reader_init_mem(&zip_archive, archiveContents.data(), archiveContents.size(), 0)) {
qDebug() << tr("Error opening OTX archive %1").arg(filename); qDebug() << tr("Error opening ETX archive %1").arg(filename);
return false; return false;
} }
@@ -49,13 +49,13 @@ bool OtxFormat::load(RadioData & radioData)
return result; return result;
} }
bool OtxFormat::write(const RadioData & radioData) bool EtxFormat::write(const RadioData & radioData)
{ {
qDebug() << "Saving to archive" << filename; qDebug() << "Saving to archive" << filename;
memset(&zip_archive, 0, sizeof(zip_archive)); memset(&zip_archive, 0, sizeof(zip_archive));
if (!mz_zip_writer_init_heap(&zip_archive, 0, MZ_ALLOCATION_SIZE)) { if (!mz_zip_writer_init_heap(&zip_archive, 0, MZ_ALLOCATION_SIZE)) {
setError(tr("Error initializing OTX archive writer")); setError(tr("Error initializing ETX archive writer"));
return false; return false;
} }
@@ -76,12 +76,12 @@ bool OtxFormat::write(const RadioData & radioData)
} }
} }
else { else {
setError(tr("Error creating OTX file %1:\n%2.").arg(filename).arg(file.errorString())); setError(tr("Error creating ETX file %1:\n%2.").arg(filename).arg(file.errorString()));
result = false; result = false;
} }
} }
else { else {
setError(tr("Error creating OTX archive")); setError(tr("Error creating ETX archive"));
result = false; result = false;
} }
} }
@@ -90,7 +90,7 @@ bool OtxFormat::write(const RadioData & radioData)
return result; return result;
} }
bool OtxFormat::loadFile(QByteArray & filedata, const QString & filename) bool EtxFormat::loadFile(QByteArray & filedata, const QString & filename)
{ {
size_t size; size_t size;
void * data = mz_zip_reader_extract_file_to_heap(&zip_archive, qPrintable(filename), &size, 0); void * data = mz_zip_reader_extract_file_to_heap(&zip_archive, qPrintable(filename), &size, 0);
@@ -105,10 +105,10 @@ bool OtxFormat::loadFile(QByteArray & filedata, const QString & filename)
return true; return true;
} }
bool OtxFormat::writeFile(const QByteArray & filedata, const QString & filename) bool EtxFormat::writeFile(const QByteArray & filedata, const QString & filename)
{ {
if (!mz_zip_writer_add_mem(&zip_archive, filename.toStdString().c_str(), filedata.data(), filedata.size(), MZ_DEFAULT_LEVEL)) { if (!mz_zip_writer_add_mem(&zip_archive, filename.toStdString().c_str(), filedata.data(), filedata.size(), MZ_DEFAULT_LEVEL)) {
setError(tr("Error adding %1 to OTX archive").arg(filename)); setError(tr("Error adding %1 to ETX archive").arg(filename));
return false; return false;
} }
@@ -18,8 +18,8 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#ifndef _OTX_H_ #ifndef _ETX_H_
#define _OTX_H_ #define _ETX_H_
#include "categorized.h" #include "categorized.h"
@@ -29,17 +29,17 @@
#include "miniz.c" #include "miniz.c"
#undef MINIZ_HEADER_FILE_ONLY #undef MINIZ_HEADER_FILE_ONLY
class OtxFormat : public CategorizedStorageFormat class EtxFormat : public CategorizedStorageFormat
{ {
Q_DECLARE_TR_FUNCTIONS(OtxFormat) Q_DECLARE_TR_FUNCTIONS(EtxFormat)
public: public:
OtxFormat(const QString & filename): EtxFormat(const QString & filename):
CategorizedStorageFormat(filename) CategorizedStorageFormat(filename)
{ {
} }
virtual QString name() { return "otx"; } virtual QString name() { return "etx"; }
virtual bool load(RadioData & radioData); virtual bool load(RadioData & radioData);
virtual bool write(const RadioData & radioData); virtual bool write(const RadioData & radioData);
@@ -50,4 +50,4 @@ class OtxFormat : public CategorizedStorageFormat
mz_zip_archive zip_archive; mz_zip_archive zip_archive;
}; };
#endif // _OTX_H_ #endif // _ETX_H_
+7 -7
View File
@@ -305,11 +305,11 @@ bool FirmwareInterface::seekSplash(QByteArray sps, QByteArray spe, int size)
return false; return false;
} }
#define OTX_SPS_9X "SPS\0\200\100" #define ETX_SPS_9X "SPS\0\200\100"
#define OTX_SPS_TARANIS "SPS\0\324\100" #define ETX_SPS_TARANIS "SPS\0\324\100"
#define OTX_SPS_SIZE 6 #define ETX_SPS_SIZE 6
#define OTX_SPE "SPE" #define ETX_SPE "SPE"
#define OTX_SPE_SIZE 4 #define ETX_SPE_SIZE 4
void FirmwareInterface::seekSplash() void FirmwareInterface::seekSplash()
{ {
@@ -342,11 +342,11 @@ void FirmwareInterface::seekSplash()
return; return;
} }
if (seekSplash(QByteArray(OTX_SPS_9X, OTX_SPS_SIZE), QByteArray(OTX_SPE, OTX_SPE_SIZE), 1024)) { if (seekSplash(QByteArray(ETX_SPS_9X, ETX_SPS_SIZE), QByteArray(ETX_SPE, ETX_SPE_SIZE), 1024)) {
return; return;
} }
if (seekSplash(QByteArray(OTX_SPS_TARANIS, OTX_SPS_SIZE), QByteArray(OTX_SPE, OTX_SPE_SIZE), RLE_SPLASH_MAX_SIZE)) { if (seekSplash(QByteArray(ETX_SPS_TARANIS, ETX_SPS_SIZE), QByteArray(ETX_SPE, ETX_SPE_SIZE), RLE_SPLASH_MAX_SIZE)) {
splashWidth = SPLASHX9D_WIDTH; splashWidth = SPLASHX9D_WIDTH;
splashHeight = SPLASHX9D_HEIGHT; splashHeight = SPLASHX9D_HEIGHT;
splash_format = QImage::Format_Indexed8; splash_format = QImage::Format_Indexed8;
+4 -2
View File
@@ -20,7 +20,7 @@
#include "bineeprom.h" #include "bineeprom.h"
#include "eepe.h" #include "eepe.h"
#include "otx.h" #include "etx.h"
#include "sdcard.h" #include "sdcard.h"
#include "yaml.h" #include "yaml.h"
#include "firmwareinterface.h" #include "firmwareinterface.h"
@@ -42,6 +42,8 @@ StorageType getStorageType(const QString & filename)
return STORAGE_TYPE_XML; return STORAGE_TYPE_XML;
else if (suffix == "OTX") else if (suffix == "OTX")
return STORAGE_TYPE_OTX; return STORAGE_TYPE_OTX;
else if (suffix == "ETX")
return STORAGE_TYPE_ETX;
else if (suffix == "YML") else if (suffix == "YML")
return STORAGE_TYPE_YML; return STORAGE_TYPE_YML;
else else
@@ -63,7 +65,7 @@ void registerStorageFactories()
registerStorageFactory(new DefaultStorageFactory<BinEepromFormat>("bin")); registerStorageFactory(new DefaultStorageFactory<BinEepromFormat>("bin"));
registerStorageFactory(new DefaultStorageFactory<EepeFormat>("eepe")); registerStorageFactory(new DefaultStorageFactory<EepeFormat>("eepe"));
registerStorageFactory(new DefaultStorageFactory<HexEepromFormat>("hex")); registerStorageFactory(new DefaultStorageFactory<HexEepromFormat>("hex"));
registerStorageFactory(new DefaultStorageFactory<OtxFormat>("otx")); registerStorageFactory(new DefaultStorageFactory<EtxFormat>("etx"));
registerStorageFactory(new DefaultStorageFactory<YamlFormat>("yml")); registerStorageFactory(new DefaultStorageFactory<YamlFormat>("yml"));
registerStorageFactory(new SdcardStorageFactory()); registerStorageFactory(new SdcardStorageFactory());
} }
+2 -1
View File
@@ -37,7 +37,8 @@ enum StorageType
STORAGE_TYPE_XML, STORAGE_TYPE_XML,
STORAGE_TYPE_SDCARD, STORAGE_TYPE_SDCARD,
STORAGE_TYPE_OTX, STORAGE_TYPE_OTX,
STORAGE_TYPE_YML STORAGE_TYPE_YML,
STORAGE_TYPE_ETX
}; };
StorageType getStorageType(const QString & filename); StorageType getStorageType(const QString & filename);
+11 -11
View File
@@ -1,6 +1,6 @@
#include "gtests.h" #include "gtests.h"
#include "location.h" #include "location.h"
#include "storage/otx.h" #include "storage/etx.h"
#include "storage/storage.h" #include "storage/storage.h"
#include "firmwares/opentx/opentxinterface.h" #include "firmwares/opentx/opentxinterface.h"
#include "firmwares/customfunctiondata.h" #include "firmwares/customfunctiondata.h"
@@ -210,12 +210,12 @@ TEST(Conversions, ConversionX10From22)
{ {
QByteArray byteBuffer; QByteArray byteBuffer;
#define USE_OTX #define USE_ETX
#if defined(USE_OTX) #if defined(USE_ETX)
OtxFormat otx(RADIO_TESTS_PATH "/model_22_x10.otx"); EtxFormat etx(RADIO_TESTS_PATH "/model_22_x10.etx");
RadioData radio; RadioData radio;
EXPECT_EQ(true, otx.load(radio)); EXPECT_EQ(true, etx.load(radio));
const GeneralSettings& settings = radio.generalSettings; const GeneralSettings& settings = radio.generalSettings;
const ModelData& model = radio.models[0]; const ModelData& model = radio.models[0];
@@ -253,7 +253,7 @@ TEST(Conversions, ConversionX10From22)
EXPECT_STREQ("BT_X10", settings.bluetoothName); EXPECT_STREQ("BT_X10", settings.bluetoothName);
EXPECT_STREQ("EdgeTX", settings.themeData.themeName); EXPECT_STREQ("EdgeTX", settings.themeData.themeName);
#if !defined(USE_OTX) #if !defined(USE_ETX)
byteBuffer.clear(); byteBuffer.clear();
ASSERT_EQ(true, loadFile(byteBuffer, RADIO_TESTS_PATH "/model_22_x10/MODELS/model1.bin")); ASSERT_EQ(true, loadFile(byteBuffer, RADIO_TESTS_PATH "/model_22_x10/MODELS/model1.bin"));
@@ -295,12 +295,12 @@ TEST(Conversions, ConversionX12SFrom22)
{ {
QByteArray byteBuffer; QByteArray byteBuffer;
#define USE_OTX #define USE_ETX
#if defined(USE_OTX) #if defined(USE_ETX)
OtxFormat otx(RADIO_TESTS_PATH "/model_22_x12s.otx"); EtxFormat etx(RADIO_TESTS_PATH "/model_22_x12s.etx");
RadioData radio; RadioData radio;
EXPECT_EQ(true, otx.load(radio)); EXPECT_EQ(true, etx.load(radio));
const GeneralSettings& settings = radio.generalSettings; const GeneralSettings& settings = radio.generalSettings;
const ModelData& model = radio.models[0]; const ModelData& model = radio.models[0];
@@ -330,7 +330,7 @@ TEST(Conversions, ConversionX12SFrom22)
EXPECT_STREQ("BT", settings.bluetoothName); EXPECT_STREQ("BT", settings.bluetoothName);
EXPECT_STREQ("EdgeTX", settings.themeData.themeName); EXPECT_STREQ("EdgeTX", settings.themeData.themeName);
#if !defined(USE_OTX) #if !defined(USE_ETX)
byteBuffer.clear(); byteBuffer.clear();
ASSERT_EQ(true, loadFile(byteBuffer, RADIO_TESTS_PATH "/model_22_x10/MODELS/model1.bin")); ASSERT_EQ(true, loadFile(byteBuffer, RADIO_TESTS_PATH "/model_22_x10/MODELS/model1.bin"));
+1 -1
View File
@@ -1507,7 +1507,7 @@ then the loaded script (or "chunk") is returned as a function. Otherwise, return
as part of the file name and the .lua/.luac will be appended to that. as part of the file name and the .lua/.luac will be appended to that.
@param mode (string) (optional) Controls whether to force loading the text (.lua) or pre-compiled binary (.luac) @param mode (string) (optional) Controls whether to force loading the text (.lua) or pre-compiled binary (.luac)
version of the script. By default OTx will load the newest version and compile a new binary if necessary (overwriting any version of the script. By default ETX will load the newest version and compile a new binary if necessary (overwriting any
existing .luac version of the same script, and stripping some debug info like line numbers). existing .luac version of the same script, and stripping some debug info like line numbers).
You can use `mode` to control the loading behavior more specifically. Possible values are: You can use `mode` to control the loading behavior more specifically. Possible values are:
* `b` only binary. * `b` only binary.
+3 -3
View File
@@ -158,7 +158,7 @@ static int luaModelGetModule(lua_State *L)
if (module.type == MODULE_TYPE_MULTIMODULE) { if (module.type == MODULE_TYPE_MULTIMODULE) {
int protocol = g_model.moduleData[idx].getMultiProtocol() + 1; int protocol = g_model.moduleData[idx].getMultiProtocol() + 1;
int subprotocol = g_model.moduleData[idx].subType; int subprotocol = g_model.moduleData[idx].subType;
convertOtxProtocolToMulti(&protocol, &subprotocol); // Special treatment for the FrSky entry... convertEtxProtocolToMulti(&protocol, &subprotocol); // Special treatment for the FrSky entry...
lua_pushtableinteger(L, "protocol", protocol); lua_pushtableinteger(L, "protocol", protocol);
lua_pushtableinteger(L, "subProtocol", subprotocol); lua_pushtableinteger(L, "subProtocol", subprotocol);
if (getMultiModuleStatus(idx).isValid()) { if (getMultiModuleStatus(idx).isValid()) {
@@ -231,8 +231,8 @@ static int luaModelSetModule(lua_State *L)
#endif #endif
} }
#if defined(MULTIMODULE) #if defined(MULTIMODULE)
if (protocol > 0 && subprotocol >= 0) { // Both are needed to compute otx protocol if (protocol > 0 && subprotocol >= 0) { // Both are needed to compute etx protocol
convertMultiProtocolToOtx(&protocol, &subprotocol); convertMultiProtocolToEtx(&protocol, &subprotocol);
g_model.moduleData[idx].setMultiProtocol(protocol - 1); g_model.moduleData[idx].setMultiProtocol(protocol - 1);
g_model.moduleData[idx].subType = subprotocol; g_model.moduleData[idx].subType = subprotocol;
} }
+4 -4
View File
@@ -53,7 +53,7 @@ static void sendDSM(uint8_t moduleIdx);
void multiPatchCustom(uint8_t moduleIdx) void multiPatchCustom(uint8_t moduleIdx)
{ {
if (g_model.moduleData[moduleIdx].multi.customProto) { if (g_model.moduleData[moduleIdx].multi.customProto) {
uint8_t type = g_model.moduleData[moduleIdx].getMultiProtocol() - 1; // custom where starting at 1, otx list at 0 uint8_t type = g_model.moduleData[moduleIdx].getMultiProtocol() - 1; // custom where starting at 1, etx list at 0
int subtype = g_model.moduleData[moduleIdx].subType; int subtype = g_model.moduleData[moduleIdx].subType;
g_model.moduleData[moduleIdx].multi.customProto = 0; g_model.moduleData[moduleIdx].multi.customProto = 0;
@@ -268,7 +268,7 @@ void sendChannels(uint8_t moduleIdx)
} }
} }
void convertMultiProtocolToOtx(int *protocol, int *subprotocol) void convertMultiProtocolToEtx(int *protocol, int *subprotocol)
{ {
if (*protocol == 3 && *subprotocol == 0) { if (*protocol == 3 && *subprotocol == 0) {
*protocol = MODULE_SUBTYPE_MULTI_FRSKY + 1; *protocol = MODULE_SUBTYPE_MULTI_FRSKY + 1;
@@ -312,7 +312,7 @@ void convertMultiProtocolToOtx(int *protocol, int *subprotocol)
*protocol -= 1; *protocol -= 1;
} }
void convertOtxProtocolToMulti(int *protocol, int *subprotocol) void convertEtxProtocolToMulti(int *protocol, int *subprotocol)
{ {
// Special treatment for the FrSky entry... // Special treatment for the FrSky entry...
if (*protocol == MODULE_SUBTYPE_MULTI_FRSKY + 1) { if (*protocol == MODULE_SUBTYPE_MULTI_FRSKY + 1) {
@@ -407,7 +407,7 @@ void sendFrameProtocolHeader(uint8_t moduleIdx, bool failsafe)
} }
// Special treatment for the FrSky entry... // Special treatment for the FrSky entry...
convertOtxProtocolToMulti(&type, &subtype); convertEtxProtocolToMulti(&type, &subtype);
// Set the highest bit of option byte in AFHDS2A protocol to instruct MULTI to passthrough telemetry bytes instead // Set the highest bit of option byte in AFHDS2A protocol to instruct MULTI to passthrough telemetry bytes instead
// of sending Frsky D telemetry // of sending Frsky D telemetry
+2 -2
View File
@@ -25,8 +25,8 @@
#include "pulses_common.h" #include "pulses_common.h"
void multiPatchCustom(uint8_t moduleIdx); void multiPatchCustom(uint8_t moduleIdx);
void convertOtxProtocolToMulti(int *protocol, int *subprotocol); void convertEtxProtocolToMulti(int *protocol, int *subprotocol);
void convertMultiProtocolToOtx(int *protocol, int *subprotocol); void convertMultiProtocolToEtx(int *protocol, int *subprotocol);
class UartMultiPulses: public DataBuffer<uint8_t, 64> class UartMultiPulses: public DataBuffer<uint8_t, 64>
{ {
+20 -20
View File
@@ -133,45 +133,45 @@ inline const char * SDCARD_ERROR(FRESULT result)
const char * getBasename(const char * path); const char * getBasename(const char * path);
#if defined(PCBX12S) #if defined(PCBX12S)
#define OTX_FOURCC 0x3478746F // otx for X12S #define ETX_FOURCC 0x3478746F // etx for X12S
#elif defined(RADIO_T16) #elif defined(RADIO_T16)
#define OTX_FOURCC 0x3F78746F // otx for Jumper T16 #define ETX_FOURCC 0x3F78746F // etx for Jumper T16
#elif defined(RADIO_T18) #elif defined(RADIO_T18)
#define OTX_FOURCC 0x4078746F // otx for Jumper T18 #define ETX_FOURCC 0x4078746F // etx for Jumper T18
#elif defined(RADIO_TX16S) #elif defined(RADIO_TX16S)
#define OTX_FOURCC 0x3878746F // otx for Radiomaster TX16S #define ETX_FOURCC 0x3878746F // etx for Radiomaster TX16S
#elif defined(PCBX10) #elif defined(PCBX10)
#define OTX_FOURCC 0x3778746F // otx for X10 #define ETX_FOURCC 0x3778746F // etx for X10
#elif defined(PCBX9E) #elif defined(PCBX9E)
#define OTX_FOURCC 0x3578746F // otx for Taranis X9E #define ETX_FOURCC 0x3578746F // etx for Taranis X9E
#elif defined(PCBXLITES) #elif defined(PCBXLITES)
#define OTX_FOURCC 0x3B78746F // otx for Taranis X-Lite S #define ETX_FOURCC 0x3B78746F // etx for Taranis X-Lite S
#elif defined(PCBXLITE) #elif defined(PCBXLITE)
#define OTX_FOURCC 0x3978746F // otx for Taranis X-Lite #define ETX_FOURCC 0x3978746F // etx for Taranis X-Lite
#elif defined(RADIO_T12) #elif defined(RADIO_T12)
#define OTX_FOURCC 0x3D78746F // otx for Jumper T12 #define ETX_FOURCC 0x3D78746F // etx for Jumper T12
#elif defined(RADIO_TLITE) #elif defined(RADIO_TLITE)
#define OTX_FOURCC 0x4278746F // otx for Jumper TLite #define ETX_FOURCC 0x4278746F // etx for Jumper TLite
#elif defined(RADIO_TPRO) #elif defined(RADIO_TPRO)
#define OTX_FOURCC 0x4678746F // otx for Jumper TPro #define ETX_FOURCC 0x4678746F // etx for Jumper TPro
#elif defined(RADIO_TX12) #elif defined(RADIO_TX12)
#define OTX_FOURCC 0x4178746F // otx for Radiomaster TX12 #define ETX_FOURCC 0x4178746F // etx for Radiomaster TX12
#elif defined(RADIO_ZORRO) #elif defined(RADIO_ZORRO)
#define OTX_FOURCC 0x4778746F // otx for Radiomaster Zorro #define ETX_FOURCC 0x4778746F // otx for Radiomaster Zorro
#elif defined(RADIO_T8) #elif defined(RADIO_T8)
#define OTX_FOURCC 0x4378746F // otx for Radiomaster T8 #define ETX_FOURCC 0x4378746F // etx for Radiomaster T8
#elif defined(PCBX7) #elif defined(PCBX7)
#define OTX_FOURCC 0x3678746F // otx for Taranis X7 / X7S / X7 Express / X7S Express #define ETX_FOURCC 0x3678746F // etx for Taranis X7 / X7S / X7 Express / X7S Express
#elif defined(PCBX9LITES) #elif defined(PCBX9LITES)
#define OTX_FOURCC 0x3E78746F // otx for Taranis X9-Lite S #define ETX_FOURCC 0x3E78746F // etx for Taranis X9-Lite S
#elif defined(PCBX9LITE) #elif defined(PCBX9LITE)
#define OTX_FOURCC 0x3C78746F // otx for Taranis X9-Lite #define ETX_FOURCC 0x3C78746F // etx for Taranis X9-Lite
#elif defined(PCBX9D) || defined(PCBX9DP) #elif defined(PCBX9D) || defined(PCBX9DP)
#define OTX_FOURCC 0x3378746F // otx for Taranis X9D #define ETX_FOURCC 0x3378746F // etx for Taranis X9D
#elif defined(PCBNV14) #elif defined(PCBNV14)
#define OTX_FOURCC 0x3A78746F // otx for NV14 #define ETX_FOURCC 0x3A78746F // etx for NV14
#elif defined(PCBSKY9X) #elif defined(PCBSKY9X)
#define OTX_FOURCC 0x3278746F // otx for sky9x #define ETX_FOURCC 0x3278746F // etx for sky9x
#endif #endif
bool isFileAvailable(const char * filename, bool exclDir = false); bool isFileAvailable(const char * filename, bool exclDir = false);
@@ -1132,7 +1132,7 @@ bool w_modSubtype(void* user, uint8_t* data, uint32_t bitoffs,
// data as-is (no FrSky special casing) // data as-is (no FrSky special casing)
int type = md->getMultiProtocol() + 1; int type = md->getMultiProtocol() + 1;
int subtype = val; int subtype = val;
convertOtxProtocolToMulti(&type, &subtype); convertEtxProtocolToMulti(&type, &subtype);
// output "[type],[subtype]" // output "[type],[subtype]"
str = yaml_unsigned2str(type); str = yaml_unsigned2str(type);
+2 -2
View File
@@ -473,7 +473,7 @@ const char * eeBackupModel(uint8_t i_fileSrc)
uint16_t size = eeModelSize(i_fileSrc); uint16_t size = eeModelSize(i_fileSrc);
*(uint32_t*)&buf[0] = OTX_FOURCC; *(uint32_t*)&buf[0] = ETX_FOURCC;
buf[4] = g_eeGeneral.version; buf[4] = g_eeGeneral.version;
buf[5] = 'M'; buf[5] = 'M';
*(uint16_t*)&buf[6] = size; *(uint16_t*)&buf[6] = size;
@@ -540,7 +540,7 @@ const char * eeRestoreModel(uint8_t i_fileDst, char *model_name)
} }
uint8_t version = (uint8_t)buf[4]; uint8_t version = (uint8_t)buf[4];
if (*(uint32_t*)&buf[0] != OTX_FOURCC || version < FIRST_CONV_EEPROM_VER || version > EEPROM_VER || buf[5] != 'M') { if (*(uint32_t*)&buf[0] != ETX_FOURCC || version < FIRST_CONV_EEPROM_VER || version > EEPROM_VER || buf[5] != 'M') {
f_close(&restoreFile); f_close(&restoreFile);
return STR_INCOMPATIBLE; return STR_INCOMPATIBLE;
} }
+2 -2
View File
@@ -508,7 +508,7 @@ const char * eeBackupModel(uint8_t i_fileSrc)
EFile theFile2; EFile theFile2;
theFile2.openRd(FILE_MODEL(i_fileSrc)); theFile2.openRd(FILE_MODEL(i_fileSrc));
*(uint32_t*)&buf[0] = OTX_FOURCC; *(uint32_t*)&buf[0] = ETX_FOURCC;
buf[4] = g_eeGeneral.version; buf[4] = g_eeGeneral.version;
buf[5] = 'M'; buf[5] = 'M';
*(uint16_t*)&buf[6] = eeModelSize(i_fileSrc); *(uint16_t*)&buf[6] = eeModelSize(i_fileSrc);
@@ -561,7 +561,7 @@ const char * eeRestoreModel(uint8_t i_fileDst, char *model_name)
} }
uint8_t version = (uint8_t)buf[4]; uint8_t version = (uint8_t)buf[4];
if (*(uint32_t*)&buf[0] != OTX_FOURCC || version < FIRST_CONV_EEPROM_VER || version > EEPROM_VER || buf[5] != 'M') { if (*(uint32_t*)&buf[0] != ETX_FOURCC || version < FIRST_CONV_EEPROM_VER || version > EEPROM_VER || buf[5] != 'M') {
f_close(&g_oLogFile); f_close(&g_oLogFile);
return STR_INCOMPATIBLE; return STR_INCOMPATIBLE;
} }
+2 -2
View File
@@ -37,7 +37,7 @@ const char *writeFileBin(const char *filename, const uint8_t *data,
return SDCARD_ERROR(result); return SDCARD_ERROR(result);
} }
*(uint32_t*)&buf[0] = OTX_FOURCC; *(uint32_t*)&buf[0] = ETX_FOURCC;
buf[4] = version; buf[4] = version;
buf[5] = 'M'; buf[5] = 'M';
*(uint16_t*)&buf[6] = size; *(uint16_t*)&buf[6] = size;
@@ -99,7 +99,7 @@ const char* openFileBin(const char * fullpath, FIL * file, uint16_t * size, uint
} }
*version = (uint8_t)buf[4]; *version = (uint8_t)buf[4];
if (*(uint32_t *)&buf[0] != OTX_FOURCC || *version < FIRST_CONV_EEPROM_VER || if (*(uint32_t *)&buf[0] != ETX_FOURCC || *version < FIRST_CONV_EEPROM_VER ||
*version > EEPROM_VER || buf[5] != 'M') { *version > EEPROM_VER || buf[5] != 'M') {
f_close(file); f_close(file);
return STR_INCOMPATIBLE; return STR_INCOMPATIBLE;
@@ -1646,8 +1646,8 @@ static void r_modSubtype(void* user, uint8_t* data, uint32_t bitoffs,
val++; val_len--; val++; val_len--;
int subtype = yaml_str2uint(val, val_len); int subtype = yaml_str2uint(val, val_len);
// convert to OTX format and write to vars // convert to ETX format and write to vars
convertMultiProtocolToOtx(&type, &subtype); convertMultiProtocolToEtx(&type, &subtype);
if (type > 0) { if (type > 0) {
md->setMultiProtocol(type - 1); md->setMultiProtocol(type - 1);
md->subType = subtype; md->subType = subtype;
+5 -5
View File
@@ -32,7 +32,7 @@
#define GET_SWITCH_BOOL(sw__) getSwitch((sw__), 0); #define GET_SWITCH_BOOL(sw__) getSwitch((sw__), 0);
#define OTXS_DBG qDebug() << "(" << simuTimerMicros() << "us)" #define ETXS_DBG qDebug() << "(" << simuTimerMicros() << "us)"
int16_t g_anas[Analogs::NUM_ANALOGS]; int16_t g_anas[Analogs::NUM_ANALOGS];
QVector<QIODevice *> OpenTxSimulator::tracebackDevices; QVector<QIODevice *> OpenTxSimulator::tracebackDevices;
@@ -106,7 +106,7 @@ void OpenTxSimulator::init()
if (isRunning()) if (isRunning())
return; return;
OTXS_DBG; ETXS_DBG;
if (!m_timer10ms) { if (!m_timer10ms) {
// make sure we create & control the timer from current thread // make sure we create & control the timer from current thread
@@ -134,7 +134,7 @@ void OpenTxSimulator::start(const char * filename, bool tests)
{ {
if (isRunning()) if (isRunning())
return; return;
OTXS_DBG << "file:" << filename << "tests:" << tests; ETXS_DBG << "file:" << filename << "tests:" << tests;
QMutexLocker lckr(&m_mtxSimuMain); QMutexLocker lckr(&m_mtxSimuMain);
QMutexLocker slckr(&m_mtxSettings); QMutexLocker slckr(&m_mtxSettings);
@@ -150,7 +150,7 @@ void OpenTxSimulator::stop()
{ {
if (!isRunning()) if (!isRunning())
return; return;
OTXS_DBG; ETXS_DBG;
setStopRequested(true); setStopRequested(true);
@@ -380,7 +380,7 @@ void OpenTxSimulator::setTrainerTimeout(uint16_t ms)
void OpenTxSimulator::sendTelemetry(const QByteArray data) void OpenTxSimulator::sendTelemetry(const QByteArray data)
{ {
//OTXS_DBG << data; //ETXS_DBG << data;
sportProcessTelemetryPacket((uint8_t *)data.constData()); sportProcessTelemetryPacket((uint8_t *)data.constData());
} }
+2 -2
View File
@@ -19,9 +19,9 @@ if(GTEST_INCDIR AND GTEST_SRCDIR AND Qt5Widgets_FOUND)
foreach(model_file ${EXTRACT_MODEL_FILES}) foreach(model_file ${EXTRACT_MODEL_FILES})
add_custom_command( add_custom_command(
DEPENDS ${TESTS_PATH}/${model_file}.otx DEPENDS ${TESTS_PATH}/${model_file}.etx
OUTPUT ${TESTS_BUILD_PATH}/${model_file}/RADIO/radio.bin OUTPUT ${TESTS_BUILD_PATH}/${model_file}/RADIO/radio.bin
COMMAND mkdir -p ${model_file} && cd ${model_file} && unzip -o -q -DD ${TESTS_PATH}/${model_file}.otx >/dev/null COMMAND mkdir -p ${model_file} && cd ${model_file} && unzip -o -q -DD ${TESTS_PATH}/${model_file}.etx >/dev/null
WORKING_DIRECTORY ${TESTS_BUILD_PATH} WORKING_DIRECTORY ${TESTS_BUILD_PATH}
) )
add_custom_target(${model_file}_files add_custom_target(${model_file}_files