1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-24 16:55:20 +03:00

Merge branch 'master' of https://github.com/tmrttmrt/opentx into tmrttmrt/Fixes#2750__Mega2560_ST7920_mixer_freq_too_slow

This commit is contained in:
Tomaz Mertelj 2015-09-30 22:09:16 +02:00
commit 8e0adbe602
313 changed files with 24053 additions and 48662 deletions

14
.travis.yml Normal file
View file

@ -0,0 +1,14 @@
language: cpp
before_install:
- sudo apt-get remove cmake cmake-data --yes
- sudo add-apt-repository ppa:george-edison55/precise-backports --yes
- sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded --yes
- sudo apt-get update
install:
- sudo apt-get install -y lcov cmake cmake-data bc curl gcc-arm-none-eabi gcc-avr avr-libc avrdude libqtcore4 libqt4-dev qt4-qmake g++ libxerces-c-dev xsdcxx libsdl1.2-dev libusb-1.0-0 libphonon-dev phonon libqtwebkit-dev python-qt4 python-qt4-dev libfox-1.6-dev libgtest-dev
script:
- radio/util/commit-tests.sh
- mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug ../companion/src && cmake --build .

View file

@ -1,3 +0,0 @@
<a href="http://3drobotics.com">3D Robotics</a>
They sell the Iris+ with a modified version of OpenTX which doesn't fullfil the GPL requirements.
No donations, no thanks, we are just free staff for them...

View file

@ -8,6 +8,7 @@
<a href="http://litepilots.com">LitePilots</a> <a href="http://litepilots.com">LitePilots</a>
<a href="http://openpilot.com">David Ankers (OpenPilot)</a> <a href="http://openpilot.com">David Ankers (OpenPilot)</a>
<a href="http://3drobotics.com">3D Robotics</a> <a href="http://3drobotics.com">3D Robotics</a>
<a href="http://rcstudio.cz">RC Studio (monthly)</a>
Mario Sette Mario Sette
Felice Baratto Felice Baratto
@ -401,7 +402,6 @@ Colin Rycroft
Emanuel Stassar Emanuel Stassar
Michael Gregory Michael Gregory
Robert Russell Robert Russell
Gordon Stahl
Felix Kaiser Felix Kaiser
Joshua Bardwell Joshua Bardwell
Davd Goodall Davd Goodall
@ -599,7 +599,6 @@ Julien Gérard
Alexandre d'Alton Alexandre d'Alton
Peter Mergaerts Peter Mergaerts
Jan Houwers Jan Houwers
Gordon Stahl
Christian Grandjean Christian Grandjean
Roger Bergevin Roger Bergevin
NorthSide NorthSide
@ -802,4 +801,27 @@ Roger Keatley
Sherman Lovell Sherman Lovell
Hugh Caldwell Hugh Caldwell
JB Fisher Company JB Fisher Company
Michels Bernhard
Pietro Rossin
Carsten Wache
Brock White
Steven Poretz
David Huelster
Gordon Stahl (monthly)
John Mathison
Richard Duczmal
Gregory Barron
Marcel Fischer
Klas Mälman
Viljo Liukku
Eric Smith
Sven Assmus
Luke Mole
NorthSide
Hannes Mössler
James Kaufman
Ravi Gupta
Lexington S Morley
Ralph Segar
Frédéric Devillard

View file

