diff --git a/DONATIONS.txt b/DONATIONS.txt index f3bf27e41..46df5704e 100644 --- a/DONATIONS.txt +++ b/DONATIONS.txt @@ -325,3 +325,8 @@ Reginald H Millsom Emanuel Stassar Pierluigi Sommaruga Rafael Eric Suarez Nordlow +A Harris +Stefan Grunenberg +Francisco Gutierrez Muñoz +Steve Coley + diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index 5ac12bd16..1db9309bf 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -398,13 +398,13 @@ IF( APPLE ) ADD_CUSTOM_TARGET( addframeworks ALL 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 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 + COMMAND ${QT_BINARY_DIR}/macdeployqt companion.app WORKING_DIRECTORY ${WORK_DIR} DEPENDS ${PROJECT_NAME} ) diff --git a/companion/src/appdata.cpp b/companion/src/appdata.cpp index a0f1fbb1c..ec634da4d 100644 --- a/companion/src/appdata.cpp +++ b/companion/src/appdata.cpp @@ -9,201 +9,201 @@ AppData g; // ** CompStoreObj class******************** void CompStoreObj::clear (const QString tag1, const QString tag2, const QString tag3) { - QSettings settings(PRODUCT, COMPANY); - if (tag2.isEmpty()) - { - settings.remove(tag1); - } - else if (tag3.isEmpty()) - { - settings.beginGroup(tag1); - settings.remove(tag2); - settings.endGroup(); - } - else - { - settings.beginGroup(tag1); - settings.beginGroup(tag2); - settings.remove(tag3); - settings.endGroup(); - settings.endGroup(); - } + QSettings settings(PRODUCT, COMPANY); + if (tag2.isEmpty()) + { + settings.remove(tag1); + } + else if (tag3.isEmpty()) + { + settings.beginGroup(tag1); + settings.remove(tag2); + settings.endGroup(); + } + else + { + settings.beginGroup(tag1); + settings.beginGroup(tag2); + settings.remove(tag3); + settings.endGroup(); + settings.endGroup(); + } } void CompStoreObj::store(const QByteArray newArray, QByteArray &array, const QString tag, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - settings.setValue(tag, newArray); - array = newArray; + settings.setValue(tag, newArray); + array = newArray; - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } void CompStoreObj::store(const QStringList newSList, QStringList &stringList, const QString tag, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - settings.setValue(tag, newSList); - stringList = newSList; + settings.setValue(tag, newSList); + stringList = newSList; - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } void CompStoreObj::store(const QString newString, QString &string, const QString tag, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - settings.setValue(tag, newString); - string = newString; + settings.setValue(tag, newString); + string = newString; - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } void CompStoreObj::store(const bool newTruth, bool &truth, const QString tag, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - settings.setValue(tag, newTruth); - truth = newTruth; + settings.setValue(tag, newTruth); + truth = newTruth; - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } void CompStoreObj::store(const int newNumber, int &number, const QString tag, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - settings.setValue(tag, newNumber); - number = newNumber; + settings.setValue(tag, newNumber); + number = newNumber; - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } // Retrieval functions void CompStoreObj::retrieve( QByteArray &array, const QString tag, const QString def, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - array = settings.value(tag, def).toByteArray(); + array = settings.value(tag, def).toByteArray(); - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } void CompStoreObj::retrieve( QStringList &stringList, const QString tag, const QString def, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - stringList = settings.value(tag, def).toStringList(); + stringList = settings.value(tag, def).toStringList(); - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } void CompStoreObj::retrieve( QString &string, const QString tag, const QString def, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - string = settings.value(tag, def).toString(); + string = settings.value(tag, def).toString(); - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } void CompStoreObj::retrieve( bool &truth, const QString tag, const bool def, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - truth = settings.value(tag, def).toBool(); + truth = settings.value(tag, def).toBool(); - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } void CompStoreObj::retrieve( int &number, const QString tag, const int def, const QString group1, const QString group2 ) { - QSettings settings(PRODUCT, COMPANY); - if (!group1.isEmpty()) settings.beginGroup(group1); - if (!group2.isEmpty()) settings.beginGroup(group2); + QSettings settings(PRODUCT, COMPANY); + if (!group1.isEmpty()) settings.beginGroup(group1); + if (!group2.isEmpty()) settings.beginGroup(group2); - number = settings.value(tag, def).toInt(); + number = settings.value(tag, def).toInt(); - if (!group1.isEmpty()) settings.endGroup(); - if (!group2.isEmpty()) settings.endGroup(); + if (!group1.isEmpty()) settings.endGroup(); + if (!group2.isEmpty()) settings.endGroup(); } // Retrieve and Store functions void CompStoreObj::getset( QByteArray &array, const QString tag, const QString def, const QString group1, const QString group2 ) { - retrieve( array, tag, def, group1, group2); - store(array, array, tag, group1, group2); + retrieve( array, tag, def, group1, group2); + store(array, array, tag, group1, group2); } void CompStoreObj::getset( QStringList &stringList, const QString tag, const QString def, const QString group1, const QString group2 ) { - retrieve( stringList, tag, def, group1, group2); - store(stringList, stringList, tag, group1, group2); + retrieve( stringList, tag, def, group1, group2); + store(stringList, stringList, tag, group1, group2); } void CompStoreObj::getset( QString &string, const QString tag, const QString def, const QString group1, const QString group2 ) { - retrieve( string, tag, def, group1, group2); - store(string, string, tag, group1, group2); + retrieve( string, tag, def, group1, group2); + store(string, string, tag, group1, group2); } void CompStoreObj::getset( bool &truth, const QString tag, const bool def, const QString group1, const QString group2 ) { - retrieve( truth, tag, def, group1, group2); - store(truth, truth, tag, group1, group2); + retrieve( truth, tag, def, group1, group2); + store(truth, truth, tag, group1, group2); } void CompStoreObj::getset( int &number, const QString tag, const int def, const QString group1, const QString group2 ) { - retrieve( number, tag, def, group1, group2); - store(number, number, tag, group1, group2); + retrieve( number, tag, def, group1, group2); + store(number, number, tag, group1, group2); } // ** FwRevision class******************** -int FwRevision::get( const QString fwName ) +int FwRevision::get( const QString fwType ) { - QString result; - retrieve( result, fwName, "", "FwRevisions" ); - return result.toInt(); + QString result; + retrieve( result, fwType, "", "FwRevisions" ); + return result.toInt(); } -void FwRevision::set( const QString fwName, const int fwRevision ) +void FwRevision::set( const QString fwType, const int fwRevision ) { - QString tempString= QString("%1").arg(fwRevision); - store( tempString, tempString, fwName, "FwRevisions" ); + QString tempString= QString("%1").arg(fwRevision); + store( tempString, tempString, fwType, "FwRevisions" ); } void FwRevision::remove( const QString tag ) { - clear( "FwRevisions", tag ); + clear( "FwRevisions", tag ); } // ** JStickData class******************** @@ -224,97 +224,93 @@ void JStickData::stick_inv(const int it) { store( it, _stickInv, QString("stick% // Constructor JStickData::JStickData() { - index = -1; + index = -1; } void JStickData::remove() { - // Remove all JStickData values from settings file - QSettings settings(PRODUCT, COMPANY); - settings.beginGroup( "JsCalibration" ); - settings.remove( QString( "stick%1_axe").arg(index) ); - settings.remove( QString( "stick%1_min").arg(index) ); - settings.remove( QString( "stick%1_med").arg(index) ); - settings.remove( QString( "stick%1_max").arg(index) ); - settings.remove( QString( "stick%1_inv").arg(index) ); - settings.endGroup(); + // Remove all JStickData values from settings file + QSettings settings(PRODUCT, COMPANY); + settings.beginGroup( "JsCalibration" ); + settings.remove( QString( "stick%1_axe").arg(index) ); + settings.remove( QString( "stick%1_min").arg(index) ); + settings.remove( QString( "stick%1_med").arg(index) ); + settings.remove( QString( "stick%1_max").arg(index) ); + settings.remove( QString( "stick%1_inv").arg(index) ); + settings.endGroup(); - // Reset all JStickData variables to initial values - init(index); + // Reset all JStickData variables to initial values + init(index); } bool JStickData::existsOnDisk() { - QSettings settings(PRODUCT, COMPANY); - settings.beginGroup("JsCalibration"); - int axe = settings.value( QString("stick%1_axe").arg(index), -1 ).toInt(); - settings.endGroup(); + QSettings settings(PRODUCT, COMPANY); + settings.beginGroup("JsCalibration"); + int axe = settings.value( QString("stick%1_axe").arg(index), -1 ).toInt(); + settings.endGroup(); - return (axe > -1); + return (axe > -1); } void JStickData::init(int newIndex) { - index = newIndex; - _stickAxe = -1; - _stickMin = -32767; - _stickMed = 0; - _stickMax = 0; - _stickInv = 0; + index = newIndex; + _stickAxe = -1; + _stickMin = -32767; + _stickMed = 0; + _stickMax = 0; + _stickInv = 0; - // Do not write empty joystick calibrations to disk. - if ( !existsOnDisk() ) - return; + // Do not write empty joystick calibrations to disk. + if ( !existsOnDisk() ) + return; - flush(); + flush(); } void JStickData::flush() { - getset( _stickAxe, QString("stick%1_axe").arg(index), -1, "JsCalibration" ); - getset( _stickMin, QString("stick%1_min").arg(index), -32767, "JsCalibration" ); - getset( _stickMed, QString("stick%1_med").arg(index), 0, "JsCalibration" ); - getset( _stickMax, QString("stick%1_max").arg(index), 0, "JsCalibration" ); - getset( _stickInv, QString("stick%1_inv").arg(index), 0, "JsCalibration" ); + getset( _stickAxe, QString("stick%1_axe").arg(index), -1, "JsCalibration" ); + getset( _stickMin, QString("stick%1_min").arg(index), -32767, "JsCalibration" ); + getset( _stickMed, QString("stick%1_med").arg(index), 0, "JsCalibration" ); + getset( _stickMax, QString("stick%1_max").arg(index), 0, "JsCalibration" ); + getset( _stickInv, QString("stick%1_inv").arg(index), 0, "JsCalibration" ); } // ** Profile class******************** // Get declarations -QString Profile::firmware() { return _firmware; } -QString Profile::name() { return _name; } -QString Profile::sdPath() { return _sdPath; } -QString Profile::splashFile() { return _splashFile; } -bool Profile::burnFirmware() { return _burnFirmware; } -bool Profile::renameFwFiles() { return _renameFwFiles; } -bool Profile::patchImage() { return _patchImage; } -int Profile::channelOrder() { return _channelOrder; } -int Profile::defaultMode() { return _defaultMode; } +QString Profile::fwName() const { return _fwName; } +QString Profile::fwType() const { return _fwType; } +QString Profile::name() const { return _name; } +QString Profile::sdPath() const { return _sdPath; } +QString Profile::splashFile() const { return _splashFile; } +bool Profile::burnFirmware() const { return _burnFirmware; } +bool Profile::renameFwFiles() const { return _renameFwFiles; } +int Profile::channelOrder() const { return _channelOrder; } +int Profile::defaultMode() const { return _defaultMode; } -QString Profile::beeper() { return _beeper; } -QString Profile::countryCode() { return _countryCode; } -QString Profile::display() { return _display; } -QString Profile::haptic() { return _haptic; } -QString Profile::speaker() { return _speaker; } -QString Profile::stickPotCalib() { return _stickPotCalib; } -QString Profile::trainerCalib() { return _trainerCalib; } -int Profile::currentCalib() { return _currentCalib; } -int Profile::gsStickMode() { return _gsStickMode; } -int Profile::ppmMultiplier() { return _ppmMultiplier; } -int Profile::vBatCalib() { return _vBatCalib; } -int Profile::vBatWarn() { return _vBatWarn; } +QString Profile::beeper() const { return _beeper; } +QString Profile::countryCode() const { return _countryCode; } +QString Profile::display() const { return _display; } +QString Profile::haptic() const { return _haptic; } +QString Profile::speaker() const { return _speaker; } +QString Profile::stickPotCalib() const { return _stickPotCalib; } +QString Profile::trainerCalib() const { return _trainerCalib; } +int Profile::currentCalib() const { return _currentCalib; } +int Profile::gsStickMode() const { return _gsStickMode; } +int Profile::ppmMultiplier() const { return _ppmMultiplier; } +int Profile::vBatCalib() const { return _vBatCalib; } +int Profile::vBatWarn() const { return _vBatWarn; } // Set declarations -void Profile::name (const QString x) { if (x.isEmpty()) // Name may never be empty! - store("----", _name, "Name", "Profiles", QString("profile%1").arg(index)); -else - store(x, _name, "Name", "Profiles", QString("profile%1").arg(index));} - -void Profile::firmware (const QString x) { store(x, _firmware, "firmware" ,"Profiles", QString("profile%1").arg(index));} +void Profile::name (const QString x) { store(x, _name, "Name" ,"Profiles", QString("profile%1").arg(index));} +void Profile::fwName (const QString x) { store(x, _fwName, "fwName" ,"Profiles", QString("profile%1").arg(index));} +void Profile::fwType (const QString x) { store(x, _fwType, "fwType" ,"Profiles", QString("profile%1").arg(index));} void Profile::sdPath (const QString x) { store(x, _sdPath, "sdPath" ,"Profiles", QString("profile%1").arg(index));} void Profile::splashFile (const QString x) { store(x, _splashFile, "SplashFileName" ,"Profiles", QString("profile%1").arg(index));} void Profile::burnFirmware (const bool x) { store(x, _burnFirmware, "burnFirmware" ,"Profiles", QString("profile%1").arg(index));} void Profile::renameFwFiles (const bool x) { store(x, _renameFwFiles, "rename_firmware_files" ,"Profiles", QString("profile%1").arg(index));} -void Profile::patchImage (const bool x) { store(x, _patchImage, "patchImage" ,"Profiles", QString("profile%1").arg(index));} void Profile::channelOrder (const int x) { store(x, _channelOrder, "default_channel_order" ,"Profiles", QString("profile%1").arg(index));} void Profile::defaultMode (const int x) { store(x, _defaultMode, "default_mode" ,"Profiles", QString("profile%1").arg(index));} @@ -334,93 +330,121 @@ void Profile::vBatWarn (const int x) { store(x, _vBatWarn, "vBatWa // Constructor Profile::Profile() { - index = -1; + index = -1; +} + +// The default copy operator can not be used since the index variable would be destroyed +Profile& Profile::operator=(const Profile& rhs) +{ + name ( rhs.name() ); + fwName ( rhs.fwName() ); + fwType ( rhs.fwType() ); + sdPath ( rhs.sdPath() ); + splashFile ( rhs.splashFile() ); + burnFirmware ( rhs.burnFirmware() ); + renameFwFiles( rhs.renameFwFiles() ); + channelOrder ( rhs.channelOrder() ); + defaultMode ( rhs.defaultMode() ); + beeper ( rhs.beeper() ); + countryCode ( rhs.countryCode() ); + display ( rhs.display() ); + haptic ( rhs.haptic() ); + speaker ( rhs.speaker() ); + stickPotCalib( rhs.stickPotCalib() ); + trainerCalib ( rhs.trainerCalib() ); + currentCalib ( rhs.currentCalib() ); + gsStickMode ( rhs.gsStickMode() ); + ppmMultiplier( rhs.ppmMultiplier() ); + vBatCalib ( rhs.vBatCalib() ); + vBatWarn ( rhs.vBatWarn() ); + + return *this; } void Profile::remove() { - // Remove all profile values from settings file - QSettings settings(PRODUCT, COMPANY); - settings.beginGroup("Profiles"); - settings.remove(QString("profile%1").arg(index)); - settings.endGroup(); + // Remove all profile values from settings file + QSettings settings(PRODUCT, COMPANY); + settings.beginGroup("Profiles"); + settings.remove(QString("profile%1").arg(index)); + settings.endGroup(); - // Reset all profile variables to initial values - init(index); + // Reset all profile variables to initial values + init(index); } bool Profile::existsOnDisk() { - QSettings settings(PRODUCT, COMPANY); - settings.beginGroup("Profiles"); - settings.beginGroup(QString("profile%1").arg(index)); - QStringList keyList = settings.allKeys(); - settings.endGroup(); - settings.endGroup(); + QSettings settings(PRODUCT, COMPANY); + settings.beginGroup("Profiles"); + settings.beginGroup(QString("profile%1").arg(index)); + QStringList keyList = settings.allKeys(); + settings.endGroup(); + settings.endGroup(); - return (keyList.length() > 0); + return (keyList.length() > 0); } void Profile::init(int newIndex) { - index = newIndex; + index = newIndex; - _firmware = ""; - _name = ""; - _sdPath = ""; - _splashFile = ""; - _burnFirmware = false; - _renameFwFiles = false; - _patchImage = false; - _channelOrder = 0; - _defaultMode = 1; + _fwName = ""; + _fwType = ""; + _name = ""; + _sdPath = ""; + _splashFile = ""; + _burnFirmware = false; + _renameFwFiles = false; + _channelOrder = 0; + _defaultMode = 1; - _beeper = ""; - _countryCode = ""; - _display = ""; - _haptic = ""; - _speaker = ""; - _stickPotCalib = ""; - _trainerCalib = ""; + _beeper = ""; + _countryCode = ""; + _display = ""; + _haptic = ""; + _speaker = ""; + _stickPotCalib = ""; + _trainerCalib = ""; - _currentCalib = 0; - _gsStickMode = 0; - _ppmMultiplier = 0; - _vBatCalib = 0; - _vBatWarn = 0; + _currentCalib = 0; + _gsStickMode = 0; + _ppmMultiplier = 0; + _vBatCalib = 0; + _vBatWarn = 0; - // Do not write empty profiles to disk except the default (0) profile. - if ( index > 0 && !existsOnDisk()) - return; + // Do not write empty profiles to disk except the default (0) profile. + if ( index > 0 && !existsOnDisk()) + return; - flush(); + flush(); } void Profile::flush() { - // Load and store all variables. Use default values if setting values are missing - getset( _firmware, "firmware" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _name, "Name" ,"----" ,"Profiles", QString("profile%1").arg(index)); - getset( _sdPath, "sdPath" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _splashFile, "SplashFileName" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _burnFirmware, "burnFirmware" ,false ,"Profiles", QString("profile%1").arg(index)); - getset( _renameFwFiles, "rename_firmware_files" ,false ,"Profiles", QString("profile%1").arg(index)); - getset( _patchImage, "patchImage" ,false ,"Profiles", QString("profile%1").arg(index)); - getset( _channelOrder, "default_channel_order" ,0 ,"Profiles", QString("profile%1").arg(index)); - getset( _defaultMode, "default_mode" ,1 ,"Profiles", QString("profile%1").arg(index)); + // Load and store all variables. Use default values if setting values are missing + getset( _fwName, "fwName" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _fwType, "fwType" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _name, "Name" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _sdPath, "sdPath" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _splashFile, "SplashFileName" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _burnFirmware, "burnFirmware" ,false ,"Profiles", QString("profile%1").arg(index)); + getset( _renameFwFiles, "rename_firmware_files" ,false ,"Profiles", QString("profile%1").arg(index)); + getset( _channelOrder, "default_channel_order" ,0 ,"Profiles", QString("profile%1").arg(index)); + getset( _defaultMode, "default_mode" ,1 ,"Profiles", QString("profile%1").arg(index)); - getset( _beeper, "Beeper" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _countryCode, "countryCode" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _display, "Display" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _haptic, "Haptic" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _speaker, "Speaker" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _stickPotCalib, "StickPotCalib" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _trainerCalib, "TrainerCalib" ,"" ,"Profiles", QString("profile%1").arg(index)); - getset( _currentCalib, "currentCalib" ,0 ,"Profiles", QString("profile%1").arg(index)); - getset( _gsStickMode, "GSStickMode" ,0 ,"Profiles", QString("profile%1").arg(index)); - getset( _ppmMultiplier, "PPM_Multiplier" ,0 ,"Profiles", QString("profile%1").arg(index)); - getset( _vBatCalib, "VbatCalib" ,0 ,"Profiles", QString("profile%1").arg(index)); - getset( _vBatWarn, "vBatWarn" ,0 ,"Profiles", QString("profile%1").arg(index)); + getset( _beeper, "Beeper" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _countryCode, "countryCode" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _display, "Display" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _haptic, "Haptic" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _speaker, "Speaker" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _stickPotCalib, "StickPotCalib" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _trainerCalib, "TrainerCalib" ,"" ,"Profiles", QString("profile%1").arg(index)); + getset( _currentCalib, "currentCalib" ,0 ,"Profiles", QString("profile%1").arg(index)); + getset( _gsStickMode, "GSStickMode" ,0 ,"Profiles", QString("profile%1").arg(index)); + getset( _ppmMultiplier, "PPM_Multiplier" ,0 ,"Profiles", QString("profile%1").arg(index)); + getset( _vBatCalib, "VbatCalib" ,0 ,"Profiles", QString("profile%1").arg(index)); + getset( _vBatWarn, "vBatWarn" ,0 ,"Profiles", QString("profile%1").arg(index)); } @@ -440,7 +464,6 @@ QString AppData::compileServer() { return _compileServer; } QString AppData::cpuId() { return _cpuId; } QString AppData::dfuArguments() { return _dfuArguments; } QString AppData::dfuLocation() { return _dfuLocation; } -QString AppData::lastFw() { return _lastFw; } QString AppData::locale() { return _locale; } QString AppData::mcu() { return _mcu; } QString AppData::programmer() { return _programmer; } @@ -495,7 +518,6 @@ void AppData::compileServer (const QString x) { store(x, _compileServer, void AppData::cpuId (const QString x) { store(x, _cpuId, "cpu_id" );} void AppData::dfuArguments (const QString x) { store(x, _dfuArguments, "dfu_arguments" );} void AppData::dfuLocation (const QString x) { store(x, _dfuLocation, "dfu_location" );} -void AppData::lastFw (const QString x) { store(x, _lastFw, "lastFw" );} void AppData::locale (const QString x) { store(x, _locale, "locale" );} void AppData::mcu (const QString x) { store(x, _mcu, "mcu" );} void AppData::programmer (const QString x) { store(x, _programmer, "programmer" );} @@ -539,105 +561,118 @@ void AppData::warningId (const int x) { store(x, _warningId, // Constructor AppData::AppData() { - //Initialize the profiles - for (int i=0; iprofileIndexLE->text().toInt()); - g.profile[g.id()].channelOrder(ui->channelorderCB->currentIndex()); g.profile[g.id()].defaultMode(ui->stickmodeCB->currentIndex()); g.profile[g.id()].renameFwFiles(ui->renameFirmware->isChecked()); g.profile[g.id()].burnFirmware(ui->burnFirmware->isChecked()); - g.profile[g.id()].name(ui->profileNameLE->text()); g.profile[g.id()].sdPath(ui->sdPath->text()); g.profile[g.id()].splashFile(ui->SplashFileName->text()); - g.profile[g.id()].firmware(ui->firmwareLE->text()); - - saveProfile(); + + // The profile name may NEVER be empty + if (ui->profileNameLE->text().isEmpty()) + g.profile[g.id()].name(tr("My Radio")); + else + g.profile[g.id()].name(ui->profileNameLE->text()); + + // If a new radio type has been choosen, several things need to change + if ( initialRadioType != ui->radioCB->currentIndex()) + { + g.profile[g.id()].fwName(""); + g.profile[g.id()].fwType(getDefaultFwType(ui->radioCB->currentIndex())); + current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType()); + } } void appPreferencesDialog::on_snapshotPathButton_clicked() @@ -147,11 +154,12 @@ void appPreferencesDialog::initSettings() ui->stickmodeCB->setCurrentIndex(g.profile[g.id()].defaultMode()); ui->renameFirmware->setChecked(g.profile[g.id()].renameFwFiles()); ui->sdPath->setText(g.profile[g.id()].sdPath()); - ui->profileIndexLE->setText(QString("%1").arg(g.id())); ui->profileNameLE->setText(g.profile[g.id()].name()); - ui->firmwareLE->setText(g.profile[g.id()].firmware()); ui->SplashFileName->setText(g.profile[g.id()].splashFile()); + initialRadioType = getRadioType(g.profile[g.id()].fwType()); + ui->radioCB->setCurrentIndex(initialRadioType); + displayImage( g.profile[g.id()].splashFile() ); } @@ -239,22 +247,6 @@ void appPreferencesDialog::on_sdPathButton_clicked() } } -void appPreferencesDialog::saveProfile() -{ - // The profile name may NEVER be empty - if (ui->profileNameLE->text().isEmpty()) - ui->profileNameLE->setText("----"); - - g.profile[g.id()].name( ui->profileNameLE->text() ); - g.profile[g.id()].channelOrder( ui->channelorderCB->currentIndex()); - g.profile[g.id()].defaultMode( ui->stickmodeCB->currentIndex()); - g.profile[g.id()].burnFirmware( ui->burnFirmware->isChecked()); - g.profile[g.id()].renameFwFiles( ui->renameFirmware->isChecked()); - g.profile[g.id()].sdPath( ui->sdPath->text()); - g.profile[g.id()].splashFile( ui->SplashFileName->text()); - g.profile[g.id()].firmware( ui->firmwareLE->text()); -} - void appPreferencesDialog::on_removeProfileButton_clicked() { if ( g.id() == 0 ) @@ -267,6 +259,7 @@ void appPreferencesDialog::on_removeProfileButton_clicked() } } + bool appPreferencesDialog::displayImage( QString fileName ) { // Start by clearing the pixmap @@ -278,31 +271,11 @@ bool appPreferencesDialog::displayImage( QString fileName ) // Use the firmware name to determine splash width int width = SPLASH_WIDTH; - if (g.profile[g.id()].firmware().contains("taranis")) + if (g.profile[g.id()].fwType().contains("taranis")) width = SPLASHX9D_WIDTH; - - ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(width, SPLASH_HEIGHT))); - if (width==SPLASHX9D_WIDTH) { - image=image.convertToFormat(QImage::Format_RGB32); - QRgb col; - int gray, height = image.height(); - for (int i = 0; i < width; ++i) { - for (int j = 0; j < height; ++j) { - col = image.pixel(i, j); - gray = qGray(col); - image.setPixel(i, j, qRgb(gray, gray, gray)); - } - } - ui->imageLabel->setPixmap(QPixmap::fromImage(image)); - } - else { - ui->imageLabel->setPixmap(QPixmap::fromImage(image.convertToFormat(QImage::Format_Mono))); - } - if (width == SPLASH_WIDTH) - ui->imageLabel->setFixedSize(SPLASH_WIDTH, SPLASH_HEIGHT); - else - ui->imageLabel->setFixedSize(SPLASHX9D_WIDTH, SPLASHX9D_HEIGHT); - + + ui->imageLabel->setPixmap( makePixMap( image, g.profile[g.id()].fwType())); + ui->imageLabel->setFixedSize(width, SPLASH_HEIGHT); return true; } @@ -331,3 +304,4 @@ void appPreferencesDialog::on_clearImageButton_clicked() { + diff --git a/companion/src/apppreferencesdialog.h b/companion/src/apppreferencesdialog.h index 18ce2f1e3..46bdf3156 100644 --- a/companion/src/apppreferencesdialog.h +++ b/companion/src/apppreferencesdialog.h @@ -21,10 +21,10 @@ public: Joystick *joystick; private: + int initialRadioType; Ui::appPreferencesDialog *ui; void initSettings(); bool displayImage( QString fileName ); - void saveProfile(); void loadProfileString(QString profile, QString label); void loadFromProfile(); diff --git a/companion/src/apppreferencesdialog.ui b/companion/src/apppreferencesdialog.ui index c15874915..f5d4b9deb 100644 --- a/companion/src/apppreferencesdialog.ui +++ b/companion/src/apppreferencesdialog.ui @@ -7,7 +7,7 @@ 0 0 685 - 446 + 462 @@ -124,12 +124,12 @@ - Include companion splashes + Only show user splash images - Only user defined splashes + Show user and companion splash images @@ -490,10 +490,10 @@ - Radio Settings + Radio Settings Profile - + @@ -547,7 +547,7 @@ Mode 4: - + @@ -697,13 +697,6 @@ This is used by the templated to determine which channel goes to what number out - - - - Qt::Horizontal - - - @@ -720,7 +713,7 @@ This is used by the templated to determine which channel goes to what number out - Settings Profile + Profile Name @@ -766,7 +759,7 @@ This is used by the templated to determine which channel goes to what number out - + Append version number to FW file name @@ -789,7 +782,7 @@ This is used by the templated to determine which channel goes to what number out - + true @@ -800,12 +793,18 @@ This is used by the templated to determine which channel goes to what number out 0 + + + 350 + 16777215 + + true - + Qt::Horizontal @@ -818,88 +817,81 @@ This is used by the templated to determine which channel goes to what number out - + Offer to write FW to Tx after download - + Remove Profile - + Open Folder - + Qt::Horizontal - + true - 0 + 350 0 + + + 350 + 16777215 + + true - - - - Firmware - - - - - - - false - - - - + Select Image - + + + + Radio Type + + + + Clear Image - - - - false - - - - 30 - 16777215 - + + + + Qt::Horizontal @@ -907,10 +899,16 @@ This is used by the templated to determine which channel goes to what number out - 0 + 350 0 + + + 350 + 16777215 + + @@ -937,7 +935,10 @@ This is used by the templated to determine which channel goes to what number out QFrame::Panel - QFrame::Raised + QFrame::Plain + + + 1 @@ -947,6 +948,45 @@ This is used by the templated to determine which channel goes to what number out + + + + + 9X + + + + + 9X with m128 + + + + + 9XR + + + + + 9XR with m128 + + + + + Gruvin9x Board + + + + + Sky9x Board + + + + + Taranis + + + + diff --git a/companion/src/burndialog.cpp b/companion/src/burndialog.cpp index e7f48e0b3..617c7ea9e 100644 --- a/companion/src/burndialog.cpp +++ b/companion/src/burndialog.cpp @@ -9,6 +9,7 @@ #include "hexinterface.h" #include "appdata.h" +// Type 1 = Burn EEPROM, Type 2= Burn Flash burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * backupEE, QString DocName): QDialog(parent), ui(new Ui::burnDialog), @@ -17,17 +18,25 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac hexType(Type) { ui->setupUi(this); - ui->libraryButton->setIcon(CompanionIcon("library.png")); + + if(!g.profile[g.id()].splashFile().isEmpty()){ + imageSource=PROFILE; + imageFile=g.profile[g.id()].splashFile(); + } + else{ + ui->useProfileImageCB->setDisabled(true); + imageSource=FIRMWARE; + imageFile=""; + } ui->SplashFrame->hide(); ui->FramFWInfo->hide(); ui->EEbackupCB->hide(); ui->EEbackupCB->setCheckState(*backup ? Qt::Checked : Qt::Unchecked); - if (Type == 2) { + if (Type == FLASH_FILE_TYPE ) { ui->EEpromCB->hide(); ui->profile_label->hide(); ui->patchcalib_CB->hide(); ui->patchhw_CB->hide(); - ui->InvertColorButton->setDisabled(true); setWindowTitle(tr("Write firmware to TX")); if (IS_TARANIS(GetEepromInterface()->getBoard())) { ui->EEbackupCB->hide(); @@ -39,12 +48,7 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac ui->patchcalib_CB->hide(); ui->patchhw_CB->hide(); ui->EEpromCB->hide(); - ui->ImageLoadButton->setDisabled(true); - ui->libraryButton->setDisabled(true); - ui->InvertColorButton->setDisabled(true); ui->BurnFlashButton->setDisabled(true); - ui->ImageFileName->clear(); - ui->FwImage->clear(); ui->FWFileName->clear(); ui->DateField->clear(); ui->SVNField->clear(); @@ -63,7 +67,7 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac } if (!hexfileName->isEmpty()) { ui->FWFileName->setText(*hexfileName); - if (Type==2) { + if (Type==FLASH_FILE_TYPE) { checkFw(*hexfileName); } else { @@ -104,14 +108,14 @@ burnDialog::burnDialog(QWidget *parent, int Type, QString * fileName, bool * bac ui->FlashLoadButton->hide(); hexfileName->clear(); } - else if (Type==2) { - QString FileName; - FileName = g.lastFw(); + else if (Type==FLASH_FILE_TYPE) { + QString FileName = g.profile[g.id()].fwName(); QFile file(FileName); if (file.exists()) { checkFw(FileName); } } + updateUI(); resize(0, 0); } @@ -124,12 +128,7 @@ void burnDialog::on_FlashLoadButton_clicked() { QString fileName; - ui->ImageLoadButton->setDisabled(true); - ui->libraryButton->setDisabled(true); - ui->InvertColorButton->setDisabled(true); ui->BurnFlashButton->setDisabled(true); - ui->ImageFileName->clear(); - ui->FwImage->clear(); ui->FWFileName->clear(); ui->DateField->clear(); ui->SVNField->clear(); @@ -139,8 +138,10 @@ void burnDialog::on_FlashLoadButton_clicked() ui->BurnFlashButton->setDisabled(true); ui->EEbackupCB->hide(); QTimer::singleShot(0, this, SLOT(shrink())); - if (hexType==2) { - fileName = QFileDialog::getOpenFileName(this, tr("Open"), g.flashDir(), FLASH_FILES_FILTER); + if (hexType==FLASH_FILE_TYPE) { + fileName = QFileDialog::getOpenFileName(this, tr("Open Firmware File"), g.flashDir(), FLASH_FILES_FILTER); + if(fileName.isEmpty()) + return; checkFw(fileName); } else { @@ -169,6 +170,7 @@ void burnDialog::on_FlashLoadButton_clicked() QTimer::singleShot(0, this, SLOT(shrink())); } } + updateUI(); } void burnDialog::checkFw(QString fileName) @@ -176,6 +178,7 @@ void burnDialog::checkFw(QString fileName) if (fileName.isEmpty()) { return; } + if (!IS_TARANIS(GetEepromInterface()->getBoard())) { ui->EEbackupCB->show(); } @@ -190,59 +193,17 @@ void burnDialog::checkFw(QString fileName) ui->DateField->setText(flash.getDate() + " " + flash.getTime()); ui->SVNField->setText(flash.getSvn()); ui->ModField->setText(flash.getBuild()); - ui->BurnFlashButton->setEnabled(true); - ui->BurnFlashButton->setText(tr("Write to TX")); + + ui->SplashFrame->hide(); if (flash.hasSplash()) { ui->SplashFrame->show(); - ui->ImageLoadButton->setEnabled(true); - ui->libraryButton->setEnabled(true); - ui->FwImage->setFixedSize(flash.getSplashWidth(), flash.getSplashHeight()); ui->imageLabel->setFixedSize(flash.getSplashWidth(), flash.getSplashHeight()); - ui->FwImage->show(); - ui->FwImage->setPixmap(QPixmap::fromImage(flash.getSplash())); - QString ImageStr = g.profile[g.id()].splashFile(); - bool PatchFwCB = g.profile[g.id()].patchImage(); - if (!ImageStr.isEmpty()) { - QImage Image = qstring2image(ImageStr); - ui->imageLabel->setPixmap(QPixmap::fromImage(Image.convertToFormat(flash.getSplashFormat()))); - ui->InvertColorButton->setEnabled(true); - ui->PreferredImageCB->setChecked(true); - ui->PatchFWCB->setChecked(PatchFwCB); - } - else { - QString fileName=ui->ImageFileName->text(); - if (!fileName.isEmpty()) { - QImage image(fileName); - if (!image.isNull()) { - ui->InvertColorButton->setEnabled(true); - ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()).convertToFormat(flash.getSplashFormat()))); - ui->PatchFWCB->setEnabled(true); - ui->PatchFWCB->setChecked(PatchFwCB); - } - else { - ui->PatchFWCB->setDisabled(true); - ui->PatchFWCB->setChecked(false); - ui->PreferredImageCB->setDisabled(true); - } - } - else { - ui->PatchFWCB->setDisabled(true); - ui->PatchFWCB->setChecked(false); - ui->PreferredImageCB->setDisabled(true); - } - } - } - else { - ui->FwImage->hide(); - ui->ImageFileName->setText(""); - ui->SplashFrame->hide(); } } else { - QMessageBox::warning(this, tr("Warning"), tr("%1 is not a known firmware").arg(fileName)); - ui->BurnFlashButton->setText(tr("Burn anyway !")); - ui->BurnFlashButton->setEnabled(true); + QMessageBox::warning(this, tr("Warning"), tr("%1 may not be a valid firmware file").arg(fileName)); } + ui->BurnFlashButton->setEnabled(true); QTimer::singleShot(0, this, SLOT(shrink())); g.flashDir( QFileInfo(fileName).dir().absolutePath() ); } @@ -337,51 +298,92 @@ bool burnDialog::checkeEprom(QString fileName) return true; } -void burnDialog::on_ImageLoadButton_clicked() +void burnDialog::displaySplash() +{ + QImage image; + if (imageSource == FIRMWARE){ + FlashInterface flash(ui->FWFileName->text()); + image = flash.getSplash(); + } + else{ + image.load(imageFile); + } + if (image.isNull()) { + return; + } + ui->imageLabel->setPixmap( makePixMap( image, g.profile[g.id()].fwType())); +} + +void burnDialog::updateUI() +{ + if (hexType==EEPROM_FILE_TYPE) + return; + + ui->useProfileImageCB->setChecked( imageSource == PROFILE ); + ui->useFwImageCB->setChecked( imageSource == FIRMWARE ); + ui->useLibraryImageCB->setChecked( imageSource == LIBRARY ); + ui->useAnotherImageCB->setChecked( imageSource == ANOTHER ); + + displaySplash(); +} + +void burnDialog::on_useFwImageCB_clicked() +{ + QString fileName = ui->FWFileName->text(); + FlashInterface flash(fileName); + if (!flash.isValid()) { + QMessageBox::critical(this, tr("Error"), tr( "The firmware file is not valid." )); + } + else { + if (!flash.hasSplash()) { + QMessageBox::critical(this, tr("Error"), tr( "There is no start screen image in the firmware file." )); + } + else{ + imageSource = FIRMWARE; + imageFile = fileName; + } + } + updateUI(); +} + +void burnDialog::on_useProfileImageCB_clicked() +{ + QString fileName = g.profile[g.id()].splashFile(); + if (!fileName.isEmpty()){ + QImage image(fileName); + if (image.isNull()) { + QMessageBox::critical(this, tr("Error"), tr("The profile image %1 does not contain an image.").arg(fileName)); + } + else { + imageSource = PROFILE; + imageFile = fileName; + } + } + updateUI(); +} + +void burnDialog::on_useAnotherImageCB_clicked() { QString supportedImageFormats; for (int formatIndex = 0; formatIndex < QImageReader::supportedImageFormats().count(); formatIndex++) { supportedImageFormats += QLatin1String(" *.") + QImageReader::supportedImageFormats()[formatIndex]; } - - QString fileName = QFileDialog::getOpenFileName(this, - tr("Open Image to load"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats)); - - if (!fileName.isEmpty()) { + QString fileName = QFileDialog::getOpenFileName(this, tr("Open image file to use as Tx start screen"), g.imagesDir(), tr("Images (%1)").arg(supportedImageFormats)); + if (!fileName.isEmpty()){ g.imagesDir( QFileInfo(fileName).dir().absolutePath() ); QImage image(fileName); if (image.isNull()) { - QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName)); - ui->PatchFWCB->setDisabled(true); - ui->PatchFWCB->setChecked(false); - ui->InvertColorButton->setDisabled(true); - return; + QMessageBox::critical(this, tr("Error"), tr("Image could not be loaded from %1").arg(fileName)); } - ui->ImageFileName->setText(fileName); - ui->InvertColorButton->setEnabled(true); - if (ui->imageLabel->width()!=128) { - image=image.convertToFormat(QImage::Format_RGB32); - QRgb col; - int gray; - int width = image.width(); - int height = image.height(); - for (int i = 0; i < width; ++i) { - for (int j = 0; j < height; ++j) { - col = image.pixel(i, j); - gray = qGray(col); - image.setPixel(i, j, qRgb(gray, gray, gray)); - } - } - ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()))); - } - else { - ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()).convertToFormat(QImage::Format_Mono))); - } - ui->PatchFWCB->setEnabled(true); + else{ + imageSource = ANOTHER; + imageFile = fileName; + } } + updateUI(); } -void burnDialog::on_libraryButton_clicked() +void burnDialog::on_useLibraryImageCB_clicked() { QString fileName; splashLibrary *ld = new splashLibrary(this,&fileName); @@ -389,49 +391,26 @@ void burnDialog::on_libraryButton_clicked() if (!fileName.isEmpty()) { QImage image(fileName); if (image.isNull()) { - QMessageBox::critical(this, tr("Error"), tr("Cannot load %1.").arg(fileName)); - ui->PatchFWCB->setDisabled(true); - ui->PatchFWCB->setChecked(false); - ui->InvertColorButton->setDisabled(true); - return; + QMessageBox::critical(this, tr("Error"), tr("The library image could not be loaded")); } - ui->ImageFileName->setText(fileName); - ui->InvertColorButton->setEnabled(true); - if (ui->imageLabel->width()!=128) { - image=image.convertToFormat(QImage::Format_RGB32); - QRgb col; - int gray; - int width = image.width(); - int height = image.height(); - for (int i = 0; i < width; ++i) - { - for (int j = 0; j < height; ++j) - { - col = image.pixel(i, j); - gray = qGray(col); - image.setPixel(i, j, qRgb(gray, gray, gray)); - } - } - ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()))); - } else { - ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()).convertToFormat(QImage::Format_Mono))); + else{ + imageSource = LIBRARY; + imageFile = fileName; } - ui->PatchFWCB->setEnabled(true); } + updateUI(); } void burnDialog::on_BurnFlashButton_clicked() { - if (hexType==2) { + if (hexType==FLASH_FILE_TYPE) { QString fileName=ui->FWFileName->text(); if (!fileName.isEmpty()) { g.flashDir( QFileInfo(fileName).dir().absolutePath() ); - g.lastFw( fileName ); - if (ui->PatchFWCB->isChecked()) { - g.profile[g.id()].patchImage( true ); + if (!ui->useFwImageCB->isChecked()) { QImage image = ui->imageLabel->pixmap()->toImage().scaled(ui->imageLabel->width(), ui->imageLabel->height()); if (!image.isNull()) { - QString tempDir = QDir::tempPath(); + QString tempDir = QDir::tempPath(); QString tempFile; if (getFileType(fileName) == FILE_TYPE_HEX) tempFile = tempDir + "/flash.hex"; @@ -451,7 +430,6 @@ void burnDialog::on_BurnFlashButton_clicked() QMessageBox::critical(this, tr("Warning"), tr("Custom image not found")); } } else { - g.profile[g.id()].patchImage( false ); hexfileName->clear(); hexfileName->append(fileName); } @@ -460,7 +438,7 @@ void burnDialog::on_BurnFlashButton_clicked() hexfileName->clear(); } } - if (hexType==1) { + if (hexType==EEPROM_FILE_TYPE) { QString calib = g.profile[g.id()].stickPotCalib(); QString trainercalib = g.profile[g.id()].trainerCalib(); int potsnum=GetEepromInterface()->getCapability(Pots); @@ -609,98 +587,9 @@ void burnDialog::on_cancelButton_clicked() this->close(); } -void burnDialog::on_InvertColorButton_clicked() -{ - if (ui->imageLabel->pixmap()) { - QImage image = ui->imageLabel->pixmap()->toImage(); - image.invertPixels(); - ui->imageLabel->setPixmap(QPixmap::fromImage(image)); - } -} - void burnDialog::on_EEpromCB_toggled(bool checked) { - if (ui->EEpromCB->isChecked()) { - *backup=true; - } else { - *backup=false; - } -} - -void burnDialog::on_PreferredImageCB_toggled(bool checked) -{ - QString tmpFileName; - if (checked) { - QString ImageStr = g.profile[g.id()].splashFile(); - if (!ImageStr.isEmpty()) { - QImage Image = qstring2image(ImageStr); - if (ui->imageLabel->width()!=128) { - Image=Image.convertToFormat(QImage::Format_RGB32); - QRgb col; - int gray; - int width = Image.width(); - int height = Image.height(); - for (int i = 0; i < width; ++i) - { - for (int j = 0; j < height; ++j) - { - col = Image.pixel(i, j); - gray = qGray(col); - Image.setPixel(i, j, qRgb(gray, gray, gray)); - } - } - } else { - Image=Image.convertToFormat(QImage::Format_Mono); - } - ui->imageLabel->setPixmap(QPixmap::fromImage(Image)); - ui->InvertColorButton->setEnabled(true); - ui->PreferredImageCB->setChecked(true); - ui->ImageFileName->setDisabled(true); - ui->ImageLoadButton->setDisabled(true); - ui->libraryButton->setDisabled(true); - ui->PatchFWCB->setEnabled(true); - } - } else { - ui->imageLabel->clear(); - ui->ImageLoadButton->setEnabled(true); - ui->libraryButton->setEnabled(true); - tmpFileName = ui->ImageFileName->text(); - if (!tmpFileName.isEmpty()) { - QImage image(tmpFileName); - if (!image.isNull()) { - if (ui->imageLabel->width()!=128) { - image=image.convertToFormat(QImage::Format_RGB32); - QRgb col; - int gray; - int width = image.width(); - int height = image.height(); - for (int i = 0; i < width; ++i) - { - for (int j = 0; j < height; ++j) - { - col = image.pixel(i, j); - gray = qGray(col); - image.setPixel(i, j, qRgb(gray, gray, gray)); - } - } - } else { - image=image.convertToFormat(QImage::Format_Mono); - } - ui->imageLabel->setPixmap(QPixmap::fromImage(image.scaled(ui->imageLabel->width(), ui->imageLabel->height()))); - ui->InvertColorButton->setEnabled(true); - ui->ImageFileName->setEnabled(true); - ui->PatchFWCB->setDisabled(false); - } else { - ui->InvertColorButton->setDisabled(true); - ui->PatchFWCB->setDisabled(true); - ui->PatchFWCB->setChecked(false); - } - } else { - ui->InvertColorButton->setDisabled(true); - ui->PatchFWCB->setDisabled(true); - ui->PatchFWCB->setChecked(false); - } - } + *backup = ui->EEpromCB->isChecked(); } void burnDialog::shrink() @@ -710,9 +599,5 @@ void burnDialog::shrink() void burnDialog::on_EEbackupCB_clicked() { - if (ui->EEbackupCB->isChecked()) { - *backup=true; - } else { - *backup=false; - } + *backup = ui->EEbackupCB->isChecked(); } diff --git a/companion/src/burndialog.h b/companion/src/burndialog.h index 40068f3ac..1ffac2b92 100644 --- a/companion/src/burndialog.h +++ b/companion/src/burndialog.h @@ -19,6 +19,8 @@ #define ER9X_EEPROM_FILE_TYPE "ER9X_EEPROM_FILE" #define EEPE_EEPROM_FILE_HEADER "EEPE EEPROM FILE" #define EEPE_MODEL_FILE_HEADER "EEPE MODEL FILE" +#define EEPROM_FILE_TYPE 1 +#define FLASH_FILE_TYPE 2 namespace Ui @@ -36,18 +38,22 @@ public: private slots: void on_FlashLoadButton_clicked(); - void on_ImageLoadButton_clicked(); - void on_libraryButton_clicked(); void on_BurnFlashButton_clicked(); void on_cancelButton_clicked(); - void on_InvertColorButton_clicked(); void on_EEbackupCB_clicked(); - void on_PreferredImageCB_toggled(bool checked); - void on_EEpromCB_toggled(bool checked); - void checkFw(QString fileName); + void on_EEpromCB_toggled(bool checked); bool checkeEprom(QString fileName); + void on_useProfileImageCB_clicked(); + void on_useFwImageCB_clicked(); + void on_useLibraryImageCB_clicked(); + void on_useAnotherImageCB_clicked(); + + void checkFw(QString fileName); + void displaySplash(); + void updateUI(); void shrink(); + private: Ui::burnDialog *ui; QString * hexfileName; @@ -55,6 +61,9 @@ private: int hexType; RadioData radioData; bool burnraw; + enum ImageSource {FIRMWARE, PROFILE, LIBRARY, ANOTHER}; + ImageSource imageSource; + QString imageFile; }; #endif // BURNDIALOG_H diff --git a/companion/src/burndialog.ui b/companion/src/burndialog.ui index e86634e9a..772304390 100644 --- a/companion/src/burndialog.ui +++ b/companion/src/burndialog.ui @@ -7,7 +7,7 @@ 0 0 440 - 418 + 423 @@ -30,21 +30,8 @@ :/icon.png:/icon.png - + - - - - Qt::Vertical - - - - 20 - 0 - - - - @@ -71,19 +58,6 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -100,19 +74,6 @@ - - - - Qt::Horizontal - - - - 48 - 20 - - - - @@ -152,56 +113,22 @@ QFrame::Raised - - - - - 0 - 0 - - - - - 128 - 64 - - - - - 212 - 64 - - - - QFrame::Panel - - - QFrame::Raised - - - - - - true - - - - - + + true - - + + - Date & Time + Variant - - + + true @@ -214,17 +141,17 @@ - - - - true + + + + Date & Time - - - - Variant + + + + true @@ -325,17 +252,10 @@ - - - - - - - Invert Color - - - - + + + + @@ -359,7 +279,7 @@ QFrame::Panel - QFrame::Raised + QFrame::Plain @@ -369,10 +289,50 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + - + + + Use firmware start screen + + + + + + + Use another start screen + + + + + 0 @@ -380,86 +340,14 @@ - Use image in settings - - - - - - - Substitute image in firmware + Use profile start screen - - - Qt::Vertical - - - - 20 - 13 - - - - - - - - Qt::Vertical - - - - 20 - 13 - - - - - - - - - - - - true - - - - 0 - 0 - - - - true - - - - - - - false - + - Load Image - - - - - - - Open Splash Library - - - ... - - - - 16 - 16 - + Use library start screen @@ -470,18 +358,37 @@ + + + + Qt::Vertical + + + + 20 + 0 + + + + + BurnFlashButton FWFileName FlashLoadButton - ImageFileName - ImageLoadButton - libraryButton + DateField + SVNField + ModField + useProfileImageCB + useFwImageCB + useLibraryImageCB + useAnotherImageCB EEbackupCB + patchcalib_CB + patchhw_CB EEpromCB cancelButton - BurnFlashButton diff --git a/companion/src/companion.cpp b/companion/src/companion.cpp index 96a6d5597..37a988273 100644 --- a/companion/src/companion.cpp +++ b/companion/src/companion.cpp @@ -95,15 +95,18 @@ int main(int argc, char *argv[]) QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); - if (g.profile[g.id()].firmware().isEmpty()) - g.profile[g.id()].firmware(default_firmware_variant.id); + if (g.profile[g.id()].fwType().isEmpty()){ + g.profile[g.id()].fwType(default_firmware_variant.id); + g.profile[g.id()].fwName(""); + } + - QPixmap pixmap = QPixmap(g.profile[g.id()].firmware().contains("taranis") ? ":/images/splasht.png" : ":/images/splash.png"); + QPixmap pixmap = QPixmap(g.profile[g.id()].fwType().contains("taranis") ? ":/images/splasht.png" : ":/images/splash.png"); QSplashScreen *splash = new QSplashScreen(pixmap); RegisterFirmwares(); - current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].firmware()); + current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType()); MainWindow *mainWin = new MainWindow(); if (g.showSplash()) { diff --git a/companion/src/companion.qrc b/companion/src/companion.qrc index 1c4550d1a..dcb97f0b3 100644 --- a/companion/src/companion.qrc +++ b/companion/src/companion.qrc @@ -173,126 +173,65 @@ images/library/00014.png images/library/00015.png images/library/00016.png - images/library/01001.png - images/library/01002.png - images/library/01003.png - images/library/01004.png - images/library/01005.png - images/library/01006.png - images/library/01007.png - images/library/01008.png + images/library/00017.png + images/library/00018.png + images/library/00019.png + images/library/00020.png + images/library/00050.png + images/library/00051.png + images/library/00052.png + images/library/00053.png + images/library/00054.png + images/library/00055.png + images/library/00056.png + images/library/00057.png + images/library/00058.png + images/library/00059.png + images/library/00060.png + images/library/00061.png + images/library/00062.png + images/library/00063.png + images/library/00064.png + images/library/00065.png + images/library/00066.png + images/library/00100.png + images/library/00101.png + images/library/00102.png + images/library/00103.png + images/library/00104.png + images/library/00105.png + images/library/00106.png + images/library/00201.png + images/library/00202.png + images/library/00203.png + images/library/00204.png + images/library/00301.png + images/library/00302.png + images/library/00303.png + images/library/00304.png + images/library/00401.png + images/library/00402.png + images/library/00403.png + images/library/00404.png + images/library/00501.png images/library/10001.png images/library/10002.png images/library/10003.png - images/library/10004.png - images/library/10005.png - images/library/10006.png - images/library/10007.png - images/library/10008.png - images/library/10009.png - images/library/10010.png - images/library/10011.png - images/library/10012.png - images/library/10013.png - images/library/10014.png - images/library/10015.png - images/library/10016.png - images/library/10017.png - images/library/10018.png - images/library/10019.png - images/library/10020.png - images/library/10021.png - images/library/10022.png - images/library/10023.png - images/library/10024.png - images/library/10033.png - images/library/10034.png - images/library/10035.png - images/library/10036.png - images/library/10049.png - images/library/10050.png - images/library/10051.png - images/library/10052.png - images/library/10037.png - images/library/10038.png - images/library/10039.png - images/library/10040.png - images/library/10053.png - images/library/10054.png - images/library/10055.png - images/library/10056.png - images/library/10025.png - images/library/10026.png - images/library/10027.png - images/library/10028.png - images/library/10029.png - images/library/10030.png - images/library/10031.png - images/library/10032.png - images/library/10041.png - images/library/10042.png - images/library/10043.png - images/library/10044.png - images/library/10057.png - images/library/10058.png - images/library/10059.png - images/library/10060.png - images/library/10045.png - images/library/10046.png - images/library/10047.png - images/library/10048.png - images/library/10061.png - images/library/10062.png - images/library/10063.png - images/library/10064.png - images/library/10065.png - images/library/10066.png - images/library/10067.png - images/library/10068.png - images/library/10081.png - images/library/10082.png - images/library/10083.png - images/library/10084.png - images/library/10069.png - images/library/10070.png - images/library/10071.png - images/library/10072.png - images/library/10085.png - images/library/10086.png - images/library/10087.png - images/library/10088.png - images/library/10073.png - images/library/10074.png - images/library/10075.png - images/library/10076.png - images/library/10089.png - images/library/10090.png - images/library/10091.png - images/library/10092.png - images/library/10077.png - images/library/10078.png - images/library/10079.png - images/library/10080.png - images/library/10093.png - images/library/10094.png - images/library/10095.png - images/library/10096.png - images/library/10097.png - images/library/10098.png - images/library/10099.png - images/library/10100.png images/library/10101.png images/library/10102.png images/library/10103.png - images/library/10104.png - images/library/20001.png - images/library/20002.png - images/library/20003.png - images/library/20004.png - images/library/30001.png - images/library/30002.png - images/library/30003.png - images/library/30004.png + images/library/10501.png + images/library/10502.png + images/library/10503.png + images/library/10504.png + images/library/10505.png + images/library/10506.png + images/library/10508.png + images/library/10601.png + images/library/10701.png + images/library/10702.png + images/library/10801.png + images/library/10802.png themes/monochrome/16/paintbrush.png themes/monochrome/16/open.png themes/monochrome/16/edit.png diff --git a/companion/src/customizesplashdialog.cpp b/companion/src/customizesplashdialog.cpp index b4d901836..42bf463da 100644 --- a/companion/src/customizesplashdialog.cpp +++ b/companion/src/customizesplashdialog.cpp @@ -14,11 +14,21 @@ Side::Side(){ imageLabel = 0; fileNameEdit = 0; saveButton = 0; + loadFwButton=0; + loadPictButton = 0; + loadProfileButton = 0; saveToFileName = new QString(""); source = new Source(UNDEFINED); format = new LCDFormat(LCDTARANIS); } +void Side::markSourceButton() +{ + loadFwButton->setChecked(*source == FW ? true : false ); + loadPictButton->setChecked(*source == PICT ? true : false ); + loadProfileButton->setChecked(*source == PROFILE ? true : false ); +} + void Side::copyImage( Side side ) { if ((*source!=UNDEFINED) && (*side.source!=UNDEFINED)) @@ -31,7 +41,7 @@ bool Side::displayImage( QString fileName, Source pictSource ) if (fileName.isEmpty()) return false; - + // Determine which picture format to use if (pictSource == FW ){ FlashInterface flash(fileName); @@ -39,60 +49,46 @@ bool Side::displayImage( QString fileName, Source pictSource ) return false; else image = flash.getSplash(); - *format = (flash.getSplashWidth()==WIDTH_TARANIS ? LCDTARANIS : LCD9X); + *format = (flash.getSplashWidth()==WIDTH_TARANIS ? LCDTARANIS : LCD9X); } else { image.load(fileName); if (pictSource== PICT) *format = image.width()>WIDTH_9X ? LCDTARANIS : LCD9X; else if (pictSource == PROFILE) - *format = (g.profile[g.id()].firmware().contains("taranis")) ? LCDTARANIS : LCD9X; + *format = (g.profile[g.id()].fwType().contains("taranis")) ? LCDTARANIS : LCD9X; } if (image.isNull()) { return false; } - // Prepare and display image + // Load image if (*format==LCDTARANIS) { - image=image.convertToFormat(QImage::Format_RGB32); - QRgb col; - int gray; - int width = image.width(); - int height = image.height(); - for (int i = 0; i < width; ++i) { - for (int j = 0; j < height; ++j) { - col = image.pixel(i, j); - gray = qGray(col); - image.setPixel(i, j, qRgb(gray, gray, gray)); - } - } - imageLabel->setPixmap(QPixmap::fromImage(image.scaled(imageLabel->width()/2, imageLabel->height()/2))); + imageLabel->setPixmap( makePixMap( image, "taranis" )); + imageLabel->setFixedSize(WIDTH_TARANIS*2, HEIGHT_TARANIS*2); } - else - imageLabel->setPixmap(QPixmap::fromImage(image.scaled(imageLabel->width()/2, imageLabel->height()/2).convertToFormat(QImage::Format_Mono))); - - if (*format == LCD9X) - imageLabel->setFixedSize(WIDTH_9X*2, HEIGHT_9X*2); - else - imageLabel->setFixedSize(WIDTH_TARANIS*2, HEIGHT_TARANIS*2); - + else { + imageLabel->setPixmap( makePixMap( image, "9x" )); + imageLabel->setFixedSize(WIDTH_9X*2, HEIGHT_9X*2); + } + switch (pictSource){ - case FW: - fileNameEdit->setText(QObject::tr("FW: %1").arg(fileName)); - *saveToFileName = fileName; - *source=FW; - break; - case PICT: - fileNameEdit->setText(QObject::tr("Pict: %1").arg(fileName)); - *saveToFileName = fileName; - *source=PICT; - break; - case PROFILE: - fileNameEdit->setText(QObject::tr("Profile image")); - *saveToFileName = fileName; - *source=PROFILE; - break; - default: - break; + case FW: + fileNameEdit->setText(QObject::tr("FW: %1").arg(fileName)); + *saveToFileName = fileName; + *source=FW; + break; + case PICT: + fileNameEdit->setText(QObject::tr("Pict: %1").arg(fileName)); + *saveToFileName = fileName; + *source=PICT; + break; + case PROFILE: + fileNameEdit->setText(QObject::tr("Profile image")); + *saveToFileName = fileName; + *source=PROFILE; + break; + default: + break; } saveButton->setEnabled(true); libraryButton->setEnabled(true); @@ -160,8 +156,17 @@ customizeSplashDialog::customizeSplashDialog(QWidget *parent) : right.libraryButton = ui->rightLibraryButton; left.invertButton = ui->leftInvertButton; right.invertButton = ui->rightInvertButton; + + left.loadFwButton = ui->leftLoadFwButton; + right.loadFwButton = ui->rightLoadFwButton; + left.loadPictButton = ui->leftLoadPictButton; + right.loadPictButton = ui->rightLoadPictButton; + left.loadProfileButton = ui->leftLoadProfileButton; + right.loadProfileButton = ui->rightLoadProfileButton; loadProfile(left); + left.markSourceButton(); + resize(0,0); } @@ -182,13 +187,14 @@ void customizeSplashDialog::on_leftLoadFwButton_clicked() {loadFirmware(left);} void customizeSplashDialog::on_rightLoadFwButton_clicked() {loadFirmware(right);} void customizeSplashDialog::loadFirmware(Side side) { - QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), g.flashDir(), FLASH_FILES_FILTER); + QString fileName = QFileDialog::getOpenFileName(this, tr("Open Firmware File"), g.flashDir(), FLASH_FILES_FILTER); if (!fileName.isEmpty()) { if (!side.displayImage( fileName, FW )) - QMessageBox::critical(this, tr("Error"), tr("Cannot load embedded FW image from %1.").arg(fileName)); + QMessageBox::critical(this, tr("Error"), tr("Can not load embedded image from firmware file %1.").arg(fileName)); else g.flashDir( QFileInfo(fileName).dir().absolutePath() ); } + side.markSourceButton(); } void customizeSplashDialog::on_leftLoadPictButton_clicked() {loadPicture(left);} @@ -208,6 +214,7 @@ void customizeSplashDialog::loadPicture(Side side) else g.imagesDir( QFileInfo(fileName).dir().absolutePath() ); } + side.markSourceButton(); } void customizeSplashDialog::on_leftLoadProfileButton_clicked() {loadProfile(left);} @@ -220,6 +227,7 @@ void customizeSplashDialog::loadProfile(Side side) if (!side.displayImage( fileName, PROFILE )) QMessageBox::critical(this, tr("Error"), tr("Cannot load the profile image %1.").arg(fileName)); } + side.markSourceButton(); } void customizeSplashDialog::on_leftLibraryButton_clicked(){libraryButton_clicked(left);} diff --git a/companion/src/customizesplashdialog.h b/companion/src/customizesplashdialog.h index 21155dede..c931005b2 100644 --- a/companion/src/customizesplashdialog.h +++ b/companion/src/customizesplashdialog.h @@ -22,6 +22,7 @@ class Side { public: Side(); + void markSourceButton(); void copyImage( Side ); bool displayImage( QString fileName, Source source ); bool saveImage(); @@ -32,6 +33,9 @@ public: QPushButton *saveButton; QPushButton *invertButton; QToolButton *libraryButton; + QPushButton *loadFwButton; + QPushButton *loadPictButton; + QPushButton *loadProfileButton; QString *saveToFileName; diff --git a/companion/src/customizesplashdialog.ui b/companion/src/customizesplashdialog.ui index de4d68f24..72b241276 100644 --- a/companion/src/customizesplashdialog.ui +++ b/companion/src/customizesplashdialog.ui @@ -258,6 +258,9 @@ Load Profile + + true + @@ -265,6 +268,9 @@ Load FW + + true + @@ -272,6 +278,9 @@ Load Pict + + true + @@ -554,6 +563,9 @@ Load Profile + + true + @@ -564,6 +576,9 @@ Load FW + + true + @@ -571,6 +586,9 @@ Load Pict + + true + diff --git a/companion/src/eepromimportexport.h b/companion/src/eepromimportexport.h index 91eda318c..242c1f7f7 100644 --- a/companion/src/eepromimportexport.h +++ b/companion/src/eepromimportexport.h @@ -650,12 +650,14 @@ class ConversionField: public TransformedField { if (!error.isEmpty()) EEPROMWarnings += error + "\n"; } - else if (shift) { + + if (shift) { if (val < min) _field = min + shift; else if (val > max) _field = max + shift; else _field = val + shift; } - else { + + if (exportFunc) { _field = exportFunc(val); } } @@ -666,10 +668,10 @@ class ConversionField: public TransformedField { if (table->importValue(_field, field)) return; } - else if (shift) { - field = _field - shift; - } - else { + + field = _field - shift; + + if (importFunc) { field = importFunc(_field); } diff --git a/companion/src/eeprominterface.cpp b/companion/src/eeprominterface.cpp index efe817053..2f22df500 100644 --- a/companion/src/eeprominterface.cpp +++ b/companion/src/eeprominterface.cpp @@ -438,6 +438,8 @@ QString LogicalSwitchData::funcToString() case LS_FN_DAPOS: return QObject::tr("|d|>=x"); case LS_FN_VEQUAL: + return QObject::tr("a=x"); + case LS_FN_VALMOSTEQUAL: return QObject::tr("a~x"); case LS_FN_TIMER: return QObject::tr("Timer"); @@ -549,9 +551,9 @@ QString LogicalSwitchData::toString(const ModelData & model) if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) { if (delay) - result += QObject::tr(" Delay %1 sec").arg(delay/2.0); + result += QObject::tr(" Delay %1 sec").arg(delay/10.0); if (duration) - result += QObject::tr(" Duration %1 sec").arg(duration/2.0); + result += QObject::tr(" Duration %1 sec").arg(duration/10.0); } return result; @@ -950,6 +952,7 @@ void ModelData::setDefault(uint8_t id) clear(); used = true; sprintf(name, "MODEL%02d", id+1); + modelId = id+1; } int ModelData::getTrimValue(int phaseIdx, int trimIdx) @@ -1058,7 +1061,7 @@ void RegisterFirmwares() RegisterEepromInterfaces(); } -bool LoadEeprom(RadioData &radioData, uint8_t *eeprom, int size) +bool LoadEeprom(RadioData &radioData, const uint8_t *eeprom, const int size) { foreach(EEPROMInterface *eepromInterface, eepromInterfaces) { if (eepromInterface->load(radioData, eeprom, size)) diff --git a/companion/src/eeprominterface.h b/companion/src/eeprominterface.h index e0fff016e..a6c6e98e1 100644 --- a/companion/src/eeprominterface.h +++ b/companion/src/eeprominterface.h @@ -74,7 +74,7 @@ const uint8_t modn12x3[4][4]= { #define C9X_MAX_ENCODERS 2 #define C9X_NUM_CHNOUT 32 // number of real output channels #define C9X_NUM_CSW 32 // number of custom switches -#define C9X_MAX_CUSTOM_FUNCTIONS 32 // number of functions assigned to switches +#define C9X_MAX_CUSTOM_FUNCTIONS 64 // number of functions assigned to switches #define C9X_NUM_MODULES 2 #define STK_RUD 1 @@ -468,6 +468,9 @@ class GeneralSettings { int beepVolume; int wavVolume; int varioVolume; + int varioPitch; + int varioRange; + int varioRepeat; int backgroundVolume; unsigned int mavbaud; unsigned int switchUnlockStates; @@ -603,6 +606,7 @@ enum CSFunction { LS_FN_DPOS, LS_FN_DAPOS, LS_FN_VEQUAL, // added at the end to avoid everything renumbered + LS_FN_VALMOSTEQUAL, LS_FN_TIMER, LS_FN_STICKY, LS_FN_STAY, @@ -863,7 +867,7 @@ class ModuleData { void clear() { memset(this, 0, sizeof(ModuleData)); } }; -#define C9X_MAX_SCRIPTS 3 +#define C9X_MAX_SCRIPTS 7 #define C9X_MAX_SCRIPT_INPUTS 10 class ScriptData { public: @@ -1085,7 +1089,7 @@ class EEPROMInterface inline BoardEnum getBoard() { return board; } - virtual bool load(RadioData &radioData, uint8_t *eeprom, int size) = 0; + virtual bool load(RadioData &radioData, const uint8_t *eeprom, int size) = 0; virtual bool loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index) = 0; @@ -1214,7 +1218,7 @@ inline void applyStickModeToModel(ModelData &model, unsigned int mode) void RegisterFirmwares(); bool LoadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index); -bool LoadEeprom(RadioData &radioData, uint8_t *eeprom, int size); +bool LoadEeprom(RadioData &radioData, const uint8_t *eeprom, int size); bool LoadEepromXml(RadioData &radioData, QDomDocument &doc); struct Option { diff --git a/companion/src/firmwares/er9x/er9xinterface.cpp b/companion/src/firmwares/er9x/er9xinterface.cpp index a45e5088b..af05f58c5 100644 --- a/companion/src/firmwares/er9x/er9xinterface.cpp +++ b/companion/src/firmwares/er9x/er9xinterface.cpp @@ -114,7 +114,7 @@ bool Er9xInterface::loadxml(RadioData &radioData, QDomDocument &doc) return true; } -bool Er9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size) +bool Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size) { std::cout << "trying er9x import... "; @@ -123,7 +123,7 @@ bool Er9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size) return false; } - if (!efile->EeFsOpen(eeprom, size, BOARD_STOCK)) { + if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) { std::cout << "wrong file system\n"; return false; } diff --git a/companion/src/firmwares/er9x/er9xinterface.h b/companion/src/firmwares/er9x/er9xinterface.h index e6d60b6ee..9ea4854be 100644 --- a/companion/src/firmwares/er9x/er9xinterface.h +++ b/companion/src/firmwares/er9x/er9xinterface.h @@ -34,7 +34,7 @@ class Er9xInterface : public EEPROMInterface virtual const int getMaxModels(); - virtual bool load(RadioData &, uint8_t * eeprom, int size); + virtual bool load(RadioData &, const uint8_t * eeprom, int size); virtual bool loadBackup(RadioData &, uint8_t * eeprom, int esize, int index); diff --git a/companion/src/firmwares/ersky9x/ersky9xinterface.cpp b/companion/src/firmwares/ersky9x/ersky9xinterface.cpp index 97ed8fd5b..7ff98b5a1 100644 --- a/companion/src/firmwares/ersky9x/ersky9xinterface.cpp +++ b/companion/src/firmwares/ersky9x/ersky9xinterface.cpp @@ -151,7 +151,7 @@ bool Ersky9xInterface::loadxml(RadioData &radioData, QDomDocument &doc) return true; } -bool Ersky9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size) +bool Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size) { std::cout << "trying ersky9x import... "; @@ -160,7 +160,7 @@ bool Ersky9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size) return false; } - if (!efile->EeFsOpen(eeprom, size, BOARD_SKY9X)) { + if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_SKY9X)) { std::cout << "wrong file system\n"; return false; } diff --git a/companion/src/firmwares/ersky9x/ersky9xinterface.h b/companion/src/firmwares/ersky9x/ersky9xinterface.h index 23473eae4..d37151c05 100644 --- a/companion/src/firmwares/ersky9x/ersky9xinterface.h +++ b/companion/src/firmwares/ersky9x/ersky9xinterface.h @@ -34,7 +34,7 @@ class Ersky9xInterface : public EEPROMInterface virtual const int getMaxModels(); - virtual bool load(RadioData &, uint8_t * eeprom, int size); + virtual bool load(RadioData &, const uint8_t * eeprom, int size); virtual bool loadBackup(RadioData &, uint8_t * eeprom, int esize, int index); diff --git a/companion/src/firmwares/gruvin9x/gruvin9xinterface.cpp b/companion/src/firmwares/gruvin9x/gruvin9xinterface.cpp index a7d1d6f1a..7a2ce5f46 100644 --- a/companion/src/firmwares/gruvin9x/gruvin9xinterface.cpp +++ b/companion/src/firmwares/gruvin9x/gruvin9xinterface.cpp @@ -99,7 +99,7 @@ bool Gruvin9xInterface::loadxml(RadioData &radioData, QDomDocument &doc) } -bool Gruvin9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size) +bool Gruvin9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size) { std::cout << "trying " << getName() << " import... "; @@ -108,7 +108,7 @@ bool Gruvin9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size) return false; } - if (!efile->EeFsOpen(eeprom, size, BOARD_STOCK)) { + if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) { std::cout << "wrong file system\n"; return false; } diff --git a/companion/src/firmwares/gruvin9x/gruvin9xinterface.h b/companion/src/firmwares/gruvin9x/gruvin9xinterface.h index 7da0975e1..2c8a28dc2 100644 --- a/companion/src/firmwares/gruvin9x/gruvin9xinterface.h +++ b/companion/src/firmwares/gruvin9x/gruvin9xinterface.h @@ -35,7 +35,7 @@ class Gruvin9xInterface : public EEPROMInterface virtual const int getMaxModels(); - virtual bool load(RadioData &, uint8_t *eeprom, int size); + virtual bool load(RadioData &, const uint8_t *eeprom, int size); virtual bool loadBackup(RadioData &, uint8_t *eeprom,int esize, int index); diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index 12fa096a3..eecdbe3e0 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -20,7 +20,7 @@ #define MAX_CHANNELS(board, version) (IS_ARM(board) ? 32 : 16) #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_CUSTOM_FUNCTIONS(board, version) (IS_ARM(board) ? (version >= 216 ? 64 : 32) : (IS_DBLEEPROM(board, version) ? 24 : 16)) #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) @@ -164,7 +164,7 @@ class SourcesConversionTable: public ConversionTable { 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 i=0; i<7; i++) { for (int j=0; j<6; j++) { addConversion(RawSource(SOURCE_TYPE_LUA_INPUT, i*16+j), val++); } @@ -1167,8 +1167,10 @@ class LogicalSwitchesFunctionsTable: public ConversionTable { int val=0; bool afterrelease21March2013 = IS_AFTER_RELEASE_21_MARCH_2013(board, version); addConversion(LS_FN_OFF, val++); - if (afterrelease21March2013) + if (IS_ARM(board) && version >= 216) addConversion(LS_FN_VEQUAL, val++); + if (afterrelease21March2013) + addConversion(LS_FN_VALMOSTEQUAL, val++); addConversion(LS_FN_VPOS, val++); addConversion(LS_FN_VNEG, val++); if (IS_ARM(board) && version >= 216) val++; // later RANGE @@ -1300,8 +1302,9 @@ class LogicalSwitchField: public TransformedField { if (IS_ARM(board)) { internalField.Append(new ConversionField< UnsignedField<8> >(csw.func, &functionsConversionTable, "Function")); - internalField.Append(new UnsignedField<8>(csw.delay)); - internalField.Append(new UnsignedField<8>(csw.duration)); + int scale = (version >= 216 ? 0 : 5); + internalField.Append(new ConversionField< UnsignedField<8> >(csw.delay, 0, scale)); + internalField.Append(new ConversionField< UnsignedField<8> >(csw.duration, 0, scale)); if (version >= 214) { internalField.Append(new ConversionField< SignedField<8> >((int &)csw.andsw, andswitchesConversionTable, "AND switch")); } @@ -1364,6 +1367,49 @@ class LogicalSwitchField: public TransformedField { else if (csw.func != LS_FN_OFF) { sourcesConversionTable->importValue((uint8_t)v1, csw.val1); csw.val2 = v2; + RawSource val1(csw.val1); + if (IS_ARM(board) && version < 216 && val1.type == SOURCE_TYPE_TELEMETRY) { + switch (val1.index) { + case TELEMETRY_SOURCE_TIMER1: + case TELEMETRY_SOURCE_TIMER2: + csw.val2 = (csw.val2 + 128) * 3; + break; + case TELEMETRY_SOURCE_ALT: + case TELEMETRY_SOURCE_GPS_ALT: + case TELEMETRY_SOURCE_ALT_MIN: + case TELEMETRY_SOURCE_ALT_MAX: + csw.val2 = (csw.val2 + 128) * 8 - 500; + break; + case TELEMETRY_SOURCE_RPM: + case TELEMETRY_SOURCE_RPM_MAX: + csw.val2 = (csw.val2 + 128) * 50; + break; + case TELEMETRY_SOURCE_T1: + case TELEMETRY_SOURCE_T2: + case TELEMETRY_SOURCE_T1_MAX: + case TELEMETRY_SOURCE_T2_MAX: + csw.val2 = (csw.val2 + 128) + 30; + break; + case TELEMETRY_SOURCE_CELL: + case TELEMETRY_SOURCE_HDG: + csw.val2 = (csw.val2 + 128) * 2; + break; + case TELEMETRY_SOURCE_DIST: + case TELEMETRY_SOURCE_DIST_MAX: + csw.val2 = (csw.val2 + 128) * 8; + break; + case TELEMETRY_SOURCE_CURRENT: + case TELEMETRY_SOURCE_POWER: + csw.val2 = (csw.val2 + 128) * 5; + break; + case TELEMETRY_SOURCE_CONSUMPTION: + csw.val2 = (csw.val2 + 128) * 20; + break; + default: + csw.val2 += 128; + break; + } + } } } @@ -1542,7 +1588,9 @@ class ArmCustomFunctionField: public TransformedField { internalField.Append(new SwitchField<8>(fn.swtch, board, version)); internalField.Append(new ConversionField< UnsignedField<8> >((unsigned int &)fn.func, &functionsConversionTable, "Function", ::QObject::tr("OpenTX on this board doesn't accept this function"))); - if (IS_TARANIS(board)) + if (IS_TARANIS(board) && version >= 216) + internalField.Append(new CharField<8>(_param, false)); + else if (IS_TARANIS(board)) internalField.Append(new CharField<10>(_param, false)); else internalField.Append(new CharField<6>(_param, false)); @@ -2283,7 +2331,7 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u } if (IS_TARANIS(board) && version >= 216) { - for (int i=0; i<3; i++) { + for (int i=0; i<7; i++) { ScriptData & script = modelData.scriptData[i]; internalField.Append(new ZCharField<10>(script.filename)); internalField.Append(new ZCharField<10>(script.name)); @@ -2450,6 +2498,11 @@ Open9xGeneralDataNew::Open9xGeneralDataNew(GeneralSettings & generalData, BoardE internalField.Append(new SignedField<8>(generalData.beepVolume)); internalField.Append(new SignedField<8>(generalData.wavVolume)); internalField.Append(new SignedField<8>(generalData.varioVolume)); + if (version >= 216) { + internalField.Append(new SignedField<8>(generalData.varioPitch)); + internalField.Append(new SignedField<8>(generalData.varioRange)); + internalField.Append(new SignedField<8>(generalData.varioRepeat)); + } internalField.Append(new SignedField<8>(generalData.backgroundVolume)); } if (IS_TARANIS(board) && version >= 216) { diff --git a/companion/src/firmwares/opentx/opentxinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp index 0b832e086..bfa13a168 100644 --- a/companion/src/firmwares/opentx/opentxinterface.cpp +++ b/companion/src/firmwares/opentx/opentxinterface.cpp @@ -290,7 +290,7 @@ bool OpenTxInterface::loadxml(RadioData &radioData, QDomDocument &doc) return false; } -bool OpenTxInterface::load(RadioData &radioData, uint8_t *eeprom, int size) +bool OpenTxInterface::load(RadioData &radioData, const uint8_t *eeprom, int size) { std::cout << "trying " << getName() << " import..."; @@ -305,7 +305,8 @@ bool OpenTxInterface::load(RadioData &radioData, uint8_t *eeprom, int size) if (notnull) { std::cout << " wrong size (" << size << ")\n"; return false; - } else { + } + else { QMessageBox::warning(NULL, "companion", QObject::tr("Your radio probably uses a wrong firmware,\n eeprom size is 4096 but only the first 2048 are used")); size=2048; } @@ -315,7 +316,7 @@ bool OpenTxInterface::load(RadioData &radioData, uint8_t *eeprom, int size) } } - if (!efile->EeFsOpen(eeprom, size, board)) { + if (!efile->EeFsOpen((uint8_t *)eeprom, size, board)) { std::cout << " wrong file system\n"; return false; } @@ -517,7 +518,7 @@ int OpenTxInterface::getCapability(const Capability capability) return (IS_TARANIS(board) ? 22 : 9); case CustomFunctions: if (IS_ARM(board)) - return 32; + return 64; else if (board==BOARD_GRUVIN9X||board==BOARD_M128) return 24; else @@ -550,7 +551,7 @@ int OpenTxInterface::getCapability(const Capability capability) case VoicesAsNumbers: return (IS_ARM(board) ? 0 : 1); case VoicesMaxLength: - return (IS_ARM(board) ? (IS_TARANIS(board) ? 10 : 6) : 0); + return (IS_ARM(board) ? (IS_TARANIS(board) ? 8 : 6) : 0); case MultiLangVoice: return (IS_ARM(board) ? 1 : 0); case SoundPitch: diff --git a/companion/src/firmwares/opentx/opentxinterface.h b/companion/src/firmwares/opentx/opentxinterface.h index aef381164..809b9f926 100644 --- a/companion/src/firmwares/opentx/opentxinterface.h +++ b/companion/src/firmwares/opentx/opentxinterface.h @@ -37,7 +37,7 @@ class OpenTxInterface : public EEPROMInterface virtual const int getMaxModels(); - virtual bool load(RadioData &, uint8_t *eeprom, int size); + virtual bool load(RadioData &, const uint8_t *eeprom, int size); virtual bool loadBackup(RadioData &, uint8_t *eeprom, int esize, int index); diff --git a/companion/src/firmwares/th9x/th9xinterface.cpp b/companion/src/firmwares/th9x/th9xinterface.cpp index c0f4f7c4e..8e1b50866 100644 --- a/companion/src/firmwares/th9x/th9xinterface.cpp +++ b/companion/src/firmwares/th9x/th9xinterface.cpp @@ -62,7 +62,7 @@ bool Th9xInterface::loadxml(RadioData &radioData, QDomDocument &doc) return false; } -bool Th9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size) +bool Th9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size) { std::cout << "trying th9x import... "; @@ -71,7 +71,7 @@ bool Th9xInterface::load(RadioData &radioData, uint8_t *eeprom, int size) return false; } - if (!efile->EeFsOpen(eeprom, size, BOARD_STOCK)) { + if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) { std::cout << "wrong file system\n"; return false; } diff --git a/companion/src/firmwares/th9x/th9xinterface.h b/companion/src/firmwares/th9x/th9xinterface.h index 6e0372107..9b63e7695 100644 --- a/companion/src/firmwares/th9x/th9xinterface.h +++ b/companion/src/firmwares/th9x/th9xinterface.h @@ -34,7 +34,7 @@ class Th9xInterface : public EEPROMInterface virtual const int getMaxModels(); - virtual bool load(RadioData &, uint8_t *eeprom, int size); + virtual bool load(RadioData &, const uint8_t *eeprom, int size); virtual bool loadBackup(RadioData &, uint8_t *eeprom, int esize, int index); diff --git a/companion/src/flashinterface.cpp b/companion/src/flashinterface.cpp index b72c39cbf..0b56cc795 100644 --- a/companion/src/flashinterface.cpp +++ b/companion/src/flashinterface.cpp @@ -52,7 +52,7 @@ FlashInterface::FlashInterface(QString fileName) char * bin_flash = (char *)malloc(MAX_FSIZE); flash_size = file.read(bin_flash, MAX_FSIZE); flash = QByteArray(bin_flash, flash_size); - free(bin_flash); + free(bin_flash); } else { flash = QByteArray(temp, flash_size); diff --git a/companion/src/flashinterface.h b/companion/src/flashinterface.h index 402c2410d..eb1459d85 100644 --- a/companion/src/flashinterface.h +++ b/companion/src/flashinterface.h @@ -92,5 +92,5 @@ private: protected: bool isValidFlag; }; -#endif /* FLASHINTERFACE_H */ +#endif /* FLASHINTERFACE_H */ diff --git a/companion/src/fwpreferencesdialog.cpp b/companion/src/fwpreferencesdialog.cpp index 17c7c6caf..ec2585ddc 100644 --- a/companion/src/fwpreferencesdialog.cpp +++ b/companion/src/fwpreferencesdialog.cpp @@ -213,7 +213,7 @@ void fwPreferencesDialog::writeValues() { g.cpuId( ui->CPU_ID_LE->text() ); current_firmware_variant = getFirmwareVariant(); - g.profile[g.id()].firmware( current_firmware_variant.id ); + g.profile[g.id()].fwType( current_firmware_variant.id ); } void fwPreferencesDialog::populateFirmwareOptions(const FirmwareInfo * firmware) @@ -290,7 +290,7 @@ void fwPreferencesDialog::on_checkFWUpdates_clicked() FirmwareVariant variant = getFirmwareVariant(); if (g.profile[g.id()].burnFirmware()) { current_firmware_variant = variant; - g.profile[g.id()].firmware( variant.id ); + g.profile[g.id()].fwType( variant.id ); } MainWindow * mw = (MainWindow *)this->parent(); mw->checkForUpdates(true, variant.id); @@ -305,7 +305,7 @@ void fwPreferencesDialog::on_fw_dnld_clicked() if (!variant.firmware->getUrl(variant.id).isNull()) { if (g.profile[g.id()].burnFirmware()) { current_firmware_variant = getFirmwareVariant(); - g.profile[g.id()].firmware( current_firmware_variant.id ); + g.profile[g.id()].fwType( current_firmware_variant.id ); } mw->downloadLatestFW(current_firmware_variant.firmware, current_firmware_variant.id); } diff --git a/companion/src/fwpreferencesdialog.ui b/companion/src/fwpreferencesdialog.ui index 28585c2ac..d095e2cb7 100644 --- a/companion/src/fwpreferencesdialog.ui +++ b/companion/src/fwpreferencesdialog.ui @@ -157,7 +157,11 @@ - + + + false + + diff --git a/companion/src/generaledit.cpp b/companion/src/generaledit.cpp index 6e96e0368..8cccc654c 100644 --- a/companion/src/generaledit.cpp +++ b/companion/src/generaledit.cpp @@ -20,7 +20,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) : ui->setupUi(this); this->setWindowIcon(CompanionIcon("open.png")); - QString firmware_id = g.profile[g.id()].firmware(); + QString firmware_id = g.profile[g.id()].fwType(); ui->tabWidget->setCurrentIndex( g.generalEditTab() ); QString name=g.profile[g.id()].name(); if (name.isEmpty()) { @@ -74,7 +74,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) : if (!name.isEmpty()) { ui->profile_CB->addItem(name, i); if (i==g.id()) { - ui->profile_CB->setCurrentIndex(ui->profile_CB->count()); + ui->profile_CB->setCurrentIndex(ui->profile_CB->count()-1); } } } diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp index 4fd070430..345d87bf4 100644 --- a/companion/src/helpers.cpp +++ b/companion/src/helpers.cpp @@ -2,6 +2,7 @@ #include "appdata.h" #include "helpers.h" #include "simulatordialog.h" +#include "flashinterface.h" QString getPhaseName(int val, char * phasename) { @@ -642,6 +643,7 @@ void populateCSWCB(QComboBox *b, int value) int order[] = { LS_FN_OFF, LS_FN_VEQUAL, // added at the end to avoid everything renumbered + LS_FN_VALMOSTEQUAL, // added at the end to avoid everything renumbered LS_FN_VPOS, LS_FN_VNEG, // LS_FN_RANGE, @@ -694,6 +696,14 @@ QString image2qstring(QImage image) return ImageStr; } +// TODO KKERNEN 20140222 +// I am sure that this code has had some kind of function, but now it only seems to cause +// problems. I think it is an attempt to open an image file from a double byte string which +// is first converted to a single byte string. Only used in burndialog.cpp +// It doesn't work for me in 2.0. I do not know why. I doubt it has ever worked for files or +// file paths containing non-english characters. +// Code can be removed ,when 2.0 is tested. + QImage qstring2image(QString imagestr) { bool ok; @@ -938,3 +948,48 @@ void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx) QObject::tr("Simulator for this firmware is not yet available")); } } + +QPixmap makePixMap( QImage image, QString firmwareType ) +{ + if (firmwareType.contains( "taranis" )) { + image = image.convertToFormat(QImage::Format_RGB32); + QRgb col; + int gray; + for (int i = 0; i < image.width(); ++i) { + for (int j = 0; j < image.height(); ++j) { + col = image.pixel(i, j); + gray = qGray(col); + image.setPixel(i, j, qRgb(gray, gray, gray)); + } + } + image = image.scaled(SPLASHX9D_WIDTH, SPLASHX9D_HEIGHT); + } + else { + image = image.scaled(SPLASH_WIDTH, SPLASH_HEIGHT).convertToFormat(QImage::Format_Mono); + } + return(QPixmap::fromImage(image)); +} + +int getRadioType(QString firmwareType) +{ + if (firmwareType.contains( "taranis" )) return 6; + if (firmwareType.contains( "sky9x" )) return 5; + if (firmwareType.contains( "gruvin9x")) return 4; + if (firmwareType.contains( "9xr128" )) return 3; + if (firmwareType.contains( "9xr" )) return 2; + if (firmwareType.contains( "9x128" )) return 1; + return 0; // 9x +} + +QString getDefaultFwType( int radioType ) +{ + switch (radioType){ + case 6: return "opentx-taranis-en"; + case 5: return "opentx-sky9x-en"; + case 4: return "opentx-gruvin9x-en"; + case 3: return "opentx-9xr128-en"; + case 2: return "opentx-9xr-en"; + case 1: return "opentx-9x128-en"; + default: return "opentx-9x-en"; + } +} diff --git a/companion/src/helpers.h b/companion/src/helpers.h index fdebcb170..857d66749 100644 --- a/companion/src/helpers.h +++ b/companion/src/helpers.h @@ -128,4 +128,13 @@ QString getFrSkySrc(int index); void startSimulation(QWidget * parent, RadioData & radioData, int modelIdx); +// Format a pixmap to fit on the radio using a specific firmware +QPixmap makePixMap( QImage image, QString firmwareType ); + +// Return a radio type derived from a firmware type string +int getRadioType(QString firmwareType); + +// Return the default firmware string for a specified radio +QString getDefaultFwType( int radioType ); + #endif // HELPERS_H diff --git a/companion/src/images/library/00001.png b/companion/src/images/library/00001.png index 57c8485a9..43cd387dc 100644 Binary files a/companion/src/images/library/00001.png and b/companion/src/images/library/00001.png differ diff --git a/companion/src/images/library/00002.png b/companion/src/images/library/00002.png index d7f9c54b0..37b24b0d7 100644 Binary files a/companion/src/images/library/00002.png and b/companion/src/images/library/00002.png differ diff --git a/companion/src/images/library/00003.png b/companion/src/images/library/00003.png index 9f3c5d78e..a179deadf 100644 Binary files a/companion/src/images/library/00003.png and b/companion/src/images/library/00003.png differ diff --git a/companion/src/images/library/00004.png b/companion/src/images/library/00004.png index 60858b556..e8494d868 100644 Binary files a/companion/src/images/library/00004.png and b/companion/src/images/library/00004.png differ diff --git a/companion/src/images/library/00005.png b/companion/src/images/library/00005.png index 6d5a1d93d..34e83f860 100644 Binary files a/companion/src/images/library/00005.png and b/companion/src/images/library/00005.png differ diff --git a/companion/src/images/library/00006.png b/companion/src/images/library/00006.png index 64eca2f66..ce8bb5ce1 100644 Binary files a/companion/src/images/library/00006.png and b/companion/src/images/library/00006.png differ diff --git a/companion/src/images/library/00007.png b/companion/src/images/library/00007.png index fa384d1e6..358a29faf 100644 Binary files a/companion/src/images/library/00007.png and b/companion/src/images/library/00007.png differ diff --git a/companion/src/images/library/00008.png b/companion/src/images/library/00008.png index ed7a1c01f..6e45e310a 100644 Binary files a/companion/src/images/library/00008.png and b/companion/src/images/library/00008.png differ diff --git a/companion/src/images/library/00009.png b/companion/src/images/library/00009.png index 6d199bb6f..bf74ff7b5 100644 Binary files a/companion/src/images/library/00009.png and b/companion/src/images/library/00009.png differ diff --git a/companion/src/images/library/00010.png b/companion/src/images/library/00010.png index 2b2081c88..1cab16ab2 100644 Binary files a/companion/src/images/library/00010.png and b/companion/src/images/library/00010.png differ diff --git a/companion/src/images/library/00011.png b/companion/src/images/library/00011.png index ec135da3c..da65dbcb3 100644 Binary files a/companion/src/images/library/00011.png and b/companion/src/images/library/00011.png differ diff --git a/companion/src/images/library/00012.png b/companion/src/images/library/00012.png index f054a15d8..6d1c00fe3 100644 Binary files a/companion/src/images/library/00012.png and b/companion/src/images/library/00012.png differ diff --git a/companion/src/images/library/00013.png b/companion/src/images/library/00013.png index c73a99701..802e9885a 100644 Binary files a/companion/src/images/library/00013.png and b/companion/src/images/library/00013.png differ diff --git a/companion/src/images/library/00014.png b/companion/src/images/library/00014.png index e4d1878c9..802e9885a 100644 Binary files a/companion/src/images/library/00014.png and b/companion/src/images/library/00014.png differ diff --git a/companion/src/images/library/00015.png b/companion/src/images/library/00015.png index 5bf13ecb2..802e9885a 100644 Binary files a/companion/src/images/library/00015.png and b/companion/src/images/library/00015.png differ diff --git a/companion/src/images/library/00016.png b/companion/src/images/library/00016.png index c44d1a5e0..802e9885a 100644 Binary files a/companion/src/images/library/00016.png and b/companion/src/images/library/00016.png differ diff --git a/companion/src/images/library/00017.png b/companion/src/images/library/00017.png new file mode 100644 index 000000000..802e9885a Binary files /dev/null and b/companion/src/images/library/00017.png differ diff --git a/companion/src/images/library/00018.png b/companion/src/images/library/00018.png new file mode 100644 index 000000000..802e9885a Binary files /dev/null and b/companion/src/images/library/00018.png differ diff --git a/companion/src/images/library/00019.png b/companion/src/images/library/00019.png new file mode 100644 index 000000000..802e9885a Binary files /dev/null and b/companion/src/images/library/00019.png differ diff --git a/companion/src/images/library/00020.png b/companion/src/images/library/00020.png new file mode 100644 index 000000000..802e9885a Binary files /dev/null and b/companion/src/images/library/00020.png differ diff --git a/companion/src/images/library/00050.png b/companion/src/images/library/00050.png new file mode 100644 index 000000000..0218d0570 Binary files /dev/null and b/companion/src/images/library/00050.png differ diff --git a/companion/src/images/library/00051.png b/companion/src/images/library/00051.png new file mode 100644 index 000000000..ec135da3c Binary files /dev/null and b/companion/src/images/library/00051.png differ diff --git a/companion/src/images/library/00052.png b/companion/src/images/library/00052.png new file mode 100644 index 000000000..64eca2f66 Binary files /dev/null and b/companion/src/images/library/00052.png differ diff --git a/companion/src/images/library/00053.png b/companion/src/images/library/00053.png new file mode 100644 index 000000000..c73a99701 Binary files /dev/null and b/companion/src/images/library/00053.png differ diff --git a/companion/src/images/library/00054.png b/companion/src/images/library/00054.png new file mode 100644 index 000000000..e4d1878c9 Binary files /dev/null and b/companion/src/images/library/00054.png differ diff --git a/companion/src/images/library/00055.png b/companion/src/images/library/00055.png new file mode 100644 index 000000000..5bf13ecb2 Binary files /dev/null and b/companion/src/images/library/00055.png differ diff --git a/companion/src/images/library/00056.png b/companion/src/images/library/00056.png new file mode 100644 index 000000000..c44d1a5e0 Binary files /dev/null and b/companion/src/images/library/00056.png differ diff --git a/companion/src/images/library/00057.png b/companion/src/images/library/00057.png new file mode 100644 index 000000000..678355ae0 Binary files /dev/null and b/companion/src/images/library/00057.png differ diff --git a/companion/src/images/library/00058.png b/companion/src/images/library/00058.png new file mode 100644 index 000000000..fa384d1e6 Binary files /dev/null and b/companion/src/images/library/00058.png differ diff --git a/companion/src/images/library/00059.png b/companion/src/images/library/00059.png new file mode 100644 index 000000000..6d5a1d93d Binary files /dev/null and b/companion/src/images/library/00059.png differ diff --git a/companion/src/images/library/00060.png b/companion/src/images/library/00060.png new file mode 100644 index 000000000..9f3c5d78e Binary files /dev/null and b/companion/src/images/library/00060.png differ diff --git a/companion/src/images/library/00061.png b/companion/src/images/library/00061.png new file mode 100644 index 000000000..f054a15d8 Binary files /dev/null and b/companion/src/images/library/00061.png differ diff --git a/companion/src/images/library/00062.png b/companion/src/images/library/00062.png new file mode 100644 index 000000000..ed7a1c01f Binary files /dev/null and b/companion/src/images/library/00062.png differ diff --git a/companion/src/images/library/00063.png b/companion/src/images/library/00063.png new file mode 100644 index 000000000..6d199bb6f Binary files /dev/null and b/companion/src/images/library/00063.png differ diff --git a/companion/src/images/library/00064.png b/companion/src/images/library/00064.png new file mode 100644 index 000000000..2b2081c88 Binary files /dev/null and b/companion/src/images/library/00064.png differ diff --git a/companion/src/images/library/00065.png b/companion/src/images/library/00065.png new file mode 100644 index 000000000..4a92323e5 Binary files /dev/null and b/companion/src/images/library/00065.png differ diff --git a/companion/src/images/library/00066.png b/companion/src/images/library/00066.png new file mode 100644 index 000000000..2e7668f7d Binary files /dev/null and b/companion/src/images/library/00066.png differ diff --git a/companion/src/images/library/00100.png b/companion/src/images/library/00100.png new file mode 100644 index 000000000..12fd5b70f Binary files /dev/null and b/companion/src/images/library/00100.png differ diff --git a/companion/src/images/library/00101.png b/companion/src/images/library/00101.png new file mode 100644 index 000000000..277f90714 Binary files /dev/null and b/companion/src/images/library/00101.png differ diff --git a/companion/src/images/library/00102.png b/companion/src/images/library/00102.png new file mode 100644 index 000000000..5319738e6 Binary files /dev/null and b/companion/src/images/library/00102.png differ diff --git a/companion/src/images/library/00103.png b/companion/src/images/library/00103.png new file mode 100644 index 000000000..ededfb8ac Binary files /dev/null and b/companion/src/images/library/00103.png differ diff --git a/companion/src/images/library/00104.png b/companion/src/images/library/00104.png new file mode 100644 index 000000000..c2649499d Binary files /dev/null and b/companion/src/images/library/00104.png differ diff --git a/companion/src/images/library/00105.png b/companion/src/images/library/00105.png new file mode 100644 index 000000000..c109f03f1 Binary files /dev/null and b/companion/src/images/library/00105.png differ diff --git a/companion/src/images/library/00106.png b/companion/src/images/library/00106.png new file mode 100644 index 000000000..01476b196 Binary files /dev/null and b/companion/src/images/library/00106.png differ diff --git a/companion/src/images/library/00201.png b/companion/src/images/library/00201.png new file mode 100644 index 000000000..a5e6349a3 Binary files /dev/null and b/companion/src/images/library/00201.png differ diff --git a/companion/src/images/library/10011.png b/companion/src/images/library/00202.png similarity index 100% rename from companion/src/images/library/10011.png rename to companion/src/images/library/00202.png diff --git a/companion/src/images/library/10007.png b/companion/src/images/library/00203.png similarity index 100% rename from companion/src/images/library/10007.png rename to companion/src/images/library/00203.png diff --git a/companion/src/images/library/10015.png b/companion/src/images/library/00204.png similarity index 100% rename from companion/src/images/library/10015.png rename to companion/src/images/library/00204.png diff --git a/companion/src/images/library/10094.png b/companion/src/images/library/00301.png similarity index 100% rename from companion/src/images/library/10094.png rename to companion/src/images/library/00301.png diff --git a/companion/src/images/library/10096.png b/companion/src/images/library/00302.png similarity index 100% rename from companion/src/images/library/10096.png rename to companion/src/images/library/00302.png diff --git a/companion/src/images/library/10070.png b/companion/src/images/library/00303.png similarity index 100% rename from companion/src/images/library/10070.png rename to companion/src/images/library/00303.png diff --git a/companion/src/images/library/00304.png b/companion/src/images/library/00304.png new file mode 100644 index 000000000..936732b2e Binary files /dev/null and b/companion/src/images/library/00304.png differ diff --git a/companion/src/images/library/00401.png b/companion/src/images/library/00401.png new file mode 100644 index 000000000..553abc70b Binary files /dev/null and b/companion/src/images/library/00401.png differ diff --git a/companion/src/images/library/00402.png b/companion/src/images/library/00402.png new file mode 100644 index 000000000..ec94b1a34 Binary files /dev/null and b/companion/src/images/library/00402.png differ diff --git a/companion/src/images/library/00403.png b/companion/src/images/library/00403.png new file mode 100644 index 000000000..71e3824f6 Binary files /dev/null and b/companion/src/images/library/00403.png differ diff --git a/companion/src/images/library/00404.png b/companion/src/images/library/00404.png new file mode 100644 index 000000000..9715eb04c Binary files /dev/null and b/companion/src/images/library/00404.png differ diff --git a/companion/src/images/library/00501.png b/companion/src/images/library/00501.png new file mode 100644 index 000000000..44bb7ad5a Binary files /dev/null and b/companion/src/images/library/00501.png differ diff --git a/companion/src/images/library/01001.png b/companion/src/images/library/01001.png deleted file mode 100644 index 47fec20ff..000000000 Binary files a/companion/src/images/library/01001.png and /dev/null differ diff --git a/companion/src/images/library/01002.png b/companion/src/images/library/01002.png deleted file mode 100644 index e83381a48..000000000 Binary files a/companion/src/images/library/01002.png and /dev/null differ diff --git a/companion/src/images/library/01003.png b/companion/src/images/library/01003.png deleted file mode 100644 index 88f5676db..000000000 Binary files a/companion/src/images/library/01003.png and /dev/null differ diff --git a/companion/src/images/library/01004.png b/companion/src/images/library/01004.png deleted file mode 100644 index bc2a06103..000000000 Binary files a/companion/src/images/library/01004.png and /dev/null differ diff --git a/companion/src/images/library/01005.png b/companion/src/images/library/01005.png deleted file mode 100644 index b4aea5dfe..000000000 Binary files a/companion/src/images/library/01005.png and /dev/null differ diff --git a/companion/src/images/library/01006.png b/companion/src/images/library/01006.png deleted file mode 100644 index 448f590da..000000000 Binary files a/companion/src/images/library/01006.png and /dev/null differ diff --git a/companion/src/images/library/01007.png b/companion/src/images/library/01007.png deleted file mode 100644 index cb9a53702..000000000 Binary files a/companion/src/images/library/01007.png and /dev/null differ diff --git a/companion/src/images/library/01008.png b/companion/src/images/library/01008.png deleted file mode 100644 index da3346f7d..000000000 Binary files a/companion/src/images/library/01008.png and /dev/null differ diff --git a/companion/src/images/library/10001.png b/companion/src/images/library/10001.png index 51e85006a..8abdaba2a 100644 Binary files a/companion/src/images/library/10001.png and b/companion/src/images/library/10001.png differ diff --git a/companion/src/images/library/10002.png b/companion/src/images/library/10002.png index 47b108be9..ac46509c2 100644 Binary files a/companion/src/images/library/10002.png and b/companion/src/images/library/10002.png differ diff --git a/companion/src/images/library/10003.png b/companion/src/images/library/10003.png index ad62abd01..0fa584dbb 100644 Binary files a/companion/src/images/library/10003.png and b/companion/src/images/library/10003.png differ diff --git a/companion/src/images/library/10004.png b/companion/src/images/library/10004.png deleted file mode 100644 index 1a93226b7..000000000 Binary files a/companion/src/images/library/10004.png and /dev/null differ diff --git a/companion/src/images/library/10005.png b/companion/src/images/library/10005.png deleted file mode 100644 index b25163b8c..000000000 Binary files a/companion/src/images/library/10005.png and /dev/null differ diff --git a/companion/src/images/library/10006.png b/companion/src/images/library/10006.png deleted file mode 100644 index ca77bbd87..000000000 Binary files a/companion/src/images/library/10006.png and /dev/null differ diff --git a/companion/src/images/library/10008.png b/companion/src/images/library/10008.png deleted file mode 100644 index 9616e2c12..000000000 Binary files a/companion/src/images/library/10008.png and /dev/null differ diff --git a/companion/src/images/library/10009.png b/companion/src/images/library/10009.png deleted file mode 100644 index 1919fc94b..000000000 Binary files a/companion/src/images/library/10009.png and /dev/null differ diff --git a/companion/src/images/library/10010.png b/companion/src/images/library/10010.png deleted file mode 100644 index 0ef805645..000000000 Binary files a/companion/src/images/library/10010.png and /dev/null differ diff --git a/companion/src/images/library/10012.png b/companion/src/images/library/10012.png deleted file mode 100644 index 6007e75d4..000000000 Binary files a/companion/src/images/library/10012.png and /dev/null differ diff --git a/companion/src/images/library/10013.png b/companion/src/images/library/10013.png deleted file mode 100644 index dc8a5efc7..000000000 Binary files a/companion/src/images/library/10013.png and /dev/null differ diff --git a/companion/src/images/library/10014.png b/companion/src/images/library/10014.png deleted file mode 100644 index 6a306d3b2..000000000 Binary files a/companion/src/images/library/10014.png and /dev/null differ diff --git a/companion/src/images/library/10016.png b/companion/src/images/library/10016.png deleted file mode 100644 index d02cb5ceb..000000000 Binary files a/companion/src/images/library/10016.png and /dev/null differ diff --git a/companion/src/images/library/10017.png b/companion/src/images/library/10017.png deleted file mode 100644 index 13f6ed481..000000000 Binary files a/companion/src/images/library/10017.png and /dev/null differ diff --git a/companion/src/images/library/10018.png b/companion/src/images/library/10018.png deleted file mode 100644 index 552c96540..000000000 Binary files a/companion/src/images/library/10018.png and /dev/null differ diff --git a/companion/src/images/library/10019.png b/companion/src/images/library/10019.png deleted file mode 100644 index fcdc73964..000000000 Binary files a/companion/src/images/library/10019.png and /dev/null differ diff --git a/companion/src/images/library/10020.png b/companion/src/images/library/10020.png deleted file mode 100644 index c40348ee7..000000000 Binary files a/companion/src/images/library/10020.png and /dev/null differ diff --git a/companion/src/images/library/10021.png b/companion/src/images/library/10021.png deleted file mode 100644 index 69ea3ad14..000000000 Binary files a/companion/src/images/library/10021.png and /dev/null differ diff --git a/companion/src/images/library/10022.png b/companion/src/images/library/10022.png deleted file mode 100644 index cb746eb74..000000000 Binary files a/companion/src/images/library/10022.png and /dev/null differ diff --git a/companion/src/images/library/10023.png b/companion/src/images/library/10023.png deleted file mode 100644 index 784dbf355..000000000 Binary files a/companion/src/images/library/10023.png and /dev/null differ diff --git a/companion/src/images/library/10024.png b/companion/src/images/library/10024.png deleted file mode 100644 index 4066cd8e0..000000000 Binary files a/companion/src/images/library/10024.png and /dev/null differ diff --git a/companion/src/images/library/10025.png b/companion/src/images/library/10025.png deleted file mode 100644 index 8a1562e52..000000000 Binary files a/companion/src/images/library/10025.png and /dev/null differ diff --git a/companion/src/images/library/10026.png b/companion/src/images/library/10026.png deleted file mode 100644 index 704865b0c..000000000 Binary files a/companion/src/images/library/10026.png and /dev/null differ diff --git a/companion/src/images/library/10027.png b/companion/src/images/library/10027.png deleted file mode 100644 index b872dd0b2..000000000 Binary files a/companion/src/images/library/10027.png and /dev/null differ diff --git a/companion/src/images/library/10028.png b/companion/src/images/library/10028.png deleted file mode 100644 index 842a14dd5..000000000 Binary files a/companion/src/images/library/10028.png and /dev/null differ diff --git a/companion/src/images/library/10029.png b/companion/src/images/library/10029.png deleted file mode 100644 index 800465056..000000000 Binary files a/companion/src/images/library/10029.png and /dev/null differ diff --git a/companion/src/images/library/10030.png b/companion/src/images/library/10030.png deleted file mode 100644 index 705741cea..000000000 Binary files a/companion/src/images/library/10030.png and /dev/null differ diff --git a/companion/src/images/library/10031.png b/companion/src/images/library/10031.png deleted file mode 100644 index 41d3a526f..000000000 Binary files a/companion/src/images/library/10031.png and /dev/null differ diff --git a/companion/src/images/library/10032.png b/companion/src/images/library/10032.png deleted file mode 100644 index 1ed9a3801..000000000 Binary files a/companion/src/images/library/10032.png and /dev/null differ diff --git a/companion/src/images/library/10033.png b/companion/src/images/library/10033.png deleted file mode 100644 index 1e39ed5b4..000000000 Binary files a/companion/src/images/library/10033.png and /dev/null differ diff --git a/companion/src/images/library/10034.png b/companion/src/images/library/10034.png deleted file mode 100644 index cc8b37afb..000000000 Binary files a/companion/src/images/library/10034.png and /dev/null differ diff --git a/companion/src/images/library/10035.png b/companion/src/images/library/10035.png deleted file mode 100644 index 2e14bc941..000000000 Binary files a/companion/src/images/library/10035.png and /dev/null differ diff --git a/companion/src/images/library/10036.png b/companion/src/images/library/10036.png deleted file mode 100644 index e4eb4667f..000000000 Binary files a/companion/src/images/library/10036.png and /dev/null differ diff --git a/companion/src/images/library/10037.png b/companion/src/images/library/10037.png deleted file mode 100644 index 7e85d9fb4..000000000 Binary files a/companion/src/images/library/10037.png and /dev/null differ diff --git a/companion/src/images/library/10038.png b/companion/src/images/library/10038.png deleted file mode 100644 index 69425a5d3..000000000 Binary files a/companion/src/images/library/10038.png and /dev/null differ diff --git a/companion/src/images/library/10039.png b/companion/src/images/library/10039.png deleted file mode 100644 index 586fae0a5..000000000 Binary files a/companion/src/images/library/10039.png and /dev/null differ diff --git a/companion/src/images/library/10040.png b/companion/src/images/library/10040.png deleted file mode 100644 index a6f575c6f..000000000 Binary files a/companion/src/images/library/10040.png and /dev/null differ diff --git a/companion/src/images/library/10041.png b/companion/src/images/library/10041.png deleted file mode 100644 index d7c509449..000000000 Binary files a/companion/src/images/library/10041.png and /dev/null differ diff --git a/companion/src/images/library/10042.png b/companion/src/images/library/10042.png deleted file mode 100644 index 6f4aa2b68..000000000 Binary files a/companion/src/images/library/10042.png and /dev/null differ diff --git a/companion/src/images/library/10043.png b/companion/src/images/library/10043.png deleted file mode 100644 index 7ff6f4bc7..000000000 Binary files a/companion/src/images/library/10043.png and /dev/null differ diff --git a/companion/src/images/library/10044.png b/companion/src/images/library/10044.png deleted file mode 100644 index 0f5ec33dc..000000000 Binary files a/companion/src/images/library/10044.png and /dev/null differ diff --git a/companion/src/images/library/10045.png b/companion/src/images/library/10045.png deleted file mode 100644 index 4e195cbb4..000000000 Binary files a/companion/src/images/library/10045.png and /dev/null differ diff --git a/companion/src/images/library/10046.png b/companion/src/images/library/10046.png deleted file mode 100644 index 99cbb9bb7..000000000 Binary files a/companion/src/images/library/10046.png and /dev/null differ diff --git a/companion/src/images/library/10047.png b/companion/src/images/library/10047.png deleted file mode 100644 index 263ef7508..000000000 Binary files a/companion/src/images/library/10047.png and /dev/null differ diff --git a/companion/src/images/library/10048.png b/companion/src/images/library/10048.png deleted file mode 100644 index 4f1ddcb8f..000000000 Binary files a/companion/src/images/library/10048.png and /dev/null differ diff --git a/companion/src/images/library/10049.png b/companion/src/images/library/10049.png deleted file mode 100644 index 1b00b73b3..000000000 Binary files a/companion/src/images/library/10049.png and /dev/null differ diff --git a/companion/src/images/library/10050.png b/companion/src/images/library/10050.png deleted file mode 100644 index 13f2c3748..000000000 Binary files a/companion/src/images/library/10050.png and /dev/null differ diff --git a/companion/src/images/library/10051.png b/companion/src/images/library/10051.png deleted file mode 100644 index 00ef00a9e..000000000 Binary files a/companion/src/images/library/10051.png and /dev/null differ diff --git a/companion/src/images/library/10052.png b/companion/src/images/library/10052.png deleted file mode 100644 index 00adf5621..000000000 Binary files a/companion/src/images/library/10052.png and /dev/null differ diff --git a/companion/src/images/library/10053.png b/companion/src/images/library/10053.png deleted file mode 100644 index 787d6cce4..000000000 Binary files a/companion/src/images/library/10053.png and /dev/null differ diff --git a/companion/src/images/library/10054.png b/companion/src/images/library/10054.png deleted file mode 100644 index 149e35ada..000000000 Binary files a/companion/src/images/library/10054.png and /dev/null differ diff --git a/companion/src/images/library/10055.png b/companion/src/images/library/10055.png deleted file mode 100644 index 52ae8827b..000000000 Binary files a/companion/src/images/library/10055.png and /dev/null differ diff --git a/companion/src/images/library/10056.png b/companion/src/images/library/10056.png deleted file mode 100644 index 7c9be6730..000000000 Binary files a/companion/src/images/library/10056.png and /dev/null differ diff --git a/companion/src/images/library/10057.png b/companion/src/images/library/10057.png deleted file mode 100644 index ffe4fd58b..000000000 Binary files a/companion/src/images/library/10057.png and /dev/null differ diff --git a/companion/src/images/library/10058.png b/companion/src/images/library/10058.png deleted file mode 100644 index b8a0117fb..000000000 Binary files a/companion/src/images/library/10058.png and /dev/null differ diff --git a/companion/src/images/library/10059.png b/companion/src/images/library/10059.png deleted file mode 100644 index 3d5e9bfc0..000000000 Binary files a/companion/src/images/library/10059.png and /dev/null differ diff --git a/companion/src/images/library/10060.png b/companion/src/images/library/10060.png deleted file mode 100644 index 2837c5398..000000000 Binary files a/companion/src/images/library/10060.png and /dev/null differ diff --git a/companion/src/images/library/10061.png b/companion/src/images/library/10061.png deleted file mode 100644 index 2aec8a703..000000000 Binary files a/companion/src/images/library/10061.png and /dev/null differ diff --git a/companion/src/images/library/10062.png b/companion/src/images/library/10062.png deleted file mode 100644 index 810efb9a9..000000000 Binary files a/companion/src/images/library/10062.png and /dev/null differ diff --git a/companion/src/images/library/10063.png b/companion/src/images/library/10063.png deleted file mode 100644 index 2cd293505..000000000 Binary files a/companion/src/images/library/10063.png and /dev/null differ diff --git a/companion/src/images/library/10064.png b/companion/src/images/library/10064.png deleted file mode 100644 index 6354a2a18..000000000 Binary files a/companion/src/images/library/10064.png and /dev/null differ diff --git a/companion/src/images/library/10065.png b/companion/src/images/library/10065.png deleted file mode 100644 index 87010d65e..000000000 Binary files a/companion/src/images/library/10065.png and /dev/null differ diff --git a/companion/src/images/library/10066.png b/companion/src/images/library/10066.png deleted file mode 100644 index db4917113..000000000 Binary files a/companion/src/images/library/10066.png and /dev/null differ diff --git a/companion/src/images/library/10067.png b/companion/src/images/library/10067.png deleted file mode 100644 index f188c03a8..000000000 Binary files a/companion/src/images/library/10067.png and /dev/null differ diff --git a/companion/src/images/library/10068.png b/companion/src/images/library/10068.png deleted file mode 100644 index b70eb70d7..000000000 Binary files a/companion/src/images/library/10068.png and /dev/null differ diff --git a/companion/src/images/library/10069.png b/companion/src/images/library/10069.png deleted file mode 100644 index 3eb68b5b2..000000000 Binary files a/companion/src/images/library/10069.png and /dev/null differ diff --git a/companion/src/images/library/10071.png b/companion/src/images/library/10071.png deleted file mode 100644 index fa9c6cde7..000000000 Binary files a/companion/src/images/library/10071.png and /dev/null differ diff --git a/companion/src/images/library/10072.png b/companion/src/images/library/10072.png deleted file mode 100644 index 82189cd46..000000000 Binary files a/companion/src/images/library/10072.png and /dev/null differ diff --git a/companion/src/images/library/10073.png b/companion/src/images/library/10073.png deleted file mode 100644 index 37f11ea34..000000000 Binary files a/companion/src/images/library/10073.png and /dev/null differ diff --git a/companion/src/images/library/10074.png b/companion/src/images/library/10074.png deleted file mode 100644 index abf8c3ae2..000000000 Binary files a/companion/src/images/library/10074.png and /dev/null differ diff --git a/companion/src/images/library/10075.png b/companion/src/images/library/10075.png deleted file mode 100644 index e17abfdf7..000000000 Binary files a/companion/src/images/library/10075.png and /dev/null differ diff --git a/companion/src/images/library/10076.png b/companion/src/images/library/10076.png deleted file mode 100644 index 30bd5f62f..000000000 Binary files a/companion/src/images/library/10076.png and /dev/null differ diff --git a/companion/src/images/library/10077.png b/companion/src/images/library/10077.png deleted file mode 100644 index 5cdddbb0b..000000000 Binary files a/companion/src/images/library/10077.png and /dev/null differ diff --git a/companion/src/images/library/10078.png b/companion/src/images/library/10078.png deleted file mode 100644 index 3dc842400..000000000 Binary files a/companion/src/images/library/10078.png and /dev/null differ diff --git a/companion/src/images/library/10079.png b/companion/src/images/library/10079.png deleted file mode 100644 index 387dc81be..000000000 Binary files a/companion/src/images/library/10079.png and /dev/null differ diff --git a/companion/src/images/library/10080.png b/companion/src/images/library/10080.png deleted file mode 100644 index 46a46e9a4..000000000 Binary files a/companion/src/images/library/10080.png and /dev/null differ diff --git a/companion/src/images/library/10081.png b/companion/src/images/library/10081.png deleted file mode 100644 index 66019bb70..000000000 Binary files a/companion/src/images/library/10081.png and /dev/null differ diff --git a/companion/src/images/library/10082.png b/companion/src/images/library/10082.png deleted file mode 100644 index 5ba72eb8f..000000000 Binary files a/companion/src/images/library/10082.png and /dev/null differ diff --git a/companion/src/images/library/10083.png b/companion/src/images/library/10083.png deleted file mode 100644 index 4619aba26..000000000 Binary files a/companion/src/images/library/10083.png and /dev/null differ diff --git a/companion/src/images/library/10084.png b/companion/src/images/library/10084.png deleted file mode 100644 index d82770ff4..000000000 Binary files a/companion/src/images/library/10084.png and /dev/null differ diff --git a/companion/src/images/library/10085.png b/companion/src/images/library/10085.png deleted file mode 100644 index 644b1d006..000000000 Binary files a/companion/src/images/library/10085.png and /dev/null differ diff --git a/companion/src/images/library/10086.png b/companion/src/images/library/10086.png deleted file mode 100644 index 2f16b8b80..000000000 Binary files a/companion/src/images/library/10086.png and /dev/null differ diff --git a/companion/src/images/library/10087.png b/companion/src/images/library/10087.png deleted file mode 100644 index dedee12ff..000000000 Binary files a/companion/src/images/library/10087.png and /dev/null differ diff --git a/companion/src/images/library/10088.png b/companion/src/images/library/10088.png deleted file mode 100644 index b24fe1a05..000000000 Binary files a/companion/src/images/library/10088.png and /dev/null differ diff --git a/companion/src/images/library/10089.png b/companion/src/images/library/10089.png deleted file mode 100644 index 133c90972..000000000 Binary files a/companion/src/images/library/10089.png and /dev/null differ diff --git a/companion/src/images/library/10090.png b/companion/src/images/library/10090.png deleted file mode 100644 index d45f27e5b..000000000 Binary files a/companion/src/images/library/10090.png and /dev/null differ diff --git a/companion/src/images/library/10091.png b/companion/src/images/library/10091.png deleted file mode 100644 index 192d3304e..000000000 Binary files a/companion/src/images/library/10091.png and /dev/null differ diff --git a/companion/src/images/library/10093.png b/companion/src/images/library/10093.png deleted file mode 100644 index cff628eb3..000000000 Binary files a/companion/src/images/library/10093.png and /dev/null differ diff --git a/companion/src/images/library/10095.png b/companion/src/images/library/10095.png deleted file mode 100644 index 5c03253c8..000000000 Binary files a/companion/src/images/library/10095.png and /dev/null differ diff --git a/companion/src/images/library/10097.png b/companion/src/images/library/10097.png deleted file mode 100644 index 88aecde84..000000000 Binary files a/companion/src/images/library/10097.png and /dev/null differ diff --git a/companion/src/images/library/10098.png b/companion/src/images/library/10098.png deleted file mode 100644 index 0d4249608..000000000 Binary files a/companion/src/images/library/10098.png and /dev/null differ diff --git a/companion/src/images/library/10099.png b/companion/src/images/library/10099.png deleted file mode 100644 index 2d99e224f..000000000 Binary files a/companion/src/images/library/10099.png and /dev/null differ diff --git a/companion/src/images/library/10100.png b/companion/src/images/library/10100.png deleted file mode 100644 index 14001a79a..000000000 Binary files a/companion/src/images/library/10100.png and /dev/null differ diff --git a/companion/src/images/library/10101.png b/companion/src/images/library/10101.png index 1f21c62ea..073c3197b 100644 Binary files a/companion/src/images/library/10101.png and b/companion/src/images/library/10101.png differ diff --git a/companion/src/images/library/10102.png b/companion/src/images/library/10102.png index 28ef0617b..7bfefdce6 100644 Binary files a/companion/src/images/library/10102.png and b/companion/src/images/library/10102.png differ diff --git a/companion/src/images/library/10103.png b/companion/src/images/library/10103.png index 8fd5c2897..d44f974b5 100644 Binary files a/companion/src/images/library/10103.png and b/companion/src/images/library/10103.png differ diff --git a/companion/src/images/library/10104.png b/companion/src/images/library/10104.png deleted file mode 100644 index 17b0c12a0..000000000 Binary files a/companion/src/images/library/10104.png and /dev/null differ diff --git a/companion/src/images/library/10501.png b/companion/src/images/library/10501.png new file mode 100644 index 000000000..51e85006a Binary files /dev/null and b/companion/src/images/library/10501.png differ diff --git a/companion/src/images/library/10502.png b/companion/src/images/library/10502.png new file mode 100644 index 000000000..47b108be9 Binary files /dev/null and b/companion/src/images/library/10502.png differ diff --git a/companion/src/images/library/10503.png b/companion/src/images/library/10503.png new file mode 100644 index 000000000..1ba8ec880 Binary files /dev/null and b/companion/src/images/library/10503.png differ diff --git a/companion/src/images/library/10504.png b/companion/src/images/library/10504.png new file mode 100644 index 000000000..e64ecb348 Binary files /dev/null and b/companion/src/images/library/10504.png differ diff --git a/companion/src/images/library/10505.png b/companion/src/images/library/10505.png new file mode 100644 index 000000000..a623d3376 Binary files /dev/null and b/companion/src/images/library/10505.png differ diff --git a/companion/src/images/library/10506.png b/companion/src/images/library/10506.png new file mode 100644 index 000000000..2fbda686e Binary files /dev/null and b/companion/src/images/library/10506.png differ diff --git a/companion/src/images/library/10508.png b/companion/src/images/library/10508.png new file mode 100644 index 000000000..ed3ce466d Binary files /dev/null and b/companion/src/images/library/10508.png differ diff --git a/companion/src/images/library/10601.png b/companion/src/images/library/10601.png new file mode 100644 index 000000000..782dd9653 Binary files /dev/null and b/companion/src/images/library/10601.png differ diff --git a/companion/src/images/library/10092.png b/companion/src/images/library/10701.png similarity index 100% rename from companion/src/images/library/10092.png rename to companion/src/images/library/10701.png diff --git a/companion/src/images/library/10702.png b/companion/src/images/library/10702.png new file mode 100644 index 000000000..c1f70cd82 Binary files /dev/null and b/companion/src/images/library/10702.png differ diff --git a/companion/src/images/library/10801.png b/companion/src/images/library/10801.png new file mode 100644 index 000000000..1ad61712b Binary files /dev/null and b/companion/src/images/library/10801.png differ diff --git a/companion/src/images/library/10802.png b/companion/src/images/library/10802.png new file mode 100644 index 000000000..bbf26657e Binary files /dev/null and b/companion/src/images/library/10802.png differ diff --git a/companion/src/images/library/20001.png b/companion/src/images/library/20001.png deleted file mode 100644 index aaed01ccc..000000000 Binary files a/companion/src/images/library/20001.png and /dev/null differ diff --git a/companion/src/images/library/20002.png b/companion/src/images/library/20002.png deleted file mode 100644 index 3f3d21866..000000000 Binary files a/companion/src/images/library/20002.png and /dev/null differ diff --git a/companion/src/images/library/20003.png b/companion/src/images/library/20003.png deleted file mode 100644 index 166fd4c94..000000000 Binary files a/companion/src/images/library/20003.png and /dev/null differ diff --git a/companion/src/images/library/20004.png b/companion/src/images/library/20004.png deleted file mode 100644 index df09efa35..000000000 Binary files a/companion/src/images/library/20004.png and /dev/null differ diff --git a/companion/src/images/library/30001.png b/companion/src/images/library/30001.png deleted file mode 100644 index a699fad95..000000000 Binary files a/companion/src/images/library/30001.png and /dev/null differ diff --git a/companion/src/images/library/30002.png b/companion/src/images/library/30002.png deleted file mode 100644 index b90ee4ca8..000000000 Binary files a/companion/src/images/library/30002.png and /dev/null differ diff --git a/companion/src/images/library/30003.png b/companion/src/images/library/30003.png deleted file mode 100644 index fe4548967..000000000 Binary files a/companion/src/images/library/30003.png and /dev/null differ diff --git a/companion/src/images/library/30004.png b/companion/src/images/library/30004.png deleted file mode 100644 index 4db2f79bb..000000000 Binary files a/companion/src/images/library/30004.png and /dev/null differ diff --git a/companion/src/images/library/30005.png b/companion/src/images/library/30005.png deleted file mode 100644 index ceeb0b358..000000000 Binary files a/companion/src/images/library/30005.png and /dev/null differ diff --git a/companion/src/images/library/30006.png b/companion/src/images/library/30006.png deleted file mode 100644 index de6493b1c..000000000 Binary files a/companion/src/images/library/30006.png and /dev/null differ diff --git a/companion/src/logsdialog.cpp b/companion/src/logsdialog.cpp index f39a41171..7a4b6745b 100644 --- a/companion/src/logsdialog.cpp +++ b/companion/src/logsdialog.cpp @@ -657,7 +657,7 @@ bool logsDialog::cvsFileParse() QString line=buffer.trimmed(); list.clear(); if(line.size()<1){ - list << ""; + list << ""; } else { while (line.size()>pos2 && (pos2 = rx2.indexIn(line, pos2)) != -1) { QString col; diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp index 75d68038b..ce66bb4bc 100644 --- a/companion/src/mainwindow.cpp +++ b/companion/src/mainwindow.cpp @@ -104,7 +104,7 @@ MainWindow::MainWindow(): setUnifiedTitleAndToolBarOnMac(true); this->setWindowIcon(QIcon(":/icon.png")); - this->setIconSize(QSize(32,32)); + this->setIconSize(QSize(32, 32)); QNetworkProxyFactory::setUseSystemConfiguration(true); setAcceptDrops(true); @@ -308,7 +308,7 @@ void MainWindow::downloadLatestFW(FirmwareInfo * firmware, const QString & firmw if (!fileName.isEmpty()) { downloadedFW = firmwareId; needRename=true; - downloadedFWFilename = fileName; + g.profile[g.id()].fwName( fileName ); if (!cpuid.isEmpty()) { url.append("&cpuid="); url.append(cpuid); @@ -323,7 +323,7 @@ void MainWindow::downloadLatestFW(FirmwareInfo * firmware, const QString & firmw void MainWindow::reply1Accepted() { QString errormsg; - if (downloadedFWFilename.isEmpty()) { + if (g.profile[g.id()].fwName().isEmpty()) { if (!(downloadedFW.isEmpty())) { QFile file(downloadedFW); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file @@ -364,11 +364,11 @@ void MainWindow::reply1Accepted() g.fwRev.set(downloadedFW, currentFWrev); } } else { - QFile file(downloadedFWFilename); + QFile file(g.profile[g.id()].fwName()); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file QMessageBox::critical(this, tr("Error"), tr("Error opening file %1:\n%2.") - .arg(downloadedFWFilename) + .arg(g.profile[g.id()].fwName()) .arg(file.errorString())); return; } @@ -399,13 +399,13 @@ void MainWindow::reply1Accepted() return; } file.close(); - FlashInterface flash(downloadedFWFilename); + FlashInterface flash(g.profile[g.id()].fwName()); QString rev=flash.getSvn(); int pos=rev.lastIndexOf("-r"); if (pos>0) { currentFWrev=rev.mid(pos+2).toInt(); if (g.profile[g.id()].renameFwFiles() && needRename) { - QFileInfo fi(downloadedFWFilename); + QFileInfo fi(g.profile[g.id()].fwName()); QString path=fi.path()+QDir::separator (); path.append(fi.completeBaseName()); path.append(rev.mid(pos)); @@ -413,14 +413,14 @@ void MainWindow::reply1Accepted() path.append(fi.suffix()); QDir qd; qd.remove(path); - qd.rename(downloadedFWFilename,path); - downloadedFWFilename=path; + qd.rename(g.profile[g.id()].fwName(),path); + g.profile[g.id()].fwName(path); } g.fwRev.set(downloadedFW, currentFWrev); if (g.profile[g.id()].burnFirmware()) { 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) { - writeFlash(downloadedFWFilename); + writeFlash(g.profile[g.id()].fwName()); } } } @@ -468,7 +468,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply) if (OldFwRev == 0) { showcheckForUpdatesResult = false; // update is available - do not show dialog QString rn = GetFirmware(fwToUpdate)->rnurl; - QAbstractButton *rnButton; + QAbstractButton *rnButton = NULL; 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); @@ -560,7 +560,7 @@ void MainWindow::reply1Finished(QNetworkReply * reply) url.append("&cpuid="); url.append(cpuid); } - downloadedFWFilename = fileName; + g.profile[g.id()].fwName( fileName ); g.flashDir(QFileInfo(fileName).dir().absolutePath()); downloadDialog * dd = new downloadDialog(this, url, fileName); currentFWrev_temp = NewFwRev; @@ -642,7 +642,7 @@ void MainWindow::openDocURL() void MainWindow::openFile() { - QString fileName = QFileDialog::getOpenFileName(this, tr("Open"), g.eepromDir(), tr(EEPROM_FILES_FILTER)); + QString fileName = QFileDialog::getOpenFileName(this, tr("Open Models and Settings file"), g.eepromDir(), tr(EEPROM_FILES_FILTER)); if (!fileName.isEmpty()) { g.eepromDir(QFileInfo(fileName).dir().absolutePath()); @@ -673,23 +673,23 @@ void MainWindow::saveAs() } void MainWindow::openRecentFile() - { - QAction *action = qobject_cast(sender()); - if (action) { - QString fileName=action->data().toString(); - - QMdiSubWindow *existing = findMdiChild(fileName); - if (existing) { - mdiArea->setActiveSubWindow(existing); - return; - } +{ + QAction *action = qobject_cast(sender()); + if (action) { + QString fileName = action->data().toString(); + QMdiSubWindow *existing = findMdiChild(fileName); + if (existing) { + mdiArea->setActiveSubWindow(existing); + } + else { MdiChild *child = createMdiChild(); if (child->loadFile(fileName)) { - statusBar()->showMessage(tr("File loaded"), 2000); - child->show(); + statusBar()->showMessage(tr("File loaded"), 2000); + child->show(); } } + } } void MainWindow::loadProfile() //TODO Load all variables - Also HW! @@ -702,7 +702,7 @@ void MainWindow::loadProfile() //TODO Load all variables - Also HW! g.id( profnum ); // TODO Get rid of this global variable - The profile.firmware is the real source - current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].firmware()); + current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType()); foreach (QMdiSubWindow *window, mdiArea->subWindowList()) { MdiChild *mdiChild = qobject_cast(window->widget()); @@ -1198,17 +1198,15 @@ bool MainWindow::isValidEEPROM(QString eepromfile) if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return false; eeprom_size = file.size(); - uint8_t *eeprom = (uint8_t *)malloc(eeprom_size); + QByteArray eeprom(eeprom_size, 0); QTextStream inputStream(&file); - eeprom_size = HexInterface(inputStream).load(eeprom, eeprom_size); + eeprom_size = HexInterface(inputStream).load((uint8_t *)eeprom.data(), eeprom_size); if (!eeprom_size) { - free(eeprom); return false; } file.close(); RadioData * radioData = new RadioData(); - bool result = LoadEeprom(*radioData, eeprom, eeprom_size); - free(eeprom); + bool result = LoadEeprom(*radioData, (uint8_t *)eeprom.data(), eeprom_size); delete radioData; return result; } @@ -1216,17 +1214,14 @@ bool MainWindow::isValidEEPROM(QString eepromfile) if (!file.open(QFile::ReadOnly)) return false; eeprom_size = file.size(); - uint8_t *eeprom = (uint8_t *)malloc(eeprom_size); - memset(eeprom, 0, eeprom_size); - long read = file.read((char*)eeprom, eeprom_size); + QByteArray eeprom(eeprom_size, 0); + long read = file.read(eeprom.data(), eeprom_size); file.close(); if (read != eeprom_size) { - free(eeprom); return false; } RadioData * radioData = new RadioData(); - bool result = LoadEeprom(*radioData, eeprom, eeprom_size); - free(eeprom); + bool result = LoadEeprom(*radioData, (uint8_t *)eeprom.data(), eeprom_size); delete radioData; return result; } @@ -1280,24 +1275,23 @@ bool MainWindow::convertEEPROM(QString backupFile, QString restoreFile, QString if (!file.open(QIODevice::ReadOnly)) return false; - uint8_t *eeprom = (uint8_t *)malloc(eeprom_size); - long result = file.read((char*)eeprom, eeprom_size); + QByteArray eeprom(eeprom_size, 0); + long result = file.read(eeprom.data(), eeprom_size); file.close(); QSharedPointer radioData = QSharedPointer(new RadioData()); - if (!LoadEeprom(*radioData, eeprom, eeprom_size) || !firmware->saveEEPROM(eeprom, *radioData, variant, version)) + if (!LoadEeprom(*radioData, (uint8_t *)eeprom.data(), eeprom_size) || !firmware->saveEEPROM((uint8_t *)eeprom.data(), *radioData, variant, version)) return false; QFile file2(restoreFile); if (!file2.open(QIODevice::WriteOnly)) return false; - result = file2.write((char*)eeprom, eeprom_size); + result = file2.write(eeprom.constData(), eeprom_size); file2.close(); if (result != eeprom_size) return false; - free(eeprom); return true; } @@ -1538,17 +1532,17 @@ MdiChild *MainWindow::createMdiChild() QAction * MainWindow::addAct(QString icon, QString sName, QString lName, QKeySequence::StandardKey shortcut, const char *slot) { - QAction * newAction = new QAction( this ); - if (!icon.isEmpty()) + QAction * newAction = new QAction( this ); + if (!icon.isEmpty()) newAction->setIcon(CompanionIcon(icon)); - if (!sName.isEmpty()) - newAction->setText(sName); - if (!lName.isEmpty()) - newAction->setStatusTip(lName); - if (shortcut != 0) - newAction->setShortcuts(shortcut); + if (!sName.isEmpty()) + newAction->setText(sName); + if (!lName.isEmpty()) + newAction->setStatusTip(lName); + if (shortcut != 0) + newAction->setShortcuts(shortcut); connect(newAction, SIGNAL(triggered()), this, slot); - return newAction; + return newAction; } QAction * MainWindow::addAct(QString icon, QString sName, QString lName, const char *slot) @@ -1558,10 +1552,10 @@ QAction * MainWindow::addAct(QString icon, QString sName, QString lName, const c QAction * MainWindow::addAct(QActionGroup *aGroup, QString sName, QString lName, const char *slot) { - QAction *action = addAct("", sName, lName, QKeySequence::UnknownKey, slot); - action->setCheckable(true); - aGroup->addAction(action); - return action; + QAction *action = addAct("", sName, lName, QKeySequence::UnknownKey, slot); + action->setCheckable(true); + aGroup->addAction(action); + return action; } void MainWindow::createActions() @@ -1586,17 +1580,17 @@ void MainWindow::createActions() } updateProfilesActions(); - newAct = addAct("new.png", tr("New"), tr("Create a new file"), QKeySequence::New, SLOT(newFile())); - openAct = addAct("open.png", tr("Open..."), tr("Open an existing file"), QKeySequence::Open, SLOT(openFile())); - saveAct = addAct("save.png", tr("Save..."), tr("Save the document to disk"), QKeySequence::Save, SLOT(save())); - saveAsAct = addAct("saveas.png", tr("Save As..."), tr("Save the document to disk"), QKeySequence::SaveAs, SLOT(saveAs())); - exitAct = addAct("exit.png", tr("Exit"), tr("Exit the application"), QKeySequence::Quit, SLOT(newFile())); - cutAct = addAct("cut.png", tr("Cut"), tr("Cut current selection to the clipboard"), QKeySequence::Cut, SLOT(cut())); - copyAct = addAct("copy.png", tr("Copy..."), tr("Copy current selection to the clipboard"), QKeySequence::Copy, SLOT(copy())); - pasteAct = addAct("paste.png", tr("Paste..."), tr("Paste clipboard into current selection"), QKeySequence::Paste, SLOT(paste())); + newAct = addAct("new.png", tr("New Models+Settings"), tr("Create a new Models and Settings file"), QKeySequence::New, SLOT(newFile())); + openAct = addAct("open.png", tr("Open Models+Settings..."), tr("Open Models and Settings file"), QKeySequence::Open, SLOT(openFile())); + saveAct = addAct("save.png", tr("Save Models+Settings..."), tr("Save Models and Settings file"), QKeySequence::Save, SLOT(save())); + saveAsAct = addAct("saveas.png", tr("Save Models+Settings as..."), tr("Save Models and Settings file"), QKeySequence::SaveAs, SLOT(saveAs())); + exitAct = addAct("exit.png", tr("Exit"), tr("Exit the application"), QKeySequence::Quit, SLOT(newFile())); + cutAct = addAct("cut.png", tr("Cut Model"), tr("Cut current model to the clipboard"), QKeySequence::Cut, SLOT(cut())); + copyAct = addAct("copy.png", tr("Copy Model..."), tr("Copy current model to the clipboard"), QKeySequence::Copy, SLOT(copy())); + pasteAct = addAct("paste.png", tr("Paste Model..."), tr("Paste model from clipboard"), QKeySequence::Paste, SLOT(paste())); QActionGroup *themeAlignGroup = new QActionGroup(this); - classicThemeAct = addAct( themeAlignGroup, tr("Classical"), tr("The classical Companion icon theme"), SLOT(setClassicTheme())); + classicThemeAct = addAct( themeAlignGroup, tr("Classical"), tr("The classic companion9x icon theme"), SLOT(setClassicTheme())); yericoThemeAct = addAct( themeAlignGroup, tr("Yerico"), tr("Yellow round honey sweet icon theme"), SLOT(setYericoTheme())); monoThemeAct = addAct( themeAlignGroup, tr("Monochrome"), tr("A monochrome black icon theme"), SLOT(setMonochromeTheme())); monoWhiteAct = addAct( themeAlignGroup, tr("MonoWhite"), tr("A monochrome white icon theme"), SLOT(setMonoWhiteTheme())); @@ -1622,30 +1616,30 @@ void MainWindow::createActions() swedishLangAct = addAct( langAlignGroup, tr("Swedish"), tr("Use Swedish in menus"), SLOT(setSELanguage())); russianLangAct = addAct( langAlignGroup, tr("Russian"), tr("Use Russian in menus"), SLOT(setRULanguage())); - aboutAct = addAct("information.png", tr("About"), tr("Show the application's About box"), SLOT(about())); - printAct = addAct("print.png", tr("Print"), tr("Print current model"), SLOT(print())); - simulateAct = addAct("simulate.png", tr("Simulate"), tr("Simulate selected model"), SLOT(simulate())); - loadbackupAct = addAct("open.png", tr("loadBackup..."), tr("Load backup from file"), SLOT(loadBackup())); - logsAct = addAct("logs.png", tr("Logs"), tr("Open log file"), SLOT(logFile())); - appPrefsAct = addAct("apppreferences.png",tr("Setting..."), tr("Edit Settings"), SLOT(appPrefs())); - fwPrefsAct = addAct("fwpreferences.png", tr("Downloads..."), tr("Download firmware and voice files"), SLOT(fwPrefs())); - checkForUpdatesAct = addAct("update.png", tr("Check for updates..."), tr("Check OpenTX and Companion updates"), SLOT(doUpdates())); - changelogAct = addAct("changelog.png", tr("ChangeLog..."), tr("Show Companion changelog"), SLOT(changelog())); - fwchangelogAct = addAct("changelog.png", tr("Firmware ChangeLog..."), tr("Show firmware changelog"), SLOT(fwchangelog())); - compareAct = addAct("compare.png", tr("Compare..."), tr("Compare models"), SLOT(compare())); - editSplashAct = addAct("paintbrush.png", tr("Edit Tx Splash Image..."),tr("edit the splash screen of your TX"), SLOT(customizeSplash())); - burnListAct = addAct("list.png", tr("List programmers"), tr("List available programmers"), SLOT(burnList())); - burnFusesAct = addAct("fuses.png", tr("Fuses..."), tr("Show fuses dialog"), SLOT(burnFuses())); - readFlashAct = addAct("read_flash.png", tr("Read Firmware"), tr("Read firmware from transmitter"), SLOT(readFlash())); - writeFlashAct = addAct("write_flash.png", tr("Write Firmware"), tr("Write firmware to transmitter"), SLOT(writeFlash())); - createProfileAct = addAct("", tr("New Profile"), tr("Create a new Radio Setting Profile"), SLOT(createProfile())); + aboutAct = addAct("information.png", tr("About..."), tr("Show the application's About box"), SLOT(about())); + printAct = addAct("print.png", tr("Print..."), tr("Print current model"), SLOT(print())); + simulateAct = addAct("simulate.png", tr("Simulate..."), tr("Simulate current model"), SLOT(simulate())); + loadbackupAct = addAct("open.png", tr("Load Backup..."), tr("Load backup from file"), SLOT(loadBackup())); + logsAct = addAct("logs.png", tr("View Log File..."), tr("Open and view log file"), SLOT(logFile())); + appPrefsAct = addAct("apppreferences.png",tr("Settings..."), tr("Edit Settings"), SLOT(appPrefs())); + fwPrefsAct = addAct("fwpreferences.png", tr("Download..."), tr("Download firmware and voice files"), SLOT(fwPrefs())); + checkForUpdatesAct = addAct("update.png", tr("Check for Updates..."), tr("Check OpenTX and Companion updates"), SLOT(doUpdates())); + changelogAct = addAct("changelog.png", tr("Companion Changes..."), tr("Show Companion change log"), SLOT(changelog())); + fwchangelogAct = addAct("changelog.png", tr("Firmware Changes..."), tr("Show firmware change log"), SLOT(fwchangelog())); + compareAct = addAct("compare.png", tr("Compare Models..."), tr("Compare models"), SLOT(compare())); + editSplashAct = addAct("paintbrush.png", tr("Edit Tx Splash Image..."), tr("Edit the splash image of your TX"), SLOT(customizeSplash())); + burnListAct = addAct("list.png", tr("List programmers..."), tr("List available programmers"), SLOT(burnList())); + burnFusesAct = addAct("fuses.png", tr("Fuses..."), tr("Show fuses dialog"), SLOT(burnFuses())); + readFlashAct = addAct("read_flash.png", tr("Read Firmware"), tr("Read firmware from transmitter"), SLOT(readFlash())); + writeFlashAct = addAct("write_flash.png", tr("Write Firmware"), tr("Write firmware to transmitter"), SLOT(writeFlash())); + createProfileAct = addAct("", tr("Add Radio Profile"), tr("Create a new Radio Setting Profile"), SLOT(createProfile())); openDocURLAct = addAct("", tr("Manuals and other Documents"), tr("Open the OpenTX document page in a web browser"), SLOT(openDocURL())); writeEepromAct = addAct("write_eeprom.png", tr("Write Models and Settings To Tx"), tr("Write Models and Settings to transmitter"), SLOT(writeEeprom())); readEepromAct = addAct("read_eeprom.png", tr("Read Models and Settings From Tx"), tr("Read Models and Settings from transmitter"), SLOT(readEeprom())); - burnConfigAct = addAct("configure.png", tr("Configure connection software..."), tr("Configure software for reading from and writing to the transmitter"), SLOT(burnConfig())); - writeFileToEepromAct = addAct("write_eeprom_file.png", tr("Write Models and Settings from file to Tx"), tr("Write Models and Settings from file to transmitter"), SLOT(writeFileToEeprom())); - readEepromToFileAct = addAct("read_eeprom_file.png", tr("Save Tx Models and Settings to file"), tr("Save the Models and Settings from the transmitter to a file"), SLOT(readEepromToFile())); - contributorsAct = addAct("contributors.png", tr("Contributors"), tr("A tribute to those who have contributed to OpenTX and Companion"), SLOT(contributors())); + burnConfigAct = addAct("configure.png", tr("Configure Communications..."), tr("Configure software for communicating with the transmitter"), SLOT(burnConfig())); + writeFileToEepromAct = addAct("write_eeprom_file.png", tr("Write Models and Settings from file to Tx"), tr("Write Models and Settings from file to transmitter"), SLOT(writeFileToEeprom())); + readEepromToFileAct = addAct("read_eeprom_file.png", tr("Save Tx Models and Settings to file"), tr("Save the Models and Settings from the transmitter to a file"), SLOT(readEepromToFile())); + contributorsAct = addAct("contributors.png", tr("Contributors..."), tr("A tribute to those who have contributed to OpenTX and Companion"), SLOT(contributors())); compareAct->setEnabled(false); simulateAct->setEnabled(false); @@ -1655,7 +1649,7 @@ void MainWindow::createActions() void MainWindow::createMenus() { - QMenu *recentFileMenu=new QMenu(tr("Recent Files")); + QMenu *recentFileMenu=new QMenu(tr("Recent Models+Settings")); QMenu *languageMenu=new QMenu(tr("Set Menu Language")); QMenu *themeMenu=new QMenu(tr("Set Icon Theme")); QMenu *iconThemeSizeMenu=new QMenu(tr("Set Icon Size")); @@ -1671,13 +1665,12 @@ void MainWindow::createMenus() recentFileMenu->addAction(recentFileActs[i]); fileMenu->addSeparator(); fileMenu->addAction(logsAct); + fileMenu->addAction(fwPrefsAct); fileMenu->addSeparator(); fileMenu->addAction(simulateAct); fileMenu->addAction(printAct); fileMenu->addAction(compareAct); fileMenu->addSeparator(); - fileMenu->addAction(fwPrefsAct); - fileMenu->addMenu(createProfilesMenu()); fileMenu->addAction(exitAct); editMenu = menuBar()->addMenu(tr("Edit")); @@ -1713,6 +1706,7 @@ void MainWindow::createMenus() iconThemeSizeMenu->addAction(hugeIconAct); settingsMenu->addSeparator(); settingsMenu->addAction(appPrefsAct); + settingsMenu->addMenu(createProfilesMenu()); settingsMenu->addAction(editSplashAct); settingsMenu->addAction(burnConfigAct); @@ -1756,7 +1750,7 @@ QMenu *MainWindow::createRecentFileMenu() QMenu *MainWindow::createProfilesMenu() { - QMenu *profilesMenu=new QMenu(tr("Radio Settings Profiles")); + QMenu *profilesMenu=new QMenu(tr("Radio Settings Profile")); int i; for ( i = 0; i < MAX_PROFILES; ++i) { profilesMenu->addAction(profileActs[i]); @@ -1798,25 +1792,26 @@ void MainWindow::createToolBars() recentToolButton->setPopupMode(QToolButton::InstantPopup); recentToolButton->setMenu(createRecentFileMenu()); recentToolButton->setIcon(CompanionIcon("recentdocument.png")); - recentToolButton->setToolTip(tr("Recent Files")); - recentToolButton->setStatusTip(tr("Show a selection list of recent documents")); + recentToolButton->setToolTip(tr("Recent Models+Settings")); + recentToolButton->setStatusTip(tr("Show recent Models+Settings documents")); fileToolBar->addWidget(recentToolButton); fileToolBar->addAction(saveAct); + fileToolBar->addSeparator(); fileToolBar->addAction(logsAct); + fileToolBar->addAction(fwPrefsAct); fileToolBar->addSeparator(); fileToolBar->addAction(appPrefsAct); - fileToolBar->addAction(fwPrefsAct); - fileToolBar->addAction(editSplashAct); QToolButton * profileButton = new QToolButton; profileButton->setPopupMode(QToolButton::InstantPopup); profileButton->setMenu(createProfilesMenu()); profileButton->setIcon(CompanionIcon("profiles.png")); - profileButton->setToolTip(tr("Radio Profiles")); - profileButton->setStatusTip(tr("Show a selection list of radio settings profiles")); + profileButton->setToolTip(tr("Radio Settings Profile")); + profileButton->setStatusTip(tr("Show a selection list of radio settings profiles")); fileToolBar->addWidget(profileButton); + fileToolBar->addAction(editSplashAct); fileToolBar->addSeparator(); fileToolBar->addAction(simulateAct); fileToolBar->addAction(printAct); @@ -1883,7 +1878,7 @@ void MainWindow::setActiveSubWindow(QWidget *window) } void MainWindow::updateRecentFileActions() - { +{ int i, numRecentFiles; // Hide all document slots @@ -1962,9 +1957,9 @@ void MainWindow::updateProfilesActions() { for (int i=0; isetText(text); profileActs[i]->setData(i); profileActs[i]->setVisible(true); @@ -1980,20 +1975,21 @@ void MainWindow::updateProfilesActions() void MainWindow::createProfile() { int i; - for (i=0; isetProperty("index", i); - cswitchDuration[i]->setSingleStep(0.5); - cswitchDuration[i]->setMaximum(50); + cswitchDuration[i]->setSingleStep(0.1); + cswitchDuration[i]->setMaximum(25); cswitchDuration[i]->setMinimum(0); cswitchDuration[i]->setAccelerated(true); cswitchDuration[i]->setDecimals(1); @@ -96,8 +96,8 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model): // Delay cswitchDelay[i] = new QDoubleSpinBox(this); cswitchDelay[i]->setProperty("index", i); - cswitchDelay[i]->setSingleStep(0.5); - cswitchDelay[i]->setMaximum(50); + cswitchDelay[i]->setSingleStep(0.1); + cswitchDelay[i]->setMaximum(25); cswitchDelay[i]->setMinimum(0); cswitchDelay[i]->setAccelerated(true); cswitchDelay[i]->setDecimals(1); @@ -121,7 +121,7 @@ void LogicalSwitchesPanel::v1Edited(int value) if (model.customSw[i].getFunctionFamily() == LS_FAMILY_VOFS) { RawSource source = RawSource(model.customSw[i].val1, &model); if (source.type == SOURCE_TYPE_TELEMETRY) { - if (model.customSw[i].func > LS_FN_ELESS && model.customSw[i].func < LS_FN_VEQUAL) { + if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) { model.customSw[i].val2 = 0; } else { @@ -130,7 +130,7 @@ void LogicalSwitchesPanel::v1Edited(int value) } else { RawSourceRange range = source.getRange(); - if (model.customSw[i].func > LS_FN_ELESS && model.customSw[i].func < LS_FN_VEQUAL) { + if (model.customSw[i].func == LS_FN_DPOS || model.customSw[i].func == LS_FN_DAPOS) { model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step); } else { @@ -164,14 +164,14 @@ void LogicalSwitchesPanel::andEdited(int value) void LogicalSwitchesPanel::durationEdited(double duration) { int index = sender()->property("index").toInt(); - model.customSw[index].duration = (uint8_t)round(duration*2); + model.customSw[index].duration = (uint8_t)round(duration*10); emit modified(); } void LogicalSwitchesPanel::delayEdited(double delay) { int index = sender()->property("index").toInt(); - model.customSw[index].delay = (uint8_t)round(delay*2); + model.customSw[index].delay = (uint8_t)round(delay*10); emit modified(); } @@ -208,7 +208,7 @@ void LogicalSwitchesPanel::edited() { source = RawSource(model.customSw[i].val1, &model); RawSourceRange range = source.getRange(); - if (model.customSw[i].func>LS_FN_ELESS && model.customSw[i].funcvalue() / range.step); cswitchOffset[i]->setValue(model.customSw[i].val2*range.step); } @@ -269,7 +269,7 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i) populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0)); cswitchOffset[i]->setDecimals(range.decimals); cswitchOffset[i]->setSingleStep(range.step); - if (model.customSw[i].func>LS_FN_ELESS && model.customSw[i].funcsetMinimum(range.step*-127); cswitchOffset[i]->setMaximum(range.step*127); cswitchOffset[i]->setValue(range.step*model.customSw[i].val2); @@ -325,8 +325,8 @@ void LogicalSwitchesPanel::update() lock = true; populateAndSwitchCB(cswitchAnd[i], RawSwitch(model.customSw[i].andsw)); if (GetEepromInterface()->getCapability(LogicalSwitchesExt)) { - cswitchDuration[i]->setValue(model.customSw[i].duration/2.0); - cswitchDelay[i]->setValue(model.customSw[i].delay/2.0); + cswitchDuration[i]->setValue(model.customSw[i].duration/10.0); + cswitchDelay[i]->setValue(model.customSw[i].delay/10.0); } lock = false; } diff --git a/companion/src/modeledit/telemetry.cpp b/companion/src/modeledit/telemetry.cpp index 099ba56ab..e06fe96a3 100644 --- a/companion/src/modeledit/telemetry.cpp +++ b/companion/src/modeledit/telemetry.cpp @@ -457,7 +457,7 @@ TelemetryPanel::~TelemetryPanel() void TelemetryPanel::setup() { - QString firmware_id = g.profile[g.id()].firmware(); + QString firmware_id = g.profile[g.id()].fwType(); lock=true; diff --git a/companion/src/radio.xsd b/companion/src/radio.xsd index b3203f138..fca4d96bc 100644 --- a/companion/src/radio.xsd +++ b/companion/src/radio.xsd @@ -1,685 +1,691 @@ - - - Radio data schema for companion9x. - - + + + Radio data schema for companion9x. + + - - - - - - + + + + + + - - - - - + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + - - + + - - - - - + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + - - - - - + + - - - - - + + diff --git a/companion/src/splashlabel.h b/companion/src/splashlabel.h index a724d2c8c..d82b23e4f 100644 --- a/companion/src/splashlabel.h +++ b/companion/src/splashlabel.h @@ -14,7 +14,7 @@ * */ #ifndef SPLASHLABEL_H -#define SPLASHLABEL_H +#define SPLASHLABEL_H #include #include @@ -77,5 +77,5 @@ signals: private: int index; }; -#endif /* SPLASHLABEL_H */ +#endif /* SPLASHLABEL_H */ diff --git a/companion/src/splashlibrary.cpp b/companion/src/splashlibrary.cpp index 5685406b7..d35dd48a6 100644 --- a/companion/src/splashlibrary.cpp +++ b/companion/src/splashlibrary.cpp @@ -3,7 +3,6 @@ #include "appdata.h" #include #include "helpers.h" -//#include "splashlabel.h" #include "flashinterface.h" #include "helpers.h" @@ -23,7 +22,6 @@ splashLibrary::splashLibrary(QWidget *parent, QString * fileName) : QDialog(pare foreach(splashLabel *sl, findChildren()) { connect(sl, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int))); } - resize(0, 0); } splashLibrary::~splashLibrary() { @@ -40,7 +38,7 @@ void splashLibrary::setupPage(int page) { if ((i + 20 * page) < imageList.size()) { QImage image(imageList.at(i + 20 * page)); if (!image.isNull()) { - sl[i]->setPixmap(QPixmap::fromImage(image.scaled(SPLASH_WIDTH, SPLASH_HEIGHT).convertToFormat(QImage::Format_Mono))); + sl[i]->setPixmap(makePixMap(image, g.profile[g.id()].fwType())); sl[i]->setEnabled(true); sl[i]->setId((i + 20 * page)); sl[i]->setStyleSheet("border:1px solid; border-color:#999999;"); @@ -104,10 +102,6 @@ void splashLibrary::getFileList() { } } -void splashLibrary::shrink() { - resize(0, 0); -} - void splashLibrary::dclose() { close(); } diff --git a/companion/src/splashlibrary.h b/companion/src/splashlibrary.h index 9da9d58e4..0d9123a74 100644 --- a/companion/src/splashlibrary.h +++ b/companion/src/splashlibrary.h @@ -17,7 +17,6 @@ public: ~splashLibrary(); private slots: - void shrink() ; void dclose(); void onButtonPressed(int button); void on_nextPage_clicked(); diff --git a/companion/src/splashlibrary.ui b/companion/src/splashlibrary.ui index 15e1b54a0..5ce1e2502 100644 --- a/companion/src/splashlibrary.ui +++ b/companion/src/splashlibrary.ui @@ -6,22 +6,16 @@ 0 0 - 662 - 356 + 650 + 374 - + 0 0 - - - 662 - 356 - - @@ -39,10 +33,16 @@ - 50 + 34 0 + + + 34 + 16777215 + + ... @@ -54,12 +54,15 @@ - + + + QLayout::SetNoConstraint + - + 0 0 @@ -72,7 +75,7 @@ - 130 + 214 66 @@ -105,7 +108,7 @@ - + 0 0 @@ -113,55 +116,12 @@ 130 - 66 + 0 - 130 - 66 - - - - true - - - border:1px; - - - QFrame::Panel - - - QFrame::Plain - - - 0 - - - - - - true - - - - - - - - 0 - 0 - - - - - 130 - 66 - - - - - 130 + 214 66 @@ -191,7 +151,7 @@ - + 0 0 @@ -199,12 +159,12 @@ 130 - 66 + 0 - 130 + 214 66 @@ -234,20 +194,20 @@ - + 0 0 - 130 + 0 66 - 130 + 214 66 @@ -277,20 +237,14 @@ - + 0 0 - - - 130 - 66 - - - 130 + 214 66 @@ -320,20 +274,14 @@ - + 0 0 - - - 130 - 66 - - - 130 + 214 66 @@ -363,20 +311,14 @@ - + 0 0 - - - 130 - 66 - - - 130 + 214 66 @@ -406,20 +348,20 @@ - + 0 0 - 130 + 0 66 - 130 + 214 66 @@ -449,20 +391,14 @@ - + 0 0 - - - 130 - 66 - - - 130 + 214 66 @@ -492,20 +428,14 @@ - + 0 0 - - - 130 - 66 - - - 130 + 214 66 @@ -535,20 +465,14 @@ - + 0 0 - - - 130 - 66 - - - 130 + 214 66 @@ -578,20 +502,20 @@ - + 0 0 - 130 + 0 66 - 130 + 214 66 @@ -621,20 +545,14 @@ - + 0 0 - - - 130 - 66 - - - 130 + 214 66 @@ -664,20 +582,14 @@ - + 0 0 - - - 130 - 66 - - - 130 + 214 66 @@ -707,20 +619,14 @@ - + 0 0 - - - 130 - 66 - - - 130 + 214 66 @@ -750,20 +656,20 @@ - + 0 0 - 130 + 0 66 - 130 + 214 66 @@ -793,20 +699,14 @@ - + 0 0 - - - 130 - 66 - - - 130 + 214 66 @@ -836,20 +736,14 @@ - + 0 0 - - - 130 - 66 - - - 130 + 214 66 @@ -879,7 +773,44 @@ - + + 0 + 0 + + + + + 214 + 66 + + + + true + + + border:1px; + + + QFrame::Panel + + + QFrame::Plain + + + 0 + + + + + + true + + + + + + + 0 0 @@ -887,12 +818,12 @@ 130 - 66 + 0 - 130 + 214 66 @@ -921,7 +852,7 @@ - + false @@ -934,10 +865,16 @@ - 50 + 34 0 + + + 34 + 16777215 + + ... @@ -949,6 +886,32 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + diff --git a/companion/src/themes/monochrome/24/fwpreferences.png b/companion/src/themes/monochrome/24/fwpreferences.png index 1f4d9bf05..2d322e73d 100644 Binary files a/companion/src/themes/monochrome/24/fwpreferences.png and b/companion/src/themes/monochrome/24/fwpreferences.png differ diff --git a/companion/src/themes/monochrome/32/fwpreferences.png b/companion/src/themes/monochrome/32/fwpreferences.png index ad10a252c..17d781fb3 100644 Binary files a/companion/src/themes/monochrome/32/fwpreferences.png and b/companion/src/themes/monochrome/32/fwpreferences.png differ diff --git a/companion/src/themes/monochrome/48/fwpreferences.png b/companion/src/themes/monochrome/48/fwpreferences.png index 55e6e6a75..aed3ed5ef 100644 Binary files a/companion/src/themes/monochrome/48/fwpreferences.png and b/companion/src/themes/monochrome/48/fwpreferences.png differ diff --git a/companion/src/themes/monowhite/16/fwpreferences.png b/companion/src/themes/monowhite/16/fwpreferences.png index b8e5ad449..63fb581eb 100644 Binary files a/companion/src/themes/monowhite/16/fwpreferences.png and b/companion/src/themes/monowhite/16/fwpreferences.png differ diff --git a/companion/src/translations/companion_pl.ts b/companion/src/translations/companion_pl.ts index 1715ded6f..ab649090f 100644 --- a/companion/src/translations/companion_pl.ts +++ b/companion/src/translations/companion_pl.ts @@ -57,22 +57,22 @@ CurveGroup - + Diff Róźnicowość - + Expo Expo - + Func Funkcja - + Curve Krzywa @@ -168,57 +168,57 @@ FS%1 - + ON Włącz - + Error Błąd - + Unable to find sound file %1! Nie mogę odnaleźć pliku dźwiękowego %1! - + &Delete &Wykasuj - + Delete Wykasuj - + &Copy &Kopiuj - + Ctrl+C Ctrl+C - + &Cut &Wytnij - + Ctrl+X Ctrl+X - + &Paste &Wklej - + Ctrl+V Ctrl+V @@ -2064,7 +2064,7 @@ Jesteś pewien ? - + File loaded Plik załadowany @@ -2123,23 +2123,23 @@ Jesteś pewien ? - - - - - - - - + + + + + + + + Error Błąd - - - + + + Error opening file %1: %2. Błąd otwarcia pliku %1: @@ -2309,21 +2309,56 @@ Chcesz pobrać teraz? OpenTX Companion - FW: %1 - Profile: %2 OpenTX Companion - FW: %1 - Profil: %2 + + + About... + O aplikacji... + + + + Print... + Drukuj... + + + + Simulate... + Symulacja... + + + + Simulate current model + Symulacja aktualnego modelu + + + + Load Backup... + Załaduj backup... + + + + View Log File... + Obejrzyj plik logów... + + + + Open and view log file + Otwórz i obejrzyj plik logów + Edit Settings Edycja Ustawień + + + Settings... + Ustawienia... + Download firmware and voice files Pobierz firmware i pliki dźwiękowe - - - New Profile - Nowy Profil - Create a new Radio Setting Profile @@ -2334,6 +2369,78 @@ Chcesz pobrać teraz? A monochrome black icon theme Monochromatyczny czarny wygląd ikon + + + + Open Models and Settings file + Otwórz plik Modeli i Ustawień + + + + New Models+Settings + Nowe Modele+Ustawienia + + + + Create a new Models and Settings file + Utwórz nowy plik Modeli i Ustawień + + + + Open Models+Settings... + Otwórz Modele i Ustawienia... + + + + Save Models+Settings... + Zapisz Modele i Ustawienia... + + + + + Save Models and Settings file + Zapisz plik Modeli i Ustawień + + + + Save Models+Settings as... + Zapisz Modele+Ustawienia jako... + + + + Cut Model + Wytnij Model + + + + Cut current model to the clipboard + Wytnij aktualny model do schowka + + + + Copy Model... + Kopiuj Model... + + + + Copy current model to the clipboard + Wytnij aktualny model do schowka + + + + Paste Model... + Wklej Model... + + + + Paste model from clipboard + Wklaj Model ze schowka + + + + The classic companion9x icon theme + Klasyczny zestaw ikon Companion + A monochrome white icon theme @@ -2495,55 +2602,21 @@ Chcesz pobrać teraz? Użyj Rosyjskiego w menu - - About - O aplikacji + + + Radio Settings Profile + Profil Ustawień Radia - - Print - Drukuj + + Show recent Models+Settings documents + Pokaż ostatanie dokumenty Modeli i Ustawień Print current model Drukuj aktualny model - - - Simulate - Symulacja - - - - Simulate selected model - Symulacja wybranego modelu - - - - loadBackup... - Załaduj backup... - - - - Logs - Logi - - - - Setting... - Ustawienia... - - - - Downloads... - Pobieranie... - - - - Check for updates... - Sprawdź aktualizacje... - Check OpenTX and Companion updates @@ -2554,16 +2627,6 @@ Chcesz pobrać teraz? Edit Tx Splash Image... Edytor erkanu startowego radia... - - - edit the splash screen of your TX - Edytuj ekran startowy swojego radia - - - - List programmers - Lista programatorów - Fuses... @@ -2579,11 +2642,6 @@ Chcesz pobrać teraz? Open the OpenTX document page in a web browser Otwórz stronę dokumentacji OpenTX w przeglądarce - - - Configure connection software... - Ustawienia oprogramowania łączącego... - Save Tx Models and Settings to file @@ -2591,13 +2649,19 @@ Chcesz pobrać teraz? - Contributors - Współpracownicy + A tribute to those who have contributed to OpenTX and Companion + Hołd dla tych, którzy przyczynili się do rozwoju OpenTX i Companion - A tribute to those who have contributed to OpenTX and Companion - Hołd dla tych, którzy przyczynili się do rozwoju OpenTX i Companion + Contributors... + Współpracownicy... + + + + + Recent Models+Settings + Ostatnie Modele+Ustawienia @@ -2609,11 +2673,6 @@ Chcesz pobrać teraz? Set Icon Size Ustaw wielkość ikon - - - Radio Settings Profiles - Profile Ustawień Radia - A new version of Companion is available (version %1)<br>Would you like to download it? @@ -2667,11 +2726,6 @@ Chcesz pobrać teraz? The icon size will be used the next time you start Companion. Wybrana wiekość ikon będzie użyta po ponownym uruchomieniu Comapnion. - - - Open - Otwórz - @@ -2802,37 +2856,11 @@ Czy mimo wszystko zapisać? About Companion O aplikacji Companion - - - Create a new file - Utwórz nowy plik - - - - Open an existing file - Otwórz istniejący plik - Load backup from file Załaduj backup z pliku - - - - Save the document to disk - Zapisz dokument na dysku - - - - Open log file - Otwórz plik logów - - - - Show Companion changelog - Zobacz zmiany w Companion - Write Models and Settings to transmitter @@ -2848,56 +2876,11 @@ Czy mimo wszystko zapisać? Write Firmware Zapisz firmware - - - Open... - Otwórz... - - - - Save... - Zapisz... - - - - Save As... - Zapisz jako... - Exit Zakończ - - - Cut - Wytnij - - - - Cut current selection to the clipboard - Wytnij zaznaczenie do schowka - - - - Copy... - Kopiuj... - - - - Copy current selection to the clipboard - Wytnij zaznaczenie do schowka - - - - Paste... - Wklej... - - - - Paste clipboard into current selection - Wytnij zaznaczenie do schowka - Monochrome @@ -2923,11 +2906,71 @@ Czy mimo wszystko zapisać? Use system language in menus Użyj języka systemu w menu + + + Download... + Pobieranie... + + + + Check for Updates... + Sprawdź aktualizacje... + + + + Companion Changes... + Zmiany w Companion... + + + + Show Companion change log + Pokaż log zmian Companion + + + + Firmware Changes... + Zmiany w Firmware... + + + + Show firmware change log + Pokaż log zmian Firmware + + + + Compare Models... + Porównaj modele... + + + + Edit the splash image of your TX + Edytuj ekran startowy swojego radia + + + + List programmers... + Lista programistów... + Write firmware to transmitter Zapisz firmware do radia + + + Add Radio Profile + Dodaj profil radia + + + + Configure Communications... + Ustaw komunikację... + + + + Configure software for communicating with the transmitter + Ustaw oprogramowanie komunikacyjne z radiem + Write Models and Settings from file to Tx @@ -2964,46 +3007,26 @@ Czy mimo wszystko zapisać? Wczytaj Firmware z radia - - Configure software for reading from and writing to the transmitter - Ustawienia oprogramowania do odczytu i zapisu radia - - - + Write Zapis - - + + %2 + %2 + + + + Invalid Models and Settings File %1 Błędny plik %1 Modeli i Ustawień - + Invalid binary Models and Settings File %1 Błędny binarny plik %1 Modeli i Ustawień - - - ChangeLog... - Zmiany... - - - - Firmware ChangeLog... - Zmiany firmware... - - - - Show firmware changelog - Zobacz zmiany w firmware - - - - Compare... - Porównaj... - Compare models @@ -3034,22 +3057,6 @@ Czy mimo wszystko zapisać? Classical Klasyczny - - - The classical Companion icon theme - Klasyczny zestaw ikon Companion - - - - New - Nowy - - - - - Recent Files - Poprzednie pliki - Set Menu Language @@ -3062,13 +3069,13 @@ Czy mimo wszystko zapisać? Plik - - + + Edit Edycja - + Settings Ustawienia @@ -3079,42 +3086,27 @@ Czy mimo wszystko zapisać? - + Help Pomoc - - - Show a selection list of recent documents - Pokaż listę wyboru poprzednich dokumentów - - - - Radio Profiles - Profile Radia - Show a selection list of radio settings profiles Pokaż listę wyboru profili ustawiań radia - + Ready Gotowe - - &%1: %2 - &%1: %2 - - - + Unable to find file %1! Nie mogę znaleźć pliku %1! - + Error reading file %1: %2. Błąd odczytu pliku %1: @@ -3149,16 +3141,17 @@ Czy mimo wszystko zapisać? - - - - + + + + + Error Błąd - + Unable to find file %1! Nie mogę odnaleźć pliku %1! @@ -3166,7 +3159,7 @@ Czy mimo wszystko zapisać? - + Error opening file %1: %2. Błąd otwarcia pliku %1: @@ -3228,7 +3221,7 @@ Czy mimo wszystko zapisać? - + Error reading file %1: %2. Błąd odczytu pliku %1: @@ -3258,58 +3251,58 @@ Zapisać? - - + + Taranis radio not found Nie odnaleziono Radia Taranis - - + + Impossible to identify the radio on your system, please verify the eeprom disk is connected. Identyfikacja radia w Twoim systemie nie jest możliwa, sprawdź dysk eeprom podpięty do komputera. - - - + + + Backup EEPROM From Tx Backup EEPROM z radia - + Cannot check eeprom compatibility! Continue anyway? Nie mogę sprawdzić kompatybilności EEprom! Kontynuować ? - - + + Warning Ostrzeżenie - + Firmware in radio is of a different family of eeprom written, check file and preferences! Firmware w radiu jest różny od zapisanego eepromu, sprawdź plik i ustawienia! - + Firmware in flash is outdated, please upgrade! Firmware w radiu jest przestarzały. Proszę zaktualizować! - + Write EEPROM To Tx Zapis EEPROM do radia - - Open - Otwórz + + Open backup Models and Settings file + Otwórz plik backupu Modeli i Ustawień - + Invalid binary backup File %1 nieprawidłowy binarny plik %1 @@ -4112,70 +4105,70 @@ p, li { white-space: pre-wrap; } QObject - + Rud SK - + Ele SW - + Thr Gaz - + Ail Lotki - - + + P1 Potencjometr 1 - - + + P2 Potencjometr 2 - - + + P3 Potencjometr 3 - + S1 Potencjometr 1 - + S2 Potencjometr 2 - + LS Lewy suwak - + RS Prawy suwak @@ -4202,14 +4195,14 @@ p, li { white-space: pre-wrap; } - + REa Pokrętło :a - + REb Pokrętło :b @@ -4694,26 +4687,26 @@ p, li { white-space: pre-wrap; } - + ---- - + THR THR - + ON Włącz - + OFF Wyłącz @@ -5160,7 +5153,7 @@ p, li { white-space: pre-wrap; } - + Warning Ostrzeżenie @@ -5170,94 +5163,94 @@ p, li { white-space: pre-wrap; } EEPROM zapisany z tymi ostrzeżeniami: - - + + FM%1 FP%1 FM%1 - + Input%1 Wejście %1 - + English Angielski - + French Francuski - + Italian Włoski - + German Niemiecki - + Czech Czeski - + Slovak Słowacki - + Spanish Hiszpański - + Portuguese Portugalski - + Polish Polski - + Finnish Fiński - + No Nie - + RotEnc A Pokrętło :A - + Rot Enc B Pokrętło :B - + Rot Enc C Pokrętło :C - + Rot Enc D Pokrętło :D - + Rot Enc E Pokrętło :E @@ -5280,22 +5273,22 @@ p, li { white-space: pre-wrap; } ASpd - + ASpd dTE - + dTE Cel- - + Cel- Vfs- - + Vfs- @@ -5340,22 +5333,22 @@ p, li { white-space: pre-wrap; } ABS - + ABS THs - + THs TH% - + TH% THt - + THt @@ -5574,138 +5567,138 @@ p, li { white-space: pre-wrap; } <font color=red><b>Niespójny parametr</b></font> - + Rotary Encoder Pokrętło - + !Flight mode %1 !Faza lotu %1 - + Flight mode %1 Faza lotu %1 - + Yellow Żółty - + Orange Pomarańczowy - + Red Czerwony - + Winged Shadow How High - + Winged Shadow How High (not supported) Winged Shadow How High (nie obsługiwane) - + FrSky Sensor Hub Hub sensora FrSky - - + + None Żaden - + Imperial Imperialne - + Metric Metryczne - + Extra Fine Bardzo dokładne - + Fine Dokładne - + Medium Średni - + Coarse Gruby - + Exponential Eksponencjalny - + Count Up Licz - + Count Down Odliczaj - + %1:%2, - + : %1 Channels, %2usec Delay :Kanały %1, opóźnienie %2usX - + Flight modes(%1) Fazy lotu(%1) - + Flight mode(%1) Faza lotu (%1) - + Rudder SK - + Elevator SW - + Throttle Gaz - + Aileron Lotki @@ -5716,43 +5709,43 @@ p, li { white-space: pre-wrap; } - - + + --- - + Rud Trim Trymer SK - + Ele Trim Trymer SW - + Thr Trim Trymer gazu - + Ail Trim Trymer lotek - + Rot Enc Pokrętło - + Swedish Szwedzki - + CH%1 Kan %1 @@ -5780,7 +5773,7 @@ p, li { white-space: pre-wrap; } - + Timer1 @@ -5788,21 +5781,21 @@ p, li { white-space: pre-wrap; } - + Timer2 - + All Wszystkie - + Telemetry Telemetria @@ -5835,66 +5828,66 @@ p, li { white-space: pre-wrap; } - + Value Wartość - + Source Źródło - + GVAR Zmienna - + Increment Zwiększanie - + Own value Własny Wartość - + Flight mode %1 value Flight phase %1 value Wartość Fazy lotu FL%1 - + Keys Przyciski - + Sticks Drążki - + Keys + Sticks Przyciski i Drążki - + -GV%1 -ZG%1 - + GV%1 ZG%1 - + Simulator for this firmware is not yet available Nie jest dostępny symulator dla tego firmware @@ -5972,17 +5965,17 @@ Zespół OpenTX/Companion. Użyj trymerów dla Fazy Lotu %1 + Własne trymery jako offset - + FW: %1 FW:%1 - + Pict: %1 Obrazek:%1 - + Profile image Obrazek Profilu @@ -6219,27 +6212,27 @@ Wolne obroty będą na górze, trymer i ostrzeżenie o otwartym gazie również TRN - + TRN GEA - + GEA ID0 - + ID0 ID1 - + DI1 ID2 - + ID2 @@ -6314,13 +6307,13 @@ Wolne obroty będą na górze, trymer i ostrzeżenie o otwartym gazie również SD - + SD SC - + SC @@ -6334,25 +6327,25 @@ Wolne obroty będą na górze, trymer i ostrzeżenie o otwartym gazie również S2 - + S2 SG - + SG RS - + RS SH - + SH @@ -6366,38 +6359,38 @@ Wolne obroty będą na górze, trymer i ostrzeżenie o otwartym gazie również S1 - + S1 SB - + SB SA - + SA SE - + SE SF - + SF LS - + LS @@ -6873,25 +6866,25 @@ Wolne obroty będą na górze, trymer i ostrzeżenie o otwartym gazie również appPreferencesDialog - + Simulator capture folder Katalog zapisu symulatora - + Remember simulator switch values Zapamiętaj ustawienia przełączników w symulatorze - - - - + + + + Open Folder Otwórz katalog - + User Splash Screens Użyj ekranu powitalnego @@ -6901,47 +6894,52 @@ Wolne obroty będą na górze, trymer i ostrzeżenie o otwartym gazie również Edycja Ustawień - + Application Settings Ustawienia Aplikacji - + + Only show user splash images + Pokaż tylko ekrany powitalne użytkownika + + + + Show user and companion splash images + Pokaż ekrany powitalne użytkownika i Companion + + + Simulator Settings Ustawienia Symulatora - + Blue Niebieskie - + Green Zielone - + Red Czerwone - + Orange Pomarańczowe - + Yellow Żółte - - Radio Settings - Ustawienia Radia - - - + Mode selection: Mode 1: @@ -6964,27 +6962,27 @@ Mode 4: - + Mode 1 (RUD ELE THR AIL) Mod 1 (SK.SW.Gaz.Lot) - + Mode 2 (RUD THR ELE AIL) Mod 2 (SK.Gaz.SW.Lot) - + Mode 3 (AIL ELE THR RUD) - + Mode 4 (AIL THR ELE RUD) Mod 4 (Lot.Gaz.SW.SK) - + Channel order This is used by the templated to determine which channel goes to what number output. @@ -6993,313 +6991,317 @@ This is used by the templated to determine which channel goes to what number out To ustawienie jest używane przez szablony, określa jakie wyjście przypisane jest do kanału. - + R E T A K W G L - + R E A T K W L G - + R T E A - + R T A E K G L W - + R A E T K L W G - + R A T E K L G W - + E R T A W K G L - + E R A T W K L G - + E T R A W G K L - + E T A R W G L K - + E A R T W L K G - + E A T R W L G K - + T R E A G K W L - + T R A E G K L W - + T E R A G W K L - + T E A R G W L K - + T A R E G L K W - + T A E R G L W K - + A R E T L K W G - + A R T E L R G W - + A E R T L W K G - + A E T R L W G K - + A T R E L G K W - + A T E R L G W K - + Default Stick Mode Bazowy mod drążków - - Settings Profile - Ustawienia Profilu - - - + Splash Screen Ekran startowy - + Channel Order Kolejność kanałów - + Append version number to FW file name Dodaj numer Firmware do nazwy pliku - + SD Structure path Struktura karty SD + Firmware Variant + Wariant Firmware + + + Select Image Wybierz obrazek - + + Firmware File + Plik Firmware + + + Offer to write FW to Tx after download Zaproponuj zapisanie FirmWare do radia po pobraniu - + + Radio Settings Profile + Profil Ustawień Radia + + + + Profile Name + Nazwa profilu + + + Remove Profile Usuń Profil - + Clear Image Wyczyść obrazek - Firmware - Firmware + Firmware - - Include companion splashes - Załącz ekrany powitalne - - - - Only user defined splashes - Tylko własne ekrany powitalne - - - + Splash Screen Library Biblioteka ekranół powitalnych - + Files to keep Pkili to zapamiętania - + Simulator BackLight Podświetlenie symularota - + Automatic Backup Folder Automatyczny Katalog Backupów - + Only capture to clipboard Przechwyć tylko do schowka - + Joystick Joystick - + Find Executable Znajdź plik wykonywalny - + Google Earth Executable Plik wykonywalny Google Earth - + Calibrate Kalibracja - + Enable Aktywowany - + Show splash screen when Companion starts Pokaz ekran startowy przy uruchamianiu Companion - + Automatic check for OpenTX firmware updates Automatycznie sprawdź aktualizacje firmware OpenTX - + Automatic check for Companion updates Automatycznie sprawdź aktualizacje Companion - + Offer to use wizard for new models Zaproponuj użycie konfiguratora dla nowych modeli - + Enable automatic backup before writing firmware Uaktywnij automatyczny backup przed zapisem firmware - + Select your snapshot folder Katalog zrzutów - - + + No joysticks found Brak oysticka - + Select your library folder Wybierz katalog bibliteki - + Select your Models and Settings backup folder Wybierz folder do backupowania Modeli i Ustawień - + Select Google Earth executable Wybierz wykonywalny plik Google Earth - + Select the folder replicating your SD structure Wybierz folder do zreplikowania struktury Twojej karty SD - + Not possible to remove profile Usunięcie profilu jest niemożliwe - + The default profile can not be removed. Podstawowy profil nie moze być usunięty. - + Open Image to load Otwórz obrazek do załadowania - + Images (%1) Obrazki (%1) @@ -7683,250 +7685,292 @@ m2560 dla platformy V4 Własne logo - - + Write to TX Zapisz do radia - + <html><head/><body><p>Modify calibration parameters using settings from current profile</p></body></html> <html><head/><body><p>Zmiana parametrów kalibracji przy użyciu aktualnego profilu</p></body></html> - + Patch calibration setting from profile Zamień ustawienia kalibracji wartościami z profilu - + <html><head/><body><p>Modify HW parameters using settings from current profile</p></body></html> <html><head/><body><p>Zmień ustawiania parametrów HW przy pomocy wartości z aktualnego profilu</p></body></html> - + Patch HW setting from profile Zmień ustawiania parametrów HW wartościami z profilu - + Date & Time Data i Czas - + + Use firmware start screen + Użyj ekranu startowego z firmware + + + + Use another start screen + Użyj innego ekranu startowego + + + + Use profile start screen + Użyj ekranu startowego z profilu + + + + Use library start screen + Użyj ekranu startowego z biblioteki + + + SVN - + Variant Wariant - Invert Color - Odwróć kolory + Odwróć kolory - Load Image - Otwórz logo + Otwórz logo - Open Splash Library - Otwórz bibliotekę obrazków + Otwórz bibliotekę obrazków - - ... - - - - Substitute image in firmware - Zmień logo w firmware + Zmień logo w firmware - - + + Browse for file Przeglądaj pliki - + Allows Companion to write to older version of the firmware Pozwól Companion na zapis do starszej wersji firmware - + Backup and restore Models and Settings Zbakupuj i odtwórz Modele i Ustawienia - Use image in settings - Użyj Logo w ustawieniach + Użyj Logo w ustawieniach - + Check Firmware compatibility Sprawdź kompatybilność firmware - + Current Profile Aktualny profil - + Cancel Przerwij - + Write firmware to TX Zapisz firmware do radia - + Current profile Aktualny profil - - Open - Otwórz - - - - - - - - + + + + + + Warning Ostrzeżenie - %1 is not a known firmware - %1 nie jest znanym firmware + %1 nie jest znanym firmware - Burn anyway ! - Wypiecz mimo wszystko ! + Wypiecz mimo wszystko ! - - - - - - - - - - + + + + + + + + + + + + + Error Błąd - + Unable to find file %1! Nie mogę odnaleźć pliku %1! - - - + + + Error opening file %1: %2. Błąd otwarcia pliku %1: %2. - + Write Models and Settings to TX Zapisz Modele i Ustawienia do radia - + Write Models and Settings in %1 to TX Zapisz Modele i Ustawienia w %1 do radia - + + Open Firmware File + Otwórz plik Firmware + + + Choose file to load Models and Settings from Wybierz plik Modeli i Ustawien do wczytania - - - + + %1 may not be a valid firmware file + %1 moze nie być prawidłowym plikiem firmware + + + + + Invalid binary Models and Settings File %1, Proceed anyway ? Nieprawidłowy plik Modeli i Ustawień : %1. Kontynuować ? - + Error reading file %1: %2. Błąd odczytu pliku %1: %2. - - Open Image to load - Otwórz plik z logo + + The firmware file is not valid. + Plik firmware jest błedny. - + + There is no start screen image in the firmware file. + Brak obrazka ekranu startowego w firmware. + + + + The profile image %1 does not contain an image. + Obraz profilu %1 nie zawiera obrazka. + + + + Open image file to use as Tx start screen + Otwórz plik obrazka by użyć go jako ekran startowy radia + + + + Image could not be loaded from %1 + Obrazek nie moze być załadowany z %1 + + + + The library image could not be loaded + Obrazek z biblioteki nie może być załadowany + + + Open Image to load + Otwórz plik z logo + + + Images (%1) Obrazki (%1) - - Cannot load %1. - Nie mogę załadować %1. + Nie mogę załadować %1. - + Cannot save customized firmware Nie mogę zapisać przystosowanego firmware - + Custom image not found Własny obrazek nie odnaleziony - + No firmware selected Brak wyboru firmware - + Wrong radio calibration data in profile, Settings not patched Błędna kalibracja radia w profilu, Ustawienia nie spatchowane - + Wrong radio setting data in profile, Settings not patched Błędne ustawienia radia w profilu, Ustawienia nie spatchowane - - + + Cannot write file %1: %2. Nie mogę zapisać pliku %1: %2. - + Error writing file %1: %2. Błąd zapisu pliku %1: @@ -8501,118 +8545,118 @@ m2560 dla platformy V4 - + Invert Odwróć - - + + Load FW Otwórz firmware - - + + Load Pict Otwórz obrazek - + Load Profile Załaduj profil - - + + Save Zapisz - + Open Splash Library Otwórz bibliotekę obrazków - - - + + + ... - - Open - Otwórz - - - - - - + + + + Error Błąd - - Cannot load embedded FW image from %1. - Nie mogę załadować wstawionego obrazu FW z %1. - - - + Cannot load the image file %1. Nie mogę załadować pliku obrazka %1. - + Cannot load the profile image %1. Nie mogę załadować obrazu Profilu %1. - + Cannot load the library image %1. Nie mogę załadować obrazu biblioteki %1. - + File Saved Plik Zapisany - + The image was saved to the file %1 Obraz został zapisany do pliku %1 - + Image Refresh Error Błąd odświeżenia obrazka - + Failed to refresh image from file %1 Nieudane odswieżenie obrazka z pliku %1 - + File Save Error Błąd zapisu pliku - + Failed to write image to %1 Nieudany zapis obrazka do %1 - + Open Image to load Otwórz obrazek do załadowania - + + Open Firmware File + Otwórz plik Firmware + + + + Can not load embedded image from firmware file %1. + Nie mogę załądować wbudowanego obrazka z pliku Firmware %1. + + + Images (%1) Obrazki (%1) @@ -10621,32 +10665,32 @@ Mode 4: splashLibrary - + ... - + Splash Library - page %1 of %2 Biblioteka obrazków - strona %1 z %2 - + Warning Ostrzeżenie - + Invalid image in library %1 Nieprawidłowy obrazek w bibliotece %1 - + Information Informacja - + No valid image found in library, check your settings Nie znaleziono prawodłowego obrazka w biblitece, sprawdź ustawienia diff --git a/companion/src/translations/companion_sv.ts b/companion/src/translations/companion_sv.ts index 9b2636f07..091cd0560 100644 --- a/companion/src/translations/companion_sv.ts +++ b/companion/src/translations/companion_sv.ts @@ -57,7 +57,7 @@ CurveGroup - + Diff Diff @@ -143,7 +143,7 @@ CustomFunctionsPanel - + Switch Brytare @@ -163,17 +163,17 @@ Effekt - + CF%1 - + - + ON På - + Error Fel @@ -183,7 +183,7 @@ Kan inte hitta ljudfilen %1! - + &Delete &Ta bort @@ -601,7 +601,7 @@ Om fältet lämnas tomt så är filtret aktivt hela tiden. Allmänna inställningar - + General settings used throught the transmitter. These will be relevant for all models in the same EEPROM. Allmänna inställningar för sändaren @@ -1541,7 +1541,7 @@ Mode 4: Spänning - + Warning Varning @@ -1557,12 +1557,12 @@ Mode 4: Felaktig information i profilen, hårdvaruinställningar lästes inte in - + Do you want to store calibration in %1 profile<br>overwriting existing calibration? Vill du skriva över existerande kalibreringsdata<br>i profilen %1 med de nuvarande? - + Calibration and HW parameters saved. Kalibrering ojch hårdvaruinställningar sparades. @@ -1677,7 +1677,7 @@ Mode 4: PPMSim - + If you enable FAI, you loose the vario, the play functions, the telemetry screen. This function cannot be disabled by the radio. Are you sure ? @@ -1844,25 +1844,25 @@ FAI-funktionen kan inte slås av i sändaren. InputsPanel - + Move Up Flytta uppåt - - + + Ctrl+Up Ctrl+Up - - + + Move Down Flytta nedåt - - + + Ctrl+Down Ctrl+Down @@ -1887,12 +1887,12 @@ FAI-funktionen kan inte slås av i sändaren. Brytare(%1) - + Clear All Settings Radera alla inställningar - + Not enough available inputs! För få filter är tillgängliga! @@ -2064,39 +2064,39 @@ FAI-funktionen kan inte slås av i sändaren. MainWindow - - - - + + + + File loaded Filen har laddats - + - - + + Save As Spara Som - - + + No updates available at this time. Inga updateringar finns tillgängliga. - - - - + + + + Unable to check for updates. Det gick inte att söka efter uppdateringar. - + Executable (*.exe) Program (*.exe) @@ -2106,110 +2106,96 @@ FAI-funktionen kan inte slås av i sändaren. Vill du starta installationsprogrammet? - + Do you want to write the firmware to the transmitter now ? Vill du skriva firmware till sändaren nu? - + A new version of %1 firmware is available (current %2 - newer %3). Do you want to download it now ? En ny version finns tillgänglig av %1 fimware (Din version %2 - Ny version %3). Vill du ladda ned den nya versionen nu ? - Open - Öppna + Öppna - + File saved Filen sparades - + Copyright Copyright - New - Ny + Ny - Open... - Öppna... + Öppna... - Save... - Spara... + Spara... - Save As... - Spara Som... + Spara Som... - + Exit Avsluta - Cut - Klipp Ut + Klipp Ut - Cut current selection to the clipboard - Klipp ut markeringens innehåll till klippbordet + Klipp ut markeringens innehåll till klippbordet - Copy... - Kopiera... + Kopiera... - Copy current selection to the clipboard - Kopiera markeringens innehåll till klippbordet + Kopiera markeringens innehåll till klippbordet - Paste... - Klistra In... + Klistra In... - Paste clipboard into current selection - Klistra in klippbokens innehåll i det valda avsnittet + Klistra in klippbokens innehåll i det valda avsnittet - + Classical Klassiskt - The classical Companion icon theme - Det klassiska Companion-temat + Det klassiska Companion-temat - The new Companion 2 icon theme - Det nya Companion2-temat + Det nya Companion2-temat - Companion2 - Companion2 + Companion2 - + Monochrome Monokromt @@ -2234,137 +2220,119 @@ Vill du ladda ned den nya versionen nu ? Använd systemspråket i menyerna - About - Om + Om - Print - Skriv ut + Skriv ut - + Print current model Skriv ut modell - Simulate - Simulera + Simulera - Simulate selected model - Simulera modell + Simulera modell loadBackup... Ladda backup från fil... - Logs - Loggar + Loggar - Setting... - Inställningar... + Inställningar... - Downloads... - Nedladdningar... + Nedladdningar... - Check for updates... - Sök efter uppdateringar... + Sök efter uppdateringar... - + Edit Tx Splash Image... Startbildsredigerare... - edit the splash screen of your TX - Editera startbilder för din sändare + Editera startbilder för din sändare - List programmers - Programmerare + Programmerare - + Fuses... Säkringar... - Configure connection software... - Inställningar för kommunikation... + Inställningar för kommunikation... - + Save Tx Models and Settings to file Spara sändarens Modeller och Inställningar till fil - Contributors - Bidragande + Bidragande - + A tribute to those who have contributed to OpenTX and Companion Ett tack till alla de som bidragit till OpenTX och Companion - + Settings Inställningar - + Read/Write Läs/Skriv - - &%1 %2 - &%1 %2 + &%1 %2 &New &Ny - Create a new file - Skapa ny fil + Skapa ny fil &Open... &Öppna... - Open an existing file - Öppna en existerande fil + Öppna en existerande fil &Save &Spara - - Save the document to disk - Spara dokumentet till fil + Spara dokumentet till fil Save &As... @@ -2379,12 +2347,12 @@ Vill du ladda ned den nya versionen nu ? &Sök efter uppdateringar... - + Display previous message again at startup ? Skall föregående varning visas igen vid uppstart ? - + Firmware does not longer fit in the Tx, due to selected firmware options Firmware får inte rum i minnet på grund av att för många funktioner aktiverats @@ -2394,12 +2362,12 @@ Vill du ladda ned den nya versionen nu ? Tillfälligt fel i byggservern. Försök igen senare - + Firmware does not fit in the Tx, due to selected firmware options Firmware får inte rum i minnet på grund av att för många funktioner aktiverats - + Firmware %1 does not seem to have ever been downloaded. Version %2 is available. Do you want to download it now ? @@ -2408,12 +2376,12 @@ Version %2 finns tillgänglig. Vill du ladda ned den nu ? - + Write Models and settings from %1 to the Tx? Skriv Modeller och Inställningar från %1 till sändaren? - + Conversion failed Konverteringen misslyckades @@ -2428,7 +2396,7 @@ Vill du ladda ned den nu ? Säkerhetskopieringen misslyckades - + OpenTX Companion - FW: %1 - Profile: %2 OpenTX Companion - FW: %1 - Profil: %2 @@ -2437,7 +2405,7 @@ Vill du ladda ned den nu ? &Inställningar... - + Edit Settings Redigera Inställningar @@ -2459,7 +2427,7 @@ Vill du ladda ned den nu ? &Avsluta - + Exit the application Avsluta programmet @@ -2496,16 +2464,15 @@ Vill du ladda ned den nu ? Ctrl+Alt+R - Configure software for reading from and writing to the transmitter - Inställningar för mjukvaran som kommunicerar med sändaren + Inställningar för mjukvaran som kommunicerar med sändaren &List programmers &Programmerare - + List available programmers Lista upp tillgängliga prorammerare @@ -2552,10 +2519,8 @@ Vill du ladda ned den nu ? Visa information om programmet - - Recent Files - Senaste Filer + Senaste Filer &File @@ -2570,22 +2535,22 @@ Vill du ladda ned den nu ? Companion - Editor för Modeller och Inställningar - %1 - + Checking for updates Letar efter uppdateringar - + A new release of Companion is available please check the OpenTX website! En ny version av Companion finns tillgänglig. Var god kontrollera OpenTX webbsida! - + Ignore this version (r%1)? Ladda inte ned versionen (r%1)? - + OpenTX Home Page: <a href='%1'>%1</a> OpenTX Hemsida: <a href='%1'>%1</a> @@ -2621,16 +2586,15 @@ Vill du ladda ned den nu ? Redigera programmets inställningar - Show Companion changelog - Visa en lista med förändringar av Companion + Visa en lista med förändringar av Companion &Write Models and Settings To Tx &Skriv Modeller och Inställningar till sändaren - + Write Models and Settings to transmitter Skriv Modeller och Inställningar till sändaren @@ -2648,8 +2612,84 @@ Vill du ladda ned den nu ? Write Firmware Skriv Firmware + + + New Models+Settings + Ny Modeller+Inställningar + + Create a new Models and Settings file + Skapa en ny Modeller och Inställningar-fil + + + + Open Models+Settings... + Öppna MOdeller+Inställningar... + + + + Save Models+Settings... + Spara Modeller+Inställningar... + + + + + Save Models and Settings file + Spara Modeller och Inställningar-fil + + + + Save Models+Settings as... + Spara Modeller+Inställningar som... + + + + Cut Model + Klipp ut Modell + + + + Cut current model to the clipboard + Klipp ut vald modell till klippbordet + + + + Copy Model... + Kopera Modell... + + + + Copy current model to the clipboard + Kopiera vald modell till klippbordet + + + + Paste Model... + Klistra in Modell... + + + + Paste model from clipboard + Klistra in modell från klippbordet + + + + The classic companion9x icon theme + Det klassiska companion9x-temat + + + + Yerico + Yerico + + + + Yellow round honey sweet icon theme + Yellow round honey sweet icon theme + + + Write firmware to transmitter Skriv firmware till sändaren @@ -2697,24 +2737,40 @@ Vill du ladda ned den nu ? - + File Arkiv - + Edit Redigera - - + + Help Hjälp - + + + Radio Settings Profile + Radioprofil + + + + Show recent Models+Settings documents + Visa senaste Modeller+Inställningar-dokument + + + + Show a selection list of radio settings profiles + Visa en lista med radioprofiler + + + Ready Redo @@ -2723,17 +2779,17 @@ Vill du ladda ned den nu ? &Bidragsgivare... - + Display previous warning again at startup ? SKall föregående varning visas igen vid uppstart ? - + - + - - + + @@ -2745,21 +2801,21 @@ Vill du ladda ned den nu ? Fel - + Cannot write file %1: %2. Filen %1 kunde inte skrivas: %2. - + New release available En ny version finns tillgänglig - - - + + + Error opening file %1: @@ -2768,68 +2824,72 @@ Vill du ladda ned den nu ? %2. - + Compilation server termporary failure, try later Tillfälligt fel i byggservern. Försök igen senare - - + + Compilation server too busy, try later Byggservern är upptagen. Försök igen senare - - + + Unknown server failure, try later Okänt server-fel. Försök igen senare - Compare... - Jämför... + Jämför... - + Compare models Jämför modeller - - + + Backup is impossible Säkerhetskopiering kan inte utföras - - + + The backup dir set in preferences does not exist Foldern för säkerhetskopior existerar inte - + Warning Varning - Firmware Profiles - Profiler för Firmware + Profiler för Firmware &Read/Write &Läs/Skriv - + Write Skriv - + + %2 + %2 + + + + Unable to find file %1! Kan inte hitta filen %1 ! @@ -2845,7 +2905,7 @@ Vill du ladda ned den nu ? ladda&Backup... - + Load backup from file Ladda backup från fil @@ -2858,46 +2918,45 @@ Vill du ladda ned den nu ? Ctrl+G - Open log file - Öppna loggfil + Öppna loggfil - - + + - + Taranis radio not found Hittade inte någon Taranis-sändare - - + + Impossible to identify the radio on your system, please verify the eeprom disk is connected. Det går inte att identifiera sändaren. Verifiera att EEPOROM-skivan är ansluteten. - + Yes Ja - + A new version of Companion is available (version %1)<br>Would you like to download it? An ny version av Companion finns tillgänglig (version %1)<br>Vill du ladda ned den? - - + + Compilation server requires registration, please check OpenTX web site Byggservern kräver registrering. Var god kontrollera OpenTX webbsida - + No Nej @@ -2915,34 +2974,40 @@ Vill du ladda ned den nu ? Vill du ladda ned firmware %1 nu ? - + Release notes contain very important informations. Do you want to see them now ? Release notes innehåller väldigt viktig information. Vill du läsa dem nu? - + The selected language will be used the next time you start Companion. Språket som valts kommer att användas nästa gång Companion startas. - - + + OK OK - + The new theme will be loaded the next time you start Companion. De nya ikonerna kommer att användas nästa gång Companion startas. - + The icon size will be used the next time you start Companion. Ikonernas storlek kommer att justeras nästa gång Companion startas. - + + + Open Models and Settings file + Öppna Modeller och Inställningar-fil + + + Firmware updates Firmware-uppdatering @@ -2954,14 +3019,14 @@ Vill du ladda ned den nu ? - + Read Models and Settings From Tx Läs Modeller och Inställningar från sändaren - + The file %1 has not been recognized as a valid Models and Settings file Write anyway ? @@ -2974,13 +3039,13 @@ Starta skrivningen i alla fall ? - + Backup Models and Settings From Tx Säkerhetskopiera Modeller och Inställningar från sändaren - + Cannot check Models and Settings compatibility! Continue anyway? Det går inte att verifiera att Modeller och Inställningar är kompatibla. Fortsätt i alla fall? @@ -2996,12 +3061,12 @@ Starta skrivningen i alla fall ? - + Write Models and Settings To Tx Skriv Modeller och Inställningar till sändaren - + Write Firmware To Tx Skriv firmware till sändaren @@ -3037,7 +3102,7 @@ Starta skrivningen i alla fall ? Det gick inte att säkerhetskopiera sändarens Modeller och Inställningar. Skrikvningen av firmware avbröts - + Save transmitter Models and Settings to File Spara sändarens Modeller och Inställningar till en fil @@ -3047,12 +3112,12 @@ Starta skrivningen i alla fall ? Det går inte att identifiera sändaren. - + Read Tx Firmware to File Läs Sändarens Firmware till Fil - + About Companion Om Companion @@ -3065,28 +3130,24 @@ Starta skrivningen i alla fall ? Ladda ned firmware och röstfiler. Definera profildata. - Check for new version of Companion - Sök efter ny version av Companion + Sök efter ny version av Companion Show Companion contributors list Visa vilka som bidragit till Companion - ChangeLog... - Förändringar... + Förändringar... - Firmware ChangeLog... - Firmware-förändringar... + Firmware-förändringar... - Show firmware changelog - Visa firmware-förändringar + Visa firmware-förändringar Configure transmitter start screen... @@ -3097,12 +3158,11 @@ Starta skrivningen i alla fall ? Inställningar för &kommunikation... - New Profile - Ny Profil + Ny Profil - + Create a new Radio Setting Profile Lägg till en ny profil med radio-inställningar @@ -3115,7 +3175,7 @@ Starta skrivningen i alla fall ? Det flerfärgade klassiska Companion-temat - + A monochrome black icon theme Ett monokromt svart tema @@ -3207,6 +3267,16 @@ Starta skrivningen i alla fall ? Use English in menus Använd Engelska i menyerna + + + Finnish + Finska + + + + Use Finnish in menus + Använd Finska i menyerna + French @@ -3278,12 +3348,102 @@ Starta skrivningen i alla fall ? Använd Ryska i menyerna - + + About... + Om... + + + + Print... + Skriv Ut... + + + + Simulate... + Simulera... + + + + Simulate current model + Simulera vald modell + + + Load Backup... Ladda backup från fil... - + + View Log File... + Visa loggfil... + + + + Open and view log file + Öppna och visa loggfil + + + + Settings... + Inställningar... + + + + Download... + Nedladdning... + + + + Check for Updates... + Sök efter uppdateringar... + + + + Check OpenTX and Companion updates + Sök efter uppdateringar av Companion och OpenTX + + + + Companion Changes... + Förändringar i Companion... + + + + Show Companion change log + Visa en lista med förändringar av Companion + + + + Firmware Changes... + OpenTX-förändringar... + + + + Show firmware change log + Visa en lista med förändringar av OpenTX + + + + Compare Models... + Jämför modeller... + + + + Edit the splash image of your TX + Editera startbilden' för din sändare + + + + List programmers... + Visa programmerare... + + + + Add Radio Profile + Lägg till Radioprofil + + + Manuals and other Documents Manualer och andra Dokument @@ -3293,7 +3453,28 @@ Starta skrivningen i alla fall ? Öppna OpenTX dokumentsida i en webbläsare - + + Configure Communications... + Kommunikations-inställningar... + + + + Configure software for communicating with the transmitter + Ställ in mjukvara för kommunikation med sändaren + + + + Contributors... + Bidragande... + + + + + Recent Models+Settings + Senaste Modell+Inställnings-filer + + + Set Icon Theme Ställ in Ikontema @@ -3307,12 +3488,11 @@ Starta skrivningen i alla fall ? &Inställningar - Radio Settings Profiles - Profiler för Radioinställningar + Profiler för Radioinställningar - + Invalid Models and Settings File %1 Filen innehåller inte Modeller och Inställningar: %1 @@ -3326,7 +3506,7 @@ Starta skrivningen i alla fall ? MdiChild - + @@ -3334,14 +3514,15 @@ Starta skrivningen i alla fall ? - + - - + + + @@ -3349,36 +3530,36 @@ Starta skrivningen i alla fall ? Fel - + Editing model %1: Redigera modell %1: - + Unable to find file %1! Kan inte hitta filen %1 ! - - + + Error reading file %1: %2. Fel vid inläsning från filen %1: %2. - + - + Error opening file %1: %2. Fel vid öppning av filen %1: %2. - + @@ -3404,12 +3585,12 @@ Starta skrivningen i alla fall ? %2. - + free bytes bytes lediga - + Invalid EEPROM File %1 Ogiltig modelldatafil %1 @@ -3420,48 +3601,48 @@ Starta skrivningen i alla fall ? Ogiltig binär modelldatafil %1 - + %1 has been modified. Do you want to save your changes? %1 har förändrats. Vill du spara förändringarna? - + Cannot write temporary file! En temporär fil kunde inte skrivas! - + Backup is impossible Säkerhetskopierin kan ej utföras - + - + Companion Companion - + The backup dir set in preferences does not exist Den katalog som konfigurerats för säkerhetskopiering existerar inte - - - + + + Backup EEPROM From Tx Säkerhetskopiera modelldata från sändaren - + Cannot check eeprom compatibility! Continue anyway? Det går inte att veriifiera att modelldata är kompatibla. Fortsätt i alla fall? - + Warning Varning @@ -3477,9 +3658,13 @@ Vill du spara förändringarna? Firmware i flashminnet är föråldrat. Var god uppgradera! - + + Open backup Models and Settings file + Öppna Modeller och Inställningar-fil + + Open - Öppna + Öppna @@ -3487,16 +3672,16 @@ Vill du spara förändringarna? Den binära backupfilen är felaktig %1 - - - + + + Taranis radio not found Taranis-sändaren hittades ej - - - + + + Impossible to identify the radio on your system, please verify the eeprom disk is connected. Det går inte att identifiera sändaren. Verifiera att EEPOROM-skivan är ansluteten. @@ -3506,7 +3691,7 @@ Vill du spara förändringarna? Skriv EEPROM till sändaren - + Do you want to use model wizard? Vill du använda modell-guiden? @@ -4295,7 +4480,7 @@ p, li { white-space: pre-wrap; } ModulePanel - + Trainer Output TrainerUttag @@ -4313,7 +4498,7 @@ p, li { white-space: pre-wrap; } QObject - + P1 @@ -4359,17 +4544,15 @@ p, li { white-space: pre-wrap; } T2 - th9x - th9x + th9x - er9x - er9x + er9x - + Trainer Trainer @@ -4457,10 +4640,8 @@ p, li { white-space: pre-wrap; } Timer2 - - - - + + Warning Varning @@ -4470,19 +4651,16 @@ p, li { white-space: pre-wrap; } Modelldata sparades, men med dessa varningar: - ersky9x - ersky9x + ersky9x - - - + Simulator for this firmware is not yet available Det finns ännu ingen simulator för denna typ av firmware - + REa @@ -4738,7 +4916,7 @@ p, li { white-space: pre-wrap; } PPM%1 - + THR GAS @@ -4972,7 +5150,7 @@ p, li { white-space: pre-wrap; } Det går inte att använda Expo på en specialkurva i open9x - + Support for frsky telemetry mod Stöd för FrSky telemeri @@ -5088,12 +5266,12 @@ p, li { white-space: pre-wrap; } Stöd för FrSky PXX-protokoll - + OpenTX for FrSky Taranis Rev4a OpenTX för FrSky Taranis Rev4a - + @@ -5232,21 +5410,21 @@ p, li { white-space: pre-wrap; } X%1 - + + - GV%1 GV%1 - - + + --- ---- - + Rud Trim Rod.Trim @@ -5316,8 +5494,8 @@ p, li { white-space: pre-wrap; } Eget värde - - + + -GV%1 -GV%1 @@ -5334,18 +5512,18 @@ p, li { white-space: pre-wrap; } - + PPM values displayed in us PPM-värden visade i ms - + Bluetooth interface Blåtandsinterface - - + + S1 S1 @@ -5697,7 +5875,7 @@ p, li { white-space: pre-wrap; } Ökning - + Yellow Gul @@ -5933,7 +6111,7 @@ p, li { white-space: pre-wrap; } !Kurva(%1) - + FM%1 FM%1 @@ -5983,6 +6161,11 @@ p, li { white-space: pre-wrap; } Portuguese Portugisiska + + + Finnish + Finska + !Flight mode %1 @@ -5999,7 +6182,7 @@ p, li { white-space: pre-wrap; } Flygläge %1 värde - + openTx only accepts %1 points in all curves openTX accepterar bar %1 punkter i alla kurvor @@ -6023,14 +6206,14 @@ p, li { white-space: pre-wrap; } OpenTX accepterar inte detta antal kanaler - + Your radio probably uses a wrong firmware, eeprom size is 4096 but only the first 2048 are used Din sändare har antagligen laddats med felaktig programvara. eeprom-storleken är 4096, men enbart den första hälften används - + Support for MAVLINK devices Stöd för MAVLINK-enheter @@ -6063,12 +6246,12 @@ eeprom-storleken är 4096, men enbart den första hälften används - + Use alternative SQT5 font Använd SQT5-typsnittet - + @@ -6121,24 +6304,24 @@ eeprom-storleken är 4096, men enbart den första hälften används - + Disable HELI menu and cyclic mix support Slå av HELI-menyn och stöd för cykliska mixar - - + + Disable TEMPLATES menu Slå av menyn för Mallar - - + + Disable Global variables Slå av Globala Variabler - + Possibility to enable FAI MODE at field Möjlighet att slå på FAI-LÄGE före pflygning @@ -6181,7 +6364,7 @@ Gruppen bakom OpenTX/Companion. Använd trim från flygläge %1 + Eget trim som offset - + FW: %1 FW: %1 @@ -6342,6 +6525,296 @@ Gasen reverseras om alternativet väljs. Tomgång ligger då uppåt. Trim och ga Automatiska + + SimulatorDialog + + + + Warning + Varning + + + + Joystick enabled but not configured correctly + Joysticken påslagen, men ej rätt inställd + + + + Cannot open joystick, joystick disabled + Joysticken kan inte hittas. Joysticken stängs av + + + + Simulating Tx (%1) + Simulerar sändare (%1) + + + + Firmware %1 error: %2 + Firmware %1 fel: %2 + + + + SimulatorDialog9X + + + Companion Simulator + Companion Simulator + + + + + + + Right Double Click to Reset + Höger dubbelklick nollställer + + + + THR + GAS + + + + RUD + ROD + + + + ELE + HÖJ + + + + AIL + SKE + + + + + Hold X + Håll X + + + + + Fix X + Fixera X + + + + + Fix Y + Fixera Y + + + + + Hold Y + Håll Y + + + + + + + TextLabel + Textettikett + + + + TRN + TRN + + + + GEA + LAN + + + + ID0 + ID0 + + + + ID1 + ID1 + + + + ID2 + ID2 + + + + BEEP + Summer + + + + P1 + P1 + + + + + + 0 % + 0 % + + + + P2 + P2 + + + + P3 + P3 + + + + 9x Simulator + Simulator för 9x + + + + Outputs + Utgångar + + + + SimulatorDialogTaranis + + + Companion Simulator + Companion Simulator + + + + + Hold Y + Håll Y + + + + + Fix Y + Fixera Y + + + + + Fix X + Fixera X + + + + + Hold X + Håll X + + + + + SD + SD + + + + + SC + SC + + + + + + + Right Double Click to Reset + Höger dubbelklick nollställer + + + + + S2 + S2 + + + + + SG + SG + + + + + RS + RS + + + + + SH + SH + + + + + + + TextLabel + Textettikett + + + + + S1 + S1 + + + + + SB + SB + + + + + SA + SA + + + + + SE + SE + + + + + + SF + SF + + + + + LS + LS + + + + Taranis Simulator + Taranissimulator + + + + Outputs + Utgångar + + Telemetry @@ -6685,7 +7158,7 @@ Gasen reverseras om alternativet väljs. Tomgång ligger då uppåt. Trim och ga mAmpere (mA) - + Range Räckvidd @@ -6741,7 +7214,7 @@ Gasen reverseras om alternativet väljs. Tomgång ligger då uppåt. Trim och ga Telemetriskärm %1 - + Winged Shadow How High Winged Shadow How High @@ -6809,7 +7282,7 @@ Gasen reverseras om alternativet väljs. Tomgång ligger då uppåt. Trim och ga Programmets Inställningar - + Simulator capture folder Lagra simulatorbilder i @@ -6822,27 +7295,37 @@ Gasen reverseras om alternativet väljs. Tomgång ligger då uppåt. Trim och ga - + Open Folder Öppna katalog - + User Splash Screens Egna Startbilder - + Edit Settings Redigera Inställningar - + Application Settings Programmet - + + Only show user splash images + Enbart användarens bilder + + + + Show user and companion splash images + Både användarens bilder och Companion-bilder + + + Simulator Settings Simulatorn @@ -6872,12 +7355,11 @@ Gasen reverseras om alternativet väljs. Tomgång ligger då uppåt. Trim och ga Gul - Radio Settings - Radion + Radion - + Mode selection: Mode 1: @@ -7067,17 +7549,21 @@ Detta används av mallen för att koppla kanal till output-nummer. S G H R - + Default Stick Mode Spaktilldelning - - Settings Profile - Profil + + Firmware File + Firmware - + Settings Profile + Profil + + + Splash Screen Startbild @@ -7097,42 +7583,54 @@ Detta används av mallen för att koppla kanal till output-nummer. Sökväg till SD-struktur - + + Firmware Variant + Firmware-typ + + + Select Image Välj Bild - + Offer to write FW to Tx after download Skriv FW till Tx efter nedladdning - + + Radio Settings Profile + Radioprofile + + + + Profile Name + Profilnamn + + + Remove Profile Ta bort Profil - + Clear Image Ta bort Bild - Firmware - Firmware + Firmware - Include companion splashes - Användarens bilder och Companion-bilder + Användarens bilder och Companion-bilder - Only user defined splashes - Enbart användarens bilder + Enbart användarens bilder - + Splash Screen Library Bibliotek för startbilder @@ -7207,38 +7705,38 @@ Detta används av mallen för att koppla kanal till output-nummer. Säkerhetskopiera innan firmware-skrivning - + Select your snapshot folder Välj katalog för snapshots av Tx-simulatorn - - + + No joysticks found Ingen joystick hittades - + Select your library folder Välj bibliotekskatalog - + Select your Models and Settings backup folder Välj folder för automatisk säkerhetskopiering - + Select Google Earth executable Sökväg till Google Earth - + Select the folder replicating your SD structure Välj katalog med en kopia av din SD-struktur - + Not possible to remove profile Det går inte att ta bort profilen @@ -7256,7 +7754,7 @@ Detta används av mallen för att koppla kanal till output-nummer. Det går inte att ladda %1. - + Open Image to load Öppna bild för laddning @@ -7531,7 +8029,7 @@ OBS. Fyll enbart i detta fällt om du är säker på vad du gör. Ingen kontroll Sökväg till AVRDUDE - + Select Location @@ -7617,7 +8115,7 @@ m2560 för v4.1-kort Inställningar för Programmerare - + DFU-UTIL Configuration Inställningar för DFU-UTIL @@ -7632,7 +8130,7 @@ m2560 för v4.1-kort Inställningar för AVRDUDE - + Companion Companion @@ -7646,12 +8144,12 @@ m2560 för v4.1-kort Välj Sändarens Startbild - + Date & Time Dag & Tid - + SVN Subversion @@ -7661,102 +8159,95 @@ m2560 för v4.1-kort Tillåter Companon att skriva till äldre firmware-versioner - Load Image - Ladda Bild + Ladda Bild - Open Splash Library - Öppna bildbibliotek + Öppna bildbibliotek - ... - ... + ... - Substitute image in firmware - Byt ut bilden i firmware-filen + Byt ut bilden i firmware-filen - - + Write to TX Skriv till sändaren - Use image in settings - Använd bilden från inställningarna + Använd bilden från inställningarna - Invert Color - Invertera Bilden + Invertera Bilden - + Check Firmware compatibility Kontrollera att firmware-filen är kompatibel - + Cancel Avbryt - + Write firmware to TX Skriv firmware till sändaren - Open - Öppna + Öppna - - + + - - + + Warning Varning - Burn anyway ! - Starta bränningen! + Starta bränningen! - Open Image to load - Öppna bilden som skall laddas + Öppna bilden som skall laddas - + Images (%1) Bilder (%1) - + - - - + + + + + + Error Fel - + Write Models and Settings to TX Skriv Modeller och Inställningar till sändaren @@ -7766,25 +8257,23 @@ m2560 för v4.1-kort Skriv Modeller och Inställningar från %1 till sändaren - + Choose file to load Models and Settings from Välj fil att ladda Modeller och Inställningar från - + Invalid binary Models and Settings File %1, Proceed anyway ? Ogiltig binärfil med Modeller och Inställningar: %1. Fortsätt i alla fall ? - - Cannot load %1. - Det går inte att ladda %1. + Det går inte att ladda %1. - + Cannot save customized firmware Det gick inte att spara den modifierade firmware-filen @@ -7794,12 +8283,12 @@ m2560 för v4.1-kort Bildfilen hittades inte - + No firmware selected Ingen firmware har valts - + Wrong radio calibration data in profile, Settings not patched Felaktig information i profilen, sändarens-kalibrering kunde inte läsas in @@ -7809,12 +8298,11 @@ m2560 för v4.1-kort Felaktig information i profilen, sändarens inställningar kunde inte läsas in - %1 is not a known firmware - %1 är inte en fimware-fil + %1 är inte en fimware-fil - + <html><head/><body><p>Modify calibration parameters using settings from current profile</p></body></html> <html><head/><body><p>Uppdatera kalibrerings-parametrarna med data från nuvarande profil</p></body></html> @@ -7834,8 +8322,8 @@ m2560 för v4.1-kort Uppdatera med HW-inställningar från profilen - - + + Browse for file Välj fil @@ -7850,12 +8338,42 @@ m2560 för v4.1-kort Nuvarande Profil - + + Use firmware start screen + Använd firmware-startskärmen + + + + Use another start screen + Använd en annan startskärm + + + + Use profile start screen + Använd profilens startskärm + + + + Use library start screen + Använd biblioteks-startskärm + + + Current profile Nuvarande profil - + + Open Firmware File + Öppna firmware-fil + + + + %1 may not be a valid firmware file + %1 är kanske inte en giltig firmware-fil + + + Unable to find file %1! Kan inte hitta filen %1 ! @@ -7876,7 +8394,37 @@ m2560 för v4.1-kort %2. - + + The firmware file is not valid. + Firmware-filen är inte giltig. + + + + There is no start screen image in the firmware file. + Firmware-filen innehåller inte någon startbild. + + + + The profile image %1 does not contain an image. + Profil-bilden %1 innehåller inte någon startbild. + + + + Open image file to use as Tx start screen + Öppna bildfil för användning som radions startsskärm + + + + Image could not be loaded from %1 + Det gick inte att ladda en bild från %1 + + + + The library image could not be loaded + Bild-biblioteket kunde inte öppnas + + + Cannot write file %1: %2. @@ -7891,7 +8439,7 @@ m2560 för v4.1-kort %2. - + Variant Variant @@ -7899,12 +8447,16 @@ m2560 för v4.1-kort compareDialog - Dialog - Dialog + Dialog - + + Compare Models + Jämför Modeller + + + Drag first model here Dra hit första modellen @@ -7929,7 +8481,7 @@ m2560 för v4.1-kort Skriv till fil - + General Model Settings Generella modell-inställningar @@ -8418,7 +8970,7 @@ m2560 för v4.1-kort Dialog - + People who have contributed to this project De som har bidragit till detta projekt @@ -8428,12 +8980,12 @@ m2560 för v4.1-kort Programmerare - + Companion Release Notes Companion Release Notes - + Thank you all !!! Tack till er alla !!! @@ -8448,7 +9000,7 @@ m2560 för v4.1-kort Bidragande - + OpenTX Release Notes OpenTX Release Notes @@ -8461,58 +9013,66 @@ m2560 för v4.1-kort Startbildsredigerare - - + + Invert Invertera - - + + Load FW Ladda FW - - + + Load Pict Ladda Bild - - + + Load Profile Ladda Profil - - + + Save Spara - - + + Open Splash Library Öppna bildbibliotek - Open - Öppna + Öppna - + - + Error Fel - Cannot load embedded FW image from %1. - Det gick inte att ladda bild från FW-filen %1. + Det gick inte att ladda bild från FW-filen %1. + + + + Open Firmware File + Öppna firmware-fil + + + + Can not load embedded image from firmware file %1. + Det gick inte att ladda bild från firmware-filen %1. @@ -8525,7 +9085,7 @@ m2560 för v4.1-kort Det gick inte att ladda profilbilden %1. - + Cannot load the library image %1. Det gick inte att ladda biblioteks-bilden %1. @@ -8564,7 +9124,7 @@ m2560 för v4.1-kort Det finns ingen bild att byta i firmware-filen - + Open Image to load Öppna bild för laddning @@ -8586,9 +9146,10 @@ m2560 för v4.1-kort Det gick inte att spara bilden i filen %1 - - - + + + + ... ... @@ -8601,7 +9162,7 @@ m2560 för v4.1-kort Nedladdning: - + Unable to save the file %1: %2. Kan ej spara filen %1: %2. @@ -8624,7 +9185,7 @@ m2560 för v4.1-kort Säkringar - + Read Fuses Läs in säkringarna @@ -8760,7 +9321,12 @@ p, li { white-space: pre-wrap; } fwPreferencesDialog - + + Downloads + Nedladdningar + + + @@ -8907,16 +9473,15 @@ Används av mallarna för att koppla ihop kanaler med numrerade utgångar.Skriv FW till Tx efter nedladdning - Downloads and Profiles - Nedladdning och Profiler + Nedladdning och Profiler Save Profile Spara Profil - + Menu Language Menyspråk @@ -8967,7 +9532,7 @@ Används av mallarna för att koppla ihop kanaler med numrerade utgångar.Sök efter uppdateringar - + Last downloaded release: %1 Senast nedladdade release: %1 @@ -9009,7 +9574,7 @@ Används av mallarna för att koppla ihop kanaler med numrerade utgångar. joystickDialog - + Configure Joystick Ställ in Joystick @@ -9158,7 +9723,7 @@ Används av mallarna för att koppla ihop kanaler med numrerade utgångar.OK - + Move sticks and pots in every direction making full movement Press next when finished Rör spakar och pottentiometrar. Ge fulla utslag. @@ -9209,7 +9774,7 @@ Tryck på Avbryt för att avburyta kalibreringen Dubblerad koppling av spak - + @@ -9241,7 +9806,7 @@ Tryck på Avbryt för att avburyta kalibreringen Companion Logg-läsare - + Filename Filnamn @@ -9251,7 +9816,7 @@ Tryck på Avbryt för att avburyta kalibreringen Öppna Loggfil - + Zoom Zoom @@ -9266,7 +9831,7 @@ Tryck på Avbryt för att avburyta kalibreringen Y - + Telemetry logs Telemetriloggar @@ -9276,7 +9841,7 @@ Tryck på Avbryt för att avburyta kalibreringen Tid - + Error Fel @@ -9288,7 +9853,7 @@ Tryck på Avbryt för att avburyta kalibreringen %2. - + Select your log file Välj loggfil @@ -9311,7 +9876,7 @@ Tryck på Avbryt för att avburyta kalibreringen mdiChild - + Simulate Tx Simulera sändare @@ -9324,7 +9889,7 @@ Tryck på Avbryt för att avburyta kalibreringen Guide för modellkonfiguaration - + Engine Motor @@ -9738,7 +10303,7 @@ Tryck på Avbryt för att avburyta kalibreringen Dubbla Sidoroder (med 2 servon) - + Apply configuration ? Tillämpa inställningarna? @@ -10155,62 +10720,48 @@ Mode 4: Firmware-info - Last downloaded release: %1 - Senast nedladdade release: %1 + Senast nedladdade release: %1 - - No joysticks found - Ingen joystick hittades + Ingen joystick hittades - Select your Models and Settings backup folder - Välj folder för automatisk säkerhetskopiering + Välj folder för automatisk säkerhetskopiering - Select Google Earth executable - Sökväg till Google Earth + Sökväg till Google Earth - Open Image to load - Öppna bild för laddning + Öppna bild för laddning - Images (%1) - Bilder (%1) + Bilder (%1) - - Error - Fel + Fel - The selected firmware has never been downloaded by Companion. - Firmware-filen har aldrig laddats ned av Companion. + Firmware-filen har aldrig laddats ned av Companion. - The selected firmware cannot be downloaded by Companion. - Firmware-filen kan inte laddas ned av Companion. + Firmware-filen kan inte laddas ned av Companion. - - Cannot load %1. - %1 kunde inte laddas. + %1 kunde inte laddas. - Image stored in settings - Bilden lagras i inställningar + Bilden lagras i inställningar @@ -10261,12 +10812,11 @@ Mode 4: säkerhetskopiera innan skrivning - Select your library folder - Välj bibliotekskatalog + Välj bibliotekskatalog - + Export Profile Exportera Profil @@ -10293,19 +10843,16 @@ May be different from firmware language Får skilja från språket för mjukvaran - Export profile As - Exportera profil som + Exportera profil som - Profile slot is not empty, profile slot %1 will we overwritten.<br>Are you sure ? - Det finns redan en profil i position %1,. Den kommer att skrivas över.<br> Är du säker ? + Det finns redan en profil i position %1,. Den kommer att skrivas över.<br> Är du säker ? - Open Profile to import - Öppna profil för import + Öppna profil för import @@ -10331,14 +10878,12 @@ Får skilja från språket för mjukvaran Använd bara clipboard - Select your snapshot folder - Välj katalog för snapshots + Välj katalog för snapshots - Profile name is empty, profile slot %1 will be deleted.<br>Are you sure ? - Profilnamn saknas, profilplats %1 kommer att raderas.<br> Är du säker? + Profilnamn saknas, profilplats %1 kommer att raderas.<br> Är du säker? @@ -10361,9 +10906,8 @@ Får skilja från språket för mjukvaran Sökväg till SD-struktur - Select the folder replicating your SD structure - Välj katalog som härmar din SD-struktur + Välj katalog som härmar din SD-struktur @@ -10374,7 +10918,7 @@ Får skilja från språket för mjukvaran Dialog - + Close Stäng @@ -10389,7 +10933,7 @@ Får skilja från språket för mjukvaran Skriv till fil - + Setup for: Inställningar för: @@ -10816,434 +11360,327 @@ Får skilja från språket för mjukvaran simulatorDialog - P1 - P1 + P1 - P2 - P2 + P2 - P3 - P3 + P3 - THR - GAS + GAS - RUD - ROD + ROD - ELE - HÖJ + HÖJ - AIL - SKE + SKE - - Hold X - Håll X + Håll X - - Fix X - Fixera X + Fixera X - - Fix Y - Fixera Y + Fixera Y - - Hold Y - Håll Y + Håll Y - - - - TextLabel - Textettikett + Textettikett - TRN - TRN + TRN - GEA - LAN + LAN - ID0 - ID0 + ID0 - ID1 - ID1 + ID1 - ID2 - ID2 + ID2 - BEEP - Summer + Summer - - - - Right Double Click to Reset - Höger dubbelklick nollställer + Höger dubbelklick nollställer - Companion Simulator - Companion Simulator + Companion Simulator - 9x Simulator - Simulator för 9x + Simulator för 9x - Outputs - Utgångar + Utgångar - LS1 - LB1 + LB1 - LS2 - LB2 + LB2 - LS3 - LB3 + LB3 - LS4 - LB4 + LB4 - LS5 - LB5 + LB5 - LS6 - LB6 + LB6 - LS7 - LB7 + LB7 - LS8 - LB8 + LB8 - LS9 - LB9 + LB9 - LSA - LBA + LBA - LSB - LBB + LBB - LSC - LBC + LBC - LSD - LBD + LBD - LSE - LBE + LBE - LSF - LBF + LBF - LSG - LBG + LBG - LSH - LBH + LBH - LSI - LBI + LBI - LSJ - LBJ + LBJ - LSK - LBK + LBK - LSL - LBL + LBL - LSM - LBM + LBM - LSN - LBN + LBN - LSO - LBO + LBO - LSP - LBP + LBP - LSQ - LBQ + LBQ - LSR - LBR + LBR - LSS - LBS + LBS - LST - LBT + LBT - LSU - LBU + LBU - LSV - LBV + LBV - LSW - LBW + LBW - CH1 - KN1 + KN1 - CH9 - KN9 + KN9 - CH2 - KN2 + KN2 - CH10 - KN10 + KN10 - CH3 - KN3 + KN3 - CH11 - KN11 + KN11 - CH4 - KN4 + KN4 - CH12 - KN12 + KN12 - CH5 - KN5 + KN5 - CH13 - KN13 + KN13 - CH6 - KN6 + KN6 - CH14 - KN14 + KN14 - CH7 - KN7 + KN7 - CH15 - KN15 + KN15 - CH8 - KN8 + KN8 - CH16 - KN16 + KN16 - - - - - - - - - - - - - - - - -100.1 - -100.1 + -100.1 - - Warning - Varning + Varning - Joystick enabled but not configured correctly - Joysticken påslagen, men ej rätt inställd + Joysticken påslagen, men ej rätt inställd - Cannot open joystick, joystick disabled - Joysticken kan inte hittas. Joysticken stängs av + Joysticken kan inte hittas. Joysticken stängs av - Firmware %1 error: %2 - Firmware %1 fel: %2 + Firmware %1 fel: %2 - Simulating Tx (%1) - Simulerar sändare (%1) + Simulerar sändare (%1) - Simulating - Simulerar + Simulerar - - - 0 % - 0 % + 0 % - - Flight mode: %1(%2) - - Fligmod: %1(%2) + - Fligmod: %1(%2) splashLibrary - - + + ... ... @@ -11253,7 +11690,7 @@ Får skilja från språket för mjukvaran Bildbibliotek - Sida %1 av %2 - + Warning Varning @@ -11276,428 +11713,312 @@ Får skilja från språket för mjukvaran xsimulatorDialog - - SE - SE + SE - - SA - SA + SA - - SB - SB + SB - - - - Right Double Click to Reset - Höger dubbelklick nollställer + Höger dubbelklick nollställer - - - - TextLabel - Textettikett + Textettikett - - Hold X - Håll X + Håll X - - Fix X - Fixera X + Fixera X - - Fix Y - Fixera Y + Fixera Y - - Hold Y - Håll Y + Håll Y - - SH - SH + SH - - SG - SG + SG - Companion Simulator - Companion Simulator + Companion Simulator - - SD - SD + SD - - SC - SC + SC - Outputs - Utgångar + Utgångar - CH1 - KN1 + KN1 - - - - - - - - - - - - - - - - -100.1 - -100.1 + -100.1 - CH9 - KN9 + KN9 - CH2 - KN2 + KN2 - CH10 - KN10 + KN10 - CH3 - KN3 + KN3 - CH11 - KN11 + KN11 - CH4 - KN4 + KN4 - CH12 - KN12 + KN12 - CH5 - KN5 + KN5 - CH13 - KN13 + KN13 - CH6 - KN6 + KN6 - CH14 - KN14 + KN14 - CH7 - KN7 + KN7 - CH15 - KN15 + KN15 - CH8 - KN8 + KN8 - CH16 - KN16 + KN16 - LSK - LBK + LBK - LSC - LBC + LBC - LSD - LBD + LBD - LS7 - LB7 + LB7 - LSL - LBL + LBL - LSB - LBB + LBB - LS1 - LB1 + LB1 - LSH - LBH + LBH - LSG - LBG + LBG - LSE - LBE + LBE - LSF - LBF + LBF - LS8 - LB8 + LB8 - LS9 - LB9 + LB9 - LSA - LBA + LBA - LSM - LBM + LBM - LSJ - LBJ + LBJ - LSI - LBI + LBI - LS4 - LB4 + LB4 - LS5 - LB5 + LB5 - LS2 - LB2 + LB2 - LS3 - LB3 + LB3 - LS6 - LB6 + LB6 - LSN - LBN + LBN - LSO - LBO + LBO - LSP - LBP + LBP - LSQ - LBQ + LBQ - LSR - LBR + LBR - LSS - LBS + LBS - LST - LBT + LBT - LSU - LBU + LBU - LSV - LBV + LBV - LSW - LBW + LBW - - Warning - Varning + Varning - Joystick enabled but not configured correctly - Joysticken påslagen, men ej rätt inställd + Joysticken påslagen, men ej rätt inställd - Cannot open joystick, joystick disabled - Joysticken kan inte hittas. Joysticken stängs av + Joysticken kan inte hittas. Joysticken stängs av - Firmware %1 error: %2 - Firmware %1 fel: %2 + Firmware %1 fel: %2 - Simulating Tx (%1) - Simulerar sändare (%1) + Simulerar sändare (%1) - Simulating - Simulerar + Simulerar - - - SF - SF + SF - - S2 - S2 + S2 - - RS - RS + RS - - S1 - S1 + S1 - - LS - LS + LS - Taranis Simulator - Taranissimulator + Taranissimulator - - Flight mode: %1(%2) - - Fligmod: %1(%2) + - Fligmod: %1(%2) diff --git a/companion/src/warnings.h b/companion/src/warnings.h index c8fb4753e..d322e36a5 100644 --- a/companion/src/warnings.h +++ b/companion/src/warnings.h @@ -1,8 +1,8 @@ #ifndef WARNINGS_H -#define WARNINGS_H +#define WARNINGS_H #define WARNING_LEVEL 0 #define WARNING_ID 6 #define WARNING QObject::tr("Thanks all for the donations, kind messages, nice ideas, constructive proposals etc. for the next OpenTX/Companion funding model.\n\nWe are really appreciative for that!\n\nThe OpenTX/Companion Team.") -#endif /* WARNINGS_H */ +#endif /* WARNINGS_H */ diff --git a/radio/src/.gitignore b/radio/src/.gitignore index c58685a26..9bff2bce9 100644 --- a/radio/src/.gitignore +++ b/radio/src/.gitignore @@ -1,7 +1,6 @@ /stamp-opentx.h /opentx.elf /simu -/opentx.hex /opentx.map /simu.d /snapshot_*.png @@ -10,6 +9,7 @@ /*.o /*.bin /*.bin.* +/*.hex /*.lst /SCRIPTS /TEMPLATES diff --git a/radio/src/audio_arm.cpp b/radio/src/audio_arm.cpp index 5d2fb1be9..9f5b07289 100644 --- a/radio/src/audio_arm.cpp +++ b/radio/src/audio_arm.cpp @@ -41,24 +41,111 @@ extern OS_MutexID audioMutex; const int16_t sineValues[] = { - 0, 64, 128, 191, 254, 316, 376, 435, 493, 548, - 601, 652, 700, 746, 789, 828, 864, 897, 926, 952, - 973, 991, 1005, 1015, 1021, 1024, 1021, 1015, 1005, 991, - 973, 952, 926, 897, 864, 828, 789, 746, 700, 652, - 601, 548, 493, 435, 376, 316, 254, 191, 128, 64, - 0, -64, -128, -191, -254, -316, -376, -435, -493, -548, - -601, -652, -700, -746, -789, -828, -864, -897, -926, -952, - -973, -991, -1005, -1015, -1021, -1024, -1021, -1015, -1005, -991, - -973, -952, -926, -897, -864, -828, -789, -746, -700, -652, - -601, -548, -493, -435, -376, -316, -254, -191, -128, -64, + 0, 196, 392, 588, 784, 980, 1175, 1370, 1564, 1758, + 1951, 2143, 2335, 2525, 2715, 2904, 3091, 3278, 3463, 3647, + 3829, 4011, 4190, 4369, 4545, 4720, 4894, 5065, 5235, 5403, + 5569, 5733, 5895, 6055, 6213, 6369, 6522, 6673, 6822, 6969, + 7113, 7255, 7395, 7532, 7667, 7799, 7929, 8056, 8180, 8302, + 8422, 8539, 8653, 8765, 8874, 8980, 9084, 9185, 9283, 9379, + 9472, 9562, 9650, 9735, 9818, 9898, 9975, 10050, 10123, 10192, + 10260, 10324, 10387, 10447, 10504, 10559, 10612, 10663, 10711, 10757, + 10801, 10843, 10882, 10920, 10955, 10989, 11020, 11050, 11078, 11104, + 11128, 11151, 11172, 11191, 11209, 11225, 11240, 11254, 11266, 11277, + 11287, 11296, 11303, 11310, 11316, 11320, 11324, 11327, 11330, 11331, + 11332, 11333, 11333, 11333, 11332, 11331, 11329, 11328, 11326, 11324, + 11323, 11321, 11319, 11318, 11316, 11315, 11314, 11313, 11313, 11313, + 11314, 11315, 11317, 11319, 11323, 11326, 11331, 11336, 11342, 11349, + 11356, 11365, 11375, 11385, 11397, 11409, 11423, 11437, 11453, 11470, + 11488, 11507, 11527, 11548, 11571, 11595, 11620, 11646, 11673, 11702, + 11732, 11763, 11795, 11828, 11863, 11899, 11936, 11974, 12013, 12054, + 12095, 12138, 12182, 12227, 12273, 12320, 12368, 12417, 12467, 12518, + 12570, 12623, 12676, 12731, 12786, 12842, 12898, 12956, 13014, 13072, + 13131, 13191, 13251, 13311, 13372, 13433, 13495, 13556, 13618, 13680, + 13743, 13805, 13867, 13929, 13991, 14053, 14115, 14177, 14238, 14299, + 14359, 14419, 14479, 14538, 14597, 14655, 14712, 14768, 14824, 14879, + 14933, 14986, 15039, 15090, 15140, 15189, 15237, 15284, 15330, 15375, + 15418, 15460, 15500, 15539, 15577, 15614, 15648, 15682, 15714, 15744, + 15772, 15799, 15825, 15849, 15871, 15891, 15910, 15927, 15942, 15955, + 15967, 15977, 15985, 15991, 15996, 15999, 16000, 15999, 15996, 15991, + 15985, 15977, 15967, 15955, 15942, 15927, 15910, 15891, 15871, 15849, + 15825, 15799, 15772, 15744, 15714, 15682, 15648, 15614, 15577, 15539, + 15500, 15460, 15418, 15375, 15330, 15284, 15237, 15189, 15140, 15090, + 15039, 14986, 14933, 14879, 14824, 14768, 14712, 14655, 14597, 14538, + 14479, 14419, 14359, 14299, 14238, 14177, 14115, 14053, 13991, 13929, + 13867, 13805, 13743, 13680, 13618, 13556, 13495, 13433, 13372, 13311, + 13251, 13191, 13131, 13072, 13014, 12956, 12898, 12842, 12786, 12731, + 12676, 12623, 12570, 12518, 12467, 12417, 12368, 12320, 12273, 12227, + 12182, 12138, 12095, 12054, 12013, 11974, 11936, 11899, 11863, 11828, + 11795, 11763, 11732, 11702, 11673, 11646, 11620, 11595, 11571, 11548, + 11527, 11507, 11488, 11470, 11453, 11437, 11423, 11409, 11397, 11385, + 11375, 11365, 11356, 11349, 11342, 11336, 11331, 11326, 11323, 11319, + 11317, 11315, 11314, 11313, 11313, 11313, 11314, 11315, 11316, 11318, + 11319, 11321, 11323, 11324, 11326, 11328, 11329, 11331, 11332, 11333, + 11333, 11333, 11332, 11331, 11330, 11327, 11324, 11320, 11316, 11310, + 11303, 11296, 11287, 11277, 11266, 11254, 11240, 11225, 11209, 11191, + 11172, 11151, 11128, 11104, 11078, 11050, 11020, 10989, 10955, 10920, + 10882, 10843, 10801, 10757, 10711, 10663, 10612, 10559, 10504, 10447, + 10387, 10324, 10260, 10192, 10123, 10050, 9975, 9898, 9818, 9735, + 9650, 9562, 9472, 9379, 9283, 9185, 9084, 8980, 8874, 8765, + 8653, 8539, 8422, 8302, 8180, 8056, 7929, 7799, 7667, 7532, + 7395, 7255, 7113, 6969, 6822, 6673, 6522, 6369, 6213, 6055, + 5895, 5733, 5569, 5403, 5235, 5065, 4894, 4720, 4545, 4369, + 4190, 4011, 3829, 3647, 3463, 3278, 3091, 2904, 2715, 2525, + 2335, 2143, 1951, 1758, 1564, 1370, 1175, 980, 784, 588, + 392, 196, 0, -196, -392, -588, -784, -980, -1175, -1370, + -1564, -1758, -1951, -2143, -2335, -2525, -2715, -2904, -3091, -3278, + -3463, -3647, -3829, -4011, -4190, -4369, -4545, -4720, -4894, -5065, + -5235, -5403, -5569, -5733, -5895, -6055, -6213, -6369, -6522, -6673, + -6822, -6969, -7113, -7255, -7395, -7532, -7667, -7799, -7929, -8056, + -8180, -8302, -8422, -8539, -8653, -8765, -8874, -8980, -9084, -9185, + -9283, -9379, -9472, -9562, -9650, -9735, -9818, -9898, -9975, -10050, + -10123, -10192, -10260, -10324, -10387, -10447, -10504, -10559, -10612, -10663, + -10711, -10757, -10801, -10843, -10882, -10920, -10955, -10989, -11020, -11050, + -11078, -11104, -11128, -11151, -11172, -11191, -11209, -11225, -11240, -11254, + -11266, -11277, -11287, -11296, -11303, -11310, -11316, -11320, -11324, -11327, + -11330, -11331, -11332, -11333, -11333, -11333, -11332, -11331, -11329, -11328, + -11326, -11324, -11323, -11321, -11319, -11318, -11316, -11315, -11314, -11313, + -11313, -11313, -11314, -11315, -11317, -11319, -11323, -11326, -11331, -11336, + -11342, -11349, -11356, -11365, -11375, -11385, -11397, -11409, -11423, -11437, + -11453, -11470, -11488, -11507, -11527, -11548, -11571, -11595, -11620, -11646, + -11673, -11702, -11732, -11763, -11795, -11828, -11863, -11899, -11936, -11974, + -12013, -12054, -12095, -12138, -12182, -12227, -12273, -12320, -12368, -12417, + -12467, -12518, -12570, -12623, -12676, -12731, -12786, -12842, -12898, -12956, + -13014, -13072, -13131, -13191, -13251, -13311, -13372, -13433, -13495, -13556, + -13618, -13680, -13743, -13805, -13867, -13929, -13991, -14053, -14115, -14177, + -14238, -14299, -14359, -14419, -14479, -14538, -14597, -14655, -14712, -14768, + -14824, -14879, -14933, -14986, -15039, -15090, -15140, -15189, -15237, -15284, + -15330, -15375, -15418, -15460, -15500, -15539, -15577, -15614, -15648, -15682, + -15714, -15744, -15772, -15799, -15825, -15849, -15871, -15891, -15910, -15927, + -15942, -15955, -15967, -15977, -15985, -15991, -15996, -15999, -16000, -15999, + -15996, -15991, -15985, -15977, -15967, -15955, -15942, -15927, -15910, -15891, + -15871, -15849, -15825, -15799, -15772, -15744, -15714, -15682, -15648, -15614, + -15577, -15539, -15500, -15460, -15418, -15375, -15330, -15284, -15237, -15189, + -15140, -15090, -15039, -14986, -14933, -14879, -14824, -14768, -14712, -14655, + -14597, -14538, -14479, -14419, -14359, -14299, -14238, -14177, -14115, -14053, + -13991, -13929, -13867, -13805, -13743, -13680, -13618, -13556, -13495, -13433, + -13372, -13311, -13251, -13191, -13131, -13072, -13014, -12956, -12898, -12842, + -12786, -12731, -12676, -12623, -12570, -12518, -12467, -12417, -12368, -12320, + -12273, -12227, -12182, -12138, -12095, -12054, -12013, -11974, -11936, -11899, + -11863, -11828, -11795, -11763, -11732, -11702, -11673, -11646, -11620, -11595, + -11571, -11548, -11527, -11507, -11488, -11470, -11453, -11437, -11423, -11409, + -11397, -11385, -11375, -11365, -11356, -11349, -11342, -11336, -11331, -11326, + -11323, -11319, -11317, -11315, -11314, -11313, -11313, -11313, -11314, -11315, + -11316, -11318, -11319, -11321, -11323, -11324, -11326, -11328, -11329, -11331, + -11332, -11333, -11333, -11333, -11332, -11331, -11330, -11327, -11324, -11320, + -11316, -11310, -11303, -11296, -11287, -11277, -11266, -11254, -11240, -11225, + -11209, -11191, -11172, -11151, -11128, -11104, -11078, -11050, -11020, -10989, + -10955, -10920, -10882, -10843, -10801, -10757, -10711, -10663, -10612, -10559, + -10504, -10447, -10387, -10324, -10260, -10192, -10123, -10050, -9975, -9898, + -9818, -9735, -9650, -9562, -9472, -9379, -9283, -9185, -9084, -8980, + -8874, -8765, -8653, -8539, -8422, -8302, -8180, -8056, -7929, -7799, + -7667, -7532, -7395, -7255, -7113, -6969, -6822, -6673, -6522, -6369, + -6213, -6055, -5895, -5733, -5569, -5403, -5235, -5065, -4894, -4720, + -4545, -4369, -4190, -4011, -3829, -3647, -3463, -3278, -3091, -2904, + -2715, -2525, -2335, -2143, -1951, -1758, -1564, -1370, -1175, -980, + -784, -588, -392, -196, }; -#if 1 - const unsigned int toneVolumes[] = { 2, 4, 8, 12, 16 }; -#else - const unsigned int toneVolumes[] = { 4000, 8000, 16000, 24000, 32000 }; -#endif - #if defined(SDCARD) const char * audioFilenames[] = { "tada", @@ -117,180 +204,261 @@ const char * audioFilenames[] = { }; uint64_t sdAvailableSystemAudioFiles = 0; -uint8_t sdAvailablePhaseAudioFiles[MAX_PHASES] = { 0 }; -uint8_t sdAvailableMixerAudioFiles[MAX_MIXERS] = { 0 }; +uint32_t sdAvailablePhaseAudioFiles = 0; +uint64_t sdAvailableSwitchAudioFiles = 0; +uint64_t sdAvailableLogicalSwitchAudioFiles = 0; -void refreshSystemAudioFiles() +#define MASK_SYSTEM_AUDIO_FILE(index) ((uint64_t)1 << index) +#define MASK_PHASE_AUDIO_FILE(index, event) ((uint32_t)1 << (2*index+event)) +#define MASK_SWITCH_AUDIO_FILE(index) ((uint64_t)1 << index) +#define MASK_LOGICAL_SWITCH_AUDIO_FILE(index, event) ((uint64_t)1 << (2*index+event)) + +bool isFileAvailable(const char * filename) { FILINFO info; -#if _USE_LFN TCHAR lfn[_MAX_LFN + 1]; info.lfname = lfn; info.lfsize = sizeof(lfn); -#endif + return f_stat(filename, &info) == FR_OK; +} - char filename[32] = SYSTEM_SOUNDS_PATH "/"; - strncpy(filename+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2); +char * getAudioPath(char * path) +{ + strcpy(path, SOUNDS_PATH "/"); + strncpy(path+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2); + return path + sizeof(SOUNDS_PATH); +} + +char * getSystemAudioPath(char * path) +{ + char * str = getAudioPath(path); + strcpy(str, SYSTEM_SUBDIR "/"); + return str + sizeof(SYSTEM_SUBDIR); +} + +void getSystemAudioFile(char * filename, int index) +{ + char * str = getSystemAudioPath(filename); + strcpy(str, audioFilenames[index]); + strcat(str, SOUNDS_EXT); +} + +void referenceSystemAudioFiles() +{ + char path[AUDIO_FILENAME_MAXLEN+1]; + FILINFO fno; + DIR dir; + char *fn; /* This function is assuming non-Unicode cfg. */ + TCHAR lfn[_MAX_LFN + 1]; + fno.lfname = lfn; + fno.lfsize = sizeof(lfn); + + uint64_t availableAudioFiles = 0; assert(sizeof(audioFilenames)==AU_FRSKY_FIRST*sizeof(char *)); assert(sizeof(sdAvailableSystemAudioFiles)*8 >= AU_FRSKY_FIRST); - uint64_t availableAudioFiles = 0; + char * filename = getSystemAudioPath(path); + *(filename-1) = '\0'; - for (uint32_t i=0; iid, 2); + char * result = strcat_modelname(path+sizeof(SOUNDS_PATH), g_eeGeneral.currModel); + *result++ = '/'; + *result = '\0'; return result; } -void refreshModelAudioFiles() +void getPhaseAudioFile(char * filename, int index, unsigned int event) { - FILINFO info; + char * str = getModelPath(filename); + char * tmp = strcat_phasename(str, index); + strcpy(tmp, suffixes[event]); + strcat(tmp, SOUNDS_EXT); + } + +void getSwitchAudioFile(char * filename, int index) +{ + char * str = getModelPath(filename); + int len = STR_VSWITCHES[0]; + strncpy(str, &STR_VSWITCHES[1+len*index], len); + str += len-1; + if (*str == '\300') { + strcpy(str, "-up"); + str += 3; +} + else if (*str == '-') { + strcpy(str, "-mid"); + str += 4; + } + else if (*str == '\301') { + strcpy(str, "-down"); + str += 5; + } + else { + str += 1; + } + strcat(str, SOUNDS_EXT); +} + +void getLogicalSwitchAudioFile(char * filename, int index, unsigned int event) +{ + char * str = getModelPath(filename); + int len = STR_VSWITCHES[0]; + strncpy(str, &STR_VSWITCHES[1+len*(index+SWSRC_FIRST_CSW-1)], len); + str += len; + strcpy(str, suffixes[event]); + strcat(str, SOUNDS_EXT); +} + +void referenceModelAudioFiles() +{ + char path[AUDIO_FILENAME_MAXLEN+1]; + FILINFO fno; + DIR dir; + char *fn; /* This function is assuming non-Unicode cfg. */ TCHAR lfn[_MAX_LFN + 1]; - info.lfname = lfn; - info.lfsize = sizeof(lfn); + fno.lfname = lfn; + fno.lfsize = sizeof(lfn); - char filename[AUDIO_FILENAME_MAXLEN+1] = SOUNDS_PATH "/"; - strncpy(filename+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2); + sdAvailablePhaseAudioFiles = 0; + sdAvailableSwitchAudioFiles = 0; + sdAvailableLogicalSwitchAudioFiles = 0; - if (sdMounted()) { - char *buf = strcat_modelname(&filename[sizeof(SOUNDS_PATH)], g_eeGeneral.currModel); - *buf++ = '/'; + char * filename = getModelPath(path); + *(filename-1) = '\0'; - for (uint32_t i=0; i-[on|off].wav + for (int i=0; i-[up|mid|down].wav + for (int i=0; i-[on|off].wav + for (int i=0; i> 24); uint8_t index = (i >> 16) & 0xFF; uint8_t event = i & 0xFF; #if 0 - printf("isAudioFileAvailable(%08x)\n", i); fflush(stdout); + printf("isAudioFileReferenced(%08x)\n", i); fflush(stdout); #endif if (category == SYSTEM_AUDIO_CATEGORY) { - if (sdAvailableSystemAudioFiles & ((uint64_t)1 << event)) { - strcpy(filename, SYSTEM_SOUNDS_PATH "/"); - strncpy(filename+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2); - strcpy(filename+sizeof(SYSTEM_SOUNDS_PATH), audioFilenames[i]); - strcat(filename+sizeof(SYSTEM_SOUNDS_PATH), SOUNDS_EXT); + if (sdAvailableSystemAudioFiles & MASK_SYSTEM_AUDIO_FILE(event)) { + getSystemAudioFile(filename, event); return true; } } else if (category == PHASE_AUDIO_CATEGORY) { - if (sdAvailablePhaseAudioFiles[index] & ((uint32_t)1 << event)) { - strcpy(filename, SOUNDS_PATH "/"); - strncpy(filename+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2); - char *str = strcat_modelname(filename+sizeof(SOUNDS_PATH), g_eeGeneral.currModel); - *str++ = '/'; - char * tmp = strcat_phasename(str, index); - if (tmp != str) { - strcpy(tmp, suffixes[event]); - strcat(tmp, SOUNDS_EXT); + if (sdAvailablePhaseAudioFiles & MASK_PHASE_AUDIO_FILE(index, event)) { + getPhaseAudioFile(filename, index, event); return true; } } + else if (category == SWITCH_AUDIO_CATEGORY) { + if (sdAvailableSwitchAudioFiles & MASK_SWITCH_AUDIO_FILE(index)) { + getSwitchAudioFile(filename, index); + return true; } - else if (category == MIXER_AUDIO_CATEGORY) { - if (sdAvailableMixerAudioFiles[index] & ((uint32_t)1 << event)) { - strcpy(filename, SOUNDS_PATH "/"); - strncpy(filename+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2); - char *str = strcat_modelname(filename+sizeof(SOUNDS_PATH), g_eeGeneral.currModel); - *str++ = '/'; - char * tmp = strcat_mixername(str, index); - if (tmp != str) { - strcpy(tmp, suffixes[event]); - strcat(tmp, SOUNDS_EXT); + } + else if (category == LOGICAL_SWITCH_AUDIO_CATEGORY) { + if (sdAvailableLogicalSwitchAudioFiles & MASK_LOGICAL_SWITCH_AUDIO_FILE(index, event)) { + getLogicalSwitchAudioFile(filename, index, event); return true; } } - } return false; } -#else -#define isAudioFileAvailable(i, f) false -#endif -int16_t alawTable[256]; -int16_t ulawTable[256]; +tmr10ms_t timeAutomaticPromptsSilence = 0; -#define SIGN_BIT (0x80) /* Sign bit for a A-law byte. */ -#define QUANT_MASK (0xf) /* Quantization field mask. */ -#define SEG_SHIFT (4) /* Left shift for segment number. */ -#define SEG_MASK (0x70) /* Segment field mask. */ -#define BIAS (0x84) /* Bias for linear code. */ - -static short alaw2linear(unsigned char a_val) +void playModelEvent(uint8_t category, uint8_t index, uint8_t event) { - int t; - int seg; - - a_val ^= 0x55; - - t = a_val & QUANT_MASK; - seg = ((unsigned)a_val & SEG_MASK) >> SEG_SHIFT; - if(seg) t= (t + t + 1 + 32) << (seg + 2); - else t= (t + t + 1 ) << 3; - - return (a_val & SIGN_BIT) ? t : -t; -} - -static short ulaw2linear(unsigned char u_val) -{ - int t; - - /* Complement to obtain normal u-law value. */ - u_val = ~u_val; - - /* - * Extract and bias the quantization bits. Then - * shift up by the segment number and subtract out the bias. - */ - t = ((u_val & QUANT_MASK) << 3) + BIAS; - t <<= ((unsigned)u_val & SEG_MASK) >> SEG_SHIFT; - - return (u_val & SIGN_BIT) ? (BIAS - t) : (t - BIAS); -} - -void codecsInit() -{ - for (uint32_t i=0; i<256; i++) { - alawTable[i] = alaw2linear(i); - ulawTable[i] = ulaw2linear(i); + char filename[AUDIO_FILENAME_MAXLEN+1]; + if ((get_tmr10ms()-timeAutomaticPromptsSilence > 50) && isAudioFileReferenced((category << 24) + (index << 16) + event, filename)) { + audioQueue.playFile(filename); } } +#else + +#define isAudioFileReferenced(i, f) false + +#endif + +const int16_t alawTable[256] = { -5504, -5248, -6016, -5760, -4480, -4224, -4992, -4736, -7552, -7296, -8064, -7808, -6528, -6272, -7040, -6784, -2752, -2624, -3008, -2880, -2240, -2112, -2496, -2368, -3776, -3648, -4032, -3904, -3264, -3136, -3520, -3392, -22016, -20992, -24064, -23040, -17920, -16896, -19968, -18944, -30208, -29184, -32256, -31232, -26112, -25088, -28160, -27136, -11008, -10496, -12032, -11520, -8960, -8448, -9984, -9472, -15104, -14592, -16128, -15616, -13056, -12544, -14080, -13568, -344, -328, -376, -360, -280, -264, -312, -296, -472, -456, -504, -488, -408, -392, -440, -424, -88, -72, -120, -104, -24, -8, -56, -40, -216, -200, -248, -232, -152, -136, -184, -168, -1376, -1312, -1504, -1440, -1120, -1056, -1248, -1184, -1888, -1824, -2016, -1952, -1632, -1568, -1760, -1696, -688, -656, -752, -720, -560, -528, -624, -592, -944, -912, -1008, -976, -816, -784, -880, -848, 5504, 5248, 6016, 5760, 4480, 4224, 4992, 4736, 7552, 7296, 8064, 7808, 6528, 6272, 7040, 6784, 2752, 2624, 3008, 2880, 2240, 2112, 2496, 2368, 3776, 3648, 4032, 3904, 3264, 3136, 3520, 3392, 22016, 20992, 24064, 23040, 17920, 16896, 19968, 18944, 30208, 29184, 32256, 31232, 26112, 25088, 28160, 27136, 11008, 10496, 12032, 11520, 8960, 8448, 9984, 9472, 15104, 14592, 16128, 15616, 13056, 12544, 14080, 13568, 344, 328, 376, 360, 280, 264, 312, 296, 472, 456, 504, 488, 408, 392, 440, 424, 88, 72, 120, 104, 24, 8, 56, 40, 216, 200, 248, 232, 152, 136, 184, 168, 1376, 1312, 1504, 1440, 1120, 1056, 1248, 1184, 1888, 1824, 2016, 1952, 1632, 1568, 1760, 1696, 688, 656, 752, 720, 560, 528, 624, 592, 944, 912, 1008, 976, 816, 784, 880, 848 }; +const int16_t ulawTable[256] = { -32124, -31100, -30076, -29052, -28028, -27004, -25980, -24956, -23932, -22908, -21884, -20860, -19836, -18812, -17788, -16764, -15996, -15484, -14972, -14460, -13948, -13436, -12924, -12412, -11900, -11388, -10876, -10364, -9852, -9340, -8828, -8316, -7932, -7676, -7420, -7164, -6908, -6652, -6396, -6140, -5884, -5628, -5372, -5116, -4860, -4604, -4348, -4092, -3900, -3772, -3644, -3516, -3388, -3260, -3132, -3004, -2876, -2748, -2620, -2492, -2364, -2236, -2108, -1980, -1884, -1820, -1756, -1692, -1628, -1564, -1500, -1436, -1372, -1308, -1244, -1180, -1116, -1052, -988, -924, -876, -844, -812, -780, -748, -716, -684, -652, -620, -588, -556, -524, -492, -460, -428, -396, -372, -356, -340, -324, -308, -292, -276, -260, -244, -228, -212, -196, -180, -164, -148, -132, -120, -112, -104, -96, -88, -80, -72, -64, -56, -48, -40, -32, -24, -16, -8, 0, 32124, 31100, 30076, 29052, 28028, 27004, 25980, 24956, 23932, 22908, 21884, 20860, 19836, 18812, 17788, 16764, 15996, 15484, 14972, 14460, 13948, 13436, 12924, 12412, 11900, 11388, 10876, 10364, 9852, 9340, 8828, 8316, 7932, 7676, 7420, 7164, 6908, 6652, 6396, 6140, 5884, 5628, 5372, 5116, 4860, 4604, 4348, 4092, 3900, 3772, 3644, 3516, 3388, 3260, 3132, 3004, 2876, 2748, 2620, 2492, 2364, 2236, 2108, 1980, 1884, 1820, 1756, 1692, 1628, 1564, 1500, 1436, 1372, 1308, 1244, 1180, 1116, 1052, 988, 924, 876, 844, 812, 780, 748, 716, 684, 652, 620, 588, 556, 524, 492, 460, 428, 396, 372, 356, 340, 324, 308, 292, 276, 260, 244, 228, 212, 196, 180, 164, 148, 132, 120, 112, 104, 96, 88, 80, 72, 64, 56, 48, 40, 32, 24, 16, 8, 0 }; AudioQueue audioQueue; @@ -320,7 +488,6 @@ void audioTask(void* pdata) #if defined(SDCARD) if (!unexpectedShutdown) { - codecsInit(); sdInit(); AUDIO_TADA(); } @@ -348,7 +515,7 @@ void AudioQueue::pushBuffer(AudioBuffer *buffer) __enable_irq(); } -void mix(uint16_t * result, int sample, unsigned int fade) +void mixSample(uint16_t * result, int sample, unsigned int fade) { *result = limit(0, *result + ((sample >> fade) >> 4), 4095); } @@ -358,42 +525,41 @@ void mix(uint16_t * result, int sample, unsigned int fade) #define RIFF_CHUNK_SIZE 12 uint8_t wavBuffer[AUDIO_BUFFER_SIZE*2]; -int AudioQueue::mixWav(AudioContext &context, AudioBuffer *buffer, int volume, unsigned int fade) +int WavContext::mixBuffer(AudioBuffer *buffer, int volume, unsigned int fade) { FRESULT result = FR_OK; UINT read = 0; - AudioFragment & fragment = context.fragment; if (fragment.file[1]) { - result = f_open(&context.state.wav.file, fragment.file, FA_OPEN_EXISTING | FA_READ); + result = f_open(&state.file, fragment.file, FA_OPEN_EXISTING | FA_READ); fragment.file[1] = 0; if (result == FR_OK) { - result = f_read(&context.state.wav.file, wavBuffer, RIFF_CHUNK_SIZE+8, &read); + result = f_read(&state.file, wavBuffer, RIFF_CHUNK_SIZE+8, &read); if (result == FR_OK && read == RIFF_CHUNK_SIZE+8 && !memcmp(wavBuffer, "RIFF", 4) && !memcmp(wavBuffer+8, "WAVEfmt ", 8)) { uint32_t size = *((uint32_t *)(wavBuffer+16)); - result = (size < 256 ? f_read(&context.state.wav.file, wavBuffer, size+8, &read) : FR_DENIED); + result = (size < 256 ? f_read(&state.file, wavBuffer, size+8, &read) : FR_DENIED); if (result == FR_OK && read == size+8) { - context.state.wav.codec = ((uint16_t *)wavBuffer)[0]; - context.state.wav.freq = ((uint16_t *)wavBuffer)[2]; + state.codec = ((uint16_t *)wavBuffer)[0]; + state.freq = ((uint16_t *)wavBuffer)[2]; uint32_t *wavSamplesPtr = (uint32_t *)(wavBuffer + size); uint32_t size = wavSamplesPtr[1]; - if (context.state.wav.freq != 0 && context.state.wav.freq * (AUDIO_SAMPLE_RATE / context.state.wav.freq) == AUDIO_SAMPLE_RATE) { - context.state.wav.resampleRatio = (AUDIO_SAMPLE_RATE / context.state.wav.freq); - context.state.wav.readSize = (context.state.wav.codec == CODEC_ID_PCM_S16LE ? 2*AUDIO_BUFFER_SIZE : AUDIO_BUFFER_SIZE) / context.state.wav.resampleRatio; + if (state.freq != 0 && state.freq * (AUDIO_SAMPLE_RATE / state.freq) == AUDIO_SAMPLE_RATE) { + state.resampleRatio = (AUDIO_SAMPLE_RATE / state.freq); + state.readSize = (state.codec == CODEC_ID_PCM_S16LE ? 2*AUDIO_BUFFER_SIZE : AUDIO_BUFFER_SIZE) / state.resampleRatio; } else { result = FR_DENIED; } while (result == FR_OK && memcmp(wavSamplesPtr, "data", 4) != 0) { - result = f_lseek(&context.state.wav.file, f_tell(&context.state.wav.file)+size); + result = f_lseek(&state.file, f_tell(&state.file)+size); if (result == FR_OK) { - result = f_read(&context.state.wav.file, wavBuffer, 8, &read); + result = f_read(&state.file, wavBuffer, 8, &read); if (read != 8) result = FR_DENIED; wavSamplesPtr = (uint32_t *)wavBuffer; size = wavSamplesPtr[1]; } } - context.state.wav.size = size; + state.size = size; } else { result = FR_DENIED; @@ -407,128 +573,128 @@ int AudioQueue::mixWav(AudioContext &context, AudioBuffer *buffer, int volume, u read = 0; if (result == FR_OK) { - result = f_read(&context.state.wav.file, wavBuffer, context.state.wav.readSize, &read); + result = f_read(&state.file, wavBuffer, state.readSize, &read); if (result == FR_OK) { - if (read > context.state.wav.size) { - read = context.state.wav.size; + if (read > state.size) { + read = state.size; } - context.state.wav.size -= read; + state.size -= read; - if (read != context.state.wav.readSize) { - f_close(&context.state.wav.file); + if (read != state.readSize) { + f_close(&state.file); fragment.clear(); } uint16_t * samples = buffer->data; - if (context.state.wav.codec == CODEC_ID_PCM_S16LE) { + if (state.codec == CODEC_ID_PCM_S16LE) { read /= 2; for (uint32_t i=0; idata; } } - fragment.clear(); + clear(); return -result; } #else -int AudioQueue::mixWav(AudioContext &context, AudioBuffer *buffer, int volume, unsigned int fade) +int WavContext::mixBuffer(AudioBuffer *buffer, int volume, unsigned int fade) { return 0; } #endif -int AudioQueue::mixBeep(AudioContext &context, AudioBuffer *buffer, int volume, unsigned int fade) +const unsigned int toneVolumes[] = { 10, 8, 6, 4, 2 }; +inline float evalVolumeRatio(int freq, int volume) { - AudioFragment & fragment = context.fragment; - int duration = 0; - int result = 0; - - if (fragment.tone.duration > 0) { - result = AUDIO_BUFFER_SIZE; - if (fragment.tone.freq && context.state.tone.freq!=fragment.tone.freq && (!fragment.tone.freqIncr || abs(context.state.tone.freq-fragment.tone.freq) > 100)) { - int periods = BEEP_POINTS_COUNT / ((AUDIO_SAMPLE_RATE / fragment.tone.freq) + 1); - context.state.tone.count = (periods * AUDIO_SAMPLE_RATE) / fragment.tone.freq; - if (context.state.tone.idx >= context.state.tone.count) context.state.tone.idx = 0; -#if 1 - for (unsigned int i=0; idata[i], context.state.tone.points[context.state.tone.idx], fade); - context.state.tone.idx = context.state.tone.idx + 1; - if (context.state.tone.idx >= context.state.tone.count) { - context.state.tone.idx = 0; - if (end && i+BEEP_POINTS_COUNT>points) break; - } - } - - fragment.tone.duration -= duration; - if (fragment.tone.duration > 0) - return AUDIO_BUFFER_SIZE; + float result = toneVolumes[2+volume]; + if (freq < 330) { + result = (result * freq * freq) / (330 * 330); } - - if (fragment.tone.pause > 0) { - result = AUDIO_BUFFER_SIZE; - fragment.tone.pause -= min(AUDIO_BUFFER_DURATION-duration, fragment.tone.pause); - if (fragment.tone.pause > 0) - return AUDIO_BUFFER_SIZE; - } - - fragment.clear(); return result; } -int AudioQueue::mixAudioContext(AudioContext &context, AudioBuffer *buffer, int beepVolume, int wavVolume, unsigned int fade) +int ToneContext::mixBuffer(AudioBuffer *buffer, int volume, unsigned int fade) { - int result; - AudioFragment & fragment = context.fragment; + int duration = 0; + int result = 0; - if (fragment.type == FRAGMENT_TONE) { - result = mixBeep(context, buffer, beepVolume, fade); - } - else if (fragment.type == FRAGMENT_FILE) { - result = mixWav(context, buffer, wavVolume, fade); - } - else { - result = 0; + int remainingDuration = fragment.tone.duration - state.duration; + if (remainingDuration > 0) { + int points; + double toneIdx = state.idx; + + if (fragment.tone.reset) { + state.duration = 0; + state.pause = 0; + } + + if (fragment.tone.freq != state.freq) { + state.freq = fragment.tone.freq; + state.step = double(DIM(sineValues)*fragment.tone.freq) / AUDIO_SAMPLE_RATE; + state.volume = evalVolumeRatio(fragment.tone.freq, volume); + } + + if (fragment.tone.freqIncr) { + fragment.tone.freq += AUDIO_BUFFER_DURATION * fragment.tone.freqIncr; + } + + if (remainingDuration > AUDIO_BUFFER_DURATION) { + duration = AUDIO_BUFFER_DURATION; + points = AUDIO_BUFFER_SIZE; + } + else { + duration = remainingDuration; + points = (duration * AUDIO_BUFFER_SIZE) / AUDIO_BUFFER_DURATION; + unsigned int end = toneIdx + (state.step * points); + if (end > DIM(sineValues)) + end -= (end % DIM(sineValues)); + else + end = DIM(sineValues); + points = (double(end) - toneIdx) / state.step; + } + + for (int i=0; idata[i], sample, fade); + toneIdx += state.step; + if ((unsigned int)toneIdx >= DIM(sineValues)) + toneIdx -= DIM(sineValues); + } + + if (remainingDuration > AUDIO_BUFFER_DURATION) { + state.duration += AUDIO_BUFFER_DURATION; + state.idx = toneIdx; + return AUDIO_BUFFER_SIZE; + } + else { + state.duration = 32000; // once the tone is finished, it's not possible to update its frequency and duration + } } + remainingDuration = fragment.tone.pause - state.pause; + if (remainingDuration > 0) { + result = AUDIO_BUFFER_SIZE; + state.pause += min(AUDIO_BUFFER_DURATION-duration, fragment.tone.pause); + if (fragment.tone.pause > state.pause) + return result; + } + + clear(); return result; } @@ -545,15 +711,20 @@ void AudioQueue::wakeup() buffer->data[i] = 0x8000 >> 4; /* silence */ } - // mix the foreground context - result = mixAudioContext(foregroundContext, buffer, g_eeGeneral.beepVolume, g_eeGeneral.wavVolume, fade); + // mix the priority context (only tones) + result = priorityContext.mixBuffer(buffer, g_eeGeneral.beepVolume, fade); if (result > 0) { - size = max(size, result); + size = result; fade += 1; } - // mix the normal context - result = mixAudioContext(currentContext, buffer, g_eeGeneral.beepVolume, g_eeGeneral.wavVolume, fade); + // mix the normal context (tones and wavs) + if (normalContext.fragment.type == FRAGMENT_TONE) + result = normalContext.tone.mixBuffer(buffer, g_eeGeneral.beepVolume, fade); + else if (normalContext.fragment.type == FRAGMENT_FILE) + result = normalContext.wav.mixBuffer(buffer, g_eeGeneral.wavVolume, fade); + else + result = 0; if (result > 0) { size = max(size, result); fade += 1; @@ -561,8 +732,7 @@ void AudioQueue::wakeup() else { CoEnterMutexSection(audioMutex); if (ridx != widx) { - currentContext.clear(); - currentContext.fragment = fragments[ridx]; + normalContext.fragment = fragments[ridx]; if (!fragments[ridx].repeat--) { ridx = (ridx + 1) % AUDIO_QUEUE_LENGTH; } @@ -570,9 +740,16 @@ void AudioQueue::wakeup() CoLeaveMutexSection(audioMutex); } + // mix the vario context + result = varioContext.mixBuffer(buffer, g_eeGeneral.varioVolume, fade); + if (result > 0) { + size = max(size, result); + fade += 1; + } + // mix the background context - if (!isFunctionActive(FUNCTION_BACKGND_MUSIC_PAUSE)) { - result = mixAudioContext(backgroundContext, buffer, g_eeGeneral.varioVolume, g_eeGeneral.backgroundVolume, fade); + if (isFunctionActive(FUNCTION_BACKGND_MUSIC) && !isFunctionActive(FUNCTION_BACKGND_MUSIC_PAUSE)) { + result = backgroundContext.mixBuffer(buffer, g_eeGeneral.backgroundVolume, fade); if (result > 0) { size = max(size, result); } @@ -600,12 +777,12 @@ inline unsigned int getToneLength(uint16_t len) void AudioQueue::pause(uint16_t len) { - play(0, 0, len); + playTone(0, 0, len); } bool AudioQueue::isPlaying(uint8_t id) { - if (currentContext.fragment.id == id || backgroundContext.fragment.id == id) + if (normalContext.fragment.id == id || backgroundContext.fragment.id == id) return true; uint8_t i = ridx; @@ -618,7 +795,7 @@ bool AudioQueue::isPlaying(uint8_t id) return false; } -void AudioQueue::play(uint16_t freq, uint16_t len, uint16_t pause, uint8_t flags, int8_t freqIncr) +void AudioQueue::playTone(uint16_t freq, uint16_t len, uint16_t pause, uint8_t flags, int8_t freqIncr) { CoEnterMutexSection(audioMutex); @@ -626,21 +803,21 @@ void AudioQueue::play(uint16_t freq, uint16_t len, uint16_t pause, uint8_t flags freq = BEEP_MIN_FREQ; if (flags & PLAY_BACKGROUND) { - AudioFragment & fragment = backgroundContext.fragment; - backgroundContext.clear(); + AudioFragment & fragment = varioContext.fragment; fragment.type = FRAGMENT_TONE; fragment.tone.freq = freq; fragment.tone.duration = len; fragment.tone.pause = pause; + fragment.tone.reset = (flags & PLAY_NOW); } else { freq += g_eeGeneral.speakerPitch * 15; len = getToneLength(len); if (flags & PLAY_NOW) { - AudioFragment & fragment = foregroundContext.fragment; + AudioFragment & fragment = priorityContext.fragment; if (fragment.type == FRAGMENT_EMPTY) { - foregroundContext.clear(); + priorityContext.clear(); fragment.type = FRAGMENT_TONE; fragment.repeat = flags & 0x0f; fragment.tone.freq = freq; @@ -697,9 +874,9 @@ void AudioQueue::playFile(const char *filename, uint8_t flags, uint8_t id) fragment.id = id; } else if (flags & PLAY_NOW) { - AudioFragment & fragment = foregroundContext.fragment; + AudioFragment & fragment = priorityContext.fragment; if (fragment.type == FRAGMENT_EMPTY) { - foregroundContext.clear(); + priorityContext.clear(); fragment.type = FRAGMENT_FILE; strcpy(fragment.file, filename); fragment.repeat = flags & 0x0f; @@ -740,7 +917,7 @@ void AudioQueue::stopSD() { sdAvailableSystemAudioFiles = 0; reset(); - play(0, 0, 100, PLAY_NOW); // insert a 100ms pause + playTone(0, 0, 100, PLAY_NOW); // insert a 100ms pause } #endif @@ -749,18 +926,15 @@ void AudioQueue::reset() { CoEnterMutexSection(audioMutex); widx = ridx; // clean the queue - foregroundContext.clear(); - currentContext.clear(); + priorityContext.clear(); + normalContext.tone.clear(); + varioContext.clear(); backgroundContext.clear(); CoLeaveMutexSection(audioMutex); } void audioEvent(uint8_t e, uint16_t f) { -#if defined(SDCARD) - char filename[AUDIO_FILENAME_MAXLEN+1]; -#endif - #if defined(HAPTIC) haptic.event(e); //do this before audio to help sync timings #endif @@ -773,7 +947,8 @@ void audioEvent(uint8_t e, uint16_t f) if (g_eeGeneral.beepMode>0 || (g_eeGeneral.beepMode==0 && e>=AU_TRIM_MOVE) || (g_eeGeneral.beepMode>=-1 && e<=AU_ERROR)) { #if defined(SDCARD) - if (e < AU_FRSKY_FIRST && isAudioFileAvailable(e, filename)) { + char filename[AUDIO_FILENAME_MAXLEN+1]; + if (e < AU_FRSKY_FIRST && isAudioFileReferenced(e, filename)) { audioQueue.playFile(filename); } else @@ -782,23 +957,23 @@ void audioEvent(uint8_t e, uint16_t f) switch (e) { // inactivity timer alert case AU_INACTIVITY: - audioQueue.play(2250, 80, 20, PLAY_REPEAT(2)); + audioQueue.playTone(2250, 80, 20, PLAY_REPEAT(2)); break; // low battery in tx case AU_TX_BATTERY_LOW: - audioQueue.play(1950, 160, 20, PLAY_REPEAT(2), 1); - audioQueue.play(2550, 160, 20, PLAY_REPEAT(2), -1); + audioQueue.playTone(1950, 160, 20, PLAY_REPEAT(2), 1); + audioQueue.playTone(2550, 160, 20, PLAY_REPEAT(2), -1); break; #if defined(PCBSKY9X) case AU_TX_MAH_HIGH: // TODO Rob something better here? - audioQueue.play(1950, 160, 20, PLAY_REPEAT(2), 1); - audioQueue.play(2550, 160, 20, PLAY_REPEAT(2), -1); + audioQueue.playTone(1950, 160, 20, PLAY_REPEAT(2), 1); + audioQueue.playTone(2550, 160, 20, PLAY_REPEAT(2), -1); break; case AU_TX_TEMP_HIGH: // TODO Rob something better here? - audioQueue.play(1950, 160, 20, PLAY_REPEAT(2), 1); - audioQueue.play(2550, 160, 20, PLAY_REPEAT(2), -1); + audioQueue.playTone(1950, 160, 20, PLAY_REPEAT(2), 1); + audioQueue.playTone(2550, 160, 20, PLAY_REPEAT(2), -1); break; #endif #if defined(VOICE) @@ -806,43 +981,43 @@ void audioEvent(uint8_t e, uint16_t f) case AU_SWITCH_ALERT: #endif case AU_ERROR: - audioQueue.play(BEEP_DEFAULT_FREQ, 200, 20, PLAY_NOW); + audioQueue.playTone(BEEP_DEFAULT_FREQ, 200, 20, PLAY_NOW); break; // keypad up (seems to be used when going left/right through system menu options. 0-100 scales etc) case AU_KEYPAD_UP: - audioQueue.play(BEEP_KEY_UP_FREQ, 80, 20, PLAY_NOW); + audioQueue.playTone(BEEP_KEY_UP_FREQ, 80, 20, PLAY_NOW); break; // keypad down (seems to be used when going left/right through system menu options. 0-100 scales etc) case AU_KEYPAD_DOWN: - audioQueue.play(BEEP_KEY_DOWN_FREQ, 80, 20, PLAY_NOW); + audioQueue.playTone(BEEP_KEY_DOWN_FREQ, 80, 20, PLAY_NOW); break; // menu display (also used by a few generic beeps) case AU_MENUS: - audioQueue.play(BEEP_DEFAULT_FREQ, 80, 20, PLAY_NOW); + audioQueue.playTone(BEEP_DEFAULT_FREQ, 80, 20, PLAY_NOW); break; // trim move case AU_TRIM_MOVE: - audioQueue.play(f, 40, 20, PLAY_NOW); + audioQueue.playTone(f, 40, 20, PLAY_NOW); break; // trim center case AU_TRIM_MIDDLE: - audioQueue.play(f, 80, 20, PLAY_NOW); + audioQueue.playTone(f, 80, 20, PLAY_NOW); break; // trim center case AU_TRIM_END: - audioQueue.play(f, 80, 20, PLAY_NOW); + audioQueue.playTone(f, 80, 20, PLAY_NOW); break; // warning one case AU_WARNING1: - audioQueue.play(BEEP_DEFAULT_FREQ, 80, 20, PLAY_NOW); + audioQueue.playTone(BEEP_DEFAULT_FREQ, 80, 20, PLAY_NOW); break; // warning two case AU_WARNING2: - audioQueue.play(BEEP_DEFAULT_FREQ, 160, 20, PLAY_NOW); + audioQueue.playTone(BEEP_DEFAULT_FREQ, 160, 20, PLAY_NOW); break; // warning three case AU_WARNING3: - audioQueue.play(BEEP_DEFAULT_FREQ, 200, 20, PLAY_NOW); + audioQueue.playTone(BEEP_DEFAULT_FREQ, 200, 20, PLAY_NOW); break; // pot/stick center case AU_STICK1_MIDDLE: @@ -857,120 +1032,120 @@ void audioEvent(uint8_t e, uint16_t f) #else case AU_POT3_MIDDLE: #endif - audioQueue.play(BEEP_DEFAULT_FREQ+1500, 80, 20, PLAY_NOW); + audioQueue.playTone(BEEP_DEFAULT_FREQ+1500, 80, 20, PLAY_NOW); break; // mix warning 1 case AU_MIX_WARNING_1: - audioQueue.play(BEEP_DEFAULT_FREQ+1440, 48, 32); + audioQueue.playTone(BEEP_DEFAULT_FREQ+1440, 48, 32); break; // mix warning 2 case AU_MIX_WARNING_2: - audioQueue.play(BEEP_DEFAULT_FREQ+1560, 48, 32, PLAY_REPEAT(1)); + audioQueue.playTone(BEEP_DEFAULT_FREQ+1560, 48, 32, PLAY_REPEAT(1)); break; // mix warning 3 case AU_MIX_WARNING_3: - audioQueue.play(BEEP_DEFAULT_FREQ+1680, 48, 32, PLAY_REPEAT(2)); + audioQueue.playTone(BEEP_DEFAULT_FREQ+1680, 48, 32, PLAY_REPEAT(2)); break; // timer == 0 case AU_TIMER_00: - audioQueue.play(BEEP_DEFAULT_FREQ+150, 300, 20, PLAY_NOW); + audioQueue.playTone(BEEP_DEFAULT_FREQ+150, 300, 20, PLAY_NOW); break; // timer <= 10 seconds left case AU_TIMER_LT10: - audioQueue.play(BEEP_DEFAULT_FREQ+150, 120, 20, PLAY_NOW); + audioQueue.playTone(BEEP_DEFAULT_FREQ+150, 120, 20, PLAY_NOW); break; // timer 20 seconds left case AU_TIMER_20: - audioQueue.play(BEEP_DEFAULT_FREQ+150, 120, 20, PLAY_REPEAT(1)|PLAY_NOW); + audioQueue.playTone(BEEP_DEFAULT_FREQ+150, 120, 20, PLAY_REPEAT(1)|PLAY_NOW); break; // timer 30 seconds left case AU_TIMER_30: - audioQueue.play(BEEP_DEFAULT_FREQ+150, 120, 20, PLAY_REPEAT(2)|PLAY_NOW); + audioQueue.playTone(BEEP_DEFAULT_FREQ+150, 120, 20, PLAY_REPEAT(2)|PLAY_NOW); break; #if defined(PCBTARANIS) case AU_A1_ORANGE: - audioQueue.play(BEEP_DEFAULT_FREQ+600, 200, 20, PLAY_NOW); + audioQueue.playTone(BEEP_DEFAULT_FREQ+600, 200, 20, PLAY_NOW); break; case AU_A1_RED: - audioQueue.play(BEEP_DEFAULT_FREQ+600, 200, 20, PLAY_REPEAT(1)|PLAY_NOW); + audioQueue.playTone(BEEP_DEFAULT_FREQ+600, 200, 20, PLAY_REPEAT(1)|PLAY_NOW); break; case AU_A2_ORANGE: - audioQueue.play(BEEP_DEFAULT_FREQ+1500, 200, 20, PLAY_NOW); + audioQueue.playTone(BEEP_DEFAULT_FREQ+1500, 200, 20, PLAY_NOW); break; case AU_A2_RED: - audioQueue.play(BEEP_DEFAULT_FREQ+1500, 200, 20, PLAY_REPEAT(1)|PLAY_NOW); + audioQueue.playTone(BEEP_DEFAULT_FREQ+1500, 200, 20, PLAY_REPEAT(1)|PLAY_NOW); break; case AU_RSSI_ORANGE: - audioQueue.play(BEEP_DEFAULT_FREQ+1500, 800, 20, PLAY_NOW); + audioQueue.playTone(BEEP_DEFAULT_FREQ+1500, 800, 20, PLAY_NOW); break; case AU_RSSI_RED: - audioQueue.play(BEEP_DEFAULT_FREQ+1800, 800, 20, PLAY_REPEAT(1)|PLAY_NOW); + audioQueue.playTone(BEEP_DEFAULT_FREQ+1800, 800, 20, PLAY_REPEAT(1)|PLAY_NOW); break; case AU_SWR_RED: - audioQueue.play(450, 160, 40, PLAY_REPEAT(2), 1); + audioQueue.playTone(450, 160, 40, PLAY_REPEAT(2), 1); break; #endif case AU_FRSKY_BEEP1: - audioQueue.play(BEEP_DEFAULT_FREQ, 60, 20); + audioQueue.playTone(BEEP_DEFAULT_FREQ, 60, 20); break; case AU_FRSKY_BEEP2: - audioQueue.play(BEEP_DEFAULT_FREQ, 120, 20); + audioQueue.playTone(BEEP_DEFAULT_FREQ, 120, 20); break; case AU_FRSKY_BEEP3: - audioQueue.play(BEEP_DEFAULT_FREQ, 200, 20); + audioQueue.playTone(BEEP_DEFAULT_FREQ, 200, 20); break; case AU_FRSKY_WARN1: - audioQueue.play(BEEP_DEFAULT_FREQ+600, 120, 40, PLAY_REPEAT(2)); + audioQueue.playTone(BEEP_DEFAULT_FREQ+600, 120, 40, PLAY_REPEAT(2)); break; case AU_FRSKY_WARN2: - audioQueue.play(BEEP_DEFAULT_FREQ+900, 120, 40, PLAY_REPEAT(2)); + audioQueue.playTone(BEEP_DEFAULT_FREQ+900, 120, 40, PLAY_REPEAT(2)); break; case AU_FRSKY_CHEEP: - audioQueue.play(BEEP_DEFAULT_FREQ+900, 80, 20, PLAY_REPEAT(2), 2); + audioQueue.playTone(BEEP_DEFAULT_FREQ+900, 80, 20, PLAY_REPEAT(2), 2); break; case AU_FRSKY_RING: - audioQueue.play(BEEP_DEFAULT_FREQ+750, 40, 20, PLAY_REPEAT(10)); - audioQueue.play(BEEP_DEFAULT_FREQ+750, 40, 80, PLAY_REPEAT(1)); - audioQueue.play(BEEP_DEFAULT_FREQ+750, 40, 20, PLAY_REPEAT(10)); + audioQueue.playTone(BEEP_DEFAULT_FREQ+750, 40, 20, PLAY_REPEAT(10)); + audioQueue.playTone(BEEP_DEFAULT_FREQ+750, 40, 80, PLAY_REPEAT(1)); + audioQueue.playTone(BEEP_DEFAULT_FREQ+750, 40, 20, PLAY_REPEAT(10)); break; case AU_FRSKY_SCIFI: - audioQueue.play(2550, 80, 20, PLAY_REPEAT(2), -1); - audioQueue.play(1950, 80, 20, PLAY_REPEAT(2), 1); - audioQueue.play(2250, 80, 20, 0); + audioQueue.playTone(2550, 80, 20, PLAY_REPEAT(2), -1); + audioQueue.playTone(1950, 80, 20, PLAY_REPEAT(2), 1); + audioQueue.playTone(2250, 80, 20, 0); break; case AU_FRSKY_ROBOT: - audioQueue.play(2250, 40, 20, PLAY_REPEAT(1)); - audioQueue.play(1650, 120, 20, PLAY_REPEAT(1)); - audioQueue.play(2550, 120, 20, PLAY_REPEAT(1)); + audioQueue.playTone(2250, 40, 20, PLAY_REPEAT(1)); + audioQueue.playTone(1650, 120, 20, PLAY_REPEAT(1)); + audioQueue.playTone(2550, 120, 20, PLAY_REPEAT(1)); break; case AU_FRSKY_CHIRP: - audioQueue.play(BEEP_DEFAULT_FREQ+1200, 40, 20, PLAY_REPEAT(2)); - audioQueue.play(BEEP_DEFAULT_FREQ+1620, 40, 20, PLAY_REPEAT(3)); + audioQueue.playTone(BEEP_DEFAULT_FREQ+1200, 40, 20, PLAY_REPEAT(2)); + audioQueue.playTone(BEEP_DEFAULT_FREQ+1620, 40, 20, PLAY_REPEAT(3)); break; case AU_FRSKY_TADA: - audioQueue.play(1650, 80, 40); - audioQueue.play(2850, 80, 40); - audioQueue.play(3450, 64, 36, PLAY_REPEAT(2)); + audioQueue.playTone(1650, 80, 40); + audioQueue.playTone(2850, 80, 40); + audioQueue.playTone(3450, 64, 36, PLAY_REPEAT(2)); break; case AU_FRSKY_CRICKET: - audioQueue.play(2550, 40, 80, PLAY_REPEAT(3)); - audioQueue.play(2550, 40, 160, PLAY_REPEAT(1)); - audioQueue.play(2550, 40, 80, PLAY_REPEAT(3)); + audioQueue.playTone(2550, 40, 80, PLAY_REPEAT(3)); + audioQueue.playTone(2550, 40, 160, PLAY_REPEAT(1)); + audioQueue.playTone(2550, 40, 80, PLAY_REPEAT(3)); break; case AU_FRSKY_SIREN: - audioQueue.play(450, 160, 40, PLAY_REPEAT(2), 2); + audioQueue.playTone(450, 160, 40, PLAY_REPEAT(2), 2); break; case AU_FRSKY_ALARMC: - audioQueue.play(1650, 32, 68, PLAY_REPEAT(2)); - audioQueue.play(2250, 64, 156, PLAY_REPEAT(1)); - audioQueue.play(1650, 64, 76, PLAY_REPEAT(2)); - audioQueue.play(2250, 32, 168, PLAY_REPEAT(1)); + audioQueue.playTone(1650, 32, 68, PLAY_REPEAT(2)); + audioQueue.playTone(2250, 64, 156, PLAY_REPEAT(1)); + audioQueue.playTone(1650, 64, 76, PLAY_REPEAT(2)); + audioQueue.playTone(2250, 32, 168, PLAY_REPEAT(1)); break; case AU_FRSKY_RATATA: - audioQueue.play(BEEP_DEFAULT_FREQ+1500, 40, 80, PLAY_REPEAT(10)); + audioQueue.playTone(BEEP_DEFAULT_FREQ+1500, 40, 80, PLAY_REPEAT(10)); break; case AU_FRSKY_TICK: - audioQueue.play(BEEP_DEFAULT_FREQ+1500, 40, 400, PLAY_REPEAT(2)); + audioQueue.playTone(BEEP_DEFAULT_FREQ+1500, 40, 400, PLAY_REPEAT(2)); break; default: break; @@ -982,16 +1157,13 @@ void audioEvent(uint8_t e, uint16_t f) void pushPrompt(uint16_t prompt, uint8_t id) { #if defined(SDCARD) - - char filename[] = SYSTEM_SOUNDS_PATH "/0000" SOUNDS_EXT; - strncpy(filename+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2); - + char filename[AUDIO_FILENAME_MAXLEN+1]; + char * str = getSystemAudioPath(filename); + strcpy(str, "0000" SOUNDS_EXT); for (int8_t i=3; i>=0; i--) { - filename[sizeof(SYSTEM_SOUNDS_PATH)+i] = '0' + (prompt%10); + str[i] = '0' + (prompt%10); prompt /= 10; } - audioQueue.playFile(filename, 0, id); - #endif } diff --git a/radio/src/audio_arm.h b/radio/src/audio_arm.h index 9b45187b0..65a9d6233 100644 --- a/radio/src/audio_arm.h +++ b/radio/src/audio_arm.h @@ -47,11 +47,10 @@ #define AUDIO_BUFFER_SIZE (AUDIO_SAMPLE_RATE*AUDIO_BUFFER_DURATION/1000) #define AUDIO_BUFFER_COUNT (3) -#define BEEP_MIN_FREQ (440) +#define BEEP_MIN_FREQ (150) #define BEEP_DEFAULT_FREQ (2250) #define BEEP_KEY_UP_FREQ (BEEP_DEFAULT_FREQ+150) #define BEEP_KEY_DOWN_FREQ (BEEP_DEFAULT_FREQ-150) -#define BEEP_POINTS_COUNT 100 #define AUDIO_BUFFER_FREE (0) #define AUDIO_BUFFER_FILLED (1) @@ -63,9 +62,11 @@ struct AudioBuffer { uint8_t state; }; -#define FRAGMENT_EMPTY 0 -#define FRAGMENT_TONE 1 -#define FRAGMENT_FILE 2 +enum FragmentTypes { + FRAGMENT_EMPTY, + FRAGMENT_TONE, + FRAGMENT_FILE, +}; struct AudioFragment { uint8_t type; @@ -77,6 +78,7 @@ struct AudioFragment { uint16_t duration; uint16_t pause; int8_t freqIncr; + uint8_t reset; } tone; char file[AUDIO_FILENAME_MAXLEN+1]; @@ -88,34 +90,57 @@ struct AudioFragment { } }; -class AudioContext { +class ToneContext { public: AudioFragment fragment; - union { -#if defined(SDCARD) - struct { - FIL file; - uint8_t codec; - uint32_t freq; - uint32_t size; - uint8_t resampleRatio; - uint16_t readSize; - } wav; -#endif + struct { + double step; + double idx; + float volume; + uint16_t freq; + uint16_t duration; + uint16_t pause; + } state; - struct { - int16_t points[BEEP_POINTS_COUNT]; - uint8_t count; - uint8_t idx; - uint16_t freq; - } tone; + inline void clear() + { + memset(this, 0, sizeof(ToneContext)); + } + + int mixBuffer(AudioBuffer *buffer, int volume, unsigned int fade); +}; + +class WavContext { + public: + AudioFragment fragment; + + struct { + FIL file; + uint8_t codec; + uint32_t freq; + uint32_t size; + uint8_t resampleRatio; + uint16_t readSize; } state; inline void clear() { fragment.clear(); } + + int mixBuffer(AudioBuffer *buffer, int volume, unsigned int fade); +}; + +class MixedContext { + public: + union { + AudioFragment fragment; + ToneContext tone; + WavContext wav; + }; + + int mixBuffer(AudioBuffer *buffer, int volume, unsigned int fade); }; bool dacQueue(AudioBuffer *buffer); @@ -130,7 +155,7 @@ class AudioQueue { void start(); - void play(uint16_t freq, uint16_t len, uint16_t pause=0, uint8_t flags=0, int8_t freqIncr=0); + void playTone(uint16_t freq, uint16_t len, uint16_t pause=0, uint8_t flags=0, int8_t freqIncr=0); void playFile(const char *filename, uint8_t flags=0, uint8_t id=0); @@ -178,19 +203,16 @@ class AudioQueue { void wakeup(); - int mixAudioContext(AudioContext &context, AudioBuffer *buffer, int beepVolume, int wavVolume, unsigned int fade); - int mixBeep(AudioContext &context, AudioBuffer *buffer, int volume, unsigned int fade); - int mixWav(AudioContext &context, AudioBuffer *buffer, int volume, unsigned int fade); - volatile bool state; uint8_t ridx; uint8_t widx; AudioFragment fragments[AUDIO_QUEUE_LENGTH]; - AudioContext backgroundContext; // for background music / vario - AudioContext currentContext; - AudioContext foregroundContext; // for important beeps + MixedContext normalContext; + WavContext backgroundContext; + ToneContext priorityContext; + ToneContext varioContext; AudioBuffer buffers[AUDIO_BUFFER_COUNT]; uint8_t bufferRIdx; @@ -254,13 +276,11 @@ void audioStart(); #define AUDIO_INACTIVITY() AUDIO_BUZZER(audioEvent(AU_INACTIVITY), beep(3)) #define AUDIO_MIX_WARNING(x) AUDIO_BUZZER(audioEvent(AU_MIX_WARNING_1+x-1), beep(1)) #define AUDIO_POT_MIDDLE(x) AUDIO_BUZZER(audioEvent(AU_STICK1_MIDDLE+x), beep(2)) -#define AUDIO_VARIO_UP() audioEvent(AU_KEYPAD_UP) -#define AUDIO_VARIO_DOWN() audioEvent(AU_KEYPAD_DOWN) #define AUDIO_TRIM_MIDDLE(f) AUDIO_BUZZER(audioEvent(AU_TRIM_MIDDLE, f), beep(2)) #define AUDIO_TRIM_END(f) AUDIO_BUZZER(audioEvent(AU_TRIM_END, f), beep(2)) #define AUDIO_TRIM(event, f) AUDIO_BUZZER(audioEvent(AU_TRIM_MOVE, f), { if (!IS_KEY_FIRST(event)) warble = true; beep(1); }) #define AUDIO_PLAY(p) audioEvent(p) -#define AUDIO_VARIO(f, t) audioQueue.play(f, t, 0, PLAY_BACKGROUND) +#define AUDIO_VARIO(fq, t, p, f) audioQueue.playTone(fq, t, p, f) #if defined(PCBTARANIS) #define AUDIO_A1_ORANGE() audioEvent(AU_A1_ORANGE) @@ -277,16 +297,21 @@ void audioStart(); #define AUDIO_HEARTBEAT() -#define SYSTEM_AUDIO_CATEGORY 0 -#define MODEL_AUDIO_CATEGORY 1 -#define PHASE_AUDIO_CATEGORY 2 -#define MIXER_AUDIO_CATEGORY 3 +enum AutomaticPromptsCategories { + SYSTEM_AUDIO_CATEGORY, + MODEL_AUDIO_CATEGORY, + PHASE_AUDIO_CATEGORY, + SWITCH_AUDIO_CATEGORY, + LOGICAL_SWITCH_AUDIO_CATEGORY, +}; -#define AUDIO_EVENT_OFF 0 -#define AUDIO_EVENT_ON 1 -#define AUDIO_EVENT_BG 2 +enum AutomaticPromptsEvents { + AUDIO_EVENT_OFF, + AUDIO_EVENT_ON, + AUDIO_EVENT_MID, +}; -extern void pushPrompt(uint16_t prompt, uint8_t id=0); +void pushPrompt(uint16_t prompt, uint8_t id=0); #define I18N_PLAY_FUNCTION(lng, x, ...) void lng ## _ ## x(__VA_ARGS__, uint8_t id) #define PLAY_FUNCTION(x, ...) void x(__VA_ARGS__, uint8_t id) @@ -300,15 +325,26 @@ extern void pushPrompt(uint16_t prompt, uint8_t id=0); #define AUDIO_RESET() audioQueue.reset() #if defined(SDCARD) - #define PLAY_PHASE_OFF(phase) do { char filename[AUDIO_FILENAME_MAXLEN+1]; if (isAudioFileAvailable((PHASE_AUDIO_CATEGORY << 24) + (phase << 16) + AUDIO_EVENT_OFF, filename)) audioQueue.playFile(filename); } while (0) - #define PLAY_PHASE_ON(phase) do { char filename[AUDIO_FILENAME_MAXLEN+1]; if (isAudioFileAvailable((PHASE_AUDIO_CATEGORY << 24) + (phase << 16) + AUDIO_EVENT_ON, filename)) audioQueue.playFile(filename); } while (0) + extern tmr10ms_t timeAutomaticPromptsSilence; + void playModelEvent(uint8_t category, uint8_t index, uint8_t event=0); + #define PLAY_PHASE_OFF(phase) playModelEvent(PHASE_AUDIO_CATEGORY, phase, AUDIO_EVENT_OFF) + #define PLAY_PHASE_ON(phase) playModelEvent(PHASE_AUDIO_CATEGORY, phase, AUDIO_EVENT_ON) + #define PLAY_SWITCH_MOVED(sw) playModelEvent(SWITCH_AUDIO_CATEGORY, sw) + #define PLAY_LOGICAL_SWITCH_OFF(sw) playModelEvent(LOGICAL_SWITCH_AUDIO_CATEGORY, sw, AUDIO_EVENT_OFF) + #define PLAY_LOGICAL_SWITCH_ON(sw) playModelEvent(LOGICAL_SWITCH_AUDIO_CATEGORY, sw, AUDIO_EVENT_ON) + #define SKIP_AUTOMATIC_PROMPTS() timeAutomaticPromptsSilence = get_tmr10ms() #else #define PLAY_PHASE_OFF(phase) #define PLAY_PHASE_ON(phase) + #define PLAY_SWITCH_MOVED(sw) + #define PLAY_LOGICAL_SWITCH_OFF(sw) + #define PLAY_LOGICAL_SWITCH_ON(sw) + #define SKIP_AUTOMATIC_PROMPTS() #endif -extern void refreshSystemAudioFiles(); -extern void refreshModelAudioFiles(); -extern bool isAudioFileAvailable(uint32_t i, char * filename); +void referenceSystemAudioFiles(); +void referenceModelAudioFiles(); + +bool isAudioFileReferenced(uint32_t i, char * filename/*at least AUDIO_FILENAME_MAXLEN+1 long*/); #endif diff --git a/radio/src/audio_avr.cpp b/radio/src/audio_avr.cpp index 356e9051d..9931269eb 100644 --- a/radio/src/audio_avr.cpp +++ b/radio/src/audio_avr.cpp @@ -227,7 +227,7 @@ void audioQueue::event(uint8_t e, uint8_t f) break; default: { - const static pm_uint8_t singleSounds[] PROGMEM = { + static const pm_uint8_t singleSounds[] PROGMEM = { 70, 10, 2, PLAY_REPEAT(2)|PLAY_NOW, // INACTIVITY BEEP_DEFAULT_FREQ, 40, 1, PLAY_NOW, // ERROR BEEP_KEY_UP_FREQ, 10, 1, PLAY_NOW, // KEYPAD_UP diff --git a/radio/src/audio_avr.h b/radio/src/audio_avr.h index 6302c13f4..691305655 100644 --- a/radio/src/audio_avr.h +++ b/radio/src/audio_avr.h @@ -157,5 +157,9 @@ void audioDefevent(uint8_t e); #define PLAY_PHASE_OFF(phase) #define PLAY_PHASE_ON(phase) +#define PLAY_SWITCH_MOVED(sw) +#define PLAY_LOGICAL_SWITCH_OFF(sw) +#define PLAY_LOGICAL_SWITCH_ON(sw) +#define SKIP_AUTOMATIC_PROMPTS() #endif diff --git a/radio/src/buzzer.h b/radio/src/buzzer.h index cbb4d5717..6d901bbbb 100644 --- a/radio/src/buzzer.h +++ b/radio/src/buzzer.h @@ -102,6 +102,10 @@ void beep(uint8_t val); #define PLAY_PHASE_OFF(phase) #define PLAY_PHASE_ON(phase) + #define PLAY_SWITCH_MOVED(sw) + #define PLAY_LOGICAL_SWITCH_OFF(sw) + #define PLAY_LOGICAL_SWITCH_ON(sw) + #define SKIP_AUTOMATIC_PROMPTS() #endif #if !defined(CPUARM) diff --git a/radio/src/eeprom_conversions.cpp b/radio/src/eeprom_conversions.cpp index 972c67a0a..d6de042cc 100644 --- a/radio/src/eeprom_conversions.cpp +++ b/radio/src/eeprom_conversions.cpp @@ -144,7 +144,7 @@ PACK(typedef struct { int8_t swtch; uint8_t func; PACK(union { - char name[LEN_CFN_NAME]; + char name[10]; struct { int16_t val; int16_t ext1; @@ -193,7 +193,7 @@ PACK(typedef struct { int8_t points[NUM_POINTS]; LogicalSwitchData_v215 customSw[NUM_CSW]; - CustomFnData_v215 funcSw[NUM_CFN]; + CustomFnData_v215 funcSw[32]; SwashRingData swashR; PhaseData_v215 phaseData[MAX_PHASES]; @@ -488,12 +488,13 @@ void ConvertModel_215_to_216(ModelData &model) for (uint8_t i=0; i<32; i++) { LogicalSwitchData & sw = g_model.customSw[i]; sw.func = oldModel.customSw[i].func; + if (sw.func >= LS_FUNC_VEQUAL) sw.func += 1; if (sw.func >= LS_FUNC_RANGE) sw.func += 1; if (sw.func >= LS_FUNC_STAY) sw.func += 1; sw.v1 = oldModel.customSw[i].v1; sw.v2 = oldModel.customSw[i].v2; - sw.delay = oldModel.customSw[i].delay; - sw.duration = oldModel.customSw[i].duration; + sw.delay = oldModel.customSw[i].delay * 5; + sw.duration = oldModel.customSw[i].duration * 5; sw.andsw = ConvertSwitch_215_to_216(oldModel.customSw[i].andsw); #if defined(PCBTARANIS) uint8_t cstate = cswFamily(sw.func); @@ -615,7 +616,7 @@ void ConvertModel_215_to_216(ModelData &model) } if (fn.func == FUNC_PLAY_TRACK || fn.func == FUNC_BACKGND_MUSIC) { - memcpy(fn.play.name, oldModel.funcSw[i].param.name, LEN_CFN_NAME); + memcpy(fn.play.name, oldModel.funcSw[i].param.name, 8); } else { fn.all.val = oldModel.funcSw[i].param.composite.val; diff --git a/radio/src/eeprom_raw.cpp b/radio/src/eeprom_raw.cpp index 718fe3558..095c18fc4 100644 --- a/radio/src/eeprom_raw.cpp +++ b/radio/src/eeprom_raw.cpp @@ -404,7 +404,7 @@ void eeLoadModel(uint8_t id) #endif #if defined(CPUARM) && defined(SDCARD) - refreshModelAudioFiles(); + referenceModelAudioFiles(); #endif LOAD_MODEL_BITMAP(); @@ -545,52 +545,24 @@ void ee32_process() Eeprom32_process_state = E32_READSENDING ; } - if ( Eeprom32_process_state == E32_READSENDING ) - { -#if 0 - if ( Spi_complete ) - { - uint32_t blank = 1 ; - x = Eeprom32_data_size + sizeof( struct t_eeprom_header ) ; // Size needing to be checked - p = (uint8_t *) &Eeprom_buffer ; - while ( x ) - { - if ( *p++ != 0xFF ) - { - blank = 0 ; - break ; - } - x -= 1 ; - } - // If not blank, sort erasing here - if ( blank ) - { - Eeprom32_state_after_erase = E32_IDLE ; // TODO really needed? - Eeprom32_process_state = E32_WRITESTART ; - } - else - { -#endif + if (Eeprom32_process_state == E32_READSENDING) { #ifdef SIMU - Eeprom32_process_state = E32_WRITESTART ; + Eeprom32_process_state = E32_WRITESTART ; #else - eeAddress = Eeprom32_address ; - eeprom_write_enable() ; - p = Spi_tx_buf ; - *p = 0x20 ; // Block Erase command - *(p+1) = eeAddress >> 16 ; - *(p+2) = eeAddress >> 8 ; - *(p+3) = eeAddress ; // 3 bytes address - spi_PDC_action( p, 0, 0, 4, 0 ) ; - Eeprom32_process_state = E32_ERASESENDING ; - Eeprom32_state_after_erase = E32_WRITESTART ; + eeAddress = Eeprom32_address ; + eeprom_write_enable() ; + p = Spi_tx_buf ; + *p = 0x20 ; // Block Erase command + *(p+1) = eeAddress >> 16 ; + *(p+2) = eeAddress >> 8 ; + *(p+3) = eeAddress ; // 3 bytes address + spi_PDC_action( p, 0, 0, 4, 0 ) ; + Eeprom32_process_state = E32_ERASESENDING ; + Eeprom32_state_after_erase = E32_WRITESTART ; #endif - // } - // } } - if ( Eeprom32_process_state == E32_WRITESTART ) - { + if (Eeprom32_process_state == E32_WRITESTART) { uint32_t total_size ; p = Eeprom32_source_address; q = (uint8_t *) &Eeprom_buffer.data; diff --git a/radio/src/eeprom_rlc.cpp b/radio/src/eeprom_rlc.cpp index f6f62502e..5dc845404 100644 --- a/radio/src/eeprom_rlc.cpp +++ b/radio/src/eeprom_rlc.cpp @@ -746,8 +746,7 @@ void RlcFile::nextRlcWriteStep() if (m_rlc_len==0) goto close; - for (i=1; 1; i++) // !! laeuft ein byte zu weit !! - { + for (i=1; 1; i++) { // !! laeuft ein byte zu weit !! bool cur0 = m_rlc_buf[i] == 0; if (cur0 != run0 || cnt==0x3f || (cnt0 && cnt==0x0f) || i==m_rlc_len) { if (run0) { @@ -782,59 +781,57 @@ void RlcFile::nextRlcWriteStep() close: - switch(m_write_step) { - case WRITE_START_STEP: - { - blkid_t fri=0; + switch(m_write_step) { + case WRITE_START_STEP: { + blkid_t fri = 0; - if (m_currBlk && (fri=EeFsGetLink(m_currBlk))) { - // TODO reuse EeFsFree!!! - blkid_t prev_freeList = eeFs.freeList; - eeFs.freeList = fri; + if (m_currBlk && (fri = EeFsGetLink(m_currBlk))) { + // TODO reuse EeFsFree!!! + blkid_t prev_freeList = eeFs.freeList; + eeFs.freeList = fri; #if defined(PCBTARANIS) - freeBlocks++; + freeBlocks++; #endif - while( EeFsGetLink(fri)) { - fri = EeFsGetLink(fri); + while (EeFsGetLink(fri)) { + fri = EeFsGetLink(fri); #if defined(PCBTARANIS) - freeBlocks++; + freeBlocks++; #endif - } - m_write_step = WRITE_FREE_UNUSED_BLOCKS_STEP1; - EeFsSetLink(fri, prev_freeList); - return; - } - } + } + m_write_step = WRITE_FREE_UNUSED_BLOCKS_STEP1; + EeFsSetLink(fri, prev_freeList); + return; + } + } - case WRITE_FINAL_DIRENT_STEP: - { - m_currBlk = eeFs.files[FILE_TMP].startBlk; - DirEnt & f = eeFs.files[m_fileId]; - eeFs.files[FILE_TMP].startBlk = f.startBlk; - eeFs.files[FILE_TMP].size = f.size; - f.startBlk = m_currBlk; - f.size = m_pos; - f.typ = eeFs.files[FILE_TMP].typ; - m_write_step = WRITE_TMP_DIRENT_STEP; - EeFsFlushDirEnt(m_fileId); - return; - } + case WRITE_FINAL_DIRENT_STEP: { + m_currBlk = eeFs.files[FILE_TMP].startBlk; + DirEnt & f = eeFs.files[m_fileId]; + eeFs.files[FILE_TMP].startBlk = f.startBlk; + eeFs.files[FILE_TMP].size = f.size; + f.startBlk = m_currBlk; + f.size = m_pos; + f.typ = eeFs.files[FILE_TMP].typ; + m_write_step = WRITE_TMP_DIRENT_STEP; + EeFsFlushDirEnt(m_fileId); + return; + } - case WRITE_TMP_DIRENT_STEP: - m_write_step = 0; - EeFsFlushDirEnt(FILE_TMP); - return; + case WRITE_TMP_DIRENT_STEP: + m_write_step = 0; + EeFsFlushDirEnt(FILE_TMP); + return; - case WRITE_FREE_UNUSED_BLOCKS_STEP1: - m_write_step = WRITE_FREE_UNUSED_BLOCKS_STEP2; - EeFsSetLink(m_currBlk, 0); - return; + case WRITE_FREE_UNUSED_BLOCKS_STEP1: + m_write_step = WRITE_FREE_UNUSED_BLOCKS_STEP2; + EeFsSetLink(m_currBlk, 0); + return; - case WRITE_FREE_UNUSED_BLOCKS_STEP2: - m_write_step = WRITE_FINAL_DIRENT_STEP; - EeFsFlushFreelist(); - return; - } + case WRITE_FREE_UNUSED_BLOCKS_STEP2: + m_write_step = WRITE_FINAL_DIRENT_STEP; + EeFsFlushFreelist(); + return; + } } void RlcFile::flush() @@ -978,7 +975,7 @@ void eeLoadModel(uint8_t id) #endif #if defined(CPUARM) && defined(SDCARD) - refreshModelAudioFiles(); + referenceModelAudioFiles(); #endif LOAD_MODEL_BITMAP(); diff --git a/radio/src/eeprom_rlc.h b/radio/src/eeprom_rlc.h index bec337033..db285a6fe 100644 --- a/radio/src/eeprom_rlc.h +++ b/radio/src/eeprom_rlc.h @@ -161,10 +161,10 @@ inline uint8_t write_errno() { return s_write_err; } class RlcFile: public EFile { - uint8_t m_bRlc; // control byte for run length decoder - uint8_t m_zeroes; + uint8_t m_bRlc; // control byte for run length decoder + uint8_t m_zeroes; - uint8_t m_flags; + uint8_t m_flags; #define WRITE_FIRST_LINK 0x01 #define WRITE_NEXT_LINK_1 0x02 #define WRITE_NEXT_LINK_2 0x03 @@ -173,41 +173,41 @@ class RlcFile: public EFile #define WRITE_FREE_UNUSED_BLOCKS_STEP2 0x30 #define WRITE_FINAL_DIRENT_STEP 0x40 #define WRITE_TMP_DIRENT_STEP 0x50 - uint8_t m_write_step; - uint16_t m_rlc_len; - uint8_t * m_rlc_buf; - uint8_t m_cur_rlc_len; - uint8_t m_write1_byte; - uint8_t m_write_len; - uint8_t * m_write_buf; + uint8_t m_write_step; + uint16_t m_rlc_len; + uint8_t * m_rlc_buf; + uint8_t m_cur_rlc_len; + uint8_t m_write1_byte; + uint8_t m_write_len; + uint8_t * m_write_buf; #if defined (EEPROM_PROGRESS_BAR) - uint8_t m_ratio; + uint8_t m_ratio; #endif -public: + public: - void openRlc(uint8_t i_fileId); + void openRlc(uint8_t i_fileId); - void create(uint8_t i_fileId, uint8_t typ, uint8_t sync_write); + void create(uint8_t i_fileId, uint8_t typ, uint8_t sync_write); - /// copy contents of i_fileSrc to i_fileDst - bool copy(uint8_t i_fileDst, uint8_t i_fileSrc); + /// copy contents of i_fileSrc to i_fileDst + bool copy(uint8_t i_fileDst, uint8_t i_fileSrc); - inline bool isWriting() { return m_write_step != 0; } - void write(uint8_t *buf, uint8_t i_len); - void write1(uint8_t b); - void nextWriteStep(); - void nextRlcWriteStep(); - void writeRlc(uint8_t i_fileId, uint8_t typ, uint8_t *buf, uint16_t i_len, uint8_t sync_write); + inline bool isWriting() { return m_write_step != 0; } + void write(uint8_t *buf, uint8_t i_len); + void write1(uint8_t b); + void nextWriteStep(); + void nextRlcWriteStep(); + void writeRlc(uint8_t i_fileId, uint8_t typ, uint8_t *buf, uint16_t i_len, uint8_t sync_write); - // flush the current write operation if any - void flush(); + // flush the current write operation if any + void flush(); - // read from opened file and decode rlc-coded data - uint16_t readRlc(uint8_t *buf, uint16_t i_len); + // read from opened file and decode rlc-coded data + uint16_t readRlc(uint8_t *buf, uint16_t i_len); #if defined (EEPROM_PROGRESS_BAR) - void DisplayProgressBar(uint8_t x); + void DisplayProgressBar(uint8_t x); #endif }; diff --git a/radio/src/fonts/sqt5/font_05x07_B_compressed.png b/radio/src/fonts/sqt5/font_05x07_B_compressed.png index 8e4ac6632..64c8545ec 100644 Binary files a/radio/src/fonts/sqt5/font_05x07_B_compressed.png and b/radio/src/fonts/sqt5/font_05x07_B_compressed.png differ diff --git a/radio/src/fonts/std/font_05x07_B_compressed.png b/radio/src/fonts/std/font_05x07_B_compressed.png index 985ded8a1..d2e197228 100644 Binary files a/radio/src/fonts/std/font_05x07_B_compressed.png and b/radio/src/fonts/std/font_05x07_B_compressed.png differ diff --git a/radio/src/gtests.cpp b/radio/src/gtests.cpp index 5530d21a2..dbb8df463 100644 --- a/radio/src/gtests.cpp +++ b/radio/src/gtests.cpp @@ -91,8 +91,6 @@ TEST(Trims, infiniteChainedTrims) TEST(outdezNAtt, test_unsigned) { - uint16_t altitude = 65530; - uint8_t refBuf[sizeof(displayBuf)]; memset(displayBuf, 0, sizeof(displayBuf)); lcd_putc(0*FWNUM, 0, '6'); @@ -103,12 +101,12 @@ TEST(outdezNAtt, test_unsigned) memcpy(refBuf, displayBuf, sizeof(displayBuf)); memset(displayBuf, 0, sizeof(displayBuf)); - lcd_outdezNAtt(1, 0, altitude, LEFT|UNSIGN); + lcd_outdezNAtt(0, 0, 65530, LEFT|UNSIGN); EXPECT_EQ(memcmp(refBuf, displayBuf, sizeof(displayBuf)), 0) << "Unsigned numbers will be bad displayed"; } -TEST(EEPROM, 1000_random_writes) +TEST(EEPROM, 100_random_writes) { eepromFile = NULL; // in memory RlcFile f; @@ -117,7 +115,7 @@ TEST(EEPROM, 1000_random_writes) EeFsFormat(); - for(int i=0; i<1000; i++) { + for(int i=0; i<100; i++) { int size = rand()%800; for(int j=0; j 200); /*2 seconds*/ + + if (first2seconds) { + menuTitle = STR_GLOBAL_V; + for (int i=0; i0) ? BLINK|INVERS : INVERS) : 0); - xcoord_t x = 12*FW + FWNUM + (j-1)*(2+3*FWNUM) - 3; + xcoord_t x = GVARS_FM_COLUMN(j-1); #if MAX_GVARS == 6 if (i==0 && j!=9) putsStrIdx(x+2, FH+1, STR_FP, j, SMLSIZE); @@ -4363,7 +4379,7 @@ void menuModelLogicalSwitchOne(uint8_t event) case LS_FIELD_DURATION: lcd_putsLeft(y, STR_DURATION); if (cs->duration > 0) - lcd_outdezAtt(CSWONE_2ND_COLUMN, y, 5*cs->duration, attr|PREC1|LEFT); + lcd_outdezAtt(CSWONE_2ND_COLUMN, y, cs->duration, attr|PREC1|LEFT); else lcd_putsiAtt(CSWONE_2ND_COLUMN, y, STR_MMMINV, 0, attr); if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, cs->duration, MAX_LS_DURATION); @@ -4371,7 +4387,7 @@ void menuModelLogicalSwitchOne(uint8_t event) case LS_FIELD_DELAY: lcd_putsLeft(y, STR_DELAY); if (cs->delay > 0) - lcd_outdezAtt(CSWONE_2ND_COLUMN, y, 5*cs->delay, attr|PREC1|LEFT); + lcd_outdezAtt(CSWONE_2ND_COLUMN, y, cs->delay, attr|PREC1|LEFT); else lcd_putsiAtt(CSWONE_2ND_COLUMN, y, STR_MMMINV, 0, attr); if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, cs->delay, MAX_LS_DELAY); @@ -4543,11 +4559,11 @@ void menuModelLogicalSwitches(uint8_t event) // CSW params uint8_t cstate = cswFamily(cs->func); #if defined(CPUARM) - int16_t v1_unsigned=(uint8_t)cs->v1, v1_min=0, v1_max=MIXSRC_LAST_TELEM, v2_min=0, v2_max=MIXSRC_LAST_TELEM; + int16_t v1_val=cs->v1, v1_min=0, v1_max=MIXSRC_LAST_TELEM, v2_min=0, v2_max=MIXSRC_LAST_TELEM; int16_t v3_min=0, v3_max=100; #else int8_t v1_min=0, v1_max=MIXSRC_LAST_TELEM, v2_min=0, v2_max=MIXSRC_LAST_TELEM; - uint8_t v1_unsigned = cs->v1; + #define v1_val cs->v1 #endif if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) { @@ -4583,7 +4599,7 @@ void menuModelLogicalSwitches(uint8_t event) } #endif else if (cstate == LS_FAMILY_COMP) { - putsMixerSource(CSW_2ND_COLUMN, y, v1_unsigned, attr1); + putsMixerSource(CSW_2ND_COLUMN, y, v1_val, attr1); putsMixerSource(CSW_3RD_COLUMN, y, cs->v2, attr2); INCDEC_SET_FLAG(INCDEC_SOURCE); INCDEC_ENABLE_CHECK(isSourceAvailable); @@ -4597,7 +4613,10 @@ void menuModelLogicalSwitches(uint8_t event) INCDEC_ENABLE_CHECK(NULL); } else { - putsMixerSource(CSW_2ND_COLUMN, y, v1_unsigned, attr1); +#if defined(CPUARM) + v1_val = (uint8_t)cs->v1; +#endif + putsMixerSource(CSW_2ND_COLUMN, y, v1_val, attr1); if (horz == 1) { INCDEC_SET_FLAG(INCDEC_SOURCE); INCDEC_ENABLE_CHECK(isSourceAvailable); @@ -4607,11 +4626,11 @@ void menuModelLogicalSwitches(uint8_t event) INCDEC_ENABLE_CHECK(NULL); } #if defined(FRSKY) - if (v1_unsigned >= MIXSRC_FIRST_TELEM) { - putsTelemetryChannel(CSW_3RD_COLUMN, y, v1_unsigned - MIXSRC_FIRST_TELEM, convertCswTelemValue(cs), LEFT|attr2); - v2_max = maxTelemValue(v1_unsigned - MIXSRC_FIRST_TELEM + 1); + if (v1_val >= MIXSRC_FIRST_TELEM) { + putsTelemetryChannel(CSW_3RD_COLUMN, y, v1_val - MIXSRC_FIRST_TELEM, convertCswTelemValue(cs), LEFT|attr2); + v2_max = maxTelemValue(v1_val - MIXSRC_FIRST_TELEM + 1); #if defined(CPUARM) - v2_min = minTelemValue(v1_unsigned - MIXSRC_FIRST_TELEM + 1); + v2_min = minTelemValue(v1_val - MIXSRC_FIRST_TELEM + 1); if (cs->v2 < v2_min || cs->v2 > v2_max) { cs->v2 = 0; eeDirty(EE_MODEL); @@ -4636,8 +4655,8 @@ void menuModelLogicalSwitches(uint8_t event) v2_min = -125; v2_max = 125; } #else - if (v1_unsigned >= MIXSRC_FIRST_TELEM) { - putsTelemetryChannel(CSW_3RD_COLUMN, y, v1_unsigned - MIXSRC_FIRST_TELEM, convertCswTelemValue(cs), LEFT|attr2); + if (v1_val >= MIXSRC_FIRST_TELEM) { + putsTelemetryChannel(CSW_3RD_COLUMN, y, v1_val - MIXSRC_FIRST_TELEM, convertCswTelemValue(cs), LEFT|attr2); v2_min = -128; v2_max = 127; } else { @@ -4661,7 +4680,7 @@ void menuModelLogicalSwitches(uint8_t event) #if defined(CPUARM) // CSW duration if (cs->duration > 0) - lcd_outdezAtt(CSW_5TH_COLUMN, y, 5*cs->duration, (horz==LS_FIELD_DURATION ? attr : 0)|PREC1|LEFT); + lcd_outdezAtt(CSW_5TH_COLUMN, y, cs->duration, (horz==LS_FIELD_DURATION ? attr : 0)|PREC1|LEFT); else lcd_putsiAtt(CSW_5TH_COLUMN, y, STR_MMMINV, 0, horz==LS_FIELD_DURATION ? attr : 0); @@ -4673,7 +4692,7 @@ void menuModelLogicalSwitches(uint8_t event) } } else if (cs->delay > 0) { - lcd_outdezAtt(CSW_6TH_COLUMN, y, 5*cs->delay, (horz==LS_FIELD_DELAY ? attr : 0)|PREC1|LEFT); + lcd_outdezAtt(CSW_6TH_COLUMN, y, cs->delay, (horz==LS_FIELD_DELAY ? attr : 0)|PREC1|LEFT); } else { lcd_putsiAtt(CSW_6TH_COLUMN, y, STR_MMMINV, 0, horz==LS_FIELD_DELAY ? attr : 0); @@ -4712,17 +4731,17 @@ void menuModelLogicalSwitches(uint8_t event) break; } case LS_FIELD_V1: - cs->v1 = CHECK_INCDEC_PARAM(event, v1_unsigned, v1_min, v1_max); + cs->v1 = CHECK_INCDEC_PARAM(event, v1_val, v1_min, v1_max); break; case LS_FIELD_V2: cs->v2 = CHECK_INCDEC_PARAM(event, cs->v2, v2_min, v2_max); #if defined(PCBTARANIS) - if (cstate==LS_FAMILY_OFS && v1_unsigned!=0 && event==EVT_KEY_LONG(KEY_ENTER)) { + if (cstate==LS_FAMILY_OFS && cs->v1!=0 && event==EVT_KEY_LONG(KEY_ENTER)) { killEvents(event); - getvalue_t x = getValue(v1_unsigned); - if (v1_unsigned < MIXSRC_GVAR1) + getvalue_t x = getValue(v1_val); + if (v1_val < MIXSRC_GVAR1) cs->v2 = calcRESXto100(x); - else if (v1_unsigned - MIXSRC_FIRST_TELEM + 1 == TELEM_ALT) + else if (v1_val - MIXSRC_FIRST_TELEM + 1 == TELEM_ALT) cs->v2 *= 100; eeDirty(EE_MODEL); } @@ -5139,8 +5158,8 @@ void onModelCustomScriptMenu(const char *result) ScriptData &sd = g_model.scriptsData[s_currIdx]; if (result == STR_UPDATE_LIST) { - if (!listSdFiles(SCRIPTS_PATH, MIXES_EXT, sizeof(sd.file), NULL)) { - POPUP_WARNING(STR_NO_BITMAPS_ON_SD); + if (!listSdFiles(SCRIPTS_PATH, SCRIPTS_EXT, sizeof(sd.file), NULL)) { + POPUP_WARNING(STR_NO_SCRIPTS_ON_SD); s_menu_flags = 0; } } @@ -5187,7 +5206,7 @@ void menuModelCustomScriptOne(uint8_t event) lcd_putsiAtt(SCRIPT_ONE_2ND_COLUMN_POS, y, STR_VCSWFUNC, 0, attr); if (attr && event==EVT_KEY_BREAK(KEY_ENTER) && !READ_ONLY()) { s_editMode = 0; - if (listSdFiles(SCRIPTS_PATH, MIXES_EXT, sizeof(sd.file), sd.file, LIST_NONE_SD_FILE)) { + if (listSdFiles(SCRIPTS_PATH, SCRIPTS_EXT, sizeof(sd.file), sd.file, LIST_NONE_SD_FILE)) { menuHandler = onModelCustomScriptMenu; } else { @@ -5627,10 +5646,7 @@ void menuModelTelemetry(uint8_t event) } #else lcd_outdezAtt(TELEM_COL2, y, -10+g_model.frsky.varioMin, (m_posHorz<=0 ? attr : 0)|LEFT); - if (g_model.frsky.varioCenterMin == -16) - lcd_putsAtt(TELEM_COL2+4*FW-2, y, STR_OFF, m_posHorz==1 ? attr : 0); - else - lcd_outdezAtt(TELEM_COL2+7*FW-2, y, -5+g_model.frsky.varioCenterMin, ((m_posHorz<0 || m_posHorz==1) ? attr : 0)|PREC1); + lcd_outdezAtt(TELEM_COL2+7*FW-2, y, -5+g_model.frsky.varioCenterMin, ((m_posHorz<0 || m_posHorz==1) ? attr : 0)|PREC1); lcd_outdezAtt(TELEM_COL2+10*FW, y, 5+g_model.frsky.varioCenterMax, ((m_posHorz<0 || m_posHorz==2) ? attr : 0)|PREC1); lcd_outdezAtt(TELEM_COL2+13*FW+2, y, 10+g_model.frsky.varioMax, ((m_posHorz<0 || m_posHorz==3) ? attr : 0)); if (attr && (s_editMode>0 || p1valdiff)) { diff --git a/radio/src/gui/menus.cpp b/radio/src/gui/menus.cpp index 421c30b57..0c9fe041d 100644 --- a/radio/src/gui/menus.cpp +++ b/radio/src/gui/menus.cpp @@ -358,47 +358,25 @@ void onLongMenuPress(const char *result) } #endif -bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow) +#if defined(CPUARM) +tmr10ms_t menuEntryTime; +#endif + +#if defined(PCBTARANIS) +bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow, uint8_t flags) { vertpos_t l_posVert = m_posVert; horzpos_t l_posHorz = m_posHorz; uint8_t maxcol = MAXCOL(l_posVert); -#ifdef NAVIGATION_POT1 - // check pot 1 - if changed -> scroll values - static int16_t p1val; - static int16_t p1valprev; - p1valdiff = (p1val-calibratedStick[6]) / SCROLL_POT1_TH; - if (p1valdiff) { - p1valdiff = (p1valprev-calibratedStick[6]) / 2; - p1val = calibratedStick[6]; - } - p1valprev = calibratedStick[6]; -#endif - -#ifdef NAVIGATION_POT2 - // check pot 2 - if changed -> scroll menu - static int16_t p2valprev; - p2valdiff = (p2valprev-calibratedStick[4]) / SCROLL_TH; - if (p2valdiff) p2valprev = calibratedStick[4]; -#endif - -#ifdef NAVIGATION_POT3 - // check pot 3 if changed -> cursor down/up - static int16_t p3valprev; - int8_t scrollUD = (p3valprev-calibratedStick[5]) / SCROLL_TH; - if (scrollUD) p3valprev = calibratedStick[5]; -#else #define scrollUD 0 -#endif if (p2valdiff || scrollUD || p1valdiff) backlightOn(); // on keypress turn the light on if (menuTab) { uint8_t attr = 0; -#if defined(PCBTARANIS) int8_t cc = curr; switch(event) { case EVT_KEY_LONG(KEY_MENU): @@ -435,7 +413,271 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t chainMenu((MenuFuncP)pgm_read_adr(&menuTab[cc])); return false; } + + s_noScroll = 0; + + if (!(flags&CHECK_FLAG_NO_SCREEN_INDEX)) { + displayScreenIndex(curr, menuTabSize, attr); + } + + lcd_filled_rect(0, 0, LCD_W, FH, SOLID, FILL_WHITE|GREY_DEFAULT); + } + + DISPLAY_PROGRESS_BAR(menuTab ? lcdLastPos-2*FW-((curr+1)/10*FWNUM)-2 : 20*FW+1); + + if (s_editMode<=0) { + if (scrollUD) { + l_posVert = limit((int8_t)0, (int8_t)(l_posVert - scrollUD), (int8_t)maxrow); + l_posHorz = min((uint8_t)l_posHorz, MAXCOL(l_posVert)); + } + + if (p2valdiff && l_posVert>0) { + l_posHorz = limit((int8_t)0, (int8_t)((uint8_t)l_posHorz - p2valdiff), (int8_t)maxcol); + } + } + + switch(event) + { + case EVT_ENTRY: + menuEntryTime = get_tmr10ms(); + l_posVert = POS_VERT_INIT; + l_posHorz = POS_HORZ_INIT(l_posVert); + SET_SCROLLBAR_X(LCD_W-1); +#if defined(ROTARY_ENCODER_NAVIGATION) + if (menuTab) { + s_editMode = EDIT_MODE_INIT; + break; + } + // no break #else + s_editMode = EDIT_MODE_INIT; + break; +#endif + + case EVT_ENTRY_UP: + menuEntryTime = get_tmr10ms(); + s_editMode = 0; + l_posHorz = POS_HORZ_INIT(l_posVert); + SET_SCROLLBAR_X(LCD_W-1); + break; + + case EVT_ROTARY_BREAK: + if (s_editMode > 1) break; + if (m_posHorz < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) { + l_posHorz = 0; + break; + } + if (!menuTab || l_posVert>0) { + if (READ_ONLY_UNLOCKED()) { + s_editMode = (s_editMode<=0); + } + } + break; + +#if defined(ROTARY_ENCODER_NAVIGATION) + case EVT_ROTARY_LONG: + if (s_editMode > 1) break; + killEvents(event); + if (l_posVert != POS_VERT_INIT) { + l_posVert = POS_VERT_INIT; + s_editMode = EDIT_MODE_INIT; + break; + } + // no break +#endif + case EVT_KEY_LONG(KEY_EXIT): + s_editMode = 0; // TODO needed? we call ENTRY_UP after which does the same + popMenu(); + return false; + + case EVT_KEY_BREAK(KEY_EXIT): +#if defined(ROTARY_ENCODER_NAVIGATION) + if (s_editMode == 0) + s_editMode = EDIT_MODE_INIT; + else +#endif + if (s_editMode>0) { + s_editMode = 0; + break; + } + + if (l_posHorz >= 0 && (COLATTR(l_posVert) & NAVIGATION_LINE_BY_LINE)) { + l_posHorz = -1; + } + else + { + uint8_t posVertInit = POS_VERT_INIT; + if (s_pgOfs != 0 || l_posVert != posVertInit) { + s_pgOfs = 0; + l_posVert = posVertInit; + l_posHorz = POS_HORZ_INIT(l_posVert); + } + else { + popMenu(); + return false; + } + } + break; + + CASE_EVT_ROTARY_MOVE_RIGHT + if (s_editMode != 0) break; + if ((COLATTR(l_posVert) & NAVIGATION_LINE_BY_LINE)) { + if (l_posHorz >= 0) { + INC(l_posHorz, 0, maxcol); + break; + } + } + else { + if (l_posHorz < maxcol) { + l_posHorz++; + break; + } + else { + l_posHorz = 0; + if (!IS_ROTARY_MOVE_RIGHT(event)) + break; + } + } + + do { + INC(l_posVert, POS_VERT_INIT, maxrow); + } while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert)); + + s_editMode = 0; // if we go down, we must be in this mode + + l_posHorz = POS_HORZ_INIT(l_posVert); + break; + + CASE_EVT_ROTARY_MOVE_LEFT + if (s_editMode != 0) break; + if ((COLATTR(l_posVert) & NAVIGATION_LINE_BY_LINE)) { + if (l_posHorz >= 0) { + DEC(l_posHorz, 0, maxcol); + break; + } + } + else { + if (l_posHorz > 0) { + l_posHorz--; + break; + } + else if (IS_ROTARY_MOVE_LEFT(event) && s_editMode == 0) { + l_posHorz = 0xff; + } + else { + l_posHorz = maxcol; + break; + } + } + + do { + DEC(l_posVert, POS_VERT_INIT, maxrow); + } while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert)); + + s_editMode = 0; // if we go up, we must be in this mode + + if ((COLATTR(l_posVert) & NAVIGATION_LINE_BY_LINE)) + l_posHorz = -1; + else + l_posHorz = min((uint8_t)l_posHorz, MAXCOL(l_posVert)); + + break; + } + +#if defined(CPUARM) + if (l_posVert<1) s_pgOfs=0; + else if (menuTab && horTab) { + vertpos_t realPosVert = l_posVert; + vertpos_t realPgOfs = s_pgOfs; + vertpos_t realMaxrow = maxrow; + for (vertpos_t i=1; i<=maxrow; i++) { + if (MAXCOL(i) == HIDDEN_ROW) { + realMaxrow--; + if (i < l_posVert) + realPosVert--; + if (i < s_pgOfs) + realPgOfs--; + } + } + if (realPosVert>(LCD_LINES-1)+realPgOfs) realPgOfs = realPosVert-(LCD_LINES-1); + else if (realPosVert<1+realPgOfs) realPgOfs = realPosVert-1; + s_pgOfs = realPgOfs; + for (vertpos_t i=1; i<=realPgOfs; i++) { + if (MAXCOL(i) == HIDDEN_ROW) { + s_pgOfs++; + } + } + maxrow = realMaxrow; + } + else { + uint8_t max = menuTab ? LCD_LINES-1 : LCD_LINES-2; + if (l_posVert>max+s_pgOfs) s_pgOfs = l_posVert-max; + else if (l_posVert<1+s_pgOfs) s_pgOfs = l_posVert-1; + } + +#if LCD_W >= 212 + if (maxrow > LCD_LINES-1 && scrollbar_X) + displayScrollbar(scrollbar_X, FH, LCD_H-FH, s_pgOfs, menuTab ? maxrow : maxrow+1, LCD_LINES-1); +#endif + +#else + uint8_t max = menuTab ? LCD_LINES-1 : LCD_LINES-2; + if (l_posVert<1) s_pgOfs=0; + else if (l_posVert>max+s_pgOfs) s_pgOfs = l_posVert-max; + else if (l_posVert<1+s_pgOfs) s_pgOfs = l_posVert-1; +#endif + m_posVert = l_posVert; + m_posHorz = l_posHorz; + if (s_pgOfs > 0) { + l_posVert--; + if (l_posVert == s_pgOfs && CURSOR_NOT_ALLOWED_IN_ROW(l_posVert)) + s_pgOfs = l_posVert-1; + } + return true; +} + +#else // defined(PCBTARANIS) + +bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow) +{ + vertpos_t l_posVert = m_posVert; + horzpos_t l_posHorz = m_posHorz; + + uint8_t maxcol = MAXCOL(l_posVert); + +#if defined(NAVIGATION_POT1) + // check pot 1 - if changed -> scroll values + static int16_t p1val; + static int16_t p1valprev; + p1valdiff = (p1val-calibratedStick[6]) / SCROLL_POT1_TH; + if (p1valdiff) { + p1valdiff = (p1valprev-calibratedStick[6]) / 2; + p1val = calibratedStick[6]; + } + p1valprev = calibratedStick[6]; +#endif + +#if defined(NAVIGATION_POT2) + // check pot 2 - if changed -> scroll menu + static int16_t p2valprev; + p2valdiff = (p2valprev-calibratedStick[4]) / SCROLL_TH; + if (p2valdiff) p2valprev = calibratedStick[4]; +#endif + +#if defined(NAVIGATION_POT3) + // check pot 3 if changed -> cursor down/up + static int16_t p3valprev; + int8_t scrollUD = (p3valprev-calibratedStick[5]) / SCROLL_TH; + if (scrollUD) p3valprev = calibratedStick[5]; +#else + #define scrollUD 0 +#endif + + if (p2valdiff || scrollUD || p1valdiff) backlightOn(); // on keypress turn the light on + + if (menuTab) { + uint8_t attr = 0; + if (l_posVert==0 && !s_noScroll) { attr = INVERS; @@ -496,14 +738,10 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t attr = INVERS|BLINK; #endif } -#endif s_noScroll = 0; displayScreenIndex(curr, menuTabSize, attr); -#if defined(PCBTARANIS) - lcd_filled_rect(0, 0, LCD_W, FH, SOLID, FILL_WHITE|GREY_DEFAULT); -#endif } DISPLAY_PROGRESS_BAR(menuTab ? lcdLastPos-2*FW-((curr+1)/10*FWNUM)-2 : 20*FW+1); @@ -522,6 +760,9 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t switch(event) { case EVT_ENTRY: +#if defined(CPUARM) + menuEntryTime = get_tmr10ms(); +#endif l_posVert = POS_VERT_INIT; l_posHorz = POS_HORZ_INIT(l_posVert); SET_SCROLLBAR_X(LCD_W-1); @@ -536,20 +777,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t break; #endif -#if defined(PCBTARANIS) - case EVT_ENTRY_UP: - s_editMode = 0; - l_posHorz = POS_HORZ_INIT(l_posVert); - SET_SCROLLBAR_X(LCD_W-1); - break; - - case EVT_ROTARY_BREAK: - if (s_editMode > 1) break; - if (m_posHorz < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) { - l_posHorz = 0; - break; - } -#elif defined(ROTARY_ENCODER_NAVIGATION) +#if defined(ROTARY_ENCODER_NAVIGATION) case EVT_ENTRY_UP: s_editMode = 0; SET_SCROLLBAR_X(LCD_W-1); @@ -559,9 +787,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t if (s_editMode > 1) break; #endif -#if !defined(PCBTARANIS) case EVT_KEY_FIRST(KEY_ENTER): -#endif if (!menuTab || l_posVert>0) { if (READ_ONLY_UNLOCKED()) { s_editMode = (s_editMode<=0); @@ -595,24 +821,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t s_editMode = 0; break; } -#if defined(PCBTARANIS) - if (l_posHorz >= 0 && (COLATTR(l_posVert) & NAVIGATION_LINE_BY_LINE)) { - l_posHorz = -1; - } - else - { - uint8_t posVertInit = POS_VERT_INIT; - if (s_pgOfs != 0 || l_posVert != posVertInit) { - s_pgOfs = 0; - l_posVert = posVertInit; - l_posHorz = POS_HORZ_INIT(l_posVert); - } - else { - popMenu(); - return false; - } - } -#else + if (l_posVert==0 || !menuTab) { popMenu(); // beeps itself return false; @@ -622,39 +831,16 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t l_posVert = 0; l_posHorz = 0; } -#endif break; -#if !defined(PCBTARANIS) case EVT_KEY_REPT(KEY_RIGHT): //inc if (l_posHorz==maxcol) break; // no break case EVT_KEY_FIRST(KEY_RIGHT)://inc if (!horTab || s_editMode>0) break; -#endif -#if defined(PCBTARANIS) - CASE_EVT_ROTARY_MOVE_RIGHT - if (s_editMode != 0) break; - if ((COLATTR(l_posVert) & NAVIGATION_LINE_BY_LINE)) { - if (l_posHorz >= 0) { - INC(l_posHorz, 0, maxcol); - break; - } - } - else { - if (l_posHorz < maxcol) { - l_posHorz++; - break; - } - else { - l_posHorz = 0; - if (!IS_ROTARY_MOVE_RIGHT(event)) - break; - } - } -#elif defined(ROTARY_ENCODER_NAVIGATION) +#if defined(ROTARY_ENCODER_NAVIGATION) CASE_EVT_ROTARY_MOVE_RIGHT if (s_editMode != 0) break; if (l_posHorz < maxcol) { @@ -671,61 +857,31 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t break; #endif -#if !defined(PCBTARANIS) case EVT_KEY_REPT(KEY_DOWN): //inc if (!IS_ROTARY_RIGHT(event) && l_posVert==maxrow) break; // no break case EVT_KEY_FIRST(KEY_DOWN): //inc if (s_editMode>0) break; -#endif do { INC(l_posVert, POS_VERT_INIT, maxrow); } while (CURSOR_NOT_ALLOWED_IN_ROW(l_posVert)); -#if defined(ROTARY_ENCODER_NAVIGATION) || defined(PCBTARANIS) +#if defined(ROTARY_ENCODER_NAVIGATION) s_editMode = 0; // if we go down, we must be in this mode #endif -#if defined(PCBTARANIS) - l_posHorz = POS_HORZ_INIT(l_posVert); -#else l_posHorz = min(l_posHorz, MAXCOL(l_posVert)); -#endif break; -#if !defined(PCBTARANIS) case EVT_KEY_REPT(KEY_LEFT): //dec if (l_posHorz==0) break; // no break case EVT_KEY_FIRST(KEY_LEFT)://dec if (!horTab || s_editMode>0) break; -#endif -#if defined(PCBTARANIS) - CASE_EVT_ROTARY_MOVE_LEFT - if (s_editMode != 0) break; - if ((COLATTR(l_posVert) & NAVIGATION_LINE_BY_LINE)) { - if (l_posHorz >= 0) { - DEC(l_posHorz, 0, maxcol); - break; - } - } - else { - if (l_posHorz > 0) { - l_posHorz--; - break; - } - else if (IS_ROTARY_MOVE_LEFT(event) && s_editMode == 0) { - l_posHorz = 0xff; - } - else { - l_posHorz = maxcol; - break; - } - } -#elif defined(ROTARY_ENCODER_NAVIGATION) +#if defined(ROTARY_ENCODER_NAVIGATION) CASE_EVT_ROTARY_MOVE_LEFT if (s_editMode != 0) break; if (l_posHorz > 0) { @@ -744,13 +900,11 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t break; #endif -#if !defined(PCBTARANIS) case EVT_KEY_REPT(KEY_UP): //dec if (!IS_ROTARY_LEFT(event) && l_posVert==0) break; // no break case EVT_KEY_FIRST(KEY_UP): //dec if (s_editMode>0) break; -#endif do { DEC(l_posVert, POS_VERT_INIT, maxrow); @@ -760,14 +914,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t s_editMode = 0; // if we go up, we must be in this mode #endif -#if defined(PCBTARANIS) - if ((COLATTR(l_posVert) & NAVIGATION_LINE_BY_LINE)) - l_posHorz = -1; - else - l_posHorz = min((uint8_t)l_posHorz, MAXCOL(l_posVert)); -#else l_posHorz = min((uint8_t)l_posHorz, MAXCOL(l_posVert)); -#endif break; } @@ -825,6 +972,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t #endif return true; } +#endif MenuFuncP g_menuStack[5]; uint8_t g_menuPos[4]; diff --git a/radio/src/gui/menus.h b/radio/src/gui/menus.h index 9f2d87c2d..3ee37c250 100644 --- a/radio/src/gui/menus.h +++ b/radio/src/gui/menus.h @@ -88,6 +88,10 @@ inline void displayColumnHeader(const char **headers, uint8_t index) #define horzpos_t uint8_t #endif +#if defined(CPUARM) + extern tmr10ms_t menuEntryTime; +#endif + extern vertpos_t m_posVert; extern horzpos_t m_posHorz; extern vertpos_t s_pgOfs; @@ -235,7 +239,14 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max); #else #define NAVIGATION_LINE_BY_LINE 0 #endif -bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *subTab, uint8_t subTabMax, vertpos_t maxrow); + +#if defined(PCBTARANIS) + #define CHECK_FLAG_NO_SCREEN_INDEX 1 + bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow, uint8_t flags=0); +#else + bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow); +#endif + bool check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t maxrow); bool check_submenu_simple(check_event_t event, uint8_t maxrow); @@ -251,11 +262,19 @@ void title(const pm_char * s); #define MENU_CHECK(tab, menu, lines_count) \ check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, (lines_count)-1) +#define MENU_CHECK_FLAGS(tab, menu, flags, lines_count) \ + check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, (lines_count)-1, flags) + #define MENU(title, tab, menu, lines_count, ...) \ MENU_TAB(__VA_ARGS__); \ if (!MENU_CHECK(tab, menu, lines_count)) return; \ TITLE(title) +#define MENU_FLAGS(title, tab, menu, flags, lines_count, ...) \ + MENU_TAB(__VA_ARGS__); \ + if (!MENU_CHECK_FLAGS(tab, menu, flags, lines_count)) return; \ + TITLE(title) + #define SIMPLE_MENU_NOTITLE(tab, menu, lines_count) \ if (!check_simple(event,menu,tab,DIM(tab),(lines_count)-1)) return; diff --git a/radio/src/lua.cpp b/radio/src/lua.cpp index 0e18824fa..1a2ab9e1a 100644 --- a/radio/src/lua.cpp +++ b/radio/src/lua.cpp @@ -935,10 +935,10 @@ void luaLoadModelScript(uint8_t index) sid.state = SCRIPT_NOFILE; if (ZEXIST(sd.file)) { - char filename[sizeof(SCRIPTS_PATH)+sizeof(sd.file)+sizeof(MIXES_EXT)] = SCRIPTS_PATH "/"; + char filename[sizeof(SCRIPTS_PATH)+sizeof(sd.file)+sizeof(SCRIPTS_EXT)] = SCRIPTS_PATH "/"; strncpy(filename+sizeof(SCRIPTS_PATH), sd.file, sizeof(sd.file)); filename[sizeof(SCRIPTS_PATH)+sizeof(sd.file)] = '\0'; - strcat(filename+sizeof(SCRIPTS_PATH), MIXES_EXT); + strcat(filename+sizeof(SCRIPTS_PATH), SCRIPTS_EXT); luaLoad(filename, sid); } } diff --git a/radio/src/maths.cpp b/radio/src/maths.cpp index 271aac8f3..63e57eaeb 100644 --- a/radio/src/maths.cpp +++ b/radio/src/maths.cpp @@ -114,7 +114,55 @@ void getGpsDistance() } #endif -#if defined(FRSKY) && defined(VARIO) +#if defined(CPUARM) + +void varioWakeup() +{ + if (isFunctionActive(FUNCTION_VARIO)) { + int varioFreq, varioDuration, varioPause=0; + uint8_t varioFlags; + + int verticalSpeed = frskyData.hub.varioSpeed; + +#if 0 + if (g_model.frsky.varioSource == VARIO_SOURCE_DTE) { + #warning "Ele stick for vario tests" + verticalSpeed = getValue(MIXSRC_Ele); + } +#endif + + int varioCenterMin = (int)g_model.frsky.varioCenterMin * 10 - 50; + int varioCenterMax = (int)g_model.frsky.varioCenterMax * 10 + 50; + int varioMax = (10+(int)g_model.frsky.varioMax) * 100; + int varioMin = (-10+(int)g_model.frsky.varioMin) * 100; + + if (verticalSpeed > varioMax) + verticalSpeed = varioMax; + else if (verticalSpeed < varioMin) + verticalSpeed = varioMin; + + if (verticalSpeed > varioCenterMin) { + varioFreq = VARIO_FREQUENCY_ZERO + (g_eeGeneral.varioPitch*10) + (((VARIO_FREQUENCY_RANGE+(g_eeGeneral.varioRange*10)) * (verticalSpeed-varioCenterMin)) / varioMax); + int varioPeriod = VARIO_REPEAT_MAX + ((VARIO_REPEAT_ZERO+(g_eeGeneral.varioRepeat*10)-VARIO_REPEAT_MAX) * (varioMax-verticalSpeed) * (varioMax-verticalSpeed)) / ((varioMax-varioCenterMin) * (varioMax-varioCenterMin)); + if (verticalSpeed >= varioCenterMax || varioCenterMin == varioCenterMax) + varioDuration = varioPeriod / 5; + else + varioDuration = varioPeriod * (85 - (((verticalSpeed-varioCenterMin) * 25) / (varioCenterMax-varioCenterMin))) / 100; + varioPause = varioPeriod - varioDuration; + varioFlags = PLAY_BACKGROUND; + } + else { + varioFreq = VARIO_FREQUENCY_ZERO + (g_eeGeneral.varioPitch*10) - (((VARIO_FREQUENCY_ZERO+(g_eeGeneral.varioPitch*10)-((VARIO_FREQUENCY_ZERO + (g_eeGeneral.varioPitch*10))/2)) * (verticalSpeed-varioCenterMin)) / varioMin); + varioDuration = 80; // continuous beep: we will enter again here before the tone ends + varioFlags = PLAY_BACKGROUND|PLAY_NOW; + } + + AUDIO_VARIO(varioFreq, varioDuration, varioPause, varioFlags); + } +} + +#elif defined(FRSKY) && defined(VARIO) + void varioWakeup() { static tmr10ms_t s_varioTmr; @@ -135,60 +183,35 @@ void varioWakeup() verticalSpeed = (verticalSpeed * 10) / ((varioMax-varioCenterMax) / 100); if ((int16_t)(s_varioTmr-tmr10ms) < 0) { - uint8_t SoundVarioBeepTime = (1600 - verticalSpeed) / 100; - uint8_t SoundVarioBeepFreq = (verticalSpeed * 10 + 16000) >> 8; - s_varioTmr = tmr10ms + (SoundVarioBeepTime*2); - AUDIO_VARIO(SoundVarioBeepFreq, SoundVarioBeepTime); + uint8_t varioFreq = (verticalSpeed * 10 + 16000) >> 8; + uint8_t varioDuration = (1600 - verticalSpeed) / 100; + s_varioTmr = tmr10ms + (varioDuration*2); + AUDIO_VARIO(varioFreq, varioDuration); } } #else - int16_t varioCenterMax = (int16_t)g_model.frsky.varioCenterMax * 10 + 50; - if (verticalSpeed >= varioCenterMax) { - verticalSpeed = verticalSpeed - varioCenterMax; - int16_t varioMax = (10+(int16_t)g_model.frsky.varioMax) * 100; - if (verticalSpeed > varioMax) verticalSpeed = varioMax; - verticalSpeed = (verticalSpeed * 10) / ((varioMax-varioCenterMax) / 100); - } - else { - int16_t varioCenterMin = (int16_t)g_model.frsky.varioCenterMin * 10 - 50; - if (verticalSpeed <= varioCenterMin) { - verticalSpeed = verticalSpeed - varioCenterMin; - int16_t varioMin = (-10+(int16_t)g_model.frsky.varioMin) * 100; - if (verticalSpeed < varioMin) verticalSpeed = varioMin; - verticalSpeed = (verticalSpeed * 10) / ((varioCenterMin-varioMin) / 100); - } - else { - return; - } - } + int varioCenterMin = (int)g_model.frsky.varioCenterMin * 10 - 50; + int varioCenterMax = (int)g_model.frsky.varioCenterMax * 10 + 50; + int varioMax = (10+(int)g_model.frsky.varioMax) * 100; + int varioMin = (-10+(int)g_model.frsky.varioMin) * 100; - if (verticalSpeed < 0 || (int16_t)(s_varioTmr-tmr10ms) < 0) { -#if defined(CPUARM) - int SoundVarioBeepTime; - int SoundVarioBeepFreq; + if (verticalSpeed > varioMax) + verticalSpeed = varioMax; + else if (verticalSpeed < varioMin) + verticalSpeed = varioMin; + + if ((int16_t)(s_varioTmr - tmr10ms) < 0) { + uint8_t varioFreq, varioDuration; if (verticalSpeed > 0) { - SoundVarioBeepTime = max(5, 320 - (verticalSpeed >> 2)); - SoundVarioBeepFreq = 1000 + verticalSpeed; + varioFreq = (verticalSpeed * 4 + 8000) >> 7; + varioDuration = (8000 - verticalSpeed * 5) / 100; } else { - SoundVarioBeepTime = 80; - SoundVarioBeepFreq = (verticalSpeed * 3 + 8000) >> 3; + varioFreq = (verticalSpeed * 3 + 8000) >> 7; + varioDuration = 20; } - s_varioTmr = tmr10ms + (SoundVarioBeepTime/5); -#else - uint8_t SoundVarioBeepTime; - uint8_t SoundVarioBeepFreq; - if (verticalSpeed > 0) { - SoundVarioBeepTime = (8000 - verticalSpeed * 5) / 100; - SoundVarioBeepFreq = (verticalSpeed * 4 + 8000) >> 7; - } - else { - SoundVarioBeepTime = 20; - SoundVarioBeepFreq = (verticalSpeed * 3 + 8000) >> 7; - } - s_varioTmr = tmr10ms + (SoundVarioBeepTime/2); -#endif - AUDIO_VARIO(SoundVarioBeepFreq, SoundVarioBeepTime); + s_varioTmr = tmr10ms + (varioDuration/2); + AUDIO_VARIO(varioFreq, varioDuration); } #endif @@ -220,4 +243,5 @@ void varioWakeup() s_varioTmr = tmr10ms; } } + #endif diff --git a/radio/src/myeeprom.h b/radio/src/myeeprom.h index 4baa15d7d..29283bd8c 100644 --- a/radio/src/myeeprom.h +++ b/radio/src/myeeprom.h @@ -74,8 +74,8 @@ #define MAX_MIXERS 64 #define MAX_EXPOS 64 #define NUM_CSW 32 // number of custom switches - #define NUM_CFN 32 // number of functions assigned to switches - #define MAX_SCRIPTS 3 + #define NUM_CFN 64 // number of functions assigned to switches + #define MAX_SCRIPTS 7 #define MAX_INPUTS 32 #elif defined(CPUARM) #define MAX_MODELS 60 @@ -84,7 +84,7 @@ #define MAX_MIXERS 64 #define MAX_EXPOS 32 #define NUM_CSW 32 // number of custom switches - #define NUM_CFN 32 // number of functions assigned to switches + #define NUM_CFN 64 // number of functions assigned to switches #elif defined(CPUM2560) || defined(CPUM2561) #define MAX_MODELS 30 #define NUM_CHNOUT 16 // number of real output channels CH1-CH16 @@ -239,6 +239,9 @@ enum BeeperMode { int8_t beepVolume; \ int8_t wavVolume; \ int8_t varioVolume; \ + int8_t varioPitch; \ + int8_t varioRange; \ + int8_t varioRepeat; \ int8_t backgroundVolume; #endif @@ -323,8 +326,9 @@ enum BacklightMode { #define SPLASH_MODE uint8_t splashMode:1; uint8_t spare4:2 #endif -#if defined(PCBTARANIS) #define POTS_POS_COUNT 6 + +#if defined(PCBTARANIS) PACK(typedef struct { uint8_t count; uint8_t steps[POTS_POS_COUNT-1]; @@ -519,6 +523,16 @@ PACK(typedef struct t_LimitData { #define MLTPX_REP 2 #if defined(CPUARM) +// highest bit used for small values in mix 128 --> 8 bit is enough +#define GV1_SMALL 128 +// highest bit used for large values in mix 4096 --> 12 bits is used (type for weight and offset has even 16 bits) +#define GV1_LARGE 4096 +// the define GV1_LARGE marks the highest bit value used for this variables +// because this would give too big numbers for ARM, we limit it further for offset and weight +// must be smaller than GV1_LARGE - RESERVE_RANGE_FOR_GVARS -1 +#define GV_RANGE_WEIGHT 500 +#define GV_RANGE_OFFSET 500 + #define DELAY_STEP 10 #define SLOW_STEP 10 #define DELAY_MAX (25*DELAY_STEP) /* 25 seconds */ @@ -584,6 +598,12 @@ PACK( union u_int8int16_t { // #define MD_SETOFFSET(md, val) md->offset = val #else + +// highest bit used for small values in mix 128 --> 8 bit is enough +#define GV1_SMALL 128 +// highest bit used for large values in mix 256 --> 9 bits is used (8 bits + 1 extra bit from weightMode/offsetMode) +#define GV1_LARGE 256 + #define DELAY_STEP 2 #define SLOW_STEP 2 #define DELAY_MAX 15 /* 7.5 seconds */ @@ -670,7 +690,10 @@ PACK( union u_int8int16_t { enum LogicalSwitchesFunctions { LS_FUNC_NONE, +#if defined(CPUARM) LS_FUNC_VEQUAL, // v==offset +#endif + LS_FUNC_VALMOSTEQUAL, // v~=offset LS_FUNC_VPOS, // v>offset LS_FUNC_VNEG, // v DELAY_SWITCH_3POS)) { \ - newPos |= (1 << (sw ## 0 - SW_SA0 + 1)); \ - switchesMidposStart[idx] = 0; \ - } \ - else { \ - if (!switchesMidposStart[idx]) { \ - switchesMidposStart[idx] = get_tmr10ms(); \ - } \ - newPos |= (switchesPos & (0x7 << (sw ## 0 - SW_SA0))); \ - } -void getSwitchesPosition() +uint32_t check3PosSwitchPosition(uint8_t idx, EnumKeys sw, bool startup) +{ + uint32_t result; + uint32_t index; + + if (switchState(sw)) { + index = sw - SW_SA0; + result = (1 << index); + switchesMidposStart[idx] = 0; + } + else if (switchState(EnumKeys(sw+2))) { + index = sw - SW_SA0 + 2; + result = (1 << index); + switchesMidposStart[idx] = 0; + } + else if (startup || (switchesPos & (1 << (sw - SW_SA0 + 1))) || (switchesMidposStart[idx] && (tmr10ms_t)(get_tmr10ms() - switchesMidposStart[idx]) > DELAY_SWITCH_3POS)) { + index = sw - SW_SA0 + 1; + result = (1 << index); + switchesMidposStart[idx] = 0; + } + else { + index = sw - SW_SA0 + 1; + if (!switchesMidposStart[idx]) { + switchesMidposStart[idx] = get_tmr10ms(); + } + result = (switchesPos & (0x7 << (sw - SW_SA0))); + } + + if (!(switchesPos & result)) { + PLAY_SWITCH_MOVED(index); + } + + return result; +} + +#define CHECK_2POS(sw) newPos |= check2PosSwitchPosition(sw ## 0) +#define CHECK_3POS(idx, sw) newPos |= check3PosSwitchPosition(idx, sw ## 0, startup) + +void getSwitchesPosition(bool startup) { uint32_t newPos = 0; CHECK_3POS(0, SW_SA); @@ -1369,13 +1407,17 @@ void getSwitchesPosition() if (calib->count>0 && calib->countcount); uint8_t previousPos = potsPos[i] >> 4; + uint8_t previousStoredPos = potsPos[i] & 0x0F; if (pos != previousPos) { potsLastposStart[i] = get_tmr10ms(); - potsPos[i] = (pos << 4) | (potsPos[i] & 0x0f); + potsPos[i] = (pos << 4) | previousStoredPos; } - else if ((tmr10ms_t)(get_tmr10ms() - potsLastposStart[i]) > DELAY_SWITCH_3POS) { + else if (startup || (tmr10ms_t)(get_tmr10ms() - potsLastposStart[i]) > DELAY_SWITCH_3POS) { potsLastposStart[i] = 0; - potsPos[i] = (pos << 4) | (pos); + potsPos[i] = (pos << 4) | pos; + if (previousStoredPos != pos) { + PLAY_SWITCH_MOVED(SWSRC_LAST_SWITCH+i*POTS_POS_COUNT+pos); + } } } } @@ -1384,16 +1426,14 @@ void getSwitchesPosition() #define SWITCH_POSITION(sw) (switchesPos & (1<<(sw))) #define POT_POSITION(sw) ((potsPos[(sw)/POTS_POS_COUNT] & 0x0f) == ((sw) % POTS_POS_COUNT)) #else -#define getSwitchesPosition() +#define getSwitchesPosition(...) #define SWITCH_POSITION(idx) switchState((EnumKeys)(SW_BASE+(idx))) #endif int16_t csLastValue[NUM_CSW]; #define CS_LAST_VALUE_INIT -32768 -// param swtch may be (negativ sign ignored) -// 0 --> no source -// 1 .. 9 (or max switches) --> returns switch value including 3pos -// others internal switches etc. + +/* recursive function. stack as of today (16/03/2012) grows by 8bytes at each call, which is ok! */ bool getSwitch(int8_t swtch) { bool result; @@ -1548,7 +1588,12 @@ bool getSwitch(int8_t swtch) #endif switch (cs->func) { +#if defined(CPUARM) case LS_FUNC_VEQUAL: + result = (x==y); + break; +#endif + case LS_FUNC_VALMOSTEQUAL: #if defined(GVARS) if (v1 >= MIXSRC_GVAR1 && v1 <= MIXSRC_LAST_GVAR) result = (x==y); @@ -1592,13 +1637,13 @@ bool getSwitch(int8_t swtch) result = false; } else { - cswDelays[cs_idx] = get_tmr10ms() + (cs->delay*50); + cswDelays[cs_idx] = get_tmr10ms() + (cs->delay*10); } } if (cs->duration) { if (result && !cswStates[cs_idx]) { - cswDurations[cs_idx] = get_tmr10ms() + (cs->duration*50); + cswDurations[cs_idx] = get_tmr10ms() + (cs->duration*10); } cswStates[cs_idx] = result; @@ -1613,10 +1658,14 @@ bool getSwitch(int8_t swtch) } #endif - if (result) + if (result) { + if (!(s_last_switch_value&mask)) PLAY_LOGICAL_SWITCH_ON(cs_idx); s_last_switch_value |= mask; - else + } + else { + if (s_last_switch_value&mask) PLAY_LOGICAL_SWITCH_OFF(cs_idx); s_last_switch_value &= ~mask; + } } } @@ -1647,53 +1696,24 @@ int8_t getMovedSwitch() } } #else - // saves about 50 bytes flash // return delivers 1 to 3 for ID1 to ID3 // 4..8 for all other switches if changed to true // -4..-8 for all other switches if changed to false // 9 for Trainer switch if changed to true; Change to false is ignored - - swstate_t mask=0x80; + swstate_t mask = 0x80; for (uint8_t i=NUM_PSWITCH; i>1; i--) { bool prev; - // mask= (1<<(i-2)); - prev=(switches_states & mask); + prev = (switches_states & mask); // don't use getSwitch here to always get the proper value, even getSwitch manipulates - // bool next = getSwitch(i); - bool next = switchState((EnumKeys)(SW_BASE+i-1)); - if (prev!=next) { - if (((i3)) || next==true) - result = next ? i : -i; - if ((i<=3) && (result==0)) result=1; - switches_states ^= mask; - } - mask>>=1; - } //endfor - -/* - for (uint8_t i=NUM_PSWITCH; i>0; i--) { - bool prev; - swstate_t mask = 0; - if (i <= 3) { - prev = ((switches_states & 0x03) == (i-1)); - } - else { - mask = (1<<(i-2)); - prev = (switches_states & mask); - } - // don't use getSwitch here to always get the proper value, because getSwitch manipulates - // bool next = getSwitch(i); bool next = switchState((EnumKeys)(SW_BASE+i-1)); if (prev != next) { - if (i!=NUM_PSWITCH || next==true) + if (((i3)) || next==true) result = next ? i : -i; - if (mask) - switches_states ^= mask; - else { - switches_states = (switches_states & 0xFC) | (i-1); - } + if (i<=3 && result==0) result = 1; + switches_states ^= mask; } - } //endfor */ + mask >>= 1; + } #endif if ((tmr10ms_t)(get_tmr10ms() - s_move_last_time) > 10) @@ -2312,6 +2332,8 @@ void checkAll() #endif clearKeyEvents(); + + SKIP_AUTOMATIC_PROMPTS(); } #if defined(MODULE_ALWAYS_SEND_PULSES) @@ -2360,30 +2382,39 @@ void checkTHR() if (g_model.disableThrottleWarning) return; getADC(); evalInputs(e_perout_mode_notrainer); // let do evalInputs do the job + int16_t v = calibratedStick[thrchn]; if (v<=(THRCHK_DEADBAND-1024)) return; // prevent warning if throttle input OK + // first - display warning; also deletes inputs if any have been before MESSAGE(STR_THROTTLEWARN, STR_THROTTLENOTIDLE, STR_PRESSANYKEYTOSKIP, AU_THROTTLE_ALERT); - while (1) { - SIMU_SLEEP(1); - getADC(); + while (1) { + + SIMU_SLEEP(1); - evalInputs(e_perout_mode_notrainer); // let do evalInputs do the job - v = calibratedStick[thrchn]; - if (pwrCheck()==e_power_off || keyDown() || v<=(THRCHK_DEADBAND-1024)) - break; + getADC(); + + evalInputs(e_perout_mode_notrainer); // let do evalInputs do the job + v = calibratedStick[thrchn]; + + if (pwrCheck()==e_power_off || keyDown() || v<=(THRCHK_DEADBAND-1024)) + break; - checkBacklight(); - wdt_reset(); - }//endwhile + checkBacklight(); + + wdt_reset(); + } #endif } void checkAlarm() // added by Gohst { - if (g_eeGeneral.disableAlarmWarning) return; - if (IS_SOUND_OFF()) ALERT(STR_ALARMSWARN, STR_ALARMSDISABLED, AU_ERROR); + if (g_eeGeneral.disableAlarmWarning) + return; + + if (IS_SOUND_OFF()) + ALERT(STR_ALARMSWARN, STR_ALARMSDISABLED, AU_ERROR); } void checkSwitches() @@ -2414,19 +2445,21 @@ void checkSwitches() for (uint8_t i=0; i> 6; - if(potMode) { + if (potMode) { perOut(e_perout_mode_normal, 0); bad_pots = 0; - for (uint8_t i=0; i> 3)) > 2)) { - warn = true; - bad_pots |= (1<> 3)) > 2)) { + warn = true; + bad_pots |= (1<> (i*2)]; @@ -2464,7 +2497,7 @@ void checkSwitches() lcd_putcAtt(60+i*(2*FW+FW/2)+FW, 4*FH+3, c, attr); } } - if(potMode) { + if (potMode) { for (uint8_t i=0; i (getValue(MIXSRC_FIRST_POT+i) >> 3) ? 126 : 127); break; - case 2: - case 3: + case 2: + case 3: lcd_putc(60+i*(5*FW)+2*FW+2, 6*FH-2, g_model.potPosition[i] > (getValue(MIXSRC_FIRST_POT+i) >> 3) ? '\300' : '\301'); break; } @@ -2493,11 +2526,11 @@ void checkSwitches() for (uint8_t i=0; i0?(i+3):(states&0x3)+1), attr); + attr = (states & (1 << (i+1))) == (switches_states & (1 << (i+1))) ? 0 : INVERS; + if (!(g_model.nSwToWarn & (1<0?(i+3):(states&0x3)+1), attr); x += 3*FW+FW/2; } #endif @@ -2639,7 +2672,7 @@ uint8_t checkTrim(uint8_t event) thro = (idx==THR_STICK && g_model.thrTrim); #endif int8_t trimInc = g_model.trimInc + 1; - int8_t v = (trimInc==-1) ? min(32, abs(before)/4+1) : (1 << trimInc); + int8_t v = (trimInc==-1) ? min(32, abs(before)/4+1) : (1 << trimInc); // TODO flash saving if (trimInc < 0) if (thro) v = 4; // if throttle trim and trim trottle then step=4 int16_t after = (k&1) ? before + v : before - v; // positive = k&1 #if defined(CPUARM) @@ -2956,11 +2989,14 @@ void resetAll() #if defined(FRSKY) resetTelemetry(); #endif - for (uint8_t i=0; ispeedDown && md->mltpx!=MLTPX_REP) { + if ((md->speedDown || md->speedUp) && md->mltpx!=MLTPX_REP) { if (mixCondition) { v = (md->mltpx == MLTPX_ADD ? 0 : RESX); apply_offset_and_curve = false; @@ -3803,6 +3834,7 @@ void perOut(uint8_t mode, uint8_t tick10ms) //========== SPEED =============== // now its on input side, but without weight compensation. More like other remote controls // lower weight causes slower movement + if (mode <= e_perout_mode_inactive_phase && (md->speedUp || md->speedDown)) { // there are delay values #define DEL_MULT_SHIFT 8 // we recale to a mult 256 higher value for calculation @@ -3963,17 +3995,25 @@ void doMixerCalculations() PORTH |= 0x40; // PORTH:6 LOW->HIGH signals start of mixer interrupt #endif - static tmr10ms_t lastTMR; + static tmr10ms_t lastTMR = 0; tmr10ms_t tmr10ms = get_tmr10ms(); - uint8_t tick10ms = (tmr10ms >= lastTMR ? tmr10ms - lastTMR : 1); // handle tick10ms overrun - //@@@ open.20.fsguruh: correct overflow handling costs a lot of code; happens only each 11 min; + uint8_t tick10ms = (tmr10ms >= lastTMR ? tmr10ms - lastTMR : 1); + // handle tick10ms overrun + // correct overflow handling costs a lot of code; happens only each 11 min; // therefore forget the exact calculation and use only 1 instead; good compromise + +#if !defined(CPUARM) lastTMR = tmr10ms; +#endif getADC(); - getSwitchesPosition(); + getSwitchesPosition(lastTMR == 0); + +#if defined(CPUARM) + lastTMR = tmr10ms; +#endif #if defined(PCBSKY9X) && !defined(REVA) && !defined(SIMU) Current_analogue = (Current_analogue*31 + s_anaFilt[8] ) >> 5 ; @@ -4636,7 +4676,7 @@ void perMain() checkBacklight(); -#if defined(FRSKY) || defined(MAVLINK) +#if !defined(CPUARM) && (defined(FRSKY) || defined(MAVLINK)) telemetryWakeup(); #endif @@ -5294,6 +5334,10 @@ void mixerTask(void * pdata) CoLeaveMutexSection(mixerMutex); if (tick10ms) checkTrims(); +#if defined(FRSKY) || defined(MAVLINK) + telemetryWakeup(); +#endif + if (heartbeat == HEART_WDT_CHECK) { wdt_reset(); heartbeat = 0; diff --git a/radio/src/opentx.h b/radio/src/opentx.h index ee6c75ecd..4b8da9dbe 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -585,24 +585,28 @@ extern uint8_t channel_order(uint8_t x); class Key { #define FILTERBITS 4 + #ifdef SIMU -#define FFVAL 1 + #define FFVAL 1 #else -#define FFVAL ((1< 0; } - void pauseEvents() { m_state = KSTATE_PAUSE; m_cnt = 0; } - void killEvents() { m_state = KSTATE_KILLED; } + + private: + uint8_t m_vals; // key debounce? 4 = 40ms + uint8_t m_cnt; + uint8_t m_state; + public: + void input(bool val, EnumKeys enuk); + bool state() { return m_vals > 0; } + void pauseEvents() { m_state = KSTATE_PAUSE; m_cnt = 0; } + void killEvents() { m_state = KSTATE_KILLED; } }; extern Key keys[NUM_KEYS]; @@ -906,13 +910,9 @@ void setTrimValue(uint8_t phase, uint8_t idx, int trim); #endif #if defined(CPUARM) - #define GV1_SMALL 128 - #define GV1_LARGE 4096 #define GV_GET_GV1_VALUE(max) ( (max<=GV_RANGESMALL && min>=GV_RANGESMALL_NEG) ? GV1_SMALL : GV1_LARGE ) #define GV_INDEX_CALCULATION(x,max) ( (max<=GV_RANGESMALL && min>=GV_RANGESMALL_NEG) ? (uint8_t) x-GV1_SMALL : ((x&(GV1_LARGE*2-1))-GV1_LARGE) ) #else - #define GV1_SMALL 128 - #define GV1_LARGE 256 #define GV_GET_GV1_VALUE(max) ( (max<=GV_RANGESMALL) ? GV1_SMALL : GV1_LARGE ) #define GV_INDEX_CALCULATION(x,max) ( (max<=GV1_SMALL) ? (uint8_t) x-GV1_SMALL : ((x&(GV1_LARGE*2-1))-GV1_LARGE) ) #endif @@ -927,6 +927,21 @@ void setTrimValue(uint8_t phase, uint8_t idx, int trim); #define GV_RANGESMALL_NEG (-GV1_SMALL + (RESERVE_RANGE_FOR_GVARS+1)) #define GV_RANGELARGE (GV1_LARGE - (RESERVE_RANGE_FOR_GVARS+1)) #define GV_RANGELARGE_NEG (-GV1_LARGE + (RESERVE_RANGE_FOR_GVARS+1)) +#if defined(CPUARM) + // the define GV1_LARGE marks the highest bit value used for this variables + // because this would give too big numbers for ARM, we limit it further for + // offset and weight + #define GV_RANGELARGE_WEIGHT (GV_RANGE_WEIGHT) + #define GV_RANGELARGE_WEIGHT_NEG (-GV_RANGE_WEIGHT) + #define GV_RANGELARGE_OFFSET (GV_RANGE_OFFSET) + #define GV_RANGELARGE_OFFSET_NEG (-GV_RANGE_OFFSET) +#else + // for stock we just use as much as possible + #define GV_RANGELARGE_WEIGHT GV_RANGELARGE + #define GV_RANGELARGE_WEIGHT_NEG GV_RANGELARGE_NEG + #define GV_RANGELARGE_OFFSET GV_RANGELARGE + #define GV_RANGELARGE_OFFSET_NEG GV_RANGELARGE_NEG +#endif extern uint16_t s_timeCumTot; extern uint16_t s_timeCumThr; @@ -1343,6 +1358,10 @@ enum FunctionsActive { #endif }; +#define VARIO_FREQUENCY_ZERO 700/*Hz*/ +#define VARIO_FREQUENCY_RANGE 1000/*Hz*/ +#define VARIO_REPEAT_ZERO 500/*ms*/ +#define VARIO_REPEAT_MAX 80/*ms*/ extern MASK_FUNC_TYPE activeFunctions; extern MASK_CFN_TYPE activeFnSwitches; @@ -1628,8 +1647,7 @@ uint8_t zlen(const char *str, uint8_t size); bool zexist(const char *str, uint8_t size); char * strcat_zchar(char * dest, char * name, uint8_t size, const char *defaultName, uint8_t defaultNameSize, uint8_t defaultIdx); #define strcat_modelname(dest, idx) strcat_zchar(dest, modelHeaders[idx].name, LEN_MODEL_NAME, STR_MODEL, PSIZE(TR_MODEL), idx+1) -#define strcat_phasename(dest, idx) strcat_zchar(dest, g_model.phaseData[idx].name, LEN_FP_NAME, NULL, 0, 0) -#define strcat_mixername(dest, idx) strcat_zchar(dest, g_model.mixData[idx].name, LEN_EXPOMIX_NAME, NULL, 0, 0) +#define strcat_phasename(dest, idx) strcat_zchar(dest, g_model.phaseData[idx].name, LEN_FP_NAME, STR_FP, PSIZE(TR_FP), idx+1) #define ZLEN(s) zlen(s, sizeof(s)) #define ZEXIST(s) zexist(s, sizeof(s)) #endif diff --git a/radio/src/rtc.cpp b/radio/src/rtc.cpp index 1dad84604..a13d9696e 100644 --- a/radio/src/rtc.cpp +++ b/radio/src/rtc.cpp @@ -51,10 +51,7 @@ extern void rtcdriver_settime(struct gtm * t); implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift right in the usual way when A < 0, so SHR falls back on division if ordinary A >> B doesn't seem to be the usual signed shift. */ -#define SHR(a, b) \ - (-1 >> 1 == -1 \ - ? (a) >> (b) \ - : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0)) +#define SHR(a, b) (-1 >> 1 == -1 ? (a) >> (b) : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0)) /* The extra casts in the following macros work around compiler bugs, e.g., in Cray C 5.0.3.0. */ @@ -487,7 +484,7 @@ __mktime_internal (struct gtm *tp, gtime_t gmktime (struct gtm *tp) { - // no time zone stuff. Just do the math ;) + // no time zone stuff. Just do the math ;) static gtime_t localtime_offset; return __mktime_internal (tp, __localtime_r, &localtime_offset); } diff --git a/radio/src/sdcard.h b/radio/src/sdcard.h index 4e6c446d7..ccbad5fa6 100644 --- a/radio/src/sdcard.h +++ b/radio/src/sdcard.h @@ -44,7 +44,7 @@ #define LOGS_PATH ROOT_PATH "LOGS" // no trailing slash = important #define SOUNDS_PATH ROOT_PATH "SOUNDS/en" // no trailing slash = important #define SOUNDS_PATH_LNG_OFS (sizeof(SOUNDS_PATH)-3) -#define SYSTEM_SOUNDS_PATH SOUNDS_PATH "/SYSTEM" // no trailing slash = important +#define SYSTEM_SUBDIR "SYSTEM" // no trailing slash = important #define BITMAPS_PATH ROOT_PATH "BMP" #define SCRIPTS_PATH ROOT_PATH "SCRIPTS" @@ -53,7 +53,6 @@ #define SOUNDS_EXT ".wav" #define BITMAPS_EXT ".bmp" #define SCRIPTS_EXT ".lua" -#define MIXES_EXT ".mix" #define TEXT_EXT ".txt" extern FATFS g_FATFS_Obj; diff --git a/radio/src/simpgmspace.cpp b/radio/src/simpgmspace.cpp index ba52639a3..b00c96be7 100644 --- a/radio/src/simpgmspace.cpp +++ b/radio/src/simpgmspace.cpp @@ -300,7 +300,7 @@ void *main_thread(void *) eeReadAll(); // load general setup and selected model #if defined(CPUARM) && defined(SDCARD) - refreshSystemAudioFiles(); + referenceSystemAudioFiles(); #endif if (g_eeGeneral.backlightMode != e_backlight_mode_off) backlightOn(); // on Tx start turn the light on @@ -473,9 +473,10 @@ char *convertSimuPath(const char *path) FRESULT f_stat (const TCHAR * name, FILINFO *) { + char *path = convertSimuPath(name); struct stat tmp; - // printf("f_stat(%s)\n", path); fflush(stdout); - return stat(convertSimuPath(name), &tmp) ? FR_INVALID_NAME : FR_OK; + TRACE("f_stat(%s)", path); + return stat(path, &tmp) ? FR_INVALID_NAME : FR_OK; } FRESULT f_mount (BYTE, FATFS*) diff --git a/radio/src/simu.cpp b/radio/src/simu.cpp index a5f74d730..73458e5b0 100644 --- a/radio/src/simu.cpp +++ b/radio/src/simu.cpp @@ -51,23 +51,24 @@ int g_snapshot_idx = 0; class Open9xSim: public FXMainWindow { FXDECLARE(Open9xSim) -public: - Open9xSim(){}; - Open9xSim(FXApp* a); - long onKeypress(FXObject*,FXSelector,void*); - long onTimeout(FXObject*,FXSelector,void*); - void makeSnapshot(const FXDrawable* drawable); - void doEvents(); - void refreshDiplay(); -private: - FXImage *bmp; - FXImageFrame *bmf; - bool firstTime; + public: + Open9xSim(){}; + Open9xSim(FXApp* a); + long onKeypress(FXObject*,FXSelector,void*); + long onTimeout(FXObject*,FXSelector,void*); + void makeSnapshot(const FXDrawable* drawable); + void doEvents(); + void refreshDiplay(); -public: - FXSlider *sliders[8]; - FXKnob *knobs[NUM_POTS]; + private: + FXImage *bmp; + FXImageFrame *bmf; + bool firstTime; + + public: + FXSlider *sliders[8]; + FXKnob *knobs[NUM_POTS]; }; // Message Map FXDEFMAP(Open9xSim) Open9xSimMap[]={ diff --git a/radio/src/targets/sky9x/diskio.cpp b/radio/src/targets/sky9x/diskio.cpp index d7f60e900..8d9ff5cfc 100644 --- a/radio/src/targets/sky9x/diskio.cpp +++ b/radio/src/targets/sky9x/diskio.cpp @@ -1014,7 +1014,7 @@ void sdMountPoll() case SD_ST_DATA: if (!usbPlugged() && f_mount(0, &g_FATFS_Obj) == FR_OK) { - refreshSystemAudioFiles(); + referenceSystemAudioFiles(); Card_state = SD_ST_MOUNTED; } break; @@ -1082,7 +1082,7 @@ void sdInit() Card_state = SD_ST_DATA; if (f_mount(0, &g_FATFS_Obj) == FR_OK) { - refreshSystemAudioFiles(); + referenceSystemAudioFiles(); Card_state = SD_ST_MOUNTED; } diff --git a/radio/src/targets/taranis/diskio.cpp b/radio/src/targets/taranis/diskio.cpp index b1d2dea7e..d9586804f 100644 --- a/radio/src/targets/taranis/diskio.cpp +++ b/radio/src/targets/taranis/diskio.cpp @@ -969,7 +969,7 @@ FIL g_telemetryFile = {0}; void sdInit() { if (f_mount(0, &g_FATFS_Obj) == FR_OK) { - refreshSystemAudioFiles(); + referenceSystemAudioFiles(); #if defined(DEBUG) f_open(&g_telemetryFile, LOGS_PATH "/sport.log", FA_OPEN_ALWAYS | FA_WRITE); diff --git a/radio/src/targets/taranis/trainer_driver.cpp b/radio/src/targets/taranis/trainer_driver.cpp index 9319cc18b..f4b4e548c 100644 --- a/radio/src/targets/taranis/trainer_driver.cpp +++ b/radio/src/targets/taranis/trainer_driver.cpp @@ -124,7 +124,7 @@ extern "C" void TIM3_IRQHandler() val = (uint16_t)(capture - lastCapt) / 2 ; lastCapt = capture; - // We prcoess g_ppmInsright here to make servo movement as smooth as possible + // We process g_ppmInsright here to make servo movement as smooth as possible // while under trainee control if ((val>4000) && (val < 19000)) { // G: Prioritize reset pulse. (Needed when less than 8 incoming pulses) ppmInState = 1; // triggered diff --git a/radio/src/telemetry/frsky_sport.cpp b/radio/src/telemetry/frsky_sport.cpp index c13443e73..99d6787e6 100644 --- a/radio/src/telemetry/frsky_sport.cpp +++ b/radio/src/telemetry/frsky_sport.cpp @@ -654,8 +654,9 @@ void telemetryWakeup() #endif #if defined(VARIO) - if (TELEMETRY_STREAMING() && !IS_FAI_ENABLED()) + if (TELEMETRY_STREAMING() && !IS_FAI_ENABLED()) { varioWakeup(); + } #endif static tmr10ms_t alarmsCheckTime = 0; diff --git a/radio/src/templates.h b/radio/src/templates.h index 2ac2cac71..4de55eddf 100644 --- a/radio/src/templates.h +++ b/radio/src/templates.h @@ -53,8 +53,8 @@ * */ -#ifndef TEMPLATES_H -#define TEMPLATES_H +#ifndef TEMPLATES_H_ +#define TEMPLATES_H_ #include diff --git a/radio/src/translations.cpp b/radio/src/translations.cpp index 074c45a14..ef7c278b0 100644 --- a/radio/src/translations.cpp +++ b/radio/src/translations.cpp @@ -449,6 +449,7 @@ const pm_char STR_SD_SECTORS[] PROGMEM = TR_SD_SECTORS; const pm_char STR_SD_SIZE[] PROGMEM = TR_SD_SIZE; const pm_char STR_TYPE[] PROGMEM = TR_TYPE; const pm_char STR_GLOBAL_VARS[] PROGMEM = TR_GLOBAL_VARS; +const pm_char STR_GLOBAL_V[] PROGMEM = TR_GLOBAL_V; const pm_char STR_GLOBAL_VAR[] PROGMEM = TR_GLOBAL_VAR; const pm_char STR_OWN[] PROGMEM = TR_OWN; const pm_char STR_ROTARY_ENCODER[] PROGMEM = TR_ROTARY_ENCODER; diff --git a/radio/src/translations.h b/radio/src/translations.h index 88aa521ac..2a0343314 100644 --- a/radio/src/translations.h +++ b/radio/src/translations.h @@ -124,12 +124,12 @@ extern const pm_char STR_OPEN9X[]; #define OFS_VTELEMCHNS (OFS_FUNCSOUNDS + sizeof(TR_FUNCSOUNDS)) #if defined(FRSKY) || defined(CPUARM) #if defined(CPUARM) - #define OFS_VTELEMUNIT_IMP (OFS_VTELEMCHNS + sizeof(TR_VTELEMCHNS)) - #define OFS_VTELEMUNIT_NORM (OFS_VTELEMUNIT_IMP + sizeof(TR_VTELEMUNIT_IMP)) - #define OFS_VALARM (OFS_VTELEMUNIT_NORM + sizeof(TR_VTELEMUNIT_NORM)) + #define OFS_VTELEMUNIT_IMP (OFS_VTELEMCHNS + sizeof(TR_VTELEMCHNS)) + #define OFS_VTELEMUNIT_NORM (OFS_VTELEMUNIT_IMP + sizeof(TR_VTELEMUNIT_IMP)) + #define OFS_VALARM (OFS_VTELEMUNIT_NORM + sizeof(TR_VTELEMUNIT_NORM)) #else - #define OFS_VTELEMUNIT (OFS_VTELEMCHNS + sizeof(TR_VTELEMCHNS)) - #define OFS_VALARM (OFS_VTELEMUNIT + sizeof(TR_VTELEMUNIT)) + #define OFS_VTELEMUNIT (OFS_VTELEMCHNS + sizeof(TR_VTELEMCHNS)) + #define OFS_VALARM (OFS_VTELEMUNIT + sizeof(TR_VTELEMUNIT)) #endif #define OFS_VALARMFN (OFS_VALARM + sizeof(TR_VALARM)) #define OFS_VTELPROTO (OFS_VALARMFN + sizeof(TR_VALARMFN)) @@ -611,6 +611,7 @@ extern const pm_char STR_SD_SECTORS[]; extern const pm_char STR_SD_SIZE[]; extern const pm_char STR_TYPE[]; extern const pm_char STR_GLOBAL_VARS[]; +extern const pm_char STR_GLOBAL_V[]; extern const pm_char STR_GLOBAL_VAR[]; extern const pm_char STR_OWN[]; extern const pm_char STR_ROTARY_ENCODER[]; diff --git a/radio/src/translations/cz.h.txt b/radio/src/translations/cz.h.txt index 1fa49ad61..d1b9d986e 100644 --- a/radio/src/translations/cz.h.txt +++ b/radio/src/translations/cz.h.txt @@ -167,8 +167,14 @@ #endif #endif +#if defined(CPUARM) + #define TR_CSWEQUAL "a=x\0 " +#else + #define TR_CSWEQUAL +#endif + #define LEN_VCSWFUNC "\005" -#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""a" @@ -665,6 +671,7 @@ #define TR_SD_SIZE "Size:" #define TR_TYPE "Type" #define TR_GLOBAL_VARS "Global Variables" +#define TR_GLOBAL_V "GLOBAL V." #define TR_GLOBAL_VAR "Global Variable" #define TR_MENUGLOBALVARS "GLOBAL VARIABLES" #define TR_OWN "Own" @@ -801,7 +808,7 @@ #define TR_BEEP_VOLUME "Beep Volume" #define TR_WAV_VOLUME "Wav Volume" -#define TR_VARIO_VOLUME "Vario Volume" +#define TR_VARIO_VOLUME "Vario Volume" // TODO may be removed #define TR_BG_VOLUME "Bg Volume" #define TR_TOP_BAR "Top Bar" diff --git a/radio/src/translations/es.h.txt b/radio/src/translations/es.h.txt index 6f250d2a3..7c4be020c 100644 --- a/radio/src/translations/es.h.txt +++ b/radio/src/translations/es.h.txt @@ -167,8 +167,14 @@ #endif #endif +#if defined(CPUARM) + #define TR_CSWEQUAL "a=x\0 " +#else + #define TR_CSWEQUAL +#endif + #define LEN_VCSWFUNC "\005" -#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""ax\0 ""ax""|a|b\0 ""a> SEG_SHIFT + if (seg): + t = (t + t + 1 + 32) << (seg + 2) + else: + t = (t + t + 1 ) << 3 + + if a_val & SIGN_BIT: + return t + else: + return -t + +def ulaw2linear(u_val): + # Complement to obtain normal u-law value. + u_val = ~u_val + + # Extract and bias the quantization bits. Then + # shift up by the segment number and subtract out the bias. + t = ((u_val & QUANT_MASK) << 3) + BIAS + t <<= (u_val & SEG_MASK) >> SEG_SHIFT + + if u_val & SIGN_BIT: + return (BIAS - t) + else: + return (t - BIAS) + +def pcmTable(fn): + result = [] + for i in range(256): + result.append(fn(i)) + return result + +def tableToString(name, table): + result = 'const int16_t ' + name + '[256] = { ' + result += ', '.join([str(i) for i in table]) + result += ' };' + return result + +print tableToString('alawTable', pcmTable(alaw2linear)) +print tableToString('ulawTable', pcmTable(ulaw2linear)) diff --git a/radio/util/sinus.py b/radio/util/sinus.py new file mode 100644 index 000000000..727090e49 --- /dev/null +++ b/radio/util/sinus.py @@ -0,0 +1,29 @@ +#!/bin/env python + +import math + +samples = 1024 +amplitudes = (32000, 0, 4000, 0, 4000) + +max = 0 +min = 0 + +for i in range(samples): + sample = 0.0 + for harmonic, amplitude in enumerate(amplitudes): + sample += math.sin(math.pi*2*i*(harmonic+1)/samples) * amplitude / 2 + sample = int(sample) + if sample > max: + max = sample + elif sample < min: + min = sample + print "%d," % sample, + if i % 10 == 9: + print + +print +print 'Range is:', min, max + +if max > 32767 or min < -32768: + print "Invalid range!" +