From 89517d8bd8fdb40b3d03f868dba7add60c39abc6 Mon Sep 17 00:00:00 2001 From: rotorman Date: Sat, 13 Nov 2021 16:30:37 +0100 Subject: [PATCH] Use ETX instead of OTX (also as a file extension). --- companion/src/constants.h | 3 +- companion/src/mainwindow.cpp | 4 +- companion/src/mdichild.cpp | 6 +-- companion/src/mdichild.h | 2 +- .../src/simulation/simulatorstartupdialog.cpp | 2 +- companion/src/simulation/simulatorwidget.cpp | 10 ++--- companion/src/simulator.cpp | 2 +- companion/src/storage/CMakeLists.txt | 2 +- companion/src/storage/{otx.cpp => etx.cpp} | 20 ++++----- companion/src/storage/{otx.h => etx.h} | 14 +++--- companion/src/storage/firmwareinterface.cpp | 14 +++--- companion/src/storage/storage.cpp | 6 ++- companion/src/storage/storage.h | 3 +- companion/src/tests/conversions.cpp | 22 +++++----- radio/src/lua/api_general.cpp | 2 +- radio/src/lua/api_model.cpp | 6 +-- radio/src/pulses/multi.cpp | 8 ++-- radio/src/pulses/multi.h | 4 +- radio/src/sdcard.h | 40 +++++++++--------- .../yaml/yaml_datastructs_funcs.cpp | 2 +- radio/src/storage/eeprom_raw.cpp | 4 +- radio/src/storage/eeprom_rlc.cpp | 4 +- radio/src/storage/sdcard_raw.cpp | 4 +- .../storage/yaml/yaml_datastructs_funcs.cpp | 4 +- radio/src/targets/simu/opentxsimulator.cpp | 10 ++--- radio/src/tests/CMakeLists.txt | 4 +- .../{model_23_x10.otx => model_23_x10.etx} | Bin .../{model_23_x12s.otx => model_23_x12s.etx} | Bin ...{model_25_tx16s.otx => model_25_tx16s.etx} | Bin 29 files changed, 103 insertions(+), 99 deletions(-) rename companion/src/storage/{otx.cpp => etx.cpp} (84%) rename companion/src/storage/{otx.h => etx.h} (84%) rename radio/src/tests/{model_23_x10.otx => model_23_x10.etx} (100%) rename radio/src/tests/{model_23_x12s.otx => model_23_x12s.etx} (100%) rename radio/src/tests/{model_25_tx16s.otx => model_25_tx16s.etx} (100%) diff --git a/companion/src/constants.h b/companion/src/constants.h index b06792a91..5a6511168 100644 --- a/companion/src/constants.h +++ b/companion/src/constants.h @@ -60,8 +60,9 @@ #define DFU_FILES_FILTER "DFU " % CPN_STR_FILES % " (*.dfu);;" #define EEPE_FILES_FILTER "EEPE " % CPN_STR_FILES % " (*.eepe);;" #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 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 EXTERNAL_EEPROM_FILES_FILTER "EEPROM " % CPN_STR_FILES % " (*.bin *.hex);;" % BIN_FILES_FILTER % HEX_FILES_FILTER #define ER9X_EEPROM_FILE_TYPE "ER9X_EEPROM_FILE" diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp index 54d06c071..e1465f9f3 100644 --- a/companion/src/mainwindow.cpp +++ b/companion/src/mainwindow.cpp @@ -157,7 +157,7 @@ MainWindow::MainWindow(): if (!str.isEmpty()) { 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(); if (child->loadFile(str)) { if (!(printing && model >= 0 && (getCurrentFirmware()->getCapability(Models) == 0 || modelgetCapability(Models)) && !printfilename.isEmpty())) { @@ -908,7 +908,7 @@ void MainWindow::readEeprom() Board::Type board = getCurrentBoard(); QString tempFile; if (IS_FAMILY_HORUS_OR_T16(board)) - tempFile = generateProcessUniqueTempFileName("temp.otx"); + tempFile = generateProcessUniqueTempFileName("temp.etx"); else tempFile = generateProcessUniqueTempFileName("temp.bin"); diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp index 600f44851..14a4266b1 100644 --- a/companion/src/mdichild.cpp +++ b/companion/src/mdichild.cpp @@ -1320,7 +1320,7 @@ void MdiChild::newFile(bool createDefaults) { static int sequenceNumber = 1; isUntitled = true; - curFile = QString("document%1.otx").arg(sequenceNumber++); + curFile = QString("document%1.etx").arg(sequenceNumber++); updateTitle(); if (createDefaults && firmware->getCapability(Capability::HasModelCategories)) { @@ -1375,7 +1375,7 @@ bool MdiChild::saveAs(bool isNew) #ifdef __APPLE__ QString filter; #else - QString filter(OTX_FILES_FILTER % YML_FILES_FILTER); + QString filter(ETX_FILES_FILTER % YML_FILES_FILTER); #endif 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) { - 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) diff --git a/companion/src/mdichild.h b/companion/src/mdichild.h index 079205cc1..b44047aba 100644 --- a/companion/src/mdichild.h +++ b/companion/src/mdichild.h @@ -179,7 +179,7 @@ class MdiChild : public QWidget bool maybeSave(); 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); void showWarning(const QString & msg); int askQuestion(const QString & msg, QMessageBox::StandardButtons buttons = (QMessageBox::Yes | QMessageBox::No), QMessageBox::StandardButton defaultButton = QMessageBox::No); diff --git a/companion/src/simulation/simulatorstartupdialog.cpp b/companion/src/simulation/simulatorstartupdialog.cpp index e48a32afe..8d70a2b50 100644 --- a/companion/src/simulation/simulatorstartupdialog.cpp +++ b/companion/src/simulation/simulatorstartupdialog.cpp @@ -120,7 +120,7 @@ QString SimulatorStartupDialog::radioEepromFileName(const QString & firmwareId, if (pos > 0) radioId = radioId.mid(pos+1); if (usesCategorizedStorage(radioId)) - ext = "otx"; + ext = "etx"; eepromFileName = QString("eeprom-%1.%2").arg(radioId, ext); eepromFileName = QDir(folder).filePath(eepromFileName.toLatin1()); diff --git a/companion/src/simulation/simulatorwidget.cpp b/companion/src/simulation/simulatorwidget.cpp index 8f3ef08c2..365cb57d4 100644 --- a/companion/src/simulation/simulatorwidget.cpp +++ b/companion/src/simulation/simulatorwidget.cpp @@ -249,9 +249,9 @@ bool SimulatorWidget::setStartupData(const QByteArray & dataSource, bool fromFil error = store.error(); } else { - if (fileName.endsWith(".otx", Qt::CaseInsensitive)) { - // no radios can work with .otx 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 + if (fileName.endsWith(".etx", Qt::CaseInsensitive)) { + // 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 .etx upon exit if ((ret = setRadioData(&simuData))) { startupFromFile = false; return true; @@ -365,7 +365,7 @@ bool SimulatorWidget::useTempDataPath(bool deleteOnClose) if (deleteTempRadioData) deleteTempData(); - QTemporaryDir tmpDir(QDir::tempPath() + "/otx-XXXXXX"); + QTemporaryDir tmpDir(QDir::tempPath() + "/etx-XXXXXX"); if (tmpDir.isValid()) { setDataPath(tmpDir.path()); 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 ret = false; diff --git a/companion/src/simulator.cpp b/companion/src/simulator.cpp index 283248496..7caca8e97 100644 --- a/companion/src/simulator.cpp +++ b/companion/src/simulator.cpp @@ -127,7 +127,7 @@ CommandLineParseResult cliOptions(SimulatorOptions * simOptions, int * profileId QApplication::translate("SimulatorMain", "type")); 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!"), QApplication::translate("SimulatorMain", "[data-source]")); diff --git a/companion/src/storage/CMakeLists.txt b/companion/src/storage/CMakeLists.txt index 8df237238..2781b50b9 100644 --- a/companion/src/storage/CMakeLists.txt +++ b/companion/src/storage/CMakeLists.txt @@ -12,7 +12,7 @@ set(storage_NAMES hexeeprom categorized sdcard - otx + etx yaml ) diff --git a/companion/src/storage/otx.cpp b/companion/src/storage/etx.cpp similarity index 84% rename from companion/src/storage/otx.cpp rename to companion/src/storage/etx.cpp index 90ea2bbf8..e79d9d477 100644 --- a/companion/src/storage/otx.cpp +++ b/companion/src/storage/etx.cpp @@ -18,13 +18,13 @@ * GNU General Public License for more details. */ -#include "otx.h" +#include "etx.h" #include "miniz.c" #include #define MZ_ALLOCATION_SIZE (32*1024) -bool OtxFormat::load(RadioData & radioData) +bool EtxFormat::load(RadioData & radioData) { QFile file(filename); @@ -40,7 +40,7 @@ bool OtxFormat::load(RadioData & radioData) // open zip file memset(&zip_archive, 0, sizeof(zip_archive)); 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; } @@ -49,13 +49,13 @@ bool OtxFormat::load(RadioData & radioData) return result; } -bool OtxFormat::write(const RadioData & radioData) +bool EtxFormat::write(const RadioData & radioData) { qDebug() << "Saving to archive" << filename; memset(&zip_archive, 0, sizeof(zip_archive)); 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; } @@ -76,12 +76,12 @@ bool OtxFormat::write(const RadioData & radioData) } } 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; } } else { - setError(tr("Error creating OTX archive")); + setError(tr("Error creating ETX archive")); result = false; } } @@ -90,7 +90,7 @@ bool OtxFormat::write(const RadioData & radioData) return result; } -bool OtxFormat::loadFile(QByteArray & filedata, const QString & filename) +bool EtxFormat::loadFile(QByteArray & filedata, const QString & filename) { size_t size; 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; } -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)) { - setError(tr("Error adding %1 to OTX archive").arg(filename)); + setError(tr("Error adding %1 to ETX archive").arg(filename)); return false; } diff --git a/companion/src/storage/otx.h b/companion/src/storage/etx.h similarity index 84% rename from companion/src/storage/otx.h rename to companion/src/storage/etx.h index da4923488..8c7002ed2 100644 --- a/companion/src/storage/otx.h +++ b/companion/src/storage/etx.h @@ -18,8 +18,8 @@ * GNU General Public License for more details. */ -#ifndef _OTX_H_ -#define _OTX_H_ +#ifndef _ETX_H_ +#define _ETX_H_ #include "categorized.h" @@ -29,17 +29,17 @@ #include "miniz.c" #undef MINIZ_HEADER_FILE_ONLY -class OtxFormat : public CategorizedStorageFormat +class EtxFormat : public CategorizedStorageFormat { - Q_DECLARE_TR_FUNCTIONS(OtxFormat) + Q_DECLARE_TR_FUNCTIONS(EtxFormat) public: - OtxFormat(const QString & filename): + EtxFormat(const QString & filename): CategorizedStorageFormat(filename) { } - virtual QString name() { return "otx"; } + virtual QString name() { return "etx"; } virtual bool load(RadioData & radioData); virtual bool write(const RadioData & radioData); @@ -50,4 +50,4 @@ class OtxFormat : public CategorizedStorageFormat mz_zip_archive zip_archive; }; -#endif // _OTX_H_ +#endif // _ETX_H_ diff --git a/companion/src/storage/firmwareinterface.cpp b/companion/src/storage/firmwareinterface.cpp index 4357928d1..79ca4a2fe 100644 --- a/companion/src/storage/firmwareinterface.cpp +++ b/companion/src/storage/firmwareinterface.cpp @@ -305,11 +305,11 @@ bool FirmwareInterface::seekSplash(QByteArray sps, QByteArray spe, int size) return false; } -#define OTX_SPS_9X "SPS\0\200\100" -#define OTX_SPS_TARANIS "SPS\0\324\100" -#define OTX_SPS_SIZE 6 -#define OTX_SPE "SPE" -#define OTX_SPE_SIZE 4 +#define ETX_SPS_9X "SPS\0\200\100" +#define ETX_SPS_TARANIS "SPS\0\324\100" +#define ETX_SPS_SIZE 6 +#define ETX_SPE "SPE" +#define ETX_SPE_SIZE 4 void FirmwareInterface::seekSplash() { @@ -342,11 +342,11 @@ void FirmwareInterface::seekSplash() 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; } - 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; splashHeight = SPLASHX9D_HEIGHT; splash_format = QImage::Format_Indexed8; diff --git a/companion/src/storage/storage.cpp b/companion/src/storage/storage.cpp index 63a5f429e..8ec511769 100644 --- a/companion/src/storage/storage.cpp +++ b/companion/src/storage/storage.cpp @@ -20,7 +20,7 @@ #include "bineeprom.h" #include "eepe.h" -#include "otx.h" +#include "etx.h" #include "sdcard.h" #include "yaml.h" #include "firmwareinterface.h" @@ -42,6 +42,8 @@ StorageType getStorageType(const QString & filename) return STORAGE_TYPE_XML; else if (suffix == "OTX") return STORAGE_TYPE_OTX; + else if (suffix == "ETX") + return STORAGE_TYPE_ETX; else if (suffix == "YML") return STORAGE_TYPE_YML; else @@ -63,7 +65,7 @@ void registerStorageFactories() registerStorageFactory(new DefaultStorageFactory("bin")); registerStorageFactory(new DefaultStorageFactory("eepe")); registerStorageFactory(new DefaultStorageFactory("hex")); - registerStorageFactory(new DefaultStorageFactory("otx")); + registerStorageFactory(new DefaultStorageFactory("etx")); registerStorageFactory(new DefaultStorageFactory("yml")); registerStorageFactory(new SdcardStorageFactory()); } diff --git a/companion/src/storage/storage.h b/companion/src/storage/storage.h index f9843650e..1e112158a 100644 --- a/companion/src/storage/storage.h +++ b/companion/src/storage/storage.h @@ -37,7 +37,8 @@ enum StorageType STORAGE_TYPE_XML, STORAGE_TYPE_SDCARD, STORAGE_TYPE_OTX, - STORAGE_TYPE_YML + STORAGE_TYPE_YML, + STORAGE_TYPE_ETX }; StorageType getStorageType(const QString & filename); diff --git a/companion/src/tests/conversions.cpp b/companion/src/tests/conversions.cpp index 8317d6ef3..b68fc0969 100644 --- a/companion/src/tests/conversions.cpp +++ b/companion/src/tests/conversions.cpp @@ -1,6 +1,6 @@ #include "gtests.h" #include "location.h" -#include "storage/otx.h" +#include "storage/etx.h" #include "storage/storage.h" #include "firmwares/opentx/opentxinterface.h" #include "firmwares/customfunctiondata.h" @@ -210,12 +210,12 @@ TEST(Conversions, ConversionX10From22) { QByteArray byteBuffer; -#define USE_OTX +#define USE_ETX -#if defined(USE_OTX) - OtxFormat otx(RADIO_TESTS_PATH "/model_22_x10.otx"); +#if defined(USE_ETX) + EtxFormat etx(RADIO_TESTS_PATH "/model_22_x10.etx"); RadioData radio; - EXPECT_EQ(true, otx.load(radio)); + EXPECT_EQ(true, etx.load(radio)); const GeneralSettings& settings = radio.generalSettings; const ModelData& model = radio.models[0]; @@ -253,7 +253,7 @@ TEST(Conversions, ConversionX10From22) EXPECT_STREQ("BT_X10", settings.bluetoothName); EXPECT_STREQ("EdgeTX", settings.themeData.themeName); -#if !defined(USE_OTX) +#if !defined(USE_ETX) byteBuffer.clear(); ASSERT_EQ(true, loadFile(byteBuffer, RADIO_TESTS_PATH "/model_22_x10/MODELS/model1.bin")); @@ -295,12 +295,12 @@ TEST(Conversions, ConversionX12SFrom22) { QByteArray byteBuffer; -#define USE_OTX +#define USE_ETX -#if defined(USE_OTX) - OtxFormat otx(RADIO_TESTS_PATH "/model_22_x12s.otx"); +#if defined(USE_ETX) + EtxFormat etx(RADIO_TESTS_PATH "/model_22_x12s.etx"); RadioData radio; - EXPECT_EQ(true, otx.load(radio)); + EXPECT_EQ(true, etx.load(radio)); const GeneralSettings& settings = radio.generalSettings; const ModelData& model = radio.models[0]; @@ -330,7 +330,7 @@ TEST(Conversions, ConversionX12SFrom22) EXPECT_STREQ("BT", settings.bluetoothName); EXPECT_STREQ("EdgeTX", settings.themeData.themeName); -#if !defined(USE_OTX) +#if !defined(USE_ETX) byteBuffer.clear(); ASSERT_EQ(true, loadFile(byteBuffer, RADIO_TESTS_PATH "/model_22_x10/MODELS/model1.bin")); diff --git a/radio/src/lua/api_general.cpp b/radio/src/lua/api_general.cpp index 354cdd1c8..c4b006b3e 100644 --- a/radio/src/lua/api_general.cpp +++ b/radio/src/lua/api_general.cpp @@ -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. @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). You can use `mode` to control the loading behavior more specifically. Possible values are: * `b` only binary. diff --git a/radio/src/lua/api_model.cpp b/radio/src/lua/api_model.cpp index e9dc36eb3..07f9f6832 100644 --- a/radio/src/lua/api_model.cpp +++ b/radio/src/lua/api_model.cpp @@ -158,7 +158,7 @@ static int luaModelGetModule(lua_State *L) if (module.type == MODULE_TYPE_MULTIMODULE) { int protocol = g_model.moduleData[idx].getMultiProtocol() + 1; 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, "subProtocol", subprotocol); if (getMultiModuleStatus(idx).isValid()) { @@ -231,8 +231,8 @@ static int luaModelSetModule(lua_State *L) #endif } #if defined(MULTIMODULE) - if (protocol > 0 && subprotocol >= 0) { // Both are needed to compute otx protocol - convertMultiProtocolToOtx(&protocol, &subprotocol); + if (protocol > 0 && subprotocol >= 0) { // Both are needed to compute etx protocol + convertMultiProtocolToEtx(&protocol, &subprotocol); g_model.moduleData[idx].setMultiProtocol(protocol - 1); g_model.moduleData[idx].subType = subprotocol; } diff --git a/radio/src/pulses/multi.cpp b/radio/src/pulses/multi.cpp index 93a2a2dfa..cb2bfdd9d 100644 --- a/radio/src/pulses/multi.cpp +++ b/radio/src/pulses/multi.cpp @@ -53,7 +53,7 @@ static void sendDSM(uint8_t moduleIdx); void multiPatchCustom(uint8_t moduleIdx) { 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; 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) { *protocol = MODULE_SUBTYPE_MULTI_FRSKY + 1; @@ -312,7 +312,7 @@ void convertMultiProtocolToOtx(int *protocol, int *subprotocol) *protocol -= 1; } -void convertOtxProtocolToMulti(int *protocol, int *subprotocol) +void convertEtxProtocolToMulti(int *protocol, int *subprotocol) { // Special treatment for the FrSky entry... if (*protocol == MODULE_SUBTYPE_MULTI_FRSKY + 1) { @@ -407,7 +407,7 @@ void sendFrameProtocolHeader(uint8_t moduleIdx, bool failsafe) } // 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 // of sending Frsky D telemetry diff --git a/radio/src/pulses/multi.h b/radio/src/pulses/multi.h index d9a50d318..756fcf28a 100644 --- a/radio/src/pulses/multi.h +++ b/radio/src/pulses/multi.h @@ -25,8 +25,8 @@ #include "pulses_common.h" void multiPatchCustom(uint8_t moduleIdx); -void convertOtxProtocolToMulti(int *protocol, int *subprotocol); -void convertMultiProtocolToOtx(int *protocol, int *subprotocol); +void convertEtxProtocolToMulti(int *protocol, int *subprotocol); +void convertMultiProtocolToEtx(int *protocol, int *subprotocol); class UartMultiPulses: public DataBuffer { diff --git a/radio/src/sdcard.h b/radio/src/sdcard.h index 43896b690..51873d4b8 100644 --- a/radio/src/sdcard.h +++ b/radio/src/sdcard.h @@ -133,45 +133,45 @@ inline const char * SDCARD_ERROR(FRESULT result) const char * getBasename(const char * path); #if defined(PCBX12S) - #define OTX_FOURCC 0x3478746F // otx for X12S + #define ETX_FOURCC 0x3478746F // etx for X12S #elif defined(RADIO_T16) - #define OTX_FOURCC 0x3F78746F // otx for Jumper T16 + #define ETX_FOURCC 0x3F78746F // etx for Jumper T16 #elif defined(RADIO_T18) - #define OTX_FOURCC 0x4078746F // otx for Jumper T18 + #define ETX_FOURCC 0x4078746F // etx for Jumper T18 #elif defined(RADIO_TX16S) - #define OTX_FOURCC 0x3878746F // otx for Radiomaster TX16S + #define ETX_FOURCC 0x3878746F // etx for Radiomaster TX16S #elif defined(PCBX10) - #define OTX_FOURCC 0x3778746F // otx for X10 + #define ETX_FOURCC 0x3778746F // etx for X10 #elif defined(PCBX9E) - #define OTX_FOURCC 0x3578746F // otx for Taranis X9E + #define ETX_FOURCC 0x3578746F // etx for Taranis X9E #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) - #define OTX_FOURCC 0x3978746F // otx for Taranis X-Lite + #define ETX_FOURCC 0x3978746F // etx for Taranis X-Lite #elif defined(RADIO_T12) - #define OTX_FOURCC 0x3D78746F // otx for Jumper T12 + #define ETX_FOURCC 0x3D78746F // etx for Jumper T12 #elif defined(RADIO_TLITE) - #define OTX_FOURCC 0x4278746F // otx for Jumper TLite + #define ETX_FOURCC 0x4278746F // etx for Jumper TLite #elif defined(RADIO_TPRO) - #define OTX_FOURCC 0x4678746F // otx for Jumper TPro + #define ETX_FOURCC 0x4678746F // etx for Jumper TPro #elif defined(RADIO_TX12) - #define OTX_FOURCC 0x4178746F // otx for Radiomaster TX12 + #define ETX_FOURCC 0x4178746F // etx for Radiomaster TX12 #elif defined(RADIO_ZORRO) - #define OTX_FOURCC 0x4778746F // otx for Radiomaster Zorro + #define ETX_FOURCC 0x4778746F // otx for Radiomaster Zorro #elif defined(RADIO_T8) - #define OTX_FOURCC 0x4378746F // otx for Radiomaster T8 + #define ETX_FOURCC 0x4378746F // etx for Radiomaster T8 #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) - #define OTX_FOURCC 0x3E78746F // otx for Taranis X9-Lite S + #define ETX_FOURCC 0x3E78746F // etx for Taranis X9-Lite S #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) - #define OTX_FOURCC 0x3378746F // otx for Taranis X9D + #define ETX_FOURCC 0x3378746F // etx for Taranis X9D #elif defined(PCBNV14) - #define OTX_FOURCC 0x3A78746F // otx for NV14 + #define ETX_FOURCC 0x3A78746F // etx for NV14 #elif defined(PCBSKY9X) - #define OTX_FOURCC 0x3278746F // otx for sky9x + #define ETX_FOURCC 0x3278746F // etx for sky9x #endif bool isFileAvailable(const char * filename, bool exclDir = false); diff --git a/radio/src/storage/conversions/yaml/yaml_datastructs_funcs.cpp b/radio/src/storage/conversions/yaml/yaml_datastructs_funcs.cpp index 0894b995e..cb1104166 100644 --- a/radio/src/storage/conversions/yaml/yaml_datastructs_funcs.cpp +++ b/radio/src/storage/conversions/yaml/yaml_datastructs_funcs.cpp @@ -1132,7 +1132,7 @@ bool w_modSubtype(void* user, uint8_t* data, uint32_t bitoffs, // data as-is (no FrSky special casing) int type = md->getMultiProtocol() + 1; int subtype = val; - convertOtxProtocolToMulti(&type, &subtype); + convertEtxProtocolToMulti(&type, &subtype); // output "[type],[subtype]" str = yaml_unsigned2str(type); diff --git a/radio/src/storage/eeprom_raw.cpp b/radio/src/storage/eeprom_raw.cpp index a7381319d..f3acf4ecb 100644 --- a/radio/src/storage/eeprom_raw.cpp +++ b/radio/src/storage/eeprom_raw.cpp @@ -473,7 +473,7 @@ const char * eeBackupModel(uint8_t 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[5] = 'M'; *(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]; - 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); return STR_INCOMPATIBLE; } diff --git a/radio/src/storage/eeprom_rlc.cpp b/radio/src/storage/eeprom_rlc.cpp index 8f18c72a1..0c8d80315 100644 --- a/radio/src/storage/eeprom_rlc.cpp +++ b/radio/src/storage/eeprom_rlc.cpp @@ -508,7 +508,7 @@ const char * eeBackupModel(uint8_t i_fileSrc) EFile theFile2; theFile2.openRd(FILE_MODEL(i_fileSrc)); - *(uint32_t*)&buf[0] = OTX_FOURCC; + *(uint32_t*)&buf[0] = ETX_FOURCC; buf[4] = g_eeGeneral.version; buf[5] = 'M'; *(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]; - 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); return STR_INCOMPATIBLE; } diff --git a/radio/src/storage/sdcard_raw.cpp b/radio/src/storage/sdcard_raw.cpp index 34bc56be4..b84c75554 100644 --- a/radio/src/storage/sdcard_raw.cpp +++ b/radio/src/storage/sdcard_raw.cpp @@ -37,7 +37,7 @@ const char *writeFileBin(const char *filename, const uint8_t *data, return SDCARD_ERROR(result); } - *(uint32_t*)&buf[0] = OTX_FOURCC; + *(uint32_t*)&buf[0] = ETX_FOURCC; buf[4] = version; buf[5] = 'M'; *(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]; - 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') { f_close(file); return STR_INCOMPATIBLE; diff --git a/radio/src/storage/yaml/yaml_datastructs_funcs.cpp b/radio/src/storage/yaml/yaml_datastructs_funcs.cpp index 5af9c9299..4774f437e 100644 --- a/radio/src/storage/yaml/yaml_datastructs_funcs.cpp +++ b/radio/src/storage/yaml/yaml_datastructs_funcs.cpp @@ -1646,8 +1646,8 @@ static void r_modSubtype(void* user, uint8_t* data, uint32_t bitoffs, val++; val_len--; int subtype = yaml_str2uint(val, val_len); - // convert to OTX format and write to vars - convertMultiProtocolToOtx(&type, &subtype); + // convert to ETX format and write to vars + convertMultiProtocolToEtx(&type, &subtype); if (type > 0) { md->setMultiProtocol(type - 1); md->subType = subtype; diff --git a/radio/src/targets/simu/opentxsimulator.cpp b/radio/src/targets/simu/opentxsimulator.cpp index a07be6d5c..51408d2eb 100644 --- a/radio/src/targets/simu/opentxsimulator.cpp +++ b/radio/src/targets/simu/opentxsimulator.cpp @@ -32,7 +32,7 @@ #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]; QVector OpenTxSimulator::tracebackDevices; @@ -106,7 +106,7 @@ void OpenTxSimulator::init() if (isRunning()) return; - OTXS_DBG; + ETXS_DBG; if (!m_timer10ms) { // make sure we create & control the timer from current thread @@ -134,7 +134,7 @@ void OpenTxSimulator::start(const char * filename, bool tests) { if (isRunning()) return; - OTXS_DBG << "file:" << filename << "tests:" << tests; + ETXS_DBG << "file:" << filename << "tests:" << tests; QMutexLocker lckr(&m_mtxSimuMain); QMutexLocker slckr(&m_mtxSettings); @@ -150,7 +150,7 @@ void OpenTxSimulator::stop() { if (!isRunning()) return; - OTXS_DBG; + ETXS_DBG; setStopRequested(true); @@ -380,7 +380,7 @@ void OpenTxSimulator::setTrainerTimeout(uint16_t ms) void OpenTxSimulator::sendTelemetry(const QByteArray data) { - //OTXS_DBG << data; + //ETXS_DBG << data; sportProcessTelemetryPacket((uint8_t *)data.constData()); } diff --git a/radio/src/tests/CMakeLists.txt b/radio/src/tests/CMakeLists.txt index 4417696c3..7d07d6ff1 100644 --- a/radio/src/tests/CMakeLists.txt +++ b/radio/src/tests/CMakeLists.txt @@ -19,9 +19,9 @@ if(GTEST_INCDIR AND GTEST_SRCDIR AND Qt5Widgets_FOUND) foreach(model_file ${EXTRACT_MODEL_FILES}) add_custom_command( - DEPENDS ${TESTS_PATH}/${model_file}.otx + DEPENDS ${TESTS_PATH}/${model_file}.etx 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} ) add_custom_target(${model_file}_files diff --git a/radio/src/tests/model_23_x10.otx b/radio/src/tests/model_23_x10.etx similarity index 100% rename from radio/src/tests/model_23_x10.otx rename to radio/src/tests/model_23_x10.etx diff --git a/radio/src/tests/model_23_x12s.otx b/radio/src/tests/model_23_x12s.etx similarity index 100% rename from radio/src/tests/model_23_x12s.otx rename to radio/src/tests/model_23_x12s.etx diff --git a/radio/src/tests/model_25_tx16s.otx b/radio/src/tests/model_25_tx16s.etx similarity index 100% rename from radio/src/tests/model_25_tx16s.otx rename to radio/src/tests/model_25_tx16s.etx