Compare commits

..

5 Commits

Author SHA1 Message Date
Arne Schwabe eefbf6cc21 Copy strings for multimode support from en.h.txt to other languages 2016-03-27 22:46:53 +02:00
Arne Schwabe 0c0d0ded91 Add FY326 protocol 2016-03-27 22:45:24 +02:00
Arne Schwabe cbaae312c9 Implement DSM2/DSMX frame format options 2016-03-27 22:45:21 +02:00
Arne Schwabe b7a4f6632f Implement autobind and low power setting and specifying a custom protocol for the multi module
Specifying a custom prtocol is useful if OpenTX firmware is older than the multi module firmware
and the protocol in question is not yet in the protocol list of the OpenTX firmware.
2016-03-27 22:31:56 +02:00
Arne Schwabe 49c25df507 Multi module support for Taranis
Reuse some of the DSM2 routines to avoid code duplication.

This first version only implements the protocol on the Taranis. (and not

Telemetry code is currently untested and will not work (Polarity mismatch). The main protocols to use telemetry are FrSky protocols and not a high priority on the Taranis.

Patch v3: Fix myeeprom.h, include option value in menu.
Patch v4: Fix identing, name substructs of modeldata
2016-03-27 22:20:41 +02:00
120 changed files with 15236 additions and 20951 deletions
+1 -63
View File
@@ -9,7 +9,6 @@
<a href="http://openpilot.com">David Ankers (OpenPilot)</a>
<a href="http://3drobotics.com">3D Robotics</a>
<a href="http://rcstudio.cz">RC Studio (monthly)</a>
<a href="http://www.craftandtheoryllc.com">Craft & Theory (monthly)</a>
Mario Sette
Felice Baratto
@@ -333,6 +332,7 @@ Jose Sobral
Heung Jin Choi
Tomasz Janiak
Fabien Gagné
Joe Street
Micha Ronen
Albert Blondin
Klaus Schuebel
@@ -885,65 +885,3 @@ Gilles Dando
Denis Roussille
Olivier Anken
Michel Motte
David McDonald
Tauno Rautakorpi
Carsten Schlassa
Angel de la Dehesa Calles
Michel Garbarin
Algirdas Tamosiunas
Petr Kysela
Pascal Roux
Robert Whitfield
InTheTubeDeep
Jaromir Malek
Joe Street
Regin Poulsen
Hervé Laveyssiere
Walter Fowler
Richard Wagner
Kevin Hyman
Herald Reichel
Frederic Rouyre
David Libby
Hans Timmermans
Adrian De Zee
John Hanagan
Didier van Steensel
Julius Vicze
Cristiano Merighi
James Holley
Chris Merry
Jiri Fojtasek
Thierry Laligand
Hassouna Cherif
Fred Thijssen
Andrew Gardiner
Christian Niß
Douglas Penney
Starck Associates
Johannes Wollenweber
Fred Page
Jean Trouche
Patrick Blanc
Jean-Louis Tonnellier
Masoud
Mustafa Güven
William Waters
Joël Allamy
William Mckinstry
Jean-Jacques Pointel
Frédéric Rouyre
Jonathan Pruett
Jörg Zieren
Christopher Rhodes
Marco Strack
Stefano Boggia
Dwayne Myers
Stavros Papathanasiou
Roland Nittby
Courtney Puskas
NorthSide
Martin Polák
Ulf Reinhardt
Wolfgang Renisch
Trevor Hinze
+1 -8
View File
@@ -6,11 +6,4 @@
The ongoing development on 2.1.x is done in this branch.
Refer to the [OpenTX wiki](https://github.com/opentx/opentx/wiki) for information about setting up the tool chains for building OpenTX and OpenTX Companion as well as other development related issues.
Useful links:
* OpenTX Blog http://blog.open-tx.org/
* OpenTX Main Site http://www.open-tx.org/
* OpenTx University http://open-txu.org/
* OpenTX User Manual https://www.gitbook.com/book/opentx/opentx-taranis-manual/details
* OpenTX Lua Reference Guide https://www.gitbook.com/book/opentx/opentx-lua-reference-guide/details
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.
-21
View File
@@ -1,24 +1,3 @@
<h2>Version 2.1.8 / 2016-04-14</h2>
<ul>
<li>Telemetry Simulator sensor instance number fixed (<a href=https://github.com/opentx/opentx/issues/3207>#3207</a>)</li>
<li>Fixed: Throttle Source combo-box was populated multiple times (<a href=https://github.com/opentx/opentx/issues/3222>#3222</a>)</li>
<li>RTC option tool-tip corrected (<a href=https://github.com/opentx/opentx/issues/3225>#3225</a>)</li>
<li>Fixed: Companion was looking for custom scripts at the wrong place (<a href=https://github.com/opentx/opentx/issues/3237>#3237</a>)</li>
<li>Offset displayed in inputs screen (<a href=https://github.com/opentx/opentx/issues/3248>#3248</a>)</li>
<li>Import/export handling was broken for Average formula telemetry sensors (<a href=https://github.com/opentx/opentx/issues/3262>#3262</a>)</li>
<li>Fixed: Hardware Setup control types and names were not stored in profile (<a href=https://github.com/opentx/opentx/issues/3260>#3260</a>)</li>
<li>Fixed voice language list (<a href=https://github.com/opentx/opentx/issues/3338>#3338</a>)</li>
<li>Fixed data overflow in Special Functions Override Channel (<a href=https://github.com/opentx/opentx/issues/3347>#3347</a>)</li>
<li>Fixed: Sync dialog new line problem (only present for some UI languages) (<a href=https://github.com/opentx/opentx/issues/3350>#3350</a>)</li>
<li>Removed a few legacy timer limitations, fix non-working limit (<a href=https://github.com/opentx/opentx/issues/3301>#3301</a>)</li>
<li>Default AVR fuse settings changed to disable JTAG interface (<a href=https://github.com/opentx/opentx/issues/3379>#3379</a>)</li>
<li>Channel range fix (Start, Channels) in Model Settings, Setup page, int/ext module settings</li>
<li>Use friendly GVAR names in dialogs (if available) (<a href=https://github.com/opentx/opentx/issues/3353>#3353</a>)</li>
<li>Various texts and translations corrections</li>
</ul>
<h2>Version 2.1.7 / 2016-01-04</h2>
<ul>
+1 -1
View File
@@ -2,7 +2,7 @@ PROJECT( companion )
SET(C9X_VERSION_MAJOR "2")
SET(C9X_VERSION_MINOR "1")
SET(C9X_VERSION_REVISION "8")
SET(C9X_VERSION_REVISION "7")
SET(C9X_VERSION_SUFFIX $ENV{OPENTX_VERSION_SUFFIX})
SET(C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR}.${C9X_VERSION_REVISION}${C9X_VERSION_SUFFIX})
-10
View File
@@ -312,8 +312,6 @@ QString Profile::speaker() const { return _speaker; }
QString Profile::stickPotCalib() const { return _stickPotCalib; }
QString Profile::timeStamp() const { return _timeStamp; }
QString Profile::trainerCalib() const { return _trainerCalib; }
QString Profile::controlTypes() const { return _controlTypes; }
QString Profile::controlNames() const { return _controlNames; }
int Profile::txCurrentCalibration() const { return _txCurrentCalibration; }
int Profile::gsStickMode() const { return _gsStickMode; }
int Profile::ppmMultiplier() const { return _ppmMultiplier; }
@@ -344,8 +342,6 @@ 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::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::controlTypes (const QString x) { store(x, _controlTypes, "ControlTypes" ,"Profiles", QString("profile%1").arg(index));}
void Profile::controlNames (const QString x) { store(x, _controlNames, "ControlNames" ,"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::ppmMultiplier (const int x) { store(x, _ppmMultiplier, "PPM_Multiplier" ,"Profiles", QString("profile%1").arg(index));}
@@ -382,8 +378,6 @@ Profile& Profile::operator=(const Profile& rhs)
speaker ( rhs.speaker() );
stickPotCalib( rhs.stickPotCalib() );
trainerCalib ( rhs.trainerCalib() );
controlTypes ( rhs.controlTypes() );
controlNames ( rhs.controlNames() );
txCurrentCalibration ( rhs.txCurrentCalibration() );
gsStickMode ( rhs.gsStickMode() );
ppmMultiplier( rhs.ppmMultiplier() );
@@ -429,8 +423,6 @@ void Profile::initFwVariables()
_stickPotCalib = "";
_timeStamp = "";
_trainerCalib = "";
_controlTypes = "";
_controlNames = "";
_txCurrentCalibration = 0;
_gsStickMode = 0;
@@ -491,8 +483,6 @@ void Profile::flush()
getset( _stickPotCalib, "StickPotCalib" ,"" ,"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( _controlTypes, "ControlTypes" ,"" ,"Profiles", QString("profile%1").arg(index));
getset( _controlNames, "ControlNames" ,"" ,"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( _ppmMultiplier, "PPM_Multiplier" ,0 ,"Profiles", QString("profile%1").arg(index));
-6
View File
@@ -125,8 +125,6 @@ class Profile: protected CompStoreObj
QString _stickPotCalib;
QString _timeStamp;
QString _trainerCalib;
QString _controlTypes;
QString _controlNames;
int _txCurrentCalibration;
int _gsStickMode;
int _ppmMultiplier;
@@ -158,8 +156,6 @@ class Profile: protected CompStoreObj
QString stickPotCalib() const;
QString timeStamp() const;
QString trainerCalib() const;
QString controlTypes() const;
QString controlNames() const;
int txCurrentCalibration() const;
int gsStickMode() const;
int ppmMultiplier() const;
@@ -190,8 +186,6 @@ class Profile: protected CompStoreObj
void stickPotCalib (const QString);
void timeStamp (const QString);
void trainerCalib (const QString);
void controlTypes (const QString);
void controlNames (const QString);
void txCurrentCalibration (const int);
void gsStickMode (const int);
void ppmMultiplier (const int);
+1 -3
View File
@@ -1624,9 +1624,7 @@ class Firmware {
}
virtual int getCapability(const Capability) = 0;
virtual QTime getMaxTimerStart() = 0;
virtual bool isTelemetrySourceAvailable(int source) = 0;
virtual int isAvailable(PulsesProtocol proto, int port=0) = 0;
@@ -54,7 +54,7 @@ class Er9xSimulator : public SimulatorInterface {
virtual void sendTelemetry(uint8_t * data, unsigned int len) {};
virtual uint8_t getSensorInstance(uint16_t id, uint8_t defaultValue = 0) { return 0; };
virtual uint8_t getSensorInstance(uint16_t id) { return 0; };
virtual uint16_t getSensorRatio(uint16_t id) { return 0; };
@@ -54,7 +54,7 @@ class Ersky9xSimulator : public SimulatorInterface {
virtual void sendTelemetry(uint8_t * data, unsigned int len) {};
virtual uint8_t getSensorInstance(uint16_t id, uint8_t defaultValue = 0) { return 0; };
virtual uint8_t getSensorInstance(uint16_t id) { return 0; };
virtual uint16_t getSensorRatio(uint16_t id) { return 0; };
@@ -2170,7 +2170,7 @@ class ArmCustomFunctionField: public TransformedField {
if (fn.func >= FuncOverrideCH1 && fn.func <= FuncOverrideCH32) {
fn.func = AssignFunc(fn.func + index);
fn.param = (int16_t)(uint16_t)value;
fn.param = (int8_t)value;
}
else if (fn.func >= FuncSetTimer1 && fn.func <= FuncSetTimer3) {
fn.func = AssignFunc(fn.func + index);
@@ -2823,7 +2823,7 @@ class SensorField: public TransformedField {
_instance = sensor.formula;
if (sensor.formula == SensorData::TELEM_FORMULA_CELL)
_param = (sensor.source) + (sensor.index << 8);
else if (sensor.formula == SensorData::TELEM_FORMULA_ADD || sensor.formula == SensorData::TELEM_FORMULA_AVERAGE || sensor.formula == SensorData::TELEM_FORMULA_MULTIPLY || sensor.formula == SensorData::TELEM_FORMULA_MIN || sensor.formula == SensorData::TELEM_FORMULA_MAX)
else if (sensor.formula == SensorData::TELEM_FORMULA_ADD || sensor.formula == SensorData::TELEM_FORMULA_MULTIPLY || sensor.formula == SensorData::TELEM_FORMULA_MIN || sensor.formula == SensorData::TELEM_FORMULA_MAX)
_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)
_param = (sensor.gps) + (sensor.alt << 8);
@@ -2845,7 +2845,7 @@ class SensorField: public TransformedField {
sensor.formula = _instance;
if (sensor.formula == SensorData::TELEM_FORMULA_CELL)
(sensor.source = _sources[0], sensor.index = _sources[1]);
else if (sensor.formula == SensorData::TELEM_FORMULA_ADD || sensor.formula == SensorData::TELEM_FORMULA_AVERAGE || sensor.formula == SensorData::TELEM_FORMULA_MULTIPLY || sensor.formula == SensorData::TELEM_FORMULA_MIN || sensor.formula == SensorData::TELEM_FORMULA_MAX)
else if (sensor.formula == SensorData::TELEM_FORMULA_ADD || sensor.formula == SensorData::TELEM_FORMULA_MULTIPLY || sensor.formula == SensorData::TELEM_FORMULA_MIN || sensor.formula == SensorData::TELEM_FORMULA_MAX)
for (int i=0; i<4; ++i)
sensor.sources[i] = _sources[i];
else if (sensor.formula == SensorData::TELEM_FORMULA_DIST)
+120 -130
View File
@@ -805,16 +805,6 @@ int OpenTxFirmware::getCapability(const Capability capability)
}
}
QTime OpenTxFirmware::getMaxTimerStart()
{
if (IS_TARANIS(board))
return QTime(23, 59, 59);
else if (IS_ARM(board))
return QTime(8, 59, 59);
else
return QTime(0, 59, 59);
}
bool OpenTxFirmware::isTelemetrySourceAvailable(int source)
{
if (IS_TARANIS(board) && (source == TELEMETRY_SOURCE_RSSI_TX))
@@ -1178,109 +1168,8 @@ void registerOpenTxFirmwares()
Option nav_options[] = { { "rotenc", QObject::tr("Rotary Encoder use in menus navigation") }, { "potscroll", QObject::tr("Pots use in menus navigation") }, { NULL } };
Option dsm2_options[] = { { "DSM2", QObject::tr("Support for DSM2 modules"), 0 }, { "DSM2PPM", QObject::tr("Support for DSM2 modules using ppm instead of true serial"), 0 }, { NULL } };
/* Taranis Plus board */
firmware = new OpenTxFirmware("opentx-taranisplus", QObject::tr("FrSky Taranis Plus"), BOARD_TARANIS_PLUS);
addOpenTxTaranisOptions(firmware);
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* Taranis board */
firmware = new OpenTxFirmware("opentx-taranis", QObject::tr("FrSky Taranis"), BOARD_TARANIS);
firmware->addOption("haptic", QObject::tr("Haptic module installed"));
addOpenTxTaranisOptions(firmware);
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* Taranis X9E board */
firmware = new OpenTxFirmware("opentx-taranisx9e", QObject::tr("FrSky Taranis X9E"), BOARD_TARANIS_X9E);
firmware->addOption("shutdownconfirm", QObject::tr("Confirmation before radio shutdown"));
addOpenTxTaranisOptions(firmware);
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* 9XR-Pro */
firmware = new OpenTxFirmware("opentx-9xrpro", QObject::tr("Turnigy 9XR-PRO"), BOARD_9XRPRO);
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("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"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* 9XR board with M128 chip */
firmware = new OpenTxFirmware("opentx-9xr128", QObject::tr("Turnigy 9XR with m128 chip"), BOARD_M128);
firmware->addOptions(extr_options);
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
firmware->addOption("nosplash", QObject::tr("No splash screen"));
firmware->addOption("nofp", QObject::tr("No flight modes"));
firmware->addOption("nocurves", QObject::tr("Disable curves menus"));
firmware->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
firmware->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
firmware->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED firmware->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
firmware->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
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("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("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("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
firmware->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
firmware->addOption("imperial", QObject::tr("Imperial units"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* 9XR board */
firmware = new OpenTxFirmware("opentx-9xr", QObject::tr("Turnigy 9XR"), BOARD_STOCK);
firmware->addOptions(extr_options);
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
firmware->addOption("nosplash", QObject::tr("No splash screen"));
firmware->addOption("nofp", QObject::tr("No flight modes"));
firmware->addOption("nocurves", QObject::tr("Disable curves menus"));
firmware->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
firmware->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
firmware->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED firmware->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
firmware->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
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("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("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("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
firmware->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
firmware->addOption("imperial", QObject::tr("Imperial units"));
firmware->addOption("nowshh", QObject::tr("No Winged Shadow How High support"));
firmware->addOption("novario", QObject::tr("No vario support"));
firmware->addOption("nogps", QObject::tr("No GPS support"));
firmware->addOption("nogauges", QObject::tr("No gauges in the custom telemetry screen"));
firmware->addOption("stickrev", QObject::tr("Add support for reversing stick inputs (e.g. needed for FrSky gimbals)"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* 9x board */
firmware = new OpenTxFirmware("opentx-9x", QObject::tr("9X with stock board"), BOARD_STOCK);
firmware = new OpenTxFirmware("opentx-9x", QObject::tr("9X board"), BOARD_STOCK);
firmware->addOptions(ext_options);
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
@@ -1316,7 +1205,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(firmware);
/* 9x board with M128 chip */
firmware = new OpenTxFirmware("opentx-9x128", QObject::tr("9X with stock board and m128 chip"), BOARD_M128);
firmware = new OpenTxFirmware("opentx-9x128", QObject::tr("M128 / 9X board"), BOARD_M128);
firmware->addOptions(ext_options);
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
@@ -1345,52 +1234,69 @@ void registerOpenTxFirmwares()
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* ar9x board */
firmware = new OpenTxFirmware("opentx-ar9x", QObject::tr("9X with AR9X board"), BOARD_AR9X);
firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
/* 9XR board */
firmware = new OpenTxFirmware("opentx-9xr", QObject::tr("9XR"), BOARD_STOCK);
firmware->addOptions(extr_options);
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
firmware->addOption("nosplash", QObject::tr("No splash screen"));
firmware->addOption("nofp", QObject::tr("No flight modes"));
firmware->addOption("nocurves", QObject::tr("Disable curves menus"));
firmware->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
firmware->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
firmware->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED firmware->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
firmware->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
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"));
firmware->addOption("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
firmware->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
firmware->addOption("imperial", QObject::tr("Imperial units"));
firmware->addOption("nowshh", QObject::tr("No Winged Shadow How High support"));
firmware->addOption("novario", QObject::tr("No vario support"));
firmware->addOption("nogps", QObject::tr("No GPS support"));
firmware->addOption("nogauges", QObject::tr("No gauges in the custom telemetry screen"));
firmware->addOption("stickrev", QObject::tr("Add support for reversing stick inputs (e.g. needed for FrSky gimbals)"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* Sky9x board */
firmware = new OpenTxFirmware("opentx-sky9x", QObject::tr("9X with Sky9x board"), BOARD_SKY9X);
firmware->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
/* 9XR board with M128 chip */
firmware = new OpenTxFirmware("opentx-9xr128", QObject::tr("9XR with M128 chip"), BOARD_M128);
firmware->addOptions(extr_options);
firmware->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
firmware->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
firmware->addOption("nosplash", QObject::tr("No splash screen"));
firmware->addOption("nofp", QObject::tr("No flight modes"));
firmware->addOption("nocurves", QObject::tr("Disable curves menus"));
firmware->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
firmware->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
firmware->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
// NOT TESTED firmware->addOption("PXX", QObject::tr("Support of FrSky PXX protocol"));
firmware->addOption("DSM2", QObject::tr("Support for DSM2 modules"));
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("thrtrace", QObject::tr("Enable the throttle trace in Statistics"));
firmware->addOption("pgbar", QObject::tr("EEprom write Progress bar"));
firmware->addOption("imperial", QObject::tr("Imperial units"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* Gruvin9x board */
firmware = new OpenTxFirmware("opentx-gruvin9x", QObject::tr("9X with Gruvin9x board"), BOARD_GRUVIN9X);
firmware = new OpenTxFirmware("opentx-gruvin9x", QObject::tr("Gruvin9x board / 9X"), BOARD_GRUVIN9X);
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"));
@@ -1415,7 +1321,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(firmware);
/* MEGA2560 board */
firmware = new OpenTxFirmware("opentx-mega2560", QObject::tr("DIY MEGA2560 radio"), BOARD_MEGA2560);
firmware = new OpenTxFirmware("opentx-mega2560", QObject::tr("MEGA2560 board"), BOARD_MEGA2560);
addOpenTxLcdOptions(firmware);
firmware->addOption("PWR", QObject::tr("Power management by soft-off circuitry"));
firmware->addOptions(ext_options);
@@ -1426,7 +1332,7 @@ void registerOpenTxFirmwares()
firmware->addOption("nofp", QObject::tr("No flight modes"));
firmware->addOption("nocurves", QObject::tr("Disable curves menus"));
firmware->addOption("sdcard", QObject::tr("Support for SD memory card"));
firmware->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
//firmware->addOption("audio", QObject::tr("Support for radio modified with regular speaker"));
//firmware->addOption("voice", QObject::tr("Used if you have modified your radio with voice mode"));
firmware->addOption("haptic", QObject::tr("Used if you have modified your radio with haptic mode"));
firmware->addOption("ppmca", QObject::tr("PPM center adjustment in limits"));
@@ -1444,6 +1350,90 @@ void registerOpenTxFirmwares()
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* Sky9x board */
firmware = new OpenTxFirmware("opentx-sky9x", QObject::tr("Sky9x board / 9X"), BOARD_SKY9X);
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"));
addOpenTxCommonOptions(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 */
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("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("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"));
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* Taranis board */
firmware = new OpenTxFirmware("opentx-taranis", QObject::tr("FrSky Taranis"), BOARD_TARANIS);
firmware->addOption("haptic", QObject::tr("Haptic module installed"));
addOpenTxTaranisOptions(firmware);
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* Taranis Plus board */
firmware = new OpenTxFirmware("opentx-taranisplus", QObject::tr("FrSky Taranis Plus"), BOARD_TARANIS_PLUS);
addOpenTxTaranisOptions(firmware);
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
/* Taranis X9E board */
firmware = new OpenTxFirmware("opentx-taranisx9e", QObject::tr("FrSky Taranis X9E"), BOARD_TARANIS_X9E);
firmware->addOption("shutdownconfirm", QObject::tr("Confirmation before radio shutdown"));
addOpenTxTaranisOptions(firmware);
addOpenTxCommonOptions(firmware);
firmwares.push_back(firmware);
default_firmware_variant = GetFirmware("opentx-taranisplus-en");
current_firmware_variant = default_firmware_variant;
}
@@ -118,8 +118,6 @@ class OpenTxFirmware: public Firmware {
virtual QString getFirmwareUrl();
virtual int getCapability(const Capability);
virtual QTime getMaxTimerStart();
virtual bool isTelemetrySourceAvailable(int source);
@@ -30,8 +30,8 @@ macro(add_lua_export_target target)
add_custom_target(lua_export_${target} DEPENDS ${RADIO_SRC_DIRECTORY}/lua/lua_exports_${target}.inc)
endmacro(add_lua_export_target)
add_lua_export_target(taranis -DCPUARM -DPCBTARANIS -DLUA -DVIRTUALINPUTS)
add_lua_export_target(taranis_x9e -DCPUARM -DPCBTARANIS -DREVPLUS -DREV9E -DLUA -DVIRTUALINPUTS)
add_lua_export_target(taranis -DPCBTARANIS -DLUA -DVIRTUALINPUTS)
add_lua_export_target(taranis_x9e -DPCBTARANIS -DREVPLUS -DREV9E -DLUA -DVIRTUALINPUTS)
set(OPENTX_SRC_FILES
opentxsimulator.cpp
@@ -497,7 +497,7 @@ void OpenTxSimulator::sendTelemetry(::uint8_t * data, unsigned int len)
#endif
}
uint8_t OpenTxSimulator::getSensorInstance(uint16_t id, uint8_t defaultValue)
uint8_t OpenTxSimulator::getSensorInstance(uint16_t id)
{
#if defined(FRSKY_SPORT)
for (int i = 0; i<MAX_SENSORS; i++) {
@@ -509,7 +509,7 @@ uint8_t OpenTxSimulator::getSensorInstance(uint16_t id, uint8_t defaultValue)
}
}
#endif
return defaultValue;
return 0;
}
uint16_t OpenTxSimulator::getSensorRatio(uint16_t id)
@@ -122,7 +122,7 @@ class DLLEXPORT OpenTxSimulator : public SimulatorInterface {
virtual void sendTelemetry(uint8_t * data, unsigned int len);
virtual uint8_t getSensorInstance(uint16_t id, uint8_t defaultValue = 0);
virtual uint8_t getSensorInstance(uint16_t id);
virtual uint16_t getSensorRatio(uint16_t id);
+2 -65
View File
@@ -84,15 +84,12 @@ void GeneralEdit::on_calretrieve_PB_clicked()
{
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
QString calib=g.profile[profile_id].stickPotCalib();
int potsnum=GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders);
int numSwPots=GetCurrentFirmware()->getCapability(Switches)+GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders);
int potsnum=GetCurrentFirmware()->getCapability(Pots);
if (calib.isEmpty()) {
return;
}
else {
QString trainercalib = g.profile[profile_id].trainerCalib();
QString hwtypes = g.profile[profile_id].controlTypes();
QString controlNames=g.profile[profile_id].controlNames();
int8_t txVoltageCalibration = (int8_t)g.profile[profile_id].txVoltageCalibration();
int8_t txCurrentCalibration = (int8_t)g.profile[profile_id].txCurrentCalibration();
int8_t PPM_Multiplier = (int8_t)g.profile[profile_id].ppmMultiplier();
@@ -139,45 +136,6 @@ void GeneralEdit::on_calretrieve_PB_clicked()
} else {
QMessageBox::critical(this, tr("Warning"), tr("Wrong data in profile, radio calibration was not retrieved"));
}
if (hwtypes.length()==numSwPots) {
QString Byte;
int16_t byte16;
QByteArray qba;
int16_t offset;
bool ok;
for (int i=0; i<NUM_STICKS; i++) {
qba = controlNames.mid(3*i,3).toAscii();
strcpy(generalSettings.stickName[i], qba.data());
}
for (int i=0; i<(GetCurrentFirmware()->getCapability(Switches)); i++) {
Byte=hwtypes.mid(i,1);
byte16=(int16_t)Byte.toInt(&ok,16);
qba=controlNames.mid(3*(i+NUM_STICKS),3).toAscii();
if (ok)
generalSettings.switchConfig[i]=byte16;
strcpy(generalSettings.switchName[i], qba.data());
}
offset = GetCurrentFirmware()->getCapability(Switches);
for (int i=0; i<(GetCurrentFirmware()->getCapability(Pots)); i++) {
Byte=hwtypes.mid(i+offset,1);
byte16=(int16_t)Byte.toInt(&ok,16);
qba=controlNames.mid(3*(i+NUM_STICKS+offset),3).toAscii();
if (ok)
generalSettings.potConfig[i]=byte16;
strcpy(generalSettings.potName[i], qba.data());
}
offset += GetCurrentFirmware()->getCapability(Pots);
for (int i=0; i<(GetCurrentFirmware()->getCapability(Sliders)); i++) {
Byte=hwtypes.mid(i+offset,1);
byte16=(int16_t)Byte.toInt(&ok,16);
qba=controlNames.mid(3*(i+NUM_STICKS+offset),3).toAscii();
if (ok)
generalSettings.sliderConfig[i]=byte16;
strcpy(generalSettings.sliderName[i], qba.data());
}
} else {
QMessageBox::critical(this, tr("Warning"), tr("Wrong data in profile, Switch/pot config not retrieved"));
}
if ((DisplaySet.length()==6) && (BeeperSet.length()==4) && (HapticSet.length()==6) && (SpeakerSet.length()==6)) {
generalSettings.stickMode=GSStickMode;
uint8_t byte8u;
@@ -242,15 +200,13 @@ void GeneralEdit::on_calstore_PB_clicked()
int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt();
QString name=g.profile[profile_id].name();
int potsnum=GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders);
int potsnum=GetCurrentFirmware()->getCapability(Pots);
if (name.isEmpty()) {
ui->calstore_PB->setDisabled(true);
return;
}
else {
QString calib=g.profile[profile_id].stickPotCalib();
QString hwtypes=g.profile[profile_id].controlTypes();
QString controlNames=g.profile[profile_id].controlNames();
if (!(calib.isEmpty())) {
int ret = QMessageBox::question(this, "Companion",
tr("Do you want to store calibration in %1 profile<br>overwriting existing calibration?").arg(name) ,
@@ -271,25 +227,6 @@ void GeneralEdit::on_calstore_PB_clicked()
calib.append(QString("%1").arg((uint16_t)generalSettings.trainer.calib[i], 4, 16, QChar('0')));
}
g.profile[profile_id].trainerCalib( calib );
hwtypes.clear();
controlNames.clear();
for (int i=0; i<NUM_STICKS; i++) {
controlNames.append(QString("%1").arg(generalSettings.stickName[i], -3));
}
for (int i=0; i<(GetCurrentFirmware()->getCapability(Switches)); i++) {
hwtypes.append(QString("%1").arg((uint16_t)generalSettings.switchConfig[i], 1));
controlNames.append(QString("%1").arg(generalSettings.switchName[i], -3));
}
for (int i=0; i<(GetCurrentFirmware()->getCapability(Pots)); i++) {
hwtypes.append(QString("%1").arg((uint16_t)generalSettings.potConfig[i], 1));
controlNames.append(QString("%1").arg(generalSettings.potName[i], -3));
}
for (int i=0; i<(GetCurrentFirmware()->getCapability(Sliders)); i++) {
hwtypes.append(QString("%1").arg((uint16_t)generalSettings.sliderConfig[i], 1));
controlNames.append(QString("%1").arg(generalSettings.sliderName[i], -3));
}
g.profile[profile_id].controlTypes( hwtypes );
g.profile[profile_id].controlNames( controlNames );
g.profile[profile_id].txVoltageCalibration( generalSettings.txVoltageCalibration );
g.profile[profile_id].txCurrentCalibration( generalSettings.txCurrentCalibration );
g.profile[profile_id].vBatWarn( generalSettings.vBatWarn );
+2 -2
View File
@@ -275,8 +275,8 @@ void GeneralSetupPanel::populateBacklightCB()
void GeneralSetupPanel::populateVoiceLangCB()
{
QComboBox * b = ui->voiceLang_CB;
QString strings[] = { QObject::tr("English"), QObject::tr("Dutch"), QObject::tr("French"), QObject::tr("Italian"), QObject::tr("German"), QObject::tr("Czech"), QObject::tr("Slovak"), QObject::tr("Spanish"), QObject::tr("Polish"), QObject::tr("Portuguese"), QObject::tr("Swedish"), QObject::tr("Hungarian"), NULL};
QString langcode[] = { "en", "nl","fr", "it", "de", "cz", "sk", "es", "pl", "pt", "se", "hu", NULL};
QString strings[] = { QObject::tr("English"), QObject::tr("Finnish"), QObject::tr("French"), QObject::tr("Italian"), QObject::tr("German"), QObject::tr("Czech"), QObject::tr("Slovak"), QObject::tr("Spanish"), QObject::tr("Polish"), QObject::tr("Portuguese"), QObject::tr("Swedish"), NULL};
QString langcode[] = { "en", "fi","fr", "it", "de", "cz", "sk", "es", "pl", "pt", "se", NULL};
b->clear();
for (int i=0; strings[i]!=NULL; i++) {
+1 -1
View File
@@ -658,7 +658,7 @@
<item>
<widget class="QCheckBox" name="adjustRTC">
<property name="toolTip">
<string>Automatically adjust the radio's clock if a GPS is connected to telemetry.</string>
<string>If you enable FAI, you loose the vario, the play functions, the telemetry screen. This function cannot be disabled by the radio.</string>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
+14 -21
View File
@@ -103,7 +103,7 @@ void populatePhasesCB(QComboBox *b, int value)
b->setCurrentIndex(value + GetCurrentFirmware()->getCapability(FlightModes));
}
GVarGroup::GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBox * weightCB, int & weight, const ModelData & model, const int deflt, const int mini, const int maxi, const double step, bool allowGvars):
GVarGroup::GVarGroup(QCheckBox *weightGV, QAbstractSpinBox *weightSB, QComboBox *weightCB, int & weight, const int deflt, const int mini, const int maxi, const double step, bool allowGvars):
QObject(),
weightGV(weightGV),
weightSB(weightSB),
@@ -115,7 +115,7 @@ GVarGroup::GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBo
lock(true)
{
if (allowGvars && GetCurrentFirmware()->getCapability(Gvars)) {
populateGVCB(*weightCB, weight, model);
populateGVCB(weightCB, weight);
connect(weightGV, SIGNAL(stateChanged(int)), this, SLOT(gvarCBChanged(int)));
connect(weightCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
}
@@ -179,14 +179,13 @@ void GVarGroup::valuesChanged()
}
}
CurveGroup::CurveGroup(QComboBox * curveTypeCB, QCheckBox * curveGVarCB, QComboBox * curveValueCB, QSpinBox * curveValueSB, CurveReference & curve, const ModelData & model, unsigned int flags):
CurveGroup::CurveGroup(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueSB, CurveReference & curve, unsigned int flags):
QObject(),
curveTypeCB(curveTypeCB),
curveGVarCB(curveGVarCB),
curveValueCB(curveValueCB),
curveValueSB(curveValueSB),
curve(curve),
model(model),
flags(flags),
lock(false),
lastType(-1)
@@ -220,7 +219,7 @@ void CurveGroup::update()
curveGVarCB->setChecked(true);
if (lastType != CurveReference::CURVE_REF_DIFF && lastType != CurveReference::CURVE_REF_EXPO) {
lastType = curve.type;
populateGVCB(*curveValueCB, curve.value, model);
populateGVCB(curveValueCB, curve.value);
}
curveValueCB->show();
curveValueSB->hide();
@@ -479,39 +478,33 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
b->setMaxVisibleItems(10);
}
void populateGVCB(QComboBox & b, int value, const ModelData & model)
void populateGVCB(QComboBox *b, int value)
{
bool selected = false;
b.clear();
b->clear();
int count = GetCurrentFirmware()->getCapability(Gvars);
for (int i=-count; i<=-1; i++) {
int pgvars = GetCurrentFirmware()->getCapability(Gvars);
for (int i=-pgvars; i<=-1; i++) {
int16_t gval = (int16_t)(-10000+i);
if (strlen(model.gvars_names[-i-1]) > 0)
b.addItem(QObject::tr("-GV%1 (%2)").arg(-i).arg(model.gvars_names[-i-1]), gval);
else
b.addItem(QObject::tr("-GV%1").arg(-i), gval);
b->addItem(QObject::tr("-GV%1").arg(-i), gval);
if (value == gval) {
b.setCurrentIndex(b.count()-1);
b->setCurrentIndex(b->count()-1);
selected = true;
}
}
for (int i=1; i<=count; i++) {
for (int i=1; i<=pgvars; i++) {
int16_t gval = (int16_t)(10000+i);
if (strlen(model.gvars_names[i-1]) > 0)
b.addItem(QObject::tr("GV%1 (%2)").arg(i).arg(model.gvars_names[i-1]), gval);
else
b.addItem(QObject::tr("GV%1").arg(i), gval);
b->addItem(QObject::tr("GV%1").arg(i), gval);
if (value == gval) {
b.setCurrentIndex(b.count()-1);
b->setCurrentIndex(b->count()-1);
selected = true;
}
}
if (!selected) {
b.setCurrentIndex(count);
b->setCurrentIndex(pgvars);
}
}
+4 -4
View File
@@ -45,7 +45,7 @@ class GVarGroup: public QObject {
Q_OBJECT
public:
GVarGroup(QCheckBox * weightGV, QAbstractSpinBox * weightSB, QComboBox * weightCB, int & weight, const ModelData & model, const int deflt, const int mini, const int maxi, const double step=1.0, bool allowGVars=true);
GVarGroup(QCheckBox *weightGV, QAbstractSpinBox *weightSB, QComboBox *weightCB, int & weight, const int deflt, const int mini, const int maxi, const double step=1.0, bool allowGVars=true);
protected slots:
void gvarCBChanged(int);
@@ -71,7 +71,7 @@ class CurveGroup : public QObject {
Q_OBJECT
public:
CurveGroup(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueSB, CurveReference & curve, const ModelData & model, unsigned int flags=0);
CurveGroup(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueSB, CurveReference & curve, unsigned int flags=0);
void update();
protected slots:
@@ -85,7 +85,6 @@ class CurveGroup : public QObject {
QComboBox *curveValueCB;
QSpinBox *curveValueSB;
CurveReference & curve;
const ModelData & model;
unsigned int flags;
bool lock;
int lastType;
@@ -118,7 +117,8 @@ void populateGvarUseCB(QComboBox *b, unsigned int phase);
#define GVARS_VARIANT 0x0001
#define FRSKY_VARIANT 0x0002
void populateGVCB(QComboBox & b, int value, const ModelData & model);
// void populateGVarCB(QComboBox *b, int value, int min, int max,int pgvars=5); //TODO: Clean Up
void populateGVCB(QComboBox *b, int value);
void populateSourceCB(QComboBox *b, const RawSource &source, const GeneralSettings generalSettings, const ModelData * model, unsigned int flags);
QString image2qstring(QImage image);
int findmult(float value, float base);
+5 -5
View File
@@ -7,7 +7,7 @@
#include <QCheckBox>
#include <QDoubleSpinBox>
LimitsGroup::LimitsGroup(Firmware * firmware, TableLayout * tableLayout, int row, int col, int & value, const ModelData & model, int min, int max, int deflt):
LimitsGroup::LimitsGroup(Firmware * firmware, TableLayout *tableLayout, int row, int col, int & value, int min, int max, int deflt):
firmware(firmware),
spinbox(new QDoubleSpinBox()),
value(value),
@@ -50,7 +50,7 @@ LimitsGroup::LimitsGroup(Firmware * firmware, TableLayout * tableLayout, int row
horizontalLayout->addWidget(cb);
horizontalLayout->addWidget(spinbox);
tableLayout->addLayout(row, col, horizontalLayout);
gvarGroup = new GVarGroup(gv, spinbox, cb, value, model, deflt, min, max, displayStep, allowGVars);
gvarGroup = new GVarGroup(gv, spinbox, cb, value, deflt, min, max, displayStep, allowGVars);
}
LimitsGroup::~LimitsGroup()
@@ -119,13 +119,13 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
}
// Channel offset
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].offset, model, -1000, 1000, 0);
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].offset, -1000, 1000, 0);
// Channel min
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].min, model, -model.getChannelsMax()*10, 0, -1000);
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].min, -model.getChannelsMax()*10, 0, -1000);
// Channel max
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].max, model, 0, model.getChannelsMax()*10, 1000);
limitsGroups << new LimitsGroup(firmware, tableLayout, i, col++, model.limitData[i].max, 0, model.getChannelsMax()*10, 1000);
// Channel inversion
QComboBox * invCB = new QComboBox(this);
+1 -1
View File
@@ -10,7 +10,7 @@ class GVarGroup;
class LimitsGroup
{
public:
LimitsGroup(Firmware * firmware, TableLayout *tableLayout, int row, int col, int & value, const ModelData & model, int min, int max, int deflt);
LimitsGroup(Firmware * firmware, TableLayout *tableLayout, int row, int col, int & value, int min, int max, int deflt);
~LimitsGroup();
void updateMinMax(int max);
+2 -1
View File
@@ -503,8 +503,9 @@ void Curves::resizeEvent(QResizeEvent *event)
ModelPanel::resizeEvent(event);
}
void Curves::on_curveType_currentIndexChanged(int index)
void Curves::on_curveType_currentIndexChanged()
{
int index = ui->curveType->currentIndex();
unsigned int flags = templates[index].flags;
ui->curveCoeffLabel->setVisible(flags & CURVE_COEFF_ENABLE);
ui->curveCoeff->setVisible(flags & CURVE_COEFF_ENABLE);
+1 -1
View File
@@ -46,7 +46,7 @@ class Curves : public ModelPanel
void onNodeMoved(int x, int y);
void onNodeFocus();
void onNodeUnfocus();
void on_curveType_currentIndexChanged(int index);
void on_curveType_currentIndexChanged();
void on_curveApply_clicked();
protected:
+2 -2
View File
@@ -70,7 +70,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
s1.report("get tracks");
if (IS_TARANIS(firmware->getBoard())) {
scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS/FUNCTIONS", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength));
scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength));
for (int i=0; i<num_fsw; i++) {
if (functions[i].func==FuncPlayScript) {
QString temp = functions[i].paramarm;
@@ -403,7 +403,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
else if (func>=FuncSetTimer1 && func<=FuncSetTimer3) {
if (modified) cfn.param = QTimeS(fswtchParamTime[i]->time()).seconds();
fswtchParamTime[i]->setMinimumTime(QTime(0, 0, 0));
fswtchParamTime[i]->setMaximumTime(firmware->getMaxTimerStart());
fswtchParamTime[i]->setMaximumTime(QTime(0, 59, 59));
fswtchParamTime[i]->setTime(QTimeS(cfn.param));
widgetsMask |= CUSTOM_FUNCTION_TIME_PARAM + CUSTOM_FUNCTION_ENABLE;
}
+4 -4
View File
@@ -21,11 +21,11 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
QRegExp rx(CHAR_FOR_NAMES_REGEX);
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, ed->weight, model, 100, -100, 100);
gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, ed->offset, model, 0, -100, 100);
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, ed->weight, 100, -100, 100);
gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, ed->offset, 0, -100, 100);
}
else {
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, ed->weight, model, 100, 0, 100);
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, ed->weight, 100, 0, 100);
gvOffsetGroup = NULL;
ui->offsetLabel->hide();
ui->offsetGV->hide();
@@ -33,7 +33,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
ui->offsetCB->hide();
}
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve, model,
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve,
firmware->getCapability(HasInputDiff) ? 0 : (HIDE_DIFF | HIDE_NEGATIVE_CURVES));
populateSwitchCB(ui->switchesCB, ed->swtch, generalSettings, MixesContext);
+3 -3
View File
@@ -25,10 +25,10 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
int limit = firmware->getCapability(OffsetWeight);
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, md->weight, model, 100, -limit, limit);
gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, md->sOffset, model, 0, -limit, limit);
gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, md->weight, 100, -limit, limit);
gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, md->sOffset, 0, -limit, limit);
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB,
md->curve, model, firmware->getCapability(HasMixerExpo) ? 0 : HIDE_EXPO);
md->curve, firmware->getCapability(HasMixerExpo) ? 0 : HIDE_EXPO);
ui->MixDR_CB->setChecked(md->noExpo == 0);
+6 -11
View File
@@ -42,8 +42,6 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, Ge
ui->countdownBeep->addItem(tr("Voice"), TimerData::COUNTDOWN_VOICE);
ui->countdownBeep->addItem(tr("Haptic"), TimerData::COUNTDOWN_HAPTIC);
}
ui->value->setMaximumTime(firmware->getMaxTimerStart());
ui->persistent->setField(timer.persistent, this);
ui->persistent->addItem(tr("Not persistent"), 0);
@@ -68,11 +66,9 @@ TimerPanel::~TimerPanel()
void TimerPanel::update()
{
int hour = timer.val / 3600;
int min = (timer.val - (hour * 3600)) / 60;
int sec = (timer.val - (hour * 3600)) % 60;
ui->value->setTime(QTime(hour, min, sec));
int min = timer.val / 60;
int sec = timer.val % 60;
ui->value->setTime(QTime(0, min, sec));
if (firmware->getCapability(PermTimers)) {
int sign = 1;
@@ -98,7 +94,7 @@ QWidget * TimerPanel::getLastFocus()
void TimerPanel::on_value_editingFinished()
{
timer.val = ui->value->time().hour()*3600 + ui->value->time().minute()*60 + ui->value->time().second();
timer.val = ui->value->time().minute()*60 + ui->value->time().second();
emit modified();
}
@@ -331,8 +327,8 @@ void ModulePanel::update()
ui->failsafesFrame->setVisible(mask & MASK_FAILSAFES);
if (mask & MASK_CHANNELS_RANGE) {
ui->channelsStart->setMaximum(33 - ui->channelsCount->value());
ui->channelsCount->setMaximum(qMin(16, 33-ui->channelsStart->value()));
ui->channelsStart->setMaximum(32 - ui->channelsCount->value());
ui->channelsCount->setMaximum(qMin(16, 32-ui->channelsStart->value()));
}
}
@@ -778,7 +774,6 @@ void SetupPanel::populateThrottleSourceCB()
lock = true;
ui->throttleSource->clear();
ui->throttleSource->addItem(QObject::tr("THR"));
if (IS_TARANIS_X9E(GetEepromInterface()->getBoard())) {
+3 -3
View File
@@ -18,7 +18,7 @@
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>6</number>
<number>-1</number>
</property>
<property name="margin">
<number>0</number>
@@ -39,10 +39,10 @@
<bool>true</bool>
</property>
<property name="currentSection">
<enum>QDateTimeEdit::HourSection</enum>
<enum>QDateTimeEdit::MinuteSection</enum>
</property>
<property name="displayFormat">
<string notr="true">hh:mm:ss</string>
<string notr="true">mm:ss</string>
</property>
</widget>
</item>
+2 -2
View File
@@ -696,10 +696,10 @@ void TelemetrySensorPanel::on_unit_currentIndexChanged(int index)
}
}
void TelemetrySensorPanel::on_prec_valueChanged(double value)
void TelemetrySensorPanel::on_prec_valueChanged()
{
if (!lock) {
sensor.prec = value;
sensor.prec = ui->prec->value();
emit dataModified();
emit modified();
}
+1 -1
View File
@@ -96,7 +96,7 @@ class TelemetrySensorPanel: public ModelPanel
void on_type_currentIndexChanged(int index);
void on_formula_currentIndexChanged(int index);
void on_unit_currentIndexChanged(int index);
void on_prec_valueChanged(double value);
void on_prec_valueChanged();
protected:
void updateSourcesComboBox(AutoComboBox * cb, bool negative);
-3
View File
@@ -306,9 +306,6 @@ QString ModelPrinter::printInputLine(const ExpoData & input)
else if (input.carryTrim<0) str += " " + Qt::escape(RawSource(SOURCE_TYPE_TRIM, (-(input.carryTrim)-1)).toString(&model));
}
if (input.offset)
str += " " + Qt::escape(tr("Offset(%1)").arg(getGVarString(input.offset)));
if (firmware->getCapability(HasExpoNames) && input.name[0])
str += Qt::escape(QString(" [%1]").arg(input.name));
+2 -2
View File
@@ -94,7 +94,7 @@ QString SyncProcess::updateEntry(const QString & path, const QDir & source, cons
else {
if (!destinationInfo.exists()) {
// qDebug() << "Copy" << path << "to" << destinationPath;
progress->addText(tr("Copy %1 to %2").arg(path).arg(destinationPath) + "\n");
progress->addText(tr("Copy %1 to %2\n").arg(path).arg(destinationPath));
if (!QFile::copy(path, destinationPath)) {
return QObject::tr("Copy '%1' to '%2' failed").arg(path).arg(destinationPath);
}
@@ -120,7 +120,7 @@ QString SyncProcess::updateEntry(const QString & path, const QDir & source, cons
if (!destinationFile.open(QFile::WriteOnly)) {
return QObject::tr("Write '%1' failed").arg(destinationPath);
}
progress->addText(tr("Write %1").arg(destinationPath) + "\n");
progress->addText(tr("Write %1\n").arg(destinationPath));
// qDebug() << "Write" << destinationPath;
QTextStream destinationStream(&destinationFile);
destinationStream << sourceContents;
+2 -2
View File
@@ -191,7 +191,7 @@ void resetAvrdudeFuses(bool eepromProtect, ProgressWidget *progress)
QStringList str;
if (bcd.getMCU() == "m2560") {
args << "-B8";
QString erStr = eepromProtect ? "hfuse:w:0x51:m" : "hfuse:w:0x59:m";
QString erStr = eepromProtect ? "hfuse:w:0x11:m" : "hfuse:w:0x19:m";
str << "-U" << "lfuse:w:0xD7:m" << "-U" << erStr << "-U" << "efuse:w:0xFC:m";
//use hfuse = 0x81 to prevent eeprom being erased with every flashing
}
@@ -220,7 +220,7 @@ void resetAvrdudeFuses(bool eepromProtect, ProgressWidget *progress)
lfuses = "lfuse:w:0x3F:m";
}
QString erStr = eepromProtect ? "hfuse:w:0xC1:m" : "hfuse:w:0xC9:m";
QString erStr = eepromProtect ? "hfuse:w:0x81:m" : "hfuse:w:0x89:m";
str << "-U" << lfuses << "-U" << erStr << "-U" << "efuse:w:0xFF:m";
//use hfuse = 0x81 to prevent eeprom being erased with every flashing
}
@@ -99,7 +99,7 @@ class SimulatorInterface
virtual void sendTelemetry(uint8_t * data, unsigned int len) = 0;
virtual uint8_t getSensorInstance(uint16_t id, uint8_t defaultValue = 0) = 0;
virtual uint8_t getSensorInstance(uint16_t id) = 0;
virtual uint16_t getSensorRatio(uint16_t id) = 0;
+28 -44
View File
@@ -143,39 +143,37 @@ void TelemetrySimulator::closeEvent(QCloseEvent *event)
event->accept();
}
#define SET_INSTANCE(control, id, def) ui->control->setText(QString::number(simulator->getSensorInstance(id, ((def) & 0x1F) + 1)))
void TelemetrySimulator::showEvent(QShowEvent *event)
{
SET_INSTANCE(rxbt_inst, BATT_ID, 0);
SET_INSTANCE(rssi_inst, RSSI_ID, 24);
SET_INSTANCE(swr_inst, SWR_ID, 24);
SET_INSTANCE(a1_inst, ADC1_ID, 0);
SET_INSTANCE(a2_inst, ADC2_ID, 0);
SET_INSTANCE(a3_inst, A3_FIRST_ID, 0);
SET_INSTANCE(a4_inst, A4_FIRST_ID, 0);
SET_INSTANCE(t1_inst, T1_FIRST_ID, 0);
SET_INSTANCE(t2_inst, T2_FIRST_ID, 0);
SET_INSTANCE(rpm_inst, RPM_FIRST_ID, DATA_ID_RPM);
SET_INSTANCE(fuel_inst, FUEL_FIRST_ID, 0);
SET_INSTANCE(aspd_inst, AIR_SPEED_FIRST_ID, 0);
SET_INSTANCE(vvspd_inst, VARIO_FIRST_ID, DATA_ID_VARIO);
SET_INSTANCE(valt_inst, ALT_FIRST_ID, DATA_ID_VARIO);
SET_INSTANCE(fasv_inst, VFAS_FIRST_ID, DATA_ID_FAS);
SET_INSTANCE(fasc_inst, CURR_FIRST_ID, DATA_ID_FAS);
SET_INSTANCE(cells_inst, CELLS_FIRST_ID, DATA_ID_FLVSS);
SET_INSTANCE(gpsa_inst, GPS_ALT_FIRST_ID, DATA_ID_GPS);
SET_INSTANCE(gpss_inst, GPS_SPEED_FIRST_ID, DATA_ID_GPS);
SET_INSTANCE(gpsc_inst, GPS_COURS_FIRST_ID, DATA_ID_GPS);
SET_INSTANCE(gpst_inst, GPS_TIME_DATE_FIRST_ID, DATA_ID_GPS);
SET_INSTANCE(gpsll_inst, GPS_LONG_LATI_FIRST_ID, DATA_ID_GPS);
SET_INSTANCE(accx_inst, ACCX_FIRST_ID, 0);
SET_INSTANCE(accy_inst, ACCY_FIRST_ID, 0);
SET_INSTANCE(accz_inst, ACCZ_FIRST_ID, 0);
ui->rxbt_inst->setText(QString::number(simulator->getSensorInstance(BATT_ID)));
ui->rxbt_ratio->setValue(simulator->getSensorRatio(BATT_ID) / 10.0);
ui->rssi_inst->setText(QString::number(simulator->getSensorInstance(RSSI_ID)));
ui->swr_inst->setText(QString::number(simulator->getSensorInstance(SWR_ID)));
ui->a1_inst->setText(QString::number(simulator->getSensorInstance(ADC1_ID)));
ui->A1_ratio->setValue(simulator->getSensorRatio(ADC1_ID) / 10.0);
ui->a2_inst->setText(QString::number(simulator->getSensorInstance(ADC2_ID)));
ui->A2_ratio->setValue(simulator->getSensorRatio(ADC2_ID) / 10.0);
ui->a3_inst->setText(QString::number(simulator->getSensorInstance(A3_FIRST_ID)));
ui->a4_inst->setText(QString::number(simulator->getSensorInstance(A4_FIRST_ID)));
ui->t1_inst->setText(QString::number(simulator->getSensorInstance(T1_FIRST_ID)));
ui->t2_inst->setText(QString::number(simulator->getSensorInstance(T2_FIRST_ID)));
ui->rpm_inst->setText(QString::number(simulator->getSensorInstance(RPM_FIRST_ID)));
ui->fuel_inst->setText(QString::number(simulator->getSensorInstance(FUEL_FIRST_ID)));
ui->aspd_inst->setText(QString::number(simulator->getSensorInstance(AIR_SPEED_FIRST_ID)));
ui->vvspd_inst->setText(QString::number(simulator->getSensorInstance(VARIO_FIRST_ID)));
ui->valt_inst->setText(QString::number(simulator->getSensorInstance(ALT_FIRST_ID)));
ui->fasv_inst->setText(QString::number(simulator->getSensorInstance(VFAS_FIRST_ID)));
ui->fasc_inst->setText(QString::number(simulator->getSensorInstance(CURR_FIRST_ID)));
ui->cells_inst->setText(QString::number(simulator->getSensorInstance(CELLS_FIRST_ID)));
ui->gpsa_inst->setText(QString::number(simulator->getSensorInstance(GPS_ALT_FIRST_ID)));
ui->gpss_inst->setText(QString::number(simulator->getSensorInstance(GPS_SPEED_FIRST_ID)));
ui->gpsc_inst->setText(QString::number(simulator->getSensorInstance(GPS_COURS_FIRST_ID)));
ui->gpst_inst->setText(QString::number(simulator->getSensorInstance(GPS_TIME_DATE_FIRST_ID)));
ui->gpsll_inst->setText(QString::number(simulator->getSensorInstance(GPS_LONG_LATI_FIRST_ID)));
ui->accx_inst->setText(QString::number(simulator->getSensorInstance(ACCX_FIRST_ID)));
ui->accy_inst->setText(QString::number(simulator->getSensorInstance(ACCY_FIRST_ID)));
ui->accz_inst->setText(QString::number(simulator->getSensorInstance(ACCZ_FIRST_ID)));
ui->Simulate->setChecked(true);
onSimulateToggled(true); // not sure why this doesn't fire automatically
@@ -195,27 +193,13 @@ void setSportPacketCrc(uint8_t * packet)
//TRACE("crc set: %x", packet[FRSKY_SPORT_PACKET_SIZE-1]);
}
uint8_t getBit(uint8_t position, uint8_t value)
void generateSportPacket(uint8_t * packet, uint8_t dataId, uint8_t prim, uint16_t appId, uint32_t data)
{
return (value & (uint8_t)(1 << position)) ? 1 : 0;
}
bool generateSportPacket(uint8_t * packet, uint8_t dataId, uint8_t prim, uint16_t appId, uint32_t data)
{
if (dataId > 0x1B ) return false;
// generate Data ID field
uint8_t bit5 = getBit(0, dataId) ^ getBit(1, dataId) ^ getBit(2, dataId);
uint8_t bit6 = getBit(2, dataId) ^ getBit(3, dataId) ^ getBit(4, dataId);
uint8_t bit7 = getBit(0, dataId) ^ getBit(2, dataId) ^ getBit(4, dataId);
packet[0] = (bit7 << 7) + (bit6 << 6) + (bit5 << 5) + dataId;
// qDebug("dataID: 0x%02x (%d)", packet[0], dataId);
packet[0] = dataId;
packet[1] = prim;
*((uint16_t *)(packet+2)) = appId;
*((int32_t *)(packet+4)) = data;
setSportPacketCrc(packet);
return true;
}
void TelemetrySimulator::generateTelemetryFrame()
@@ -388,7 +372,7 @@ void TelemetrySimulator::generateTelemetryFrame()
return;
}
if (ok && (buffer[2] || buffer[3]))
if (ok && buffer[0])
simulator->sendTelemetry(buffer, FRSKY_SPORT_PACKET_SIZE);
else
onTimerEvent();
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-44
View File
@@ -1,47 +1,3 @@
<h2>Version 2.1.8 / 2016-04-14</h2>
Notice: EDGE Logical Switch operation has changed. Users should check their setups, if they use EDGE with AND switch.
This bug was introduced in version 2.1.2 and has been fixed in 2.1.8. (<a href=https://github.com/opentx/opentx/issues/2939>#2939</a>)
[Taranis]
<ul>
<li>Improvements of Statistics screen (<a href=https://github.com/opentx/opentx/issues/3206>#3206</a>)</li>
<li>Flight Modes screen layout fix (<a href=https://github.com/opentx/opentx/issues/3307>#3307</a>)</li>
<li>Fixed: left slider was affecting the value of the right slider on X9E (<a href=https://github.com/opentx/opentx/issues/2639>#2639</a>)</li>
<li>USB Joystick now supports 24 buttons (CH9-32) (<a href=https://github.com/opentx/opentx/issues/3268>#3268</a>)</li>
<li>Main view adjustments for 3-char switch names (<a href=https://github.com/opentx/opentx/issues/3278>#3278</a>)</li>
</ul>
[ARM (Taranis, Sky9x, 9XR-PRO, AR9X)]
<ul>
<li>Channel jitter reduced (<a href=https://github.com/opentx/opentx/issues/3233>#3233</a>)</li>
<li>Fixed: EDGE Logical switch internal state was being reset by the AND switch, that affected its function (it looked like AND was applied before the EDGE processing, not after like it is done for other logical switch types) (<a href=https://github.com/opentx/opentx/issues/2939>#2939</a>)</li>
</ul>
[Lua]
<ul>
<li>Some Lua fields were not available to scripts (<a href=https://github.com/opentx/opentx/issues/3223>#3223</a>)</li>
<li>Fixed: only first 32 input lines (out of 64) were accessible in Lua (<a href=https://github.com/opentx/opentx/issues/3285>#3285</a>)</li>
<li>playDuration() second parameter is now really optional (<a href=https://github.com/opentx/opentx/issues/3329>#3329</a>)</li>
<li>Fixed Lua io.open() problem for non-existing files (<a href=https://github.com/opentx/opentx/issues/3342>#3342</a>)</li>
</ul>
[Mega2560]
<ul>
<li>Fixed: First PPM pulse in the frame was longer (<a href=https://github.com/opentx/opentx/issues/2981>#2981</a>)</li>
</ul>
[All]
<ul>
<li>Various texts and translations corrections (se, it, pl, de)</li>
<li>Text to speech fixes (hu, sp)</li>
<li>Various small bug-fixes</li>
<li>PowerBox telemetry sensor names changed</li>
<li>Removed a few legacy timer limitations, fix non-working limit (<a href=https://github.com/opentx/opentx/issues/3301>#3301</a>)</li>
<li>Removed the "RF signal low" alert before "Telemetry lost" when powering off the receiver (<a href=https://github.com/opentx/opentx/issues/2616>#2616</a>)</li>
</ul>
<h2>Version 2.1.7 / 2016-01-04</h2>
Notice: Lua model wizard was fixed (<a href=https://github.com/opentx/opentx/issues/3061>#3061</a>)
+17 -23
View File
@@ -228,7 +228,11 @@ PXX = NO
# DSM2 (Spektrum) protocol
# Values = NO, SERIAL, PPM
DSM2 = NO
DSM2 = PPM
# Multimodule support
# (http://www.rcgroups.com/forums/showthread.php?t=2165676)
MULTIMODULE = YES
# HUBSAN protocol
# Values = NO, YES
@@ -383,14 +387,6 @@ WARNINGS_AS_ERRORS = NO
# Values = NO, YES
LUA_COMPILER = NO
# Enable ADC jitter measurement
# Values = NO, YES
JITTER_MEASURE = NO
# Enable ADC jitter filtering
# Values = NO, YES
JITTER_FILTER = YES
#------- END BUILD OPTIONS ---------------------------
# Define programs and commands.
@@ -403,7 +399,7 @@ TRANSLATE = -python ../util/translate.py
VERSION_MAJOR = 2
VERSION_MINOR = 1
VERSION_REVISION = 8
VERSION_REVISION = 7
VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_REVISION)$(OPENTX_VERSION_SUFFIX)
@@ -720,7 +716,7 @@ ifeq ($(PCB), MEGA2560)
TRGT = avr-
MCU = atmega2560
OPT = s
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBMEGA2560 -DCPUM2560 -DEEPROM_RLC -DEEPROM_VARIANT=0
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBMEGA2560 -DCPUM2560 -DEEPROM_RLC -DEEPROM_VARIANT=0 -DAUDIO
SDCARD = NO
BUZZER = YES
THR_TRACE = YES
@@ -729,7 +725,7 @@ ifeq ($(PCB), MEGA2560)
BOARDSRC = main_avr.cpp targets/mega2560/board_mega2560.cpp
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp
PULSESSRC = pulses/pulses_avr.cpp
CPPSRC += debug.cpp
CPPSRC += audio_avr.cpp debug.cpp
BITMAPS += bitmaps/9X/splash.lbm bitmaps/9X/asterisk.lbm bitmaps/9X/about.lbm
GUIGENERALSRC += gui/$(GUIDIRECTORY)/menu_general_diagkeys.cpp gui/$(GUIDIRECTORY)/menu_general_diaganas.cpp
@@ -1059,6 +1055,10 @@ ifeq ($(PCB), TARANIS)
ifeq ($(DSM2), PPM)
CPPSRC += pulses/dsm2_arm.cpp
endif
ifeq ($(MULTIMODULE), YES)
CPPDEFS += -DMULTIMODULE
CPPSRC += pulses/multi_arm.cpp
endif
ifeq ($(HUBSAN), YES)
CPPDEFS += -DHUBSAN
CPPSRC += pulses/hubsan.cpp
@@ -1075,12 +1075,6 @@ ifeq ($(PCB), TARANIS)
ifeq ($(WATCHDOG_TEST), YES)
CPPDEFS += -DWATCHDOG_TEST
endif
ifeq ($(JITTER_MEASURE), YES)
CPPDEFS += -DJITTER_MEASURE
endif
ifeq ($(JITTER_FILTER), YES)
CPPDEFS += -DJITTER_FILTER
endif
endif
CC = $(TRGT)gcc
@@ -1532,12 +1526,12 @@ bootloader.lbm: targets/taranis/bootloader/bootloader_ramBoot.bin
else ifeq ($(PCB), $(filter $(PCB), 9XRPRO AR9X))
bootloader.lbm:
@echo "Fetching Mike's bootloader..."
wget https://github.com/MikeBland/OpenRcBootloader/releases/download/V1.9/bootflash8.lbm
wget http://ersky9x.googlecode.com/svn/trunk/src/bootloader/bootflash8.lbm
mv bootflash8.lbm $@
else ifeq ($(PCB), SKY9X)
bootloader.lbm:
@echo "Fetching Mike's bootloader..."
wget https://github.com/MikeBland/OpenRcBootloader/releases/download/V1.9/bootflash4.lbm
wget http://ersky9x.googlecode.com/svn/trunk/src/bootloader/bootflash4.lbm
mv bootflash4.lbm $@
endif
@@ -1672,14 +1666,14 @@ endif
lua_exports_taranis.inc: myeeprom.h ../util/luaexport.py
@echo "Generating a list of Lua exported constants in lua_exports_taranis.txt"
@$(PARSER) -DEXPORT -DCPUARM -DPCBTARANIS -DLUA -DVIRTUALINPUTS myeeprom.h | grep LEXP > lua_exports_taranis.txt
@$(PARSER) -DEXPORT -DPCBTARANIS -DLUA -DVIRTUALINPUTS myeeprom.h | grep LEXP > lua_exports_taranis.txt
@echo "Parsing and generating C Lua exports in lua/lua_exports_taranis.inc"
@python ../util/luaexport.py $(VERSION) lua_exports_taranis.txt lua/lua_exports_taranis.inc lua_fields_taranis.txt
@$(PYTHON) ../util/luaexport.py $(VERSION) lua_exports_taranis.txt lua/lua_exports_taranis.inc lua_fields_taranis.txt
@rm lua_exports_taranis.txt
lua_exports_taranis_x9e.inc: myeeprom.h ../util/luaexport.py
@echo "Generating a list of Lua exported constants in lua_exports_taranis_x9e.txt"
@$(PARSER) -DEXPORT -DCPUARM -DPCBTARANIS -DREVPLUS -DREV9E -DLUA -DVIRTUALINPUTS myeeprom.h | grep LEXP > lua_exports_taranis_x9e.txt
@$(PARSER) -DEXPORT -DPCBTARANIS -DREVPLUS -DREV9E -DLUA -DVIRTUALINPUTS myeeprom.h | grep LEXP > lua_exports_taranis_x9e.txt
@echo "Parsing and generating C Lua exports in lua/lua_exports_taranis_x9e.inc"
@python ../util/luaexport.py $(VERSION) lua_exports_taranis_x9e.txt lua/lua_exports_taranis_x9e.inc lua_fields_taranis_x9e.txt
@rm lua_exports_taranis_x9e.txt
-30
View File
@@ -160,35 +160,5 @@ void dumpTraceBuffer();
#endif
#if defined(JITTER_MEASURE) && defined(__cplusplus)
template<class T> class JitterMeter {
public:
T min;
T max;
T measured;
JitterMeter() : min(~(T)0), max(0), measured(0) {};
void reset() {
// store mesaurement
measured = max - min;
//reset - begin new measurement
min = ~(T)0;
max = 0;
};
void measure(T value) {
if (value > max) max = value;
if (value < min) min = value;
};
T get() const {
return measured;
};
};
#endif // defined(JITTER_MEASURE)
#endif // #ifndef debug_h
+3 -7
View File
@@ -457,9 +457,9 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
}
else if (smlsize) {
x -= 2;
lcd_plot(x, y+5);
lcd_plot(x+1, y+5);
if ((flags&INVERS) && ((~flags & BLINK) || BLINK_ON_PHASE)) {
lcd_vline(x, y-1, 8);
lcd_vline(x+1, y, 7);
}
}
else if (tinsize) {
@@ -625,7 +625,7 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
#if defined(CPUARM)
char separator = ':';
if (tme >= 3600) {
if (tme >= 3600 && (~att & DBLSIZE)) {
qr = div(qr.quot, 60);
separator = CHR_HOUR;
}
@@ -633,10 +633,6 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
#define separator ':'
#endif
lcd_outdezNAtt(x, y, qr.quot, att|LEADING0|LEFT, 2);
#if defined(CPUARM)
if (separator == CHR_HOUR)
att &= ~DBLSIZE;
#endif
#if defined(CPUARM) && defined(RTCLOCK)
if (att&TIMEBLINK)
lcd_putcAtt(lcdLastPos, y, separator, BLINK);
@@ -211,7 +211,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
#endif
#if defined(CPUARM)
else if (func == FUNC_SET_TIMER) {
val_max = 539*60+59;
val_max = 59*60+59;
putsTimer(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT, attr);
}
#endif
+2 -6
View File
@@ -220,14 +220,13 @@ void menuModelSetup(uint8_t event)
break;
}
case 1:
CHECK_INCDEC_MODELVAR_ZERO(event, qr.quot, 539); // 8:59
CHECK_INCDEC_MODELVAR_ZERO(event, qr.quot, 59);
timer->start = qr.rem + qr.quot*60;
break;
case 2:
qr.rem -= checkIncDecModel(event, qr.rem+2, 1, 62)-2;
timer->start -= qr.rem ;
if ((int16_t)timer->start < 0) timer->start=0;
if ((int16_t)timer->start > 5999) timer->start=32399; // 8:59:59
break;
}
}
@@ -300,10 +299,7 @@ void menuModelSetup(uint8_t event)
break;
case 2:
qr.rem -= checkIncDecModel(event, qr.rem+2, 1, 62)-2;
if (timer->start >= qr.rem) {
timer->start -= qr.rem ;
}
if ((int32_t)timer->start > 3599) timer->start=3599; // 59:59
timer->start -= qr.rem ;
break;
}
}
+2 -5
View File
@@ -421,9 +421,9 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
}
else if (smlsize) {
x -= 2;
lcd_plot(x, y+5);
lcd_plot(x+1, y+5);
if ((flags&INVERS) && ((~flags & BLINK) || BLINK_ON_PHASE)) {
lcd_vline(x, y-1, 8);
lcd_vline(x+1, y, 7);
}
}
else if (tinsize) {
@@ -593,8 +593,6 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
qr.quot = qr2.rem;
if (att & MIDSIZE)
x += 17;
else if (att & BOLD)
x += 15;
else
x += 13;
}
@@ -1038,7 +1036,6 @@ void lcd_plot(coord_t x, coord_t y, LcdFlags att)
void lcd_hlineStip(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att)
{
if (w < 0) { x += w; w = -w; }
if (y < 0 || y >= LCD_H) return;
if (x+w > LCD_W) {
if (x >= LCD_W ) return;
+12 -10
View File
@@ -43,26 +43,28 @@ void menuGeneralDiagAna(uint8_t event)
STICK_SCROLL_DISABLE();
for (int i=0; i<NUM_STICKS+NUM_POTS; i++) {
coord_t y = MENU_HEADER_HEIGHT + 1 + (i/2)*FH;
uint8_t x = i&1 ? LCD_W/2 + FW : 0;
#if (NUM_STICKS+NUM_POTS) > 9
coord_t y = MENU_HEADER_HEIGHT + 1 + (i/3)*FH;
const uint8_t x_coord[] = {0, 70, 154};
uint8_t x = x_coord[i%3];
lcd_outdezNAtt(x, y, i+1, LEADING0|LEFT, 2);
lcd_putc(x+2*FW-2, y, ':');
lcd_outhex4(x+3*FW-1, y, anaIn(i));
#if defined(JITTER_MEASURE)
lcd_outdezAtt(x+10*FW-1, y, rawJitter[i].get());
lcd_outdezAtt(x+13*FW-1, y, avgJitter[i].get());
lcd_outdez8(x+17*FW-1, y, (int16_t)calibratedStick[CONVERT_MODE(i)]*25/256);
#else
lcd_outdez8(x+10*FW-1, y, (int16_t)calibratedStick[CONVERT_MODE(i)]*25/256);
coord_t y = MENU_HEADER_HEIGHT + 1 + (i/2)*FH;
uint8_t x = i&1 ? 64+5 : 0;
putsStrIdx(x, y, PSTR("A"), i+1);
lcd_putc(lcdNextPos, y, ':');
#endif
lcd_outhex4(x+3*FW-1, y, anaIn(i));
lcd_outdez8(x+10*FW-1, y, (int16_t)calibratedStick[CONVERT_MODE(i)]*25/256);
}
lcd_putsLeft(MENU_HEADER_HEIGHT+1+6*FH, STR_BATT_CALIB);
lcd_putsLeft(MENU_HEADER_HEIGHT+1+5*FH, STR_BATT_CALIB);
static int32_t adcBatt;
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8;
uint32_t batCalV = (adcBatt + (adcBatt*g_eeGeneral.txVoltageCalibration)/128) * BATT_SCALE;
batCalV >>= 11;
batCalV += 2; // because of the diode
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_HEADER_HEIGHT+1+6*FH, batCalV, s_editMode > 0 ? BLINK|INVERS : INVERS);
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_HEADER_HEIGHT+1+5*FH, batCalV, s_editMode > 0 ? BLINK|INVERS : INVERS);
if (s_editMode > 0) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txVoltageCalibration, -127, 127);
}
@@ -272,8 +272,8 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
lcd_putsiAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, "\004Int.Ext.", CFN_PARAM(cfn), attr);
}
else if (func == FUNC_SET_TIMER) {
val_max = 539*60+59; //8:59:59
putsTimer(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT|TIMEHOUR, attr);
val_max = 59*60+59;
putsTimer(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT, attr);
}
else if (func == FUNC_PLAY_SOUND) {
val_max = AU_FRSKY_LAST-AU_FRSKY_FIRST-1;
@@ -121,7 +121,7 @@ void menuModelFlightModesAll(uint8_t event)
case ITEM_FLIGHT_MODES_SWITCH:
if (k>0) {
putsSwitches((4+LEN_FLIGHT_MODE_NAME)*FW+FW/2, y, p->swtch, attr);
putsSwitches((5+LEN_FLIGHT_MODE_NAME)*FW+FW/2, y, p->swtch, attr);
if (active) CHECK_INCDEC_MODELSWITCH(event, p->swtch, SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, isSwitchAvailableInMixes);
}
break;
+154 -16
View File
@@ -95,6 +95,10 @@ enum menuModelSetupItems {
ITEM_MODEL_EXTERNAL_MODULE_CHANNELS,
ITEM_MODEL_EXTERNAL_MODULE_BIND,
ITEM_MODEL_EXTERNAL_MODULE_FAILSAFE,
#ifdef MULTIMODULE
ITEM_MODEL_EXTERNAL_MODULE_AUTOBIND,
ITEM_MODEL_EXTERNAL_MODULE_LOWPOWER,
#endif
ITEM_MODEL_TRAINER_LABEL,
ITEM_MODEL_TRAINER_MODE,
ITEM_MODEL_TRAINER_CHANNELS,
@@ -137,8 +141,8 @@ void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, uint8_t event)
TimerData * timer = &g_model.timers[timerIdx];
putsStrIdx(0*FW, y, STR_TIMER, timerIdx+1);
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, menuHorizontalPosition==0 ? attr : 0);
putsTimer(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, menuHorizontalPosition==1 ? attr|TIMEHOUR : TIMEHOUR, menuHorizontalPosition==2 ? attr|TIMEHOUR : TIMEHOUR);
if (attr && menuHorizontalPosition < 0) drawFilledRect(MODEL_SETUP_2ND_COLUMN-1, y-1, 11*FW, FH+1);
putsTimer(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, menuHorizontalPosition==1 ? attr : 0, menuHorizontalPosition==2 ? attr : 0);
if (attr && menuHorizontalPosition < 0) drawFilledRect(MODEL_SETUP_2ND_COLUMN-1, y-1, LCD_W-MODEL_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH+1, FH+1);
if (attr && s_editMode>0) {
div_t qr = div(timer->start, 60);
switch (menuHorizontalPosition) {
@@ -162,14 +166,13 @@ void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, uint8_t event)
break;
}
case 1:
qr.quot = checkIncDec(event, qr.quot, 0, 1439, EE_MODEL | NO_INCDEC_MARKS); // 23h59
CHECK_INCDEC_MODELVAR_ZERO(event, qr.quot, 59);
timer->start = qr.rem + qr.quot*60;
break;
case 2:
qr.rem -= checkIncDecModel(event, qr.rem+2, 1, 62)-2;
timer->start -= qr.rem ;
if ((int16_t)timer->start < 0) timer->start=0;
if ((int32_t)timer->start > 86399) timer->start=86399; // 23h59:59
break;
}
}
@@ -205,12 +208,27 @@ int getSwitchWarningsCount()
#define IS_D8_RX(x) (g_model.moduleData[x].rfProtocol == RF_PROTO_D8)
#define IF_EXTERNAL_MODULE_XJT(x) (IS_MODULE_XJT(EXTERNAL_MODULE) ? (uint8_t)x : HIDDEN_ROW)
#define INTERNAL_MODULE_CHANNELS_ROWS IF_INTERNAL_MODULE_ON(1)
#define EXTERNAL_MODULE_CHANNELS_ROWS IF_EXTERNAL_MODULE_ON((IS_MODULE_DSM2(EXTERNAL_MODULE) || IS_MODULE_CROSSFIRE(EXTERNAL_MODULE)) ? (uint8_t)0 : (uint8_t)1)
#define EXTERNAL_MODULE_CHANNELS_ROWS IF_EXTERNAL_MODULE_ON((IS_MODULE_DSM2(EXTERNAL_MODULE) || IS_MODULE_CROSSFIRE(EXTERNAL_MODULE) || IS_MODULE_MULTIMODULE(EXTERNAL_MODULE)) ? (uint8_t)0 : (uint8_t)1)
#define TRAINER_CHANNELS_ROWS() IF_TRAINER_ON(1)
#define PORT_CHANNELS_ROWS(x) (x==INTERNAL_MODULE ? INTERNAL_MODULE_CHANNELS_ROWS : (x==EXTERNAL_MODULE ? EXTERNAL_MODULE_CHANNELS_ROWS : TRAINER_CHANNELS_ROWS()))
#define FAILSAFE_ROWS(x) (HAS_RF_PROTOCOL_FAILSAFE(g_model.moduleData[x].rfProtocol) ? (g_model.moduleData[x].failsafeMode==FAILSAFE_CUSTOM ? (uint8_t)1 : (uint8_t)0) : HIDDEN_ROW)
#if defined MULTIMODULE
#define MULTIMODULE_HASOPTIONS(x) (x == MM_RF_PROTO_HUBSAN || x == MM_RF_PROTO_FRSKY || x == MM_RF_PROTO_DSM2 || x >= MM_RF_PROTO_CUSTOM)
#define MULTIMODULE_FAILSAFEROWS(x) (IS_MODULE_MULTIMODULE(x) && (MULTIMODULE_HASOPTIONS(g_model.moduleData[x].multi.rfProtocol))) ? (uint8_t) 1: HIDDEN_ROW
#else
#define MULTIMODULE_FAILSAFEROWS(x) HIDDEN_ROW
#endif
#define FAILSAFE_ROWS(x) (IS_MODULE_XJT(x) && HAS_RF_PROTOCOL_FAILSAFE(g_model.moduleData[x].rfProtocol) ? (g_model.moduleData[x].failsafeMode==FAILSAFE_CUSTOM ? (uint8_t)1 : (uint8_t)0) : MULTIMODULE_FAILSAFEROWS(x))
#define TIMER_ROWS 2|NAVIGATION_LINE_BY_LINE, 0, CASE_PERSISTENT_TIMERS(0) 0, 0
#define EXTERNAL_MODULE_MODE_ROWS (IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)1 : (uint8_t)0
#if defined(MULTIMODULE)
#define MULTIMODULE_HAS_SUBTYPE(x) (x == MM_RF_PROTO_FLYSKY || x == MM_RF_PROTO_FRSKY || x == MM_RF_PROTO_HISKY || x == MM_RF_PROTO_DSM2 || x == MM_RF_PROTO_YD717 || x == MM_RF_PROTO_KN || x == MM_RF_PROTO_SYMAX || x == MM_RF_PROTO_CX10 || x == MM_RF_PROTO_CG023 || x == MM_RF_PROTO_MT99XX || x == MM_RF_PROTO_MJXQ)
#define MULTIMODULE_MODE_ROWS(x) (g_model.moduleData[x].multi.rfProtocol >= MM_RF_PROTO_CUSTOM ) ? (uint8_t) 3 :MULTIMODULE_HAS_SUBTYPE(g_model.moduleData[x].multi.rfProtocol) ? (uint8_t)2 : (uint8_t)1
#define MULTIMODULE_MODULE_ROWS IS_MODULE_MULTIMODULE(EXTERNAL_MODULE) ? (uint8_t) 1 : HIDDEN_ROW, IS_MODULE_MULTIMODULE(EXTERNAL_MODULE) ? (uint8_t) 1 : HIDDEN_ROW,
#else
#define MULTIMODULE_MODE_ROWS(x) (uint8_t)0
#define MULTIMODULE_MODULE_ROWS
#endif
#define EXTERNAL_MODULE_MODE_ROWS (IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)1 : IS_MODULE_MULTIMODULE(EXTERNAL_MODULE) ? MULTIMODULE_MODE_ROWS(EXTERNAL_MODULE) : (uint8_t)0
#if TIMERS == 1
#define TIMERS_ROWS TIMER_ROWS
#elif TIMERS == 2
@@ -228,6 +246,7 @@ int getSwitchWarningsCount()
#define TOPLCD_ROWS
#endif
void menuModelSetup(uint8_t event)
{
horzpos_t l_posHorz = menuHorizontalPosition;
@@ -239,12 +258,12 @@ void menuModelSetup(uint8_t event)
INTERNAL_MODULE_MODE_ROWS,
INTERNAL_MODULE_CHANNELS_ROWS,
IF_INTERNAL_MODULE_ON(IS_MODULE_XJT(INTERNAL_MODULE) ? (HAS_RF_PROTOCOL_MODELINDEX(g_model.moduleData[INTERNAL_MODULE].rfProtocol) ? (uint8_t)2 : (uint8_t)1) : (IS_MODULE_PPM(INTERNAL_MODULE) ? (uint8_t)1 : HIDDEN_ROW)),
IF_INTERNAL_MODULE_ON((IS_MODULE_XJT(INTERNAL_MODULE)) ? FAILSAFE_ROWS(INTERNAL_MODULE) : HIDDEN_ROW),
LABEL(ExternalModule),
(IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)1 : (uint8_t)0,
IF_INTERNAL_MODULE_ON((IS_MODULE_XJT(INTERNAL_MODULE)) ? FAILSAFE_ROWS(INTERNAL_MODULE) : HIDDEN_ROW),
LABEL(ExternalModule),
(IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE) || IS_MODULE_MULTIMODULE(EXTERNALE_MODULE)) ? (uint8_t)1 : (uint8_t)0,
EXTERNAL_MODULE_CHANNELS_ROWS,
(IS_MODULE_XJT(EXTERNAL_MODULE) && !HAS_RF_PROTOCOL_MODELINDEX(g_model.moduleData[EXTERNAL_MODULE].rfProtocol)) ? (uint8_t)1 : (IS_MODULE_PPM(EXTERNAL_MODULE) || IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)2 : HIDDEN_ROW,
IF_EXTERNAL_MODULE_XJT(FAILSAFE_ROWS(EXTERNAL_MODULE)),
(IS_MODULE_XJT(EXTERNAL_MODULE) && !HAS_RF_PROTOCOL_MODELINDEX(g_model.moduleData[EXTERNAL_MODULE].rfProtocol)) ? (uint8_t)1 : (IS_MODULE_PPM(EXTERNAL_MODULE) || IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE) || IS_MODULE_MULTIMODULE(EXTERNAL_MODULE)) ? (uint8_t)2 : HIDDEN_ROW,
IF_EXTERNAL_MODULE_XJT(FAILSAFE_ROWS(EXTERNAL_MODULE)),
LABEL(Trainer), 0, TRAINER_CHANNELS_ROWS(), IF_TRAINER_ON(2)});
#else
MENU_TAB({ 0, 0, TIMERS_ROWS, TOPLCD_ROWS 0, 1, 0, 0, LABEL(Throttle), 0, 0, 0, LABEL(PreflightCheck), 0, 0, SW_WARN_ITEMS(), POT_WARN_ITEMS(),
@@ -257,8 +276,8 @@ void menuModelSetup(uint8_t event)
LABEL(ExternalModule),
EXTERNAL_MODULE_MODE_ROWS,
EXTERNAL_MODULE_CHANNELS_ROWS,
(IS_MODULE_XJT(EXTERNAL_MODULE) && !HAS_RF_PROTOCOL_MODELINDEX(g_model.moduleData[EXTERNAL_MODULE].rfProtocol)) ? (uint8_t)1 : (IS_MODULE_PPM(EXTERNAL_MODULE) || IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE)) ? (uint8_t)2 : HIDDEN_ROW,
IF_EXTERNAL_MODULE_XJT(FAILSAFE_ROWS(EXTERNAL_MODULE)),
(IS_MODULE_XJT(EXTERNAL_MODULE) && !HAS_RF_PROTOCOL_FAILSAFE(g_model.moduleData[EXTERNAL_MODULE].rfProtocol)) ? (uint8_t)1 : (IS_MODULE_PPM(EXTERNAL_MODULE) || IS_MODULE_XJT(EXTERNAL_MODULE) || IS_MODULE_DSM2(EXTERNAL_MODULE) || IS_MODULE_MULTIMODULE(EXTERNAL_MODULE)) ? (uint8_t)2 : HIDDEN_ROW,
FAILSAFE_ROWS(EXTERNAL_MODULE), MULTIMODULE_MODULE_ROWS
LABEL(Trainer), 0, TRAINER_CHANNELS_ROWS(), IF_TRAINER_ON(2)});
#endif
MENU_CHECK(STR_MENUSETUP, menuTabModel, e_ModelSetup, ITEM_MODEL_SETUP_MAX);
@@ -679,6 +698,52 @@ void menuModelSetup(uint8_t event)
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
else if (IS_MODULE_DSM2(EXTERNAL_MODULE))
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_DSM_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
#if defined(MULTIMODULE)
else if (IS_MODULE_MULTIMODULE(EXTERNAL_MODULE)) {
int8_t multi_rfProto = min(g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol, (uint8_t) MM_RF_PROTO_CUSTOM);
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+5*FW, y, STR_MULTI_PROTOCOLS, multi_rfProto, menuHorizontalPosition==1 ? attr : 0);
switch(multi_rfProto) {
case MM_RF_PROTO_FLYSKY:
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+11*FW, y, STR_SUBTYPE_FLYSKY, g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition==2 ? attr : 0);
break;
case MM_RF_PROTO_FRSKY:
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+11*FW, y, STR_XJT_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].subType+1, menuHorizontalPosition==2 ? attr : 0);
break;
case MM_RF_PROTO_HISKY:
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+10*FW, y, STR_SUBTYPE_HISKY, g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition==2 ? attr : 0);
break;
case MM_RF_PROTO_DSM2:
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+11*FW, y, STR_DSM_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].subType+1, menuHorizontalPosition==2 ? attr : 0);
break;
case MM_RF_PROTO_YD717:
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+10*FW, y, STR_SUBTYPE_YD717, g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition==2 ? attr : 0);
break;
case MM_RF_PROTO_KN:
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+11*FW, y, STR_SUBTYPE_KN, g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition==2 ? attr : 0);
break;
case MM_RF_PROTO_SYMAX:
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+11*FW, y, STR_SUBTYPE_SYMAX, g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition==2 ? attr : 0);
break;
case MM_RF_PROTO_CX10:
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+10*FW, y, STR_SUBTYPE_CX10, g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition==2 ? attr : 0);
break;
case MM_RF_PROTO_CG023:
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+10*FW, y, STR_SUBTYPE_CG023, g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition==2 ? attr : 0);
break;
case MM_RF_PROTO_MT99XX:
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+11*FW, y, STR_SUBTYPE_MT99, g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition==2 ? attr : 0);
break;
case MM_RF_PROTO_MJXQ:
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+11*FW, y, STR_SUBTYPE_MJXQ, g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition==2 ? attr : 0);
break;
case MM_RF_PROTO_CUSTOM:
lcd_outdezNAtt(MODEL_SETUP_2ND_COLUMN+14*FW, y, g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol & 0x1f, menuHorizontalPosition==2 ? attr : 0, 2);
lcd_outdezNAtt(MODEL_SETUP_2ND_COLUMN+16*FW, y, g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition==3 ? attr : 0, 2);
break;
}
}
#endif
if (attr && s_editMode>0) {
switch (menuHorizontalPosition) {
case 0:
@@ -692,12 +757,52 @@ void menuModelSetup(uint8_t event)
case 1:
if (IS_MODULE_DSM2(EXTERNAL_MODULE))
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, DSM2_PROTO_LP45, DSM2_PROTO_DSMX);
else if (IS_MODULE_MULTIMODULE(EXTERNAL_MODULE)) {
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol, MM_RF_PROTO_FIRST, MM_RF_PROTO_LAST);
if (checkIncDec_Ret)
g_model.moduleData[EXTERNAL_MODULE].subType=0;
}
else
g_model.moduleData[EXTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, RF_PROTO_X16, RF_PROTO_LAST, EE_MODEL, isRfProtocolAvailable);
if (checkIncDec_Ret) {
g_model.moduleData[EXTERNAL_MODULE].channelsStart = 0;
g_model.moduleData[EXTERNAL_MODULE].channelsCount = 0;
}
break;
#if defined(MULTIMODULE)
case 2:
switch (min(g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol, (uint8_t) MM_RF_PROTO_CUSTOM)) {
case MM_RF_PROTO_HISKY:
case MM_RF_PROTO_DSM2:
case MM_RF_PROTO_SYMAX:
case MM_RF_PROTO_KN:
case MM_RF_PROTO_FRSKY:
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].subType, 0, 1);
break;
case MM_RF_PROTO_CG023:
case MM_RF_PROTO_MT99XX:
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].subType, 0, 2);
break;
case MM_RF_PROTO_FLYSKY:
case MM_RF_PROTO_MJXQ:
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].subType, 0, 3);
break;
case MM_RF_PROTO_YD717:
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].subType, 0, 4);
break;
case MM_RF_PROTO_CX10:
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].subType, 0, 7);
break;
case MM_RF_PROTO_CUSTOM:
g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol = 0x20 | checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].multi.rfProtocol & 0x1f, 1, 31, EE_MODEL);
break;
}
break;
case 3:
// Custom protocol, third column is subtype
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].subType, 0, 7);
break;
#endif
}
}
break;
@@ -781,11 +886,13 @@ void menuModelSetup(uint8_t event)
else {
lcd_putsLeft(y, STR_RXNUM);
}
if (IS_MODULE_XJT(moduleIdx) || IS_MODULE_DSM2(moduleIdx)) {
if (IS_MODULE_XJT(moduleIdx) || IS_MODULE_DSM2(moduleIdx) || IS_MODULE_MULTIMODULE(moduleIdx)) {
if (xOffsetBind) lcd_outdezNAtt(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId[moduleIdx], (l_posHorz==0 ? attr : 0) | LEADING0|LEFT, 2);
if (attr && l_posHorz==0) {
if (s_editMode>0) {
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.header.modelId[moduleIdx], IS_MODULE_DSM2(moduleIdx) ? 20 : 63);
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.header.modelId[moduleIdx],
IS_MODULE_DSM2(moduleIdx) ? 20 :
IS_MODULE_MULTIMODULE(moduleIdx) ? 15 : 63);
if (checkIncDec_Ret) {
modelHeaders[g_eeGeneral.currModel].modelId[moduleIdx] = g_model.header.modelId[moduleIdx];
}
@@ -841,8 +948,39 @@ void menuModelSetup(uint8_t event)
}
}
}
#if defined(MULTIMODULE)
else if (IS_MODULE_MULTIMODULE(moduleIdx)) {
switch (g_model.moduleData[moduleIdx].multi.rfProtocol) {
case MM_RF_PROTO_FRSKY:
lcd_putsLeft(y, STR_MULTI_RFTUNE);
break;
case MM_RF_PROTO_HUBSAN:
lcd_putsLeft(y, STR_MULTI_VIDFREQ);
break;
case MM_RF_PROTO_DSM2:
g_model.moduleData[moduleIdx].multi.optionValue = selectMenuItem(MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_DSMFRAME, STR_OPTIONS_DSM, g_model.moduleData[moduleIdx].multi.optionValue, 0, 12, attr, event);
break;
default:
lcd_putsLeft(y, STR_MULTI_OPTION);
break;
}
if (g_model.moduleData[moduleIdx].multi.rfProtocol != MM_RF_PROTO_DSM2) {
lcd_outdezNAtt(MODEL_SETUP_2ND_COLUMN, y, g_model.moduleData[moduleIdx].multi.optionValue, LEFT | attr);
if (attr)
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[moduleIdx].multi.optionValue, -128, 127);
}
}
#endif
break;
}
#if defined(MULTIMODULE)
case ITEM_MODEL_EXTERNAL_MODULE_AUTOBIND:
g_model.moduleData[EXTERNAL_MODULE].multi.autoBindMode = onoffMenuItem(g_model.moduleData[EXTERNAL_MODULE].multi.autoBindMode, MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_AUTOBIND, attr, event);
break;
case ITEM_MODEL_EXTERNAL_MODULE_LOWPOWER:
g_model.moduleData[EXTERNAL_MODULE].multi.lowPowerMode = onoffMenuItem(g_model.moduleData[EXTERNAL_MODULE].multi.lowPowerMode, MODEL_SETUP_2ND_COLUMN, y, STR_MULTI_LOWPOWER, attr, event);
break;
#endif
}
}
+5 -5
View File
@@ -38,8 +38,8 @@
#include "../../timers.h"
#define BIGSIZE MIDSIZE
#define LBOX_CENTERX (BOX_WIDTH/2 + 16)
#define RBOX_CENTERX (LCD_W-LBOX_CENTERX-1)
#define LBOX_CENTERX (BOX_WIDTH/2 + 17)
#define RBOX_CENTERX (LCD_W-LBOX_CENTERX)
#define MODELNAME_X (15)
#define MODELNAME_Y (11)
#define VBATT_X (MODELNAME_X+26)
@@ -564,12 +564,12 @@ void menuMainView(uint8_t event)
if (g_eeGeneral.view == VIEW_INPUTS) {
div_t qr2 = div(qr.rem, 5);
if (i >= 14) qr2.rem += 1;
const coord_t x[4] = { 50, 142 };
const coord_t x[4] = { 50, 144 };
const coord_t y[4] = { 25, 42, 25, 42 };
displaySwitch(x[qr.quot]+qr2.rem*4, y[qr2.quot], 3, i);
}
else {
displaySwitch(17+qr.rem*6, 25+qr.quot*17, 5, i);
displaySwitch(15+qr.rem*6, 25+qr.quot*17, 5, i);
}
}
}
@@ -579,7 +579,7 @@ void menuMainView(uint8_t event)
if (SWITCH_EXISTS(i)) {
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH+i);
getvalue_t sw = ((val < 0) ? 3*i+1 : ((val == 0) ? 3*i+2 : 3*i+3));
putsSwitches((g_eeGeneral.view == VIEW_INPUTS) ? (index<4 ? 8*FW+1 : 23*FW+2) : (index<4 ? 3*FW+1 : 8*FW-2), (index%4)*FH+3*FH, sw, 0);
putsSwitches((g_eeGeneral.view == VIEW_INPUTS) ? (index<4 ? 8*FW+3 : 24*FW+1) : (index<4 ? 3*FW+2 : 8*FW-1), (index%4)*FH+3*FH, sw, 0);
index++;
}
}
+13 -22
View File
@@ -37,11 +37,6 @@
#include "../../opentx.h"
#include "../../timers.h"
#define STATS_1ST_COLUMN FW/2
#define STATS_2ND_COLUMN 12*FW+FW/2
#define STATS_3RD_COLUMN 24*FW+FW/2
#define STATS_LABEL_WIDTH 8*FW
void menuStatisticsView(uint8_t event)
{
TITLE(STR_MENUSTAT);
@@ -63,25 +58,21 @@ void menuStatisticsView(uint8_t event)
break;
}
// Session and Total timers
lcd_putsAtt(STATS_1ST_COLUMN, FH*1+1, "SES", BOLD);
putsTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*1+1, sessionTimer, 0, 0);
lcd_putsAtt(STATS_1ST_COLUMN, FH*2+1, "TOT", BOLD);
putsTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*2+1, g_eeGeneral.globalTimer + sessionTimer, TIMEHOUR, 0);
lcd_puts( 1*FW, FH*0, STR_TOTTM1TM2THRTHP);
putsTimer( 5*FW+5*FWNUM+1, FH*1, timersStates[0].val, 0, 0);
putsTimer( 12*FW+5*FWNUM+1, FH*1, timersStates[1].val, 0, 0);
// Throttle special timers
lcd_putsAtt(STATS_2ND_COLUMN, FH*0+1, "THR", BOLD);
putsTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*0+1, s_timeCumThr, 0, 0);
lcd_putsAtt(STATS_2ND_COLUMN, FH*1+1, "TH%", BOLD);
putsTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*1+1, s_timeCum16ThrP/16, 0, 0);
putsTimer( 5*FW+5*FWNUM+1, FH*2, s_timeCumThr, 0, 0);
putsTimer( 12*FW+5*FWNUM+1, FH*2, s_timeCum16ThrP/16, 0, 0);
// Timers
for (int i=0; i<TIMERS; i++) {
putsStrIdx(STATS_3RD_COLUMN, FH*i+1, "TM", i+1, BOLD);
if (timersStates[i].val > 3600)
putsTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val, TIMEHOUR, 0);
else
putsTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val, 0, 0);
putsTimer( 12*FW+5*FWNUM+1, FH*0, sessionTimer, 0, 0);
lcd_puts( 24*FW, FH*0, "TOT");
putsTimer( 28*FW+5*FWNUM+1, FH*0, g_eeGeneral.globalTimer + sessionTimer, TIMEHOUR, 0);
if (TIMERS == 3) {
lcd_puts( 24*FW, FH*1, "TM3");
putsTimer( 28*FW+5*FWNUM+1, FH*1, timersStates[2].val, TIMEHOUR, 0);
}
#if defined(THRTRACE)
+3 -9
View File
@@ -121,7 +121,6 @@ void displayGaugesTelemetryScreen(FrSkyScreenData & screen)
bool displayNumbersTelemetryScreen(FrSkyScreenData & screen)
{
// Custom Screen with numbers
const coord_t pos[] = {0, 71, 143, 214};
uint8_t fields_count = 0;
for (uint8_t i=0; i<4; i++) {
for (uint8_t j=0; j<NUM_LINE_ITEMS; j++) {
@@ -138,17 +137,11 @@ bool displayNumbersTelemetryScreen(FrSkyScreenData & screen)
}
}
if (field) {
coord_t x = pos[j+1]-2;
coord_t y = (i==3 ? 1+FH+2*FH*i:FH+2*FH*i);
LcdFlags att = (i==3 ? NO_UNIT : DBLSIZE|NO_UNIT);
coord_t pos[] = {0, 71, 143, 214};
if (field >= MIXSRC_FIRST_TIMER && field <= MIXSRC_LAST_TIMER && i!=3) {
// there is not enough space on LCD for displaying "Tmr1" or "Tmr2" and still see the - sign, we write "T1" or "T2" instead
putsStrIdx(pos[j], 1+FH+2*FH*i, "T", field-MIXSRC_FIRST_TIMER+1, 0);
if (timersStates[field-MIXSRC_FIRST_TIMER].val > 3600) {
att += TIMEHOUR - DBLSIZE;
x -= 3*FW;
y += FH/2;
}
}
else if (field >= MIXSRC_FIRST_TELEM && isGPSSensor(1+(field-MIXSRC_FIRST_TELEM)/3) && telemetryItems[(field-MIXSRC_FIRST_TELEM)/3].isAvailable()) {
// we don't display GPS name, no space for it
@@ -167,7 +160,8 @@ bool displayNumbersTelemetryScreen(FrSkyScreenData & screen)
}
}
putsChannel(x, y, field, att);
putsChannel(pos[j+1]-2, (i==3 ? 1+FH+2*FH*i:FH+2*FH*i), field, att);
}
}
}
+4 -13
View File
@@ -332,12 +332,6 @@ The list of valid sources is available:
* for OpenTX 2.1.x Taranis and Taranis Plus at http://downloads-21.open-tx.org/firmware/lua_fields_taranis.txt
* for OpenTX 2.1.x Taranis X9E at http://downloads-21.open-tx.org/firmware/lua_fields_taranis_x9e.txt
In OpenTX 2.1.x the telemetry sources no longer have a predefined name.
To get a telemetry value simply use it's sensor name. For example:
* Altitude sensor has a name "Alt"
* to get the current altitude use the source "Alt"
* to get the minimum altitude use the source "Alt-", to get the maximum use "Alt+"
@param name (string) name of the field
@retval table information about requested field, table elements:
@@ -371,9 +365,7 @@ Returns the value of a source.
The list of valid sources is available:
* for OpenTX 2.0.x at http://downloads-20.open-tx.org/firmware/lua_fields.txt
* for OpenTX 2.1.x at http://downloads-21.open-tx.org/firmware/lua_fields.txt (depreciated)
* for OpenTX 2.1.x Taranis and Taranis Plus at http://downloads-21.open-tx.org/firmware/lua_fields_taranis.txt
* for OpenTX 2.1.x Taranis X9E at http://downloads-21.open-tx.org/firmware/lua_fields_taranis_x9e.txt
* for OpenTX 2.1.x at http://downloads-21.open-tx.org/firmware/lua_fields.txt
In OpenTX 2.1.x the telemetry sources no longer have a predefined name.
To get a telemetry value simply use it's sensor name. For example:
@@ -504,7 +496,7 @@ OpenTX 2.0:
| Unit | Sound | File (.wav) | Automatic conversion rules |
| --- | --- | --- | --- |
| 0 | --- | --- (no unit played) | |
| 0 | | | |
| 1 | Volts | 116 | |
| 2 | Amps | 118 | |
| 3 | Meters per Second | 120 | |
@@ -530,8 +522,7 @@ OpenTX 2.0:
OpenTX 2.1:
| 2.1 Unit | Sound | Sound File (.wav) |
| --- | --- | --- | --- |
| 0 | --- | --- (no unit played) | |
| --- | --- | --- |
| 1 | Volts | 116 |
| 2 | Amps | 118 |
| 3 | Milliamps | 120 |
@@ -583,7 +574,7 @@ Play a time value (text to speech)
static int luaPlayDuration(lua_State *L)
{
int duration = luaL_checkinteger(L, 1);
bool playTime = (luaL_optinteger(L, 2, 0) != 0);
bool playTime = (luaL_checkinteger(L, 2) != 0);
playDuration(duration, playTime ? PLAY_TIME : 0, 0);
return 0;
}
+2 -2
View File
@@ -273,7 +273,7 @@ static int luaModelResetTimer(lua_State *L)
static unsigned int getFirstInput(unsigned int chn)
{
for (unsigned int i=0; i<MAX_EXPOS; i++) {
for (unsigned int i=0; i<MAX_INPUTS; i++) {
ExpoData * expo = expoAddress(i);
if (!expo->srcRaw || expo->chn >= chn) {
return i;
@@ -285,7 +285,7 @@ static unsigned int getFirstInput(unsigned int chn)
static unsigned int getInputsCountFromFirst(unsigned int chn, unsigned int first)
{
unsigned int count = 0;
for (unsigned int i=first; i<MAX_EXPOS; i++) {
for (unsigned int i=first; i<MAX_INPUTS; i++) {
ExpoData * expo = expoAddress(i);
if (!expo->srcRaw || expo->chn!=chn) break;
count++;
+48 -6
View File
@@ -422,13 +422,24 @@ PACK(typedef struct {
int8_t rfProtocol:4;
uint8_t channelsStart;
int8_t channelsCount; // 0=8 channels
uint8_t failsafeMode:7;
uint8_t failsafeMode:4;
uint8_t subType:3;
uint8_t invertedSerial:1; // telemetry serial inverted from standard
int16_t failsafeChannels[NUM_CHNOUT];
int8_t ppmDelay:6;
uint8_t ppmPulsePol:1;
uint8_t ppmOutputType:1; // false = open drain, true = push pull
int8_t ppmFrameLength;
union {
struct {
int8_t ppmDelay:6;
uint8_t ppmPulsePol:1;
uint8_t ppmOutputType:1; // false = open drain, true = push pull
int8_t ppmFrameLength;
};
struct {
uint8_t rfProtocol:6; // can be changed to rfProtocol if rfProtocol gets more bits, currently 6 bits used
uint8_t autoBindMode:1;
uint8_t lowPowerMode:1;
int8_t optionValue;
} multi;
};
}) ModuleData;
#define SET_DEFAULT_PPM_FRAME_LENGTH(idx) g_model.moduleData[idx].ppmFrameLength = 4 * max((int8_t)0, g_model.moduleData[idx].channelsCount)
@@ -2025,11 +2036,14 @@ enum Protocols {
PROTO_CROSSFIRE,
#endif
#if defined(IRPROTOS)
// we will need 4 bytes for proto :(
// we will need 4 bits for proto :(
PROTO_SILV,
PROTO_TRAC09,
PROTO_PICZ,
PROTO_SWIFT,
#endif
#if defined(MULTIMODULE)
PROTO_MULTIMODULE,
#endif
PROTO_MAX,
PROTO_NONE
@@ -2043,6 +2057,31 @@ enum RFProtocols {
RF_PROTO_LAST = RF_PROTO_LR12
};
enum MultiModuleRFProtocols {
MM_RF_PROTO_FLYSKY=0,
MM_RF_PROTO_FIRST=MM_RF_PROTO_FLYSKY,
MM_RF_PROTO_HUBSAN,
MM_RF_PROTO_FRSKY,
MM_RF_PROTO_HISKY,
MM_RF_PROTO_V2X2,
MM_RF_PROTO_DSM2,
MM_RF_PROTO_DEVO,
MM_RF_PROTO_YD717,
MM_RF_PROTO_KN,
MM_RF_PROTO_SYMAX,
MM_RF_PROTO_SLT,
MM_RF_PROTO_CX10,
MM_RF_PROTO_CG023,
MM_RF_PROTO_BAYANG,
MM_RF_PROTO_ESky,
MM_RF_PROTO_MT99XX,
MM_RF_PROTO_MJXQ,
MM_RF_PROTO_SHENQI,
MM_RF_PROTO_FY326,
MM_RF_PROTO_CUSTOM,
MM_RF_PROTO_LAST= MM_RF_PROTO_CUSTOM
};
#define HAS_RF_PROTOCOL_FAILSAFE(rf) ((rf) == RF_PROTO_X16)
#define HAS_RF_PROTOCOL_MODELINDEX(rf) (((rf) == RF_PROTO_X16) || ((rf) == RF_PROTO_LR12))
@@ -2061,6 +2100,9 @@ enum ModuleTypes {
#endif
#if defined(CROSSFIRE)
MODULE_TYPE_CROSSFIRE,
#endif
#if defined(MULTIMODULE)
MODULE_TYPE_MULTIMODULE,
#endif
MODULE_TYPE_COUNT
};
+4 -55
View File
@@ -1428,13 +1428,6 @@ uint16_t BandGap = 2040 ;
uint16_t BandGap ;
#endif
#if defined(JITTER_MEASURE)
JitterMeter<uint16_t> rawJitter[NUMBER_ANALOG];
JitterMeter<uint16_t> avgJitter[NUMBER_ANALOG];
tmr10ms_t jitterResetTime = 0;
#define JITTER_MEASURE_ACTIVE() (menuHandlers[menuLevel] == menuGeneralDiagAna)
#endif // defined(JITTER_MEASURE)
#if !defined(SIMU)
uint16_t anaIn(uint8_t chan)
{
@@ -1471,28 +1464,10 @@ void getADC()
{
uint16_t temp[NUMBER_ANALOG] = { 0 };
#if defined(JITTER_MEASURE)
if (JITTER_MEASURE_ACTIVE() && jitterResetTime < get_tmr10ms()) {
for (uint32_t x=0; x<NUMBER_ANALOG; x++) {
rawJitter[x].reset();
avgJitter[x].reset();
}
jitterResetTime = get_tmr10ms() + 100; //every second
}
#endif
for (uint32_t i=0; i<4; i++) {
adcRead();
for (uint32_t x=0; x<NUMBER_ANALOG; x++) {
#if defined(JITTER_MEASURE)
uint16_t val = getAnalogValue(x);
if (JITTER_MEASURE_ACTIVE()) {
rawJitter[x].measure(val);
}
temp[x] += val;
#else
temp[x] += getAnalogValue(x);
#endif
}
#if defined(VIRTUALINPUTS)
if (calibrationState) break;
@@ -1501,29 +1476,8 @@ void getADC()
for (uint32_t x=0; x<NUMBER_ANALOG; x++) {
uint16_t v = temp[x] >> 3;
#if defined(VIRTUALINPUTS)
if (calibrationState) {
v = temp[x] >> 1;
}
#if defined(JITTER_FILTER)
else {
// jitter filter
uint16_t diff = (v > s_anaFilt[x]) ? (v - s_anaFilt[x]) : (s_anaFilt[x] - v);
if (diff < 10) {
// apply filter
v = (7 * s_anaFilt[x] + v) >> 3;
}
}
#endif
#if defined(JITTER_MEASURE)
if (JITTER_MEASURE_ACTIVE()) {
avgJitter[x].measure(v);
}
#endif
if (calibrationState) v = temp[x] >> 1;
StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[x];
if (!calibrationState && IS_POT_MULTIPOS(x) && calib->count>0 && calib->count<XPOTS_MULTIPOS_COUNT) {
uint8_t vShifted = (v >> 4);
@@ -1535,11 +1489,9 @@ void getADC()
}
}
}
else
else
#endif
{
s_anaFilt[x] = v;
}
s_anaFilt[x] = v;
}
}
#endif
@@ -2521,12 +2473,9 @@ int main(void)
#if defined(CPUM2560) || defined(CPUM2561)
uint8_t mcusr = MCUSR; // save the WDT (etc) flags
MCUSR = 0; // must be zeroed before disabling the WDT
MCUCR = 0x80 ; // Disable JTAG port that can interfere with POT3
MCUCR = 0x80 ; // Must be done twice
#elif defined(PCBSTD)
uint8_t mcusr = MCUCSR;
MCUCSR = 0x80 ; // Disable JTAG port that can interfere with POT3
MCUCSR = 0x80 ; // Must be done twice
MCUCSR = 0;
#endif
#if defined(PCBTARANIS)
g_eeGeneral.contrast=30;
+6 -6
View File
@@ -503,6 +503,11 @@
#else
#define IS_MODULE_CROSSFIRE(idx) (false)
#endif
#if defined(MULTIMODULE)
#define IS_MODULE_MULTIMODULE(idx) (idx==EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_MULTIMODULE)
#else
#define IS_MODULE_MULTIMODULE(idx) (false)
#endif
#if defined(TARANIS_INTERNAL_PPM)
#define MAX_INTERNAL_MODULE_CHANNELS() ((g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_XJT) ? maxChannelsXJT[1+g_model.moduleData[0].rfProtocol] : maxChannelsModules[g_model.moduleData[INTERNAL_MODULE].type])
#else
@@ -510,7 +515,7 @@
#endif
#define MAX_EXTERNAL_MODULE_CHANNELS() ((g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_XJT) ? maxChannelsXJT[1+g_model.moduleData[1].rfProtocol] : maxChannelsModules[g_model.moduleData[EXTERNAL_MODULE].type])
#define MAX_CHANNELS(idx) (idx==INTERNAL_MODULE ? MAX_INTERNAL_MODULE_CHANNELS() : (idx==EXTERNAL_MODULE ? MAX_EXTERNAL_MODULE_CHANNELS() : MAX_TRAINER_CHANNELS()))
#define NUM_CHANNELS(idx) (IS_MODULE_CROSSFIRE(idx) ? CROSSFIRE_CHANNELS_COUNT : (8+g_model.moduleData[idx].channelsCount))
#define NUM_CHANNELS(idx) ((IS_MODULE_CROSSFIRE(idx) || IS_MODULE_MULTIMODULE(idx)) ? CROSSFIRE_CHANNELS_COUNT : (8+g_model.moduleData[idx].channelsCount))
#elif defined(PCBSKY9X) && !defined(REVA)
#define IS_MODULE_PPM(idx) (idx==TRAINER_MODULE || idx==EXTRA_MODULE || (idx==EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_PPM))
#define IS_MODULE_XJT(idx) (idx==EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type==MODULE_TYPE_XJT)
@@ -1789,9 +1794,4 @@ extern Clipboard clipboard;
extern uint16_t s_anaFilt[NUMBER_ANALOG];
#endif
#if defined(JITTER_MEASURE)
extern JitterMeter<uint16_t> rawJitter[NUMBER_ANALOG];
extern JitterMeter<uint16_t> avgJitter[NUMBER_ANALOG];
#endif // defined(JITTER_MEASURE)
#endif
+169
View File
@@ -0,0 +1,169 @@
/*
* Copyright (C) OpenTX
*
* Based on code named
* th9x - http://code.google.com/p/th9x
* er9x - http://code.google.com/p/er9x
* gruvin9x - http://code.google.com/p/gruvin9x
*
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "opentx.h"
// for the MULTI protocol definition
// see https://github.com/pascallanger/DIY-Multiprotocol-TX-Module
// file Multiprotocol/multiprotocol.h
/* The protocol is heavily inspired by the DSM2 protocol, so reuse some the definitions where they are identical */
#define MULTI_SEND_BIND (1 << 7)
#define MULTI_SEND_RANGECHECK (1 << 5)
#define MULTI_SEND_AUTOBIND (1 << 6)
#define BITLEN_MULTI (10*2) //100000 Baud => 10uS per bit
static void _send_level(uint8_t v)
{
/* Copied over from DSM, this looks doubious and in my logic analyzer
output the low->high is about 2 ns late */
if (modulePulsesData[EXTERNAL_MODULE].dsm2.index == 0)
v -= 2;
else
v += 2;
modulePulsesData[EXTERNAL_MODULE].dsm2.value += v;
*modulePulsesData[EXTERNAL_MODULE].dsm2.ptr++ = modulePulsesData[EXTERNAL_MODULE].dsm2.value;
modulePulsesData[EXTERNAL_MODULE].dsm2.index = (modulePulsesData[EXTERNAL_MODULE].dsm2.index+1) % 2;
}
static void sendByteMulti(uint8_t b) //max 11 changes 0 10 10 10 10 P 1
{
bool lev = 0;
uint8_t parity = 1;
uint8_t len = BITLEN_MULTI; //max val: 10*20 < 256
for (uint8_t i=0; i<=9; i++) { //8Bits + 1Parity + Stop=1
bool nlev = b & 1; //lsb first
parity = parity ^ nlev;
if (lev == nlev) {
len += BITLEN_MULTI;
}
else {
_send_level(len);
len = BITLEN_MULTI;
lev = nlev;
}
b = (b>>1) | 0x80; //shift in ones for stop bit and parity
if (i==7)
b = b ^ parity; // lowest bit is one from previous line
}
_send_level(len+2*BITLEN_MULTI); // 2Stop bits
}
// This is the data stream to send, prepare after 19.5 mS
// Send after 22.5 mS
//static uint8_t *Dsm2_pulsePtr = pulses2MHz.pbyte ;
#define MULTI_CHANS 16
#define MULTI_CHAN_BITS 11
void setupPulsesMultimodule(unsigned int port)
{
#if defined(PPM_PIN_HW_SERIAL)
modulePulsesData[EXTERNAL_MODULE].dsm2.serialByte = 0 ;
modulePulsesData[EXTERNAL_MODULE].dsm2.serialBitCount = 0 ;
#else
modulePulsesData[EXTERNAL_MODULE].dsm2.value = 0;
modulePulsesData[EXTERNAL_MODULE].dsm2.index = 1;
#endif
modulePulsesData[EXTERNAL_MODULE].dsm2.ptr = modulePulsesData[EXTERNAL_MODULE].dsm2.pulses;
#if defined(PCBTARANIS)
modulePulsesData[EXTERNAL_MODULE].dsm2.value = 100;
*modulePulsesData[EXTERNAL_MODULE].dsm2.ptr++ = modulePulsesData[EXTERNAL_MODULE].dsm2.value;
#endif
// header, byte 0, always 0x55
sendByteMulti(0x55);
// byte 1+2, protocol information
int type = g_model.moduleData[port].multi.rfProtocol +1;
int subtype = g_model.moduleData[port].subType;
uint8_t protoByte=0;
if (moduleFlag[port] == MODULE_BIND)
protoByte |= MULTI_SEND_BIND;
else if (moduleFlag[port] == MODULE_RANGECHECK)
protoByte |= MULTI_SEND_RANGECHECK;
// rfProtocol
// 15 for Multimodule is FrskyX or D16 which we map as a subprotocol of 3 (FrSky)
// all protos > frskyx are therefore also off by one
if (type >=15)
type= type +1;
if (g_model.moduleData[port].multi.rfProtocol == MM_RF_PROTO_FRSKY) {
if(subtype == 1)
type = 3;
else
type = 15;
subtype = 0;
}
if (g_model.moduleData[port].multi.rfProtocol >= MM_RF_PROTO_CUSTOM)
type = g_model.moduleData[port].multi.rfProtocol & 0x1f;
protoByte |= (type & 0x1f) | (g_model.moduleData[port].multi.autoBindMode << 6);
sendByteMulti(protoByte);
// power always set to high (0 << 7)
sendByteMulti((g_model.header.modelId[port] & 0x0f)
| ((subtype & 0x7) << 4)
| (g_model.moduleData[port].multi.lowPowerMode << 7)
);
//TODO: option_protocol, use same default as multi module
// byte 3
sendByteMulti(g_model.moduleData[port].multi.optionValue);
uint32_t bits = 0;
uint8_t bitsavailable = 0;
// byte 4-25, channels 0..2047
// ?? Range for pulses (channelsOutputs) is [-1024:+1024]
for (int i=0; i<MULTI_CHANS; i++) {
int channel = g_model.moduleData[port].channelsStart+i;
int value = channelOutputs[channel] + 2*PPM_CH_CENTER(channel) - 2*PPM_CENTER;
bits |= limit(0, 1024 + value, 2047) << bitsavailable;
bitsavailable += MULTI_CHAN_BITS;
while (bitsavailable >= 8) {
sendByteMulti((uint8_t) (bits & 0xff));
bits >>= 8;
bitsavailable -= 8;
}
}
putDsm2Flush();
}
+10
View File
@@ -84,6 +84,16 @@ enum ModuleFlag
#define IS_DSM2_SERIAL_PROTOCOL(protocol) (0)
#endif
#if defined(MULTIMODULE)
#define IS_MULTIMODULE_PROTOCOL(protocol) (protocol==PROTO_MULTIMODULE)
#if !defined(DSM2)
#error You need to enable DSM2 = PPM for MULTIMODULE support
#endif
#else
#define IS_MULTIMODULE_PROTOCOL(protocol) (0)
#endif
#if defined(CPUARM)
#include "pulses_arm.h"
#else
+20
View File
@@ -80,6 +80,11 @@ void setupPulses(unsigned int port)
case MODULE_TYPE_XJT:
required_protocol = PROTO_PXX;
break;
#if defined(MULTIMODULE)
case MODULE_TYPE_MULTIMODULE:
required_protocol = PROTO_MULTIMODULE;
break;
#endif
#if defined(PCBTARANIS) && defined(DSM2)
case MODULE_TYPE_DSM2:
required_protocol = limit<uint8_t>(PROTO_DSM2_LP45, PROTO_DSM2_LP45+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, PROTO_DSM2_DSMX);
@@ -139,6 +144,11 @@ void setupPulses(unsigned int port)
case PROTO_CROSSFIRE:
disable_crossfire(port);
break;
#endif
#if defined(MULTIMODULE)
case PROTO_MULTIMODULE:
disable_dsm2(port);
break;
#endif
case PROTO_PPM:
disable_ppm(port);
@@ -165,6 +175,11 @@ void setupPulses(unsigned int port)
case PROTO_CROSSFIRE:
init_crossfire(port);
break;
#endif
#if defined(MULTIMODULE)
case PROTO_MULTIMODULE:
init_dsm2(port);
break;
#endif
case PROTO_PPM:
init_ppm(port);
@@ -198,6 +213,11 @@ void setupPulses(unsigned int port)
}
break;
}
#endif
#if defined(MULTIMODULE)
case PROTO_MULTIMODULE:
setupPulsesMultimodule(port);
break;
#endif
case PROTO_PPM:
setupPulsesPPM(port);
+4
View File
@@ -107,11 +107,15 @@ union TrainerPulsesData {
extern ModulePulsesData modulePulsesData[NUM_MODULES];
extern TrainerPulsesData trainerPulsesData;
extern const uint16_t CRCTable[];
void setupPulses(unsigned int port);
void setupPulsesDSM2(unsigned int port);
void setupPulsesMultimodule(unsigned int port);
void setupPulsesPXX(unsigned int port);
void setupPulsesPPM(unsigned int port);
void sendByteDsm2(uint8_t b);
void putDsm2Flush();
void createCrossfireFrame(uint8_t * frame, int16_t * pulses);
+230 -218
View File
@@ -73,8 +73,8 @@ inline void DSM2_EnableTXD(void)
}
#endif
void set_timer3_capture(void);
void set_timer3_ppm(void);
void set_timer3_capture( void ) ;
void set_timer3_ppm( void ) ;
void startPulses()
{
@@ -110,62 +110,58 @@ uint8_t *pulses2MHzWPtr = pulses2MHz;
#define CTRL_REP_1CMD -3
#define CTRL_REP_2CMD -6
#define SETUP_PULSES_DURATION 1000 // 500us
uint8_t g_ppmPulsePolarity = 0; // Needed for Bit-bang PPM.
#define SETUP_PULSES_DURATION 1000/*500us*/
// TIMER1_COMPA_vect used for PPM and DSM2=SERIAL.
ISR(TIMER1_COMPA_vect) // 2MHz pulse generation (BLOCKING ISR).
// TIMER1_COMPA_vect used for PPM and DSM2=SERIAL
uint8_t g_ppmPulsePolarity = 0;
ISR(TIMER1_COMPA_vect) //2MHz pulse generation (BLOCKING ISR)
{
uint8_t dt = TCNT1L; // Record Timer1 latency for DEBUG stats display.
// Call setupPulses only after "rest" period has elapsed.
// Must do this before toggle PORTB to keep timing accurate.
uint8_t dt = TCNT1L; // record Timer1 latency for DEBUG stats display
// Call setupPulses only after REST pulse had been sent.
// Must do this before toggle PORTB to keep timing accurate
if (IS_DSM2_SERIAL_PROTOCOL(s_current_protocol[0]) || *((uint16_t*)pulses2MHzRPtr) == 0) {
if (!IS_DSM2_SERIAL_PROTOCOL(s_current_protocol[0])) {
OCR1A = SETUP_PULSES_DURATION;
#if defined(CPUM2560) // CPUM2560 hardware toggled PPM out.
OCR1B = OCR1A;
if (g_model.pulsePol) {
TCCR1A = (TCCR1A | (1<<COM1B1)) & ~(1<<COM1B0); // Set idle level.
}
else {
TCCR1A |= 3<<COM1B0;
}
TCCR1C = 1<<FOC1B; // Strobe FOC1B.
TCCR1A = (TCCR1A | (1<<COM1B0)) & ~(1<<COM1B1); // Toggle OC1B on next match.
#endif
}
setupPulses(); // Does not sei() for setupPulsesPPM.
setupPulses(); // does not sei() for setupPulsesPPM
heartbeat |= HEART_TIMER_PULSES;
return;
}
if (s_current_protocol[0] != PROTO_NONE) {
#if !defined(CPUM2560)
// Original Bit-bang for PPM.
// Original bitbang for PPM
if (s_current_protocol[0] != PROTO_NONE) {
if (g_ppmPulsePolarity) {
PORTB |= (1<<OUT_B_PPM); // GCC optimisation should result in a single SBI instruction
PORTB |= (1<<OUT_B_PPM); // GCC optimisation should result in a single SBI instruction
g_ppmPulsePolarity = 0;
}
else {
PORTB &= ~(1<<OUT_B_PPM);
g_ppmPulsePolarity = 1;
}
}
#else // defined(CPUM2560)
// CPUM2560 hardware toggled PPM out.
if (*(uint16_t*)(pulses2MHzRPtr + sizeof(uint16_t)) == 0) {
// Look one step ahead to see if we are currently the "rest" period.
OCR1B = 0xffff; // Prevent next compare match hence toggle.
// CPUM2560 zero jitter hardware toggled PPM_out
OCR1B = *((uint16_t*)pulses2MHzRPtr); // duplicate capture (Timer1 in CTC mode, so restricted to OCR1A for int vector)
// Toggle bit: Can't read PPM_OUT I/O pin when OC1B is connected (on the ATmega2560 -- can on ATmega64A!)
// so need to use pusePol register to keep track of PPM_out polarity.
if (s_current_protocol[0] != PROTO_NONE) {
if (g_ppmPulsePolarity) {
TCCR1A = (3<<COM1B0); // SET the state of PB6(OC1B)/PPM_out on next TCNT1==OCR1B
g_ppmPulsePolarity = 0;
}
else {
OCR1B = *((uint16_t*) pulses2MHzRPtr);
TCCR1A = (2<<COM1B0); // CLEAR the state of PB6(OC1B)/PPM_out on next TCNT1==OCR1B
g_ppmPulsePolarity = 1;
}
#endif
}
#endif
OCR1A = *((uint16_t*) pulses2MHzRPtr); // Schedule next Timer1 interrupt vector (to this function).
pulses2MHzRPtr += sizeof(uint16_t); // Non PPM protocols use uint8_t pulse buffer.
OCR1A = *((uint16_t*)pulses2MHzRPtr); // Schedule next Timer1 interrupt vector (to this function)
pulses2MHzRPtr += sizeof(uint16_t); // non PPM protocols use uint8_t pulse buffer
if (dt > g_tmr1Latency_max) g_tmr1Latency_max = dt;
if (dt < g_tmr1Latency_min) g_tmr1Latency_min = dt;
}
@@ -246,61 +242,67 @@ const pm_uint16_t CRCTable[] PROGMEM =
0x7bc7,0x6a4e,0x58d5,0x495c,0x3de3,0x2c6a,0x1ef1,0x0f78
};
uint8_t PcmByte;
uint8_t PcmBitCount;
uint16_t PcmCrc;
uint8_t PcmOnesCount;
uint8_t PcmByte ;
uint8_t PcmBitCount ;
uint16_t PcmCrc ;
uint8_t PcmOnesCount ;
void crc(uint8_t data)
void crc( uint8_t data )
{
PcmCrc = (PcmCrc<<8) ^ pgm_read_word(&CRCTable[((PcmCrc >> 8) ^ data) & 0xFF]);
PcmCrc=(PcmCrc<<8)^pgm_read_word(&CRCTable[((PcmCrc>>8)^data) & 0xFF]);
}
void putPcmPart(uint8_t value)
void putPcmPart( uint8_t value )
{
PcmByte >>= 2;
PcmByte |= value;
if (++PcmBitCount >= 4) {
*pulses2MHzWPtr++ = PcmByte;
PcmBitCount = PcmByte = 0;
}
PcmByte >>= 2 ;
PcmByte |= value ;
if ( ++PcmBitCount >= 4 )
{
*pulses2MHzWPtr++ = PcmByte ;
PcmBitCount = PcmByte = 0 ;
}
}
void putPcmFlush()
{
while (PcmBitCount != 0) {
putPcmPart(0); // Empty
}
*pulses2MHzWPtr = 0; // Mark end
while ( PcmBitCount != 0 )
{
putPcmPart( 0 ) ; // Empty
}
*pulses2MHzWPtr = 0 ; // Mark end
}
void putPcmBit(uint8_t bit)
void putPcmBit( uint8_t bit )
{
if (bit) {
PcmOnesCount += 1;
putPcmPart(0x80);
}
else {
PcmOnesCount = 0;
putPcmPart(0xC0);
}
if (PcmOnesCount >= 5) {
putPcmBit(0); // Stuff a 0 bit in
}
if ( bit )
{
PcmOnesCount += 1 ;
putPcmPart( 0x80 ) ;
}
else
{
PcmOnesCount = 0 ;
putPcmPart( 0xC0 ) ;
}
if ( PcmOnesCount >= 5 )
{
putPcmBit( 0 ) ; // Stuff a 0 bit in
}
}
void putPcmByte(uint8_t byte)
void putPcmByte( uint8_t byte )
{
uint8_t i;
uint8_t i ;
crc(byte);
crc( byte ) ;
for (i=0; i<8; i++) {
putPcmBit(byte & 0x80);
byte <<= 1;
}
for (i=0; i<8; i++)
{
putPcmBit( byte & 0x80 ) ;
byte <<= 1 ;
}
}
@@ -308,57 +310,57 @@ void putPcmHead()
{
// send 7E, do not CRC
// 01111110
putPcmPart(0xC0);
putPcmPart(0x80);
putPcmPart(0x80);
putPcmPart(0x80);
putPcmPart(0x80);
putPcmPart(0x80);
putPcmPart(0x80);
putPcmPart(0xC0);
putPcmPart( 0xC0 ) ;
putPcmPart( 0x80 ) ;
putPcmPart( 0x80 ) ;
putPcmPart( 0x80 ) ;
putPcmPart( 0x80 ) ;
putPcmPart( 0x80 ) ;
putPcmPart( 0x80 ) ;
putPcmPart( 0xC0 ) ;
}
uint16_t scaleForPXX(uint8_t i)
uint16_t scaleForPXX( uint8_t i )
{
int16_t value = ((i < 16) ? channelOutputs[i] * 3 / 4 : 0) + 1024;
int16_t value = ( ( i < 16 ) ? channelOutputs[i] * 3 / 4 : 0 ) + 1024;
return limit<uint16_t>(1, value, 2046);
}
void setupPulsesPXX()
{
uint16_t chan;
uint16_t chan_1;
uint16_t chan ;
uint16_t chan_1 ;
pulses2MHzWPtr = pulses2MHz;
pulses2MHzRPtr = pulses2MHz;
pulses2MHzWPtr = pulses2MHz;
pulses2MHzRPtr = pulses2MHz;
PcmCrc = 0;
PcmBitCount = PcmByte = 0;
PcmOnesCount = 0;
putPcmHead();
putPcmByte(g_model.header.modelId[0]);
uint8_t flag1 = 0;
if (moduleFlag[0] == MODULE_BIND)
flag1 |= (g_eeGeneral.countryCode << 1) | PXX_SEND_BIND;
else if (moduleFlag[0] == MODULE_RANGECHECK)
flag1 |= PXX_SEND_RANGECHECK;
putPcmByte(flag1); // First byte of flags
putPcmByte(0); // Second byte of flags
for (uint8_t i=0; i<8; i+=2) { // First 8 channels only
chan = scaleForPXX(i);
chan_1 = scaleForPXX(i+1);
putPcmByte(chan); // Low byte of channel
putPcmByte(((chan >> 8) & 0x0F) | (chan_1 << 4)); // 4 bits each from 2 channels
putPcmByte(chan_1 >> 4); // High byte of channel
}
putPcmByte(0);
chan = PcmCrc; // get the crc
putPcmByte(chan>>8); // Checksum lo
putPcmByte(chan); // Checksum hi
putPcmHead();
putPcmFlush();
OCR1C += 40000; // 20mS on
PORTB |= (1<<OUT_B_PPM);
PcmCrc = 0 ;
PcmBitCount = PcmByte = 0 ;
PcmOnesCount = 0 ;
putPcmHead() ;
putPcmByte(g_model.header.modelId[0]);
uint8_t flag1 = 0;
if (moduleFlag[0] == MODULE_BIND)
flag1 |= (g_eeGeneral.countryCode << 1) | PXX_SEND_BIND;
else if (moduleFlag[0] == MODULE_RANGECHECK)
flag1 |= PXX_SEND_RANGECHECK;
putPcmByte(flag1) ; // First byte of flags
putPcmByte( 0 ) ; // Second byte of flags
for (uint8_t i=0; i<8; i+=2) { // First 8 channels only
chan = scaleForPXX(i);
chan_1 = scaleForPXX(i+1);
putPcmByte( chan ) ; // Low byte of channel
putPcmByte( ( ( chan >> 8 ) & 0x0F ) | ( chan_1 << 4) ) ; // 4 bits each from 2 channels
putPcmByte( chan_1 >> 4 ) ; // High byte of channel
}
putPcmByte(0);
chan = PcmCrc ; // get the crc
putPcmByte( chan>>8 ) ; // Checksum lo
putPcmByte( chan ) ; // Checksum hi
putPcmHead( ) ;
putPcmFlush() ;
OCR1C += 40000 ; // 20mS on
PORTB |= (1<<OUT_B_PPM);
}
#endif
@@ -367,7 +369,7 @@ void setupPulsesPXX()
// DSM2 protocol pulled from th9x - Thanks thus!!!
//http://www.rclineforum.de/forum/board49-zubeh-r-elektronik-usw/fernsteuerungen-sender-und-emp/neuer-9-kanal-sender-f-r-70-au/Beitrag_3897736#post3897736
//(dsm2(LP4DSM aus den RTF (Ready To Fly) Sendern von Spektrum.
//(dsm2( LP4DSM aus den RTF ( Ready To Fly ) Sendern von Spektrum.
//http://www.rcgroups.com/forums/showpost.php?p=18554028&postcount=237
// /home/thus/txt/flieger/PPMtoDSM.c
/*
@@ -491,30 +493,30 @@ inline void _send_1(uint8_t v)
#define BITLEN_DSM2 (8*2) //125000 Baud
void sendByteDsm2(uint8_t b) //max 10changes 0 10 10 10 10 1
{
bool lev = 0;
uint8_t len = BITLEN_DSM2; //max val: 9*16 < 256
for (uint8_t i=0; i<=8; i++) { //8Bits + Stop=1
bool nlev = b & 1; //lsb first
if (lev == nlev){
len += BITLEN_DSM2;
}
else {
bool lev = 0;
uint8_t len = BITLEN_DSM2; //max val: 9*16 < 256
for (uint8_t i=0; i<=8; i++) { //8Bits + Stop=1
bool nlev = b & 1; //lsb first
if (lev == nlev){
len += BITLEN_DSM2;
}
else {
#if defined(CPUM2560)
// G: Compensate for main clock synchronisation -- to get accurate 8us bit length
// NOTE: This has now been tested as NOT required on the stock board, with the ATmega64A chip.
_send_1(nlev ? len-5 : len+3);
// G: Compensate for main clock synchronisation -- to get accurate 8us bit length
// NOTE: This has now been tested as NOT required on the stock board, with the ATmega64A chip.
_send_1(nlev ? len-5 : len+3);
#else
_send_1(len-1);
_send_1(len-1);
#endif
len = BITLEN_DSM2;
lev = nlev;
len = BITLEN_DSM2;
lev = nlev;
}
b = (b>>1) | 0x80; //shift in stop bit
}
b = (b>>1) | 0x80; //shift in stop bit
}
#if defined (CPUM2560)
_send_1(len+BITLEN_DSM2+3); // 2 stop bits
_send_1(len+BITLEN_DSM2+3); // 2 stop bits
#else
_send_1(len+BITLEN_DSM2-1); // 2 stop bits
_send_1(len+BITLEN_DSM2-1); // 2 stop bits
#endif
}
@@ -578,6 +580,9 @@ void setupPulsesDSM2()
/****** END DSM2=PPM ********/
#if defined(IRPROTOS)
static void _send_u8(uint8_t u8)
{
@@ -590,7 +595,7 @@ static void _send_u8(uint8_t u8)
: [p]"=z"(pulses2MHzWPtr)
: "%[p]"(pulses2MHzWPtr)
, [u]"r"(u8)
);
);
#endif
}
@@ -606,7 +611,7 @@ static void _send_u16(uint16_t u16)
: [p]"=z"(pulses2MHzWPtr)
: "%[p]"(pulses2MHzWPtr)
, [t0]"r"(u16)
);
);
#endif
}
@@ -671,31 +676,26 @@ void picco_sendBn(uint8_t bits, uint8_t n)
while (n--) picco_sendB1(bits & (1<<n));
}
#define BITS 10
#define BITS2 (BITS-1)
NOINLINE uint8_t reduce7u(int16_t v, uint8_t sfr)
{
v += (1<<BITS2);
if (v < 0) v=0;
if (v >= (1<<BITS)) v=(1<<BITS)-1;
return v >> sfr;
if(v < 0) v=0;
if(v >= (1<<BITS)) v=(1<<BITS)-1;
return v>>sfr;
}
NOINLINE int8_t reduce7s(int16_t v, uint8_t sfr, uint8_t sf2, int8_t ofs2)
{
v += (1<<BITS2) + sf2;
if (v & (1<<BITS)) {
v = (1<<BITS)-1; // no overflow
}
v += (1<<BITS2)+sf2;
if(v&(1<<BITS)) v = (1<<BITS)-1; //no overflow
int8_t i8 = (uint16_t)v>>sfr;
if (i8 <= 0) {
i8 = 1;
}
i8 -= ofs2;
if (i8 >= ofs2) {
i8 = ofs2-1; //no overflow
}
if(i8<=0) i8=1;
i8-=ofs2;
if(i8>=ofs2) i8=ofs2-1;//no overflow
return i8;
}
@@ -751,22 +751,21 @@ void setupPulses()
uint8_t required_protocol = g_model.protocol;
#if defined(DEBUG) && !defined(VOICE)
PORTH |= 0x80; // PORTH:7 LOW->HIGH signals start of setupPulses()
PORTH |= 0x80; // PORTH:7 LOW->HIGH signals start of setupPulses()
#endif
if (s_pulses_paused) {
if (s_pulses_paused)
required_protocol = PROTO_NONE;
}
#if defined(CPUM2560) && defined(DSM2_PPM) && defined(TX_CADDY)
// This should be here, executed on every loop, to ensure re-setting of the
// TX moudle power control output register, in case of electrical glitch.
// (Following advice of Atmel for MCU's used in industrial / mission cricital
// applications.)
if (IS_DSM2_PROTOCOL(required_protocol))
PORTH &= ~0x80;
else
PORTH |= 0x80;
if (IS_DSM2_PROTOCOL(required_protocol))
PORTH &= ~0x80;
else
PORTH |= 0x80;
#endif
if (s_current_protocol[0] != required_protocol) {
@@ -787,13 +786,14 @@ void setupPulses()
TIMSK1 &= ~(1<<OCIE1C); // COMPC1 off
TIFR1 = 0x2F;
#else
TIMSK &= ~0x3C; // All interrupts off
ETIMSK &= ~(1<<OCIE1C); // COMPC1 off
TIFR = 0x3C; // Clear all pending interrupts
ETIFR = 0x3F; // Clear all pending interrupts
TIMSK &= ~0x3C ; // All interrupts off
ETIMSK &= ~(1<<OCIE1C) ; // COMPC1 off
TIFR = 0x3C ; // Clear all pending interrupts
ETIFR = 0x3F ; // Clear all pending interrupts
#endif
switch (required_protocol) {
#if defined(DSM2_PPM) // For DSM2=SERIAL, the default: case is executed, below
case PROTO_DSM2_LP45:
case PROTO_DSM2_DSM2:
@@ -843,7 +843,7 @@ void setupPulses()
TIMSK |= 0x10; // Enable COMPA
TCCR1A = (0<<WGM10);
#endif
TCCR1B = (1 << WGM12) | (2<<CS10); // CTC OCRA, 16MHz / 8
TCCR1B = (1 << WGM12) | (2<<CS10) ; // CTC OCRA, 16MHz / 8
setupPulsesPPM(PROTO_PPM16);
OCR3A = 50000;
OCR3B = 5000;
@@ -859,7 +859,7 @@ void setupPulses()
OCR3B = 5000;
set_timer3_ppm();
PORTB &= ~(1<<OUT_B_PPM); // Hold PPM output low
break;
break ;
#if defined(DSM2_SERIAL) && defined(FRSKY)
case PROTO_DSM2_LP45:
@@ -891,6 +891,7 @@ void setupPulses()
}
switch(required_protocol) {
#if defined(PXX)
case PROTO_PXX:
// schedule next Mixer calculations
@@ -939,8 +940,9 @@ void setupPulses()
}
#if defined(DEBUG) && !defined(VOICE)
PORTH &= ~0x80; // PORTH:7 HIGH->LOW signals end of setupPulses()
PORTH &= ~0x80; // PORTH:7 HIGH->LOW signals end of setupPulses()
#endif
}
#ifndef SIMU
@@ -949,12 +951,13 @@ void setupPulses()
ISR(TIMER1_CAPT_vect) // 2MHz pulse generation
{
#if defined (CPUM2560)
/*** G9X V4 hardware toggled PPM_out avoids any chance of output timing jitter ***/
// OCR1B output pin (PPM_OUT) is pre-SET in setupPulses -- on every new
// frame, for safety -- and then configured to toggle on each OCR1B compare match.
// Thus, all we need do here is update the compare regisiter(s) ...
uint8_t x;
uint8_t x ;
x = *pulses2MHzRPtr++; // Byte size
ICR1 = x;
OCR1B = (uint16_t)x; // Duplicate capture compare value for OCR1B, because Timer1 is in CTC mode
@@ -962,36 +965,44 @@ ISR(TIMER1_CAPT_vect) // 2MHz pulse generation
// pin on OCR1A. Oh well.)
#else // manual bit-bang mode
uint8_t x;
uint8_t x ;
PORTB ^= (1<<OUT_B_PPM); // Toggle PPM_OUT
x = *pulses2MHzRPtr++; // Byte size
ICR1 = x;
ICR1 = x ;
if (x > 200) PORTB |= (1<<OUT_B_PPM); // Make sure pulses are the correct way up.
#endif
}
#if defined(PXX)
ISR(TIMER1_COMPB_vect) // PXX main interrupt
{
uint8_t x;
PORTB ^= (1<<OUT_B_PPM);
x = *pulses2MHzRPtr; // Byte size
if ((x & 1) == 0) {
OCR1B += 32;
}
else {
OCR1B += 16;
}
if ((x >>= 1) == 0) {
if (*(++pulses2MHzRPtr) == 0) {
OCR1B = OCR1C + 2000; // 1mS on from OCR1B
uint8_t x ;
PORTB ^= (1<<OUT_B_PPM) ;
x = *pulses2MHzRPtr; // Byte size
if ( ( x & 1 ) == 0 )
{
OCR1B += 32 ;
}
else
{
OCR1B += 16 ;
}
if ( (x >>= 1) == 0 )
{
if ( *(++pulses2MHzRPtr) == 0 )
{
OCR1B = OCR1C + 2000 ; // 1mS on from OCR1B
}
}
else
{
*pulses2MHzRPtr = x;
}
}
else {
*pulses2MHzRPtr = x;
}
heartbeat |= HEART_TIMER_PULSES;
heartbeat |= HEART_TIMER_PULSES;
}
#endif
@@ -1002,7 +1013,7 @@ ISR(TIMER1_COMPC_vect) // DSM2_PPM or PXX end of frame
#endif
#if defined(DSM2_PPM)
ICR1 = 41536; // next frame starts in 22ms 41536 = 2*(22000 - 14*11*8)
ICR1 = 41536 ; // next frame starts in 22ms 41536 = 2*(22000 - 14*11*8)
if (OCR1C < 255) {
OCR1C = 39000; // delay setup pulses by 19.5ms to reduce system latency
}
@@ -1013,6 +1024,7 @@ ISR(TIMER1_COMPC_vect) // DSM2_PPM or PXX end of frame
}
heartbeat |= HEART_TIMER_PULSES;
#endif
#if defined(DSM2_PPM) && defined(PXX)
@@ -1022,7 +1034,7 @@ ISR(TIMER1_COMPC_vect) // DSM2_PPM or PXX end of frame
#if defined(PXX)
// must be PXX
setupPulses();
setupPulses() ;
#endif
#if defined(DSM2_PPM) && defined(PXX)
@@ -1038,38 +1050,38 @@ void set_timer3_capture()
{
#ifndef SIMU
#if defined (CPUM2560) || defined(CPUM2561) // TODO TIMSK3 in #define!
TIMSK3 &= ~((1<<OCIE3A) | (1<<OCIE3B) | (1<<OCIE3C)); // Stop compare interrupts
TIMSK3 &= ~( (1<<OCIE3A) | (1<<OCIE3B) | (1<<OCIE3C) ) ; // Stop compare interrupts
#else
ETIMSK &= ~((1<<OCIE3A) | (1<<OCIE3B) | (1<<OCIE3C)); // Stop compare interrupts
ETIMSK &= ~( (1<<OCIE3A) | (1<<OCIE3B) | (1<<OCIE3C) ) ; // Stop compare interrupts
#endif
// TODO G: This can't work with V3.2/4.x boards. Select and use a different pin
// for secondary 8-ch PPM output (PORTH or Spare1 or Spare2 maybe?)
DDRE &= ~0x80; PORTE |= 0x80; // Bit 7 input + pullup
// TODO G: This can't work with V3.2/4.x boards. Select and use a different pin
// for secondary 8-ch PPM output (PORTH or Spare1 or Spare2 maybe?)
DDRE &= ~0x80; PORTE |= 0x80 ; // Bit 7 input + pullup
TCCR3B = 0; // Stop counter
TCCR3A = 0;
// Noise Canceller enabled, neg. edge, clock at 16MHz / 8 (2MHz) (Correct for PCB V4.x+ also)
TCCR3B = (1<<ICNC3) | (0b010 << CS30);
TCCR3B = 0 ; // Stop counter
TCCR3A = 0;
// Noise Canceller enabled, neg. edge, clock at 16MHz / 8 (2MHz) (Correct for PCB V4.x+ also)
TCCR3B = (1<<ICNC3) | (0b010 << CS30);
RESUME_PPMIN_INTERRUPT();
RESUME_PPMIN_INTERRUPT();
#endif
}
void set_timer3_ppm()
{
#ifndef SIMU
PAUSE_PPMIN_INTERRUPT();
PAUSE_PPMIN_INTERRUPT();
DDRE |= 0x80; // Bit 7 output
DDRE |= 0x80; // Bit 7 output
TCCR3B = 0; // Stop counter
TCCR3A = (0<<WGM10);
TCCR3B = (1 << WGM12) | (2<<CS10); // CTC OCR1A, 16MHz / 8
TCCR3B = 0 ; // Stop counter
TCCR3A = (0<<WGM10);
TCCR3B = (1 << WGM12) | (2<<CS10); // CTC OCR1A, 16MHz / 8
#if defined (CPUM2560) || defined(CPUM2561)
TIMSK3 |= ((1<<OCIE3A) | (1<<OCIE3B)); // enable immediately before mainloop
TIMSK3 |= ( (1<<OCIE3A) | (1<<OCIE3B) ); // enable immediately before mainloop
#else
ETIMSK |= ((1<<OCIE3A) | (1<<OCIE3B)); // enable immediately before mainloop
ETIMSK |= ( (1<<OCIE3A) | (1<<OCIE3B) ); // enable immediately before mainloop
#endif
#endif
}
@@ -1080,39 +1092,39 @@ void set_timer3_ppm()
// and PPMSIM modes
ISR(TIMER3_COMPA_vect) //2MHz pulse generation
{
static uint8_t pulsePol;
static uint16_t * pulse2MHzPPM16RPtr = (uint16_t*) &pulses2MHz[PULSES_SIZE/2];
static uint8_t pulsePol;
static uint16_t *pulse2MHzPPM16RPtr = (uint16_t*) &pulses2MHz[PULSES_SIZE/2];
if (pulsePol) {
PORTE |= 0x80; // (1<<OUT_B_PPM);
pulsePol = 0;
}
else {
PORTE &= ~0x80; // (1<<OUT_B_PPM);
pulsePol = 1;
}
if (pulsePol) {
PORTE |= 0x80 ; // (1<<OUT_B_PPM);
pulsePol = 0;
}
else {
PORTE &= ~0x80; // (1<<OUT_B_PPM);
pulsePol = 1;
}
OCR3A = *pulse2MHzPPM16RPtr++;
OCR3B = B3_comp_value;
OCR3A = *pulse2MHzPPM16RPtr++;
OCR3B = B3_comp_value ;
if (*pulse2MHzPPM16RPtr == 0) {
pulse2MHzPPM16RPtr = (uint16_t*) &pulses2MHz[PULSES_SIZE/2];
pulsePol = g_model.pulsePol;
}
if (*pulse2MHzPPM16RPtr == 0) {
pulse2MHzPPM16RPtr = (uint16_t*) &pulses2MHz[PULSES_SIZE/2];
pulsePol = g_model.pulsePol;
}
heartbeat |= HEART_TIMER_PULSES;
heartbeat |= HEART_TIMER_PULSES;
}
ISR(TIMER3_COMPB_vect) //2MHz pulse generation
{
sei();
sei() ;
if (s_current_protocol[0] != g_model.protocol) {
if (s_current_protocol[0] == PROTO_PPMSIM) {
setupPulses();
}
}
else {
setupPulsesPPM(g_model.protocol);
setupPulsesPPM(g_model.protocol) ;
}
}
-5
View File
@@ -244,12 +244,7 @@ bool getLogicalSwitch(uint8_t idx)
#endif
if (ls->func == LS_FUNC_NONE || (s && !getSwitch(s))) {
#if defined(CPUARM)
if (ls->func != LS_FUNC_STICKY && ls->func != LS_FUNC_EDGE ) {
#else
if (ls->func != LS_FUNC_STICKY) {
#endif
// AND switch must not affect STICKY and EDGE processing
LS_LAST_VALUE(mixerCurrentFlightMode, idx) = CS_LAST_VALUE_INIT;
}
result = false;
+3 -4
View File
@@ -42,8 +42,7 @@
#define PIN_PORTC 0x0200
// Sample time should exceed 1uS
#define SAMPTIME 2 // sample time = 28 cycles
#define SAMPTIME_LONG 3 // sample time = 56 cycles
#define SAMPTIME 2 // sample time = 28 cycles
#if defined(REV9E)
const int8_t ana_direction[NUMBER_ANALOG] = {1,1,-1,-1, -1,-1,-1,1, -1,1,1,1, -1};
@@ -113,8 +112,8 @@ void adcInit()
ADC3->SQR1 = (NUMBER_ANALOG_ADC3-1) << 20 ; // NUMBER_ANALOG Channels
ADC3->SQR2 = 0;
ADC3->SQR3 = (ADC_CHANNEL_POT1<<0) + (ADC_CHANNEL_SLIDER1<<5) + (ADC_CHANNEL_SLIDER2<<10) ; // conversions 1 to 3
ADC3->SMPR1 = 0;
ADC3->SMPR2 = (SAMPTIME_LONG<<(3*ADC_CHANNEL_POT1)) + (SAMPTIME_LONG<<(3*ADC_CHANNEL_SLIDER1)) + (SAMPTIME_LONG<<(3*ADC_CHANNEL_SLIDER2));
ADC3->SMPR1 = SAMPTIME + (SAMPTIME<<3) + (SAMPTIME<<6);
ADC3->SMPR2 = 0;
// Enable the DMA channel here, DMA2 stream 1, channel 2
DMA2_Stream1->CR = DMA_SxCR_PL | DMA_SxCR_CHSEL_1 | DMA_SxCR_MSIZE_0 | DMA_SxCR_PSIZE_0 | DMA_SxCR_MINC;
@@ -47,7 +47,7 @@ void bluetoothInit(uint32_t baudrate)
GPIO_InitStructure.GPIO_Pin = BT_GPIO_PIN_BRTS;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(BT_GPIO_BRTS, &GPIO_InitStructure);
GPIO_SetBits(BT_GPIO_BRTS, BT_GPIO_PIN_BRTS);
+2 -10
View File
@@ -241,19 +241,11 @@ void usbJoystickUpdate(void)
static uint8_t HID_Buffer[HID_IN_PACKET];
//buttons
HID_Buffer[0] = 0;
HID_Buffer[1] = 0;
HID_Buffer[2] = 0;
HID_Buffer[0] = 0; //buttons
for (int i = 0; i < 8; ++i) {
if ( channelOutputs[i+8] > 0 ) {
HID_Buffer[0] |= (1 << i);
}
if ( channelOutputs[i+16] > 0 ) {
HID_Buffer[1] |= (1 << i);
}
if ( channelOutputs[i+24] > 0 ) {
HID_Buffer[2] |= (1 << i);
}
}
//analog values
@@ -262,7 +254,7 @@ void usbJoystickUpdate(void)
int16_t value = channelOutputs[i] / 8;
if ( value > 127 ) value = 127;
else if ( value < -127 ) value = -127;
HID_Buffer[i+3] = static_cast<int8_t>(value);
HID_Buffer[i+1] = static_cast<int8_t>(value);
}
USBD_HID_SendReport (&USB_OTG_dev, HID_Buffer, HID_IN_PACKET );
+2 -2
View File
@@ -55,7 +55,7 @@ void hapticInit(void)
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = HAPTIC_GPIO_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(HAPTIC_GPIO, &GPIO_InitStructure);
@@ -80,7 +80,7 @@ void hapticInit(void)
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = HAPTIC_GPIO_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(HAPTIC_GPIO, &GPIO_InitStructure);
+2 -2
View File
@@ -9,7 +9,7 @@ void i2cInit()
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = I2C_GPIO_PIN_WP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
@@ -30,7 +30,7 @@ void i2cInit()
GPIO_PinAFConfig(I2C_GPIO, I2C_GPIO_PinSource_SDA, I2C_GPIO_AF);
GPIO_InitStructure.GPIO_Pin = I2C_GPIO_PIN_SCL | I2C_GPIO_PIN_SDA;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
+1 -1
View File
@@ -276,7 +276,7 @@ void keysInit()
{
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP ;
+4 -4
View File
@@ -258,7 +258,7 @@ void backlightInit()
#if defined(REV9E)
GPIO_InitStructure.GPIO_Pin = BACKLIGHT_GPIO_PIN_1|BACKLIGHT_GPIO_PIN_2;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(BACKLIGHT_GPIO, &GPIO_InitStructure);
@@ -275,7 +275,7 @@ void backlightInit()
#elif defined(REVPLUS)
GPIO_InitStructure.GPIO_Pin = BACKLIGHT_GPIO_PIN_1|BACKLIGHT_GPIO_PIN_2;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(BACKLIGHT_GPIO, &GPIO_InitStructure);
@@ -293,7 +293,7 @@ void backlightInit()
#else
GPIO_InitStructure.GPIO_Pin = BACKLIGHT_GPIO_PIN_1;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(BACKLIGHT_GPIO, &GPIO_InitStructure);
@@ -318,7 +318,7 @@ static void LCD_Hardware_Init()
GPIO_InitStructure.GPIO_Pin = LCD_GPIO_PIN_MOSI | LCD_GPIO_PIN_CLK | LCD_GPIO_PIN_A0;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(LCD_GPIO_SPI, &GPIO_InitStructure);
+12 -10
View File
@@ -48,7 +48,7 @@ static void intmodulePxxStop( void ) ;
#endif
static void extmodulePxxStart( void ) ;
static void extmodulePxxStop( void ) ;
#if defined(DSM2)
#if defined(DSM2) || defined(MULTIMODULE)
static void extmoduleDsm2Start( void ) ;
static void extmoduleDsm2Stop( void ) ;
#endif
@@ -77,7 +77,7 @@ void disable_pxx(uint32_t port)
extmodulePxxStop() ;
}
#if defined(DSM2)
#if defined(DSM2) || defined(MULTIMODULE)
void init_dsm2(uint32_t port)
{
if (port == EXTERNAL_MODULE) {
@@ -171,7 +171,7 @@ static void intmoduleNoneStart()
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = INTMODULE_GPIO_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT ;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(INTMODULE_GPIO, &GPIO_InitStructure);
@@ -212,7 +212,7 @@ static void extmoduleNoneStart()
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = EXTMODULE_GPIO_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT ;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(EXTMODULE_GPIO, &GPIO_InitStructure);
@@ -248,7 +248,7 @@ static void extmoduleCrossfireStart()
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = EXTMODULE_GPIO_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT ;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(EXTMODULE_GPIO, &GPIO_InitStructure);
@@ -293,7 +293,7 @@ static void intmodulePxxStart()
GPIO_PinAFConfig(INTMODULE_GPIO, INTMODULE_GPIO_PinSource, INTMODULE_GPIO_AF);
GPIO_InitStructure.GPIO_Pin = INTMODULE_GPIO_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(INTMODULE_GPIO, &GPIO_InitStructure);
@@ -439,7 +439,7 @@ void extmodulePxxStart()
GPIO_PinAFConfig(EXTMODULE_GPIO, EXTMODULE_GPIO_PinSource, EXTMODULE_GPIO_AF);
GPIO_InitStructure.GPIO_Pin = EXTMODULE_GPIO_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(EXTMODULE_GPIO, &GPIO_InitStructure);
@@ -488,7 +488,7 @@ static void extmodulePxxStop()
}
}
#if defined(DSM2)
#if defined(DSM2) || defined(MULTIMODULE)
static void extmoduleDsm2Start()
{
EXTERNAL_MODULE_ON();
@@ -499,7 +499,7 @@ static void extmoduleDsm2Start()
GPIO_PinAFConfig(EXTMODULE_GPIO, EXTMODULE_GPIO_PinSource, EXTMODULE_GPIO_AF);
GPIO_InitStructure.GPIO_Pin = EXTMODULE_GPIO_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(EXTMODULE_GPIO, &GPIO_InitStructure);
@@ -612,7 +612,9 @@ extern "C" void TIM8_CC_IRQHandler()
EXTMODULE_TIMER->DIER |= TIM_DIER_CC2IE ; // Enable this interrupt
}
#if defined(DSM2)
else if (s_current_protocol[EXTERNAL_MODULE] >= PROTO_DSM2_LP45 && s_current_protocol[EXTERNAL_MODULE] <= PROTO_DSM2_DSMX) {
else if ((s_current_protocol[EXTERNAL_MODULE] >= PROTO_DSM2_LP45 && s_current_protocol[EXTERNAL_MODULE] <= PROTO_DSM2_DSMX) || IS_MULTIMODULE_PROTOCOL (s_current_protocol[EXTERNAL_MODULE]))
{
DMA2_Stream2->CR &= ~DMA_SxCR_EN ; // Disable DMA
DMA2->LIFCR = DMA_LIFCR_CTCIF2 | DMA_LIFCR_CHTIF2 | DMA_LIFCR_CTEIF2 | DMA_LIFCR_CDMEIF2 | DMA_LIFCR_CFEIF2 ; // Write ones to clear bits
DMA2_Stream2->M0AR = CONVERT_PTR_UINT(&modulePulsesData[EXTERNAL_MODULE].dsm2.pulses[1]);
+1 -1
View File
@@ -45,7 +45,7 @@ void pwrInit()
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = PWR_GPIO_PIN_ON;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init(PWR_GPIO, &GPIO_InitStructure);
+1 -1
View File
@@ -53,7 +53,7 @@ void uart3Setup(unsigned int baudrate)
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(SERIAL_GPIO, &GPIO_InitStructure);
USART_InitStructure.USART_BaudRate = baudrate;
@@ -55,7 +55,7 @@ void telemetryPortInit(uint32_t baudrate)
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(TELEMETRY_GPIO, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = TELEMETRY_GPIO_PIN_DIR;
+1 -1
View File
@@ -240,7 +240,7 @@ void topLcdInit()
GPIO_InitStructure.GPIO_Pin = TOPLCD_GPIO_PIN_DATA | TOPLCD_GPIO_PIN_WR |TOPLCD_GPIO_PIN_BL|TOPLCD_GPIO_PIN_CS1|TOPLCD_GPIO_PIN_CS2;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init(TOPLCD_GPIO, &GPIO_InitStructure);
+1 -1
View File
@@ -210,7 +210,7 @@ void init_sbus_on_heartbeat_capture()
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);
USART_InitStructure.USART_BaudRate = 100000;
+2 -2
View File
@@ -49,7 +49,7 @@ void USB_OTG_BSP_Init(USB_OTG_CORE_HANDLE *pdev)
/* Configure DM and DP Pins */
GPIO_InitStructure.GPIO_Pin = USB_GPIO_PIN_DM | USB_GPIO_PIN_DP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_25MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
@@ -60,7 +60,7 @@ void USB_OTG_BSP_Init(USB_OTG_CORE_HANDLE *pdev)
/* Configure VBUS Pin */
GPIO_InitStructure.GPIO_Pin = USB_GPIO_PIN_VBUS;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ;
+1 -1
View File
@@ -49,7 +49,7 @@
#define HID_IN_EP 0x81
#define HID_OUT_EP 0x01
#define HID_IN_PACKET 11
#define HID_IN_PACKET 9
#define HID_OUT_PACKET 9
#define CDC_IN_EP 0x81 /* EP1 for data IN */
@@ -118,15 +118,13 @@ static uint8_t USBD_HID_DataIn (void *pdev, uint8_t epnum);
#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
/*
This USB HID endpoint report description defines a device with:
* 24 digital buttons
* 8 digital buttons
* 8 analog axes with 8bit resolution
Repot packet described as C struct is:
struct {
uint8_t buttons1; //bit 0 - button 1, bit 1 - button 2, ..., mapped to channels 9-16, on if channel > 0
uint8_t buttons2; // mapped to channels 17-24, on if channel > 0
uint8_t buttons3; // mapped to channels 25-32, on if channel > 0
uint8_t buttons; //bit 0 - button 1, bit 1 - button 2, ..., mapped to channels 9-16, on if channel > 0
uint8_t X; //analog value, mapped to channel 1
uint8_t Y; //analog value, mapped to channel 2
uint8_t Z; //analog value, mapped to channel 3
@@ -145,10 +143,10 @@ __ALIGN_BEGIN static const uint8_t HID_JOYSTICK_ReportDesc[] __ALIGN_END =
0xa1, 0x00, // COLLECTION (Physical)
0x05, 0x09, // USAGE_PAGE (Button)
0x19, 0x01, // USAGE_MINIMUM (Button 1)
0x29, 0x18, // USAGE_MAXIMUM (Button 24)
0x29, 0x08, // USAGE_MAXIMUM (Button 8)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x95, 0x18, // REPORT_COUNT (24)
0x95, 0x08, // REPORT_COUNT (8)
0x75, 0x01, // REPORT_SIZE (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
+7 -10
View File
@@ -84,12 +84,12 @@ const FrSkySportSensor sportSensors[] = {
{ GPS_LONG_LATI_FIRST_ID, GPS_LONG_LATI_LAST_ID, 0, ZSTR_GPS, UNIT_GPS, 0 },
{ FUEL_QTY_FIRST_ID, FUEL_QTY_LAST_ID, 0, ZSTR_FUEL, UNIT_MILLILITERS, 2 },
{ GPS_COURS_FIRST_ID, GPS_COURS_LAST_ID, 0, ZSTR_HDG, UNIT_DEGREE, 2 },
{ POWERBOX_BATT1_FIRST_ID, POWERBOX_BATT1_LAST_ID, 0, ZSTR_BATT1_VOLTAGE, UNIT_VOLTS, 3 },
{ POWERBOX_BATT2_FIRST_ID, POWERBOX_BATT2_LAST_ID, 0, ZSTR_BATT2_VOLTAGE, UNIT_VOLTS, 3 },
{ POWERBOX_BATT1_FIRST_ID, POWERBOX_BATT1_LAST_ID, 1, ZSTR_BATT1_CURRENT, UNIT_AMPS, 2 },
{ POWERBOX_BATT2_FIRST_ID, POWERBOX_BATT2_LAST_ID, 1, ZSTR_BATT2_CURRENT, UNIT_AMPS, 2 },
{ POWERBOX_CNSP_FIRST_ID, POWERBOX_CNSP_LAST_ID, 0, ZSTR_BATT1_CONSUMPTION, UNIT_MAH, 0 },
{ POWERBOX_CNSP_FIRST_ID, POWERBOX_CNSP_LAST_ID, 1, ZSTR_BATT2_CONSUMPTION, UNIT_MAH, 0 },
{ POWERBOX_BATT1_FIRST_ID, POWERBOX_BATT1_LAST_ID, 0, ZSTR_PBOX1, UNIT_VOLTS, 3 },
{ POWERBOX_BATT2_FIRST_ID, POWERBOX_BATT2_LAST_ID, 0, ZSTR_PBOX2, UNIT_VOLTS, 3 },
{ POWERBOX_BATT1_FIRST_ID, POWERBOX_BATT1_LAST_ID, 1, ZSTR_PBOX1, UNIT_AMPS, 2 },
{ POWERBOX_BATT2_FIRST_ID, POWERBOX_BATT2_LAST_ID, 1, ZSTR_PBOX2, UNIT_AMPS, 2 },
{ POWERBOX_CNSP_FIRST_ID, POWERBOX_CNSP_LAST_ID, 0, ZSTR_PBOX1, UNIT_MAH, 0 },
{ POWERBOX_CNSP_FIRST_ID, POWERBOX_CNSP_LAST_ID, 1, ZSTR_PBOX2, UNIT_MAH, 0 },
{ POWERBOX_STATE_FIRST_ID, POWERBOX_STATE_LAST_ID, 0, ZSTR_RX1_FAILSAFE, UNIT_RAW, 0 },
{ POWERBOX_STATE_FIRST_ID, POWERBOX_STATE_LAST_ID, 1, ZSTR_RX1_LOSTFRAME, UNIT_RAW, 0 },
{ POWERBOX_STATE_FIRST_ID, POWERBOX_STATE_LAST_ID, 2, ZSTR_RX2_FAILSAFE, UNIT_RAW, 0 },
@@ -234,10 +234,7 @@ void processSportPacket(uint8_t * packet)
if (id == RSSI_ID) {
frskyStreaming = FRSKY_TIMEOUT10ms; // reset counter only if valid frsky packets are being detected
data = SPORT_DATA_U8(packet);
if (data == 0)
frskyData.rssi.reset();
else
frskyData.rssi.set(data);
frskyData.rssi.set(data);
}
#if defined(PCBTARANIS) && defined(REVPLUS)
else if (id == XJT_VERSION_ID) {
Binary file not shown.

Before

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 469 B

-10
View File
@@ -210,16 +210,6 @@ TEST(Lcd, vline_x_lt0)
#endif
#if defined(CPUARM)
TEST(Lcd, SmlsizeDecimalPoint)
{
lcd_clear();
lcd_outdezNAtt(0, 1, 105, PREC1|SMLSIZE|LEFT);
lcd_outdezNAtt(0, LCD_H-7, 105, PREC1|SMLSIZE|LEFT|INVERS);
lcd_outdezNAtt(LCD_W, 1, 105, PREC2|SMLSIZE);
lcd_outdezNAtt(LCD_W, LCD_H-7, 105, PREC2|SMLSIZE|INVERS);
EXPECT_TRUE(checkScreenshot("SmlsizeDecimalPoint"));
}
TEST(Lcd, Smlsize)
{
lcd_clear();
+381 -565
View File
@@ -1,565 +1,381 @@
/*
* Authors (alphabetical order)
* - Andre Bernet <bernet.andre@gmail.com>
* - Andreas Weitl
* - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv
* - Gabriel Birkus
* - Jean-Pierre Parisy
* - Karl Szmutny
* - Michael Blandford
* - Michal Hlavinka
* - Pat Mackenzie
* - Philip Moss
* - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer
*
* opentx is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include "gtests.h"
#if !defined(PCBTARANIS)
TEST(getSwitch, undefCSW)
{
MODEL_RESET();
EXPECT_EQ(getSwitch(NUM_PSWITCH), false);
EXPECT_EQ(getSwitch(-NUM_PSWITCH), true); // no good answer there!
}
#endif
#if !defined(CPUARM)
TEST(getSwitch, circularCSW)
{
MODEL_RESET();
MIXER_RESET();
g_model.logicalSw[0] = { SWSRC_SW1, SWSRC_SW1, LS_FUNC_OR };
g_model.logicalSw[1] = { SWSRC_SW1, SWSRC_SW1, LS_FUNC_AND };
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(-SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
EXPECT_EQ(getSwitch(-SWSRC_SW2), true);
}
#endif
#if defined(PCBTARANIS)
void setLogicalSwitch(int index, uint16_t _func, int16_t _v1, int16_t _v2, int16_t _v3 = 0, uint8_t _delay = 0, uint8_t _duration = 0, int8_t _andsw = 0)
{
g_model.logicalSw[index].func = _func;
g_model.logicalSw[index].v1 = _v1;
g_model.logicalSw[index].v2 = _v2;
g_model.logicalSw[index].v3 = _v3;
g_model.logicalSw[index].delay = _delay;
g_model.logicalSw[index].duration = _duration;
g_model.logicalSw[index].andsw = _andsw;
}
TEST(getSwitch, OldTypeStickyCSW)
{
RADIO_RESET();
MODEL_RESET();
MIXER_RESET();
setLogicalSwitch(0, LS_FUNC_AND, SWSRC_SA0, SWSRC_NONE);
setLogicalSwitch(1, LS_FUNC_OR, SWSRC_SW1, SWSRC_SW2);
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
// now trigger SA0, both switches should become true
simuSetSwitch(0, -1);
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
// now release SA0 and SW2 should stay true
simuSetSwitch(0, 0);
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
// now reset logical switches
logicalSwitchesReset();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
}
#endif // #if defined(PCBTARANIS)
TEST(getSwitch, nullSW)
{
MODEL_RESET();
EXPECT_EQ(getSwitch(0), true);
}
#if 0
TEST(getSwitch, DISABLED_VfasWithDelay)
{
MODEL_RESET();
MIXER_RESET();
memclear(&frskyData, sizeof(frskyData));
/*
Test for logical switch:
L1 Vfas < 9.6 Delay (0.5s)
(gdb) print Open9xX9D::g_model.logicalSw[0]
$3 = {v1 = -39 '\331', v2 = 96, v3 = 0, func = 4 '\004', delay = 5 '\005', duration = 0 '\000', andsw = 0 '\000'}
*/
g_model.logicalSw[0] = {int8_t(MIXSRC_FIRST_TELEM+TELEM_VFAS-1), 96, 0, 4, 5, 0, 0};
frskyData.hub.vfas = 150; //unit is 100mV
//telemetry streaming is FALSE, so L1 should be FALSE no matter what value Vfas has
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
//every logicalSwitchesTimerTick() represents 100ms
//so now after 5 ticks we should still have a FALSE value
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
//now turn on telemetry
EXPECT_EQ(TELEMETRY_STREAMING(), false);
TELEMETRY_RSSI() = 50;
EXPECT_EQ(TELEMETRY_STREAMING(), true);
//vfas is 15.0V so L1 should still be FALSE
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
//now reduce vfas to 9.5V and L1 should become TRUE after 0.5s
frskyData.hub.vfas = 95;
evalLogicalSwitches();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
//now stop telemetry, L1 should become FALSE immediatelly
TELEMETRY_RSSI() = 0;
EXPECT_EQ(TELEMETRY_STREAMING(), false);
evalLogicalSwitches();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
}
TEST(getSwitch, DISABLED_RssiWithDuration)
{
MODEL_RESET();
MIXER_RESET();
memclear(&frskyData, sizeof(frskyData));
/*
Test for logical switch:
L1 RSSI > 10 Duration (0.5s)
(gdb) print Open9xX9D::g_model.logicalSw[0]
$1 = {v1 = -55 '\311', v2 = 10, v3 = 0, func = 3 '\003', delay = 0 '\000', duration = 5 '\005', andsw = 0 '\000'}
*/
g_model.logicalSw[0] = {int8_t(MIXSRC_FIRST_TELEM+TELEM_RSSI_RX-1), 10, 0, 3, 0, 5, 0};
EXPECT_EQ(TELEMETRY_STREAMING(), false);
evalLogicalSwitches();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
//now set RSSI to 5, L1 should still be FALSE
TELEMETRY_RSSI() = 5;
evalLogicalSwitches();
EXPECT_EQ(TELEMETRY_STREAMING(), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
//now set RSSI to 100, L1 should become TRUE for 0.5s
TELEMETRY_RSSI() = 100;
evalLogicalSwitches();
EXPECT_EQ(TELEMETRY_STREAMING(), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
//repeat telemetry streaming OFF and ON to test for duration processing
TELEMETRY_RSSI() = 0;
evalLogicalSwitches();
EXPECT_EQ(TELEMETRY_STREAMING(), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
//now set RSSI to 100, L1 should become TRUE for 0.5s
TELEMETRY_RSSI() = 100;
evalLogicalSwitches();
EXPECT_EQ(TELEMETRY_STREAMING(), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
}
#endif // #if defined(PCBTARANIS) && defined(FRSKY)
#if !defined(CPUARM)
TEST(getSwitch, recursiveSW)
{
MODEL_RESET();
MIXER_RESET();
g_model.logicalSw[0] = { SWSRC_RUD, -SWSRC_SW2, LS_FUNC_OR };
g_model.logicalSw[1] = { SWSRC_ELE, -SWSRC_SW1, LS_FUNC_OR };
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
LS_RECURSIVE_EVALUATION_RESET();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
simuSetSwitch(1, 1);
LS_RECURSIVE_EVALUATION_RESET();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
LS_RECURSIVE_EVALUATION_RESET();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
}
#endif // #if !defined(CPUARM)
#if defined(PCBTARANIS)
TEST(getSwitch, inputWithTrim)
{
MODEL_RESET();
modelDefault(0);
MIXER_RESET();
g_model.logicalSw[0] = { LS_FUNC_VPOS, MIXSRC_FIRST_INPUT, 0, 0 };
doMixerCalculations();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
setTrimValue(0, 0, 32);
doMixerCalculations();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
}
#endif
#if defined(PCBTARANIS)
TEST(evalLogicalSwitches, playFile)
{
SYSTEM_RESET();
MODEL_RESET();
modelDefault(0);
MIXER_RESET();
extern uint64_t sdAvailableLogicalSwitchAudioFiles;
sdAvailableLogicalSwitchAudioFiles = 0xffffffffffffffff;
char filename[AUDIO_FILENAME_MAXLEN+1];
isAudioFileReferenced((LOGICAL_SWITCH_AUDIO_CATEGORY << 24) + (0 << 16) + AUDIO_EVENT_OFF, filename);
EXPECT_EQ(strcmp(filename, "/SOUNDS/en/MODEL01/L1-off.wav"), 0);
isAudioFileReferenced((LOGICAL_SWITCH_AUDIO_CATEGORY << 24) + (0 << 16) + AUDIO_EVENT_ON, filename);
EXPECT_EQ(strcmp(filename, "/SOUNDS/en/MODEL01/L1-on.wav"), 0);
isAudioFileReferenced((LOGICAL_SWITCH_AUDIO_CATEGORY << 24) + (31 << 16) + AUDIO_EVENT_OFF, filename);
EXPECT_EQ(strcmp(filename, "/SOUNDS/en/MODEL01/L32-off.wav"), 0);
isAudioFileReferenced((LOGICAL_SWITCH_AUDIO_CATEGORY << 24) + (31 << 16) + AUDIO_EVENT_ON, filename);
EXPECT_EQ(strcmp(filename, "/SOUNDS/en/MODEL01/L32-on.wav"), 0);
}
TEST(getSwitch, edgeInstant)
{
MODEL_RESET();
MIXER_RESET();
// LS1 setup: EDGE SFup (0:instant)
// LS2 setup: (EDGE SFup (0:instant)) AND SAup
setLogicalSwitch(0, LS_FUNC_EDGE, SWSRC_SF2, -129, -1);
setLogicalSwitch(1, LS_FUNC_EDGE, SWSRC_SF2, -129, -1, 0, 0, SWSRC_SA2 );
simuSetSwitch(0, -1); //SA down
simuSetSwitch(5, 0); //SF down
// EXPECT_EQ(getSwitch(SWSRC_SF2), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
// now trigger SFup, LS1 should become true
simuSetSwitch(5, 1); //SF up
// EXPECT_EQ(getSwitch(SWSRC_SF2), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
// now release SA0 and SW2 should stay true
simuSetSwitch(5, 0); //SF down
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
// now reset logical switches
logicalSwitchesReset();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
// second part with SAup
simuSetSwitch(0, 1); //SA up
simuSetSwitch(5, 0); //SF down
// EXPECT_EQ(getSwitch(SWSRC_SF2), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
// now trigger SFup, LS1 should become true
simuSetSwitch(5, 1); //SF up
// EXPECT_EQ(getSwitch(SWSRC_SF2), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
// now release SA0 and SW2 should stay true
simuSetSwitch(5, 0); //SF down
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
// now reset logical switches
logicalSwitchesReset();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
// now bug #2939
// SF is kept up and SA is toggled
simuSetSwitch(0, -1); //SA down
simuSetSwitch(5, 1); //SF up
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
simuSetSwitch(0, 1); //SA up
simuSetSwitch(5, 1); //SF up
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
simuSetSwitch(0, -1); //SA down
simuSetSwitch(5, 1); //SF up
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
//test what happens when EDGE condition is true and
//logical switches are reset - the switch should fire again
simuSetSwitch(0, 1); //SA up
simuSetSwitch(5, 1); //SF up
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false); //switch will not trigger, because SF was already up
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
logicalSwitchesReset();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
}
TEST(getSwitch, edgeRelease)
{
MODEL_RESET();
MIXER_RESET();
// test for issue #2728
// LS1 setup: EDGE SFup (0:release)
// LS2 setup: (EDGE SFup (0:release)) AND SAup
setLogicalSwitch(0, LS_FUNC_EDGE, SWSRC_SF2, -129, 0);
setLogicalSwitch(1, LS_FUNC_EDGE, SWSRC_SF2, -129, 0, 0, 0, SWSRC_SA2 );
simuSetSwitch(0, -1); //SA down
simuSetSwitch(5, 0); //SF down
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
simuSetSwitch(5, 1); //SF up
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
simuSetSwitch(5, 0); //SF down
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
// second part with SAup
simuSetSwitch(0, 1); //SA up
simuSetSwitch(5, 0); //SF down
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
simuSetSwitch(5, 1); //SF up
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
simuSetSwitch(5, 0); //SF down
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
// with switches reset both should remain false
logicalSwitchesReset();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
}
#endif // #if defined(CPUARM)
/*
* Authors (alphabetical order)
* - Andre Bernet <bernet.andre@gmail.com>
* - Andreas Weitl
* - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv
* - Gabriel Birkus
* - Jean-Pierre Parisy
* - Karl Szmutny
* - Michael Blandford
* - Michal Hlavinka
* - Pat Mackenzie
* - Philip Moss
* - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer
*
* opentx is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include "gtests.h"
#if !defined(PCBTARANIS)
TEST(getSwitch, undefCSW)
{
MODEL_RESET();
EXPECT_EQ(getSwitch(NUM_PSWITCH), false);
EXPECT_EQ(getSwitch(-NUM_PSWITCH), true); // no good answer there!
}
#endif
#if !defined(CPUARM)
TEST(getSwitch, circularCSW)
{
MODEL_RESET();
MIXER_RESET();
g_model.logicalSw[0] = { SWSRC_SW1, SWSRC_SW1, LS_FUNC_OR };
g_model.logicalSw[1] = { SWSRC_SW1, SWSRC_SW1, LS_FUNC_AND };
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(-SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
EXPECT_EQ(getSwitch(-SWSRC_SW2), true);
}
#endif
#define SET_LOGICAL_SWITCH(index, _func, _v1, _v2) ( \
g_model.logicalSw[index].func = _func, \
g_model.logicalSw[index].v1 = _v1, \
g_model.logicalSw[index].v2 = _v2 )
#if defined(PCBTARANIS)
TEST(getSwitch, OldTypeStickyCSW)
{
RADIO_RESET();
MODEL_RESET();
MIXER_RESET();
SET_LOGICAL_SWITCH(0, LS_FUNC_AND, SWSRC_SA0, SWSRC_NONE);
SET_LOGICAL_SWITCH(1, LS_FUNC_OR, SWSRC_SW1, SWSRC_SW2);
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
// now trigger SA0, both switches should become true
simuSetSwitch(0, -1);
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
// now release SA0 and SW2 should stay true
simuSetSwitch(0, 0);
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
// now reset logical switches
logicalSwitchesReset();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
}
#endif // #if defined(PCBTARANIS)
TEST(getSwitch, nullSW)
{
MODEL_RESET();
EXPECT_EQ(getSwitch(0), true);
}
#if 0
TEST(getSwitch, DISABLED_VfasWithDelay)
{
MODEL_RESET();
MIXER_RESET();
memclear(&frskyData, sizeof(frskyData));
/*
Test for logical switch:
L1 Vfas < 9.6 Delay (0.5s)
(gdb) print Open9xX9D::g_model.logicalSw[0]
$3 = {v1 = -39 '\331', v2 = 96, v3 = 0, func = 4 '\004', delay = 5 '\005', duration = 0 '\000', andsw = 0 '\000'}
*/
g_model.logicalSw[0] = {int8_t(MIXSRC_FIRST_TELEM+TELEM_VFAS-1), 96, 0, 4, 5, 0, 0};
frskyData.hub.vfas = 150; //unit is 100mV
//telemetry streaming is FALSE, so L1 should be FALSE no matter what value Vfas has
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
//every logicalSwitchesTimerTick() represents 100ms
//so now after 5 ticks we should still have a FALSE value
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
//now turn on telemetry
EXPECT_EQ(TELEMETRY_STREAMING(), false);
TELEMETRY_RSSI() = 50;
EXPECT_EQ(TELEMETRY_STREAMING(), true);
//vfas is 15.0V so L1 should still be FALSE
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
//now reduce vfas to 9.5V and L1 should become TRUE after 0.5s
frskyData.hub.vfas = 95;
evalLogicalSwitches();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
//now stop telemetry, L1 should become FALSE immediatelly
TELEMETRY_RSSI() = 0;
EXPECT_EQ(TELEMETRY_STREAMING(), false);
evalLogicalSwitches();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
}
TEST(getSwitch, DISABLED_RssiWithDuration)
{
MODEL_RESET();
MIXER_RESET();
memclear(&frskyData, sizeof(frskyData));
/*
Test for logical switch:
L1 RSSI > 10 Duration (0.5s)
(gdb) print Open9xX9D::g_model.logicalSw[0]
$1 = {v1 = -55 '\311', v2 = 10, v3 = 0, func = 3 '\003', delay = 0 '\000', duration = 5 '\005', andsw = 0 '\000'}
*/
g_model.logicalSw[0] = {int8_t(MIXSRC_FIRST_TELEM+TELEM_RSSI_RX-1), 10, 0, 3, 0, 5, 0};
EXPECT_EQ(TELEMETRY_STREAMING(), false);
evalLogicalSwitches();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
//now set RSSI to 5, L1 should still be FALSE
TELEMETRY_RSSI() = 5;
evalLogicalSwitches();
EXPECT_EQ(TELEMETRY_STREAMING(), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
//now set RSSI to 100, L1 should become TRUE for 0.5s
TELEMETRY_RSSI() = 100;
evalLogicalSwitches();
EXPECT_EQ(TELEMETRY_STREAMING(), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
//repeat telemetry streaming OFF and ON to test for duration processing
TELEMETRY_RSSI() = 0;
evalLogicalSwitches();
EXPECT_EQ(TELEMETRY_STREAMING(), false);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
//now set RSSI to 100, L1 should become TRUE for 0.5s
TELEMETRY_RSSI() = 100;
evalLogicalSwitches();
EXPECT_EQ(TELEMETRY_STREAMING(), true);
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
logicalSwitchesTimerTick();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
}
#endif // #if defined(PCBTARANIS) && defined(FRSKY)
#if !defined(CPUARM)
TEST(getSwitch, recursiveSW)
{
MODEL_RESET();
MIXER_RESET();
g_model.logicalSw[0] = { SWSRC_RUD, -SWSRC_SW2, LS_FUNC_OR };
g_model.logicalSw[1] = { SWSRC_ELE, -SWSRC_SW1, LS_FUNC_OR };
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
LS_RECURSIVE_EVALUATION_RESET();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
simuSetSwitch(1, 1);
LS_RECURSIVE_EVALUATION_RESET();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
LS_RECURSIVE_EVALUATION_RESET();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
}
#endif // #if !defined(CPUARM)
#if defined(PCBTARANIS)
TEST(getSwitch, inputWithTrim)
{
MODEL_RESET();
modelDefault(0);
MIXER_RESET();
g_model.logicalSw[0] = { LS_FUNC_VPOS, MIXSRC_FIRST_INPUT, 0, 0 };
doMixerCalculations();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
setTrimValue(0, 0, 32);
doMixerCalculations();
evalLogicalSwitches();
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
}
#endif
#if defined(PCBTARANIS)
TEST(evalLogicalSwitches, playFile)
{
SYSTEM_RESET();
MODEL_RESET();
modelDefault(0);
MIXER_RESET();
extern uint64_t sdAvailableLogicalSwitchAudioFiles;
sdAvailableLogicalSwitchAudioFiles = 0xffffffffffffffff;
char filename[AUDIO_FILENAME_MAXLEN+1];
isAudioFileReferenced((LOGICAL_SWITCH_AUDIO_CATEGORY << 24) + (0 << 16) + AUDIO_EVENT_OFF, filename);
EXPECT_EQ(strcmp(filename, "/SOUNDS/en/MODEL01/L1-off.wav"), 0);
isAudioFileReferenced((LOGICAL_SWITCH_AUDIO_CATEGORY << 24) + (0 << 16) + AUDIO_EVENT_ON, filename);
EXPECT_EQ(strcmp(filename, "/SOUNDS/en/MODEL01/L1-on.wav"), 0);
isAudioFileReferenced((LOGICAL_SWITCH_AUDIO_CATEGORY << 24) + (31 << 16) + AUDIO_EVENT_OFF, filename);
EXPECT_EQ(strcmp(filename, "/SOUNDS/en/MODEL01/L32-off.wav"), 0);
isAudioFileReferenced((LOGICAL_SWITCH_AUDIO_CATEGORY << 24) + (31 << 16) + AUDIO_EVENT_ON, filename);
EXPECT_EQ(strcmp(filename, "/SOUNDS/en/MODEL01/L32-on.wav"), 0);
}
#endif
+3 -8
View File
@@ -253,14 +253,9 @@ static int io_open (lua_State *L) {
else if (*md == 'a')
mode = FA_WRITE | FA_OPEN_ALWAYS; // always open file (create it if necessary)
FRESULT result = f_open(&p->f, filename, mode);
if (result == FR_OK) {
if (*md == 'a')
f_lseek(&p->f, f_size(&p->f)); // seek to the end of the file
return 1;
}
else {
return luaL_fileresult(L, 0, filename);
}
if (result == FR_OK && *md == 'a')
result = f_lseek(&p->f, f_size(&p->f)); // seek to the end of the file
return result == FR_OK ? 1 : 0;
#else
const char *mode = md; /* to traverse/check mode */
luaL_argcheck(L, lua_checkmode(mode), 2, "invalid mode");
+22
View File
@@ -123,6 +123,19 @@ const pm_char STR_OPEN9X[] PROGMEM =
ISTR(TARANIS_PROTOCOLS)
ISTR(XJT_PROTOCOLS)
ISTR(DSM_PROTOCOLS)
#if defined(MULTIMODULE)
ISTR(MULTI_PROTOCOLS)
ISTR(SUBTYPE_FLYSKY)
ISTR(SUBTYPE_HISKY)
ISTR(SUBTYPE_YD717)
ISTR(SUBTYPE_SYMAX)
ISTR(SUBTYPE_CX10)
ISTR(SUBTYPE_CG023)
ISTR(SUBTYPE_KN)
ISTR(SUBTYPE_MT99)
ISTR(SUBTYPE_MJXQ)
ISTR(OPTIONS_DSM)
#endif
ISTR(VOLTSRC)
ISTR(CURVE_TYPES)
ISTR(VSENSORTYPES)
@@ -436,6 +449,15 @@ const pm_char STR_STATISTICS[] PROGMEM = TR_STATISTICS;
const pm_char STR_ABOUT_US[] PROGMEM = TR_ABOUT_US;
#endif
#if defined(MULTIMODULE)
const pm_char STR_MULTI_RFTUNE[] PROGMEM = TR_MULTI_RFTUNE;
const pm_char STR_MULTI_VIDFREQ[] PROGMEM = TR_MULTI_VIDFREQ;
const pm_char STR_MULTI_OPTION[] PROGMEM = TR_MULTI_OPTION;
const pm_char STR_MULTI_AUTOBIND[] PROGMEM = TR_MULTI_AUTOBIND;
const pm_char STR_MULTI_LOWPOWER[] PROGMEM = TR_MULTI_LOWPOWER;
const pm_char STR_MULTI_DSMFRAME[] PROGMEM = TR_MULTI_DSMFRAME;
#endif
const pm_char STR_RESET_BTN[] PROGMEM = TR_RESET_BTN;
#if defined(SDCARD)
+44 -8
View File
@@ -199,7 +199,22 @@ extern const pm_char STR_OPEN9X[];
#define OFS_TARANIS_PROTOCOLS (OFS_VTRAINERMODES + sizeof(TR_VTRAINERMODES))
#define OFS_XJT_PROTOCOLS (OFS_TARANIS_PROTOCOLS + sizeof(TR_TARANIS_PROTOCOLS))
#define OFS_DSM_PROTOCOLS (OFS_XJT_PROTOCOLS + sizeof(TR_XJT_PROTOCOLS))
#define OFS_VOLTSRC (OFS_DSM_PROTOCOLS + sizeof(TR_DSM_PROTOCOLS))
#if defined(MULTIMODULE)
#define OFS_MULTI_PROTOCOLS (OFS_DSM_PROTOCOLS + sizeof(TR_DSM_PROTOCOLS))
#define OFS_SUBTYPE_FLYSKY (OFS_MULTI_PROTOCOLS + sizeof(TR_MULTI_PROTOCOLS))
#define OFS_SUBTYPE_HISKY (OFS_SUBTYPE_FLYSKY + sizeof(TR_SUBTYPE_FLYSKY))
#define OFS_SUBTYPE_YD717 (OFS_SUBTYPE_HISKY + sizeof(TR_SUBTYPE_HISKY))
#define OFS_SUBTYPE_SYMAX (OFS_SUBTYPE_YD717 + sizeof(TR_SUBTYPE_YD717))
#define OFS_SUBTYPE_CX10 (OFS_SUBTYPE_SYMAX + sizeof(TR_SUBTYPE_SYMAX))
#define OFS_SUBTYPE_CG023 (OFS_SUBTYPE_CX10 + sizeof(TR_SUBTYPE_CX10))
#define OFS_SUBTYPE_KN (OFS_SUBTYPE_CG023 + sizeof(TR_SUBTYPE_CG023))
#define OFS_SUBTYPE_MT99 (OFS_SUBTYPE_KN + sizeof(TR_SUBTYPE_KN))
#define OFS_SUBTYPE_MJXQ (OFS_SUBTYPE_MT99 + sizeof(TR_SUBTYPE_MT99))
#define OFS_OPTIONS_DSM (OFS_SUBTYPE_MJXQ + sizeof(TR_SUBTYPE_MJXQ))
#define OFS_VOLTSRC (OFS_OPTIONS_DSM + sizeof(TR_OPTIONS_DSM))
#else
#define OFS_VOLTSRC (OFS_DSM_PROTOCOLS + sizeof(TR_DSM_PROTOCOLS))
#endif
#define OFS_CURVE_TYPES (OFS_VOLTSRC + sizeof(TR_VOLTSRC))
#define OFS_VSENSORTYPES (OFS_CURVE_TYPES + sizeof(TR_CURVE_TYPES))
#define OFS_VFORMULAS (OFS_VSENSORTYPES + sizeof(TR_VSENSORTYPES))
@@ -314,8 +329,21 @@ extern const pm_char STR_OPEN9X[];
#define STR_TARANIS_PROTOCOLS (STR_OPEN9X + OFS_TARANIS_PROTOCOLS)
#define STR_XJT_PROTOCOLS (STR_OPEN9X + OFS_XJT_PROTOCOLS)
#define STR_DSM_PROTOCOLS (STR_OPEN9X + OFS_DSM_PROTOCOLS)
#define STR_CURVE_TYPES (STR_OPEN9X + OFS_CURVE_TYPES)
#define STR_VSENSORTYPES (STR_OPEN9X + OFS_VSENSORTYPES)
#if defined(MULTIMODULE)
#define STR_MULTI_PROTOCOLS (STR_OPEN9X + OFS_MULTI_PROTOCOLS)
#define STR_SUBTYPE_FLYSKY (STR_OPEN9X + OFS_SUBTYPE_FLYSKY)
#define STR_SUBTYPE_HISKY (STR_OPEN9X + OFS_SUBTYPE_HISKY)
#define STR_SUBTYPE_YD717 (STR_OPEN9X + OFS_SUBTYPE_YD717)
#define STR_SUBTYPE_SYMAX (STR_OPEN9X + OFS_SUBTYPE_SYMAX)
#define STR_SUBTYPE_CX10 (STR_OPEN9X + OFS_SUBTYPE_CX10)
#define STR_SUBTYPE_CG023 (STR_OPEN9X + OFS_SUBTYPE_CG023)
#define STR_SUBTYPE_KN (STR_OPEN9X + OFS_SUBTYPE_KN)
#define STR_SUBTYPE_MT99 (STR_OPEN9X + OFS_SUBTYPE_MT99)
#define STR_SUBTYPE_MJXQ (STR_OPEN9X + OFS_SUBTYPE_MJXQ)
#define STR_OPTIONS_DSM (STR_OPEN9X + OFS_OPTIONS_DSM)
#endif
#define STR_CURVE_TYPES (STR_OPEN9X + OFS_CURVE_TYPES)
#define STR_VSENSORTYPES (STR_OPEN9X + OFS_VSENSORTYPES)
#define STR_VFORMULAS (STR_OPEN9X + OFS_VFORMULAS)
#define STR_VPREC (STR_OPEN9X + OFS_VPREC)
#define STR_VCELLINDEX (STR_OPEN9X + OFS_VCELLINDEX)
@@ -538,11 +566,19 @@ extern const pm_char STR_GF[];
#if defined(FAS_OFFSET) || !defined(CPUM64)
extern const pm_char STR_FAS_OFFSET[];
#endif
#if defined(DSM2) || defined(PXX)
extern const pm_char STR_RXNUM[];
#endif
#endif
#if defined(MULTIMODULE)
extern const pm_char STR_MULTI_OPTION[];
extern const pm_char STR_MULTI_VIDFREQ[];
extern const pm_char STR_MULTI_RFTUNE[];
extern const pm_char STR_MULTI_AUTOBIND[];
extern const pm_char STR_MULTI_LOWPOWER[];
extern const pm_char STR_MULTI_DSMFRAME[];
#endif
#if defined(DSM2) || defined(PXX)
extern const pm_char STR_RXNUM[];
#endif
#if defined(PXX) || defined(CPUARM)
extern const pm_char STR_SYNCMENU[];
+47 -7
View File
@@ -104,7 +104,7 @@
#define TR_COUNTRYCODES TR("US""JP""EU", "Amerika\0""Japonsko""Evropa\0 ")
#define LEN_TARANIS_PROTOCOLS "\004"
#define TR_TARANIS_PROTOCOLS "Vyp\0""PPM\0""XJT\0""DSM2""CRSF"
#define TR_TARANIS_PROTOCOLS "Vyp\0""PPM\0""XJT\0""DSM2""CRSF""MULT"
#define LEN_XJT_PROTOCOLS "\004"
#define TR_XJT_PROTOCOLS "Vyp\0""D16\0""D8\0 ""LR12"
@@ -112,6 +112,44 @@
#define LEN_DSM_PROTOCOLS "\004"
#define TR_DSM_PROTOCOLS "LP45""DSM2""DSMX"
#define LEN_MULTI_PROTOCOLS "\006"
#define TR_MULTI_PROTOCOLS "FlySky""Hubsan""FrSky\0""Hisky\0""V2x2\0 ""DSM2\0 ""Devo\0 ""YD717\0""KN\0 ""SymaX\0""SLT\0 ""CX10\0 ""CG023\0""Bayang""ESky\0 ""MT99XX""MJXQ\0 ""Shenqi""FY326\0""Custom"
#define LEN_SUBTYPE_FLYSKY "\004"
#define TR_SUBTYPE_FLYSKY "Std\0""V9x9""V6x6""V912"
// SUBTYPE FOR FRSKY use TR_XJT_PROTOCOLS with offset +1
#define LEN_SUBTYPE_HISKY "\005"
#define TR_SUBTYPE_HISKY "HiSky""HK310"
// SUBTYPE FOR DSMX use TR_DSM_PROTOCOLS with offset +1
#define LEN_SUBTYPE_YD717 "\007"
#define TR_SUBTYPE_YD717 "YD717\0 ""SKYWLKR""SYMAX2\0""XINXUN\0""NIHUI\0 "
#define LEN_SUBTYPE_SYMAX "\003"
#define TR_SUBTYPE_SYMAX "Std""5c\0"
#define LEN_SUBTYPE_CX10 "\007"
#define TR_SUBTYPE_CX10 "Green\0 ""Blue\0 ""DM007\0 ""Q282\0 ""JC3015a""JC3015b""MK33041""Q242\0 "
#define LEN_SUBTYPE_CG023 "\005"
#define TR_SUBTYPE_CG023 "CG023""YD829""H3 3d"
#define LEN_SUBTYPE_KN "\006"
#define TR_SUBTYPE_KN "WLtoys""FeiLun"
#define LEN_SUBTYPE_MT99 "\004"
#define TR_SUBTYPE_MT99 "MT99""H7\0 ""YZ\0 "
#define LEN_SUBTYPE_MJXQ "\005"
#define TR_SUBTYPE_MJXQ "WLH08""X600\0""X800\0""H26D"
#define LEN_OPTIONS_DSM "\011"
#define TR_OPTIONS_DSM " 4ch 22ms"" 5ch 22ms"" 6ch 22ms"" 7ch 22ms"" 4ch 11ms"" 5ch 11ms"" 6ch 11ms"" 7ch 11ms"" 8ch 22ms"" 9ch 22ms""10ch 22ms""11ch 22ms""12ch 22ms"
#define LEN_VTRIMINC "\007"
#define TR_VTRIMINC "Expo\0 ""ExJemný""Jemný\0 ""Střední""Hrubý\0 "
@@ -787,6 +825,12 @@
#else
#define TR_RXNUM "RX číslo"
#endif
#define TR_MULTI_RFTUNE INDENT "RF Freq. fine tune"
#define TR_MULTI_VIDFREQ INDENT "Video frequency"
#define TR_MULTI_DSMFRAME INDENT "DSM frame format"
#define TR_MULTI_OPTION INDENT "Option value"
#define TR_MULTI_AUTOBIND INDENT "Autobind"
#define TR_MULTI_LOWPOWER INDENT "Low power mode"
#define TR_SYNCMENU "[Sync]"
#define TR_LIMIT INDENT"Limit"
#define TR_MINRSSI "Min Rssi"
@@ -1130,12 +1174,8 @@
#define ZSTR_GPSALT "GAlt"
#define ZSTR_GPSDATETIME "Date"
#define ZSTR_GPS "GPS"
#define ZSTR_BATT1_VOLTAGE "RB1V"
#define ZSTR_BATT2_VOLTAGE "RB2V"
#define ZSTR_BATT1_CURRENT "RB1A"
#define ZSTR_BATT2_CURRENT "RB2A"
#define ZSTR_BATT1_CONSUMPTION "RB1C"
#define ZSTR_BATT2_CONSUMPTION "RB2C"
#define ZSTR_PBOX1 "PBx1"
#define ZSTR_PBOX2 "PBx2"
#define ZSTR_RX1_FAILSAFE "Rx1F"
#define ZSTR_RX1_LOSTFRAME "Rx1L"
#define ZSTR_RX1_CONN_LOST "Rx1C"
+13 -12
View File
@@ -1,4 +1,4 @@
/* German checked 17.02.2016 r102 opentx V2.17 für X9D, X9D+, X9E, Th9, 9XR, 9XR-Pro
/* German checked 27.09.2015 r096 opentx V2.1.4 für X9D,X9D+, X9E, Th9, 9XR, 9XR-Pro
* Authors (alphabetical order)
* - Bertrand Songis <bsongis@gmail.com>
* - Bernet Andre <bernet.andre@gmail.com>
@@ -104,10 +104,15 @@
#define TR_COUNTRYCODES TR("US""JP""EU", "Amerika""Japan\0 ""Europa\0")
#define LEN_TARANIS_PROTOCOLS "\004"
#define TR_TARANIS_PROTOCOLS "AUS\0""PPM\0""XJT\0""DSM2""CRSF"
#define TR_TARANIS_PROTOCOLS "AUS\0""PPM\0""XJT\0""DSM?""CRSF"
#define LEN_XJT_PROTOCOLS "\004"
#define TR_XJT_PROTOCOLS "AUS\0""D16\0""D8\0 ""LR12"
#if defined(MODULE_D16_EU_ONLY_SUPPORT)
#define LEN_XJT_PROTOCOLS "\007"
#define TR_XJT_PROTOCOLS "AUS\0 ""D16-EU\0""D8\0 ""LR12-EU"
#else
#define LEN_XJT_PROTOCOLS "\004"
#define TR_XJT_PROTOCOLS "AUS\0""X16\0""D8\0 ""LR12"
#endif
#define LEN_DSM_PROTOCOLS "\004"
#define TR_DSM_PROTOCOLS "LP45""DSM2""DSMX" //LP45 =Low Power 4 und 5 Kanal
@@ -1080,7 +1085,7 @@
#define TR_ONLYPOSITIVE "Nur Positiv"
#define TR_FILTER "Filter aktiv"
#define TR_TELEMETRYFULL "Telemetriezeilen voll!"
#define TR_INVERTED_SERIAL INDENT "Invert."
#define TR_INVERTED_SERIAL INDENT "Invert."
#define TR_IGNORE_INSTANCE TR(INDENT "Keine ID", INDENT "Keine Multisen-ID") //unklar
#define TR_DISCOVER_SENSORS INDENT "Start Sensorsuche"
#define TR_STOP_DISCOVER_SENSORS INDENT "Stop Sensorsuche"
@@ -1111,7 +1116,7 @@
#define ZSTR_A4 "A4"
#define ZSTR_BATT "RxBt"
#define ZSTR_ALT "Alt"
#define ZSTR_TEMP1 "Tmp1"
#define ZSTR_TEMP1 "Tmp1"
#define ZSTR_TEMP2 "Tmp2"
#define ZSTR_RPM "RPM"
#define ZSTR_FUEL "Fuel"
@@ -1128,12 +1133,8 @@
#define ZSTR_GPSALT "GAlt"
#define ZSTR_GPSDATETIME "Date"
#define ZSTR_GPS "GPS"
#define ZSTR_BATT1_VOLTAGE "RB1V"
#define ZSTR_BATT2_VOLTAGE "RB2V"
#define ZSTR_BATT1_CURRENT "RB1A"
#define ZSTR_BATT2_CURRENT "RB2A"
#define ZSTR_BATT1_CONSUMPTION "RB1C"
#define ZSTR_BATT2_CONSUMPTION "RB2C"
#define ZSTR_PBOX1 "PBx1"
#define ZSTR_PBOX2 "PBx2"
#define ZSTR_RX1_FAILSAFE "Rx1F"
#define ZSTR_RX1_LOSTFRAME "Rx1L"
#define ZSTR_RX1_CONN_LOST "Rx1C"
+47 -8
View File
@@ -104,7 +104,7 @@
#define TR_COUNTRYCODES TR("US""JP""EU", "America""Japan\0 ""Europe\0")
#define LEN_TARANIS_PROTOCOLS "\004"
#define TR_TARANIS_PROTOCOLS "OFF\0""PPM\0""XJT\0""DSM2""CRSF"
#define TR_TARANIS_PROTOCOLS "OFF\0""PPM\0""XJT\0""DSM2""CRSF""MULT"
#define LEN_XJT_PROTOCOLS "\004"
#define TR_XJT_PROTOCOLS "OFF\0""D16\0""D8\0 ""LR12"
@@ -112,6 +112,44 @@
#define LEN_DSM_PROTOCOLS "\004"
#define TR_DSM_PROTOCOLS "LP45""DSM2""DSMX"
#define LEN_MULTI_PROTOCOLS "\006"
#define TR_MULTI_PROTOCOLS "FlySky""Hubsan""FrSky\0""Hisky\0""V2x2\0 ""DSM2\0 ""Devo\0 ""YD717\0""KN\0 ""SymaX\0""SLT\0 ""CX10\0 ""CG023\0""Bayang""ESky\0 ""MT99XX""MJXQ\0 ""Shenqi""FY326\0""Custom"
#define LEN_SUBTYPE_FLYSKY "\004"
#define TR_SUBTYPE_FLYSKY "Std\0""V9x9""V6x6""V912"
// SUBTYPE FOR FRSKY use TR_XJT_PROTOCOLS with offset +1
#define LEN_SUBTYPE_HISKY "\005"
#define TR_SUBTYPE_HISKY "HiSky""HK310"
// SUBTYPE FOR DSMX use TR_DSM_PROTOCOLS with offset +1
#define LEN_SUBTYPE_YD717 "\007"
#define TR_SUBTYPE_YD717 "YD717\0 ""SKYWLKR""SYMAX2\0""XINXUN\0""NIHUI\0 "
#define LEN_SUBTYPE_SYMAX "\003"
#define TR_SUBTYPE_SYMAX "Std""5c\0"
#define LEN_SUBTYPE_CX10 "\007"
#define TR_SUBTYPE_CX10 "Green\0 ""Blue\0 ""DM007\0 ""Q282\0 ""JC3015a""JC3015b""MK33041""Q242\0 "
#define LEN_SUBTYPE_CG023 "\005"
#define TR_SUBTYPE_CG023 "CG023""YD829""H3 3d"
#define LEN_SUBTYPE_KN "\006"
#define TR_SUBTYPE_KN "WLtoys""FeiLun"
#define LEN_SUBTYPE_MT99 "\004"
#define TR_SUBTYPE_MT99 "MT99""H7\0 ""YZ\0 "
#define LEN_SUBTYPE_MJXQ "\005"
#define TR_SUBTYPE_MJXQ "WLH08""X600\0""X800\0""H26D"
#define LEN_OPTIONS_DSM "\011"
#define TR_OPTIONS_DSM " 4ch 22ms"" 5ch 22ms"" 6ch 22ms"" 7ch 22ms"" 4ch 11ms"" 5ch 11ms"" 6ch 11ms"" 7ch 11ms"" 8ch 22ms"" 9ch 22ms""10ch 22ms""11ch 22ms""12ch 22ms"
#define LEN_VTRIMINC TR("\006", "\013")
#define TR_VTRIMINC TR("Expo\0 ""ExFine""Fine\0 ""Medium""Coarse", "Exponential""Extra Fine\0""Fine\0 ""Medium\0 ""Coarse\0 ")
@@ -769,7 +807,6 @@
#define TR_MENUINPUTS "STICKS"
#define TR_MENULIMITS "SERVOS"
#endif
#define TR_MENUCURVES "CURVES"
#define TR_MENUCURVE "CURVE"
#define TR_MENULOGICALSWITCH "LOGICAL SWITCH"
@@ -786,6 +823,12 @@
#else
#define TR_RXNUM "RxNum"
#endif
#define TR_MULTI_RFTUNE INDENT "RF Freq. fine tune"
#define TR_MULTI_VIDFREQ INDENT "Video frequency"
#define TR_MULTI_DSMFRAME INDENT "DSM frame format"
#define TR_MULTI_OPTION INDENT "Option value"
#define TR_MULTI_AUTOBIND INDENT "Autobind"
#define TR_MULTI_LOWPOWER INDENT "Low power mode"
#define TR_SYNCMENU "[Sync]"
#define TR_LIMIT INDENT "Limit"
#define TR_MINRSSI "Min Rssi"
@@ -1128,12 +1171,8 @@
#define ZSTR_GPSALT "GAlt"
#define ZSTR_GPSDATETIME "Date"
#define ZSTR_GPS "GPS"
#define ZSTR_BATT1_VOLTAGE "RB1V"
#define ZSTR_BATT2_VOLTAGE "RB2V"
#define ZSTR_BATT1_CURRENT "RB1A"
#define ZSTR_BATT2_CURRENT "RB2A"
#define ZSTR_BATT1_CONSUMPTION "RB1C"
#define ZSTR_BATT2_CONSUMPTION "RB2C"
#define ZSTR_PBOX1 "PBx1"
#define ZSTR_PBOX2 "PBx2"
#define ZSTR_RX1_FAILSAFE "Rx1F"
#define ZSTR_RX1_LOSTFRAME "Rx1L"
#define ZSTR_RX1_CONN_LOST "Rx1C"

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