@ -1,5 +1,9 @@
##OpenTX 2.1 Branch ##OpenTX 2.1 Branch
The ongoing development is not done in this branch. It is performed in the branch called next. [![Build Status](https://travis-ci.org/opentx/opentx.svg?branch=master)](https://travis-ci.org/opentx/opentx)
[![Join the chat at https://gitter.im/opentx/opentx](https://img.shields.io/badge/%E2%8A%AA%20GITTER%20-JOIN%20CHAT%20%E2%86%92-brightgreen.svg?style=flat)](https://gitter.im/opentx/opentx?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Donate using Paypal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DJ9MASSKVW8WN)
The ongoing development on 2.1.x is done in this branch.
Refer to the opentx.wiki for information about setting up the tool chains for building OpenTX and OpenTX Companion as well as other development related issues. Refer to the opentx.wiki for information about setting up the tool chains for building OpenTX and OpenTX Companion as well as other development related issues.

View file

@ -1,4 +1,24 @@
<h2>Version 2.1.2 / <set date></h2> <h2>Version 2.1.4 / <set date></h2>
<ul>
<li>Fixed: changing any setting on the telemetry panel does not set the file as being modified (<a href=https://github.com/opentx/opentx/issues/2875>#2875</a>)</li>
<li>Print model fix for "Play value.... not on startup" (<a href=https://github.com/opentx/opentx/issues/2736>#2736</a>)</li>
<li>Top LCD Timer could not be selected for X9E (<a href=https://github.com/opentx/opentx/issues/2850>#2850</a>)</li>
<li>More informative error/info messages when openin eepe files (<a href=https://github.com/opentx/opentx/issues/2778>#2778</a>)</li>
<li>Print model fix for curves (<a href=https://github.com/opentx/opentx/issues/2896>#2896</a>)</li>
</ul>
<h2>Version 2.1.3 / 2015-09-09</h2>
<ul>
<li>Fix missing translations in inputs/mixes tabs, print and compare dialogs (<a href=https://github.com/opentx/opentx/issues/2847>#2847</a>)</li>
</ul>
<h2>Version 2.1.2 / 2015-09-07</h2>
<ul> <ul>
<li>Fixed: Lua model scripts outputs not working in a simulator (<a href=https://github.com/opentx/opentx/issues/2684>#2684</a>)</li> <li>Fixed: Lua model scripts outputs not working in a simulator (<a href=https://github.com/opentx/opentx/issues/2684>#2684</a>)</li>
<li>Fixed a problem of Companion 2.1 trying to install into 2.0 path. <li>Fixed a problem of Companion 2.1 trying to install into 2.0 path.
@ -6,6 +26,14 @@
(<a href=https://github.com/opentx/opentx/issues/2645>#2645</a>)</li> (<a href=https://github.com/opentx/opentx/issues/2645>#2645</a>)</li>
<li>Added missing SDL libraries to MAC package (<a href=https://github.com/opentx/opentx/issues/2678>#2678</a>)</li> <li>Added missing SDL libraries to MAC package (<a href=https://github.com/opentx/opentx/issues/2678>#2678</a>)</li>
<li>Added used channels check/warning in Wizard (<a href=https://github.com/opentx/opentx/issues/2091>#2091</a>)</li> <li>Added used channels check/warning in Wizard (<a href=https://github.com/opentx/opentx/issues/2091>#2091</a>)</li>
<li>Model Print and Model Compare improvements and fixes (<a href=https://github.com/opentx/opentx/issues/2734>#2734</a>, <a href=https://github.com/opentx/opentx/issues/2737>#2737</a>, <a href=https://github.com/opentx/opentx/issues/2576>#2576</a>)</li>
<li>Negative telemetry offset value was reset when writing back to radio (<a href=https://github.com/opentx/opentx/issues/2738>#2738</a>)</li>
<li>Telemetry sensor names were not displayed (<a href=https://github.com/opentx/opentx/issues/2807>#2807</a>)</li>
<li>Mixes multiplex representation now the same as on the radio (<a href=https://github.com/opentx/opentx/issues/2808>#2808</a>)</li>
<li>Fixed language-related startup crash on Mac (<a href=https://github.com/opentx/opentx/issues/2815>#2815</a>)</li>
<li>Fixed issues with conversion from 2.0 (<a href=https://github.com/opentx/opentx/issues/2809>#2809</a>, <a href=https://github.com/opentx/opentx/issues/2800>#2800</a>)</li>
<li>Fixed Throttle source export issue on X9E (<a href=https://github.com/opentx/opentx/issues/2844>#2844</a>)</li>
<li>Added support for the AR9X replacement board (prototype) for the Turnigy 9X radio, info <a href=http://www.rcgroups.com/forums/showthread.php?t=2479552>here</a></li>
</ul> </ul>

View file

@ -2,13 +2,13 @@ PROJECT( companion )
SET(C9X_VERSION_MAJOR "2") SET(C9X_VERSION_MAJOR "2")
SET(C9X_VERSION_MINOR "1") SET(C9X_VERSION_MINOR "1")
SET(C9X_VERSION_REVISION "2") SET(C9X_VERSION_REVISION "4")
SET(C9X_VERSION_SUFFIX $ENV{OPENTX_VERSION_SUFFIX}) SET(C9X_VERSION_SUFFIX $ENV{OPENTX_VERSION_SUFFIX})
SET(C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR}.${C9X_VERSION_REVISION}${C9X_VERSION_SUFFIX}) SET(C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR}.${C9X_VERSION_REVISION}${C9X_VERSION_SUFFIX})
MESSAGE(STATUS OpenTX Companion ${C9X_VERSION}) MESSAGE(STATUS "OpenTX Companion ${C9X_VERSION}")
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 )
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
@ -62,7 +62,7 @@ ELSE()
MESSAGE( "SDL not found! Joysticks support will be disabled. Simulator audio will not work." ) MESSAGE( "SDL not found! Joysticks support will be disabled. Simulator audio will not work." )
ENDIF() ENDIF()
FIND_PACKAGE(Qt4 4.8.4 REQUIRED) FIND_PACKAGE(Qt4 4.8.1 REQUIRED)
SET( QT_USE_QTNETWORK True ) SET( QT_USE_QTNETWORK True )
SET( QT_USE_QTXML True ) SET( QT_USE_QTXML True )
INCLUDE( ${QT_USE_FILE} ) INCLUDE( ${QT_USE_FILE} )
@ -213,6 +213,8 @@ set(companion_MOC_HDRS
radionotfound.h radionotfound.h
helpers.h helpers.h
wizarddialog.h wizarddialog.h
modelprinter.h
multimodelprinter.h
) )
set(companion_UIS set(companion_UIS
@ -432,7 +434,7 @@ ADD_CUSTOM_TARGET( stamp
IF( LUPDATE_FOUND ) IF( LUPDATE_FOUND )
ADD_CUSTOM_TARGET( translations ADD_CUSTOM_TARGET( translations
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${LUPDATE_EXECUTABLE} ${CMAKE_SOURCE_DIR} -ts ${companion_TS} COMMAND ${LUPDATE_EXECUTABLE} ${CMAKE_SOURCE_DIR} -no-obsolete -ts ${companion_TS}
) )
ELSE() ELSE()
ADD_CUSTOM_TARGET( translations ADD_CUSTOM_TARGET( translations

View file

@ -312,10 +312,10 @@ QString Profile::speaker() const { return _speaker; }
QString Profile::stickPotCalib() const { return _stickPotCalib; } QString Profile::stickPotCalib() const { return _stickPotCalib; }
QString Profile::timeStamp() const { return _timeStamp; } QString Profile::timeStamp() const { return _timeStamp; }
QString Profile::trainerCalib() const { return _trainerCalib; } QString Profile::trainerCalib() const { return _trainerCalib; }
int Profile::currentCalib() const { return _currentCalib; } int Profile::txCurrentCalibration() const { return _txCurrentCalibration; }
int Profile::gsStickMode() const { return _gsStickMode; } int Profile::gsStickMode() const { return _gsStickMode; }
int Profile::ppmMultiplier() const { return _ppmMultiplier; } int Profile::ppmMultiplier() const { return _ppmMultiplier; }
int Profile::vBatCalib() const { return _vBatCalib; } int Profile::txVoltageCalibration() const { return _txVoltageCalibration; }
int Profile::vBatWarn() const { return _vBatWarn; } int Profile::vBatWarn() const { return _vBatWarn; }
int Profile::vBatMin() const { return _vBatMin; } int Profile::vBatMin() const { return _vBatMin; }
int Profile::vBatMax() const { return _vBatMax; } int Profile::vBatMax() const { return _vBatMax; }
@ -342,10 +342,10 @@ void Profile::speaker (const QString x) { store(x, _speaker, "Speake
void Profile::stickPotCalib (const QString x) { store(x, _stickPotCalib, "StickPotCalib" ,"Profiles", QString("profile%1").arg(index));} void Profile::stickPotCalib (const QString x) { store(x, _stickPotCalib, "StickPotCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::timeStamp (const QString x) { store(x, _timeStamp, "TimeStamp" ,"Profiles", QString("profile%1").arg(index));} void Profile::timeStamp (const QString x) { store(x, _timeStamp, "TimeStamp" ,"Profiles", QString("profile%1").arg(index));}
void Profile::trainerCalib (const QString x) { store(x, _trainerCalib, "TrainerCalib" ,"Profiles", QString("profile%1").arg(index));} void Profile::trainerCalib (const QString x) { store(x, _trainerCalib, "TrainerCalib" ,"Profiles", QString("profile%1").arg(index));}
void Profile::currentCalib (const int x) { store(x, _currentCalib, "currentCalib" ,"Profiles", QString("profile%1").arg(index));} void Profile::txCurrentCalibration (const int x) { store(x, _txCurrentCalibration, "currentCalib","Profiles", QString("profile%1").arg(index));}
void Profile::gsStickMode (const int x) { store(x, _gsStickMode, "GSStickMode" ,"Profiles", QString("profile%1").arg(index));} void Profile::gsStickMode (const int x) { store(x, _gsStickMode, "GSStickMode" ,"Profiles", QString("profile%1").arg(index));}
void Profile::ppmMultiplier (const int x) { store(x, _ppmMultiplier, "PPM_Multiplier" ,"Profiles", QString("profile%1").arg(index));} void Profile::ppmMultiplier (const int x) { store(x, _ppmMultiplier, "PPM_Multiplier" ,"Profiles", QString("profile%1").arg(index));}
void Profile::vBatCalib (const int x) { store(x, _vBatCalib, "VbatCalib" ,"Profiles", QString("profile%1").arg(index));} void Profile::txVoltageCalibration (const int x) { store(x, _txVoltageCalibration, "VbatCalib","Profiles", QString("profile%1").arg(index));}
void Profile::vBatWarn (const int x) { store(x, _vBatWarn, "vBatWarn" ,"Profiles", QString("profile%1").arg(index));} void Profile::vBatWarn (const int x) { store(x, _vBatWarn, "vBatWarn" ,"Profiles", QString("profile%1").arg(index));}
void Profile::vBatMin (const int x) { store(x, _vBatMin, "VbatMin" ,"Profiles", QString("profile%1").arg(index));} void Profile::vBatMin (const int x) { store(x, _vBatMin, "VbatMin" ,"Profiles", QString("profile%1").arg(index));}
void Profile::vBatMax (const int x) { store(x, _vBatMax, "VbatMax" ,"Profiles", QString("profile%1").arg(index));} void Profile::vBatMax (const int x) { store(x, _vBatMax, "VbatMax" ,"Profiles", QString("profile%1").arg(index));}
@ -378,10 +378,10 @@ Profile& Profile::operator=(const Profile& rhs)
speaker ( rhs.speaker() ); speaker ( rhs.speaker() );
stickPotCalib( rhs.stickPotCalib() ); stickPotCalib( rhs.stickPotCalib() );
trainerCalib ( rhs.trainerCalib() ); trainerCalib ( rhs.trainerCalib() );
currentCalib ( rhs.currentCalib() ); txCurrentCalibration ( rhs.txCurrentCalibration() );
gsStickMode ( rhs.gsStickMode() ); gsStickMode ( rhs.gsStickMode() );
ppmMultiplier( rhs.ppmMultiplier() ); ppmMultiplier( rhs.ppmMultiplier() );
vBatCalib ( rhs.vBatCalib() ); txVoltageCalibration ( rhs.txVoltageCalibration() );
vBatWarn ( rhs.vBatWarn() ); vBatWarn ( rhs.vBatWarn() );
vBatMin ( rhs.vBatMin() ); vBatMin ( rhs.vBatMin() );
vBatMax ( rhs.vBatMax() ); vBatMax ( rhs.vBatMax() );
@ -424,10 +424,10 @@ void Profile::initFwVariables()
_timeStamp = ""; _timeStamp = "";
_trainerCalib = ""; _trainerCalib = "";
_currentCalib = 0; _txCurrentCalibration = 0;
_gsStickMode = 0; _gsStickMode = 0;
_ppmMultiplier = 0; _ppmMultiplier = 0;
_vBatCalib = 0; _txVoltageCalibration = 0;
_vBatWarn = 0; _vBatWarn = 0;
_vBatMin = 0; _vBatMin = 0;
_vBatMax = 0; _vBatMax = 0;
@ -483,10 +483,10 @@ void Profile::flush()
getset( _stickPotCalib, "StickPotCalib" ,"" ,"Profiles", QString("profile%1").arg(index)); getset( _stickPotCalib, "StickPotCalib" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _timeStamp, "TimeStamp" ,"" ,"Profiles", QString("profile%1").arg(index)); getset( _timeStamp, "TimeStamp" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _trainerCalib, "TrainerCalib" ,"" ,"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( _txCurrentCalibration, "currentCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _gsStickMode, "GSStickMode" ,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( _ppmMultiplier, "PPM_Multiplier" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _vBatCalib, "VbatCalib" ,0 ,"Profiles", QString("profile%1").arg(index)); getset( _txVoltageCalibration, "VbatCalib" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _vBatWarn, "vBatWarn" ,0 ,"Profiles", QString("profile%1").arg(index)); getset( _vBatWarn, "vBatWarn" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _vBatMin, "VbatMin" ,0 ,"Profiles", QString("profile%1").arg(index)); getset( _vBatMin, "VbatMin" ,0 ,"Profiles", QString("profile%1").arg(index));
getset( _vBatMax, "VbatMax" ,0 ,"Profiles", QString("profile%1").arg(index)); getset( _vBatMax, "VbatMax" ,0 ,"Profiles", QString("profile%1").arg(index));

View file

@ -125,10 +125,10 @@ class Profile: protected CompStoreObj
QString _stickPotCalib; QString _stickPotCalib;
QString _timeStamp; QString _timeStamp;
QString _trainerCalib; QString _trainerCalib;
int _currentCalib; int _txCurrentCalibration;
int _gsStickMode; int _gsStickMode;
int _ppmMultiplier; int _ppmMultiplier;
int _vBatCalib; int _txVoltageCalibration;
int _vBatWarn; int _vBatWarn;
int _vBatMin; int _vBatMin;
int _vBatMax; int _vBatMax;
@ -156,10 +156,10 @@ class Profile: protected CompStoreObj
QString stickPotCalib() const; QString stickPotCalib() const;
QString timeStamp() const; QString timeStamp() const;
QString trainerCalib() const; QString trainerCalib() const;
int currentCalib() const; int txCurrentCalibration() const;
int gsStickMode() const; int gsStickMode() const;
int ppmMultiplier() const; int ppmMultiplier() const;
int vBatCalib() const; int txVoltageCalibration() const;
int vBatWarn() const; int vBatWarn() const;
int vBatMin() const; int vBatMin() const;
int vBatMax() const; int vBatMax() const;
@ -186,10 +186,10 @@ class Profile: protected CompStoreObj
void stickPotCalib (const QString); void stickPotCalib (const QString);
void timeStamp (const QString); void timeStamp (const QString);
void trainerCalib (const QString); void trainerCalib (const QString);
void currentCalib (const int); void txCurrentCalibration (const int);
void gsStickMode (const int); void gsStickMode (const int);
void ppmMultiplier (const int); void ppmMultiplier (const int);
void vBatCalib (const int); void txVoltageCalibration (const int);
void vBatWarn (const int); void vBatWarn (const int);
void vBatMin (const int); void vBatMin (const int);
void vBatMax (const int); void vBatMax (const int);

View file

@ -53,6 +53,7 @@
#undef main #undef main
#endif #endif
#include "mainwindow.h" #include "mainwindow.h"
#include "version.h"
#include "eeprominterface.h" #include "eeprominterface.h"
#include "appdata.h" #include "appdata.h"
@ -87,6 +88,13 @@ int main(int argc, char *argv[])
app.setOrganizationDomain("open-tx.org"); app.setOrganizationDomain("open-tx.org");
app.setAttribute(Qt::AA_DontShowIconsInMenus, false); app.setAttribute(Qt::AA_DontShowIconsInMenus, false);
QStringList strl = QApplication::arguments();
if (strl.contains("--version")) {
printf("%s\n", C9X_VERSION);
fflush(stdout);
exit(0);
}
#ifdef __APPLE__ #ifdef __APPLE__
app.setStyle(new MyProxyStyle); app.setStyle(new MyProxyStyle);
#endif #endif

View file

@ -4,7 +4,6 @@
<file>icon.png</file> <file>icon.png</file>
<file>../../CREDITS.txt</file> <file>../../CREDITS.txt</file>
<file>../../DONATIONS.txt</file> <file>../../DONATIONS.txt</file>
<file>../../BLACKLIST.txt</file>
<file>../releasenotes.txt</file> <file>../releasenotes.txt</file>
<file>images/9xdb.png</file> <file>images/9xdb.png</file>
<file>images/9xdl.png</file> <file>images/9xdl.png</file>
@ -101,6 +100,8 @@
<file>images/library/00018.png</file> <file>images/library/00018.png</file>
<file>images/library/00019.png</file> <file>images/library/00019.png</file>
<file>images/library/00020.png</file> <file>images/library/00020.png</file>
<file>images/library/00021.png</file>
<file>images/library/00022.png</file>
<file>images/library/00050.png</file> <file>images/library/00050.png</file>
<file>images/library/00051.png</file> <file>images/library/00051.png</file>
<file>images/library/00052.png</file> <file>images/library/00052.png</file>

View file

@ -101,7 +101,7 @@ void CompareDialog::dropEvent(QDropEvent *event)
if (model1Valid && model2Valid) { if (model1Valid && model2Valid) {
multimodelprinter.setModel(0, model1); multimodelprinter.setModel(0, model1);
multimodelprinter.setModel(1, model2); multimodelprinter.setModel(1, model2);
ui->textEdit->setHtml(multimodelprinter.print()); ui->textEdit->setHtml(multimodelprinter.print(ui->textEdit->document()));
} }
} }

View file

@ -8,6 +8,7 @@ enum BoardEnum {
BOARD_GRUVIN9X, BOARD_GRUVIN9X,
BOARD_SKY9X, BOARD_SKY9X,
BOARD_9XRPRO, BOARD_9XRPRO,
BOARD_AR9X,
BOARD_TARANIS, BOARD_TARANIS,
BOARD_TARANIS_PLUS, BOARD_TARANIS_PLUS,
BOARD_TARANIS_X9E BOARD_TARANIS_X9E

View file

@ -63,12 +63,15 @@ ContributorsDialog::ContributorsDialog(QWidget * parent):
" <tr><td class=\"normal\">" + tr("Honors go to Rafal Tomczak (RadioClone), Thomas Husterer (th9x) and Erez Raviv (er9x and eePe)") + "<br/></td></tr>" \ " <tr><td class=\"normal\">" + tr("Honors go to Rafal Tomczak (RadioClone), Thomas Husterer (th9x) and Erez Raviv (er9x and eePe)") + "<br/></td></tr>" \
"</table>"); "</table>");
#if 0
QFile blacklist(":/BLACKLIST.txt"); QFile blacklist(":/BLACKLIST.txt");
if (blacklist.open(QIODevice::ReadOnly | QIODevice::Text)) { if (blacklist.open(QIODevice::ReadOnly | QIODevice::Text)) {
QStringList names; QStringList names;
names << blacklist.readAll(); names << blacklist.readAll();
str.append(formatTable(tr("OpenTX Blacklist"), names, 1)); str.append(formatTable(tr("OpenTX Blacklist"), names, 1));
} }
#endif
str.append("</body></html>"); str.append("</body></html>");
ui->textEditor->setHtml(str); ui->textEditor->setHtml(str);
ui->textEditor->scroll(0, 0); ui->textEditor->scroll(0, 0);

5
companion/src/converteeprom.cpp Executable file → Normal file
View file

@ -26,8 +26,11 @@ bool convertEEprom(const QString &sourceEEprom, const QString &destinationEEprom
sourceFile.close(); sourceFile.close();
QSharedPointer<RadioData> radioData = QSharedPointer<RadioData>(new RadioData()); QSharedPointer<RadioData> radioData = QSharedPointer<RadioData>(new RadioData());
if (!loadEEprom(*radioData, (uint8_t *)eeprom.data(), eeprom_size) || !currentFirmware->saveEEPROM((uint8_t *)eeprom.data(), *radioData, variant, version)) std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEeprom(*radioData, (uint8_t *)eeprom.data(), eeprom_size));
if (!errors.test(NO_ERROR)
|| !currentFirmware->saveEEPROM((uint8_t *)eeprom.data(), *radioData, variant, version)) {
return false; return false;
}
QFile destinationFile(destinationEEprom); QFile destinationFile(destinationEEprom);
if (!destinationFile.open(QIODevice::WriteOnly)) if (!destinationFile.open(QIODevice::WriteOnly))

0
companion/src/converteeprom.h Executable file → Normal file
View file

View file

@ -481,7 +481,7 @@ QString RawSource::toString(const ModelData * model) const
QObject::tr("L21"), QObject::tr("L22"), QObject::tr("L23"), QObject::tr("L24"), QObject::tr("L25"), QObject::tr("L26"), QObject::tr("L27"), QObject::tr("L28"), QObject::tr("L29"), QObject::tr("L30"), QObject::tr("L21"), QObject::tr("L22"), QObject::tr("L23"), QObject::tr("L24"), QObject::tr("L25"), QObject::tr("L26"), QObject::tr("L27"), QObject::tr("L28"), QObject::tr("L29"), QObject::tr("L30"),
QObject::tr("L31"), QObject::tr("L32") QObject::tr("L31"), QObject::tr("L32")
}; };
if (index<0) { if (index<0) {
return QObject::tr("----"); return QObject::tr("----");
} }
@ -528,7 +528,7 @@ QString RawSource::toString(const ModelData * model) const
return CHECK_IN_ARRAY(telemetry, index); return CHECK_IN_ARRAY(telemetry, index);
} }
case SOURCE_TYPE_GVAR: case SOURCE_TYPE_GVAR:
return QObject::tr("GV%1").arg(index+1); return QObject::tr("GV%1").arg(index+1);
default: default:
return QObject::tr("----"); return QObject::tr("----");
} }
@ -536,15 +536,15 @@ QString RawSource::toString(const ModelData * model) const
bool RawSource::isPot() const bool RawSource::isPot() const
{ {
return (type == SOURCE_TYPE_STICK && return (type == SOURCE_TYPE_STICK &&
index >= NUM_STICKS && index >= NUM_STICKS &&
index < NUM_STICKS+GetCurrentFirmware()->getCapability(Pots)); index < NUM_STICKS+GetCurrentFirmware()->getCapability(Pots));
} }
bool RawSource::isSlider() const bool RawSource::isSlider() const
{ {
return (type == SOURCE_TYPE_STICK && return (type == SOURCE_TYPE_STICK &&
index >= NUM_STICKS+GetCurrentFirmware()->getCapability(Pots) && index >= NUM_STICKS+GetCurrentFirmware()->getCapability(Pots) &&
index < NUM_STICKS+GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders)); index < NUM_STICKS+GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders));
} }
@ -810,6 +810,18 @@ QString CustomFunctionData::funcToString() const
return QObject::tr("Background Music Pause"); return QObject::tr("Background Music Pause");
else if (func >= FuncAdjustGV1 && func <= FuncAdjustGVLast) else if (func >= FuncAdjustGV1 && func <= FuncAdjustGVLast)
return QObject::tr("Adjust GV%1").arg(func-FuncAdjustGV1+1); return QObject::tr("Adjust GV%1").arg(func-FuncAdjustGV1+1);
else if (func == FuncSetFailsafeInternalModule)
return QObject::tr("SetFailsafe Int. Module");
else if (func == FuncSetFailsafeExternalModule)
return QObject::tr("SetFailsafe Ext. Module");
else if (func == FuncRangeCheckInternalModule)
return QObject::tr("RangeCheck Int. Module");
else if (func == FuncRangeCheckExternalModule)
return QObject::tr("RangeCheck Ext. Module");
else if (func == FuncBindInternalModule)
return QObject::tr("Bind Int. Module");
else if (func == FuncBindExternalModule)
return QObject::tr("Bind Ext. Module");
else { else {
return QString("???"); // Highlight unknown functions with output of question marks.(BTW should not happen that we do not know what a function is) return QString("???"); // Highlight unknown functions with output of question marks.(BTW should not happen that we do not know what a function is)
} }
@ -858,7 +870,7 @@ void CustomFunctionData::populatePlaySoundParams(QStringList & qs)
qs << "SciFi" << "Robot" << "Chirp" << "Tada" << "Crickt" << "AlmClk" ; qs << "SciFi" << "Robot" << "Chirp" << "Tada" << "Crickt" << "AlmClk" ;
} }
void CustomFunctionData::populateHapticParams(QStringList & qs) void CustomFunctionData::populateHapticParams(QStringList & qs)
{ {
qs << "0" << "1" << "2" << "3"; qs << "0" << "1" << "2" << "3";
} }
@ -892,12 +904,12 @@ QString CustomFunctionData::paramToString(const ModelData * model) const
int pos = cb.findData(param); int pos = cb.findData(param);
if (pos >= 0) if (pos >= 0)
return cb.itemText(pos); return cb.itemText(pos);
else else
return QObject::tr("<font color=red><b>Inconsistent parameter</b></font>"); return QObject::tr("<font color=red><b>Inconsistent parameter</b></font>");
} }
else if ((func==FuncVolume)|| (func==FuncPlayValue)) { else if ((func==FuncVolume)|| (func==FuncPlayValue)) {
RawSource item(param); RawSource item(param);
return item.toString(); return item.toString(model);
} }
else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) { else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) {
if ( GetCurrentFirmware()->getCapability(VoicesAsNumbers)) { if ( GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
@ -924,12 +936,15 @@ QString CustomFunctionData::paramToString(const ModelData * model) const
QString CustomFunctionData::repeatToString() const QString CustomFunctionData::repeatToString() const
{ {
if (repeatParam==0) { if (repeatParam == -1) {
return QObject::tr("played once, not during startup");
}
else if (repeatParam == 0) {
return ""; return "";
} }
else { else {
unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 1 : 10; unsigned int step = IS_ARM(GetEepromInterface()->getBoard()) ? 1 : 10;
return QObject::tr("repeat") + QString("(%1").arg(step*repeatParam) + QObject::tr("s") + ")"; return QObject::tr("repeat(%1s)").arg(step*repeatParam);
} }
} }
@ -1083,8 +1098,8 @@ GeneralSettings::GeneralSettings()
} }
else { else {
QString t_trainercalib=g.profile[g.id()].trainerCalib(); QString t_trainercalib=g.profile[g.id()].trainerCalib();
int8_t t_vBatCalib=(int8_t)g.profile[g.id()].vBatCalib(); int8_t t_txVoltageCalibration=(int8_t)g.profile[g.id()].txVoltageCalibration();
int8_t t_currentCalib=(int8_t)g.profile[g.id()].currentCalib(); int8_t t_txCurrentCalibration=(int8_t)g.profile[g.id()].txCurrentCalibration();
int8_t t_PPM_Multiplier=(int8_t)g.profile[g.id()].ppmMultiplier(); int8_t t_PPM_Multiplier=(int8_t)g.profile[g.id()].ppmMultiplier();
uint8_t t_stickMode=(uint8_t)g.profile[g.id()].gsStickMode(); uint8_t t_stickMode=(uint8_t)g.profile[g.id()].gsStickMode();
uint8_t t_vBatWarn=(uint8_t)g.profile[g.id()].vBatWarn(); uint8_t t_vBatWarn=(uint8_t)g.profile[g.id()].vBatWarn();
@ -1118,8 +1133,8 @@ GeneralSettings::GeneralSettings()
if (ok) if (ok)
trainer.calib[i]=byte16; trainer.calib[i]=byte16;
} }
currentCalib=t_currentCalib; txCurrentCalibration=t_txCurrentCalibration;
vBatCalib=t_vBatCalib; txVoltageCalibration=t_txVoltageCalibration;
vBatWarn=t_vBatWarn; vBatWarn=t_vBatWarn;
PPM_Multiplier=t_PPM_Multiplier; PPM_Multiplier=t_PPM_Multiplier;
stickMode = t_stickMode; stickMode = t_stickMode;
@ -1383,12 +1398,16 @@ void ModelData::clear()
moduleData[2].ppmDelay = 300; moduleData[2].ppmDelay = 300;
int board = GetEepromInterface()->getBoard(); int board = GetEepromInterface()->getBoard();
if (IS_TARANIS(board)) { if (IS_TARANIS(board)) {
moduleData[0].protocol=PXX_XJT_X16; moduleData[0].protocol = PULSES_PXX_XJT_X16;
moduleData[1].protocol=OFF; moduleData[1].protocol = PULSES_OFF;
}
else if (IS_SKY9X(board)) {
moduleData[0].protocol = PULSES_PPM;
moduleData[1].protocol = PULSES_PPM;
} }
else { else {
moduleData[0].protocol=PPM; moduleData[0].protocol = PULSES_PPM;
moduleData[1].protocol=OFF; moduleData[1].protocol = PULSES_OFF;
} }
for (int i=0; i<C9X_MAX_FLIGHT_MODES; i++) { for (int i=0; i<C9X_MAX_FLIGHT_MODES; i++) {
flightModeData[i].clear(); flightModeData[i].clear();
@ -1601,7 +1620,7 @@ void registerEEpromInterfaces()
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_SKY9X)); eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_SKY9X));
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_9XRPRO)); eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_9XRPRO));
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS)); eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS));
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS_PLUS)); eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS_PLUS));
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS_X9E)); eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS_X9E));
eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_STOCK)); eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_STOCK));
eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_GRUVIN9X)); eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_GRUVIN9X));
@ -1615,7 +1634,7 @@ void unregisterEEpromInterfaces()
foreach(EEPROMInterface * intf, eepromInterfaces) { foreach(EEPROMInterface * intf, eepromInterfaces) {
// qDebug() << "UnregisterEepromInterfaces(): deleting " << QString::number( reinterpret_cast<uint64_t>(intf), 16 ); // qDebug() << "UnregisterEepromInterfaces(): deleting " << QString::number( reinterpret_cast<uint64_t>(intf), 16 );
delete intf; delete intf;
} }
OpenTxEepromCleanup(); OpenTxEepromCleanup();
} }
@ -1630,35 +1649,116 @@ void unregisterFirmwares()
} }
} }
bool loadEEprom(RadioData &radioData, const uint8_t *eeprom, const int size) void ShowEepromErrors(QWidget *parent, const QString &title, const QString &mainMessage, unsigned long errorsFound)
{ {
foreach(EEPROMInterface *eepromInterface, eepromInterfaces) { std::bitset<NUM_ERRORS> errors((unsigned long long)errorsFound);
if (eepromInterface->load(radioData, eeprom, size)) QStringList errorsList;
return true;
errorsList << QT_TRANSLATE_NOOP("EepromInterface", "Possible causes for this:");
if (errors.test(UNSUPPORTED_NEWER_VERSION)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom is from a newer version of OpenTX"); }
if (errors.test(NOT_OPENTX)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom is not from OpenTX"); }
if (errors.test(NOT_TH9X)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom is not from Th9X"); }
if (errors.test(NOT_GRUVIN9X)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom is not from Gruvin9X"); }
if (errors.test(NOT_ERSKY9X)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom is not from ErSky9X"); }
if (errors.test(NOT_ER9X)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom is not from Er9X"); }
if (errors.test(WRONG_SIZE)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom size is invalid"); }
if (errors.test(WRONG_FILE_SYSTEM)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom file system is invalid"); }
if (errors.test(UNKNOWN_BOARD)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom is from a unknown board"); }
if (errors.test(WRONG_BOARD)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom is from the wrong board"); }
if (errors.test(BACKUP_NOT_SUPPORTED)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Eeprom backup not supported"); }
if (errors.test(UNKNOWN_ERROR)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Something that couldn't be guessed, sorry"); }
if (errors.test(HAS_WARNINGS)) {
errorsList << QT_TRANSLATE_NOOP("EepromInterface", "Warning:");
if (errors.test(WARNING_WRONG_FIRMWARE)) { errorsList << QT_TRANSLATE_NOOP("EepromInterface", "- Your radio probably uses a wrong firmware,\n eeprom size is 4096 but only the first 2048 are used"); }
} }
return false; QMessageBox msgBox(parent);
msgBox.setWindowTitle(title);
msgBox.setIcon(QMessageBox::Critical);
msgBox.setText(mainMessage);
msgBox.setInformativeText(errorsList.join("\n"));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec();
} }
bool loadBackup(RadioData &radioData, uint8_t *eeprom, int size, int index) void ShowEepromWarnings(QWidget *parent, const QString &title, unsigned long errorsFound)
{ {
std::bitset<NUM_ERRORS> errors((unsigned long long)errorsFound);
QStringList warningsList;
if (errors.test(WARNING_WRONG_FIRMWARE)) { warningsList << QT_TRANSLATE_NOOP("EepromInterface", "- Your radio probably uses a wrong firmware,\n eeprom size is 4096 but only the first 2048 are used"); }
if (errors.test(OLD_VERSION)) { warningsList << QT_TRANSLATE_NOOP("EepromInterface", "- Your eeprom is from an old version of OpenTX, upgrading!\n You should 'save as' to keep the old file as a backup."); }
QMessageBox msgBox(parent);
msgBox.setWindowTitle(title);
msgBox.setIcon(QMessageBox::Warning);
msgBox.setText(QT_TRANSLATE_NOOP("EepromInterface", "Warnings!"));
msgBox.setInformativeText(warningsList.join("\n"));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec();
}
unsigned long LoadEeprom(RadioData &radioData, const uint8_t *eeprom, const int size)
{
std::bitset<NUM_ERRORS> errors;
foreach(EEPROMInterface *eepromInterface, eepromInterfaces) { foreach(EEPROMInterface *eepromInterface, eepromInterfaces) {
if (eepromInterface->loadBackup(radioData, eeprom, size, index)) std::bitset<NUM_ERRORS> result((unsigned long long)eepromInterface->load(radioData, eeprom, size));
return true; if (result.test(NO_ERROR)) {
return result.to_ulong();
}
else {
errors |= result;
}
} }
return false; if (errors.none()) {
errors.set(UNKNOWN_ERROR);
}
return errors.to_ulong();
}
unsigned long LoadBackup(RadioData & radioData, uint8_t * eeprom, int size, int index)
{
std::bitset<NUM_ERRORS> errors;
foreach(EEPROMInterface *eepromInterface, eepromInterfaces) {
std::bitset<NUM_ERRORS> result((unsigned long long)eepromInterface->loadBackup(radioData, eeprom, size, index));
if (result.test(NO_ERROR)) {
return result.to_ulong();
}
else {
errors |= result;
}
}
if (errors.none()) {
errors.set(UNKNOWN_ERROR);
}
return errors.to_ulong();
} }
bool loadEEpromXml(RadioData &radioData, QDomDocument &doc) unsigned long LoadEepromXml(RadioData & radioData, QDomDocument & doc)
{ {
std::bitset<NUM_ERRORS> errors;
foreach(EEPROMInterface *eepromInterface, eepromInterfaces) { foreach(EEPROMInterface *eepromInterface, eepromInterfaces) {
if (eepromInterface->loadxml(radioData, doc)) std::bitset<NUM_ERRORS> result((unsigned long long)eepromInterface->loadxml(radioData, doc));
return true; if (result.test(NO_ERROR)) {
return result.to_ulong();
}
else {
errors |= result;
}
} }
return false; if (errors.none()) {
errors.set(UNKNOWN_ERROR);
}
return errors.to_ulong();
} }
QString getBoardName(BoardEnum board) QString getBoardName(BoardEnum board)
@ -1680,6 +1780,8 @@ QString getBoardName(BoardEnum board)
return "Sky9x"; return "Sky9x";
case BOARD_9XRPRO: case BOARD_9XRPRO:
return "9XR-PRO"; return "9XR-PRO";
case BOARD_AR9X:
return "AR9X";
default: default:
return "Unknown"; return "Unknown";
} }

View file

@ -24,6 +24,7 @@
#include <QtXml> #include <QtXml>
#include <QComboBox> #include <QComboBox>
#include <iostream> #include <iostream>
#include <bitset>
#include "constants.h" #include "constants.h"
#include "simulatorinterface.h" #include "simulatorinterface.h"
@ -40,7 +41,7 @@ QString getBoardName(BoardEnum board);
#define IS_9X(board) (board==BOARD_STOCK || board==BOARD_M128) #define IS_9X(board) (board==BOARD_STOCK || board==BOARD_M128)
#define IS_STOCK(board) (board==BOARD_STOCK) #define IS_STOCK(board) (board==BOARD_STOCK)
#define IS_2560(board) (board==BOARD_GRUVIN9X || board==BOARD_MEGA2560) #define IS_2560(board) (board==BOARD_GRUVIN9X || board==BOARD_MEGA2560)
#define IS_SKY9X(board) (board==BOARD_SKY9X || board==BOARD_9XRPRO) #define IS_SKY9X(board) (board==BOARD_SKY9X || board==BOARD_9XRPRO || board==BOARD_AR9X)
#define IS_9XRPRO(board) (board==BOARD_9XRPRO) #define IS_9XRPRO(board) (board==BOARD_9XRPRO)
#define IS_TARANIS(board) (board==BOARD_TARANIS || board==BOARD_TARANIS_PLUS || board==BOARD_TARANIS_X9E) #define IS_TARANIS(board) (board==BOARD_TARANIS || board==BOARD_TARANIS_PLUS || board==BOARD_TARANIS_X9E)
#define IS_TARANIS_PLUS(board) (board==BOARD_TARANIS_PLUS || board==BOARD_TARANIS_X9E) #define IS_TARANIS_PLUS(board) (board==BOARD_TARANIS_PLUS || board==BOARD_TARANIS_X9E)
@ -183,19 +184,6 @@ extern const char downArrow[];
class ModelData; class ModelData;
class GeneralSettings; class GeneralSettings;
enum ThrottleSource {
THROTTLE_SOURCE_THR,
THROTTLE_SOURCE_P1,
THROTTLE_SOURCE_P2,
THROTTLE_SOURCE_P3,
THROTTLE_SOURCE_S1 = THROTTLE_SOURCE_P1,
THROTTLE_SOURCE_S2,
THROTTLE_SOURCE_S3,
THROTTLE_SOURCE_LS,
THROTTLE_SOURCE_RS,
THROTTLE_SOURCE_FIRST_CHANNEL,
};
enum TelemetrySource { enum TelemetrySource {
TELEMETRY_SOURCE_TX_BATT, TELEMETRY_SOURCE_TX_BATT,
TELEMETRY_SOURCE_TX_TIME, TELEMETRY_SOURCE_TX_TIME,
@ -610,6 +598,12 @@ enum AssignFunc {
FuncBackgroundMusicPause, FuncBackgroundMusicPause,
FuncAdjustGV1, FuncAdjustGV1,
FuncAdjustGVLast = FuncAdjustGV1+C9X_MAX_GVARS-1, FuncAdjustGVLast = FuncAdjustGV1+C9X_MAX_GVARS-1,
FuncSetFailsafeInternalModule,
FuncSetFailsafeExternalModule,
FuncRangeCheckInternalModule,
FuncRangeCheckExternalModule,
FuncBindInternalModule,
FuncBindExternalModule,
FuncCount, FuncCount,
FuncReserve = -1 FuncReserve = -1
}; };
@ -815,31 +809,31 @@ class TimerData {
void clear() { memset(this, 0, sizeof(TimerData)); mode = RawSwitch(SWITCH_TYPE_TIMER_MODE, 0); } void clear() { memset(this, 0, sizeof(TimerData)); mode = RawSwitch(SWITCH_TYPE_TIMER_MODE, 0); }
}; };
enum Protocol { enum PulsesProtocol {
OFF, PULSES_OFF,
PPM, PULSES_PPM,
SILV_A, PULSES_SILV_A,
SILV_B, PULSES_SILV_B,
SILV_C, PULSES_SILV_C,
CTP1009, PULSES_CTP1009,
LP45, PULSES_LP45,
DSM2, PULSES_DSM2,
DSMX, PULSES_DSMX,
PPM16, PULSES_PPM16,
PPMSIM, PULSES_PPMSIM,
PXX_XJT_X16, PULSES_PXX_XJT_X16,
PXX_XJT_D8, PULSES_PXX_XJT_D8,
PXX_XJT_LR12, PULSES_PXX_XJT_LR12,
PXX_DJT, PULSES_PXX_DJT,
PROTO_LAST PULSES_PROTOCOL_LAST
}; };
enum TrainerProtocol { enum TrainerProtocol {
MASTER_JACK, TRAINER_MASTER_JACK,
SLAVE_JACK, TRAINER_SLAVE_JACK,
MASTER_SBUS_MODULE, TRAINER_MASTER_SBUS_MODULE,
MASTER_CPPM_MODULE, TRAINER_MASTER_CPPM_MODULE,
MASTER_SBUS_BATT_COMPARTMENT TRAINER_MASTER_SBUS_BATT_COMPARTMENT
}; };
class ModuleData { class ModuleData {
@ -854,7 +848,7 @@ class ModuleData {
int failsafeChannels[C9X_NUM_CHNOUT]; int failsafeChannels[C9X_NUM_CHNOUT];
int ppmDelay; int ppmDelay;
bool ppmPulsePol; // false = positive bool ppmPulsePol; // false = positive
bool ppmOutputType; // false = open drain, true = push pull bool ppmOutputType; // false = open drain, true = push pull
int ppmFrameLength; int ppmFrameLength;
void clear() { memset(this, 0, sizeof(ModuleData)); } void clear() { memset(this, 0, sizeof(ModuleData)); }
QString polarityToString() const { return ppmPulsePol ? QObject::tr("Positive") : QObject::tr("Negative"); } // TODO ModelPrinter QString polarityToString() const { return ppmPulsePol ? QObject::tr("Positive") : QObject::tr("Negative"); } // TODO ModelPrinter
@ -1054,6 +1048,8 @@ class ModelData {
SensorData sensorData[C9X_MAX_SENSORS]; SensorData sensorData[C9X_MAX_SENSORS];
unsigned int toplcdTimer;
void clear(); void clear();
bool isEmpty() const; bool isEmpty() const;
void setDefaultInputs(const GeneralSettings & settings); void setDefaultInputs(const GeneralSettings & settings);
@ -1139,7 +1135,8 @@ class GeneralSettings {
unsigned int currModel; // 0..15 unsigned int currModel; // 0..15
unsigned int contrast; unsigned int contrast;
unsigned int vBatWarn; unsigned int vBatWarn;
int vBatCalib; int txVoltageCalibration;
int txCurrentCalibration;
int vBatMin; int vBatMin;
int vBatMax; int vBatMax;
int backlightMode; int backlightMode;
@ -1187,7 +1184,6 @@ class GeneralSettings {
int speakerVolume; int speakerVolume;
unsigned int backlightBright; unsigned int backlightBright;
int switchesDelay; int switchesDelay;
int currentCalib;
int temperatureCalib; int temperatureCalib;
int temperatureWarn; int temperatureWarn;
unsigned int mAhWarn; unsigned int mAhWarn;
@ -1318,7 +1314,7 @@ enum Capability {
PPMCenter, PPMCenter,
PPMUnitMicroseconds, PPMUnitMicroseconds,
SYMLimits, SYMLimits,
HasCurrentCalibration, HastxCurrentCalibration,
HasVolume, HasVolume,
HasBrightness, HasBrightness,
PerModelTimers, PerModelTimers,
@ -1330,6 +1326,7 @@ enum Capability {
LCDWidth, LCDWidth,
GetThrSwitch, GetThrSwitch,
HasDisplayText, HasDisplayText,
HasTopLcd,
GlobalFunctions, GlobalFunctions,
VirtualInputs, VirtualInputs,
TrainerInputs, TrainerInputs,
@ -1349,7 +1346,8 @@ enum Capability {
HasInputDiff, HasInputDiff,
HasMixerExpo, HasMixerExpo,
MixersMonitor, MixersMonitor,
HasBatMeterRange HasBatMeterRange,
DangerousFunctions,
}; };
class SimulatorInterface; class SimulatorInterface;
@ -1366,11 +1364,11 @@ class EEPROMInterface
inline BoardEnum getBoard() { return board; } inline BoardEnum getBoard() { return board; }
virtual bool load(RadioData &radioData, const uint8_t *eeprom, int size) = 0; virtual unsigned long load(RadioData &radioData, const uint8_t *eeprom, int size) = 0;
virtual bool loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index) = 0; virtual unsigned long loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index) = 0;
virtual bool loadxml(RadioData &radioData, QDomDocument &doc) = 0; virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc) = 0;
virtual int save(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, uint8_t version=0) = 0; virtual int save(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, uint8_t version=0) = 0;
@ -1378,7 +1376,7 @@ class EEPROMInterface
virtual int getSize(const GeneralSettings &) = 0; virtual int getSize(const GeneralSettings &) = 0;
virtual int isAvailable(Protocol proto, int port=0) = 0; virtual int isAvailable(PulsesProtocol proto, int port=0) = 0;
virtual const int getEEpromSize() = 0; virtual const int getEEpromSize() = 0;
@ -1493,9 +1491,35 @@ void unregisterEEpromInterfaces();
void registerOpenTxFirmwares(); void registerOpenTxFirmwares();
void unregisterFirmwares(); void unregisterFirmwares();
bool loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index); enum EepromLoadErrors {
bool loadEEprom(RadioData &radioData, const uint8_t *eeprom, int size); NO_ERROR,
bool loadEEpromXml(RadioData &radioData, QDomDocument &doc);
UNKNOWN_ERROR,
UNSUPPORTED_NEWER_VERSION,
WRONG_SIZE,
WRONG_FILE_SYSTEM,
NOT_OPENTX,
NOT_TH9X,
NOT_GRUVIN9X,
NOT_ERSKY9X,
NOT_ER9X,
UNKNOWN_BOARD,
WRONG_BOARD,
BACKUP_NOT_SUPPORTED,
HAS_WARNINGS,
OLD_VERSION,
WARNING_WRONG_FIRMWARE,
NUM_ERRORS
};
void ShowEepromErrors(QWidget *parent, const QString &title, const QString &mainMessage, unsigned long errorsFound);
void ShowEepromWarnings(QWidget *parent, const QString &title, unsigned long errorsFound);
unsigned long LoadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index);
unsigned long LoadEeprom(RadioData &radioData, const uint8_t *eeprom, int size);
unsigned long LoadEepromXml(RadioData &radioData, QDomDocument &doc);
struct Option { struct Option {
const char * name; const char * name;

0
companion/src/firmwareinterface.cpp Executable file → Normal file
View file

0
companion/src/firmwareinterface.h Executable file → Normal file
View file

View file

@ -70,7 +70,7 @@ Er9xGeneral::operator GeneralSettings ()
result.currModel = currModel; result.currModel = currModel;
result.contrast = contrast; result.contrast = contrast;
result.vBatWarn = vBatWarn; result.vBatWarn = vBatWarn;
result.vBatCalib = vBatCalib; result.txVoltageCalibration = txVoltageCalibration;
result.trainer = trainer; result.trainer = trainer;
result.blightinv=blightinv; result.blightinv=blightinv;
result.stickScroll=stickScroll; result.stickScroll=stickScroll;
@ -361,16 +361,16 @@ t_Er9xModelData::operator ModelData ()
c9x.timers[0].val = tmrVal; c9x.timers[0].val = tmrVal;
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].ppmFrameLength=ppmFrameLength; c9x.moduleData[0].ppmFrameLength=ppmFrameLength;

View file

@ -61,7 +61,7 @@ PACK(typedef struct t_Er9xGeneral {
uint8_t currModel; //0..15 uint8_t currModel; //0..15
uint8_t contrast; uint8_t contrast;
uint8_t vBatWarn; uint8_t vBatWarn;
int8_t vBatCalib; int8_t txVoltageCalibration;
int8_t lightSw; int8_t lightSw;
Er9xTrainerData trainer; Er9xTrainerData trainer;
uint8_t view; uint8_t view;

View file

@ -89,14 +89,17 @@ inline void applyStickModeToModel(Er9xModelData & model, unsigned int mode)
model.swashCollectiveSource = applyStickMode(model.swashCollectiveSource, mode); model.swashCollectiveSource = applyStickMode(model.swashCollectiveSource, mode);
} }
bool Er9xInterface::loadxml(RadioData &radioData, QDomDocument &doc) unsigned long Er9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
{ {
std::cout << "trying er9x xml import... "; std::cout << "trying er9x xml import... ";
std::bitset<NUM_ERRORS> errors;
Er9xGeneral er9xGeneral; Er9xGeneral er9xGeneral;
memset(&er9xGeneral,0,sizeof(er9xGeneral)); memset(&er9xGeneral,0,sizeof(er9xGeneral));
if(!loadGeneralDataXML(&doc, &er9xGeneral)) { if(!loadGeneralDataXML(&doc, &er9xGeneral)) {
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} else { } else {
radioData.generalSettings=er9xGeneral; radioData.generalSettings=er9xGeneral;
std::cout << "version " << (unsigned int)er9xGeneral.myVers << " "; std::cout << "version " << (unsigned int)er9xGeneral.myVers << " ";
@ -111,21 +114,26 @@ bool Er9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
} }
} }
std::cout << "ok\n"; std::cout << "ok\n";
return true; errors.set(NO_ERROR);
return errors.to_ulong();
} }
bool Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size) unsigned long Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
{ {
std::cout << "trying er9x import... "; std::cout << "trying er9x import... ";
std::bitset<NUM_ERRORS> errors;
if (size != getEEpromSize()) { if (size != getEEpromSize()) {
std::cout << "wrong size\n"; std::cout << "wrong size\n";
return false; errors.set(WRONG_SIZE);
return errors.to_ulong();
} }
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) { if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) {
std::cout << "wrong file system\n"; std::cout << "wrong file system\n";
return false; errors.set(WRONG_FILE_SYSTEM);
return errors.to_ulong();
} }
efile->openRd(FILE_GENERAL); efile->openRd(FILE_GENERAL);
@ -133,7 +141,8 @@ bool Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
if (efile->readRlc1((uint8_t*)&er9xGeneral, 1) != 1) { if (efile->readRlc1((uint8_t*)&er9xGeneral, 1) != 1) {
std::cout << "no\n"; std::cout << "no\n";
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
std::cout << "version " << (unsigned int)er9xGeneral.myVers << " "; std::cout << "version " << (unsigned int)er9xGeneral.myVers << " ";
@ -151,13 +160,16 @@ bool Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
break; break;
default: default:
std::cout << "not er9x\n"; std::cout << "not er9x\n";
return false; errors.set(NOT_ER9X);
return errors.to_ulong();
} }
efile->openRd(FILE_GENERAL); efile->openRd(FILE_GENERAL);
if (!efile->readRlc1((uint8_t*)&er9xGeneral, sizeof(Er9xGeneral))) { if (!efile->readRlc1((uint8_t*)&er9xGeneral, sizeof(Er9xGeneral))) {
std::cout << "ko\n"; std::cout << "ko\n";
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
radioData.generalSettings = er9xGeneral; radioData.generalSettings = er9xGeneral;
@ -174,12 +186,15 @@ bool Er9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
} }
std::cout << "ok\n"; std::cout << "ok\n";
return true; errors.set(NO_ERROR);
return errors.to_ulong();
} }
bool Er9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index) unsigned long Er9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
{ {
return false; std::bitset<NUM_ERRORS> errors;
errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
int Er9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version) int Er9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
@ -200,13 +215,13 @@ int Er9xInterface::getSize(const GeneralSettings &settings)
return 0; return 0;
} }
int Er9xInterface::isAvailable(Protocol prot, int port) int Er9xInterface::isAvailable(PulsesProtocol prot, int port)
{ {
switch (prot) { switch (prot) {
case PPM: case PULSES_PPM:
case DSM2: case PULSES_DSM2:
case PXX_DJT: case PULSES_PXX_DJT:
case PPM16: case PULSES_PPM16:
return 1; return 1;
default: default:
return 0; return 0;

View file

@ -1,6 +1,6 @@
/* /*
* Author - Bertrand Songis <bsongis@gmail.com> * Author - Bertrand Songis <bsongis@gmail.com>
* *
* Based on th9x -> http://code.google.com/p/th9x/ * Based on th9x -> http://code.google.com/p/th9x/
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -29,24 +29,24 @@ class Er9xInterface : public EEPROMInterface
virtual ~Er9xInterface(); virtual ~Er9xInterface();
virtual const char * getName(); virtual const char * getName();
virtual const int getEEpromSize(); virtual const int getEEpromSize();
virtual const int getMaxModels(); virtual const int getMaxModels();
virtual bool load(RadioData &, const uint8_t * eeprom, int size); virtual unsigned long load(RadioData &, const uint8_t * eeprom, int size);
virtual bool loadBackup(RadioData &, uint8_t * eeprom, int esize, int index); virtual unsigned long loadBackup(RadioData &, uint8_t * eeprom, int esize, int index);
virtual bool loadxml(RadioData &radioData, QDomDocument &doc); virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
virtual int save(uint8_t * eeprom, RadioData & radioData, uint32_t variant=0, uint8_t version=0); virtual int save(uint8_t * eeprom, RadioData & radioData, uint32_t variant=0, uint8_t version=0);
virtual int getSize(const ModelData &); virtual int getSize(const ModelData &);
virtual int getSize(const GeneralSettings &settings); virtual int getSize(const GeneralSettings &settings);
virtual int isAvailable(Protocol proto, int port=0); virtual int isAvailable(PulsesProtocol proto, int port=0);
protected: protected:
@ -54,17 +54,17 @@ class Er9xInterface : public EEPROMInterface
private: private:
void appendTextElement(QDomDocument * qdoc, QDomElement * pe, QString name, QString value); void appendTextElement(QDomDocument * qdoc, QDomElement * pe, QString name, QString value);
void appendNumberElement(QDomDocument * qdoc, QDomElement * pe,QString name, int value, bool forceZeroWrite = false); void appendNumberElement(QDomDocument * qdoc, QDomElement * pe,QString name, int value, bool forceZeroWrite = false);
void appendCDATAElement(QDomDocument * qdoc, QDomElement * pe,QString name, const char * data, int size); void appendCDATAElement(QDomDocument * qdoc, QDomElement * pe,QString name, const char * data, int size);
QDomElement getGeneralDataXML(QDomDocument * qdoc, Er9xGeneral * tgen); //parse out data to XML format QDomElement getGeneralDataXML(QDomDocument * qdoc, Er9xGeneral * tgen); //parse out data to XML format
QDomElement getModelDataXML(QDomDocument * qdoc, Er9xModelData * tmod, int modelNum, int mdver); //parse out data to XML format QDomElement getModelDataXML(QDomDocument * qdoc, Er9xModelData * tmod, int modelNum, int mdver); //parse out data to XML format
bool loadGeneralDataXML(QDomDocument * qdoc, Er9xGeneral * tgen); // get data from XML bool loadGeneralDataXML(QDomDocument * qdoc, Er9xGeneral * tgen); // get data from XML
bool loadModelDataXML(QDomDocument * qdoc, Er9xModelData * tmod, int modelNum = -1); // get data from XML bool loadModelDataXML(QDomDocument * qdoc, Er9xModelData * tmod, int modelNum = -1); // get data from XML
}; };

View file

@ -82,7 +82,7 @@ Ersky9xGeneral::operator GeneralSettings ()
result.currModel = currModel; result.currModel = currModel;
result.contrast = contrast; result.contrast = contrast;
result.vBatWarn = vBatWarn; result.vBatWarn = vBatWarn;
result.vBatCalib = vBatCalib; result.txVoltageCalibration = txVoltageCalibration;
result.backlightMode = 0; result.backlightMode = 0;
if (lightSw == 22) { if (lightSw == 22) {
@ -135,7 +135,7 @@ Ersky9xGeneral::operator GeneralSettings ()
result.switchWarningStates = switchWarningStates; result.switchWarningStates = switchWarningStates;
result.speakerVolume = volume; result.speakerVolume = volume;
result.backlightBright = bright ; result.backlightBright = bright ;
result.currentCalib = current_calib; result.txCurrentCalibration = current_calib;
return result; return result;
} }
@ -493,16 +493,16 @@ t_Ersky9xModelData_v10::operator ModelData ()
} }
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].ppmFrameLength=ppmFrameLength; c9x.moduleData[0].ppmFrameLength=ppmFrameLength;
@ -608,16 +608,16 @@ t_Ersky9xModelData_v11::operator ModelData ()
} }
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].ppmFrameLength=ppmFrameLength; c9x.moduleData[0].ppmFrameLength=ppmFrameLength;

View file

@ -69,7 +69,7 @@ PACK(typedef struct t_Ersky9xGeneral {
uint8_t currModel; //0..15 uint8_t currModel; //0..15
uint8_t contrast; uint8_t contrast;
uint8_t vBatWarn; uint8_t vBatWarn;
int8_t vBatCalib; int8_t txVoltageCalibration;
int8_t lightSw; int8_t lightSw;
Ersky9xTrainerData trainer; Ersky9xTrainerData trainer;
uint8_t view; uint8_t view;

View file

@ -15,7 +15,6 @@
*/ */
#include <iostream> #include <iostream>
#include <QMessageBox>
#include "ersky9xinterface.h" #include "ersky9xinterface.h"
#include "ersky9xeeprom.h" #include "ersky9xeeprom.h"
#include "simulator/ersky9xsimulator.h" #include "simulator/ersky9xsimulator.h"
@ -120,14 +119,17 @@ inline void applyStickModeToModel(Ersky9xModelData_v11 & model, unsigned int mod
model.swashCollectiveSource = applyStickMode(model.swashCollectiveSource, mode); model.swashCollectiveSource = applyStickMode(model.swashCollectiveSource, mode);
} }
bool Ersky9xInterface::loadxml(RadioData &radioData, QDomDocument &doc) unsigned long Ersky9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
{ {
std::cout << "trying ersky9x xml import... "; std::cout << "trying ersky9x xml import... ";
std::bitset<NUM_ERRORS> errors;
Ersky9xGeneral ersky9xGeneral; Ersky9xGeneral ersky9xGeneral;
memset(&ersky9xGeneral,0,sizeof(ersky9xGeneral)); memset(&ersky9xGeneral,0,sizeof(ersky9xGeneral));
if(!loadGeneralDataXML(&doc, &ersky9xGeneral)) { if(!loadGeneralDataXML(&doc, &ersky9xGeneral)) {
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
else { else {
radioData.generalSettings=ersky9xGeneral; radioData.generalSettings=ersky9xGeneral;
@ -137,32 +139,39 @@ bool Ersky9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
if (ersky9xGeneral.myVers == 10) { if (ersky9xGeneral.myVers == 10) {
if (!loadModelDataXML<Ersky9xModelData_v10>(&doc, &radioData.models[i], i, radioData.generalSettings.stickMode+1)) { if (!loadModelDataXML<Ersky9xModelData_v10>(&doc, &radioData.models[i], i, radioData.generalSettings.stickMode+1)) {
std::cout << "ko\n"; std::cout << "ko\n";
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
} }
else { else {
if (!loadModelDataXML<Ersky9xModelData_v11>(&doc, &radioData.models[i], i, radioData.generalSettings.stickMode+1)) { if (!loadModelDataXML<Ersky9xModelData_v11>(&doc, &radioData.models[i], i, radioData.generalSettings.stickMode+1)) {
std::cout << "ko\n"; std::cout << "ko\n";
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
} }
} }
std::cout << "ok\n"; std::cout << "ok\n";
return true; errors.set(NO_ERROR);
return errors.to_ulong();
} }
bool Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size) unsigned long Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
{ {
std::cout << "trying ersky9x import... "; std::cout << "trying ersky9x import... ";
std::bitset<NUM_ERRORS> errors;
if (size != EESIZE_SKY9X) { if (size != EESIZE_SKY9X) {
std::cout << "wrong size\n"; std::cout << "wrong size\n";
return false; errors.set(WRONG_SIZE);
return errors.to_ulong();
} }
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_SKY9X)) { if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_SKY9X)) {
std::cout << "wrong file system\n"; std::cout << "wrong file system\n";
return false; errors.set(WRONG_FILE_SYSTEM);
return errors.to_ulong();
} }
efile->openRd(FILE_GENERAL); efile->openRd(FILE_GENERAL);
@ -170,7 +179,8 @@ bool Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int siz
if (efile->readRlc2((uint8_t*)&ersky9xGeneral, 1) != 1) { if (efile->readRlc2((uint8_t*)&ersky9xGeneral, 1) != 1) {
std::cout << "no\n"; std::cout << "no\n";
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
std::cout << "version " << (unsigned int)ersky9xGeneral.myVers << " "; std::cout << "version " << (unsigned int)ersky9xGeneral.myVers << " ";
@ -182,12 +192,14 @@ bool Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int siz
break; break;
default: default:
std::cout << "not ersky9x\n"; std::cout << "not ersky9x\n";
return false; errors.set(NOT_ERSKY9X);
return errors.to_ulong();
} }
efile->openRd(FILE_GENERAL); efile->openRd(FILE_GENERAL);
if (!efile->readRlc2((uint8_t*)&ersky9xGeneral, sizeof(Ersky9xGeneral))) { if (!efile->readRlc2((uint8_t*)&ersky9xGeneral, sizeof(Ersky9xGeneral))) {
std::cout << "ko\n"; std::cout << "ko\n";
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
radioData.generalSettings = ersky9xGeneral; radioData.generalSettings = ersky9xGeneral;
@ -218,12 +230,15 @@ bool Ersky9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int siz
} }
std::cout << "ok\n"; std::cout << "ok\n";
return true; errors.set(NO_ERROR);
return errors.to_ulong();
} }
bool Ersky9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index) unsigned long Ersky9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
{ {
return false; std::bitset<NUM_ERRORS> errors;
errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
int Ersky9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version) int Ersky9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
@ -244,13 +259,13 @@ int Ersky9xInterface::getSize(const GeneralSettings & settings)
return 0; return 0;
} }
int Ersky9xInterface::isAvailable(Protocol prot, int port) int Ersky9xInterface::isAvailable(PulsesProtocol prot, int port)
{ {
switch (prot) { switch (prot) {
case PPM: case PULSES_PPM:
case DSM2: case PULSES_DSM2:
case PXX_DJT: case PULSES_PXX_DJT:
case PPM16: case PULSES_PPM16:
return 1; return 1;
default: default:
return 0; return 0;

View file

@ -34,11 +34,11 @@ class Ersky9xInterface : public EEPROMInterface
virtual const int getMaxModels(); virtual const int getMaxModels();
virtual bool load(RadioData &, const uint8_t * eeprom, int size); virtual unsigned long load(RadioData &, const uint8_t * eeprom, int size);
virtual bool loadBackup(RadioData &, uint8_t * eeprom, int esize, int index); virtual unsigned long loadBackup(RadioData &, uint8_t * eeprom, int esize, int index);
virtual bool loadxml(RadioData &radioData, QDomDocument &doc); virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
virtual int save(uint8_t * eeprom, RadioData & radioData, uint32_t variant=0, uint8_t version=0); virtual int save(uint8_t * eeprom, RadioData & radioData, uint32_t variant=0, uint8_t version=0);
@ -46,7 +46,7 @@ class Ersky9xInterface : public EEPROMInterface
virtual int getSize(const GeneralSettings & settings); virtual int getSize(const GeneralSettings & settings);
virtual int isAvailable(Protocol proto, int port=0); virtual int isAvailable(PulsesProtocol proto, int port=0);
protected: protected:

View file

@ -70,7 +70,7 @@ Gruvin9xGeneral_v103::operator GeneralSettings ()
result.currModel = currModel; result.currModel = currModel;
result.contrast = contrast; result.contrast = contrast;
result.vBatWarn = vBatWarn; result.vBatWarn = vBatWarn;
result.vBatCalib = vBatCalib; result.txVoltageCalibration = txVoltageCalibration;
result.backlightMode = 0; result.backlightMode = 0;
if (lightSw == 22) { if (lightSw == 22) {
@ -127,7 +127,7 @@ Gruvin9xGeneral_v104::operator GeneralSettings ()
result.currModel = currModel; result.currModel = currModel;
result.contrast = contrast; result.contrast = contrast;
result.vBatWarn = vBatWarn; result.vBatWarn = vBatWarn;
result.vBatCalib = vBatCalib; result.txVoltageCalibration = txVoltageCalibration;
result.backlightMode = 0; result.backlightMode = 0;
if (lightSw == 22) { if (lightSw == 22) {
@ -423,25 +423,25 @@ t_Gruvin9xModelData_v102::operator ModelData ()
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = SILV_A; c9x.moduleData[0].protocol = PULSES_SILV_A;
break; break;
case 4: case 4:
c9x.moduleData[0].protocol = SILV_B; c9x.moduleData[0].protocol = PULSES_SILV_B;
break; break;
case 5: case 5:
c9x.moduleData[0].protocol = SILV_C; c9x.moduleData[0].protocol = PULSES_SILV_C;
break; break;
case 6: case 6:
c9x.moduleData[0].protocol = CTP1009; c9x.moduleData[0].protocol = PULSES_CTP1009;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -493,25 +493,25 @@ t_Gruvin9xModelData_v103::operator ModelData ()
c9x.timers[1] = timer2; c9x.timers[1] = timer2;
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = SILV_A; c9x.moduleData[0].protocol = PULSES_SILV_A;
break; break;
case 4: case 4:
c9x.moduleData[0].protocol = SILV_B; c9x.moduleData[0].protocol = PULSES_SILV_B;
break; break;
case 5: case 5:
c9x.moduleData[0].protocol = SILV_C; c9x.moduleData[0].protocol = PULSES_SILV_C;
break; break;
case 6: case 6:
c9x.moduleData[0].protocol = CTP1009; c9x.moduleData[0].protocol = PULSES_CTP1009;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -563,25 +563,25 @@ t_Gruvin9xModelData_v105::operator ModelData ()
c9x.timers[1] = timer2; c9x.timers[1] = timer2;
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = SILV_A; c9x.moduleData[0].protocol = PULSES_SILV_A;
break; break;
case 4: case 4:
c9x.moduleData[0].protocol = SILV_B; c9x.moduleData[0].protocol = PULSES_SILV_B;
break; break;
case 5: case 5:
c9x.moduleData[0].protocol = SILV_C; c9x.moduleData[0].protocol = PULSES_SILV_C;
break; break;
case 6: case 6:
c9x.moduleData[0].protocol = CTP1009; c9x.moduleData[0].protocol = PULSES_CTP1009;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -653,25 +653,25 @@ t_Gruvin9xModelData_v106::operator ModelData ()
c9x.timers[1] = timer2; c9x.timers[1] = timer2;
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = SILV_A; c9x.moduleData[0].protocol = PULSES_SILV_A;
break; break;
case 4: case 4:
c9x.moduleData[0].protocol = SILV_B; c9x.moduleData[0].protocol = PULSES_SILV_B;
break; break;
case 5: case 5:
c9x.moduleData[0].protocol = SILV_C; c9x.moduleData[0].protocol = PULSES_SILV_C;
break; break;
case 6: case 6:
c9x.moduleData[0].protocol = CTP1009; c9x.moduleData[0].protocol = PULSES_CTP1009;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);

View file

@ -69,7 +69,7 @@ PACK(typedef struct t_Gruvin9xGeneral_v103 {
uint8_t currModel; //0..15 uint8_t currModel; //0..15
uint8_t contrast; uint8_t contrast;
uint8_t vBatWarn; uint8_t vBatWarn;
int8_t vBatCalib; int8_t txVoltageCalibration;
int8_t lightSw; int8_t lightSw;
Gruvin9xTrainerData_v103 trainer; Gruvin9xTrainerData_v103 trainer;
uint8_t view; //index of subview in main scrren uint8_t view; //index of subview in main scrren
@ -106,7 +106,7 @@ PACK(typedef struct t_Gruvin9xGeneral_v104 {
uint8_t currModel; //0..15 uint8_t currModel; //0..15
uint8_t contrast; uint8_t contrast;
uint8_t vBatWarn; uint8_t vBatWarn;
int8_t vBatCalib; int8_t txVoltageCalibration;
int8_t lightSw; int8_t lightSw;
Gruvin9xTrainerData_v104 trainer; Gruvin9xTrainerData_v104 trainer;
uint8_t view; //index of subview in main scrren uint8_t view; //index of subview in main scrren

View file

@ -93,24 +93,30 @@ bool Gruvin9xInterface::loadGeneral(GeneralSettings &settings, int version)
return false; return false;
} }
bool Gruvin9xInterface::loadxml(RadioData &radioData, QDomDocument &doc) unsigned long Gruvin9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
{ {
return false; std::bitset<NUM_ERRORS> errors;
errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
bool Gruvin9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size) unsigned long Gruvin9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
{ {
std::cout << "trying " << getName() << " import... "; std::cout << "trying " << getName() << " import... ";
std::bitset<NUM_ERRORS> errors;
if (size != this->getEEpromSize()) { if (size != this->getEEpromSize()) {
std::cout << "wrong size\n"; std::cout << "wrong size\n";
return false; errors.set(WRONG_SIZE);
return errors.to_ulong();
} }
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) { if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) {
std::cout << "wrong file system\n"; std::cout << "wrong file system\n";
return false; errors.set(WRONG_FILE_SYSTEM);
return errors.to_ulong();
} }
efile->openRd(FILE_GENERAL); efile->openRd(FILE_GENERAL);
@ -118,14 +124,16 @@ bool Gruvin9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int si
uint8_t version; uint8_t version;
if (efile->readRlc2(&version, 1) != 1) { if (efile->readRlc2(&version, 1) != 1) {
std::cout << "no\n"; std::cout << "no\n";
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
if (version == 0) { if (version == 0) {
efile->openRd(FILE_GENERAL); efile->openRd(FILE_GENERAL);
if (efile->readRlc1(&version, 1) != 1) { if (efile->readRlc1(&version, 1) != 1) {
std::cout << "no\n"; std::cout << "no\n";
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
} }
@ -145,25 +153,33 @@ bool Gruvin9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int si
break; break;
default: default:
std::cout << "not gruvin9x\n"; std::cout << "not gruvin9x\n";
return false; errors.set(NOT_GRUVIN9X);
return errors.to_ulong();
} }
efile->openRd(FILE_GENERAL); efile->openRd(FILE_GENERAL);
if (version == 5) { if (version == 5) {
if (!loadGeneral<Gruvin9xGeneral_v103>(radioData.generalSettings, 1)) if (!loadGeneral<Gruvin9xGeneral_v103>(radioData.generalSettings, 1)) {
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
}
} }
else if (version < 104) { else if (version < 104) {
if (!loadGeneral<Gruvin9xGeneral_v103>(radioData.generalSettings)) if (!loadGeneral<Gruvin9xGeneral_v103>(radioData.generalSettings)) {
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
}
} }
else if (version <= 106) { else if (version <= 106) {
if (!loadGeneral<Gruvin9xGeneral_v104>(radioData.generalSettings)) if (!loadGeneral<Gruvin9xGeneral_v104>(radioData.generalSettings)) {
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
}
} }
else { else {
std::cout << "ko\n"; std::cout << "ko\n";
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
for (int i=0; i<getMaxModels(); i++) { for (int i=0; i<getMaxModels(); i++) {
@ -185,17 +201,21 @@ bool Gruvin9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int si
} }
else { else {
std::cout << "ko\n"; std::cout << "ko\n";
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
} }
std::cout << "ok\n"; std::cout << "ok\n";
return true; errors.set(NO_ERROR);
return errors.to_ulong();
} }
bool Gruvin9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index) unsigned long Gruvin9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
{ {
return false; std::bitset<NUM_ERRORS> errors;
errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
int Gruvin9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version) int Gruvin9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
@ -216,15 +236,15 @@ int Gruvin9xInterface::getSize(const GeneralSettings & settings)
return 0; return 0;
} }
int Gruvin9xInterface::isAvailable(Protocol proto, int port) int Gruvin9xInterface::isAvailable(PulsesProtocol proto, int port)
{ {
switch (proto) { switch (proto) {
case PPM: case PULSES_PPM:
case SILV_A: case PULSES_SILV_A:
case SILV_B: case PULSES_SILV_B:
case SILV_C: case PULSES_SILV_C:
case CTP1009: case PULSES_CTP1009:
case DSM2: case PULSES_DSM2:
return 1; return 1;
default: default:
return 0; return 0;

View file

@ -1,6 +1,6 @@
/* /*
* Author - Bertrand Songis <bsongis@gmail.com> * Author - Bertrand Songis <bsongis@gmail.com>
* *
* Based on th9x -> http://code.google.com/p/th9x/ * Based on th9x -> http://code.google.com/p/th9x/
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -30,24 +30,25 @@ class Gruvin9xInterface : public EEPROMInterface
virtual ~Gruvin9xInterface(); virtual ~Gruvin9xInterface();
virtual const char * getName(); virtual const char * getName();
virtual const int getEEpromSize(); virtual const int getEEpromSize();
virtual const int getMaxModels(); virtual const int getMaxModels();
virtual bool load(RadioData &, const uint8_t *eeprom, int size); virtual unsigned long load(RadioData &, const uint8_t *eeprom, int size);
virtual bool loadBackup(RadioData &, uint8_t *eeprom,int esize, int index);
virtual unsigned long loadBackup(RadioData &, uint8_t *eeprom,int esize, int index);
virtual bool loadxml(RadioData &radioData, QDomDocument &doc);
virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
virtual int save(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, uint8_t version=0); virtual int save(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, uint8_t version=0);
virtual int getSize(const ModelData &); virtual int getSize(const ModelData &);
virtual int getSize(const GeneralSettings & settings); virtual int getSize(const GeneralSettings & settings);
virtual int isAvailable(Protocol proto, int port=0); virtual int isAvailable(PulsesProtocol proto, int port=0);
protected: protected:

View file

@ -440,16 +440,16 @@ t_Open9xGruvin9xModelData_v207::operator ModelData ()
c9x.timers[i] = timers[i]; c9x.timers[i] = timers[i];
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -514,19 +514,19 @@ t_Open9xGruvin9xModelData_v208::operator ModelData ()
c9x.timers[i] = timers[i]; c9x.timers[i] = timers[i];
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = PPMSIM; c9x.moduleData[0].protocol = PULSES_PPMSIM;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 4: case 4:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -596,19 +596,19 @@ t_Open9xGruvin9xModelData_v209::operator ModelData ()
c9x.timers[i] = timers[i]; c9x.timers[i] = timers[i];
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = PPMSIM; c9x.moduleData[0].protocol = PULSES_PPMSIM;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 4: case 4:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -679,19 +679,19 @@ t_Open9xGruvin9xModelData_v210::operator ModelData ()
c9x.timers[i] = timers[i]; c9x.timers[i] = timers[i];
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = PPMSIM; c9x.moduleData[0].protocol = PULSES_PPMSIM;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 4: case 4:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -766,19 +766,19 @@ t_Open9xGruvin9xModelData_v211::operator ModelData ()
} }
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = PPMSIM; c9x.moduleData[0].protocol = PULSES_PPMSIM;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 4: case 4:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);

View file

@ -716,19 +716,19 @@ t_Open9xArmModelData_v208::operator ModelData ()
c9x.timers[i] = timers[i]; c9x.timers[i] = timers[i];
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = PPMSIM; c9x.moduleData[0].protocol = PULSES_PPMSIM;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 4: case 4:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -799,19 +799,19 @@ t_Open9xArmModelData_v209::operator ModelData ()
c9x.timers[i] = timers[i]; c9x.timers[i] = timers[i];
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = PPMSIM; c9x.moduleData[0].protocol = PULSES_PPMSIM;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 4: case 4:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -883,19 +883,19 @@ t_Open9xArmModelData_v210::operator ModelData ()
c9x.timers[i] = timers[i]; c9x.timers[i] = timers[i];
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = PPMSIM; c9x.moduleData[0].protocol = PULSES_PPMSIM;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 4: case 4:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -967,19 +967,19 @@ t_Open9xArmModelData_v211::operator ModelData ()
c9x.timers[i] = timers[i]; c9x.timers[i] = timers[i];
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = PPMSIM; c9x.moduleData[0].protocol = PULSES_PPMSIM;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 4: case 4:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -1054,19 +1054,19 @@ t_Open9xArmModelData_v212::operator ModelData ()
} }
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = PPMSIM; c9x.moduleData[0].protocol = PULSES_PPMSIM;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 4: case 4:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);

View file

@ -917,16 +917,16 @@ t_Open9xModelData_v201::operator ModelData ()
c9x.timers[1] = timer2; c9x.timers[1] = timer2;
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -991,16 +991,16 @@ t_Open9xModelData_v202::operator ModelData ()
c9x.timers[1] = timer2; c9x.timers[1] = timer2;
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -1067,16 +1067,16 @@ t_Open9xModelData_v203::operator ModelData ()
c9x.timers[1] = timer2; c9x.timers[1] = timer2;
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -1141,16 +1141,16 @@ t_Open9xModelData_v204::operator ModelData ()
c9x.timers[1] = timer2; c9x.timers[1] = timer2;
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -1217,19 +1217,19 @@ t_Open9xModelData_v205::operator ModelData ()
c9x.timers[i] = timers[i]; c9x.timers[i] = timers[i];
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
case 4: case 4:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -1295,19 +1295,19 @@ t_Open9xModelData_v208::operator ModelData ()
c9x.timers[i] = timers[i]; c9x.timers[i] = timers[i];
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = PPMSIM; c9x.moduleData[0].protocol = PULSES_PPMSIM;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 4: case 4:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -1381,19 +1381,19 @@ t_Open9xModelData_v209::operator ModelData ()
c9x.timers[i] = timers[i]; c9x.timers[i] = timers[i];
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = PPMSIM; c9x.moduleData[0].protocol = PULSES_PPMSIM;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 4: case 4:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -1468,19 +1468,19 @@ t_Open9xModelData_v210::operator ModelData ()
c9x.timers[i] = timers[i]; c9x.timers[i] = timers[i];
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = PPMSIM; c9x.moduleData[0].protocol = PULSES_PPMSIM;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 4: case 4:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
@ -1556,19 +1556,19 @@ t_Open9xModelData_v211::operator ModelData ()
c9x.timers[i] = timers[i]; c9x.timers[i] = timers[i];
switch(protocol) { switch(protocol) {
case 1: case 1:
c9x.moduleData[0].protocol = PPM16; c9x.moduleData[0].protocol = PULSES_PPM16;
break; break;
case 2: case 2:
c9x.moduleData[0].protocol = PPMSIM; c9x.moduleData[0].protocol = PULSES_PPMSIM;
break; break;
case 3: case 3:
c9x.moduleData[0].protocol = PXX_DJT; c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break; break;
case 4: case 4:
c9x.moduleData[0].protocol = DSM2; c9x.moduleData[0].protocol = PULSES_DSM2;
break; break;
default: default:
c9x.moduleData[0].protocol = PPM; c9x.moduleData[0].protocol = PULSES_PPM;
break; break;
} }
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH); c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);

View file

@ -12,7 +12,7 @@
#define HAS_PERSISTENT_TIMERS(board) (IS_ARM(board) || IS_2560(board)) #define HAS_PERSISTENT_TIMERS(board) (IS_ARM(board) || IS_2560(board))
#define HAS_LARGE_LCD(board) IS_TARANIS(board) #define HAS_LARGE_LCD(board) IS_TARANIS(board)
#define MAX_VIEWS(board) (HAS_LARGE_LCD(board) ? 2 : 256) #define MAX_VIEWS(board) (HAS_LARGE_LCD(board) ? 2 : 256)
#define MAX_POTS(board) (IS_TARANIS(board) ? (IS_TARANIS_X9E(board) ? 4 : 3) : 3) #define MAX_POTS(board, version) (IS_TARANIS(board) ? (IS_TARANIS_X9E(board) ? 4 : (version >= 216 ? 3 : 2)) : 3)
#define MAX_SLIDERS(board) (IS_TARANIS(board) ? (IS_TARANIS_X9E(board) ? 4 : 2) : 0) #define MAX_SLIDERS(board) (IS_TARANIS(board) ? (IS_TARANIS_X9E(board) ? 4 : 2) : 0)
#define MAX_SWITCHES(board, version) (IS_TARANIS(board) ? (IS_TARANIS_X9E(board) ? 18 : 8) : 7) #define MAX_SWITCHES(board, version) (IS_TARANIS(board) ? (IS_TARANIS_X9E(board) ? 18 : 8) : 7)
#define MAX_SWITCHES_POSITION(board, version) (IS_TARANIS_X9E(board) ? 18*3 : (IS_TARANIS(board) ? 8*3 : 9)) #define MAX_SWITCHES_POSITION(board, version) (IS_TARANIS_X9E(board) ? 18*3 : (IS_TARANIS(board) ? 8*3 : 9))
@ -80,7 +80,7 @@ class SwitchesConversionTable: public ConversionTable {
} }
if (IS_TARANIS(board) && version >= 216) { if (IS_TARANIS(board) && version >= 216) {
for (int i=1; i<=MAX_POTS(board)*6; i++) { for (int i=1; i<=MAX_POTS(board, version)*6; i++) {
addConversion(RawSwitch(SWITCH_TYPE_MULTIPOS_POT, -i), -val+offset); addConversion(RawSwitch(SWITCH_TYPE_MULTIPOS_POT, -i), -val+offset);
addConversion(RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i), val++); addConversion(RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i), val++);
} }
@ -212,8 +212,9 @@ class SourcesConversionTable: public ConversionTable {
} }
if (IS_TARANIS(board) && version >= 216) { if (IS_TARANIS(board) && version >= 216) {
for (int i=0; i<32; i++) for (int i=0; i<32; i++) {
addConversion(RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i), val++); addConversion(RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i), val++);
}
for (int i=0; i<7; i++) { for (int i=0; i<7; i++) {
for (int j=0; j<6; j++) { for (int j=0; j<6; j++) {
addConversion(RawSource(SOURCE_TYPE_LUA_OUTPUT, i*16+j), val++); addConversion(RawSource(SOURCE_TYPE_LUA_OUTPUT, i*16+j), val++);
@ -221,16 +222,18 @@ class SourcesConversionTable: public ConversionTable {
} }
} }
for (int i=0; i<NUM_STICKS+MAX_POTS(board)+MAX_SLIDERS(board); i++) { for (int i=0; i<NUM_STICKS+MAX_POTS(board, version)+MAX_SLIDERS(board); i++) {
addConversion(RawSource(SOURCE_TYPE_STICK, i), val++); addConversion(RawSource(SOURCE_TYPE_STICK, i), val++);
} }
for (int i=0; i<MAX_ROTARY_ENCODERS(board); i++) for (int i=0; i<MAX_ROTARY_ENCODERS(board); i++) {
addConversion(RawSource(SOURCE_TYPE_ROTARY_ENCODER, 0), val++); addConversion(RawSource(SOURCE_TYPE_ROTARY_ENCODER, 0), val++);
}
if (!afterrelease21March2013) { if (!afterrelease21March2013) {
for (int i=0; i<NUM_STICKS; i++) for (int i=0; i<NUM_STICKS; i++) {
addConversion(RawSource(SOURCE_TYPE_TRIM, i), val++); addConversion(RawSource(SOURCE_TYPE_TRIM, i), val++);
}
} }
addConversion(RawSource(SOURCE_TYPE_MAX), val++); addConversion(RawSource(SOURCE_TYPE_MAX), val++);
@ -380,32 +383,6 @@ void OpenTxEepromCleanup(void)
SwitchesConversionTable::Cleanup(); SwitchesConversionTable::Cleanup();
} }
ThrottleSourceConversionTable::ThrottleSourceConversionTable(BoardEnum board, unsigned int version)
{
int val=0;
addConversion(THROTTLE_SOURCE_THR, val++);
if (IS_TARANIS(board)) {
addConversion(THROTTLE_SOURCE_S1, val++);
addConversion(THROTTLE_SOURCE_S2, val++);
if (version >= 216)
addConversion(THROTTLE_SOURCE_S3, val++);
addConversion(THROTTLE_SOURCE_LS, val++);
addConversion(THROTTLE_SOURCE_RS, val++);
}
else {
addConversion(THROTTLE_SOURCE_P1, val++);
addConversion(THROTTLE_SOURCE_P2, val++);
addConversion(THROTTLE_SOURCE_P3, val++);
}
for (int i=0; i<MAX_CHANNELS(board, version); i++) {
addConversion(THROTTLE_SOURCE_FIRST_CHANNEL+i, val++);
}
}
template <int N> template <int N>
class SwitchField: public ConversionField< SignedField<N> > { class SwitchField: public ConversionField< SignedField<N> > {
public: public:
@ -1746,6 +1723,7 @@ class LogicalSwitchField: public TransformedField {
{ {
delete andswitchesConversionTable; delete andswitchesConversionTable;
} }
virtual void beforeExport() virtual void beforeExport()
{ {
if (csw.func == LS_FN_TIMER) { if (csw.func == LS_FN_TIMER) {
@ -1787,8 +1765,14 @@ class LogicalSwitchField: public TransformedField {
switchesConversionTable->importValue(v2, csw.val2); switchesConversionTable->importValue(v2, csw.val2);
} }
else if (csw.func >= LS_FN_EQUAL && csw.func <= LS_FN_ELESS) { else if (csw.func >= LS_FN_EQUAL && csw.func <= LS_FN_ELESS) {
sourcesConversionTable->importValue((uint8_t)v1, csw.val1); if (IS_ARM(board)) {
sourcesConversionTable->importValue((uint8_t)v2, csw.val2); sourcesConversionTable->importValue((uint32_t)v1, csw.val1);
sourcesConversionTable->importValue((uint32_t)v2, csw.val2);
}
else {
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
sourcesConversionTable->importValue((uint8_t)v2, csw.val2);
}
if (IS_TARANIS(board) && version < 216) { if (IS_TARANIS(board) && version < 216) {
RawSource val1(csw.val1); RawSource val1(csw.val1);
if (val1.type == SOURCE_TYPE_STICK && val1.index < NUM_STICKS) { if (val1.type == SOURCE_TYPE_STICK && val1.index < NUM_STICKS) {
@ -1801,7 +1785,12 @@ class LogicalSwitchField: public TransformedField {
} }
} }
else if (csw.func != LS_FN_OFF) { else if (csw.func != LS_FN_OFF) {
sourcesConversionTable->importValue((uint8_t)v1, csw.val1); if (IS_ARM(board)) {
sourcesConversionTable->importValue((uint32_t)v1, csw.val1);
}
else {
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
}
if (IS_TARANIS(board) && version < 216) { if (IS_TARANIS(board) && version < 216) {
RawSource val1(csw.val1); RawSource val1(csw.val1);
if (val1.type == SOURCE_TYPE_STICK && val1.index < NUM_STICKS) { if (val1.type == SOURCE_TYPE_STICK && val1.index < NUM_STICKS) {
@ -1930,9 +1919,12 @@ class CustomFunctionsConversionTable: public ConversionTable {
val++; val++;
if (IS_ARM(board)) { if (IS_ARM(board)) {
addConversion(FuncVolume, val++); addConversion(FuncVolume, val++);
addConversion(FuncReserve, val++); addConversion(FuncSetFailsafeInternalModule, val);
addConversion(FuncReserve, val++); addConversion(FuncSetFailsafeExternalModule, val++);
addConversion(FuncReserve, val++); addConversion(FuncRangeCheckInternalModule, val);
addConversion(FuncRangeCheckExternalModule, val++);
addConversion(FuncBindInternalModule, val);
addConversion(FuncBindExternalModule, val++);
} }
addConversion(FuncPlaySound, val++); addConversion(FuncPlaySound, val++);
addConversion(FuncPlayPrompt, val++); addConversion(FuncPlayPrompt, val++);
@ -2091,6 +2083,21 @@ class ArmCustomFunctionField: public TransformedField {
*((uint8_t *)(_param+3)) = fn.func - FuncSetTimer1; *((uint8_t *)(_param+3)) = fn.func - FuncSetTimer1;
} }
} }
else if (fn.func >= FuncSetFailsafeInternalModule && fn.func <= FuncSetFailsafeExternalModule) {
if (version >= 216) {
*((uint16_t *)_param) = fn.func - FuncSetFailsafeInternalModule;
}
}
else if (fn.func >= FuncRangeCheckInternalModule && fn.func <= FuncRangeCheckExternalModule) {
if (version >= 216) {
*((uint16_t *)_param) = fn.func - FuncRangeCheckInternalModule;
}
}
else if (fn.func >= FuncBindInternalModule && fn.func <= FuncBindExternalModule) {
if (version >= 216) {
*((uint16_t *)_param) = fn.func - FuncBindInternalModule;
}
}
else if (fn.func == FuncPlayPrompt || fn.func == FuncBackgroundMusic || fn.func == FuncPlayScript) { else if (fn.func == FuncPlayPrompt || fn.func == FuncBackgroundMusic || fn.func == FuncPlayScript) {
memcpy(_param, fn.paramarm, sizeof(_param)); memcpy(_param, fn.paramarm, sizeof(_param));
} }
@ -2809,7 +2816,8 @@ class SensorField: public TransformedField {
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) { if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
_id = sensor.id; _id = sensor.id;
_instance = sensor.instance; _instance = sensor.instance;
_param = (sensor.ratio) + ((unsigned int)sensor.offset << 16); _ratio = sensor.ratio;
_offset = sensor.offset;
} }
else { else {
_id = sensor.persistentValue; _id = sensor.persistentValue;
@ -2820,7 +2828,7 @@ class SensorField: public TransformedField {
_param = ((uint8_t)sensor.sources[0]) + ((uint8_t)sensor.sources[1] << 8) + ((uint8_t)sensor.sources[2] << 16) + ((uint8_t)sensor.sources[3] << 24); _param = ((uint8_t)sensor.sources[0]) + ((uint8_t)sensor.sources[1] << 8) + ((uint8_t)sensor.sources[2] << 16) + ((uint8_t)sensor.sources[3] << 24);
else if (sensor.formula == SensorData::TELEM_FORMULA_DIST) else if (sensor.formula == SensorData::TELEM_FORMULA_DIST)
_param = (sensor.gps) + (sensor.alt << 8); _param = (sensor.gps) + (sensor.alt << 8);
else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION) else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION || sensor.formula == SensorData::TELEM_FORMULA_TOTALIZE)
_param = (sensor.amps); _param = (sensor.amps);
} }
} }
@ -2830,8 +2838,8 @@ class SensorField: public TransformedField {
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) { if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
sensor.id = _id; sensor.id = _id;
sensor.instance = _instance; sensor.instance = _instance;
sensor.ratio = _param & 0xFFFF; sensor.ratio = _ratio;
sensor.offset = (_param >> 16) & 0xFFFF; sensor.offset = _offset;
} }
else { else {
sensor.persistentValue = _id; sensor.persistentValue = _id;
@ -2843,7 +2851,7 @@ class SensorField: public TransformedField {
sensor.sources[i] = _sources[i]; sensor.sources[i] = _sources[i];
else if (sensor.formula == SensorData::TELEM_FORMULA_DIST) else if (sensor.formula == SensorData::TELEM_FORMULA_DIST)
(sensor.gps = _sources[0], sensor.alt = _sources[1]); (sensor.gps = _sources[0], sensor.alt = _sources[1]);
else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION) else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION || sensor.formula == SensorData::TELEM_FORMULA_TOTALIZE)
sensor.amps = _sources[0]; sensor.amps = _sources[0];
} }
eepromImportDebug() << QString("imported %1").arg(internalField.getName()); eepromImportDebug() << QString("imported %1").arg(internalField.getName());
@ -2857,6 +2865,10 @@ class SensorField: public TransformedField {
union { union {
unsigned int _param; unsigned int _param;
uint8_t _sources[4]; uint8_t _sources[4];
struct {
uint16_t _ratio;
int16_t _offset;
};
}; };
}; };
@ -2870,8 +2882,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
board(board), board(board),
version(version), version(version),
variant(variant), variant(variant),
protocolsConversionTable(board), protocolsConversionTable(board)
throttleSourceConversionTable(board, version)
{ {
sprintf(name, "Model %s", modelData.name); sprintf(name, "Model %s", modelData.name);
@ -3006,7 +3017,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
internalField.Append(new SignedField<8>(modelData.moduleData[0].ppmFrameLength)); internalField.Append(new SignedField<8>(modelData.moduleData[0].ppmFrameLength));
} }
internalField.Append(new ConversionField< UnsignedField<8> >(modelData.thrTraceSrc, &throttleSourceConversionTable, "Throttle Source")); internalField.Append(new UnsignedField<8>(modelData.thrTraceSrc, "Throttle Source"));
if (!afterrelease21March2013) { if (!afterrelease21March2013) {
internalField.Append(new UnsignedField<8>(modelData.moduleData[0].modelId)); internalField.Append(new UnsignedField<8>(modelData.moduleData[0].modelId));
@ -3148,7 +3159,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
if (IS_ARM(board) && version >= 217) { if (IS_ARM(board) && version >= 217) {
for (int i=0; i<8; i++) { for (int i=0; i<8; i++) {
if (i < MAX_POTS(board)+MAX_SLIDERS(board)) if (i < MAX_POTS(board, version)+MAX_SLIDERS(board))
internalField.Append(new BoolField<1>(modelData.potsWarningEnabled[i])); internalField.Append(new BoolField<1>(modelData.potsWarningEnabled[i]));
else else
internalField.Append(new SpareBitsField<1>()); internalField.Append(new SpareBitsField<1>());
@ -3156,7 +3167,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
} }
else if (IS_ARM(board) && version >= 216) { else if (IS_ARM(board) && version >= 216) {
for (int i=0; i<6; i++) { for (int i=0; i<6; i++) {
if (i < MAX_POTS(board)+MAX_SLIDERS(board)) if (i < MAX_POTS(board, version)+MAX_SLIDERS(board))
internalField.Append(new BoolField<1>(modelData.potsWarningEnabled[i])); internalField.Append(new BoolField<1>(modelData.potsWarningEnabled[i]));
else else
internalField.Append(new SpareBitsField<1>()); internalField.Append(new SpareBitsField<1>());
@ -3165,7 +3176,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
} }
if (IS_ARM(board) && version >= 216) { if (IS_ARM(board) && version >= 216) {
for (int i=0; i < MAX_POTS(board)+MAX_SLIDERS(board); i++) { for (int i=0; i < MAX_POTS(board, version)+MAX_SLIDERS(board); i++) {
internalField.Append(new SignedField<8>(modelData.potPosition[i])); internalField.Append(new SignedField<8>(modelData.potPosition[i]));
} }
} }
@ -3184,6 +3195,10 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
internalField.Append(new SensorField(modelData.sensorData[i], board, version)); internalField.Append(new SensorField(modelData.sensorData[i], board, version));
} }
} }
if (IS_TARANIS_X9E(board)) {
internalField.Append(new UnsignedField<8>(modelData.toplcdTimer));
}
} }
void OpenTxModelData::beforeExport() void OpenTxModelData::beforeExport()
@ -3191,10 +3206,10 @@ void OpenTxModelData::beforeExport()
// qDebug() << QString("before export model") << modelData.name; // qDebug() << QString("before export model") << modelData.name;
for (int module=0; module<3; module++) { for (int module=0; module<3; module++) {
if (modelData.moduleData[module].protocol >= PXX_XJT_X16 && modelData.moduleData[module].protocol <= PXX_XJT_LR12) if (modelData.moduleData[module].protocol >= PULSES_PXX_XJT_X16 && modelData.moduleData[module].protocol <= PULSES_PXX_XJT_LR12)
subprotocols[module] = modelData.moduleData[module].protocol - PXX_XJT_X16; subprotocols[module] = modelData.moduleData[module].protocol - PULSES_PXX_XJT_X16;
else if (modelData.moduleData[module].protocol >= LP45 && modelData.moduleData[module].protocol <= DSMX) else if (modelData.moduleData[module].protocol >= PULSES_LP45 && modelData.moduleData[module].protocol <= PULSES_DSMX)
subprotocols[module] = modelData.moduleData[module].protocol - LP45; subprotocols[module] = modelData.moduleData[module].protocol - PULSES_LP45;
else else
subprotocols[module] = (module==0 ? -1 : 0); subprotocols[module] = (module==0 ? -1 : 0);
} }
@ -3224,15 +3239,15 @@ void OpenTxModelData::afterImport()
} }
for (int module=0; module<3; module++) { for (int module=0; module<3; module++) {
if (modelData.moduleData[module].protocol == PXX_XJT_X16 || modelData.moduleData[module].protocol == LP45) { if (modelData.moduleData[module].protocol == PULSES_PXX_XJT_X16 || modelData.moduleData[module].protocol == PULSES_LP45) {
if (subprotocols[module] >= 0) if (subprotocols[module] >= 0)
modelData.moduleData[module].protocol += subprotocols[module]; modelData.moduleData[module].protocol += subprotocols[module];
else else
modelData.moduleData[module].protocol = OFF; modelData.moduleData[module].protocol = PULSES_OFF;
} }
} }
if (IS_TARANIS(board) && version < 217 && modelData.moduleData[1].protocol != OFF) { if (IS_TARANIS(board) && version < 217 && modelData.moduleData[1].protocol != PULSES_OFF) {
modelData.moduleData[1].modelId = modelData.moduleData[0].modelId; modelData.moduleData[1].modelId = modelData.moduleData[0].modelId;
} }
} }
@ -3243,7 +3258,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
generalData(generalData), generalData(generalData),
board(board), board(board),
version(version), version(version),
inputsCount(NUM_STICKS+MAX_POTS(board)+MAX_SLIDERS(board)) inputsCount(NUM_STICKS+MAX_POTS(board, version)+MAX_SLIDERS(board))
{ {
eepromImportDebug() << QString("OpenTxGeneralData::OpenTxGeneralData(board: %1, version:%2, variant:%3)").arg(board).arg(version).arg(variant); eepromImportDebug() << QString("OpenTxGeneralData::OpenTxGeneralData(board: %1, version:%2, variant:%3)").arg(board).arg(version).arg(variant);
@ -3280,7 +3295,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
internalField.Append(new UnsignedField<8>(generalData.currModel)); internalField.Append(new UnsignedField<8>(generalData.currModel));
internalField.Append(new UnsignedField<8>(generalData.contrast)); internalField.Append(new UnsignedField<8>(generalData.contrast));
internalField.Append(new UnsignedField<8>(generalData.vBatWarn)); internalField.Append(new UnsignedField<8>(generalData.vBatWarn));
internalField.Append(new SignedField<8>(generalData.vBatCalib)); internalField.Append(new SignedField<8>(generalData.txVoltageCalibration));
internalField.Append(new SignedField<8>(generalData.backlightMode)); internalField.Append(new SignedField<8>(generalData.backlightMode));
for (int i=0; i<NUM_STICKS; i++) for (int i=0; i<NUM_STICKS; i++)
@ -3364,7 +3379,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
if (IS_ARM(board)) { if (IS_ARM(board)) {
internalField.Append(new UnsignedField<8>(generalData.backlightBright)); internalField.Append(new UnsignedField<8>(generalData.backlightBright));
internalField.Append(new SignedField<8>(generalData.currentCalib)); internalField.Append(new SignedField<8>(generalData.txCurrentCalibration));
if (version >= 213) { if (version >= 213) {
internalField.Append(new SignedField<8>(generalData.temperatureWarn)); // TODO internalField.Append(new SignedField<8>(generalData.temperatureWarn)); // TODO
internalField.Append(new UnsignedField<8>(generalData.mAhWarn)); internalField.Append(new UnsignedField<8>(generalData.mAhWarn));
@ -3407,7 +3422,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
internalField.Append(new UnsignedField<8>(generalData.hw_uartMode)); internalField.Append(new UnsignedField<8>(generalData.hw_uartMode));
} }
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
if (i < MAX_POTS(board)) if (i < MAX_POTS(board, version))
internalField.Append(new UnsignedField<2>(generalData.potConfig[i])); internalField.Append(new UnsignedField<2>(generalData.potConfig[i]));
else else
internalField.Append(new SpareBitsField<2>()); internalField.Append(new SpareBitsField<2>());
@ -3439,7 +3454,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
for (int i=0; i<NUM_STICKS; ++i) { for (int i=0; i<NUM_STICKS; ++i) {
internalField.Append(new ZCharField<3>(generalData.stickName[i])); internalField.Append(new ZCharField<3>(generalData.stickName[i]));
} }
for (int i=0; i<MAX_POTS(board); ++i) { for (int i=0; i<MAX_POTS(board, version); ++i) {
internalField.Append(new ZCharField<3>(generalData.potName[i])); internalField.Append(new ZCharField<3>(generalData.potName[i]));
} }
for (int i=0; i<MAX_SLIDERS(board); ++i) { for (int i=0; i<MAX_SLIDERS(board); ++i) {

View file

@ -56,40 +56,34 @@ class ProtocolsConversionTable: public ConversionTable
{ {
int val = 0; int val = 0;
if (IS_ARM(board)) { if (IS_ARM(board)) {
addConversion(OFF, val++); addConversion(PULSES_OFF, val++);
} }
addConversion(PPM, val++); addConversion(PULSES_PPM, val++);
if (!IS_ARM(board)) { if (!IS_ARM(board)) {
addConversion(PPM16, val++); addConversion(PULSES_PPM16, val++);
addConversion(PPMSIM, val++); addConversion(PULSES_PPMSIM, val++);
} }
if (IS_ARM(board)) { if (IS_ARM(board)) {
addConversion(PXX_XJT_X16, val); addConversion(PULSES_PXX_XJT_X16, val);
addConversion(PXX_XJT_D8, val); addConversion(PULSES_PXX_XJT_D8, val);
addConversion(PXX_XJT_LR12, val++); addConversion(PULSES_PXX_XJT_LR12, val++);
} }
else { else {
addConversion(PXX_DJT, val++); addConversion(PULSES_PXX_DJT, val++);
} }
if (IS_ARM(board)) { if (IS_ARM(board)) {
addConversion(LP45, val); addConversion(PULSES_LP45, val);
addConversion(DSM2, val); addConversion(PULSES_DSM2, val);
addConversion(DSMX, val++); addConversion(PULSES_DSMX, val++);
} }
else { else {
addConversion(LP45, val++); addConversion(PULSES_LP45, val++);
addConversion(DSM2, val++); addConversion(PULSES_DSM2, val++);
addConversion(DSMX, val++); addConversion(PULSES_DSMX, val++);
} }
} }
}; };
class ThrottleSourceConversionTable: public ConversionTable {
public:
ThrottleSourceConversionTable(BoardEnum board, unsigned int version);
};
class ChannelsConversionTable: public ConversionTable class ChannelsConversionTable: public ConversionTable
{ {
public: public:
@ -121,7 +115,6 @@ class OpenTxModelData: public TransformedField {
char name[256]; char name[256];
int subprotocols[C9X_NUM_MODULES+1/*trainer*/]; int subprotocols[C9X_NUM_MODULES+1/*trainer*/];
ProtocolsConversionTable protocolsConversionTable; ProtocolsConversionTable protocolsConversionTable;
ThrottleSourceConversionTable throttleSourceConversionTable;
ChannelsConversionTable channelsConversionTable; ChannelsConversionTable channelsConversionTable;
}; };

View file

@ -73,6 +73,8 @@ const char * OpenTxEepromInterface::getName()
return "OpenTX for Sky9x board / 9X"; return "OpenTX for Sky9x board / 9X";
case BOARD_9XRPRO: case BOARD_9XRPRO:
return "OpenTX for 9XR-PRO"; return "OpenTX for 9XR-PRO";
case BOARD_AR9X:
return "OpenTX for ar9x board / 9X";
default: default:
return "OpenTX for an unknown board"; return "OpenTX for an unknown board";
} }
@ -91,6 +93,7 @@ const int OpenTxEepromInterface::getEEpromSize()
case BOARD_SKY9X: case BOARD_SKY9X:
return EESIZE_SKY9X; return EESIZE_SKY9X;
case BOARD_9XRPRO: case BOARD_9XRPRO:
case BOARD_AR9X:
return EESIZE_9XRPRO; return EESIZE_9XRPRO;
case BOARD_TARANIS: case BOARD_TARANIS:
case BOARD_TARANIS_PLUS: case BOARD_TARANIS_PLUS:
@ -304,15 +307,19 @@ bool OpenTxEepromInterface::saveModel(unsigned int index, ModelData &model, unsi
return (sz == eeprom.size()); return (sz == eeprom.size());
} }
bool OpenTxEepromInterface::loadxml(RadioData &radioData, QDomDocument &doc) unsigned long OpenTxEepromInterface::loadxml(RadioData &radioData, QDomDocument &doc)
{ {
return false; std::bitset<NUM_ERRORS> errors;
errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
bool OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *eeprom, int size) unsigned long OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
{ {
std::cout << "trying " << getName() << " import..."; std::cout << "trying " << getName() << " import...";
std::bitset<NUM_ERRORS> errors;
if (size != getEEpromSize()) { if (size != getEEpromSize()) {
if (size==4096) { if (size==4096) {
int notnull=false; int notnull=false;
@ -323,21 +330,25 @@ bool OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *eeprom, in
} }
if (notnull) { if (notnull) {
std::cout << " wrong size (" << size << ")\n"; std::cout << " wrong size (" << size << ")\n";
return false; errors.set(WRONG_SIZE);
return errors.to_ulong();
} }
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")); errors.set(HAS_WARNINGS);
errors.set(WARNING_WRONG_FIRMWARE);
size=2048; size=2048;
} }
} else { } else {
std::cout << " wrong size (" << size << "/" << getEEpromSize() << ")\n"; std::cout << " wrong size (" << size << "/" << getEEpromSize() << ")\n";
return false; errors.set(WRONG_SIZE);
return errors.to_ulong();
} }
} }
if (!efile->EeFsOpen((uint8_t *)eeprom, size, board)) { if (!efile->EeFsOpen((uint8_t *)eeprom, size, board)) {
std::cout << " wrong file system\n"; std::cout << " wrong file system\n";
return false; errors.set(WRONG_FILE_SYSTEM);
return errors.to_ulong();
} }
efile->openRd(FILE_GENERAL); efile->openRd(FILE_GENERAL);
@ -345,30 +356,39 @@ bool OpenTxEepromInterface::load(RadioData &radioData, const uint8_t *eeprom, in
uint8_t version; uint8_t version;
if (efile->readRlc2(&version, 1) != 1) { if (efile->readRlc2(&version, 1) != 1) {
std::cout << " no\n"; std::cout << " no\n";
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
std::cout << " version " << (unsigned int)version; std::cout << " version " << (unsigned int)version;
if (!checkVersion(version)) { EepromLoadErrors version_error = checkVersion(version);
if (version_error == OLD_VERSION) {
errors.set(version_error);
errors.set(HAS_WARNINGS);
} else if (version_error == NOT_OPENTX) {
std::cout << " not open9x\n"; std::cout << " not open9x\n";
return false; errors.set(version_error);
return errors.to_ulong();
} }
if (!loadGeneral<OpenTxGeneralData>(radioData.generalSettings, version)) { if (!loadGeneral<OpenTxGeneralData>(radioData.generalSettings, version)) {
std::cout << " ko\n"; std::cout << " ko\n";
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
std::cout << " variant " << radioData.generalSettings.variant; std::cout << " variant " << radioData.generalSettings.variant;
for (int i=0; i<getMaxModels(); i++) { for (int i=0; i<getMaxModels(); i++) {
if (!loadModel(version, radioData.models[i], NULL, i, radioData.generalSettings.variant, radioData.generalSettings.stickMode+1)) { if (!loadModel(version, radioData.models[i], NULL, i, radioData.generalSettings.variant, radioData.generalSettings.stickMode+1)) {
std::cout << " ko\n"; std::cout << " ko\n";
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
} }
std::cout << " ok\n"; std::cout << " ok\n";
return true; errors.set(NO_ERROR);
return errors.to_ulong();
} }
int OpenTxEepromInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version) int OpenTxEepromInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
@ -381,6 +401,7 @@ int OpenTxEepromInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t
case BOARD_TARANIS_PLUS: case BOARD_TARANIS_PLUS:
case BOARD_TARANIS_X9E: case BOARD_TARANIS_X9E:
case BOARD_SKY9X: case BOARD_SKY9X:
case BOARD_AR9X:
case BOARD_9XRPRO: case BOARD_9XRPRO:
version = 217; version = 217;
break; break;
@ -570,7 +591,7 @@ int OpenTxFirmware::getCapability(const Capability capability)
case OffsetWeight: case OffsetWeight:
return (IS_ARM(board) ? 500 : 245); return (IS_ARM(board) ? 500 : 245);
case Timers: case Timers:
return (IS_ARM(board) ? 3 : 2); return ((IS_ARM(board) && id.contains("timer3")) ? 3 : 2);
case TimersName: case TimersName:
return (IS_TARANIS(board) ? 8 : (IS_ARM(board) ? 3 : 0)); return (IS_TARANIS(board) ? 8 : (IS_ARM(board) ? 3 : 0));
case PermTimers: case PermTimers:
@ -649,7 +670,7 @@ int OpenTxFirmware::getCapability(const Capability capability)
case Haptic: case Haptic:
return (IS_2560(board) || IS_SKY9X(board) || IS_TARANIS_PLUS(board) || id.contains("haptic")); return (IS_2560(board) || IS_SKY9X(board) || IS_TARANIS_PLUS(board) || id.contains("haptic"));
case ModelTrainerEnable: case ModelTrainerEnable:
if (IS_ARM(board)) if (IS_TARANIS(board))
return 1; return 1;
else else
return 0; return 0;
@ -707,10 +728,10 @@ int OpenTxFirmware::getCapability(const Capability capability)
case HasFailsafe: case HasFailsafe:
return (IS_ARM(board) ? 32 : 0); return (IS_ARM(board) ? 32 : 0);
case NumModules: case NumModules:
return (IS_ARM(board) && !IS_9XRPRO(board)) ? 2 : 1; return (IS_ARM(board) ? 2 : 1);
case HasPPMStart: case HasPPMStart:
return (IS_ARM(board) ? true : false); return (IS_ARM(board) ? true : false);
case HasCurrentCalibration: case HastxCurrentCalibration:
return (IS_SKY9X(board) ? true : false); return (IS_SKY9X(board) ? true : false);
case HasVolume: case HasVolume:
return (IS_ARM(board) ? true : false); return (IS_ARM(board) ? true : false);
@ -732,6 +753,8 @@ int OpenTxFirmware::getCapability(const Capability capability)
return (IS_TARANIS(board) ? SWITCH_SF1 : SWITCH_THR) ; return (IS_TARANIS(board) ? SWITCH_SF1 : SWITCH_THR) ;
case HasDisplayText: case HasDisplayText:
return IS_ARM(board) ? 1 : 0; return IS_ARM(board) ? 1 : 0;
case HasTopLcd:
return IS_TARANIS_X9E(board) ? 1 : 0;
case GlobalFunctions: case GlobalFunctions:
return IS_ARM(board) ? 64 : 0; return IS_ARM(board) ? 64 : 0;
case VirtualInputs: case VirtualInputs:
@ -777,6 +800,8 @@ int OpenTxFirmware::getCapability(const Capability capability)
return id.contains("mixersmon") ? 1 : 0; return id.contains("mixersmon") ? 1 : 0;
case HasBatMeterRange: case HasBatMeterRange:
return (IS_TARANIS(board) ? true : false); return (IS_TARANIS(board) ? true : false);
case DangerousFunctions:
return id.contains("danger") ? 1 : 0;
default: default:
return 0; return 0;
} }
@ -793,16 +818,16 @@ bool OpenTxFirmware::isTelemetrySourceAvailable(int source)
return true; return true;
} }
int OpenTxEepromInterface::isAvailable(Protocol proto, int port) int OpenTxEepromInterface::isAvailable(PulsesProtocol proto, int port)
{ {
if (IS_TARANIS(board)) { if (IS_TARANIS(board)) {
switch (port) { switch (port) {
case 0: case 0:
switch (proto) { switch (proto) {
case OFF: case PULSES_OFF:
case PXX_XJT_X16: case PULSES_PXX_XJT_X16:
case PXX_XJT_D8: case PULSES_PXX_XJT_D8:
case PXX_XJT_LR12: case PULSES_PXX_XJT_LR12:
return 1; return 1;
default: default:
return 0; return 0;
@ -810,15 +835,15 @@ int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
break; break;
case 1: case 1:
switch (proto) { switch (proto) {
case OFF: case PULSES_OFF:
case PPM: case PULSES_PPM:
case PXX_XJT_X16: case PULSES_PXX_XJT_X16:
case PXX_XJT_D8: case PULSES_PXX_XJT_D8:
case PXX_XJT_LR12: case PULSES_PXX_XJT_LR12:
//case PXX_DJT: // Unavailable for now //case PULSES_PXX_DJT: // Unavailable for now
case LP45: case PULSES_LP45:
case DSM2: case PULSES_DSM2:
case DSMX: case PULSES_DSMX:
return 1; return 1;
default: default:
return 0; return 0;
@ -826,7 +851,7 @@ int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
break; break;
case -1: case -1:
switch (proto) { switch (proto) {
case PPM: case PULSES_PPM:
return 1; return 1;
default: default:
return 0; return 0;
@ -840,13 +865,13 @@ int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
switch (port) { switch (port) {
case 0: case 0:
switch (proto) { switch (proto) {
case PPM: case PULSES_PPM:
// case PXX_XJT_X16: case PULSES_PXX_XJT_X16:
// case PXX_XJT_D8: case PULSES_PXX_XJT_D8:
// case PXX_XJT_LR12: case PULSES_PXX_XJT_LR12:
case LP45: case PULSES_LP45:
case DSM2: case PULSES_DSM2:
case DSMX: case PULSES_DSMX:
return 1; return 1;
default: default:
return 0; return 0;
@ -854,7 +879,7 @@ int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
break; break;
case 1: case 1:
switch (proto) { switch (proto) {
case PPM: case PULSES_PPM:
return 1; return 1;
default: default:
return 0; return 0;
@ -866,13 +891,13 @@ int OpenTxEepromInterface::isAvailable(Protocol proto, int port)
} }
else { else {
switch (proto) { switch (proto) {
case PPM: case PULSES_PPM:
case DSMX: case PULSES_DSMX:
case LP45: case PULSES_LP45:
case DSM2: case PULSES_DSM2:
case PXX_DJT: case PULSES_PXX_DJT:
case PPM16: case PULSES_PPM16:
case PPMSIM: case PULSES_PPMSIM:
return 1; return 1;
default: default:
return 0; return 0;
@ -885,73 +910,60 @@ size_t getSizeA(T (&)[SIZE]) {
return SIZE; return SIZE;
} }
bool OpenTxEepromInterface::checkVersion(unsigned int version) EepromLoadErrors OpenTxEepromInterface::checkVersion(unsigned int version)
{ {
switch(version) { switch(version) {
case 201: case 201:
// first version // first version
break;
case 202: case 202:
// channel order is now always RUD - ELE - THR - AIL // channel order is now always RUD - ELE - THR - AIL
// changes in timers // changes in timers
// ppmFrameLength added // ppmFrameLength added
// thrTraceSrc added // thrTraceSrc added
break;
case 203: case 203:
// mixers changed (for the trims use for change the offset of a mix) // mixers changed (for the trims use for change the offset of a mix)
// telemetry offset raised to -127 +127 // telemetry offset raised to -127 +127
// function switches now have a param on 4 bits // function switches now have a param on 4 bits
break;
case 204: case 204:
// telemetry changes (bars) // telemetry changes (bars)
break;
case 205: case 205:
// mixer changes (differential, negative curves)... // mixer changes (differential, negative curves)...
break;
// case 206: // case 206:
case 207: case 207:
// V4: Rotary Encoders position in FlightModes // V4: Rotary Encoders position in FlightModes
break;
case 208: case 208:
// Trim value in 16bits // Trim value in 16bits
// FrSky A1/A2 offset on 12bits // FrSky A1/A2 offset on 12bits
// ARM: More Mixers / Expos / CSW / FSW / CHNOUT // ARM: More Mixers / Expos / CSW / FSW / CHNOUT
break;
case 209: case 209:
// Add TrmR, TrmE, TrmT, TrmA as Mix sources // Add TrmR, TrmE, TrmT, TrmA as Mix sources
// Trims are now OFF / ON / Rud / Ele / Thr / Ail // Trims are now OFF / ON / Rud / Ele / Thr / Ail
break;
case 210: case 210:
// Add names in Mixes / Expos // Add names in Mixes / Expos
// Add a new telemetry screen // Add a new telemetry screen
// Add support for Play Track <filename> // Add support for Play Track <filename>
break;
case 211: case 211:
// Curves big change // Curves big change
break;
case 212: case 212:
// Big changes in mixers / limitse // Big changes in mixers / limitse
break;
case 213: case 213:
// GVARS / Variants introduction // GVARS / Variants introduction
break;
case 214: case 214:
// Massive EEPROM change! // Massive EEPROM change!
break;
case 215: case 215:
// M128 revert because too much RAM used! // M128 revert because too much RAM used!
break;
case 216: case 216:
// A lot of things (first github release) // A lot of things (first github release)
return OLD_VERSION;
break; break;
case 217: case 217:
// 3 logical switches removed on M128 / gruvin9x boards // 3 logical switches removed on M128 / gruvin9x boards
break; break;
default: default:
return false; return NOT_OPENTX;
} }
return true; return NO_ERROR;
} }
bool OpenTxEepromInterface::checkVariant(unsigned int version, unsigned int variant) bool OpenTxEepromInterface::checkVariant(unsigned int version, unsigned int variant)
@ -987,13 +999,16 @@ bool OpenTxEepromInterface::checkVariant(unsigned int version, unsigned int vari
return true; return true;
} }
bool OpenTxEepromInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index) unsigned long OpenTxEepromInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
{ {
std::bitset<NUM_ERRORS> errors;
std::cout << "trying " << getName() << " backup import..."; std::cout << "trying " << getName() << " backup import...";
if (esize < 8 || memcmp(eeprom, "o9x", 3) != 0) { if (esize < 8 || memcmp(eeprom, "o9x", 3) != 0) {
std::cout << " no\n"; std::cout << " no\n";
return false; errors.set(WRONG_SIZE);
return errors.to_ulong();
} }
BoardEnum backupBoard = (BoardEnum)-1; BoardEnum backupBoard = (BoardEnum)-1;
@ -1009,12 +1024,14 @@ bool OpenTxEepromInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, in
break; break;
default: default:
std::cout << " unknown board\n"; std::cout << " unknown board\n";
return false; errors.set(UNKNOWN_BOARD);
return errors.to_ulong();
} }
if (backupBoard != board) { if (backupBoard != board) {
std::cout << " not right board\n"; std::cout << " not right board\n";
return false; errors.set(WRONG_BOARD);
return errors.to_ulong();
} }
uint8_t version = eeprom[4]; uint8_t version = eeprom[4];
@ -1024,29 +1041,38 @@ bool OpenTxEepromInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, in
std::cout << " version " << (unsigned int)version << " "; std::cout << " version " << (unsigned int)version << " ";
if (!checkVersion(version)) { EepromLoadErrors version_error = checkVersion(version);
if (version_error == OLD_VERSION) {
errors.set(version_error);
errors.set(HAS_WARNINGS);
} else if (version_error == NOT_OPENTX) {
std::cout << " not open9x\n"; std::cout << " not open9x\n";
return false; errors.set(version_error);
return errors.to_ulong();
} }
if (size > esize-8) { if (size > esize-8) {
std::cout << " wrong size\n"; std::cout << " wrong size\n";
return false; errors.set(WRONG_SIZE);
return errors.to_ulong();
} }
if (bcktype=='M') { if (bcktype=='M') {
if (!loadModel(version, radioData.models[index], &eeprom[8], size, variant)) { if (!loadModel(version, radioData.models[index], &eeprom[8], size, variant)) {
std::cout << " ko\n"; std::cout << " ko\n";
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
} }
else { else {
std::cout << " backup type not supported\n"; std::cout << " backup type not supported\n";
return false; errors.set(BACKUP_NOT_SUPPORTED);
return errors.to_ulong();
} }
std::cout << " ok\n"; std::cout << " ok\n";
return true; errors.set(NO_ERROR);
return errors.to_ulong();
} }
QString OpenTxFirmware::getFirmwareBaseUrl() QString OpenTxFirmware::getFirmwareBaseUrl()
@ -1069,6 +1095,7 @@ QString OpenTxFirmware::getFirmwareUrl()
url.append(QString("/getfw.php?fw=%1.hex").arg(id)); url.append(QString("/getfw.php?fw=%1.hex").arg(id));
break; break;
case BOARD_SKY9X: case BOARD_SKY9X:
case BOARD_AR9X:
case BOARD_9XRPRO: case BOARD_9XRPRO:
case BOARD_TARANIS: case BOARD_TARANIS:
case BOARD_TARANIS_PLUS: case BOARD_TARANIS_PLUS:
@ -1111,7 +1138,8 @@ void addOpenTxTaranisOptions(OpenTxFirmware * firmware)
firmware->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support")); firmware->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
firmware->addOption("nogvars", QObject::tr("Disable Global variables")); firmware->addOption("nogvars", QObject::tr("Disable Global variables"));
firmware->addOption("lua", QObject::tr("Support for Lua model scripts")); firmware->addOption("lua", QObject::tr("Support for Lua model scripts"));
firmware->addOption("nojoystick", QObject::tr("No Joystick emulation inside the FW (only Mass Storage as in the Bootloader)")); Option usb_options[] = { { "massstorage", QObject::tr("Instead of Joystick emulation, USB connection is Mass Storage (as in the Bootloader)") }, { "cli", QObject::tr("Instead of Joystick emulation, USB connection is Command Line Interface") }, { NULL } };
firmware->addOptions(usb_options);
firmware->addOption("mixersmon", QObject::tr("Adds mixers output view to the CHANNELS MONITOR screen, pressing [ENT] switches between the views")); firmware->addOption("mixersmon", QObject::tr("Adds mixers output view to the CHANNELS MONITOR screen, pressing [ENT] switches between the views"));
firmware->addOption("eu", QObject::tr("Removes D8 and LR12 FrSky protocols that are not legal for use in the EU on radios sold after Jan 1st, 2015")); firmware->addOption("eu", QObject::tr("Removes D8 and LR12 FrSky protocols that are not legal for use in the EU on radios sold after Jan 1st, 2015"));
firmware->addOption("internalppm", QObject::tr("Support for PPM internal module hack")); firmware->addOption("internalppm", QObject::tr("Support for PPM internal module hack"));
@ -1329,6 +1357,7 @@ void registerOpenTxFirmwares()
firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits")); firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT); firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
firmware->addOption("symlimits", QObject::tr("Symetrical Limits")); firmware->addOption("symlimits", QObject::tr("Symetrical Limits"));
firmware->addOption("timer3", QObject::tr("Support for a third timer"));
firmware->addOption("potscroll", QObject::tr("Pots use in menus navigation")); firmware->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
firmware->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control")); firmware->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
firmware->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control")); firmware->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
@ -1340,6 +1369,29 @@ void registerOpenTxFirmwares()
addOpenTxCommonOptions(firmware); addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware); firmwares.push_back(firmware);
/* ar9x board */
firmware = new OpenTxFirmware("opentx-ar9x", QObject::tr("ar9x board / 9X"), BOARD_AR9X);
firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
firmware->addOption("nofp", QObject::tr("No flight modes"));
firmware->addOption("nocurves", QObject::tr("Disable curves menus"));
firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
firmware->addOption("symlimits", QObject::tr("Symetrical Limits"));
firmware->addOption("timer3", QObject::tr("Support for a third timer"));
firmware->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
firmware->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
firmware->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));
firmware->addOption("dblkeys", QObject::tr("Enable resetting values by pressing up and down at the same time"));
firmware->addOption("nographics", QObject::tr("No graphical check boxes and sliders"));
firmware->addOption("battgraph", QObject::tr("Battery graph"));
firmware->addOption("nobold", QObject::tr("Don't use bold font for highlighting active items"));
firmware->addOption("bluetooth", QObject::tr("Bluetooth interface"));
// firmware->addOption("rtc", QObject::tr("Optional RTC added"));
// firmware->addOption("volume", QObject::tr("i2c volume control added"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* 9XR-Pro */ /* 9XR-Pro */
firmware = new OpenTxFirmware("opentx-9xrpro", QObject::tr("9XR-PRO"), BOARD_9XRPRO); firmware = new OpenTxFirmware("opentx-9xrpro", QObject::tr("9XR-PRO"), BOARD_9XRPRO);
firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support")); firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
@ -1349,6 +1401,7 @@ void registerOpenTxFirmwares()
firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits")); firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT); firmware->addOption("gvars", QObject::tr("Global variables"), GVARS_VARIANT);
firmware->addOption("symlimits", QObject::tr("Symetrical Limits")); firmware->addOption("symlimits", QObject::tr("Symetrical Limits"));
firmware->addOption("timer3", QObject::tr("Support for a third timer"));
firmware->addOption("potscroll", QObject::tr("Pots use in menus navigation")); firmware->addOption("potscroll", QObject::tr("Pots use in menus navigation"));
firmware->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control")); firmware->addOption("autosource", QObject::tr("In model setup menus automatically set source by moving the control"));
firmware->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control")); firmware->addOption("autoswitch", QObject::tr("In model setup menus automatically set switch by moving the control"));

View file

@ -1,6 +1,6 @@
/* /*
* Author - Bertrand Songis <bsongis@gmail.com> * Author - Bertrand Songis <bsongis@gmail.com>
* *
* Based on th9x -> http://code.google.com/p/th9x/ * Based on th9x -> http://code.google.com/p/th9x/
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -33,25 +33,25 @@ class OpenTxEepromInterface : public EEPROMInterface
virtual const int getMaxModels(); virtual const int getMaxModels();
virtual bool load(RadioData &, const uint8_t *eeprom, int size); virtual unsigned long load(RadioData &, const uint8_t *eeprom, int size);
virtual bool loadBackup(RadioData &, uint8_t *eeprom, int esize, int index); virtual unsigned long loadBackup(RadioData &, uint8_t *eeprom, int esize, int index);
virtual bool loadxml(RadioData &radioData, QDomDocument &doc); virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
virtual int save(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, uint8_t version=0); virtual int save(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, uint8_t version=0);
virtual int getSize(const ModelData &); virtual int getSize(const ModelData &);
virtual int getSize(const GeneralSettings &); virtual int getSize(const GeneralSettings &);
virtual int isAvailable(Protocol proto, int port=0); virtual int isAvailable(PulsesProtocol proto, int port=0);
protected: protected:
const char * getName(); const char * getName();
bool checkVersion(unsigned int version); EepromLoadErrors checkVersion(unsigned int version);
bool checkVariant(unsigned int version, unsigned int variant); bool checkVariant(unsigned int version, unsigned int variant);
@ -112,7 +112,7 @@ class OpenTxFirmware: public Firmware {
} }
virtual Firmware * getFirmwareVariant(const QString & id); virtual Firmware * getFirmwareVariant(const QString & id);
virtual QString getStampUrl(); virtual QString getStampUrl();
virtual QString getReleaseNotesUrl(); virtual QString getReleaseNotesUrl();
@ -122,7 +122,7 @@ class OpenTxFirmware: public Firmware {
virtual int getCapability(const Capability); virtual int getCapability(const Capability);
virtual bool isTelemetrySourceAvailable(int source); virtual bool isTelemetrySourceAvailable(int source);
protected: protected:
QString getFirmwareBaseUrl(); QString getFirmwareBaseUrl();

View file

@ -80,6 +80,7 @@ add_library(opentx-gruvin9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-mega2560${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES}) add_library(opentx-mega2560${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-sky9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES}) add_library(opentx-sky9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-9xrpro${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES}) add_library(opentx-9xrpro${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-ar9x${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-taranis${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES}) add_library(opentx-taranis${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-taranisplus${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES}) add_library(opentx-taranisplus${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
add_library(opentx-taranisx9e${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES}) add_library(opentx-taranisx9e${SUFFIX}-simulator SHARED ${OPENTX_SRC_FILES})
@ -92,6 +93,7 @@ add_dependencies(opentx-gruvin9x${SUFFIX}-simulator about_lbm_9x commondeps)
add_dependencies(opentx-mega2560${SUFFIX}-simulator about_lbm_9x commondeps) add_dependencies(opentx-mega2560${SUFFIX}-simulator about_lbm_9x commondeps)
add_dependencies(opentx-sky9x${SUFFIX}-simulator about_lbm_9x commondeps) add_dependencies(opentx-sky9x${SUFFIX}-simulator about_lbm_9x commondeps)
add_dependencies(opentx-9xrpro${SUFFIX}-simulator about_lbm_9x commondeps) add_dependencies(opentx-9xrpro${SUFFIX}-simulator about_lbm_9x commondeps)
add_dependencies(opentx-ar9x${SUFFIX}-simulator about_lbm_9x commondeps)
add_dependencies(opentx-taranis${SUFFIX}-simulator about_lbm_taranis commondeps lua_exports) add_dependencies(opentx-taranis${SUFFIX}-simulator about_lbm_taranis commondeps lua_exports)
add_dependencies(opentx-taranisplus${SUFFIX}-simulator about_lbm_taranis commondeps lua_exports) add_dependencies(opentx-taranisplus${SUFFIX}-simulator about_lbm_taranis commondeps lua_exports)
add_dependencies(opentx-taranisx9e${SUFFIX}-simulator about_lbm_taranis commondeps lua_exports) add_dependencies(opentx-taranisx9e${SUFFIX}-simulator about_lbm_taranis commondeps lua_exports)
@ -105,6 +107,7 @@ set(OPENTX_LIBRARIES
opentx-mega2560${SUFFIX}-simulator opentx-mega2560${SUFFIX}-simulator
opentx-sky9x${SUFFIX}-simulator opentx-sky9x${SUFFIX}-simulator
opentx-9xrpro${SUFFIX}-simulator opentx-9xrpro${SUFFIX}-simulator
opentx-ar9x${SUFFIX}-simulator
opentx-taranis${SUFFIX}-simulator opentx-taranis${SUFFIX}-simulator
opentx-taranisplus${SUFFIX}-simulator opentx-taranisplus${SUFFIX}-simulator
opentx-taranisx9e${SUFFIX}-simulator opentx-taranisx9e${SUFFIX}-simulator
@ -154,6 +157,11 @@ target_include_directories(opentx-9xrpro${SUFFIX}-simulator PRIVATE ${RADIO_SRC_
target_compile_definitions(opentx-9xrpro${SUFFIX}-simulator PRIVATE PCBSKY9X REVX CPUARM VOICE SDCARD ${COMMON_DEFINITIONS}) target_compile_definitions(opentx-9xrpro${SUFFIX}-simulator PRIVATE PCBSKY9X REVX CPUARM VOICE SDCARD ${COMMON_DEFINITIONS})
target_link_libraries(opentx-9xrpro${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES}) target_link_libraries(opentx-9xrpro${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
# AR9X
target_include_directories(opentx-ar9x${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/sky9x)
target_compile_definitions(opentx-ar9x${SUFFIX}-simulator PRIVATE PCBSKY9X AR9X CPUARM VOICE SDCARD ${COMMON_DEFINITIONS})
target_link_libraries(opentx-ar9x${SUFFIX}-simulator PRIVATE ${COMMON_LIBRARIES})
# Taranis standard # Taranis standard
target_include_directories(opentx-taranis${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/taranis) target_include_directories(opentx-taranis${SUFFIX}-simulator PRIVATE ${RADIO_SRC_DIRECTORY}/targets/taranis)
target_compile_definitions(opentx-taranis${SUFFIX}-simulator PRIVATE PCBTARANIS CPUARM CPUSTM32 EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS}) target_compile_definitions(opentx-taranis${SUFFIX}-simulator PRIVATE PCBTARANIS CPUARM CPUSTM32 EEPROM_RLC VOICE SDCARD ${COMMON_DEFINITIONS})

View file

@ -233,7 +233,7 @@ namespace NAMESPACE {
#include "radio/src/targets/taranis/pulses_driver.cpp" #include "radio/src/targets/taranis/pulses_driver.cpp"
#include "radio/src/targets/taranis/rtc_driver.cpp" #include "radio/src/targets/taranis/rtc_driver.cpp"
#include "radio/src/targets/taranis/trainer_driver.cpp" #include "radio/src/targets/taranis/trainer_driver.cpp"
#include "radio/src/targets/taranis/uart3_driver.cpp" #include "radio/src/targets/taranis/serial2_driver.cpp"
#elif defined(PCBSKY9X) #elif defined(PCBSKY9X)
#include "radio/src/targets/sky9x/board_sky9x.cpp" #include "radio/src/targets/sky9x/board_sky9x.cpp"
#include "radio/src/targets/sky9x/telemetry_driver.cpp" #include "radio/src/targets/sky9x/telemetry_driver.cpp"
@ -244,7 +244,7 @@ namespace NAMESPACE {
#include "radio/src/targets/sky9x/sdcard_driver.cpp" #include "radio/src/targets/sky9x/sdcard_driver.cpp"
#include "radio/src/targets/sky9x/coproc_driver.cpp" #include "radio/src/targets/sky9x/coproc_driver.cpp"
#include "radio/src/targets/sky9x/haptic_driver.cpp" #include "radio/src/targets/sky9x/haptic_driver.cpp"
#include "radio/src/targets/sky9x/second_serial_driver.cpp" #include "radio/src/targets/sky9x/serial2_driver.cpp"
#include "radio/src/targets/sky9x/pulses_driver.cpp" #include "radio/src/targets/sky9x/pulses_driver.cpp"
#elif defined(PCBGRUVIN9X) #elif defined(PCBGRUVIN9X)
#include "radio/src/targets/gruvin9x/board_gruvin9x.cpp" #include "radio/src/targets/gruvin9x/board_gruvin9x.cpp"
@ -260,7 +260,11 @@ namespace NAMESPACE {
#include "radio/src/targets/simu/simpgmspace.cpp" #include "radio/src/targets/simu/simpgmspace.cpp"
#include "radio/src/translations.cpp" #include "radio/src/translations.cpp"
#include "radio/src/telemetry/frsky.cpp" #include "radio/src/telemetry/frsky.cpp"
#include "radio/src/telemetry/frsky_d.cpp" #if defined(CPUARM)
#include "radio/src/telemetry/frsky_d_arm.cpp"
#else
#include "radio/src/telemetry/frsky_d.cpp"
#endif
#include "radio/src/translations/tts_en.cpp" #include "radio/src/translations/tts_en.cpp"
#if defined(CPUARM) #if defined(CPUARM)

View file

@ -35,6 +35,10 @@
#define FLAVOUR "9xrpro" #define FLAVOUR "9xrpro"
#define NAMESPACE Sky9xPro #define NAMESPACE Sky9xPro
#define EEPROM_VARIANT 0 #define EEPROM_VARIANT 0
#elif defined(PCBSKY9X) && defined(AR9X)
#define FLAVOUR "ar9x"
#define NAMESPACE Ar9x
#define EEPROM_VARIANT 0
#elif defined(PCBSKY9X) #elif defined(PCBSKY9X)
#define FLAVOUR "sky9x" #define FLAVOUR "sky9x"
#define NAMESPACE Sky9X #define NAMESPACE Sky9X

View file

@ -62,7 +62,7 @@ Th9xGeneral::operator GeneralSettings ()
result.currModel = currModel; result.currModel = currModel;
result.contrast = contrast; result.contrast = contrast;
result.vBatWarn = vBatWarn; result.vBatWarn = vBatWarn;
result.vBatCalib = vBatCalib; result.txVoltageCalibration = txVoltageCalibration;
// result.lightSw = th9xToSwitch(lightSw); // result.lightSw = th9xToSwitch(lightSw);
result.trainer = trainer; result.trainer = trainer;
result.view = view; result.view = view;

View file

@ -64,7 +64,7 @@ PACK(typedef struct t_Th9xGeneral {
uint8_t currModel; //0..15 uint8_t currModel; //0..15
uint8_t contrast; uint8_t contrast;
uint8_t vBatWarn; uint8_t vBatWarn;
int8_t vBatCalib; int8_t txVoltageCalibration;
int8_t lightSw; int8_t lightSw;
Th9xTrainerData trainer; Th9xTrainerData trainer;
uint8_t adcFilt:2; uint8_t adcFilt:2;

View file

@ -57,23 +57,29 @@ const int Th9xInterface::getMaxModels()
return 16; return 16;
} }
bool Th9xInterface::loadxml(RadioData &radioData, QDomDocument &doc) unsigned long Th9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
{ {
return false; std::bitset<NUM_ERRORS> errors;
errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
bool Th9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size) unsigned long Th9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
{ {
std::cout << "trying th9x import... "; std::cout << "trying th9x import... ";
std::bitset<NUM_ERRORS> errors;
if (size != getEEpromSize()) { if (size != getEEpromSize()) {
std::cout << "wrong size\n"; std::cout << "wrong size\n";
return false; errors.set(WRONG_SIZE);
return errors.to_ulong();
} }
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) { if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) {
std::cout << "wrong file system\n"; std::cout << "wrong file system\n";
return false; errors.set(WRONG_FILE_SYSTEM);
return errors.to_ulong();
} }
efile->openRd(FILE_GENERAL); efile->openRd(FILE_GENERAL);
@ -81,7 +87,8 @@ bool Th9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
if (efile->readRlc2((uint8_t*)&th9xGeneral, 1) != 1) { if (efile->readRlc2((uint8_t*)&th9xGeneral, 1) != 1) {
std::cout << "no\n"; std::cout << "no\n";
return false; errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
std::cout << "version " << (unsigned int)th9xGeneral.myVers << " "; std::cout << "version " << (unsigned int)th9xGeneral.myVers << " ";
@ -91,14 +98,16 @@ bool Th9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
break; break;
default: default:
std::cout << "not th9x\n"; std::cout << "not th9x\n";
return false; errors.set(NOT_TH9X);
return errors.to_ulong();
} }
efile->openRd(FILE_GENERAL); efile->openRd(FILE_GENERAL);
int len = efile->readRlc2((uint8_t*)&th9xGeneral, sizeof(Th9xGeneral)); int len = efile->readRlc2((uint8_t*)&th9xGeneral, sizeof(Th9xGeneral));
if (len != sizeof(Th9xGeneral)) { if (len != sizeof(Th9xGeneral)) {
std::cout << "not th9x\n"; std::cout << "not th9x\n";
return false; errors.set(NOT_TH9X);
return errors.to_ulong();
} }
radioData.generalSettings = th9xGeneral; radioData.generalSettings = th9xGeneral;
@ -114,12 +123,15 @@ bool Th9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
} }
std::cout << "ok\n"; std::cout << "ok\n";
return true; errors.set(NO_ERROR);
return errors.to_ulong();
} }
bool Th9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index) unsigned long Th9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
{ {
return false; std::bitset<NUM_ERRORS> errors;
errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
} }
int Th9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version) int Th9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
@ -140,14 +152,14 @@ int Th9xInterface::getSize(const GeneralSettings & settings)
return 0; return 0;
} }
int Th9xInterface::isAvailable(Protocol proto, int port) int Th9xInterface::isAvailable(PulsesProtocol proto, int port)
{ {
switch (proto) { switch (proto) {
case PPM: case PULSES_PPM:
case SILV_A: case PULSES_SILV_A:
case SILV_B: case PULSES_SILV_B:
case SILV_C: case PULSES_SILV_C:
case CTP1009: case PULSES_CTP1009:
return 1; return 1;
default: default:
return 0; return 0;

View file

@ -34,11 +34,11 @@ class Th9xInterface : public EEPROMInterface
virtual const int getMaxModels(); virtual const int getMaxModels();
virtual bool load(RadioData &, const uint8_t *eeprom, int size); virtual unsigned long load(RadioData &, const uint8_t *eeprom, int size);
virtual bool loadBackup(RadioData &, uint8_t *eeprom, int esize, int index); virtual unsigned long loadBackup(RadioData &, uint8_t *eeprom, int esize, int index);
virtual bool loadxml(RadioData &radioData, QDomDocument &doc); virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
virtual int save(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, uint8_t version=0); virtual int save(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, uint8_t version=0);
@ -46,7 +46,7 @@ class Th9xInterface : public EEPROMInterface
virtual int getSize(const GeneralSettings &); virtual int getSize(const GeneralSettings &);
virtual int isAvailable(Protocol proto, int port=0); virtual int isAvailable(PulsesProtocol proto, int port=0);
protected: protected:

18
companion/src/flasheepromdialog.cpp Executable file → Normal file
View file

@ -104,7 +104,7 @@ int FlashEEpromDialog::getEEpromVersion(const QString &filename)
QByteArray eeprom(EESIZE_MAX, 0); QByteArray eeprom(EESIZE_MAX, 0);
int fileType = getFileType(filename); int fileType = getFileType(filename);
#if 0 #if 0
if (fileType==FILE_TYPE_XML) { if (fileType==FILE_TYPE_XML) {
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
@ -125,7 +125,8 @@ int FlashEEpromDialog::getEEpromVersion(const QString &filename)
bool xmlOK = doc.setContent(&file); bool xmlOK = doc.setContent(&file);
if (xmlOK) { if (xmlOK) {
RadioData * radioData = new RadioData(); RadioData * radioData = new RadioData();
if (!loadEEpromXml(*radioData, doc)) { std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEepromXml(*radioData, doc));
if (!errors.test(NO_ERROR)) {
QMessageBox::warning(this, tr("Error"), tr("Invalid Models and Settings File %1").arg(filename)); QMessageBox::warning(this, tr("Error"), tr("Invalid Models and Settings File %1").arg(filename));
} }
else { else {
@ -160,7 +161,8 @@ int FlashEEpromDialog::getEEpromVersion(const QString &filename)
} }
RadioData * radioData = new RadioData(); RadioData * radioData = new RadioData();
if (eeprom_size == 0 || !loadEEprom(*radioData, (const uint8_t *)eeprom.data(), eeprom_size)) { std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEeprom(*radioData, (const uint8_t *)eeprom.data(), eeprom_size));
if (eeprom_size == 0 || !errors.test(NO_ERROR)) {
QMessageBox::warning(this, tr("Error"), tr("Invalid Models and Settings file %1").arg(filename)); QMessageBox::warning(this, tr("Error"), tr("Invalid Models and Settings file %1").arg(filename));
} }
else { else {
@ -175,8 +177,8 @@ bool FlashEEpromDialog::patchCalibration()
QString calib = g.profile[g.id()].stickPotCalib(); QString calib = g.profile[g.id()].stickPotCalib();
QString trainercalib = g.profile[g.id()].trainerCalib(); QString trainercalib = g.profile[g.id()].trainerCalib();
int potsnum=GetCurrentFirmware()->getCapability(Pots); int potsnum=GetCurrentFirmware()->getCapability(Pots);
int8_t vBatCalib=(int8_t) g.profile[g.id()].vBatCalib(); int8_t txVoltageCalibration=(int8_t) g.profile[g.id()].txVoltageCalibration();
int8_t currentCalib=(int8_t) g.profile[g.id()].currentCalib(); int8_t txCurrentCalibration=(int8_t) g.profile[g.id()].txCurrentCalibration();
int8_t PPM_Multiplier=(int8_t) g.profile[g.id()].ppmMultiplier(); int8_t PPM_Multiplier=(int8_t) g.profile[g.id()].ppmMultiplier();
if ((calib.length()==(NUM_STICKS+potsnum)*12) && (trainercalib.length()==16)) { if ((calib.length()==(NUM_STICKS+potsnum)*12) && (trainercalib.length()==16)) {
@ -204,8 +206,8 @@ bool FlashEEpromDialog::patchCalibration()
radioData->generalSettings.trainer.calib[i] = byte16; radioData->generalSettings.trainer.calib[i] = byte16;
} }
} }
radioData->generalSettings.currentCalib = currentCalib; radioData->generalSettings.txCurrentCalibration = txCurrentCalibration;
radioData->generalSettings.vBatCalib = vBatCalib; radioData->generalSettings.txVoltageCalibration = txVoltageCalibration;
radioData->generalSettings.PPM_Multiplier = PPM_Multiplier; radioData->generalSettings.PPM_Multiplier = PPM_Multiplier;
return true; return true;
} }
@ -303,7 +305,7 @@ void FlashEEpromDialog::on_burnButton_clicked()
backupPath = g.profile[g.id()].pBackupDir(); backupPath = g.profile[g.id()].pBackupDir();
if (backupPath.isEmpty()) { if (backupPath.isEmpty()) {
backupPath=g.backupDir(); backupPath=g.backupDir();
} }
backupFilename = backupPath + "/backup-" + QDateTime().currentDateTime().toString("yyyy-MM-dd-HHmmss") + ".bin"; backupFilename = backupPath + "/backup-" + QDateTime().currentDateTime().toString("yyyy-MM-dd-HHmmss") + ".bin";
} }
else if (ui->checkFirmwareCompatibility->isChecked()) { else if (ui->checkFirmwareCompatibility->isChecked()) {

0
companion/src/flasheepromdialog.h Executable file → Normal file
View file

0
companion/src/flasheepromdialog.ui Executable file → Normal file
View file

0
companion/src/flashfirmwaredialog.cpp Executable file → Normal file
View file

0
companion/src/flashfirmwaredialog.h Executable file → Normal file
View file

0
companion/src/flashfirmwaredialog.ui Executable file → Normal file
View file

View file

@ -159,6 +159,11 @@ CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSe
ui->serialPortLabel->hide(); ui->serialPortLabel->hide();
} }
if (!IS_SKY9X(firmware->getBoard())) {
ui->txCurrentCalibration->hide();
ui->txCurrentCalibrationLabel->hide();
}
if (IS_TARANIS_X9E(firmware->getBoard())) { if (IS_TARANIS_X9E(firmware->getBoard())) {
ui->bluetoothEnable->setChecked(generalSettings.bluetoothEnable); ui->bluetoothEnable->setChecked(generalSettings.bluetoothEnable);
ui->bluetoothName->setField(generalSettings.bluetoothName, 10, this); ui->bluetoothName->setField(generalSettings.bluetoothName, 10, this);
@ -214,9 +219,9 @@ void CalibrationPanel::on_PPM4_editingFinished()
} }
void CalibrationPanel::on_CurrentCalib_SB_editingFinished() void CalibrationPanel::on_txCurrentCalibration_editingFinished()
{ {
generalSettings.currentCalib = ui->CurrentCalib_SB->value(); generalSettings.txCurrentCalibration = ui->txCurrentCalibration->value();
emit modified(); emit modified();
} }
@ -228,8 +233,8 @@ void CalibrationPanel::on_bluetoothEnable_stateChanged(int)
void CalibrationPanel::setValues() void CalibrationPanel::setValues()
{ {
ui->battCalibDSB->setValue((double)generalSettings.vBatCalib/10); ui->txVoltageCalibration->setValue((double)generalSettings.txVoltageCalibration/10);
ui->CurrentCalib_SB->setValue((double)generalSettings.currentCalib); ui->txCurrentCalibration->setValue((double)generalSettings.txCurrentCalibration);
ui->ana1Neg->setValue(generalSettings.calibSpanNeg[0]); ui->ana1Neg->setValue(generalSettings.calibSpanNeg[0]);
ui->ana2Neg->setValue(generalSettings.calibSpanNeg[1]); ui->ana2Neg->setValue(generalSettings.calibSpanNeg[1]);
@ -265,9 +270,9 @@ void CalibrationPanel::setValues()
ui->PPM_MultiplierDSB->setValue((qreal)(generalSettings.PPM_Multiplier+10)/10); ui->PPM_MultiplierDSB->setValue((qreal)(generalSettings.PPM_Multiplier+10)/10);
} }
void CalibrationPanel::on_battCalibDSB_editingFinished() void CalibrationPanel::on_txVoltageCalibration_editingFinished()
{ {
generalSettings.vBatCalib = ui->battCalibDSB->value()*10; generalSettings.txVoltageCalibration = ui->txVoltageCalibration->value()*10;
emit modified(); emit modified();
} }

View file

@ -21,14 +21,14 @@ class CalibrationPanel : public GeneralPanel
// virtual void update(); // virtual void update();
private slots: private slots:
void on_battCalibDSB_editingFinished(); void on_txVoltageCalibration_editingFinished();
void on_PPM1_editingFinished(); void on_PPM1_editingFinished();
void on_PPM2_editingFinished(); void on_PPM2_editingFinished();
void on_PPM3_editingFinished(); void on_PPM3_editingFinished();
void on_PPM4_editingFinished(); void on_PPM4_editingFinished();
void on_PPM_MultiplierDSB_editingFinished(); void on_PPM_MultiplierDSB_editingFinished();
void on_CurrentCalib_SB_editingFinished(); void on_txCurrentCalibration_editingFinished();
void on_bluetoothEnable_stateChanged(int); void on_bluetoothEnable_stateChanged(int);
void on_ana1Neg_editingFinished(); void on_ana1Neg_editingFinished();

View file

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>805</width> <width>805</width>
<height>1269</height> <height>1313</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -562,14 +562,14 @@
</widget> </widget>
</item> </item>
<item row="42" column="0"> <item row="42" column="0">
<widget class="QLabel" name="label_22"> <widget class="QLabel" name="txVoltageCalibrationLabel">
<property name="text"> <property name="text">
<string>Battery</string> <string>Battery Offset</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="42" column="1"> <item row="42" column="1">
<widget class="QDoubleSpinBox" name="battCalibDSB"> <widget class="QDoubleSpinBox" name="txVoltageCalibration">
<property name="statusTip"> <property name="statusTip">
<string/> <string/>
</property> </property>
@ -674,7 +674,7 @@
</widget> </widget>
</item> </item>
<item row="43" column="1"> <item row="43" column="1">
<widget class="QSpinBox" name="CurrentCalib_SB"> <widget class="QSpinBox" name="txCurrentCalibration">
<property name="minimum"> <property name="minimum">
<number>-49</number> <number>-49</number>
</property> </property>
@ -698,9 +698,9 @@
</widget> </widget>
</item> </item>
<item row="43" column="0"> <item row="43" column="0">
<widget class="QLabel" name="label_CurrentCalib"> <widget class="QLabel" name="txCurrentCalibrationLabel">
<property name="text"> <property name="text">
<string>Current</string> <string>Current Offset</string>
</property> </property>
</widget> </widget>
</item> </item>

View file

@ -88,8 +88,8 @@ void GeneralEdit::on_calretrieve_PB_clicked()
} }
else { else {
QString trainercalib = g.profile[profile_id].trainerCalib(); QString trainercalib = g.profile[profile_id].trainerCalib();
int8_t vBatCalib = (int8_t)g.profile[profile_id].vBatCalib(); int8_t txVoltageCalibration = (int8_t)g.profile[profile_id].txVoltageCalibration();
int8_t currentCalib = (int8_t)g.profile[profile_id].currentCalib(); int8_t txCurrentCalibration = (int8_t)g.profile[profile_id].txCurrentCalibration();
int8_t PPM_Multiplier = (int8_t)g.profile[profile_id].ppmMultiplier(); int8_t PPM_Multiplier = (int8_t)g.profile[profile_id].ppmMultiplier();
uint8_t GSStickMode = (uint8_t)g.profile[profile_id].gsStickMode(); uint8_t GSStickMode = (uint8_t)g.profile[profile_id].gsStickMode();
uint8_t vBatWarn = (uint8_t)g.profile[profile_id].vBatWarn(); uint8_t vBatWarn = (uint8_t)g.profile[profile_id].vBatWarn();
@ -123,8 +123,8 @@ void GeneralEdit::on_calretrieve_PB_clicked()
if (ok) if (ok)
generalSettings.trainer.calib[i]=byte16; generalSettings.trainer.calib[i]=byte16;
} }
generalSettings.currentCalib=currentCalib; generalSettings.txCurrentCalibration=txCurrentCalibration;
generalSettings.vBatCalib=vBatCalib; generalSettings.txVoltageCalibration=txVoltageCalibration;
generalSettings.vBatWarn=vBatWarn; generalSettings.vBatWarn=vBatWarn;
if (GetCurrentFirmware()->getCapability(HasBatMeterRange)) { if (GetCurrentFirmware()->getCapability(HasBatMeterRange)) {
generalSettings.vBatMin = (int8_t) g.profile[profile_id].vBatMin(); generalSettings.vBatMin = (int8_t) g.profile[profile_id].vBatMin();
@ -225,8 +225,8 @@ void GeneralEdit::on_calstore_PB_clicked()
calib.append(QString("%1").arg((uint16_t)generalSettings.trainer.calib[i], 4, 16, QChar('0'))); calib.append(QString("%1").arg((uint16_t)generalSettings.trainer.calib[i], 4, 16, QChar('0')));
} }
g.profile[profile_id].trainerCalib( calib ); g.profile[profile_id].trainerCalib( calib );
g.profile[profile_id].vBatCalib( generalSettings.vBatCalib ); g.profile[profile_id].txVoltageCalibration( generalSettings.txVoltageCalibration );
g.profile[profile_id].currentCalib( generalSettings.currentCalib ); g.profile[profile_id].txCurrentCalibration( generalSettings.txCurrentCalibration );
g.profile[profile_id].vBatWarn( generalSettings.vBatWarn ); g.profile[profile_id].vBatWarn( generalSettings.vBatWarn );
if (GetCurrentFirmware()->getCapability(HasBatMeterRange)) { if (GetCurrentFirmware()->getCapability(HasBatMeterRange)) {
g.profile[profile_id].vBatMin( generalSettings.vBatMin ); g.profile[profile_id].vBatMin( generalSettings.vBatMin );

0
companion/src/helpers_html.cpp Executable file → Normal file
View file

0
companion/src/helpers_html.h Executable file → Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

0
companion/src/images/originals/scripts/makeblue.sh Executable file → Normal file
View file

0
companion/src/images/originals/scripts/makewhite.sh Executable file → Normal file
View file

View file

@ -115,12 +115,12 @@ MainWindow::MainWindow():
this->setIconSize(QSize(32, 32)); this->setIconSize(QSize(32, 32));
QNetworkProxyFactory::setUseSystemConfiguration(true); QNetworkProxyFactory::setUseSystemConfiguration(true);
setAcceptDrops(true); setAcceptDrops(true);
// give time to the splash to disappear and main window to open before starting updates // give time to the splash to disappear and main window to open before starting updates
int updateDelay = 1000; int updateDelay = 1000;
bool showSplash = g.showSplash(); bool showSplash = g.showSplash();
if (showSplash) { if (showSplash) {
updateDelay += (SPLASH_TIME*1000); updateDelay += (SPLASH_TIME*1000);
} }
QTimer::singleShot(updateDelay, this, SLOT(doAutoUpdates())); QTimer::singleShot(updateDelay, this, SLOT(doAutoUpdates()));
QTimer::singleShot(updateDelay, this, SLOT(displayWarnings())); QTimer::singleShot(updateDelay, this, SLOT(displayWarnings()));
@ -158,13 +158,13 @@ MainWindow::MainWindow():
child->show(); child->show();
} }
else { else {
child->show(); child->show();
child->print(model,printfilename); child->print(model,printfilename);
child->close(); child->close();
} }
} }
} }
} }
if (printing) { if (printing) {
QTimer::singleShot(0, this, SLOT(autoClose())); QTimer::singleShot(0, this, SLOT(autoClose()));
} }
@ -185,7 +185,7 @@ void MainWindow::displayWarnings()
} }
} }
else if (warnId==0) { else if (warnId==0) {
g.warningId(WARNING_ID); g.warningId(WARNING_ID);
} }
} }
@ -292,15 +292,15 @@ void MainWindow::checkForCompanionUpdateFinished(QNetworkReply * reply)
int c9xver = version2index(c9xversion); int c9xver = version2index(c9xversion);
if (c9xver < vnum) { if (c9xver < vnum) {
#if defined WIN32 || !defined __GNUC__ // || defined __APPLE__ // OSX should only notify of updates since no update packages are available. #if defined WIN32 || !defined __GNUC__ // || defined __APPLE__ // OSX should only notify of updates since no update packages are available.
int ret = QMessageBox::question(this, "Companion", tr("A new version of Companion is available (version %1)<br>" int ret = QMessageBox::question(this, "Companion", tr("A new version of Companion is available (version %1)<br>"
"Would you like to download it?").arg(version) , "Would you like to download it?").arg(version) ,
QMessageBox::Yes | QMessageBox::No); QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::Yes) { if (ret == QMessageBox::Yes) {
#if defined __APPLE__ #if defined __APPLE__
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.updatesDir() + QString(COMPANION_INSTALLER).arg(version)); QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.updatesDir() + QString(COMPANION_INSTALLER).arg(version));
#else #else
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.updatesDir() + QString(COMPANION_INSTALLER).arg(version), tr("Executable (*.exe)")); QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.updatesDir() + QString(COMPANION_INSTALLER).arg(version), tr("Executable (*.exe)"));
#endif #endif
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
@ -313,7 +313,7 @@ void MainWindow::checkForCompanionUpdateFinished(QNetworkReply * reply)
} }
#else #else
QMessageBox::warning(this, tr("New release available"), tr("A new release of Companion is available, please check the OpenTX website!")); QMessageBox::warning(this, tr("New release available"), tr("A new release of Companion is available, please check the OpenTX website!"));
#endif #endif
} }
else { else {
if (downloadDialog_forWait && checkForUpdatesState==0) { if (downloadDialog_forWait && checkForUpdatesState==0) {
@ -539,19 +539,19 @@ void MainWindow::closeEvent(QCloseEvent *event)
} }
void MainWindow::setLanguage(const QString & langString) void MainWindow::setLanguage(const QString & langString)
{ {
g.locale(langString); g.locale(langString);
QMessageBox::information(this, tr("Companion"), tr("The selected language will be used the next time you start Companion.")); QMessageBox::information(this, tr("Companion"), tr("The selected language will be used the next time you start Companion."));
} }
void MainWindow::setTheme(int index) void MainWindow::setTheme(int index)
{ {
g.theme(index); g.theme(index);
QMessageBox::information(this, tr("Companion"), tr("The new theme will be loaded the next time you start Companion.")); QMessageBox::information(this, tr("Companion"), tr("The new theme will be loaded the next time you start Companion."));
} }
void MainWindow::setIconThemeSize(int index) void MainWindow::setIconThemeSize(int index)
{ {
g.iconSize(index); g.iconSize(index);
QMessageBox::information(this, tr("Companion"), tr("The icon size will be used the next time you start Companion.")); QMessageBox::information(this, tr("Companion"), tr("The icon size will be used the next time you start Companion."));
} }
@ -705,7 +705,7 @@ void MainWindow::fwchangelog()
} }
void MainWindow::customizeSplash() void MainWindow::customizeSplash()
{ {
customizeSplashDialog * dialog = new customizeSplashDialog(this); customizeSplashDialog * dialog = new customizeSplashDialog(this);
dialog->exec(); dialog->exec();
} }
@ -763,7 +763,7 @@ void MainWindow::readEeprom()
EEPROMInterface *eepromInterface = GetEepromInterface(); EEPROMInterface *eepromInterface = GetEepromInterface();
if (IS_ARM(eepromInterface->getBoard())) if (IS_ARM(eepromInterface->getBoard()))
tempFile = generateProcessUniqueTempFileName("temp.bin"); tempFile = generateProcessUniqueTempFileName("temp.bin");
else else
tempFile += generateProcessUniqueTempFileName("temp.hex"); tempFile += generateProcessUniqueTempFileName("temp.hex");
@ -920,7 +920,7 @@ void MainWindow::updateMenus()
pasteAct->setEnabled(hasMdiChild ? activeMdiChild()->hasPasteData() : false); pasteAct->setEnabled(hasMdiChild ? activeMdiChild()->hasPasteData() : false);
writeEepromAct->setEnabled(hasMdiChild); writeEepromAct->setEnabled(hasMdiChild);
separatorAct->setVisible(hasMdiChild); separatorAct->setVisible(hasMdiChild);
bool hasSelection = (activeMdiChild() && activeMdiChild()->hasSelection()); bool hasSelection = (activeMdiChild() && activeMdiChild()->hasSelection());
cutAct->setEnabled(hasSelection); cutAct->setEnabled(hasSelection);
copyAct->setEnabled(hasSelection); copyAct->setEnabled(hasSelection);
@ -962,7 +962,7 @@ QAction * MainWindow::addAct(const QString & icon, const QString & sName, const
QAction * newAction = new QAction( this ); QAction * newAction = new QAction( this );
if (!icon.isEmpty()) if (!icon.isEmpty())
newAction->setIcon(CompanionIcon(icon)); newAction->setIcon(CompanionIcon(icon));
if (!sName.isEmpty()) if (!sName.isEmpty())
newAction->setText(sName); newAction->setText(sName);
if (!lName.isEmpty()) if (!lName.isEmpty())
newAction->setStatusTip(lName); newAction->setStatusTip(lName);
@ -983,7 +983,7 @@ QAction * MainWindow::addAct(QActionGroup *aGroup, const QString & sName, const
{ {
QAction *action = addAct("", sName, lName, QKeySequence::UnknownKey, slot); QAction *action = addAct("", sName, lName, QKeySequence::UnknownKey, slot);
action->setCheckable(true); action->setCheckable(true);
aGroup->addAction(action); aGroup->addAction(action);
return action; return action;
} }
@ -1017,7 +1017,7 @@ void MainWindow::createActions()
cutAct = addAct("cut.png", tr("Cut Model"), tr("Cut current model to the clipboard"), QKeySequence::Cut, SLOT(cut())); 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())); 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())); pasteAct = addAct("paste.png", tr("Paste Model"), tr("Paste model from clipboard"), QKeySequence::Paste, SLOT(paste()));
QActionGroup *themeAlignGroup = new QActionGroup(this); QActionGroup *themeAlignGroup = new QActionGroup(this);
classicThemeAct = addAct( themeAlignGroup, tr("Classical"), tr("The classic companion9x 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())); yericoThemeAct = addAct( themeAlignGroup, tr("Yerico"), tr("Yellow round honey sweet icon theme"), SLOT(setYericoTheme()));
@ -1072,7 +1072,7 @@ void MainWindow::createActions()
readBackupToFileAct = addAct("read_eeprom_file.png", tr("Backup Radio to File"), tr("Save a complete backup file of all settings and model data in the Radio"), SLOT(readBackup())); readBackupToFileAct = addAct("read_eeprom_file.png", tr("Backup Radio to File"), tr("Save a complete backup file of all settings and model data in the Radio"), SLOT(readBackup()));
contributorsAct = addAct("contributors.png", tr("Contributors..."), tr("A tribute to those who have contributed to OpenTX and Companion"), SLOT(contributors())); contributorsAct = addAct("contributors.png", tr("Contributors..."), tr("A tribute to those who have contributed to OpenTX and Companion"), SLOT(contributors()));
sdsyncAct = addAct("sdsync.png", tr("Synchronize SD"), tr("SD card synchronization"), SLOT(sdsync())); sdsyncAct = addAct("sdsync.png", tr("Synchronize SD"), tr("SD card synchronization"), SLOT(sdsync()));
compareAct->setEnabled(false); compareAct->setEnabled(false);
simulateAct->setEnabled(false); simulateAct->setEnabled(false);
printAct->setEnabled(false); printAct->setEnabled(false);
@ -1118,8 +1118,8 @@ void MainWindow::createMenus()
languageMenu->addAction(germanLangAct); languageMenu->addAction(germanLangAct);
languageMenu->addAction(finnishLangAct); languageMenu->addAction(finnishLangAct);
languageMenu->addAction(frenchLangAct); languageMenu->addAction(frenchLangAct);
// languageMenu->addAction(hebrewLangAct);
languageMenu->addAction(italianLangAct); languageMenu->addAction(italianLangAct);
// languageMenu->addAction(hebrewLangAct);
languageMenu->addAction(polishLangAct); languageMenu->addAction(polishLangAct);
// languageMenu->addAction(portugueseLangAct); // languageMenu->addAction(portugueseLangAct);
languageMenu->addAction(spanishLangAct); languageMenu->addAction(spanishLangAct);
@ -1156,7 +1156,7 @@ void MainWindow::createMenus()
burnMenu->addSeparator(); burnMenu->addSeparator();
burnMenu->addSeparator(); burnMenu->addSeparator();
EEPROMInterface *eepromInterface = GetEepromInterface(); EEPROMInterface *eepromInterface = GetEepromInterface();
if (!IS_ARM(eepromInterface->getBoard())) { if (!IS_ARM(eepromInterface->getBoard())) {
burnMenu->addAction(burnFusesAct); burnMenu->addAction(burnFusesAct);
burnMenu->addAction(burnListAct); burnMenu->addAction(burnListAct);
} }
@ -1173,7 +1173,7 @@ void MainWindow::createMenus()
helpMenu->addSeparator(); helpMenu->addSeparator();
helpMenu->addAction(contributorsAct); helpMenu->addAction(contributorsAct);
} }
QMenu *MainWindow::createRecentFileMenu() QMenu *MainWindow::createRecentFileMenu()
{ {
QMenu *recentFileMenu = new QMenu(this); QMenu *recentFileMenu = new QMenu(this);
@ -1214,7 +1214,7 @@ void MainWindow::createToolBars()
break; break;
default: default:
size=QSize(24,24); size=QSize(24,24);
break; break;
} }
fileToolBar = addToolBar(tr("File")); fileToolBar = addToolBar(tr("File"));
fileToolBar->setIconSize(size); fileToolBar->setIconSize(size);
@ -1260,7 +1260,7 @@ void MainWindow::createToolBars()
editToolBar->addAction(cutAct); editToolBar->addAction(cutAct);
editToolBar->addAction(copyAct); editToolBar->addAction(copyAct);
editToolBar->addAction(pasteAct); editToolBar->addAction(pasteAct);
burnToolBar = new QToolBar(tr("Write")); burnToolBar = new QToolBar(tr("Write"));
addToolBar( Qt::LeftToolBarArea, burnToolBar ); addToolBar( Qt::LeftToolBarArea, burnToolBar );
burnToolBar->setIconSize(size); burnToolBar->setIconSize(size);
@ -1317,7 +1317,7 @@ void MainWindow::setActiveSubWindow(QWidget *window)
void MainWindow::updateRecentFileActions() void MainWindow::updateRecentFileActions()
{ {
int i, numRecentFiles; int i, numRecentFiles;
// Hide all document slots // Hide all document slots
for ( i=0 ; i < g.historySize(); i++) for ( i=0 ; i < g.historySize(); i++)
recentFileActs[i]->setVisible(false); recentFileActs[i]->setVisible(false);
@ -1325,7 +1325,7 @@ void MainWindow::updateRecentFileActions()
// Fill slots with content and unhide them // Fill slots with content and unhide them
QStringList files = g.recentFiles(); QStringList files = g.recentFiles();
numRecentFiles = qMin(files.size(), g.historySize()); numRecentFiles = qMin(files.size(), g.historySize());
for ( i = 0; i < numRecentFiles; i++) { for ( i = 0; i < numRecentFiles; i++) {
QString text = strippedName(files[i]); QString text = strippedName(files[i]);
if (!text.trimmed().isEmpty()) if (!text.trimmed().isEmpty())
@ -1352,34 +1352,34 @@ void MainWindow::updateLanguageActions()
{ {
QString langId = g.locale(); QString langId = g.locale();
if (langId=="") if (langId=="")
sysLangAct->setChecked(true); sysLangAct->setChecked(true);
else if (langId=="cs_CZ") else if (langId=="cs_CZ")
czechLangAct->setChecked(true); czechLangAct->setChecked(true);
else if (langId=="de_DE") else if (langId=="de_DE")
germanLangAct->setChecked(true); germanLangAct->setChecked(true);
else if (langId=="en") else if (langId=="en")
englishLangAct->setChecked(true); englishLangAct->setChecked(true);
else if (langId=="fi_FI") else if (langId=="fi_FI")
finnishLangAct->setChecked(true); finnishLangAct->setChecked(true);
else if (langId=="fr_FR") else if (langId=="fr_FR")
frenchLangAct->setChecked(true); frenchLangAct->setChecked(true);
else if (langId=="it_IT") else if (langId=="it_IT")
italianLangAct->setChecked(true); italianLangAct->setChecked(true);
else if (langId=="he_IL") // else if (langId=="he_IL")
hebrewLangAct->setChecked(true); // hebrewLangAct->setChecked(true);
else if (langId=="pl_PL") else if (langId=="pl_PL")
polishLangAct->setChecked(true); polishLangAct->setChecked(true);
else if (langId=="pt_PT") // else if (langId=="pt_PT")
portugueseLangAct->setChecked(true); // portugueseLangAct->setChecked(true);
else if (langId=="ru_RU")
russianLangAct->setChecked(true);
else if (langId=="es_ES") else if (langId=="es_ES")
spanishLangAct->setChecked(true); spanishLangAct->setChecked(true);
else if (langId=="sv_SE") else if (langId=="sv_SE")
swedishLangAct->setChecked(true); swedishLangAct->setChecked(true);
else if (langId=="nl_NL") // else if (langId=="ru_RU")
dutchLangAct->setChecked(true); // russianLangAct->setChecked(true);
// else if (langId=="nl_NL")
// dutchLangAct->setChecked(true);
} }
void MainWindow::updateIconThemeActions() void MainWindow::updateIconThemeActions()
@ -1396,9 +1396,9 @@ void MainWindow::updateIconThemeActions()
void MainWindow::updateProfilesActions() void MainWindow::updateProfilesActions()
{ {
for (int i=0; i<MAX_PROFILES; i++) for (int i=0; i<MAX_PROFILES; i++)
{ {
if (g.profile[i].existsOnDisk()) if (g.profile[i].existsOnDisk())
{ {
QString text = tr("%2").arg(g.profile[i].name()); QString text = tr("%2").arg(g.profile[i].name());
profileActs[i]->setText(text); profileActs[i]->setText(text);
@ -1406,8 +1406,8 @@ void MainWindow::updateProfilesActions()
profileActs[i]->setVisible(true); profileActs[i]->setVisible(true);
if (i == g.id()) if (i == g.id())
profileActs[i]->setChecked(true); profileActs[i]->setChecked(true);
} }
else else
{ {
profileActs[i]->setVisible(false); profileActs[i]->setVisible(false);
} }
@ -1421,7 +1421,7 @@ void MainWindow::createProfile()
; ;
if (i==MAX_PROFILES) //Failed to find free slot if (i==MAX_PROFILES) //Failed to find free slot
return; return;
// Copy current profile to new and give it a new name // Copy current profile to new and give it a new name
g.profile[i] = g.profile[g.id()]; g.profile[i] = g.profile[g.id()];
g.profile[i].name(tr("New Radio")); g.profile[i].name(tr("New Radio"));

View file

@ -262,20 +262,22 @@ class MainWindow : public QMainWindow
QAction *normalIconAct; QAction *normalIconAct;
QAction *bigIconAct; QAction *bigIconAct;
QAction *hugeIconAct; QAction *hugeIconAct;
QAction *sysLangAct; QAction *sysLangAct;
QAction *englishLangAct;
QAction *czechLangAct; QAction *czechLangAct;
QAction *germanLangAct; QAction *germanLangAct;
QAction *frenchLangAct; QAction *englishLangAct;
QAction *finnishLangAct; QAction *finnishLangAct;
QAction *frenchLangAct;
QAction *italianLangAct; QAction *italianLangAct;
QAction *hebrewLangAct; // QAction *hebrewLangAct;
QAction *polishLangAct; QAction *polishLangAct;
// QAction *portugueseLangAct;
QAction *spanishLangAct; QAction *spanishLangAct;
QAction *portugueseLangAct;
QAction *swedishLangAct; QAction *swedishLangAct;
QAction *russianLangAct; // QAction *russianLangAct;
QAction *dutchLangAct; // QAction *dutchLangAct;
QAction *openDocURLAct; QAction *openDocURLAct;
}; };

View file

@ -81,7 +81,7 @@ MdiChild::MdiChild():
} }
} }
MdiChild::~MdiChild() MdiChild::~MdiChild()
{ {
delete ui; delete ui;
} }
@ -174,7 +174,7 @@ void MdiChild::modelEdit()
if (row == 0){ if (row == 0){
generalEdit(); generalEdit();
} }
else { else {
QApplication::setOverrideCursor(Qt::WaitCursor); QApplication::setOverrideCursor(Qt::WaitCursor);
checkAndInitModel( row ); checkAndInitModel( row );
@ -251,7 +251,7 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile)
XmlInterface(inputStream).load(radioData); XmlInterface(inputStream).load(radioData);
} }
else else
#endif #endif
if (fileType==FILE_TYPE_HEX || fileType==FILE_TYPE_EEPE) { //read HEX file if (fileType==FILE_TYPE_HEX || fileType==FILE_TYPE_EEPE) { //read HEX file
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { //reading HEX TEXT file
QMessageBox::critical(this, tr("Error"), QMessageBox::critical(this, tr("Error"),
@ -260,18 +260,19 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile)
.arg(file.errorString())); .arg(file.errorString()));
return false; return false;
} }
QDomDocument doc(ER9X_EEPROM_FILE_TYPE); QDomDocument doc(ER9X_EEPROM_FILE_TYPE);
bool xmlOK = doc.setContent(&file); bool xmlOK = doc.setContent(&file);
if(xmlOK) { if(xmlOK) {
if (loadEEpromXml(radioData, doc)){ std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEepromXml(radioData, doc));
if (errors.test(NO_ERROR)) {
ui->modelsList->refreshList(); ui->modelsList->refreshList();
if(resetCurrentFile) setCurrentFile(fileName); if(resetCurrentFile) setCurrentFile(fileName);
return true; return true;
} }
} }
file.reset(); file.reset();
QTextStream inputStream(&file); QTextStream inputStream(&file);
if (fileType==FILE_TYPE_EEPE) { // read EEPE file header if (fileType==FILE_TYPE_EEPE) { // read EEPE file header
@ -294,12 +295,14 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile)
file.close(); file.close();
if (!loadEEprom(radioData, (uint8_t *)eeprom.data(), eeprom_size)) { std::bitset<NUM_ERRORS> errors((unsigned long long)LoadEeprom(radioData, (uint8_t *)eeprom.data(), eeprom_size));
QMessageBox::critical(this, tr("Error"), if (!errors.test(NO_ERROR)) {
tr("Invalid EEPROM File %1") ShowEepromErrors(this, tr("Error"), tr("Invalid EEPROM File %1").arg(fileName), errors.to_ulong());
.arg(fileName));
return false; return false;
} }
if (errors.test(HAS_WARNINGS)) {
ShowEepromWarnings(this, tr("Warning"), errors.to_ulong());
}
ui->modelsList->refreshList(); ui->modelsList->refreshList();
if(resetCurrentFile) setCurrentFile(fileName); if(resetCurrentFile) setCurrentFile(fileName);
@ -330,11 +333,18 @@ bool MdiChild::loadFile(const QString &fileName, bool resetCurrentFile)
return false; return false;
} }
if (!loadEEprom(radioData, eeprom, eeprom_size) && !::loadBackup(radioData, eeprom, eeprom_size, 0)) { std::bitset<NUM_ERRORS> errorsEeprom((unsigned long long)LoadEeprom(radioData, eeprom, eeprom_size));
QMessageBox::critical(this, tr("Error"), if (!errorsEeprom.test(NO_ERROR)) {
tr("Invalid binary EEPROM File %1") std::bitset<NUM_ERRORS> errorsBackup((unsigned long long)LoadBackup(radioData, eeprom, eeprom_size, 0));
.arg(fileName)); if (!errorsBackup.test(NO_ERROR)) {
return false; ShowEepromErrors(this, tr("Error"), tr("Invalid binary EEPROM File %1").arg(fileName), (errorsEeprom | errorsBackup).to_ulong());
return false;
}
if (errorsBackup.test(HAS_WARNINGS)) {
ShowEepromWarnings(this, tr("Warning"), errorsBackup.to_ulong());
}
} else if (errorsEeprom.test(HAS_WARNINGS)) {
ShowEepromWarnings(this, tr("Warning"), errorsEeprom.to_ulong());
} }
ui->modelsList->refreshList(); ui->modelsList->refreshList();
@ -367,7 +377,7 @@ bool MdiChild::saveAs(bool isNew)
fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.eepromDir() + "/" +fi.fileName()); fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.eepromDir() + "/" +fi.fileName());
#else #else
fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.eepromDir() + "/" +fi.fileName(), tr(BIN_FILES_FILTER)); fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.eepromDir() + "/" +fi.fileName(), tr(BIN_FILES_FILTER));
#endif #endif
} }
else { else {
QFileInfo fi(curFile); QFileInfo fi(curFile);
@ -375,14 +385,14 @@ bool MdiChild::saveAs(bool isNew)
fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.eepromDir() + "/" +fi.fileName()); fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.eepromDir() + "/" +fi.fileName());
#else #else
fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.eepromDir() + "/" +fi.fileName(), tr(EEPROM_FILES_FILTER)); fileName = QFileDialog::getSaveFileName(this, tr("Save As"), g.eepromDir() + "/" +fi.fileName(), tr(EEPROM_FILES_FILTER));
#endif #endif
} }
if (fileName.isEmpty()) if (fileName.isEmpty())
return false; return false;
g.eepromDir( QFileInfo(fileName).dir().absolutePath() ); g.eepromDir( QFileInfo(fileName).dir().absolutePath() );
if (isNew) if (isNew)
return saveFile(fileName); return saveFile(fileName);
else else
return saveFile(fileName,true); return saveFile(fileName,true);
} }
@ -505,7 +515,7 @@ void MdiChild::setCurrentFile(const QString &fileName)
files.prepend(fileName); files.prepend(fileName);
while (files.size() > MaxRecentFiles) while (files.size() > MaxRecentFiles)
files.removeLast(); files.removeLast();
g.recentFiles( files ); g.recentFiles( files );
} }
@ -544,7 +554,7 @@ void MdiChild::print(int model, QString filename)
else if (getCurrentRow() > 0) { else if (getCurrentRow() > 0) {
pd = new PrintDialog(this, GetCurrentFirmware()/*firmware*/, radioData.generalSettings, radioData.models[getCurrentRow()-1]); pd = new PrintDialog(this, GetCurrentFirmware()/*firmware*/, radioData.generalSettings, radioData.models[getCurrentRow()-1]);
} }
if (pd) { if (pd) {
pd->setAttribute(Qt::WA_DeleteOnClose, true); pd->setAttribute(Qt::WA_DeleteOnClose, true);
pd->show(); pd->show();
@ -601,12 +611,14 @@ bool MdiChild::loadBackup()
return false; return false;
} }
if (!::loadBackup(radioData, (uint8_t *)eeprom.data(), eeprom_size, index)) { std::bitset<NUM_ERRORS> errorsEeprom((unsigned long long)LoadBackup(radioData, (uint8_t *)eeprom.data(), eeprom_size, index));
QMessageBox::critical(this, tr("Error"), if (!errorsEeprom.test(NO_ERROR)) {
tr("Invalid binary backup File %1") ShowEepromErrors(this, tr("Error"), tr("Invalid binary backup File %1").arg(fileName), (errorsEeprom).to_ulong());
.arg(fileName)); return false;
return false; }
} if (errorsEeprom.test(HAS_WARNINGS)) {
ShowEepromWarnings(this, tr("Warning"), errorsEeprom.to_ulong());
}
ui->modelsList->refreshList(); ui->modelsList->refreshList();

View file

@ -383,13 +383,16 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
populateFuncParamCB(fswtchParamT[i], func, cfn.param); populateFuncParamCB(fswtchParamT[i], func, cfn.param);
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM | CUSTOM_FUNCTION_ENABLE; widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM | CUSTOM_FUNCTION_ENABLE;
} }
else if (func>=FuncSetTimer1 && func<=FuncSetTimer2) { else if (func>=FuncSetTimer1 && func<=FuncSetTimer3) {
if (modified) cfn.param = QTimeS(fswtchParamTime[i]->time()).seconds(); if (modified) cfn.param = QTimeS(fswtchParamTime[i]->time()).seconds();
fswtchParamTime[i]->setMinimumTime(QTime(0, 0, 0)); fswtchParamTime[i]->setMinimumTime(QTime(0, 0, 0));
fswtchParamTime[i]->setMaximumTime(QTime(0, 59, 59)); fswtchParamTime[i]->setMaximumTime(QTime(0, 59, 59));
fswtchParamTime[i]->setTime(QTimeS(cfn.param)); fswtchParamTime[i]->setTime(QTimeS(cfn.param));
widgetsMask |= CUSTOM_FUNCTION_TIME_PARAM + CUSTOM_FUNCTION_ENABLE; widgetsMask |= CUSTOM_FUNCTION_TIME_PARAM + CUSTOM_FUNCTION_ENABLE;
} }
else if (func>=FuncSetFailsafeInternalModule && func<=FuncBindExternalModule) {
widgetsMask |= CUSTOM_FUNCTION_ENABLE;
}
else if (func==FuncVolume) { else if (func==FuncVolume) {
if (modified) cfn.param = fswtchParamT[i]->itemData(fswtchParamT[i]->currentIndex()).toInt(); if (modified) cfn.param = fswtchParamT[i]->itemData(fswtchParamT[i]->currentIndex()).toInt();
populateFuncParamCB(fswtchParamT[i], func, cfn.param); populateFuncParamCB(fswtchParamT[i], func, cfn.param);
@ -604,6 +607,8 @@ void CustomFunctionsPanel::populateFuncCB(QComboBox *b, unsigned int value)
((i==FuncPlayHaptic) && !firmware->getCapability(Haptic)) || ((i==FuncPlayHaptic) && !firmware->getCapability(Haptic)) ||
((i==FuncPlayBoth) && !firmware->getCapability(HasBeeper)) || ((i==FuncPlayBoth) && !firmware->getCapability(HasBeeper)) ||
((i==FuncLogs) && !firmware->getCapability(HasSDLogs)) || ((i==FuncLogs) && !firmware->getCapability(HasSDLogs)) ||
((i==FuncSetTimer3) && firmware->getCapability(Timers) < 3) ||
((i>=FuncRangeCheckInternalModule && i<=FuncBindExternalModule) && (!model || !firmware->getCapability(DangerousFunctions))) ||
((i>=FuncAdjustGV1 && i<=FuncAdjustGVLast) && !firmware->getCapability(Gvars)) ((i>=FuncAdjustGV1 && i<=FuncAdjustGVLast) && !firmware->getCapability(Gvars))
) { ) {
// skipped // skipped

View file

@ -121,14 +121,14 @@ bool MixesPanel::AddMixerLine(int dest)
QString MixesPanel::getMixerText(int dest, bool * new_ch) QString MixesPanel::getMixerText(int dest, bool * new_ch)
{ {
QString str; QString str;
if (new_ch) *new_ch = 0; bool newChannel = false;
if (dest < 0) { if (dest < 0) {
str = modelPrinter.printMixerName(-dest); str = modelPrinter.printMixerName(-dest);
//highlight channel if needed //highlight channel if needed
if (-dest == (int)highlightedSource) { if (-dest == (int)highlightedSource) {
str = "<b>" + str + "</b>"; str = "<b>" + str + "</b>";
} }
if (new_ch) *new_ch = 1; newChannel = true;
} }
else { else {
MixData & mix = model->mixData[dest]; MixData & mix = model->mixData[dest];
@ -136,7 +136,7 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
str = modelPrinter.printMixerName(mix.destCh); str = modelPrinter.printMixerName(mix.destCh);
if ((dest == 0) || (model->mixData[dest-1].destCh != mix.destCh)) { if ((dest == 0) || (model->mixData[dest-1].destCh != mix.destCh)) {
if (new_ch) *new_ch = 1; newChannel = true;
//highlight channel if needed //highlight channel if needed
if (mix.destCh == highlightedSource) { if (mix.destCh == highlightedSource) {
str = "<b>" + str + "</b>"; str = "<b>" + str + "</b>";
@ -146,8 +146,9 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
str.fill(' '); str.fill(' ');
} }
str += modelPrinter.printMixerLine(mix, highlightedSource); str += modelPrinter.printMixerLine(mix, !newChannel, highlightedSource);
} }
if (new_ch) *new_ch = newChannel;
return str.replace(" ", "&nbsp;"); return str.replace(" ", "&nbsp;");
} }

View file

@ -167,8 +167,8 @@ ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module
ui->label_module->setText(label); ui->label_module->setText(label);
// The protocols available on this board // The protocols available on this board
for (int i=0; i<PROTO_LAST; i++) { for (int i=0; i<PULSES_PROTOCOL_LAST; i++) {
if (GetEepromInterface()->isAvailable((Protocol)i, moduleIdx)) { if (GetEepromInterface()->isAvailable((PulsesProtocol)i, moduleIdx)) {
ui->protocol->addItem(ModelPrinter::printModuleProtocol(i), (QVariant)i); ui->protocol->addItem(ModelPrinter::printModuleProtocol(i), (QVariant)i);
if (i == module.protocol) ui->protocol->setCurrentIndex(ui->protocol->count()-1); if (i == module.protocol) ui->protocol->setCurrentIndex(ui->protocol->count()-1);
} }
@ -223,42 +223,42 @@ ModulePanel::~ModulePanel()
void ModulePanel::update() void ModulePanel::update()
{ {
unsigned int mask = 0; unsigned int mask = 0;
Protocol protocol = (Protocol)module.protocol; PulsesProtocol protocol = (PulsesProtocol)module.protocol;
unsigned int max_rx_num = 63; unsigned int max_rx_num = 63;
if (moduleIdx >= 0) { if (moduleIdx >= 0) {
mask |= MASK_PROTOCOL; mask |= MASK_PROTOCOL;
switch (protocol) { switch (protocol) {
case PXX_XJT_X16: case PULSES_PXX_XJT_X16:
case PXX_XJT_D8: case PULSES_PXX_XJT_D8:
case PXX_XJT_LR12: case PULSES_PXX_XJT_LR12:
case PXX_DJT: case PULSES_PXX_DJT:
mask |= MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT; mask |= MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT;
if ((protocol==PXX_XJT_X16) || (protocol==PXX_XJT_LR12)) mask |= MASK_FAILSAFES | MASK_RX_NUMBER; if ((protocol==PULSES_PXX_XJT_X16) || (protocol==PULSES_PXX_XJT_LR12)) mask |= MASK_FAILSAFES | MASK_RX_NUMBER;
break; break;
case LP45: case PULSES_LP45:
case DSM2: case PULSES_DSM2:
case DSMX: case PULSES_DSMX:
mask |= MASK_CHANNELS_RANGE | MASK_RX_NUMBER; mask |= MASK_CHANNELS_RANGE | MASK_RX_NUMBER;
module.channelsCount = 6; module.channelsCount = 6;
max_rx_num = 20; max_rx_num = 20;
break; break;
case PPM: case PULSES_PPM:
mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE| MASK_CHANNELS_COUNT; mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE| MASK_CHANNELS_COUNT;
if (IS_9XRPRO(firmware->getBoard())) { if (IS_9XRPRO(firmware->getBoard())) {
mask |= MASK_OPEN_DRAIN; mask |= MASK_OPEN_DRAIN;
} }
break; break;
case OFF: case PULSES_OFF:
default: default:
break; break;
} }
} }
else if (IS_TARANIS(firmware->getBoard())) { else if (IS_TARANIS(firmware->getBoard())) {
switch(model->trainerMode) { switch(model->trainerMode) {
case MASTER_JACK: case TRAINER_MASTER_JACK:
break; break;
case SLAVE_JACK: case TRAINER_SLAVE_JACK:
mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT; mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT;
break; break;
default: default:
@ -266,7 +266,7 @@ void ModulePanel::update()
break; break;
} }
} }
else if (model->trainerMode != MASTER_JACK) { else if (model->trainerMode != TRAINER_MASTER_JACK) {
mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT; mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE | MASK_CHANNELS_COUNT;
} }
@ -516,6 +516,19 @@ SetupPanel::SetupPanel(QWidget *parent, ModelData & model, GeneralSettings & gen
} }
} }
if (firmware->getCapability(HasTopLcd)) {
ui->toplcdTimer->setField(model.toplcdTimer, this);
for (int i=0; i<C9X_MAX_TIMERS; i++) {
if (i<firmware->getCapability(Timers)) {
ui->toplcdTimer->addItem(tr("Timer %1").arg(i+1), i);
}
}
}
else {
ui->toplcdTimerLabel->hide();
ui->toplcdTimer->hide();
}
if (!firmware->getCapability(HasDisplayText)) { if (!firmware->getCapability(HasDisplayText)) {
ui->displayText->hide(); ui->displayText->hide();
} }
@ -689,7 +702,7 @@ void SetupPanel::on_trimIncrement_currentIndexChanged(int index)
void SetupPanel::on_throttleSource_currentIndexChanged(int index) void SetupPanel::on_throttleSource_currentIndexChanged(int index)
{ {
if (!lock) { if (!lock) {
model->thrTraceSrc = ui->throttleSource->itemData(index).toInt(); model->thrTraceSrc = index;
emit modified(); emit modified();
} }
} }
@ -735,34 +748,39 @@ void SetupPanel::on_image_currentIndexChanged(int index)
void SetupPanel::populateThrottleSourceCB() void SetupPanel::populateThrottleSourceCB()
{ {
const QString sources9x[] = { QObject::tr("THR"), QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3")}; const QString pots9x[] = { QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3")};
const QString sourcesTaranis[] = { QObject::tr("THR"), QObject::tr("S1"), QObject::tr("S2"), QObject::tr("S3"), QObject::tr("LS"), QObject::tr("RS")}; const QString potsTaranis[] = { QObject::tr("S1"), QObject::tr("S2"), QObject::tr("S3"), QObject::tr("LS"), QObject::tr("RS")};
const QString potsTaranisX9E[] = { QObject::tr("F1"), QObject::tr("F2"), QObject::tr("F3"), QObject::tr("F4"), QObject::tr("S1"), QObject::tr("S2"), QObject::tr("LS"), QObject::tr("RS")};
unsigned int i; unsigned int i;
lock = true; lock = true;
if (IS_TARANIS(GetEepromInterface()->getBoard())) { ui->throttleSource->addItem(QObject::tr("THR"));
for (i=0; i<6; i++) {
ui->throttleSource->addItem(sourcesTaranis[i], i); if (IS_TARANIS_X9E(GetEepromInterface()->getBoard())) {
for (i=0; i<8; i++) {
ui->throttleSource->addItem(potsTaranisX9E[i], i);
}
}
else if (IS_TARANIS(GetEepromInterface()->getBoard())) {
for (i=0; i<5; i++) {
ui->throttleSource->addItem(potsTaranis[i], i);
} }
} }
else { else {
for (i=0; i<4; i++) { for (i=0; i<3; i++) {
ui->throttleSource->addItem(sources9x[i], i); ui->throttleSource->addItem(pots9x[i], i);
} }
} }
if (model->thrTraceSrc < i)
ui->throttleSource->setCurrentIndex(model->thrTraceSrc);
int channels = (IS_ARM(GetEepromInterface()->getBoard()) ? 32 : 16); int channels = (IS_ARM(GetEepromInterface()->getBoard()) ? 32 : 16);
for (int i=0; i<channels; i++) { for (int i=0; i<channels; i++) {
ui->throttleSource->addItem(ModelPrinter::printChannelName(i), THROTTLE_SOURCE_FIRST_CHANNEL+i); ui->throttleSource->addItem(ModelPrinter::printChannelName(i));
if (model->thrTraceSrc == unsigned(THROTTLE_SOURCE_FIRST_CHANNEL+i))
ui->throttleSource->setCurrentIndex(ui->throttleSource->count()-1);
} }
ui->throttleSource->setCurrentIndex(model->thrTraceSrc);
lock = false; lock = false;
} }

View file

@ -16,22 +16,6 @@
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="3" column="0">
<widget class="QLabel" name="label_timer3">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Timer 3</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_timer1"> <widget class="QLabel" name="label_timer1">
<property name="font"> <property name="font">
@ -48,8 +32,8 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0" alignment="Qt::AlignRight|Qt::AlignVCenter"> <item row="4" column="0">
<widget class="QLabel" name="label_timer2"> <widget class="QLabel" name="toplcdTimerLabel">
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight> <weight>50</weight>
@ -57,14 +41,307 @@
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Timer 2</string> <string>Top LCD Timer</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="name">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxLength">
<number>10</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="modelImage_label">
<property name="text">
<string>Model Image</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="imagePreview">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>64</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>32</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="image"/>
</item>
<item>
<spacer name="horizontalSpacer_26">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="10" column="0" alignment="Qt::AlignLeft|Qt::AlignTop">
<widget class="QLabel" name="swwarn_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Warnings</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="10" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Switch Warnings</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="switchesStartupLayout" rowstretch="0" columnstretch="0">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item alignment="Qt::AlignTop">
<widget class="QLabel" name="label_potWarning">
<property name="text">
<string>Pot Warnings</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="potWarningLayout">
<item row="0" column="0" alignment="Qt::AlignTop">
<widget class="QComboBox" name="potWarningMode">
<item>
<property name="text">
<string>OFF</string>
</property>
</item>
<item>
<property name="text">
<string>Manual</string>
</property>
</item>
<item>
<property name="text">
<string>Auto</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="0" alignment="Qt::AlignLeft|Qt::AlignTop">
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Model</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="8" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<layout class="QGridLayout" name="centerBeepLayout"/>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="9" column="0" colspan="2">
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_12">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Center beep</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="6" column="1">
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="2"> <item row="1" column="2">
<widget class="QCheckBox" name="extendedTrims"> <widget class="QCheckBox" name="extendedTrims">
@ -224,7 +501,7 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
</item> </item>
</layout> </layout>
</item> </item>
<item row="5" column="0"> <item row="6" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item alignment="Qt::AlignRight"> <item alignment="Qt::AlignRight">
<widget class="QLabel" name="label_ttrace"> <widget class="QLabel" name="label_ttrace">
@ -276,42 +553,15 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
</item> </item>
</layout> </layout>
</item> </item>
<item row="4" column="1"> <item row="5" column="1">
<widget class="Line" name="line_2"> <widget class="Line" name="line_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="2" column="0" alignment="Qt::AlignRight|Qt::AlignVCenter">
<layout class="QHBoxLayout" name="horizontalLayout_7"> <widget class="QLabel" name="label_timer2">
<item>
<layout class="QGridLayout" name="centerBeepLayout"/>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="8" column="0" colspan="2">
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_12">
<property name="font"> <property name="font">
<font> <font>
<weight>50</weight> <weight>50</weight>
@ -319,261 +569,37 @@ If this is checked the throttle will be reversed. Idle will be forward, trim wi
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Center beep</string> <string>Timer 2</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="3" column="0">
<widget class="Line" name="line_4"> <widget class="QLabel" name="label_timer3_2">
<property name="orientation"> <property name="font">
<enum>Qt::Horizontal</enum> <font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Timer 3</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="4" column="1">
<layout class="QVBoxLayout" name="verticalLayout_5"> <widget class="AutoComboBox" name="toplcdTimer">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="name">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxLength">
<number>10</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="modelImage_label">
<property name="text">
<string>Model Image</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="imagePreview">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>64</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>32</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="image"/>
</item>
<item>
<spacer name="horizontalSpacer_26">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="9" column="0" alignment="Qt::AlignLeft|Qt::AlignTop">
<widget class="QLabel" name="swwarn_label">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Warnings</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="9" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Switch Warnings</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="switchesStartupLayout" rowstretch="0" columnstretch="0">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item alignment="Qt::AlignTop">
<widget class="QLabel" name="label_potWarning">
<property name="text">
<string>Pot Warnings</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="potWarningLayout">
<item row="0" column="0" alignment="Qt::AlignTop">
<widget class="QComboBox" name="potWarningMode">
<item>
<property name="text">
<string>OFF</string>
</property>
</item>
<item>
<property name="text">
<string>Manual</string>
</property>
</item>
<item>
<property name="text">
<string>Auto</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="0" alignment="Qt::AlignLeft|Qt::AlignTop">
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Model</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>

View file

@ -533,6 +533,7 @@ void TelemetrySensorPanel::update()
bool cellsFieldsDisplayed = false; bool cellsFieldsDisplayed = false;
bool consFieldsDisplayed = false; bool consFieldsDisplayed = false;
bool ratioFieldsDisplayed = false; bool ratioFieldsDisplayed = false;
bool totalizeFieldsDisplayed = false;
bool sources12FieldsDisplayed = false; bool sources12FieldsDisplayed = false;
bool sources34FieldsDisplayed = false; bool sources34FieldsDisplayed = false;
@ -556,6 +557,7 @@ void TelemetrySensorPanel::update()
consFieldsDisplayed = (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION); consFieldsDisplayed = (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION);
sources12FieldsDisplayed = (sensor.formula <= SensorData::TELEM_FORMULA_MULTIPLY); sources12FieldsDisplayed = (sensor.formula <= SensorData::TELEM_FORMULA_MULTIPLY);
sources34FieldsDisplayed = (sensor.formula < SensorData::TELEM_FORMULA_MULTIPLY); sources34FieldsDisplayed = (sensor.formula < SensorData::TELEM_FORMULA_MULTIPLY);
totalizeFieldsDisplayed = (sensor.formula == SensorData::TELEM_FORMULA_TOTALIZE);
updateSourcesComboBox(ui->source1, true); updateSourcesComboBox(ui->source1, true);
updateSourcesComboBox(ui->source2, true); updateSourcesComboBox(ui->source2, true);
updateSourcesComboBox(ui->source3, true); updateSourcesComboBox(ui->source3, true);
@ -595,15 +597,15 @@ void TelemetrySensorPanel::update()
ui->offsetLabel->setVisible(ratioFieldsDisplayed && sensor.unit != SensorData::UNIT_RPMS); ui->offsetLabel->setVisible(ratioFieldsDisplayed && sensor.unit != SensorData::UNIT_RPMS);
ui->multiplierLabel->setVisible(sensor.unit == SensorData::UNIT_RPMS); ui->multiplierLabel->setVisible(sensor.unit == SensorData::UNIT_RPMS);
ui->offset->setVisible(ratioFieldsDisplayed); ui->offset->setVisible(ratioFieldsDisplayed);
ui->precLabel->setVisible(isConfigurable); ui->precLabel->setVisible(isConfigurable && sensor.unit != SensorData::UNIT_FAHRENHEIT);
ui->prec->setVisible(isConfigurable && sensor.unit != SensorData::UNIT_FAHRENHEIT); ui->prec->setVisible(isConfigurable && sensor.unit != SensorData::UNIT_FAHRENHEIT);
ui->unit->setVisible((sensor.type == SensorData::TELEM_TYPE_CALCULATED && (sensor.formula == SensorData::TELEM_FORMULA_DIST)) || isConfigurable); ui->unit->setVisible((sensor.type == SensorData::TELEM_TYPE_CALCULATED && (sensor.formula == SensorData::TELEM_FORMULA_DIST)) || isConfigurable);
ui->gpsSensorLabel->setVisible(gpsFieldsDisplayed); ui->gpsSensorLabel->setVisible(gpsFieldsDisplayed);
ui->gpsSensor->setVisible(gpsFieldsDisplayed); ui->gpsSensor->setVisible(gpsFieldsDisplayed);
ui->altSensorLabel->setVisible(gpsFieldsDisplayed); ui->altSensorLabel->setVisible(gpsFieldsDisplayed);
ui->altSensor->setVisible(gpsFieldsDisplayed); ui->altSensor->setVisible(gpsFieldsDisplayed);
ui->ampsSensorLabel->setVisible(consFieldsDisplayed); ui->ampsSensorLabel->setVisible(consFieldsDisplayed || totalizeFieldsDisplayed);
ui->ampsSensor->setVisible(consFieldsDisplayed); ui->ampsSensor->setVisible(consFieldsDisplayed || totalizeFieldsDisplayed);
ui->cellsSensorLabel->setVisible(cellsFieldsDisplayed); ui->cellsSensorLabel->setVisible(cellsFieldsDisplayed);
ui->cellsSensor->setVisible(cellsFieldsDisplayed); ui->cellsSensor->setVisible(cellsFieldsDisplayed);
ui->cellsIndex->setVisible(cellsFieldsDisplayed); ui->cellsIndex->setVisible(cellsFieldsDisplayed);
@ -643,7 +645,7 @@ void TelemetrySensorPanel::on_name_editingFinished()
{ {
if (!lock) { if (!lock) {
strcpy(sensor.label, ui->name->text().toAscii()); strcpy(sensor.label, ui->name->text().toAscii());
emit nameModified(); emit dataModified();
emit modified(); emit modified();
} }
} }
@ -665,7 +667,15 @@ void TelemetrySensorPanel::on_formula_currentIndexChanged(int index)
sensor.prec = 2; sensor.prec = 2;
sensor.unit = SensorData::UNIT_VOLTS; sensor.unit = SensorData::UNIT_VOLTS;
} }
update(); else if (sensor.formula == SensorData::TELEM_FORMULA_CONSUMPTION) {
sensor.prec = 0;
sensor.unit = SensorData::UNIT_MAH;
}
else if (sensor.formula == SensorData::TELEM_FORMULA_DIST) {
sensor.prec = 0;
sensor.unit = SensorData::UNIT_METERS;
}
emit dataModified();
emit modified(); emit modified();
} }
} }
@ -683,7 +693,7 @@ void TelemetrySensorPanel::on_prec_valueChanged()
{ {
if (!lock) { if (!lock) {
sensor.prec = ui->prec->value(); sensor.prec = ui->prec->value();
update(); emit dataModified();
emit modified(); emit modified();
} }
} }
@ -707,7 +717,8 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin
TelemetrySensorPanel * panel = new TelemetrySensorPanel(this, model.sensorData[i], model, generalSettings, firmware); TelemetrySensorPanel * panel = new TelemetrySensorPanel(this, model.sensorData[i], model, generalSettings, firmware);
ui->sensorsLayout->addWidget(panel); ui->sensorsLayout->addWidget(panel);
sensorPanels[i] = panel; sensorPanels[i] = panel;
connect(panel, SIGNAL(nameModified()), this, SLOT(update())); connect(panel, SIGNAL(dataModified()), this, SLOT(update()));
connect(panel, SIGNAL(modified()), this, SLOT(onModified()));
} }
} }
else { else {
@ -717,14 +728,14 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin
connect(analogs[0], SIGNAL(modified()), this, SLOT(onAnalogModified())); connect(analogs[0], SIGNAL(modified()), this, SLOT(onAnalogModified()));
analogs[1] = new TelemetryAnalog(this, model.frsky.channels[1], model, generalSettings, firmware); analogs[1] = new TelemetryAnalog(this, model.frsky.channels[1], model, generalSettings, firmware);
ui->A2Layout->addWidget(analogs[1]); ui->A2Layout->addWidget(analogs[1]);
connect(analogs[1], SIGNAL(modified()), this, SLOT(onAnalogModified())); connect(analogs[1], SIGNAL(modified()), this, SLOT(onModified()));
} }
if (IS_TARANIS(firmware->getBoard())) { if (IS_TARANIS(firmware->getBoard())) {
ui->voltsSource->setField(model.frsky.voltsSource); ui->voltsSource->setField(model.frsky.voltsSource, this);
ui->altitudeSource->setField(model.frsky.altitudeSource); ui->altitudeSource->setField(model.frsky.altitudeSource, this);
ui->varioSource->setField(model.frsky.varioSource); ui->varioSource->setField(model.frsky.varioSource, this);
ui->varioCenterSilent->setField(model.frsky.varioCenterSilent); ui->varioCenterSilent->setField(model.frsky.varioCenterSilent, this);
} }
else { else {
ui->topbarGB->hide(); ui->topbarGB->hide();
@ -749,7 +760,7 @@ TelemetryPanel::~TelemetryPanel()
void TelemetryPanel::update() void TelemetryPanel::update()
{ {
if (IS_TARANIS(firmware->getBoard())) { if (IS_TARANIS(firmware->getBoard())) {
if (model->moduleData[0].protocol == OFF && model->moduleData[1].protocol == PPM) { if (model->moduleData[0].protocol == PULSES_OFF && model->moduleData[1].protocol == PULSES_PPM) {
ui->telemetryProtocol->setEnabled(true); ui->telemetryProtocol->setEnabled(true);
} }
else { else {
@ -935,7 +946,7 @@ void TelemetryPanel::on_telemetryProtocol_currentIndexChanged(int index)
} }
} }
void TelemetryPanel::onAnalogModified() void TelemetryPanel::onModified()
{ {
emit modified(); emit modified();
} }

View file

@ -89,7 +89,7 @@ class TelemetrySensorPanel: public ModelPanel
void update(); void update();
signals: signals:
void nameModified(); void dataModified();
protected slots: protected slots:
void on_name_editingFinished(); void on_name_editingFinished();
@ -118,7 +118,7 @@ class TelemetryPanel : public ModelPanel
private slots: private slots:
void on_telemetryProtocol_currentIndexChanged(int index); void on_telemetryProtocol_currentIndexChanged(int index);
void onAnalogModified(); void onModified();
void on_frskyProtoCB_currentIndexChanged(int index); void on_frskyProtoCB_currentIndexChanged(int index);
void on_bladesCount_editingFinished(); void on_bladesCount_editingFinished();
void on_rssiAlarm1CB_currentIndexChanged(int index); void on_rssiAlarm1CB_currentIndexChanged(int index);

View file

@ -62,7 +62,16 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<layout class="QGridLayout" name="rssiLayout" columnstretch="0,0,1"> <layout class="QGridLayout" name="rssiLayout" columnstretch="0,0,1">
<property name="margin"> <property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number> <number>4</number>
</property> </property>
<item row="2" column="0"> <item row="2" column="0">
@ -269,7 +278,16 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<layout class="QVBoxLayout" name="A1Layout"> <layout class="QVBoxLayout" name="A1Layout">
<property name="margin"> <property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number> <number>4</number>
</property> </property>
<item> <item>
@ -294,7 +312,16 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<layout class="QVBoxLayout" name="A2Layout"> <layout class="QVBoxLayout" name="A2Layout">
<property name="margin"> <property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number> <number>4</number>
</property> </property>
<item> <item>
@ -322,7 +349,16 @@
</sizepolicy> </sizepolicy>
</property> </property>
<layout class="QGridLayout" name="gridLayout_39"> <layout class="QGridLayout" name="gridLayout_39">
<property name="margin"> <property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number> <number>4</number>
</property> </property>
<property name="spacing"> <property name="spacing">
@ -571,7 +607,16 @@
</sizepolicy> </sizepolicy>
</property> </property>
<layout class="QGridLayout" name="gridLayout_40"> <layout class="QGridLayout" name="gridLayout_40">
<property name="margin"> <property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number> <number>4</number>
</property> </property>
<property name="spacing"> <property name="spacing">
@ -642,7 +687,16 @@
</sizepolicy> </sizepolicy>
</property> </property>
<layout class="QGridLayout" name="gridLayout_6"> <layout class="QGridLayout" name="gridLayout_6">
<property name="margin"> <property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number> <number>4</number>
</property> </property>
<property name="spacing"> <property name="spacing">
@ -893,7 +947,16 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<layout class="QGridLayout" name="sensorsLayout" columnstretch="0"> <layout class="QGridLayout" name="sensorsLayout" columnstretch="0">
<property name="margin"> <property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number> <number>4</number>
</property> </property>
<item row="1" column="0"> <item row="1" column="0">

View file

@ -272,7 +272,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>Amps Sensor :</string> <string>Sensor :</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -366,82 +366,82 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Voltage (V)</string> <string>V</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Current (A)</string> <string>A</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Current (mA)</string> <string>mA</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Speed (kts)</string> <string>kt</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Speed (m/s)</string> <string>m/s</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Speed (ft/s)</string> <string>ft/s</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Speed (km/h)</string> <string>km/h</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Speed (miles/h)</string> <string>mph</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Meters (m)</string> <string>m</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Feet (ft)</string> <string>ft</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Temp (°C)</string> <string>°C</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Temp (°F)</string> <string>°F</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Percentage (%)</string> <string>%</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Energy (mAh)</string> <string>mAh</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Power (W)</string> <string>W</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>RF Power (dBm)</string> <string>dBm</string>
</property> </property>
</item> </item>
<item> <item>
@ -451,22 +451,22 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Acceleration (g)</string> <string>g</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Heading (°)</string> <string>°</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Volume (mL)</string> <string>mL</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Volume (US fl.Oz.)</string> <string>US fl.Oz.</string>
</property> </property>
</item> </item>
</widget> </widget>

View file

@ -17,9 +17,6 @@ ModelPrinter::ModelPrinter(Firmware * firmware, const GeneralSettings & generalS
ModelPrinter::~ModelPrinter() ModelPrinter::~ModelPrinter()
{ {
foreach(QString filename, curvefiles) {
qunlink(filename);
}
} }
void debugHtml(const QString & html) void debugHtml(const QString & html)
@ -108,13 +105,13 @@ QString ModelPrinter::printModuleProtocol(unsigned int protocol)
QString ModelPrinter::printModule(int idx) QString ModelPrinter::printModule(int idx)
{ {
const ModuleData & module = model.moduleData[idx]; const ModuleData & module = model.moduleData[idx];
if (module.protocol == OFF) if (module.protocol == PULSES_OFF)
return printModuleProtocol(module.protocol); return printModuleProtocol(module.protocol);
else if (module.protocol == PPM) else if (module.protocol == PULSES_PPM)
return tr("%1, Channels(%2-%3), PPM delay(%4usec), Pulse polarity(%5)").arg(printModuleProtocol(module.protocol)).arg(module.channelsStart+1).arg(module.channelsStart+module.channelsCount).arg(module.ppmDelay).arg(module.polarityToString()); return tr("%1, Channels(%2-%3), PPM delay(%4usec), Pulse polarity(%5)").arg(printModuleProtocol(module.protocol)).arg(module.channelsStart+1).arg(module.channelsStart+module.channelsCount).arg(module.ppmDelay).arg(module.polarityToString());
else { else {
QString result = tr("%1, Channels(%2-%3)").arg(printModuleProtocol(module.protocol)).arg(module.channelsStart+1).arg(module.channelsStart+module.channelsCount); QString result = tr("%1, Channels(%2-%3)").arg(printModuleProtocol(module.protocol)).arg(module.channelsStart+1).arg(module.channelsStart+module.channelsCount);
if (module.protocol != PXX_XJT_D8) { if (module.protocol != PULSES_PXX_XJT_D8) {
result += " " + tr("Receiver number(%1)").arg(module.modelId); result += " " + tr("Receiver number(%1)").arg(module.modelId);
} }
return result; return result;
@ -187,7 +184,7 @@ QString ModelPrinter::printTimer(const TimerData & timer)
QStringList result; QStringList result;
if (firmware->getCapability(TimersName) && timer.name[0]) if (firmware->getCapability(TimersName) && timer.name[0])
result += tr("Name(%1)").arg(timer.name); result += tr("Name(%1)").arg(timer.name);
result += tr("%1:%2").arg(timer.val/60, 2, 10, QChar('0')).arg(timer.val%60, 2, 10, QChar('0')); result += QString("%1:%2").arg(timer.val/60, 2, 10, QChar('0')).arg(timer.val%60, 2, 10, QChar('0'));
result += timer.mode.toString(); result += timer.mode.toString();
if (timer.persistent) if (timer.persistent)
result += tr("Persistent"); result += tr("Persistent");
@ -327,21 +324,25 @@ QString ModelPrinter::printMixerName(int curDest)
return Qt::escape(str); return Qt::escape(str);
} }
QString ModelPrinter::printMixerLine(int idx, int highlightedSource) QString ModelPrinter::printMixerLine(int idx, bool showMultiplex, int highlightedSource)
{ {
return printMixerLine(model.mixData[idx], highlightedSource); return printMixerLine(model.mixData[idx], highlightedSource, showMultiplex);
} }
QString ModelPrinter::printMixerLine(const MixData & mix, int highlightedSource) QString ModelPrinter::printMixerLine(const MixData & mix, bool showMultiplex, int highlightedSource)
{ {
QString str = "&nbsp;"; QString str = "&nbsp;";
switch(mix.mltpx) { if (showMultiplex) {
case (1): str += "*"; break; switch(mix.mltpx) {
case (2): str += "R"; break; case (1): str += "*="; break;
default: str += "&nbsp;"; break; case (2): str += ":="; break;
}; default: str += "+="; break;
}
}
else {
str += "&nbsp;&nbsp;";
}
// highlight source if needed // highlight source if needed
QString source = Qt::escape(mix.srcRaw.toString(&model)); QString source = Qt::escape(mix.srcRaw.toString(&model));
if ( (mix.srcRaw.type == SOURCE_TYPE_CH) && (mix.srcRaw.index+1 == (int)highlightedSource) ) { if ( (mix.srcRaw.type == SOURCE_TYPE_CH) && (mix.srcRaw.index+1 == (int)highlightedSource) ) {
@ -349,30 +350,33 @@ QString ModelPrinter::printMixerLine(const MixData & mix, int highlightedSource)
} }
str += "&nbsp;" + source; str += "&nbsp;" + source;
str += " " + Qt::escape(tr("Weight")) + QString("(%1)").arg(getGVarString(mix.weight, true)); str += " " + Qt::escape(tr("Weight(%1)").arg(getGVarString(mix.weight, true)));
QString flightModesStr = printFlightModes(mix.flightModes); QString flightModesStr = printFlightModes(mix.flightModes);
if (!flightModesStr.isEmpty()) str += " " + Qt::escape(flightModesStr); if (!flightModesStr.isEmpty())
str += " " + Qt::escape(flightModesStr);
if (mix.swtch.type != SWITCH_TYPE_NONE) { if (mix.swtch.type != SWITCH_TYPE_NONE)
str += " " + Qt::escape(tr("Switch")) + QString("(%1)").arg(mix.swtch.toString()); str += " " + Qt::escape(tr("Switch(%1)").arg(mix.swtch.toString()));
}
if (mix.carryTrim>0) str += " " + Qt::escape(tr("NoTrim")); if (mix.carryTrim > 0)
else if (mix.carryTrim<0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(mix.carryTrim)-1)).toString(&model); str += " " + Qt::escape(tr("NoTrim"));
else if (mix.carryTrim < 0)
if (firmware->getCapability(HasNoExpo) && mix.noExpo) str += " " + Qt::escape(tr("No DR/Expo")); str += " " + RawSource(SOURCE_TYPE_TRIM, (-(mix.carryTrim)-1)).toString(&model);
if (mix.sOffset) str += " " + Qt::escape(tr("Offset")
) + QString("(%1)").arg(getGVarString(mix.sOffset));
if (mix.curve.value) str += " " + Qt::escape(mix.curve.toString());
if (firmware->getCapability(HasNoExpo) && mix.noExpo)
str += " " + Qt::escape(tr("No DR/Expo"));
if (mix.sOffset)
str += " " + Qt::escape(tr("Offset(%1)").arg(getGVarString(mix.sOffset)));
if (mix.curve.value)
str += " " + Qt::escape(mix.curve.toString());
int scale = firmware->getCapability(SlowScale); int scale = firmware->getCapability(SlowScale);
if (scale == 0) if (scale == 0)
scale = 1; scale = 1;
if (mix.delayDown || mix.delayUp) if (mix.delayDown || mix.delayUp)
str += " " + Qt::escape(tr("Delay")) + QString("(u%1:d%2)").arg((double)mix.delayUp/scale).arg((double)mix.delayDown/scale); str += " " + Qt::escape(tr("Delay(u%1:d%2)").arg((double)mix.delayUp/scale).arg((double)mix.delayDown/scale));
if (mix.speedDown || mix.speedUp) if (mix.speedDown || mix.speedUp)
str += " " + Qt::escape(tr("Slow")) + QString("(u%1:d%2)").arg((double)mix.speedUp/scale).arg((double)mix.speedDown/scale); str += " " + Qt::escape(tr("Slow(u%1:d%2)").arg((double)mix.speedUp/scale).arg((double)mix.speedDown/scale));
if (mix.mixWarn) if (mix.mixWarn)
str += " " + Qt::escape(tr("Warn(%1)").arg(mix.mixWarn)); str += " " + Qt::escape(tr("Warn(%1)").arg(mix.mixWarn));
if (firmware->getCapability(HasMixerNames) && mix.name[0]) if (firmware->getCapability(HasMixerNames) && mix.name[0])
@ -613,29 +617,12 @@ void CurveImage::drawCurve(const CurveData & curve, QColor color)
} }
} }
void CurveImage::save(const QString & filename) QString ModelPrinter::createCurveImage(int idx, QTextDocument * document)
{
image.save(filename, "png", 100);
}
QString ModelPrinter::createCurveImage(int idx)
{ {
CurveImage image; CurveImage image;
image.drawCurve(model.curves[idx], colors[idx]); image.drawCurve(model.curves[idx], colors[idx]);
QString filename = generateProcessUniqueTempFileName(QString("curve-%1-%2.png").arg((uint64_t)this).arg(idx)); QString filename = QString("curve-%1-%2.png").arg((uint64_t)this).arg(idx);
image.save(filename); if (document) document->addResource(QTextDocument::ImageResource, QUrl(filename), image.get());
curvefiles << filename; // qDebug() << "ModelPrinter::createCurveImage()" << idx << filename;
return filename; return ":" + filename;
}
QString ModelPrinter::createCurvesImage()
{
CurveImage image;
for (int idx=0; idx<firmware->getCapability(NumCurves); idx++) {
image.drawCurve(model.curves[idx], colors[idx]);
}
QString filename = generateProcessUniqueTempFileName(QString("curves-%1.png").arg((uint64_t)this));
image.save(filename);
curvefiles << filename;
return filename;
} }

View file

@ -4,6 +4,7 @@
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QPainter> #include <QPainter>
#include <QTextDocument>
#include "eeprominterface.h" #include "eeprominterface.h"
QString changeColor(const QString & input, const QString & to, const QString & from = "grey"); QString changeColor(const QString & input, const QString & to, const QString & from = "grey");
@ -17,7 +18,7 @@ class CurveImage
public: public:
CurveImage(); CurveImage();
void drawCurve(const CurveData & curve, QColor color); void drawCurve(const CurveData & curve, QColor color);
void save(const QString & filename); const QImage & get() const { return image; };
protected: protected:
int size; int size;
@ -27,6 +28,8 @@ class CurveImage
class ModelPrinter: public QObject class ModelPrinter: public QObject
{ {
Q_OBJECT
public: public:
ModelPrinter(Firmware * firmware, const GeneralSettings & generalSettings, const ModelData & model); ModelPrinter(Firmware * firmware, const GeneralSettings & generalSettings, const ModelData & model);
virtual ~ModelPrinter(); virtual ~ModelPrinter();
@ -50,21 +53,19 @@ class ModelPrinter: public QObject
QString printInputLine(int idx); QString printInputLine(int idx);
QString printInputLine(const ExpoData & ed); QString printInputLine(const ExpoData & ed);
QString printMixerName(int curDest); QString printMixerName(int curDest);
QString printMixerLine(int idx, int highlightedSource = 0); QString printMixerLine(int idx, bool showMultiplex, int highlightedSource = 0);
QString printMixerLine(const MixData & md, int highlightedSource = 0); QString printMixerLine(const MixData & md, bool showMultiplex, int highlightedSource = 0);
QString printLogicalSwitchLine(int idx); QString printLogicalSwitchLine(int idx);
QString printCustomFunctionLine(int idx); QString printCustomFunctionLine(int idx);
static QString printChannelName(int idx); static QString printChannelName(int idx);
QString printOutputName(int idx); QString printOutputName(int idx);
QString printCurve(int idx); QString printCurve(int idx);
QString createCurvesImage(); QString createCurveImage(int idx, QTextDocument * document);
QString createCurveImage(int idx);
private: private:
Firmware * firmware; Firmware * firmware;
const GeneralSettings & generalSettings; const GeneralSettings & generalSettings;
const ModelData & model; const ModelData & model;
QStringList curvefiles;
}; };

View file

@ -122,8 +122,10 @@ void MultiModelPrinter::setModel(int idx, const ModelData & model)
modelPrinters[idx] = new ModelPrinter(firmware, defaultSettings, model); modelPrinters[idx] = new ModelPrinter(firmware, defaultSettings, model);
} }
QString MultiModelPrinter::print() QString MultiModelPrinter::print(QTextDocument * document)
{ {
if (document) document->clear();
QString str = "<table border='1' cellspacing='0' cellpadding='3' width='100%' style='font-family: monospace;'>"; QString str = "<table border='1' cellspacing='0' cellpadding='3' width='100%' style='font-family: monospace;'>";
str += printSetup(); str += printSetup();
if (firmware->getCapability(FlightModes)) if (firmware->getCapability(FlightModes))
@ -131,7 +133,7 @@ QString MultiModelPrinter::print()
str += printInputs(); str += printInputs();
str += printMixers(); str += printMixers();
str += printLimits(); str += printLimits();
str += printCurves(); str += printCurves(document);
if (firmware->getCapability(Gvars) && !firmware->getCapability(GvarsFlightModes)) if (firmware->getCapability(Gvars) && !firmware->getCapability(GvarsFlightModes))
str += printGvars(); str += printGvars();
str += printLogicalSwitches(); str += printLogicalSwitches();
@ -357,7 +359,7 @@ QString MultiModelPrinter::printMixers()
for (int j=0; j<count; j++) { for (int j=0; j<count; j++) {
if (j > 0) if (j > 0)
columns.append("<br/>"); columns.append("<br/>");
COMPARE((j < model->mixes(i).size()) ? modelPrinter->printMixerLine(*model->mixes(i)[j]) : "&nbsp;"); COMPARE((j < model->mixes(i).size()) ? modelPrinter->printMixerLine(*model->mixes(i)[j], (j>0)) : "&nbsp;");
} }
columns.append("</td></tr>"); columns.append("</td></tr>");
} }
@ -366,7 +368,7 @@ QString MultiModelPrinter::printMixers()
return str; return str;
} }
QString MultiModelPrinter::printCurves() QString MultiModelPrinter::printCurves(QTextDocument * document)
{ {
QString str; QString str;
MultiColumns columns(models.size()); MultiColumns columns(models.size());
@ -385,7 +387,7 @@ QString MultiModelPrinter::printCurves()
columns.append("<tr><td width='20%'><b>" + tr("CV%1").arg(i+1) + "</b></td><td>"); columns.append("<tr><td width='20%'><b>" + tr("CV%1").arg(i+1) + "</b></td><td>");
COMPARE(modelPrinter->printCurve(i)); COMPARE(modelPrinter->printCurve(i));
for (int k=0; k<models.size(); k++) for (int k=0; k<models.size(); k++)
columns.append(k, QString("<br/><img src='%1' border='0' />").arg(modelPrinters[k]->createCurveImage(i))); columns.append(k, QString("<br/><img src='%1' border='0' />").arg(modelPrinters[k]->createCurveImage(i, document)));
columns.append("</td></tr>"); columns.append("</td></tr>");
} }
} }

View file

@ -2,17 +2,20 @@
#define _MULTIMODELPRINTER_H #define _MULTIMODELPRINTER_H
#include <QObject> #include <QObject>
#include <QTextDocument>
#include "eeprominterface.h" #include "eeprominterface.h"
#include "modelprinter.h" #include "modelprinter.h"
class MultiModelPrinter: public QObject class MultiModelPrinter: public QObject
{ {
Q_OBJECT
public: public:
MultiModelPrinter(Firmware * firmware); MultiModelPrinter(Firmware * firmware);
virtual ~MultiModelPrinter(); virtual ~MultiModelPrinter();
void setModel(int idx, const ModelData & model); void setModel(int idx, const ModelData & model);
QString print(); QString print(QTextDocument * document);
protected: protected:
class MultiColumns { class MultiColumns {
@ -44,7 +47,7 @@ class MultiModelPrinter: public QObject
QString printLimits(); QString printLimits();
QString printInputs(); QString printInputs();
QString printMixers(); QString printMixers();
QString printCurves(); QString printCurves(QTextDocument * document);
QString printGvars(); QString printGvars();
QString printLogicalSwitches(); QString printLogicalSwitches();
QString printCustomFunctions(); QString printCustomFunctions();

View file

@ -21,7 +21,7 @@ PrintDialog::PrintDialog(QWidget *parent, Firmware * firmware, GeneralSettings &
setWindowIcon(CompanionIcon("print.png")); setWindowIcon(CompanionIcon("print.png"));
setWindowTitle(model.name); setWindowTitle(model.name);
multimodelprinter.setModel(0, model); multimodelprinter.setModel(0, model);
ui->textEdit->setHtml(multimodelprinter.print()); ui->textEdit->setHtml(multimodelprinter.print(ui->textEdit->document()));
if (!printfilename.isEmpty()) { if (!printfilename.isEmpty()) {
printToFile(); printToFile();
QTimer::singleShot(0, this, SLOT(autoClose())); QTimer::singleShot(0, this, SLOT(autoClose()));

0
companion/src/process_copy.cpp Executable file → Normal file
View file

0
companion/src/process_copy.h Executable file → Normal file
View file

0
companion/src/process_flash.cpp Executable file → Normal file
View file

0
companion/src/process_flash.h Executable file → Normal file
View file

0
companion/src/process_sync.cpp Executable file → Normal file
View file

0
companion/src/process_sync.h Executable file → Normal file
View file

0
companion/src/progressdialog.cpp Executable file → Normal file
View file

0
companion/src/progressdialog.h Executable file → Normal file
View file

0
companion/src/progressdialog.ui Executable file → Normal file
View file

0
companion/src/progresswidget.cpp Executable file → Normal file
View file

0
companion/src/progresswidget.h Executable file → Normal file
View file

0
companion/src/progresswidget.ui Executable file → Normal file
View file

0
companion/src/radiointerface.cpp Executable file → Normal file
View file

0
companion/src/radiointerface.h Executable file → Normal file
View file

0
companion/src/releasenotesdialog.cpp Executable file → Normal file
View file

0
companion/src/releasenotesdialog.h Executable file → Normal file
View file

0
companion/src/releasenotesfirmwaredialog.cpp Executable file → Normal file
View file

0
companion/src/releasenotesfirmwaredialog.h Executable file → Normal file
View file

0
companion/src/shared/autolineedit.h Executable file → Normal file
View file

View file

@ -68,128 +68,128 @@ void TelemetrySimulator::generateTelemetryFrame()
switch(item++) { switch(item++) {
case 0: case 0:
if (ui->Rssi->text().length()) if (ui->Rssi->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, RSSI_ID, LIMIT<uint32_t>(0, ui->Rssi->text().toInt(&ok, 0), 0xFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, RSSI_ID, LIMIT<uint32_t>(0, ui->Rssi->text().toInt(&ok, 0), 0xFF));
break; break;
case 1: case 1:
#if defined(XJT_VERSION_ID) #if defined(XJT_VERSION_ID)
generateSportPacket(buffer, 1, DATA_FRAME, XJT_VERSION_ID, 11); generateSportPacket(buffer, INSTANCE, DATA_FRAME, XJT_VERSION_ID, 11);
#endif #endif
break; break;
case 2: case 2:
if (ui->Swr->text().length()) if (ui->Swr->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, SWR_ID, LIMIT<uint32_t>(0, ui->Swr->text().toInt(&ok, 0), 0xFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, SWR_ID, LIMIT<uint32_t>(0, ui->Swr->text().toInt(&ok, 0), 0xFFFF));
break; break;
case 3: case 3:
if (ui->A1->text().length()) if (ui->A1->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, ADC1_ID, LIMIT<uint32_t>(0, ui->A1->text().toInt(&ok, 0), 0xFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, ADC1_ID, LIMIT<uint32_t>(0, ui->A1->text().toInt(&ok, 0), 0xFF));
break; break;
case 4: case 4:
if (ui->A2->text().length()) if (ui->A2->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, ADC2_ID, LIMIT<uint32_t>(0, ui->A2->text().toInt(&ok, 0), 0xFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, ADC2_ID, LIMIT<uint32_t>(0, ui->A2->text().toInt(&ok, 0), 0xFF));
break; break;
case 5: case 5:
if (ui->A3->text().length()) if (ui->A3->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, A3_FIRST_ID, LIMIT<uint32_t>(0, ui->A3->text().toInt(&ok, 0), 0xFFFFFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, A3_FIRST_ID, LIMIT<uint32_t>(0, ui->A3->text().toInt(&ok, 0), 0xFFFFFFFF));
break; break;
case 6: case 6:
if (ui->A4->text().length()) if (ui->A4->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, A4_FIRST_ID, LIMIT<uint32_t>(0, ui->A4->text().toInt(&ok, 0), 0xFFFFFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, A4_FIRST_ID, LIMIT<uint32_t>(0, ui->A4->text().toInt(&ok, 0), 0xFFFFFFFF));
break; break;
case 7: case 7:
if (ui->T1->text().length()) if (ui->T1->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, T1_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->T1->text().toInt(&ok, 0), 0x7FFFFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, T1_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->T1->text().toInt(&ok, 0), 0x7FFFFFFF));
break; break;
case 8: case 8:
if (ui->T2->text().length()) if (ui->T2->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, T2_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->T2->text().toInt(&ok, 0), 0x7FFFFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, T2_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->T2->text().toInt(&ok, 0), 0x7FFFFFFF));
break; break;
case 9: case 9:
if (ui->rpm->text().length()) if (ui->rpm->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, RPM_FIRST_ID, LIMIT<uint32_t>(0, ui->rpm->text().toInt(&ok, 0), 0xFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, RPM_FIRST_ID, LIMIT<uint32_t>(0, ui->rpm->text().toInt(&ok, 0), 0xFFFF));
break; break;
case 10: case 10:
if (ui->fuel->text().length()) if (ui->fuel->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, FUEL_FIRST_ID, LIMIT<uint32_t>(0, ui->fuel->text().toInt(&ok, 0), 0xFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, FUEL_FIRST_ID, LIMIT<uint32_t>(0, ui->fuel->text().toInt(&ok, 0), 0xFFFF));
break; break;
case 11: case 11:
if (ui->aspeed->text().length()) if (ui->aspeed->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, AIR_SPEED_FIRST_ID, LIMIT<uint32_t>(0, ui->aspeed->text().toInt(&ok, 0), 0xFFFFFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, AIR_SPEED_FIRST_ID, LIMIT<uint32_t>(0, ui->aspeed->text().toInt(&ok, 0), 0xFFFFFFFF));
break; break;
case 12: case 12:
if (ui->vspeed->text().length()) if (ui->vspeed->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, VARIO_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->vspeed->text().toInt(&ok, 0), 0x7FFFFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, VARIO_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->vspeed->text().toInt(&ok, 0), 0x7FFFFFFF));
break; break;
case 13: case 13:
if (ui->valt->text().length()) if (ui->valt->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, ALT_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->valt->text().toInt(&ok, 0), 0x7FFFFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, ALT_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->valt->text().toInt(&ok, 0), 0x7FFFFFFF));
break; break;
case 14: case 14:
if (ui->accx->text().length()) if (ui->accx->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, ACCX_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->accx->text().toInt(&ok, 0), 0x7FFFFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, ACCX_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->accx->text().toInt(&ok, 0), 0x7FFFFFFF));
break; break;
case 15: case 15:
if (ui->accy->text().length()) if (ui->accy->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, ACCY_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->accy->text().toInt(&ok, 0), 0x7FFFFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, ACCY_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->accy->text().toInt(&ok, 0), 0x7FFFFFFF));
break; break;
case 16: case 16:
if (ui->accz->text().length()) if (ui->accz->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, ACCZ_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->accz->text().toInt(&ok, 0), 0x7FFFFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, ACCZ_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->accz->text().toInt(&ok, 0), 0x7FFFFFFF));
break; break;
case 17: case 17:
if (ui->vfas->text().length()) if (ui->vfas->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, VFAS_FIRST_ID, LIMIT<uint32_t>(0, ui->vfas->text().toInt(&ok, 0), 0xFFFFFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, VFAS_FIRST_ID, LIMIT<uint32_t>(0, ui->vfas->text().toInt(&ok, 0), 0xFFFFFFFF));
break; break;
case 18: case 18:
if (ui->curr->text().length()) if (ui->curr->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, CURR_FIRST_ID, LIMIT<uint32_t>(0, ui->curr->text().toInt(&ok, 0), 0xFFFFFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, CURR_FIRST_ID, LIMIT<uint32_t>(0, ui->curr->text().toInt(&ok, 0), 0xFFFFFFFF));
break; break;
case 19: case 19:
if (ui->cells->text().length()) if (ui->cells->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, CELLS_FIRST_ID, LIMIT<uint32_t>(0, ui->cells->text().toInt(&ok, 0), 0xFFFFFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, CELLS_FIRST_ID, LIMIT<uint32_t>(0, ui->cells->text().toInt(&ok, 0), 0xFFFFFFFF));
break; break;
case 20: case 20:
if (ui->gps_alt->text().length()) if (ui->gps_alt->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, GPS_ALT_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->gps_alt->text().toInt(&ok, 0), 0x7FFFFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, GPS_ALT_FIRST_ID, LIMIT<int32_t>(-0x7FFFFFFF, ui->gps_alt->text().toInt(&ok, 0), 0x7FFFFFFF));
break; break;
case 21: case 21:
if (ui->gps_speed->text().length()) if (ui->gps_speed->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, GPS_SPEED_FIRST_ID, LIMIT<uint32_t>(0, ui->gps_speed->text().toInt(&ok, 0), 0xFFFFFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, GPS_SPEED_FIRST_ID, LIMIT<uint32_t>(0, ui->gps_speed->text().toInt(&ok, 0), 0xFFFFFFFF));
break; break;
case 22: case 22:
if (ui->gps_course->text().length()) if (ui->gps_course->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, GPS_COURS_FIRST_ID, LIMIT<uint32_t>(0, ui->gps_course->text().toInt(&ok, 0), 0xFFFFFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, GPS_COURS_FIRST_ID, LIMIT<uint32_t>(0, ui->gps_course->text().toInt(&ok, 0), 0xFFFFFFFF));
break; break;
case 23: case 23:
if (ui->gps_time->text().length()) if (ui->gps_time->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, GPS_TIME_DATE_FIRST_ID, LIMIT<uint32_t>(0, ui->gps_time->text().toInt(&ok, 0), 0xFFFFFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, GPS_TIME_DATE_FIRST_ID, LIMIT<uint32_t>(0, ui->gps_time->text().toInt(&ok, 0), 0xFFFFFFFF));
break; break;
case 24: case 24:
if (ui->gps_latlon->text().length()) if (ui->gps_latlon->text().length())
generateSportPacket(buffer, 1, DATA_FRAME, GPS_LONG_LATI_FIRST_ID, LIMIT<uint32_t>(0, ui->gps_latlon->text().toInt(&ok, 0), 0xFFFFFFFF)); generateSportPacket(buffer, INSTANCE, DATA_FRAME, GPS_LONG_LATI_FIRST_ID, LIMIT<uint32_t>(0, ui->gps_latlon->text().toInt(&ok, 0), 0xFFFFFFFF));
break; break;
default: default:

View file

@ -7,6 +7,8 @@
#include <QTimer> #include <QTimer>
#include "simulatorinterface.h" #include "simulatorinterface.h"
#define INSTANCE (ui->Instance->text().toInt(&ok,0) -1)
namespace Ui { namespace Ui {
class TelemetrySimulator; class TelemetrySimulator;
} }

View file

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>278</width> <width>331</width>
<height>384</height> <height>384</height>
</rect> </rect>
</property> </property>
@ -326,6 +326,20 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2">
<widget class="QLabel" name="label_26">
<property name="text">
<string>Instance</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="Instance">
<property name="text">
<string>2</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more