Compare commits
208 Commits
multipatchv4
...
2.0.13
| Author | SHA1 | Date | |
|---|---|---|---|
| b359aa12ba | |||
| 5f81444ccb | |||
| e8aba51edb | |||
| 6393f10ae4 | |||
| 8a16b63b31 | |||
| a5d334b11d | |||
| b51060f8f8 | |||
| 0db8fc5ab2 | |||
| 1c696c28fd | |||
| f29d2074c1 | |||
| c12bc7326c | |||
| 6365292bfe | |||
| d74bdef2ea | |||
| 884698c7f7 | |||
| 1454764987 | |||
| fb35ff098d | |||
| 681064b11c | |||
| 87ebf0b90a | |||
| 1f63108753 | |||
| 649fffa439 | |||
| e3d08e9bab | |||
| b4cc92b3f0 | |||
| 9691d9f648 | |||
| f02b9699d5 | |||
| b78556275b | |||
| 1effa17204 | |||
| ff69164400 | |||
| 86e8687d32 | |||
| 85755312e4 | |||
| f826d77f18 | |||
| 9dc4756789 | |||
| afd04e0c44 | |||
| d718ca03db | |||
| ca4028cc7e | |||
| 9c0b13eb6b | |||
| 5a10d85ee0 | |||
| 2d80327ffd | |||
| 2a5ff5244f | |||
| 2ce1ec16fb | |||
| 607a93b604 | |||
| 75b7a0517b | |||
| cf54d28f35 | |||
| ffe8ee5a29 | |||
| 552e3d468a | |||
| 949369d6a8 | |||
| 3b2cf5d738 | |||
| 5468bacad7 | |||
| b8fea4d652 | |||
| 734480cc56 | |||
| 30e0d441e4 | |||
| 784238252a | |||
| 403a62478a | |||
| c73ab26bc4 | |||
| c0783948e6 | |||
| dc3ca96a2f | |||
| 5664b4a141 | |||
| 7e18f53cbe | |||
| 611e26d0bf | |||
| ae7a36deeb | |||
| 7c37277364 | |||
| 2230fbaa94 | |||
| 97bb1a4b4d | |||
| 82d385bcef | |||
| 34f9367e25 | |||
| 205e510468 | |||
| 414a482ce4 | |||
| b24d071493 | |||
| a50e2472e9 | |||
| 29c95fd2a3 | |||
| c9875525a4 | |||
| 6df7575ad8 | |||
| 86c8d4a878 | |||
| 6abc26c36a | |||
| 966398426a | |||
| d43a48f088 | |||
| 56b4698655 | |||
| 57f0c1b6f6 | |||
| b89e16e627 | |||
| 9e4e990d33 | |||
| a7c893607a | |||
| e477183026 | |||
| a4698287f8 | |||
| b035a8df64 | |||
| 223be49c5d | |||
| ac8312de36 | |||
| 46a9151bcf | |||
| 0e9536fea9 | |||
| 64d86c4c74 | |||
| 151a09149d | |||
| fd53eba65f | |||
| 393f599ecf | |||
| 1fbb4effed | |||
| fe95488a83 | |||
| c9b9de2c99 | |||
| 3adc4c20a6 | |||
| 227a886122 | |||
| de625fde01 | |||
| daad477250 | |||
| 334a718a8a | |||
| 5baaec1868 | |||
| c2ad82eb35 | |||
| c61c417f13 | |||
| 98f156301a | |||
| ef6fe0006e | |||
| 23358c254c | |||
| 6114245229 | |||
| e76880cf26 | |||
| f30dfa3365 | |||
| f4aa92ec20 | |||
| 2640ca9fea | |||
| f6a1420ce3 | |||
| 6c0f65411a | |||
| a7f1ace55b | |||
| b8dedd7940 | |||
| 2703118c56 | |||
| 8bfc7a497a | |||
| 87870c24a5 | |||
| 7610fb43d5 | |||
| 0263784e65 | |||
| 6f74624371 | |||
| 1c721b3817 | |||
| 67d97046bb | |||
| 19d9e6ab19 | |||
| 5d9883d47f | |||
| bb5f1d7d79 | |||
| 30087b4a3a | |||
| 61aa01b9b3 | |||
| 16e06cff70 | |||
| 2073a1f033 | |||
| 563b817b46 | |||
| 8b540a66f6 | |||
| b0b7657756 | |||
| 74d22b623f | |||
| bee01d9999 | |||
| d2055edf62 | |||
| c926ac557b | |||
| 3e2092e32f | |||
| 21054ffc54 | |||
| 350ece0b60 | |||
| 01a103f2e6 | |||
| 2e8e439d27 | |||
| 98e6a3dc21 | |||
| 3b324d076a | |||
| 91c922d5fb | |||
| eac918c2da | |||
| b5f9c0ec84 | |||
| d1f54b099b | |||
| 7b98ad55c0 | |||
| d2cb7cb3dd | |||
| be190b8bb1 | |||
| 4b2c02b2c5 | |||
| 142d3fee1a | |||
| 6a5e938ead | |||
| 2d9ae108ff | |||
| bae84e4e8c | |||
| f4944eefdb | |||
| 5d598cc6a1 | |||
| 945808d69b | |||
| dbe512e45a | |||
| 11efb5121e | |||
| f6274f38aa | |||
| cd1f20b8a0 | |||
| e61b931ddb | |||
| a7a9b61234 | |||
| 5ee95673d1 | |||
| 98c5b5e7bd | |||
| 6d434c0bf9 | |||
| ade7151796 | |||
| a7cd1f9aa0 | |||
| cb2c922542 | |||
| 8159a559da | |||
| ed826d8c62 | |||
| b57f5ab2ce | |||
| 8fbafa6f05 | |||
| 9243a59426 | |||
| ccf66831c7 | |||
| 06792b5696 | |||
| 6d4d871849 | |||
| 5a634a7991 | |||
| 69e504212e | |||
| 03e049c360 | |||
| 4ca893da1f | |||
| 66670cf713 | |||
| 271bb4a82e | |||
| e0eab648ef | |||
| 3235f43db9 | |||
| c12b0cfebe | |||
| 3e590d44f0 | |||
| 1f6d1799af | |||
| 8c813a87c9 | |||
| 5bdeedbd0e | |||
| e33f4cf415 | |||
| 61d745011a | |||
| 3e269a04ae | |||
| 341feaf78f | |||
| 19ddf6fc23 | |||
| 9b4b0d3c83 | |||
| dc1eebf40d | |||
| 752e13b9ab | |||
| b988bec5bd | |||
| 3c72afed20 | |||
| e7586f47c3 | |||
| f126b149f0 | |||
| 6b15c0c985 | |||
| db85f39ebc | |||
| dee1e4ce8d | |||
| df96504a85 | |||
| 0112a1e3e9 |
@@ -566,3 +566,77 @@ Bertrand Condevaux Lanloy
|
||||
Henri Mirra
|
||||
Aurélien Planiol
|
||||
Kevin Caldwell
|
||||
Andrew Garello
|
||||
Tomasz Maziarz
|
||||
Russell Flack
|
||||
Fernando Rimoldi
|
||||
Greg Reid
|
||||
Dietmar Drees
|
||||
Holger Landwehr
|
||||
Arno Loehdorf
|
||||
Boon Sripattha
|
||||
Patrik Åkerfeldt
|
||||
Alonzo Fretwell
|
||||
Renjith Chandrasekharan
|
||||
Ruben Gomez Hernandez
|
||||
Michael Gardner
|
||||
Judith Green
|
||||
Timo Ruppell
|
||||
John Lipscomb
|
||||
Norbert Wenke
|
||||
Erik Frieberg
|
||||
Raimo Ruotsalainen
|
||||
Brian Harris
|
||||
Sebastian Blüml
|
||||
Efisio Maxia
|
||||
Jeff Theobald
|
||||
Anthony Rizzo
|
||||
Rodney Huddleston
|
||||
Dietmar Drees
|
||||
Jürgen Monden
|
||||
David Morgan
|
||||
Andrew Fernie
|
||||
Michel Baily
|
||||
Donald Burke
|
||||
Ronald Donker
|
||||
Fredie Singh
|
||||
Patrizio Simoncini (monthly)
|
||||
Harald Gabler
|
||||
Michael Brown
|
||||
Julien Gérard
|
||||
Alexandre d'Alton
|
||||
Peter Mergaerts
|
||||
Jan Houwers
|
||||
Gordon Stahl
|
||||
Christian Grandjean
|
||||
Roger Bergevin
|
||||
NorthSide
|
||||
Sigmund Martinsen
|
||||
Lionel Lafraise
|
||||
Gisli Ofeigsson
|
||||
The Gruvin9x Project
|
||||
Manuel McLure
|
||||
Fernando Rimoldi
|
||||
Hiltenkamp Stephan
|
||||
Sandeep Kishore Jain
|
||||
Sebastien Charpentier
|
||||
Greg Parker
|
||||
Norman Maaß
|
||||
Adriano Del Ben
|
||||
Justin Poole
|
||||
Kenneth Harrison
|
||||
Eugene LaFaille
|
||||
John O'Shaughnessy
|
||||
Uwe Jordt
|
||||
Stuart Olson
|
||||
Frédéric Devillard
|
||||
Cheung Leo
|
||||
Peter Webster
|
||||
Jean-Claude Bachetta
|
||||
Delfin Perena
|
||||
Sae-wook Yoon
|
||||
Focus on Excellence
|
||||
Jeffery Golias
|
||||
Nick Milton
|
||||
Paul Zasso
|
||||
Reidar Johannes Lillebotn
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
##OpenTX Next Branch
|
||||
##OpenTX Master Branch
|
||||
|
||||
You have found your way to the GitHub repository site for the OpenTX Next Branch. This code branch holds the source code for the ongoing development.
|
||||
You have found your way to the GitHub repository site for the OpenTX Master Branch. This code branch holds the source code for the latest stable release.
|
||||
|
||||
The stable release code is not here, it is in the master branch.
|
||||
Under no circumstances build and use software from this branch for real world application. At times you will be more or less guaranteed to crash your plane and destroy all your model settings.
|
||||
The ongoing development is not done in this branch. It is performed in the branch called next.
|
||||
|
||||
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.
|
||||
|
||||
@@ -1,9 +1,38 @@
|
||||
<h2>Version 2.0.9</h2>
|
||||
<h2>Version 2.0.13 / 2014-11-20</h2>
|
||||
<ul>
|
||||
<li>Taranis is now the default board in General Settings</li>
|
||||
<li>Too many curves shown on non ARM boards</li>
|
||||
<li>Fixed vario limits</li>
|
||||
<li>Fixes in compare dialog</li>
|
||||
<li>Fixed receiver number range</li>
|
||||
<li>Virtual inputs not selectable in SF Volume and heli Collective Source</li>
|
||||
<li>Joystick calibration crash after channel assignment</li>
|
||||
<li>Gvar import error for limits</li>
|
||||
<li>Companion shows too many curve types in input/mixer for 9x</li>
|
||||
<li>NOT curves removed from inputs (for non ARM platforms)</li>
|
||||
<li>Companion again builds on OS X (Mac)</li>
|
||||
<li>Companion simulator Lua crash on OS X 64bit (Mac)</li>
|
||||
<li>Companion didn't take care of PlayScript functions</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.8</h2>
|
||||
<h2>Version 2.0.12 / 2014-09-15</h2>
|
||||
<ul>
|
||||
<li>Typos & Translations updated</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.11 / 2014-09-10</h2>
|
||||
<ul>
|
||||
<li>Limits EEPROM export was broken (all boards except Taranis)</li>
|
||||
<li>Fix issue when a GVAR was used as Offset</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.10 / 2014-09-08</h2>
|
||||
<ul>
|
||||
<li>Taranis is now the default board in General Settings</li>
|
||||
<li>GVARS allowed in Limits min/max/offset</li>
|
||||
<li>Limits displayed in us when ppmus option selected
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.8 / 2014-07-23</h2>
|
||||
<ul>
|
||||
<li>Compare dialog bugfixes</li>
|
||||
<li>Curve index correctly resetted when type changed</li>
|
||||
|
||||
@@ -2,7 +2,7 @@ PROJECT( companion )
|
||||
|
||||
SET( C9X_VERSION_MAJOR "2" )
|
||||
SET( C9X_VERSION_MINOR "0" )
|
||||
SET( C9X_VERSION_REVISION "9" )
|
||||
SET( C9X_VERSION_REVISION "13" )
|
||||
SET( C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR}.${C9X_VERSION_REVISION} )
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
|
||||
@@ -89,7 +89,7 @@ add_custom_command(
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${RADIO_SRC_DIRECTORY}/lua_exports.inc
|
||||
COMMAND make lua_exports.cpp
|
||||
COMMAND make PCB=TARANIS lua_exports.cpp
|
||||
DEPENDS ${RADIO_SRC_DIRECTORY}/myeeprom.h
|
||||
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
|
||||
)
|
||||
|
||||
@@ -797,7 +797,7 @@ void CompareDialog::printMixers()
|
||||
if (md->swtch.type) str += " " + tr("Switch") + QString("(%1)").arg(md->swtch.toString());
|
||||
if (md->carryTrim) str += " " + tr("noTrim");
|
||||
if (md->sOffset) str += " "+ tr("Offset") + QString(" (%1%)").arg(getGVarString(md->sOffset));
|
||||
if (md->curve.value) str += " " + md->curve.toString().replace("<", "<").replace(">", ">");
|
||||
if (md->curve.value) str += " " + Qt::escape(md->curve.toString());
|
||||
if (md->delayDown || md->delayUp) str += tr(" Delay(u%1:d%2)").arg(md->delayUp/scale).arg(md->delayDown/scale);
|
||||
if (md->speedDown || md->speedUp) str += tr(" Slow(u%1:d%2)").arg(md->speedUp/scale).arg(md->speedDown/scale);
|
||||
if (md->mixWarn) str += " "+tr("Warn")+QString("(%1)").arg(md->mixWarn);
|
||||
@@ -875,7 +875,7 @@ void CompareDialog::printMixers()
|
||||
if (md->swtch.type) str += " " + tr("Switch") + QString("(%1)").arg(md->swtch.toString());
|
||||
if (md->carryTrim) str += " " + tr("noTrim");
|
||||
if (md->sOffset) str += " "+ tr("Offset") + QString(" (%1%)").arg(getGVarString(md->sOffset));
|
||||
if (md->curve.value) str += " " + md->curve.toString().replace("<", "<").replace(">", ">");
|
||||
if (md->curve.value) str += " " + Qt::escape(md->curve.toString());
|
||||
if (md->delayDown || md->delayUp) str += tr(" Delay(u%1:d%2)").arg(md->delayUp/scale).arg(md->delayDown/scale);
|
||||
if (md->speedDown || md->speedUp) str += tr(" Slow(u%1:d%2)").arg(md->speedUp/scale).arg(md->speedDown/scale);
|
||||
if (md->mixWarn) str += " "+tr("Warn")+QString("(%1)").arg(md->mixWarn);
|
||||
@@ -1021,11 +1021,7 @@ void CompareDialog::printSwitches()
|
||||
str.append("<tr>");
|
||||
color=getColor1(sw1,sw2);
|
||||
str.append(QString("<td width=\"45%\"><font color=%1>").arg(color)+sw1+"</font></td>");
|
||||
if (i<9) {
|
||||
str.append("<td align=\"center\" width=\"10%\"><b>"+tr("LS")+QString("%1</b></td>").arg(i+1));
|
||||
} else {
|
||||
str.append("<td align=\"center\" width=\"10%\"><b>"+tr("LS")+('A'+(i-9))+"</b></td>");
|
||||
}
|
||||
str.append("<td align=\"center\" width=\"10%\"><b>"+tr("L%1").arg(i+1)+QString("</b></td>"));
|
||||
color=getColor2(sw1,sw2);
|
||||
str.append(QString("<td width=\"45%\"><font color=%1>").arg(color)+sw2+"</font></td>");
|
||||
str.append("</tr>");
|
||||
|
||||
@@ -301,7 +301,7 @@ RawSourceRange RawSource::getRange(const ModelData & model, const GeneralSetting
|
||||
break;
|
||||
|
||||
default:
|
||||
result.max = (model.extendedLimits ? 125 : 100);
|
||||
result.max = model.getChannelsMax(true);
|
||||
result.min = -result.max;
|
||||
break;
|
||||
}
|
||||
@@ -460,7 +460,7 @@ QString RawSwitch::toString()
|
||||
};
|
||||
|
||||
static const QString timerModes[] = {
|
||||
QObject::tr("OFF"), QObject::tr("ABS"),
|
||||
QObject::tr("OFF"), QObject::tr("ON"),
|
||||
QObject::tr("THs"), QObject::tr("TH%"), QObject::tr("THt")
|
||||
};
|
||||
|
||||
@@ -723,7 +723,7 @@ void FuncSwData::clear()
|
||||
QString FuncSwData::funcToString()
|
||||
{
|
||||
ModelData model;
|
||||
if (func >= FuncSafetyCh1 && func <= FuncSafetyCh32)
|
||||
if (func >= FuncOverrideCH1 && func <= FuncOverrideCH32)
|
||||
return QObject::tr("Override %1").arg(RawSource(SOURCE_TYPE_CH, func).toString(model));
|
||||
else if (func == FuncTrainer)
|
||||
return QObject::tr("Trainer");
|
||||
@@ -753,6 +753,8 @@ QString FuncSwData::funcToString()
|
||||
return QObject::tr("Play Both");
|
||||
else if (func == FuncPlayValue)
|
||||
return QObject::tr("Play Value");
|
||||
else if (func == FuncPlayScript)
|
||||
return QObject::tr("Play Script");
|
||||
else if (func == FuncLogs)
|
||||
return QObject::tr("Start Logs");
|
||||
else if (func == FuncVolume)
|
||||
@@ -1309,9 +1311,9 @@ ModelData ModelData::removeGlobalVars()
|
||||
return result;
|
||||
}
|
||||
|
||||
int ModelData::getChannelsMax()
|
||||
int ModelData::getChannelsMax(bool forceExtendedLimits) const
|
||||
{
|
||||
if (extendedLimits)
|
||||
if (forceExtendedLimits || extendedLimits)
|
||||
return IS_TARANIS(GetCurrentFirmware()->getBoard()) ? 150 : 125;
|
||||
else
|
||||
return 100;
|
||||
|
||||
@@ -526,6 +526,8 @@ class GeneralSettings {
|
||||
int temperatureCalib;
|
||||
int temperatureWarn;
|
||||
unsigned int mAhWarn;
|
||||
unsigned int mAhUsed;
|
||||
unsigned int globalTimer;
|
||||
unsigned int btBaudrate;
|
||||
unsigned int sticksGain;
|
||||
unsigned int rotarySteps;
|
||||
@@ -725,8 +727,8 @@ class LogicalSwitchData { // Logical Switches data
|
||||
};
|
||||
|
||||
enum AssignFunc {
|
||||
FuncSafetyCh1 = 0,
|
||||
FuncSafetyCh32 = FuncSafetyCh1+C9X_NUM_CHNOUT-1,
|
||||
FuncOverrideCH1 = 0,
|
||||
FuncOverrideCH32 = FuncOverrideCH1+C9X_NUM_CHNOUT-1,
|
||||
FuncTrainer,
|
||||
FuncTrainerRUD,
|
||||
FuncTrainerELE,
|
||||
@@ -742,6 +744,7 @@ enum AssignFunc {
|
||||
FuncPlayPrompt,
|
||||
FuncPlayBoth,
|
||||
FuncPlayValue,
|
||||
FuncPlayScript,
|
||||
FuncLogs,
|
||||
FuncVolume,
|
||||
FuncBacklight,
|
||||
@@ -755,7 +758,7 @@ enum AssignFunc {
|
||||
|
||||
class FuncSwData { // Function Switches data
|
||||
public:
|
||||
FuncSwData(AssignFunc func=FuncSafetyCh1) { clear(); this->func = func; }
|
||||
FuncSwData(AssignFunc func=FuncOverrideCH1) { clear(); this->func = func; }
|
||||
RawSwitch swtch;
|
||||
AssignFunc func;
|
||||
int param;
|
||||
@@ -1043,7 +1046,7 @@ class ModelData {
|
||||
void clearMixes();
|
||||
void clearInputs();
|
||||
|
||||
int getChannelsMax();
|
||||
int getChannelsMax(bool forceExtendedLimits=false) const;
|
||||
|
||||
protected:
|
||||
void removeGlobalVar(int & var);
|
||||
@@ -1129,6 +1132,7 @@ enum Capability {
|
||||
HasSoundMixer,
|
||||
NumModules,
|
||||
PPMCenter,
|
||||
PPMUnitMicroseconds,
|
||||
SYMLimits,
|
||||
HasCurrentCalibration,
|
||||
HasVolume,
|
||||
@@ -1155,6 +1159,8 @@ enum Capability {
|
||||
MultiposPotsPositions,
|
||||
SimulatorVariant,
|
||||
MavlinkTelemetry,
|
||||
HasInputDiff,
|
||||
HasMixerExpo,
|
||||
};
|
||||
|
||||
class SimulatorInterface;
|
||||
|
||||
@@ -576,7 +576,7 @@ t_Open9xArmFuncSwData_v208::operator FuncSwData ()
|
||||
FuncSwData c9x;
|
||||
c9x.swtch = open9xArmToSwitch(swtch);
|
||||
c9x.func = (AssignFunc)(func);
|
||||
if (c9x.func <= FuncSafetyCh32) {
|
||||
if (c9x.func <= FuncOverrideCH32) {
|
||||
c9x.enabled=param & 0x01;
|
||||
c9x.param = (param>>1)<<1;
|
||||
}
|
||||
|
||||
@@ -149,6 +149,7 @@ inline int geteepromsize() {
|
||||
#include "radio/src/lua/src/lstate.c"
|
||||
#include "radio/src/lua/src/lstring.c"
|
||||
#include "radio/src/lua/src/ltable.c"
|
||||
#include "radio/src/lua/src/lrotable.c"
|
||||
#include "radio/src/lua/src/ltm.c"
|
||||
#include "radio/src/lua/src/lundump.c"
|
||||
#include "radio/src/lua/src/lvm.c"
|
||||
@@ -156,6 +157,7 @@ inline int geteepromsize() {
|
||||
#include "radio/src/lua/src/lbaselib.c"
|
||||
#include "radio/src/lua/src/linit.c"
|
||||
#include "radio/src/lua/src/lmathlib.c"
|
||||
#include "radio/src/lua/src/lbitlib.c"
|
||||
#include "radio/src/lua/src/loadlib.c"
|
||||
#include "radio/src/lua/src/lauxlib.c"
|
||||
#include "radio/src/lua/src/ltablib.c"
|
||||
|
||||
@@ -202,8 +202,8 @@ class SourcesConversionTable: public ConversionTable {
|
||||
if (IS_TARANIS(board) && version >= 216) {
|
||||
for (int i=0; i<32; i++)
|
||||
addConversion(RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i), val++);
|
||||
for (int i=0; i<GetCurrentFirmware()->getCapability(LuaScripts); i++) {
|
||||
for (int j=0; j<GetCurrentFirmware()->getCapability(LuaOutputsPerScript); j++) {
|
||||
for (int i=0; i<7; i++) {
|
||||
for (int j=0; j<6; j++) {
|
||||
addConversion(RawSource(SOURCE_TYPE_LUA_OUTPUT, i*16+j), val++);
|
||||
}
|
||||
}
|
||||
@@ -991,7 +991,12 @@ class MixField: public TransformedField {
|
||||
_destCh = mix.destCh - 1;
|
||||
if (mix.curve.type == CurveReference::CURVE_REF_CUSTOM) {
|
||||
_curveMode = true;
|
||||
_curveParam = 6 + mix.curve.value;
|
||||
if (mix.curve.value > 0) {
|
||||
_curveParam = 6 + mix.curve.value;
|
||||
}
|
||||
else {
|
||||
_curveParam = mix.curve.value;
|
||||
}
|
||||
}
|
||||
else if (mix.curve.type == CurveReference::CURVE_REF_FUNC) {
|
||||
_curveMode = true;
|
||||
@@ -1039,6 +1044,8 @@ class MixField: public TransformedField {
|
||||
mix.curve = CurveReference(CurveReference::CURVE_REF_DIFF, smallGvarToC9x(_curveParam));
|
||||
else if (_curveParam > 6)
|
||||
mix.curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, _curveParam-6);
|
||||
else if (_curveParam < 0)
|
||||
mix.curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, _curveParam);
|
||||
else
|
||||
mix.curve = CurveReference(CurveReference::CURVE_REF_FUNC, _curveParam);
|
||||
}
|
||||
@@ -1098,7 +1105,7 @@ class InputField: public TransformedField {
|
||||
internalField.Append(new SignedField<6>(expo.carryTrim, "CarryTrim"));
|
||||
internalField.Append(new UnsignedField<2>(expo.mode, "Mode"));
|
||||
internalField.Append(new ZCharField<8>(expo.name));
|
||||
internalField.Append(new SignedField<8>(expo.offset, "Offset"));
|
||||
internalField.Append(new SignedField<8>(_offset, "Offset"));
|
||||
internalField.Append(new CurveReferenceField(expo.curve, board, version));
|
||||
internalField.Append(new SpareBitsField<8>());
|
||||
}
|
||||
@@ -1151,7 +1158,11 @@ class InputField: public TransformedField {
|
||||
|
||||
virtual void beforeExport()
|
||||
{
|
||||
_weight = smallGvarToEEPROM(expo.weight);
|
||||
_weight = smallGvarToEEPROM(expo.weight);
|
||||
|
||||
if (IS_TARANIS(board) && version >= 216) {
|
||||
_offset = smallGvarToEEPROM(expo.offset);
|
||||
}
|
||||
|
||||
if (!IS_TARANIS(board) || version < 216) {
|
||||
if (expo.curve.type==CurveReference::CURVE_REF_FUNC && expo.curve.value) {
|
||||
@@ -1184,6 +1195,10 @@ class InputField: public TransformedField {
|
||||
|
||||
expo.weight = smallGvarToC9x(_weight);
|
||||
|
||||
if (IS_TARANIS(board) && version >= 216) {
|
||||
expo.offset = smallGvarToC9x(_offset);
|
||||
}
|
||||
|
||||
if (!IS_TARANIS(board) || version < 216) {
|
||||
if (!_curveMode)
|
||||
expo.curve = CurveReference(CurveReference::CURVE_REF_EXPO, smallGvarToC9x(_curveParam));
|
||||
@@ -1201,24 +1216,65 @@ class InputField: public TransformedField {
|
||||
unsigned int version;
|
||||
bool _curveMode;
|
||||
int _weight;
|
||||
int _offset;
|
||||
int _curveParam;
|
||||
};
|
||||
|
||||
class LimitField: public StructField {
|
||||
public:
|
||||
template <int shift>
|
||||
static int exportLimitValue(int value)
|
||||
{
|
||||
const int GV1 = 4096;
|
||||
if (value > 10000) {
|
||||
return -GV1 + value - 10001;
|
||||
}
|
||||
if (value < -10000) {
|
||||
return GV1 + value + 10000;
|
||||
}
|
||||
return value + shift;
|
||||
}
|
||||
|
||||
template <int shift>
|
||||
static int importLimitValue(int value)
|
||||
{
|
||||
/* GVARS mapping on radio:
|
||||
GV1 = -4096
|
||||
GV9 = -4088
|
||||
-GV1 = 4095
|
||||
-GV9 = 4087
|
||||
*/
|
||||
const int GV1 = 4096;
|
||||
if (value >= GV1) {
|
||||
return 10001 + value - GV1;
|
||||
}
|
||||
if (value >= GV1-9) {
|
||||
return -10000 + value - GV1;
|
||||
}
|
||||
if (value < -GV1) {
|
||||
return -10000 + value + GV1 + 1;
|
||||
}
|
||||
if (value < -GV1+9) {
|
||||
return 10000 + value + GV1 + 1;
|
||||
}
|
||||
return value - shift;
|
||||
}
|
||||
|
||||
LimitField(LimitData & limit, BoardEnum board, unsigned int version):
|
||||
StructField("Limit")
|
||||
{
|
||||
if (IS_TARANIS(board) && version >= 216) {
|
||||
Append(new ConversionField< SignedField<16> >(limit.min, +1000));
|
||||
Append(new ConversionField< SignedField<16> >(limit.max, -1000));
|
||||
Append(new ConversionField< SignedField<16> >(limit.min, exportLimitValue<1000>, importLimitValue<1000>));
|
||||
Append(new ConversionField< SignedField<16> >(limit.max, exportLimitValue<-1000>, importLimitValue<-1000>));
|
||||
Append(new SignedField<8>(limit.ppmCenter));
|
||||
Append(new ConversionField< SignedField<14> >(limit.offset, exportLimitValue<0>, importLimitValue<0>));
|
||||
}
|
||||
else {
|
||||
Append(new ConversionField< SignedField<8> >(limit.min, +100, 10));
|
||||
Append(new ConversionField< SignedField<8> >(limit.max, -100, 10));
|
||||
Append(new SignedField<8>(limit.ppmCenter));
|
||||
Append(new SignedField<14>(limit.offset));
|
||||
}
|
||||
Append(new SignedField<8>(limit.ppmCenter));
|
||||
Append(new SignedField<14>(limit.offset));
|
||||
Append(new BoolField<1>(limit.symetrical));
|
||||
Append(new BoolField<1>(limit.revert));
|
||||
if (HAS_LARGE_LCD(board)) {
|
||||
@@ -1711,7 +1767,10 @@ class CustomFunctionsConversionTable: public ConversionTable {
|
||||
addConversion(FuncPlayValue, val++);
|
||||
if (IS_ARM(board)) {
|
||||
addConversion(FuncReserve, val++);
|
||||
addConversion(FuncReserve, val++);
|
||||
if (IS_TARANIS(board))
|
||||
addConversion(FuncPlayScript, val++);
|
||||
else
|
||||
addConversion(FuncReserve, val++);
|
||||
addConversion(FuncReserve, val++);
|
||||
addConversion(FuncBackgroundMusic, val++);
|
||||
addConversion(FuncBackgroundMusicPause, val++);
|
||||
@@ -1833,10 +1892,10 @@ class ArmCustomFunctionField: public TransformedField {
|
||||
else
|
||||
_active = (fn.enabled ? 1 : 0);
|
||||
|
||||
if (fn.func >= FuncSafetyCh1 && fn.func <= FuncSafetyCh32) {
|
||||
if (fn.func >= FuncOverrideCH1 && fn.func <= FuncOverrideCH32) {
|
||||
if (version >= 216) {
|
||||
*((uint16_t *)_param) = fn.param;
|
||||
*((uint8_t *)(_param+3)) = fn.func - FuncSafetyCh1;
|
||||
*((uint8_t *)(_param+3)) = fn.func - FuncOverrideCH1;
|
||||
}
|
||||
else {
|
||||
*((uint32_t *)_param) = fn.param;
|
||||
@@ -1852,7 +1911,7 @@ class ArmCustomFunctionField: public TransformedField {
|
||||
*((uint8_t *)(_param+3)) = fn.func - FuncSetTimer1;
|
||||
}
|
||||
}
|
||||
else if (fn.func == FuncPlayPrompt || fn.func == FuncBackgroundMusic) {
|
||||
else if (fn.func == FuncPlayPrompt || fn.func == FuncBackgroundMusic || fn.func == FuncPlayScript) {
|
||||
memcpy(_param, fn.paramarm, sizeof(_param));
|
||||
}
|
||||
else if (fn.func >= FuncAdjustGV1 && fn.func <= FuncAdjustGVLast) {
|
||||
@@ -1915,7 +1974,7 @@ class ArmCustomFunctionField: public TransformedField {
|
||||
value = *((uint32_t *)_param);
|
||||
}
|
||||
|
||||
if (fn.func >= FuncSafetyCh1 && fn.func <= FuncSafetyCh32) {
|
||||
if (fn.func >= FuncOverrideCH1 && fn.func <= FuncOverrideCH32) {
|
||||
fn.func = AssignFunc(fn.func + index);
|
||||
fn.param = (int8_t)value;
|
||||
}
|
||||
@@ -1927,7 +1986,7 @@ class ArmCustomFunctionField: public TransformedField {
|
||||
fn.func = AssignFunc(fn.func + index);
|
||||
fn.param = value;
|
||||
}
|
||||
else if (fn.func == FuncPlayPrompt || fn.func == FuncBackgroundMusic) {
|
||||
else if (fn.func == FuncPlayPrompt || fn.func == FuncBackgroundMusic || fn.func == FuncPlayScript) {
|
||||
memcpy(fn.paramarm, _param, sizeof(fn.paramarm));
|
||||
}
|
||||
else if (fn.func == FuncVolume) {
|
||||
@@ -2020,9 +2079,9 @@ class AvrCustomFunctionField: public TransformedField {
|
||||
_param = fn.param;
|
||||
_active = (fn.enabled ? 1 : 0);
|
||||
|
||||
if (fn.func >= FuncSafetyCh1 && fn.func <= FuncSafetyCh32) {
|
||||
if (fn.func >= FuncOverrideCH1 && fn.func <= FuncOverrideCH32) {
|
||||
if (version >= 216)
|
||||
_union_param = fn.func - FuncSafetyCh1;
|
||||
_union_param = fn.func - FuncOverrideCH1;
|
||||
else if (version >= 213)
|
||||
_active += ((fn.func % 4) << 1);
|
||||
}
|
||||
@@ -2080,7 +2139,7 @@ class AvrCustomFunctionField: public TransformedField {
|
||||
fn.enabled = (_active & 0x01);
|
||||
}
|
||||
|
||||
if (fn.func >= FuncSafetyCh1 && fn.func <= FuncSafetyCh32) {
|
||||
if (fn.func >= FuncOverrideCH1 && fn.func <= FuncOverrideCH32) {
|
||||
if (version >= 216)
|
||||
fn.func = AssignFunc(fn.func + _union_param);
|
||||
else if (version >= 213)
|
||||
@@ -2790,8 +2849,8 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
|
||||
if (version >= 213) {
|
||||
internalField.Append(new SignedField<8>(generalData.temperatureWarn)); // TODO
|
||||
internalField.Append(new UnsignedField<8>(generalData.mAhWarn));
|
||||
internalField.Append(new SpareBitsField<16>()); // mAhUsed
|
||||
internalField.Append(new SpareBitsField<32>()); // globalTimer
|
||||
internalField.Append(new UnsignedField<16>(generalData.mAhUsed));
|
||||
internalField.Append(new UnsignedField<32>(generalData.globalTimer));
|
||||
internalField.Append(new SignedField<8>(generalData.temperatureCalib)); // TODO
|
||||
internalField.Append(new UnsignedField<8>(generalData.btBaudrate)); // TODO
|
||||
internalField.Append(new BoolField<8>(generalData.optrexDisplay)); //TODO
|
||||
|
||||
@@ -663,7 +663,9 @@ int OpenTxFirmware::getCapability(const Capability capability)
|
||||
case TelemetryMaxMultiplier:
|
||||
return (IS_ARM(board) ? 32 : 8);
|
||||
case PPMCenter:
|
||||
return 1;
|
||||
return (IS_TARANIS(board) || id.contains("ppmca")) ? 1 : 0;
|
||||
case PPMUnitMicroseconds:
|
||||
return id.contains("ppmus") ? 1 : 0;
|
||||
case SYMLimits:
|
||||
return 1;
|
||||
case OptrexDisplay:
|
||||
@@ -730,6 +732,9 @@ int OpenTxFirmware::getCapability(const Capability capability)
|
||||
return 0;
|
||||
case MavlinkTelemetry:
|
||||
return id.contains("mavlink") ? 1 : 0;
|
||||
case HasInputDiff:
|
||||
case HasMixerExpo:
|
||||
return (IS_ARM(board) ? true : false);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ These will be relevant for all models in the same EEPROM.</string>
|
||||
<item>
|
||||
<widget class="QSlider" name="backlightColor_SL">
|
||||
<property name="maximum">
|
||||
<number>17</number>
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>5</number>
|
||||
|
||||
+50
-28
@@ -147,18 +147,18 @@ void populatePhasesCB(QComboBox *b, int value)
|
||||
b->setCurrentIndex(value + GetCurrentFirmware()->getCapability(FlightModes));
|
||||
}
|
||||
|
||||
GVarGroup::GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightCB, int & weight, const int deflt, const int mini, const int maxi, const unsigned int flags):
|
||||
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),
|
||||
sb(dynamic_cast<QSpinBox *>(weightSB)),
|
||||
dsb(dynamic_cast<QDoubleSpinBox *>(weightSB)),
|
||||
weightCB(weightCB),
|
||||
weight(weight),
|
||||
flags(flags),
|
||||
lock(false)
|
||||
step(step),
|
||||
lock(true)
|
||||
{
|
||||
lock = true;
|
||||
|
||||
if (GetCurrentFirmware()->getCapability(Gvars)) {
|
||||
if (allowGvars && GetCurrentFirmware()->getCapability(Gvars)) {
|
||||
populateGVCB(weightCB, weight);
|
||||
connect(weightGV, SIGNAL(stateChanged(int)), this, SLOT(gvarCBChanged(int)));
|
||||
connect(weightCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
|
||||
@@ -170,21 +170,32 @@ GVarGroup::GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightC
|
||||
}
|
||||
}
|
||||
|
||||
weightSB->setMinimum(mini);
|
||||
weightSB->setMaximum(maxi);
|
||||
int val;
|
||||
|
||||
if (weight>maxi || weight<mini) {
|
||||
val = deflt;
|
||||
weightGV->setChecked(true);
|
||||
weightSB->hide();
|
||||
weightCB->show();
|
||||
}
|
||||
else {
|
||||
val = weight;
|
||||
weightGV->setChecked(false);
|
||||
weightSB->setValue(weight);
|
||||
weightSB->show();
|
||||
weightCB->hide();
|
||||
}
|
||||
|
||||
if (sb) {
|
||||
sb->setMinimum(mini);
|
||||
sb->setMaximum(maxi);
|
||||
sb->setValue(val);
|
||||
}
|
||||
else {
|
||||
dsb->setMinimum(mini*step);
|
||||
dsb->setMaximum(maxi*step);
|
||||
dsb->setValue(val*step);
|
||||
}
|
||||
|
||||
connect(weightSB, SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
|
||||
|
||||
lock = false;
|
||||
@@ -193,16 +204,23 @@ GVarGroup::GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightC
|
||||
void GVarGroup::gvarCBChanged(int state)
|
||||
{
|
||||
weightCB->setVisible(state);
|
||||
weightSB->setVisible(!state);
|
||||
if (weightSB)
|
||||
weightSB->setVisible(!state);
|
||||
else
|
||||
weightSB->setVisible(!state);
|
||||
valuesChanged();
|
||||
}
|
||||
|
||||
void GVarGroup::valuesChanged()
|
||||
{
|
||||
if (weightGV->isChecked())
|
||||
weight = weightCB->itemData(weightCB->currentIndex()).toInt();
|
||||
else
|
||||
weight = weightSB->value();
|
||||
if (!lock) {
|
||||
if (weightGV->isChecked())
|
||||
weight = weightCB->itemData(weightCB->currentIndex()).toInt();
|
||||
else if (sb)
|
||||
weight = sb->value();
|
||||
else
|
||||
weight = dsb->value()/step;
|
||||
}
|
||||
}
|
||||
|
||||
CurveGroup::CurveGroup(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueSB, CurveReference & curve, unsigned int flags):
|
||||
@@ -216,10 +234,10 @@ CurveGroup::CurveGroup(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox
|
||||
lock(false),
|
||||
lastType(-1)
|
||||
{
|
||||
curveTypeCB->addItem(tr("Diff"));
|
||||
curveTypeCB->addItem(tr("Expo"));
|
||||
curveTypeCB->addItem(tr("Func"));
|
||||
curveTypeCB->addItem(tr("Curve"));
|
||||
if (!(flags & HIDE_DIFF)) curveTypeCB->addItem(tr("Diff"), 0);
|
||||
if (!(flags & HIDE_EXPO)) curveTypeCB->addItem(tr("Expo"), 1);
|
||||
curveTypeCB->addItem(tr("Func"), 2);
|
||||
curveTypeCB->addItem(tr("Curve"), 3);
|
||||
|
||||
curveValueCB->setMaxVisibleItems(10);
|
||||
|
||||
@@ -235,10 +253,12 @@ void CurveGroup::update()
|
||||
{
|
||||
lock = true;
|
||||
|
||||
curveTypeCB->setCurrentIndex(curve.type);
|
||||
int found = curveTypeCB->findData(curve.type);
|
||||
if (found < 0) found = 0;
|
||||
curveTypeCB->setCurrentIndex(found);
|
||||
|
||||
if (curve.type == CurveReference::CURVE_REF_DIFF || curve.type == CurveReference::CURVE_REF_EXPO) {
|
||||
curveGVarCB->show();
|
||||
curveGVarCB->setVisible(GetCurrentFirmware()->getCapability(Gvars));
|
||||
if (curve.value > 100 || curve.value < -100) {
|
||||
curveGVarCB->setChecked(true);
|
||||
if (lastType != CurveReference::CURVE_REF_DIFF && lastType != CurveReference::CURVE_REF_EXPO) {
|
||||
@@ -278,11 +298,13 @@ void CurveGroup::update()
|
||||
if (lastType != curve.type) {
|
||||
lastType = curve.type;
|
||||
curveValueCB->clear();
|
||||
for (int i=-numcurves; i<=numcurves; i++) {
|
||||
curveValueCB->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, i).toString());
|
||||
for (int i= ((flags & HIDE_NEGATIVE_CURVES) ? 0 : -numcurves); i<=numcurves; i++) {
|
||||
curveValueCB->addItem(CurveReference(CurveReference::CURVE_REF_CUSTOM, i).toString(), i);
|
||||
if (i == curve.value) {
|
||||
curveValueCB->setCurrentIndex(curveValueCB->count() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
curveValueCB->setCurrentIndex(curve.value+numcurves);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -310,7 +332,8 @@ void CurveGroup::gvarCBChanged(int state)
|
||||
void CurveGroup::typeChanged(int value)
|
||||
{
|
||||
if (!lock) {
|
||||
switch (value) {
|
||||
int type = curveTypeCB->itemData(curveTypeCB->currentIndex()).toInt();
|
||||
switch (type) {
|
||||
case 0:
|
||||
curve = CurveReference(CurveReference::CURVE_REF_DIFF, 0);
|
||||
break;
|
||||
@@ -332,7 +355,7 @@ void CurveGroup::typeChanged(int value)
|
||||
void CurveGroup::valuesChanged()
|
||||
{
|
||||
if (!lock) {
|
||||
switch (curveTypeCB->currentIndex()) {
|
||||
switch (curveTypeCB->itemData(curveTypeCB->currentIndex()).toInt()) {
|
||||
case 0:
|
||||
case 1:
|
||||
{
|
||||
@@ -341,14 +364,14 @@ void CurveGroup::valuesChanged()
|
||||
value = curveValueCB->itemData(curveValueCB->currentIndex()).toInt();
|
||||
else
|
||||
value = curveValueSB->value();
|
||||
curve = CurveReference(curveTypeCB->currentIndex() == 0 ? CurveReference::CURVE_REF_DIFF : CurveReference::CURVE_REF_EXPO, value);
|
||||
curve = CurveReference(curveTypeCB->itemData(curveTypeCB->currentIndex()).toInt() == 0 ? CurveReference::CURVE_REF_DIFF : CurveReference::CURVE_REF_EXPO, value);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
curve = CurveReference(CurveReference::CURVE_REF_FUNC, curveValueCB->currentIndex());
|
||||
break;
|
||||
case 3:
|
||||
curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, curveValueCB->currentIndex() - GetCurrentFirmware()->getCapability(NumCurves));
|
||||
curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, curveValueCB->itemData(curveValueCB->currentIndex()).toInt());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1004,7 +1027,6 @@ QString index2version(int index)
|
||||
|
||||
int qunlink(const QString & fileName)
|
||||
{
|
||||
qDebug() << "unlinking "<< fileName;
|
||||
QByteArray ba = fileName.toLatin1();
|
||||
return unlink(ba.constData());
|
||||
}
|
||||
|
||||
+10
-4
@@ -37,12 +37,12 @@ class CompanionIcon: public QIcon {
|
||||
CompanionIcon(QString baseimage);
|
||||
};
|
||||
|
||||
class GVarGroup : public QObject {
|
||||
class GVarGroup: public QObject {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightCB, int & weight, const int deflt, const int mini, const int maxi, const unsigned int flags=0);
|
||||
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);
|
||||
@@ -50,13 +50,19 @@ class GVarGroup : public QObject {
|
||||
|
||||
protected:
|
||||
QCheckBox *weightGV;
|
||||
QSpinBox *weightSB;
|
||||
QAbstractSpinBox *weightSB;
|
||||
QSpinBox *sb;
|
||||
QDoubleSpinBox *dsb;
|
||||
QComboBox *weightCB;
|
||||
int & weight;
|
||||
const unsigned int flags;
|
||||
double step;
|
||||
bool lock;
|
||||
};
|
||||
|
||||
#define HIDE_DIFF 0x01
|
||||
#define HIDE_EXPO 0x02
|
||||
#define HIDE_NEGATIVE_CURVES 0x04
|
||||
|
||||
class CurveGroup : public QObject {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "channels.h"
|
||||
#include "helpers.h"
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QSpinBox>
|
||||
@@ -6,6 +7,70 @@
|
||||
#include <QCheckBox>
|
||||
#include <QDoubleSpinBox>
|
||||
|
||||
LimitsGroup::LimitsGroup(FirmwareInterface * firmware, QGridLayout *gridLayout, int row, int col, int & value, int min, int max, int deflt):
|
||||
firmware(firmware),
|
||||
spinbox(new QDoubleSpinBox()),
|
||||
value(value),
|
||||
displayStep(0.1)
|
||||
{
|
||||
bool allowGVars = false;
|
||||
int internalStep = 1;
|
||||
|
||||
spinbox->setProperty("index", row);
|
||||
spinbox->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
spinbox->setAccelerated(true);
|
||||
|
||||
if (firmware->getCapability(PPMUnitMicroseconds)) {
|
||||
displayStep = 0.512;
|
||||
spinbox->setDecimals(1);
|
||||
spinbox->setSuffix("us");
|
||||
}
|
||||
else {
|
||||
spinbox->setDecimals(0);
|
||||
spinbox->setSuffix("%");
|
||||
}
|
||||
|
||||
if (IS_TARANIS(firmware->getBoard()) || deflt == 0 /*it's the offset*/) {
|
||||
spinbox->setDecimals(1);
|
||||
allowGVars = true;
|
||||
}
|
||||
else {
|
||||
internalStep *= 10;
|
||||
}
|
||||
|
||||
spinbox->setSingleStep(displayStep*internalStep);
|
||||
|
||||
QHBoxLayout * horizontalLayout = new QHBoxLayout();
|
||||
QCheckBox * gv = new QCheckBox(QObject::tr("GV"));
|
||||
horizontalLayout->addWidget(gv);
|
||||
QComboBox * cb = new QComboBox();
|
||||
horizontalLayout->addWidget(cb);
|
||||
horizontalLayout->addWidget(spinbox);
|
||||
gridLayout->addLayout(horizontalLayout, row, col, 1, 1);
|
||||
gvarGroup = new GVarGroup(gv, spinbox, cb, value, deflt, min, max, displayStep, allowGVars);
|
||||
}
|
||||
|
||||
LimitsGroup::~LimitsGroup()
|
||||
{
|
||||
delete gvarGroup;
|
||||
}
|
||||
|
||||
void LimitsGroup::updateMinMax(int max)
|
||||
{
|
||||
if (spinbox->maximum() == 0) {
|
||||
spinbox->setMinimum(-max*displayStep);
|
||||
if (value < -max) {
|
||||
value = -max;
|
||||
}
|
||||
}
|
||||
if (spinbox->minimum() == 0) {
|
||||
spinbox->setMaximum(max*displayStep);
|
||||
if (value > max) {
|
||||
value = max;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
|
||||
ModelPanel(parent, model, generalSettings, firmware)
|
||||
{
|
||||
@@ -13,8 +78,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||
bool minimize = false;
|
||||
|
||||
int col = 1;
|
||||
if (firmware->getCapability(ChannelsName))
|
||||
{
|
||||
if (firmware->getCapability(ChannelsName)) {
|
||||
minimize=true;
|
||||
addLabel(gridLayout, tr("Name"), col++);
|
||||
}
|
||||
@@ -52,44 +116,13 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||
}
|
||||
|
||||
// Channel offset
|
||||
QDoubleSpinBox * offset = new QDoubleSpinBox(this);
|
||||
offset->setProperty("index", i);
|
||||
offset->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
offset->setAccelerated(true);
|
||||
offset->setDecimals(1);
|
||||
offset->setMinimum(-100);
|
||||
offset->setSingleStep(0.1);
|
||||
offset->setValue(float(model.limitData[i].offset) / 10);
|
||||
connect(offset, SIGNAL(editingFinished()), this, SLOT(offsetEdited()));
|
||||
gridLayout->addWidget(offset, i+1, col++, 1, 1);
|
||||
limitsGroups << new LimitsGroup(firmware, gridLayout, i+1, col++, model.limitData[i].offset, -1000, 1000, 0);
|
||||
|
||||
// Channel min
|
||||
QDoubleSpinBox * minSB = new QDoubleSpinBox(this);
|
||||
minSB->setProperty("index", i);
|
||||
minSB->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
minSB->setAccelerated(true);
|
||||
minSB->setDecimals(1);
|
||||
minSB->setMinimum(-model.getChannelsMax());
|
||||
minSB->setSingleStep(0.1);
|
||||
minSB->setMaximum(0);
|
||||
minSB->setValue(float(model.limitData[i].min) / 10);
|
||||
connect(minSB, SIGNAL(editingFinished()), this, SLOT(minEdited()));
|
||||
gridLayout->addWidget(minSB, i+1, col++, 1, 1);
|
||||
minSpins << minSB;
|
||||
limitsGroups << new LimitsGroup(firmware, gridLayout, i+1, col++, model.limitData[i].min, -model.getChannelsMax()*10, 0, -1000);
|
||||
|
||||
// Channel max
|
||||
QDoubleSpinBox * maxSB = new QDoubleSpinBox(this);
|
||||
maxSB->setProperty("index", i);
|
||||
maxSB->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
maxSB->setAccelerated(true);
|
||||
maxSB->setDecimals(1);
|
||||
maxSB->setMinimum(0);
|
||||
maxSB->setSingleStep(0.1);
|
||||
maxSB->setMaximum(model.getChannelsMax());
|
||||
maxSB->setValue(float(model.limitData[i].max) / 10);
|
||||
connect(maxSB, SIGNAL(editingFinished()), this, SLOT(maxEdited()));
|
||||
gridLayout->addWidget(maxSB, i+1, col++, 1, 1);
|
||||
maxSpins << maxSB;
|
||||
limitsGroups << new LimitsGroup(firmware, gridLayout, i+1, col++, model.limitData[i].max, 0, model.getChannelsMax()*10, 1000);
|
||||
|
||||
// Channel inversion
|
||||
QComboBox * invCB = new QComboBox(this);
|
||||
@@ -117,6 +150,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||
QSpinBox * center = new QSpinBox(this);
|
||||
center->setProperty("index", i);
|
||||
center->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
center->setSuffix("us");
|
||||
center->setMinimum(1375);
|
||||
center->setMaximum(1625);
|
||||
center->setValue(1500);
|
||||
@@ -134,6 +168,7 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||
gridLayout->addWidget(symlimits, i+1, col++, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Push the rows up
|
||||
addVSpring(gridLayout, 0,firmware->getCapability(Outputs)+1);
|
||||
|
||||
@@ -142,6 +177,9 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||
|
||||
Channels::~Channels()
|
||||
{
|
||||
foreach(LimitsGroup *group, limitsGroups) {
|
||||
delete group;
|
||||
}
|
||||
}
|
||||
|
||||
void Channels::symlimitsEdited()
|
||||
@@ -164,46 +202,14 @@ void Channels::nameEdited()
|
||||
}
|
||||
}
|
||||
|
||||
void Channels::offsetEdited()
|
||||
{
|
||||
QDoubleSpinBox *dsb = qobject_cast<QDoubleSpinBox*>(sender());
|
||||
int index = dsb->property("index").toInt();
|
||||
model.limitData[index].offset = round(dsb->value() * 10);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void Channels::minEdited()
|
||||
{
|
||||
QDoubleSpinBox *sb = qobject_cast<QDoubleSpinBox*>(sender());
|
||||
int index = sb->property("index").toInt();
|
||||
model.limitData[index].min = round(sb->value() * 10);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void Channels::maxEdited()
|
||||
{
|
||||
QDoubleSpinBox *sb = qobject_cast<QDoubleSpinBox*>(sender());
|
||||
int index = sb->property("index").toInt();
|
||||
model.limitData[index].max = round(sb->value() * 10);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void Channels::refreshExtendedLimits()
|
||||
{
|
||||
int channelMax = model.getChannelsMax();
|
||||
int channelMaxValue = channelMax * 10;
|
||||
|
||||
for (int i=0; i<firmware->getCapability(Outputs); i++) {
|
||||
QDoubleSpinBox * minDSB = minSpins[i];
|
||||
QDoubleSpinBox * maxDSB = maxSpins[i];
|
||||
|
||||
minDSB->setMinimum(-channelMax);
|
||||
maxDSB->setMaximum(+channelMax);
|
||||
|
||||
//reset any limit that is bigger than current maximum (dependent on extended limits setting)
|
||||
if ( model.limitData[i].min < -channelMaxValue ) model.limitData[i].min = -channelMaxValue;
|
||||
if ( model.limitData[i].max > +channelMaxValue ) model.limitData[i].max = +channelMaxValue;
|
||||
foreach(LimitsGroup *group, limitsGroups) {
|
||||
group->updateMinMax(10*channelMax);
|
||||
}
|
||||
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,24 @@
|
||||
#include "modelpanel.h"
|
||||
#include <QSpinBox>
|
||||
|
||||
class GVarGroup;
|
||||
|
||||
class LimitsGroup
|
||||
{
|
||||
public:
|
||||
LimitsGroup(FirmwareInterface * firmware, QGridLayout *gridLayout, int row, int col, int & value, int min, int max, int deflt);
|
||||
~LimitsGroup();
|
||||
|
||||
void updateMinMax(int max);
|
||||
|
||||
protected:
|
||||
FirmwareInterface * firmware;
|
||||
QDoubleSpinBox * spinbox;
|
||||
GVarGroup * gvarGroup;
|
||||
int & value;
|
||||
double displayStep;
|
||||
};
|
||||
|
||||
class Channels : public ModelPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -13,8 +31,7 @@ class Channels : public ModelPanel
|
||||
~Channels();
|
||||
|
||||
private:
|
||||
QVector<QDoubleSpinBox *> minSpins;
|
||||
QVector<QDoubleSpinBox *> maxSpins;
|
||||
QVector<LimitsGroup *> limitsGroups;
|
||||
|
||||
public slots:
|
||||
void refreshExtendedLimits();
|
||||
@@ -22,9 +39,6 @@ class Channels : public ModelPanel
|
||||
private slots:
|
||||
void symlimitsEdited();
|
||||
void nameEdited();
|
||||
void offsetEdited();
|
||||
void minEdited();
|
||||
void maxEdited();
|
||||
void invEdited();
|
||||
void curveEdited();
|
||||
void ppmcenterEdited();
|
||||
|
||||
@@ -318,11 +318,12 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
|
||||
int index = fswtchFunc[i]->currentIndex();
|
||||
|
||||
if (index>=FuncSafetyCh1 && index<=FuncSafetyCh32) {
|
||||
if (index>=FuncOverrideCH1 && index<=FuncOverrideCH32) {
|
||||
int channelsMax = model.getChannelsMax(true);
|
||||
fswtchParam[i]->setDecimals(0);
|
||||
fswtchParam[i]->setSingleStep(1);
|
||||
fswtchParam[i]->setMinimum(-125);
|
||||
fswtchParam[i]->setMaximum(125);
|
||||
fswtchParam[i]->setMinimum(-channelsMax);
|
||||
fswtchParam[i]->setMaximum(channelsMax);
|
||||
if (modified) {
|
||||
model.funcSw[i].param = fswtchParam[i]->value();
|
||||
}
|
||||
@@ -469,6 +470,18 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified)
|
||||
widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM;
|
||||
}
|
||||
}
|
||||
else if (index==FuncPlayScript) {
|
||||
widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM;
|
||||
if (modified) {
|
||||
memset(model.funcSw[i].paramarm, 0, sizeof(model.funcSw[i].paramarm));
|
||||
int vml = 8/*TODO*/;
|
||||
if (fswtchParamArmT[i]->currentText() != "----") {
|
||||
for (int j=0; j<std::min(fswtchParamArmT[i]->currentText().length(), vml); j++) {
|
||||
model.funcSw[i].paramarm[j] = fswtchParamArmT[i]->currentText().toAscii().at(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (index==FuncBacklight && IS_TARANIS_PLUS(GetEepromInterface()->getBoard())) {
|
||||
if (modified) model.funcSw[i].param = (uint8_t)fswtchBLcolor[i]->value();
|
||||
fswtchBLcolor[i]->setValue(model.funcSw[i].param);
|
||||
@@ -590,8 +603,9 @@ void CustomFunctionsPanel::populateFuncCB(QComboBox *b, unsigned int value)
|
||||
b->clear();
|
||||
for (unsigned int i=0; i<FuncCount; i++) {
|
||||
b->addItem(FuncSwData(AssignFunc(i)).funcToString());
|
||||
if (((i>=FuncSafetyCh1 && i<=FuncSafetyCh32) && !firmware->getCapability(SafetyChannelCustomFunction)) ||
|
||||
if (((i>=FuncOverrideCH1 && i<=FuncOverrideCH32) && !firmware->getCapability(SafetyChannelCustomFunction)) ||
|
||||
((i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) && !firmware->getCapability(HasVolume)) ||
|
||||
((i==FuncPlayScript && !IS_TARANIS(firmware->getBoard()))) ||
|
||||
((i==FuncPlayHaptic) && !firmware->getCapability(Haptic)) ||
|
||||
((i==FuncPlayBoth) && !firmware->getCapability(HasBeeper)) ||
|
||||
((i==FuncLogs) && !firmware->getCapability(HasSDLogs)) ||
|
||||
@@ -669,7 +683,7 @@ void CustomFunctionsPanel::populateFuncParamCB(QComboBox *b, const ModelData & m
|
||||
b->setCurrentIndex(value);
|
||||
}
|
||||
else if (function==FuncVolume) {
|
||||
populateSourceCB(b, RawSource(value), model, POPULATE_SOURCES|POPULATE_TRIMS);
|
||||
populateSourceCB(b, RawSource(value), model, POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_TRIMS);
|
||||
}
|
||||
else if (function==FuncPlayValue) {
|
||||
populateSourceCB(b, RawSource(value), model, POPULATE_SOURCES|POPULATE_VIRTUAL_INPUTS|POPULATE_SWITCHES|POPULATE_GVARS|POPULATE_TRIMS|POPULATE_TELEMETRYEXT);
|
||||
|
||||
@@ -31,7 +31,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);
|
||||
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);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ void HeliPanel::update()
|
||||
lock = true;
|
||||
|
||||
ui->swashTypeCB->setCurrentIndex(model.swashRingData.type);
|
||||
populateSourceCB(ui->swashCollectiveCB, model.swashRingData.collectiveSource, model, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS);
|
||||
populateSourceCB(ui->swashCollectiveCB, model.swashRingData.collectiveSource, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
|
||||
ui->swashRingValSB->setValue(model.swashRingData.value);
|
||||
ui->swashInvertELE->setChecked(model.swashRingData.invertELE);
|
||||
ui->swashInvertAIL->setChecked(model.swashRingData.invertAIL);
|
||||
|
||||
@@ -174,7 +174,7 @@ QString InputsPanel::getInputText(int dest, bool * new_ch)
|
||||
}
|
||||
}
|
||||
|
||||
if (md->curve.value) str += " " + Qt::escape(md->curve.toString());
|
||||
if (md->curve.value) str += " " + md->curve.toString();
|
||||
|
||||
QString phasesStr = getPhasesStr(md->phases, model);
|
||||
if (!phasesStr.isEmpty()) str += " " + phasesStr;
|
||||
|
||||
@@ -11,6 +11,8 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
|
||||
ModelPanel(parent, model, generalSettings, firmware),
|
||||
selectedSwitch(0)
|
||||
{
|
||||
int channelsMax = model.getChannelsMax(true);
|
||||
|
||||
QGridLayout * gridLayout = new QGridLayout(this);
|
||||
|
||||
int col = 1;
|
||||
@@ -48,8 +50,8 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
|
||||
gridLayout->addWidget(cswitchSource1[i], i+1, 2);
|
||||
cswitchSource1[i]->setVisible(false);
|
||||
cswitchValue[i] = new QDoubleSpinBox(this);
|
||||
cswitchValue[i]->setMaximum(125);
|
||||
cswitchValue[i]->setMinimum(-125);
|
||||
cswitchValue[i]->setMaximum(channelsMax);
|
||||
cswitchValue[i]->setMinimum(-channelsMax);
|
||||
cswitchValue[i]->setAccelerated(true);
|
||||
cswitchValue[i]->setDecimals(0);
|
||||
cswitchValue[i]->setProperty("index", i);
|
||||
@@ -66,8 +68,8 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
|
||||
cswitchSource2[i]->setVisible(false);
|
||||
cswitchOffset[i] = new QDoubleSpinBox(this);
|
||||
cswitchOffset[i]->setProperty("index",i);
|
||||
cswitchOffset[i]->setMaximum(125);
|
||||
cswitchOffset[i]->setMinimum(-125);
|
||||
cswitchOffset[i]->setMaximum(channelsMax);
|
||||
cswitchOffset[i]->setMinimum(-channelsMax);
|
||||
cswitchOffset[i]->setAccelerated(true);
|
||||
cswitchOffset[i]->setDecimals(0);
|
||||
connect(cswitchOffset[i], SIGNAL(valueChanged(double)), this, SLOT(edited()));
|
||||
@@ -75,8 +77,8 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
|
||||
v2Layout->addWidget(cswitchOffset[i]);
|
||||
cswitchOffset2[i] = new QDoubleSpinBox(this);
|
||||
cswitchOffset2[i]->setProperty("index",i);
|
||||
cswitchOffset2[i]->setMaximum(125);
|
||||
cswitchOffset2[i]->setMinimum(-125);
|
||||
cswitchOffset2[i]->setMaximum(channelsMax);
|
||||
cswitchOffset2[i]->setMinimum(-channelsMax);
|
||||
cswitchOffset2[i]->setAccelerated(true);
|
||||
cswitchOffset2[i]->setDecimals(0);
|
||||
connect(cswitchOffset2[i], SIGNAL(valueChanged(double)), this, SLOT(edited()));
|
||||
@@ -239,6 +241,7 @@ void LogicalSwitchesPanel::edited()
|
||||
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, 0.1);
|
||||
break;
|
||||
case LS_FAMILY_STAY:
|
||||
cswitchOffset2[i]->setSpecialValueText(tr("(instant)"));
|
||||
if (sender() == cswitchOffset[i]) {
|
||||
model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value());
|
||||
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, 0.0);
|
||||
@@ -246,10 +249,12 @@ void LogicalSwitchesPanel::edited()
|
||||
else {
|
||||
model.customSw[i].val3 = TimToVal(cswitchOffset2[i]->value()) - model.customSw[i].val2;
|
||||
}
|
||||
updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, cswitchOffset[i]->value());
|
||||
updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, cswitchOffset[i]->value()-0.1);
|
||||
if (model.customSw[i].val3 == 0) {
|
||||
cswitchOffset2[i]->setSuffix(tr("(infinite)"));
|
||||
cswitchOffset2[i]->clear();
|
||||
cswitchOffset2[i]->setSuffix("(release)");
|
||||
}
|
||||
else {
|
||||
cswitchOffset2[i]->setSuffix("");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -274,7 +279,6 @@ void LogicalSwitchesPanel::updateTimerParam(QDoubleSpinBox *sb, int timer, doubl
|
||||
else
|
||||
sb->setSingleStep(0.1);
|
||||
sb->setValue(value);
|
||||
sb->setSuffix("");
|
||||
}
|
||||
|
||||
#define SOURCE1_VISIBLE 0x1
|
||||
@@ -320,7 +324,6 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||
}
|
||||
break;
|
||||
case LS_FAMILY_STICKY:
|
||||
mask &= ~DELAY_ENABLED;
|
||||
// no break
|
||||
case LS_FAMILY_VBOOL:
|
||||
mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
|
||||
@@ -329,12 +332,16 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||
break;
|
||||
case LS_FAMILY_STAY:
|
||||
mask |= SOURCE1_VISIBLE | VALUE2_VISIBLE | VALUE3_VISIBLE;
|
||||
mask &= ~DELAY_ENABLED;
|
||||
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1), generalSettings, LogicalSwitchesContext);
|
||||
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, 0.0);
|
||||
updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, cswitchOffset[i]->value());
|
||||
updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, cswitchOffset[i]->value()-0.1);
|
||||
cswitchOffset2[i]->setSpecialValueText(tr("(instant)"));
|
||||
if (model.customSw[i].val3 == 0) {
|
||||
cswitchOffset2[i]->setSuffix(tr("(infinite)"));
|
||||
cswitchOffset2[i]->clear();
|
||||
cswitchOffset2[i]->setSuffix(tr("(release)"));
|
||||
}
|
||||
else {
|
||||
cswitchOffset2[i]->setSuffix("");
|
||||
}
|
||||
break;
|
||||
case LS_FAMILY_VCOMP:
|
||||
|
||||
@@ -26,7 +26,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
|
||||
|
||||
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);
|
||||
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, md->curve, firmware->getCapability(HasMixerExpo) ? 0 : HIDE_EXPO);
|
||||
|
||||
ui->MixDR_CB->setChecked(md->noExpo==0);
|
||||
|
||||
|
||||
@@ -122,6 +122,15 @@ qreal Node::getX()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Node::setX(qreal newX)
|
||||
{
|
||||
if(scene())
|
||||
{
|
||||
QRectF rect = scene()->sceneRect();
|
||||
QGraphicsObject::setX(rect.left() + (newX+1) * rect.width()/2);
|
||||
}
|
||||
}
|
||||
|
||||
qreal Node::getY()
|
||||
{
|
||||
if(scene())
|
||||
@@ -132,6 +141,15 @@ qreal Node::getY()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Node::setY(qreal newY)
|
||||
{
|
||||
if(scene())
|
||||
{
|
||||
QRectF rect = scene()->sceneRect();
|
||||
QGraphicsObject::setY(rect.top() + (newY+1) * rect.height()/2);
|
||||
}
|
||||
}
|
||||
|
||||
QList<Edge *> Node::edges() const
|
||||
{
|
||||
return edgeList;
|
||||
|
||||
@@ -72,6 +72,8 @@ class Node : public QGraphicsObject
|
||||
int getBallSize() {return ballSize;}
|
||||
qreal getX();
|
||||
qreal getY();
|
||||
void setX(qreal newX);
|
||||
void setY(qreal newX);
|
||||
|
||||
void setCenteringX(bool val) {centerX = val;}
|
||||
void setCenteringY(bool val) {centerY = val;}
|
||||
|
||||
@@ -179,6 +179,7 @@ void ModulePanel::update()
|
||||
{
|
||||
unsigned int mask = 0;
|
||||
Protocol protocol = (Protocol)module.protocol;
|
||||
unsigned int max_rx_num = 63;
|
||||
|
||||
if (moduleIdx >= 0) {
|
||||
mask |= MASK_PROTOCOL;
|
||||
@@ -195,6 +196,7 @@ void ModulePanel::update()
|
||||
case DSMX:
|
||||
mask |= MASK_CHANNELS_RANGE | MASK_RX_NUMBER;
|
||||
module.channelsCount = 6;
|
||||
max_rx_num = 20;
|
||||
break;
|
||||
case PPM:
|
||||
mask |= MASK_PPM_FIELDS | MASK_CHANNELS_RANGE| MASK_CHANNELS_COUNT;
|
||||
@@ -210,8 +212,9 @@ void ModulePanel::update()
|
||||
|
||||
ui->label_protocol->setVisible(mask & MASK_PROTOCOL);
|
||||
ui->protocol->setVisible(mask & MASK_PROTOCOL);
|
||||
ui->label_rxNumber->setVisible(mask & MASK_FAILSAFES);
|
||||
ui->rxNumber->setVisible(mask & MASK_FAILSAFES);
|
||||
ui->label_rxNumber->setVisible(mask & MASK_RX_NUMBER);
|
||||
ui->rxNumber->setVisible(mask & MASK_RX_NUMBER);
|
||||
ui->rxNumber->setMaximum(max_rx_num);
|
||||
ui->rxNumber->setValue(model.modelId);
|
||||
ui->label_channelsStart->setVisible(mask & MASK_CHANNELS_RANGE);
|
||||
ui->channelsStart->setVisible(mask & MASK_CHANNELS_RANGE);
|
||||
|
||||
@@ -507,16 +507,16 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>125</number>
|
||||
<number>63</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -593,7 +593,6 @@ void TelemetryPanel::setup()
|
||||
int varioCap = firmware->getCapability(HasVario);
|
||||
if (!varioCap) {
|
||||
ui->varioLimitMax_DSB->hide();
|
||||
ui->varioLimitMinOff_ChkB->hide();
|
||||
ui->varioLimitMin_DSB->hide();
|
||||
ui->varioLimitCenterMin_DSB->hide();
|
||||
ui->varioLimitCenterMax_DSB->hide();
|
||||
@@ -607,7 +606,6 @@ void TelemetryPanel::setup()
|
||||
}
|
||||
else {
|
||||
if (!firmware->getCapability(HasVarioSink)) {
|
||||
ui->varioLimitMinOff_ChkB->hide();
|
||||
ui->varioLimitMin_DSB->hide();
|
||||
ui->varioLimitCenterMin_DSB->hide();
|
||||
ui->VarioLabel_1->hide();
|
||||
@@ -616,15 +614,7 @@ void TelemetryPanel::setup()
|
||||
ui->varioLimitMin_DSB->setValue(model.frsky.varioMin-10);
|
||||
ui->varioLimitMax_DSB->setValue(model.frsky.varioMax+10);
|
||||
ui->varioLimitCenterMax_DSB->setValue((model.frsky.varioCenterMax/10.0)+0.5);
|
||||
if (model.frsky.varioCenterMin==-16) {
|
||||
ui->varioLimitMinOff_ChkB->setChecked(true);
|
||||
ui->varioLimitCenterMin_DSB->setValue(-2.0);
|
||||
ui->varioLimitCenterMin_DSB->setDisabled(true);
|
||||
}
|
||||
else {
|
||||
ui->varioLimitMinOff_ChkB->setChecked(false);
|
||||
ui->varioLimitCenterMin_DSB->setValue((model.frsky.varioCenterMin/10.0)-0.5);
|
||||
}
|
||||
ui->varioLimitCenterMin_DSB->setValue((model.frsky.varioCenterMin/10.0)-0.5);
|
||||
}
|
||||
|
||||
ui->altimetryGB->setVisible(firmware->getCapability(HasAltitudeSel) || firmware->getCapability(HasVario)),
|
||||
@@ -801,24 +791,6 @@ void TelemetryPanel::on_varioLimitCenterMin_DSB_editingFinished()
|
||||
}
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_varioLimitMinOff_ChkB_toggled(bool checked)
|
||||
{
|
||||
if (!lock) {
|
||||
model.frsky.varioCenterMin = -16;
|
||||
if (!checked) {
|
||||
lock=true;
|
||||
ui->varioLimitCenterMin_DSB->setValue(-2.0);
|
||||
ui->varioLimitCenterMin_DSB->setEnabled(true);
|
||||
lock=false;
|
||||
}
|
||||
else {
|
||||
ui->varioLimitCenterMin_DSB->setValue(-2.0);
|
||||
ui->varioLimitCenterMin_DSB->setDisabled(true);
|
||||
}
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void TelemetryPanel::on_varioLimitCenterMax_DSB_editingFinished()
|
||||
{
|
||||
if (!lock) {
|
||||
|
||||
@@ -97,7 +97,6 @@ class TelemetryPanel : public ModelPanel
|
||||
void on_varioLimitMin_DSB_editingFinished();
|
||||
void on_varioLimitMax_DSB_editingFinished();
|
||||
void on_varioLimitCenterMin_DSB_editingFinished();
|
||||
void on_varioLimitMinOff_ChkB_toggled(bool checked);
|
||||
void on_varioLimitCenterMax_DSB_editingFinished();
|
||||
void on_fasOffset_DSB_editingFinished();
|
||||
void on_mahCount_SB_editingFinished();
|
||||
|
||||
@@ -281,10 +281,10 @@
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-2.000000000000000</double>
|
||||
<double>-2.100000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>0.000000000000000</double>
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
@@ -363,19 +363,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="varioLimitMinOff_ChkB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Off</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLabel" name="VarioLabel_2">
|
||||
<property name="sizePolicy">
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>No Radio was found!</p><p>Make sure that you hold the lower trim buttons towards the center while you turn it on.</p><p>Then connect the USB wire.</p></body></html></string>
|
||||
<string><html><head/><body><p>No Radio was found!</p><p>Make sure that you hold the lower trim buttons towards the center while you turn it on.</p><p>Then connect the USB wire.</p><p><span style=" font-family:'arial,sans-serif'; font-size:13px; font-style:italic; color:#222222; background-color:#ffffff;">Note: if you have a Taranis that has not had the firmware upgraded to 2.0 then this version of Companion will not work.</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
|
||||
@@ -137,8 +137,9 @@ void joystickDialog::on_okButton_clicked() {
|
||||
QCheckBox * ib[]={ui->ChInv_1, ui->ChInv_2, ui->ChInv_3, ui->ChInv_4, ui->ChInv_5, ui->ChInv_6, ui->ChInv_7, ui->ChInv_8};
|
||||
foreach(QComboBox *cb, findChildren<QComboBox *>(QRegExp("jsmapCB_[0-9]+"))) {
|
||||
int axe=cb->objectName().mid(cb->objectName().lastIndexOf("_")+1).toInt()-1;
|
||||
int stick=cb->currentIndex();
|
||||
if (stick > 0) {
|
||||
int stick=cb->currentIndex() - 1;
|
||||
qDebug() << "joystick mapping " << cb->objectName() <<"axe:" << axe << "stick:" << stick;
|
||||
if (stick >= 0) {
|
||||
g.joystick[stick].stick_axe( axe );
|
||||
g.joystick[stick].stick_max( jscal[axe][2] );
|
||||
g.joystick[stick].stick_med( jscal[axe][1] );
|
||||
|
||||
@@ -298,7 +298,7 @@ void SimulatorDialog::initUi(T * ui)
|
||||
for (int j=0; j<8; j++){
|
||||
int axe = g.joystick[j].stick_axe();
|
||||
if (axe>=0 && axe<8) {
|
||||
jsmap[axe]=j;
|
||||
jsmap[axe]=j+1;
|
||||
jscal[axe][0] = g.joystick[j].stick_min();
|
||||
jscal[axe][1] = g.joystick[j].stick_med();
|
||||
jscal[axe][2] = g.joystick[j].stick_max();
|
||||
@@ -987,37 +987,28 @@ void SimulatorDialog::onjoystickAxisValueChanged(int axis, int value)
|
||||
if (jscal[axis][3]==1) {
|
||||
stickval*=-1;
|
||||
}
|
||||
if (stick==1 || stick==2) {
|
||||
float currX=nodeRight->getX();
|
||||
float currY=nodeRight->getY();
|
||||
if (stick==1 ) {
|
||||
nodeRight->setPos(currX*100-10,-stickval*100/1024-10);
|
||||
}
|
||||
if (stick==2) {
|
||||
nodeRight->setPos(stickval*100/1024-10,currY*100-10);
|
||||
}
|
||||
}
|
||||
else if (stick==3 || stick==4) {
|
||||
float currX=nodeLeft->getX();
|
||||
float currY=nodeLeft->getY();
|
||||
if (stick==3) {
|
||||
nodeLeft->setPos(currX*100-10,-stickval*100/1024-10);
|
||||
}
|
||||
if (stick==4) {
|
||||
nodeLeft->setPos(stickval*100/1024-10,currY*100-10);
|
||||
}
|
||||
}
|
||||
|
||||
if (stick==5) {
|
||||
if (stick==1 ) {
|
||||
nodeRight->setY(-stickval/1024.0);
|
||||
}
|
||||
else if (stick==2) {
|
||||
nodeRight->setX(stickval/1024.0);
|
||||
}
|
||||
else if (stick==3) {
|
||||
nodeLeft->setY(-stickval/1024.0);
|
||||
}
|
||||
else if (stick==4) {
|
||||
nodeLeft->setX(stickval/1024.0);
|
||||
}
|
||||
else if (stick==5) {
|
||||
dialP_1->setValue(stickval);
|
||||
}
|
||||
if (stick==6) {
|
||||
else if (stick==6) {
|
||||
dialP_2->setValue(stickval);
|
||||
}
|
||||
if (stick==7) {
|
||||
else if (stick==7) {
|
||||
dialP_3->setValue(stickval);
|
||||
}
|
||||
if (stick==8 && dialP_4) {
|
||||
else if (stick==8 && dialP_4) {
|
||||
dialP_4->setValue(stickval);
|
||||
}
|
||||
}
|
||||
|
||||
+1186
-1339
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+183
-111
@@ -1,206 +1,278 @@
|
||||
<h2>Version 2.0.9 / 2014-07-28</h2>
|
||||
<h2>Version 2.0.13 / 2014-11-20</h2>
|
||||
[Taranis]
|
||||
<ul>
|
||||
<li>CPPM issue on Helis when cross trims used
|
||||
<li>Taranis+ LCD color range adjusted
|
||||
<li>Compilation with -Os instead of -O2 because of a strange bug on LS1 (AND condition changed by itself on SD error)</li>
|
||||
<li>Lua getTimer and setTimer parameters fixed (persistent and minuteBeep)</li>
|
||||
<li>Lua resetTimer function added</li>
|
||||
<li>SWR shown on newer Taranis+</li>
|
||||
<li>BOLD, CONDENSED, FIXED constants exported to Lua</li>
|
||||
<li>Disable mixer line that uses a Lua source if the Lua script is not running</li>
|
||||
<li>Additional parameters for Lua model.getMix/insertMix</li>
|
||||
<li>Fixed occasional SD card error</li>
|
||||
<li>Fixed bitmap loading</li>
|
||||
</ul>
|
||||
|
||||
[9XR-PRO]
|
||||
<ul>
|
||||
<li>Coprocessor interface bugfix</li>
|
||||
</ul>
|
||||
|
||||
[Stock]
|
||||
<ul>
|
||||
<li>Fixed never ending haptic repeat</li>
|
||||
<li>Fixed curves display</li>
|
||||
</ul>
|
||||
|
||||
[All]
|
||||
<ul>
|
||||
<li>Stick icons missing next to trim key states on switch diag page</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Version 2.0.12 / 2014-09-16</h2>
|
||||
[Taranis]
|
||||
<ul>
|
||||
<li>LTR patch (modified) applied to the Lua code. Saves around 8-10k RAM</li>
|
||||
<li>Lua hardening again!</li>
|
||||
<li>bit32 lib added to the Lua interpreter</li>
|
||||
<li>Audio tones distorsion (just after playing a wav file)</li>
|
||||
<li>ABS changed to ON in Timers modes</li>
|
||||
<li>S2 and S3 pots inverted on Taranis+</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.11 / 2014-09-10</h2>
|
||||
[9XR-PRO]
|
||||
<ul>
|
||||
<li>Audio broken (since we changed the ARM GCC compiler)</li>
|
||||
</ul>
|
||||
|
||||
[Taranis]
|
||||
<ul>
|
||||
<li>Switch warning didn't allow access to SG</li>
|
||||
<li>Pot warning would show S3 when the cursor wasn't on the Pot Warning line</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.10 / 2014-09-08</h2>
|
||||
[All]
|
||||
<ul>
|
||||
<li>Duration and AND fixed on Sticky and Edge logical switches</li>
|
||||
</ul>
|
||||
|
||||
[Taranis]
|
||||
<ul>
|
||||
<li>CCPM issue on Helis when cross trims used</li>
|
||||
<li>Taranis+ LCD color range and brightness adjusted</li>
|
||||
<li>Taranis+ SWR removed</li>
|
||||
<li>Lua small enhancements (TIMEHOUR constant, GVARS over 500)</li>
|
||||
<li>Lua hardening, use of newlib-nano (optimizes RAM usage)</li>
|
||||
<li>Incoming telemetry rejected if RSSI=0</li>
|
||||
<li>Assign Bitmap impossible if filename length too big</li>
|
||||
</ul>
|
||||
|
||||
[9XR-PRO]
|
||||
<ul>
|
||||
<li>Telemetry enabled</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.8 / 2014-07-23</h2>
|
||||
[Taranis]
|
||||
<ul>
|
||||
<li>Curve wrongly displayed when used in an Input with a positive offset
|
||||
<li>Telemetry Channels are now accessible through Lua
|
||||
<li>New string Lua fields added for accessing sources
|
||||
<li>Trims now applied on Inputs when used in Logical Switches
|
||||
<li>Option "nojoystick" added
|
||||
<li>Curve wrongly displayed when used in an Input with a positive offset</li>
|
||||
<li>Telemetry Channels are now accessible through Lua</li>
|
||||
<li>New string Lua fields added for accessing sources</li>
|
||||
<li>Trims now applied on Inputs when used in Logical Switches</li>
|
||||
<li>Option "nojoystick" added</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.7 / 2014-07-15</h2>
|
||||
[Taranis]
|
||||
<ul>
|
||||
<li>Instant Trim problem when using a negative curve
|
||||
<li>Instant Trim problem when using a negative curve</li>
|
||||
</ul>
|
||||
|
||||
[All]
|
||||
<ul>
|
||||
<li>SafetyCH function was missing on the compilation server
|
||||
<li>SafetyCH function was missing on the compilation server</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.6 / 2014-07-13</h2>
|
||||
[Taranis]
|
||||
<ul>
|
||||
<li>Telemetry Type field is hidden when only S.PORT is available
|
||||
<li>Permanent timers may be not resetted on Flight Reset
|
||||
<li>Instant Trim bugfix
|
||||
<li>No sound on trim press when trim option disabled
|
||||
<li>[Page] / [Page Long] allowed to change Telemetry screen
|
||||
<li>XXL font added for Lua telemetry screens
|
||||
<li>
|
||||
<li>Telemetry Type field is hidden when only S.PORT is available</li>
|
||||
<li>Permanent timers may be not resetted on Flight Reset</li>
|
||||
<li>Instant Trim bugfix</li>
|
||||
<li>No sound on trim press when trim option disabled</li>
|
||||
<li>[Page] / [Page Long] allowed to change Telemetry screen</li>
|
||||
<li>XXL font added for Lua telemetry screens</li>
|
||||
</ul>
|
||||
|
||||
[9XR-PRO / Sky9x]
|
||||
<ul>
|
||||
<li>RTC time was not stored correctly
|
||||
<li>PPM polarity fix
|
||||
<li>RTC time was not stored correctly</li>
|
||||
<li>PPM polarity fix</li>
|
||||
</ul>
|
||||
|
||||
[Gruvin9x, 9X128, 9XR128]
|
||||
<ul>
|
||||
<li>12 logical switches instead of 15 (the extra ones were not accessible in custom functions)
|
||||
<li>12 logical switches instead of 15 (the extra ones were not accessible in custom functions)</li>
|
||||
</ul>
|
||||
|
||||
[All]
|
||||
<ul>
|
||||
<li>Logical switches were not resetted on Model load
|
||||
<li>SafetyCH function can be hidden (depending on Companion options)
|
||||
<li>MPH to km/h conversion improved
|
||||
<li>Logical switches were not resetted on Model load</li>
|
||||
<li>SafetyCH function can be hidden (depending on Companion options)</li>
|
||||
<li>MPH to km/h conversion improved</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.5 / 2014-06-26</h2>
|
||||
[Taranis]
|
||||
<ul>
|
||||
<li>Add Flight Mode indication to the mixer/inputs screens
|
||||
<li>Joystick emulation fixed
|
||||
<li>Fixed float number display in Lua
|
||||
<li>Fixed telemetry screens page order (Lua, custom, voltage, GPS)
|
||||
<li>Fixed unability to disable switch warning for SG
|
||||
<li>Lua bugfixes in getCustomFunction/setCustomFunction and getLogicalSwitch/setLogicalSwitch
|
||||
<li>Add Flight Mode indication to the mixer/inputs screens</li>
|
||||
<li>Joystick emulation fixed</li>
|
||||
<li>Fixed float number display in Lua</li>
|
||||
<li>Fixed telemetry screens page order (Lua, custom, voltage, GPS)</li>
|
||||
<li>Fixed unability to disable switch warning for SG</li>
|
||||
<li>Lua bugfixes in getCustomFunction/setCustomFunction and getLogicalSwitch/setLogicalSwitch</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.4 / 2014-06-24</h2>
|
||||
[Taranis]
|
||||
<ul>
|
||||
<li>Lua Telemetry custom screens added
|
||||
<li>Lua wrong memory used indication
|
||||
<li>Telemetry on the serial port in the battery bay
|
||||
<li>
|
||||
<li>Lua Telemetry custom screens added</li>
|
||||
<li>Lua wrong memory used indication</li>
|
||||
<li>Telemetry on the serial port in the battery bay</li>
|
||||
</ul>
|
||||
|
||||
[All]
|
||||
<ul>
|
||||
<li>Air Speed added in Logs
|
||||
<li>|d|>x bug fix
|
||||
<li>Air Speed added in Logs</li>
|
||||
<li>|d|>x bug fix</li>
|
||||
<li>Timers played even if 00:00
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.3 / 2014-06-17</h2>
|
||||
<ul>
|
||||
<li>Bugfix on Reset Flight function (possible freeze of the menus)
|
||||
<li>Imperial units bug (on altitude)
|
||||
<li>FIRMWARE.BIN and EEPROM.BIN are not anymore marked as system files
|
||||
<li>Bugfix on Reset Flight function (possible freeze of the menus)</li>
|
||||
<li>Imperial units bug (on altitude)</li>
|
||||
<li>FIRMWARE.BIN and EEPROM.BIN are not anymore marked as system files</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.2 / 2014-06-12</h2>
|
||||
<ul>
|
||||
<li>RxBatt removed (merged with A1 as before)
|
||||
<li>Bootloader accessible through the 2 trims (as 2.0.0)
|
||||
<li>Delay on switches middle position only applied to Play functions
|
||||
<li>Delay for Play functions is configurable (0-300ms)
|
||||
<li>SWR, A3 and A4 now recorded in SD logs
|
||||
<li>Persistent mAh was not correctly stored in EEPROM
|
||||
<li>A lot of small bug fixes
|
||||
<li>RxBatt removed (merged with A1 as before)</li>
|
||||
<li>Bootloader accessible through the 2 trims (as 2.0.0)</li>
|
||||
<li>Delay on switches middle position only applied to Play functions</li>
|
||||
<li>Delay for Play functions is configurable (0-300ms)</li>
|
||||
<li>SWR, A3 and A4 now recorded in SD logs</li>
|
||||
<li>Persistent mAh was not correctly stored in EEPROM</li>
|
||||
<li>A lot of small bug fixes</li>
|
||||
</ul>
|
||||
|
||||
<h2>OpenTX 2.0.1 / 2014-02-05</h2>
|
||||
[Taranis]
|
||||
<ul>
|
||||
<li>S.PORT / D protocol choice added in TELEMETRY menu
|
||||
<li>Heli mixer fix (stick modes 2/3/4)
|
||||
<li>Multipos switch fix
|
||||
<li>Italian translations updated
|
||||
<li>French translations fixes
|
||||
<li>Multis Wizard added
|
||||
<li>Bootloader now needs only one trim pressed
|
||||
<li>S3 warning hidden (no S3 on Taranis)
|
||||
<li>Persistent mAh was broken
|
||||
<li>S.PORT / D protocol choice added in TELEMETRY menu</li>
|
||||
<li>Heli mixer fix (stick modes 2/3/4)</li>
|
||||
<li>Multipos switch fix</li>
|
||||
<li>Italian translations updated</li>
|
||||
<li>French translations fixes</li>
|
||||
<li>Multis Wizard added</li>
|
||||
<li>Bootloader now needs only one trim pressed</li>
|
||||
<li>S3 warning hidden (no S3 on Taranis)</li>
|
||||
<li>Persistent mAh was broken</li>
|
||||
</ul>
|
||||
|
||||
[Stock]
|
||||
<ul>
|
||||
<li>Fix for LS used as source
|
||||
<li>Fix for LS used as source</li>
|
||||
</ul>
|
||||
|
||||
[All]
|
||||
<ul>
|
||||
<li>Fix on d>=x logical switches
|
||||
<li>Fix on d>=x logical switches</li>
|
||||
</ul>
|
||||
|
||||
<h2>OpenTX 2.0.0 / 2014-06-02</h2>
|
||||
[Taranis]
|
||||
<ul>
|
||||
<li>Inputs layer with support for all physical inputs and telemetry
|
||||
<li>Lua interpreter for runtime scripts and one-time configuration assistants
|
||||
<li>GVARs useable for offsets and limits
|
||||
<li>GVAR modification popup on home screen can be enabled/disabled for each GVAR
|
||||
<li>Output curve assignable to each servo on the SERVOS page
|
||||
<li>32 curves instead of 16, with smoothing, and any number of points between 2 and 17
|
||||
<li>Pot position memory for the 4 pots, with startup warning
|
||||
<li>Copy/paste/insert/delete of custom function lines
|
||||
<li>Altitude can be displayed in the top bar
|
||||
<li>FrSky Taranis will run at 120MHz instead of 60MHz
|
||||
<li>New trim system (a mode's trims can be relative to that of another mode's)
|
||||
<li>SPORT data form internal module available on the UART connector in the battery compartment in the Taranis
|
||||
<li>Support for 6-position pots, with individual positions available in the switch selection list
|
||||
<li>Taranis will be useable as a standard PC joystick through USB, 8 analogs and 8 buttons mapped to CH1-8 and 9-16 respectively
|
||||
<li>Inputs layer with support for all physical inputs and telemetry</li>
|
||||
<li>Lua interpreter for runtime scripts and one-time configuration assistants</li>
|
||||
<li>GVARs useable for offsets and limits</li>
|
||||
<li>GVAR modification popup on home screen can be enabled/disabled for each GVAR</li>
|
||||
<li>Output curve assignable to each servo on the SERVOS page</li>
|
||||
<li>32 curves instead of 16, with smoothing, and any number of points between 2 and 17</li>
|
||||
<li>Pot position memory for the 4 pots, with startup warning</li>
|
||||
<li>Copy/paste/insert/delete of custom function lines</li>
|
||||
<li>Altitude can be displayed in the top bar</li>
|
||||
<li>FrSky Taranis will run at 120MHz instead of 60MHz</li>
|
||||
<li>New trim system (a mode's trims can be relative to that of another mode's)</li>
|
||||
<li>SPORT data form internal module available on the UART connector in the battery compartment in the Taranis</li>
|
||||
<li>Support for 6-position pots, with individual positions available in the switch selection list</li>
|
||||
<li>Taranis will be useable as a standard PC joystick through USB, 8 analogs and 8 buttons mapped to CH1-8 and 9-16 respectively</li>
|
||||
</ul>
|
||||
|
||||
[ARM Boards]
|
||||
<ul>
|
||||
<li>Measured consumption (mAh) can be stored on power off
|
||||
<li>0.1% resolution for limits
|
||||
<li>Sound repeat time settable in multiples of 1sec, call at model load can be disabled
|
||||
<li>3 options for timer countdown voice output
|
||||
<li>9 GVARS instead of 5 (ARM boards only)
|
||||
<li>64 custom functions instead of 32
|
||||
<li>Ability to read text files from the SD card. A file with the name of a model will be linked to it and easily accessible as "model notes". Can be displayed automatically at model load for use as a checklist
|
||||
<li>Bootloader added, removes the need to install computer drivers to flash new firmware
|
||||
<li>Radio can handle EEPROM conversion by itself (no need for companion)
|
||||
<li>Improved vario sounds
|
||||
<li>Default audio files can be placed on the SD card for each model for all switch positions (both for physical and logical switches).
|
||||
<li>Support for up to 16 channels on trainer input
|
||||
<li>Measured consumption (mAh) can be stored on power off</li>
|
||||
<li>0.1% resolution for limits</li>
|
||||
<li>Sound repeat time settable in multiples of 1sec, call at model load can be disabled</li>
|
||||
<li>3 options for timer countdown voice output</li>
|
||||
<li>9 GVARS instead of 5 (ARM boards only)</li>
|
||||
<li>64 custom functions instead of 32</li>
|
||||
<li>Ability to read text files from the SD card. A file with the name of a model will be linked to it and easily accessible as "model notes". Can be displayed automatically at model load for use as a checklist</li>
|
||||
<li>Bootloader added, removes the need to install computer drivers to flash new firmware</li>
|
||||
<li>Radio can handle EEPROM conversion by itself (no need for companion)</li>
|
||||
<li>Improved vario sounds</li>
|
||||
<li>Default audio files can be placed on the SD card for each model for all switch positions (both for physical and logical switches)</li>
|
||||
<li>Support for up to 16 channels on trainer input</li>
|
||||
</ul>
|
||||
|
||||
[All]
|
||||
<ul>
|
||||
<li>Proportional fonts
|
||||
<li>Switch warnings can be disabled for switches you don't use on a given model
|
||||
<li>Compensation for offset error of FrSky FAS-xx current sensors (option on m64)
|
||||
<li>Companion merged into OpenTX
|
||||
<li>Companion major code / graphics refactoring
|
||||
<li>Sticky Logical Switches
|
||||
<li>ASpd, dTE, Cel-, Vfas- added to Telemetry values
|
||||
<li>Workaround for newer bogus FlySky modules that send out servo centers on powerup (9x only)
|
||||
<li>Finnish language support
|
||||
<li>Proportional fonts</li>
|
||||
<li>Switch warnings can be disabled for switches you don't use on a given model</li>
|
||||
<li>Compensation for offset error of FrSky FAS-xx current sensors (option on m64)</li>
|
||||
<li>Companion merged into OpenTX</li>
|
||||
<li>Companion major code / graphics refactoring</li>
|
||||
<li>Sticky Logical Switches</li>
|
||||
<li>ASpd, dTE, Cel-, Vfas- added to Telemetry values</li>
|
||||
<li>Workaround for newer bogus FlySky modules that send out servo centers on powerup (9x only)</li>
|
||||
<li>Finnish language support</li>
|
||||
</ul>
|
||||
|
||||
<h2>2940 / 2014-02-02</h2>
|
||||
[ARM Boards]
|
||||
<ul>
|
||||
<li>Wav files played even in silent mode
|
||||
<li>GPS support had broken VFAS
|
||||
<li>Wav files played even in silent mode</li>
|
||||
<li>GPS support had broken VFAS</li>
|
||||
</ul>
|
||||
|
||||
[All]
|
||||
<ul>
|
||||
<li>Custom function triggered by a CSW based on analog triggering erroneously at powerup
|
||||
<li>Problem with mixer weight field when !GVARS
|
||||
<li>PPM5 was broken
|
||||
<li>Custom function triggered by a CSW based on analog triggering erroneously at powerup</li>
|
||||
<li>Problem with mixer weight field when !GVARS</li>
|
||||
<li>PPM5 was broken</li>
|
||||
</ul>
|
||||
|
||||
<h2>2923 / 2014-01-08</h2>
|
||||
[ARM Boards]
|
||||
<ul>
|
||||
<li>Audio freeze bug fixed
|
||||
<li>Aurora gimbals support
|
||||
<li>Audio freeze bug fixed</li>
|
||||
<li>Aurora gimbals support</li>
|
||||
</ul>
|
||||
|
||||
<h2>2834 / 2013-10-29</h2>
|
||||
[ARM Boards]
|
||||
<ul>
|
||||
<li>Altitude played without decimal when >= 10m
|
||||
<li>Check to avoid too long paths when playing SD files
|
||||
<li>Altitude played without decimal when >= 10m</li>
|
||||
<li>Check to avoid too long paths when playing SD files</li>
|
||||
</ul>
|
||||
|
||||
[All]
|
||||
<ul>
|
||||
<li>Mixer bug when a MULTIPLY mix used with a slow
|
||||
<li>GVAR popup removed
|
||||
<li>Sticky virtual switches are reset when ResetFlight function is called
|
||||
<li>Mixer bug when a MULTIPLY mix used with a slow</li>
|
||||
<li>GVAR popup removed</li>
|
||||
<li>Sticky virtual switches are reset when ResetFlight function is called </li>
|
||||
</ul>
|
||||
|
||||
<h2>2768 / 2013-09-20</h2>
|
||||
@@ -284,26 +356,26 @@
|
||||
<ul>
|
||||
<li>Flash savings</li>
|
||||
<li>Vario sink tones removed</li>
|
||||
<li>Audio files renumbered (see here) </li>
|
||||
<li>Audio files renumbered (see here)</li>
|
||||
</ul>
|
||||
|
||||
[Sky9x]
|
||||
<ul>
|
||||
<li>Audio mixer: several sounds can now be played simulataneously, and beeps won't interrupt and clear voice alerts anymore. Note that sound files now need to have sampling rates of either 8, 16 or 32kHz and may need to be replaced. </li>
|
||||
<li>Audio mixer: several sounds can now be played simulataneously, and beeps won't interrupt and clear voice alerts anymore. Note that sound files now need to have sampling rates of either 8, 16 or 32kHz and may need to be replaced</li>
|
||||
</ul>
|
||||
|
||||
<h2>2413 / 2013-05-22</h2>
|
||||
[All]
|
||||
<ul>
|
||||
<li>Calibration screen automatically appears following an EEPROM format</li>
|
||||
<li>Wraparound in popup menus </li>
|
||||
<li>Wraparound in popup menus</li>
|
||||
</ul>
|
||||
|
||||
[9X Stock]
|
||||
<ul>
|
||||
<li>More options supported (novario / nogps / nogauges)</li>
|
||||
<li>Flash savings</li>
|
||||
<li>Mavlink huge rework by Rienk! </li>
|
||||
<li>Mavlink huge rework by Rienk!</li>
|
||||
</ul>
|
||||
|
||||
[Sky9x]
|
||||
@@ -315,17 +387,17 @@
|
||||
<h2>2215 / 2013-04-05</h2>
|
||||
[All]
|
||||
<ul>
|
||||
<li>New option AUTOSOURCE to automatically select the stick / pot / switch which is moved when editing a Mix source </li>
|
||||
<li>New option AUTOSOURCE to automatically select the stick / pot / switch which is moved when editing a Mix source</li>
|
||||
</ul>
|
||||
|
||||
[9X Stock]
|
||||
<ul>
|
||||
<li>All prompts renumbered to have the "custom" prompts starting at 0 and to be able to use PlayTrack?(GVAR) with Adjust(GVAR) to play tracks sequences </li>
|
||||
<li>All prompts renumbered to have the "custom" prompts starting at 0 and to be able to use PlayTrack?(GVAR) with Adjust(GVAR) to play tracks sequences</li>
|
||||
</ul>
|
||||
|
||||
[Gruvin9x]
|
||||
<ul>
|
||||
<li>Possibility to have both BEEPER and SPEAKER enable in the same time </li>
|
||||
<li>Possibility to have both BEEPER and SPEAKER enable in the same time</li>
|
||||
</ul>
|
||||
|
||||
[Sky9x]
|
||||
@@ -335,5 +407,5 @@
|
||||
<li>Possibility to have both BEEPER and SPEAKER enable in the same time</li>
|
||||
<li>New menu in Main Views / Telemetry Views</li>
|
||||
<li>Vario sounds improved!</li>
|
||||
<li>SD Folders renamed. "9XSOUNDS" becomes "SOUNDS", don't forget to updateyour cards!</li>
|
||||
<li>SD Folders renamed. "9XSOUNDS" becomes "SOUNDS", don't forget to update your SD card!</li>
|
||||
</ul>
|
||||
@@ -26,3 +26,4 @@
|
||||
/gtests.d
|
||||
/lua_exports.cpp
|
||||
/lua_exports.txt
|
||||
/lua_fields.txt
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <CoOS.h>
|
||||
|
||||
|
||||
#define OsSchedLock() OSSchedLock++; /*!< Lock schedule */
|
||||
#define OsSchedLock() { OSSchedLock++; asm volatile ("" : : : "memory"); } /*!< Lock schedule */
|
||||
extern void OsSchedUnlock(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FatFs Module Source Files R0.09b (C)ChaN, 2013
|
||||
FatFs Module Source Files R0.10c (C)ChaN, 2014
|
||||
|
||||
|
||||
FILES
|
||||
@@ -24,7 +24,7 @@ AGREEMENTS
|
||||
small embedded systems. This is a free software and is opened for education,
|
||||
research and commercial developments under license policy of following trems.
|
||||
|
||||
Copyright (C) 2012, ChaN, all right reserved.
|
||||
Copyright (C) 2014, ChaN, all right reserved.
|
||||
|
||||
* The FatFs module is a free software and there is NO WARRANTY.
|
||||
* No restriction on use. You can use, modify and redistribute it for
|
||||
@@ -134,5 +134,30 @@ REVISION HISTORY
|
||||
Changed f_open() and f_opendir() reject null object pointer to avoid crash.
|
||||
Changed option name _FS_SHARE to _FS_LOCK.
|
||||
|
||||
Jan 23,'13 R0.09b Added f_getlabel() and f_setlabel(). (_USE_LABEL == 1)
|
||||
Jan 23,'13 R0.09b Added f_getlabel() and f_setlabel(). (_USE_LABEL)
|
||||
|
||||
Oct 02,'13 R0.10 Added selection of character encoding on the file. (_STRF_ENCODE)
|
||||
Added f_closedir().
|
||||
Added forced full FAT scan for f_getfree(). (_FS_NOFSINFO)
|
||||
Added forced mount feature with changes of f_mount().
|
||||
Improved behavior of volume auto detection.
|
||||
Improved write throughput of f_puts() and f_printf().
|
||||
Changed argument of f_chdrive(), f_mkfs(), disk_read() and disk_write().
|
||||
Fixed f_write() can be truncated when the file size is close to 4GB.
|
||||
Fixed f_open(), f_mkdir() and f_setlabel() can return incorrect error code.
|
||||
|
||||
Jan 15,'14 R0.10a Added arbitrary strings as drive number in the path name. (_STR_VOLUME_ID)
|
||||
Added a configuration option of minimum sector size. (_MIN_SS)
|
||||
2nd argument of f_rename() can have a drive number and it will be ignored.
|
||||
Fixed f_mount() with forced mount fails when drive number is >= 1.
|
||||
Fixed f_close() invalidates the file object without volume lock.
|
||||
Fixed f_closedir() returns but the volume lock is left acquired.
|
||||
Fixed creation of an entry with LFN fails on too many SFN collisions.
|
||||
|
||||
Mar 19,'14 R0.10b Fixed a hard error in the disk I/O layer can collapse the directory entry.
|
||||
Fixed LFN entry is not deleted on delete/rename an object with lossy converted SFN.
|
||||
|
||||
Nov 09,'14 R0.10c Added a configuration option for the platforms without RTC. (_FS_NORTC)
|
||||
Fixed volume label created by Mac OS X cannot be retrieved with f_getlabel().
|
||||
Fixed a potential problem of FAT access that can appear on disk error.
|
||||
Fixed null pointer dereference on attempting to delete the root direcotry.
|
||||
|
||||
+12
-20
@@ -1,5 +1,5 @@
|
||||
/*-----------------------------------------------------------------------
|
||||
/ Low level disk interface modlue include file (C)ChaN, 2013
|
||||
/*-----------------------------------------------------------------------/
|
||||
/ Low level disk interface modlue include file (C)ChaN, 2014 /
|
||||
/-----------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _DISKIO_DEFINED
|
||||
@@ -34,12 +34,13 @@ typedef enum {
|
||||
|
||||
DSTATUS disk_initialize (BYTE pdrv);
|
||||
DSTATUS disk_status (BYTE pdrv);
|
||||
DRESULT disk_read (BYTE pdrv, BYTE*buff, DWORD sector, BYTE count);
|
||||
DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, BYTE count);
|
||||
DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
|
||||
DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
|
||||
DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
|
||||
|
||||
|
||||
/* Disk Status Bits (DSTATUS) */
|
||||
|
||||
#define STA_NOINIT 0x01 /* Drive not initialized */
|
||||
#define STA_NODISK 0x02 /* No medium in the drive */
|
||||
#define STA_PROTECT 0x04 /* Write protected */
|
||||
@@ -47,14 +48,14 @@ DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
|
||||
|
||||
/* Command code for disk_ioctrl fucntion */
|
||||
|
||||
/* Generic command (used by FatFs) */
|
||||
#define CTRL_SYNC 0 /* Flush disk cache (for write functions) */
|
||||
#define GET_SECTOR_COUNT 1 /* Get media size (for only f_mkfs()) */
|
||||
#define GET_SECTOR_SIZE 2 /* Get sector size (for multiple sector size (_MAX_SS >= 1024)) */
|
||||
#define GET_BLOCK_SIZE 3 /* Get erase block size (for only f_mkfs()) */
|
||||
#define CTRL_ERASE_SECTOR 4 /* Force erased a block of sectors (for only _USE_ERASE) */
|
||||
/* Generic command (Used by FatFs) */
|
||||
#define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */
|
||||
#define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */
|
||||
#define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */
|
||||
#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */
|
||||
#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */
|
||||
|
||||
/* Generic command (not used by FatFs) */
|
||||
/* Generic command (Not used by FatFs) */
|
||||
#define CTRL_POWER 5 /* Get/Set power status */
|
||||
#define CTRL_LOCK 6 /* Lock/Unlock media removal */
|
||||
#define CTRL_EJECT 7 /* Eject media */
|
||||
@@ -72,15 +73,6 @@ DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
|
||||
#define ATA_GET_MODEL 21 /* Get model name */
|
||||
#define ATA_GET_SN 22 /* Get serial number */
|
||||
|
||||
|
||||
/* MMC card type flags (MMC_GET_TYPE) */
|
||||
#define CT_MMC 0x01 /* MMC ver 3 */
|
||||
#define CT_SD1 0x02 /* SD ver 1 */
|
||||
#define CT_SD2 0x04 /* SD ver 2 */
|
||||
#define CT_SDC (CT_SD1|CT_SD2) /* SD */
|
||||
#define CT_BLOCK 0x08 /* Block addressing */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
+1235
-955
File diff suppressed because it is too large
Load Diff
+44
-43
@@ -1,11 +1,11 @@
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ FatFs - FAT file system module include file R0.09b (C)ChaN, 2013
|
||||
/ FatFs - FAT file system module include file R0.10c (C)ChaN, 2014
|
||||
/----------------------------------------------------------------------------/
|
||||
/ FatFs module is a generic FAT file system module for small embedded systems.
|
||||
/ This is a free software that opened for education, research and commercial
|
||||
/ developments under license policy of following terms.
|
||||
/
|
||||
/ Copyright (C) 2013, ChaN, all right reserved.
|
||||
/ Copyright (C) 2014, ChaN, all right reserved.
|
||||
/
|
||||
/ * The FatFs module is a free software and there is NO WARRANTY.
|
||||
/ * No restriction on use. You can use, modify and redistribute it for
|
||||
@@ -15,7 +15,7 @@
|
||||
/----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _FATFS
|
||||
#define _FATFS 82786 /* Revision ID */
|
||||
#define _FATFS 80376 /* Revision ID */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -23,7 +23,6 @@ extern "C" {
|
||||
|
||||
#include "integer.h" /* Basic integer types */
|
||||
#include "ffconf.h" /* FatFs configuration options */
|
||||
|
||||
#if _FATFS != _FFCONF
|
||||
#error Wrong configuration file (ffconf.h).
|
||||
#endif
|
||||
@@ -43,7 +42,7 @@ extern PARTITION VolToPart[]; /* Volume - Partition resolution table */
|
||||
|
||||
#else /* Single partition configuration */
|
||||
#define LD2PD(vol) (BYTE)(vol) /* Each logical drive is bound to the same physical drive number */
|
||||
#define LD2PT(vol) 0 /* Always mounts the 1st partition or in SFD */
|
||||
#define LD2PT(vol) 0 /* Find first valid partition or in SFD */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -53,7 +52,7 @@ extern PARTITION VolToPart[]; /* Volume - Partition resolution table */
|
||||
|
||||
#if _LFN_UNICODE /* Unicode string */
|
||||
#if !_USE_LFN
|
||||
#error _LFN_UNICODE must be 0 in non-LFN cfg.
|
||||
#error _LFN_UNICODE must be 0 at non-LFN cfg.
|
||||
#endif
|
||||
#ifndef _INC_TCHAR
|
||||
typedef WCHAR TCHAR;
|
||||
@@ -78,12 +77,12 @@ typedef struct {
|
||||
BYTE fs_type; /* FAT sub-type (0:Not mounted) */
|
||||
BYTE drv; /* Physical drive number */
|
||||
BYTE csize; /* Sectors per cluster (1,2,4...128) */
|
||||
BYTE n_fats; /* Number of FAT copies (1,2) */
|
||||
BYTE wflag; /* win[] dirty flag (1:must be written back) */
|
||||
BYTE fsi_flag; /* fsinfo dirty flag (1:must be written back) */
|
||||
BYTE n_fats; /* Number of FAT copies (1 or 2) */
|
||||
BYTE wflag; /* win[] flag (b0:dirty) */
|
||||
BYTE fsi_flag; /* FSINFO flags (b7:disabled, b0:dirty) */
|
||||
WORD id; /* File system mount ID */
|
||||
WORD n_rootdir; /* Number of root directory entries (FAT12/16) */
|
||||
#if _MAX_SS != 512
|
||||
#if _MAX_SS != _MIN_SS
|
||||
WORD ssize; /* Bytes per sector (512, 1024, 2048 or 4096) */
|
||||
#endif
|
||||
#if _FS_REENTRANT
|
||||
@@ -92,19 +91,18 @@ typedef struct {
|
||||
#if !_FS_READONLY
|
||||
DWORD last_clust; /* Last allocated cluster */
|
||||
DWORD free_clust; /* Number of free clusters */
|
||||
DWORD fsi_sector; /* fsinfo sector (FAT32) */
|
||||
#endif
|
||||
#if _FS_RPATH
|
||||
DWORD cdir; /* Current directory start cluster (0:root) */
|
||||
#endif
|
||||
DWORD n_fatent; /* Number of FAT entries (= number of clusters + 2) */
|
||||
DWORD n_fatent; /* Number of FAT entries, = number of clusters + 2 */
|
||||
DWORD fsize; /* Sectors per FAT */
|
||||
DWORD volbase; /* Volume start sector */
|
||||
DWORD fatbase; /* FAT start sector */
|
||||
DWORD dirbase; /* Root directory start sector (FAT32:Cluster#) */
|
||||
DWORD database; /* Data start sector */
|
||||
DWORD winsect; /* Current sector appearing in the win[] */
|
||||
BYTE win[_MAX_SS]; /* Disk access window for Directory, FAT (and Data on tiny cfg) */
|
||||
BYTE win[_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */
|
||||
} FATFS;
|
||||
|
||||
|
||||
@@ -114,25 +112,25 @@ typedef struct {
|
||||
typedef struct {
|
||||
FATFS* fs; /* Pointer to the related file system object (**do not change order**) */
|
||||
WORD id; /* Owner file system mount ID (**do not change order**) */
|
||||
BYTE flag; /* File status flags */
|
||||
BYTE pad1;
|
||||
DWORD fptr; /* File read/write pointer (0ed on file open) */
|
||||
BYTE flag; /* Status flags */
|
||||
BYTE err; /* Abort flag (error code) */
|
||||
DWORD fptr; /* File read/write pointer (Zeroed on file open) */
|
||||
DWORD fsize; /* File size */
|
||||
DWORD sclust; /* File data start cluster (0:no data cluster, always 0 when fsize is 0) */
|
||||
DWORD clust; /* Current cluster of fpter */
|
||||
DWORD dsect; /* Current data sector of fpter */
|
||||
DWORD sclust; /* File start cluster (0:no cluster chain, always 0 when fsize is 0) */
|
||||
DWORD clust; /* Current cluster of fpter (not valid when fprt is 0) */
|
||||
DWORD dsect; /* Sector number appearing in buf[] (0:invalid) */
|
||||
#if !_FS_READONLY
|
||||
DWORD dir_sect; /* Sector containing the directory entry */
|
||||
BYTE* dir_ptr; /* Pointer to the directory entry in the window */
|
||||
DWORD dir_sect; /* Sector number containing the directory entry */
|
||||
BYTE* dir_ptr; /* Pointer to the directory entry in the win[] */
|
||||
#endif
|
||||
#if _USE_FASTSEEK
|
||||
DWORD* cltbl; /* Pointer to the cluster link map table (null on file open) */
|
||||
DWORD* cltbl; /* Pointer to the cluster link map table (Nulled on file open) */
|
||||
#endif
|
||||
#if _FS_LOCK
|
||||
UINT lockid; /* File lock ID (index of file semaphore table Files[]) */
|
||||
UINT lockid; /* File lock ID origin from 1 (index of file semaphore table Files[]) */
|
||||
#endif
|
||||
#if !_FS_TINY
|
||||
BYTE buf[_MAX_SS]; /* File data read/write buffer */
|
||||
BYTE buf[_MAX_SS]; /* File private data read/write window */
|
||||
#endif
|
||||
} FIL;
|
||||
|
||||
@@ -149,6 +147,9 @@ typedef struct {
|
||||
DWORD sect; /* Current sector */
|
||||
BYTE* dir; /* Pointer to the current SFN entry in the win[] */
|
||||
BYTE* fn; /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */
|
||||
#if _FS_LOCK
|
||||
UINT lockid; /* File lock ID (index of file semaphore table Files[]) */
|
||||
#endif
|
||||
#if _USE_LFN
|
||||
WCHAR* lfn; /* Pointer to the LFN working buffer */
|
||||
WORD lfn_idx; /* Last matched LFN index number (0xFFFF:No LFN) */
|
||||
@@ -203,38 +204,39 @@ typedef enum {
|
||||
/*--------------------------------------------------------------*/
|
||||
/* FatFs module application interface */
|
||||
|
||||
FRESULT f_mount (BYTE vol, FATFS* fs); /* Mount/Unmount a logical drive */
|
||||
FRESULT f_open (FIL* fp, const TCHAR* path, BYTE mode); /* Open or create a file */
|
||||
FRESULT f_read (FIL* fp, void* buff, UINT btr, UINT* br); /* Read data from a file */
|
||||
FRESULT f_lseek (FIL* fp, DWORD ofs); /* Move file pointer of a file object */
|
||||
FRESULT f_close (FIL* fp); /* Close an open file object */
|
||||
FRESULT f_opendir (DIR* dj, const TCHAR* path); /* Open an existing directory */
|
||||
FRESULT f_readdir (DIR* dj, FILINFO* fno); /* Read a directory item */
|
||||
FRESULT f_stat (const TCHAR* path, FILINFO* fno); /* Get file status */
|
||||
FRESULT f_read (FIL* fp, void* buff, UINT btr, UINT* br); /* Read data from a file */
|
||||
FRESULT f_write (FIL* fp, const void* buff, UINT btw, UINT* bw); /* Write data to a file */
|
||||
FRESULT f_getfree (const TCHAR* path, DWORD* nclst, FATFS** fatfs); /* Get number of free clusters on the drive */
|
||||
FRESULT f_forward (FIL* fp, UINT(*func)(const BYTE*,UINT), UINT btf, UINT* bf); /* Forward data to the stream */
|
||||
FRESULT f_lseek (FIL* fp, DWORD ofs); /* Move file pointer of a file object */
|
||||
FRESULT f_truncate (FIL* fp); /* Truncate file */
|
||||
FRESULT f_sync (FIL* fp); /* Flush cached data of a writing file */
|
||||
FRESULT f_opendir (DIR* dp, const TCHAR* path); /* Open a directory */
|
||||
FRESULT f_closedir (DIR* dp); /* Close an open directory */
|
||||
FRESULT f_readdir (DIR* dp, FILINFO* fno); /* Read a directory item */
|
||||
FRESULT f_mkdir (const TCHAR* path); /* Create a sub directory */
|
||||
FRESULT f_unlink (const TCHAR* path); /* Delete an existing file or directory */
|
||||
FRESULT f_mkdir (const TCHAR* path); /* Create a new directory */
|
||||
FRESULT f_rename (const TCHAR* path_old, const TCHAR* path_new); /* Rename/Move a file or directory */
|
||||
FRESULT f_stat (const TCHAR* path, FILINFO* fno); /* Get file status */
|
||||
FRESULT f_chmod (const TCHAR* path, BYTE value, BYTE mask); /* Change attribute of the file/dir */
|
||||
FRESULT f_utime (const TCHAR* path, const FILINFO* fno); /* Change times-tamp of the file/dir */
|
||||
FRESULT f_rename (const TCHAR* path_old, const TCHAR* path_new); /* Rename/Move a file or directory */
|
||||
FRESULT f_chdrive (BYTE drv); /* Change current drive */
|
||||
FRESULT f_chdir (const TCHAR* path); /* Change current directory */
|
||||
FRESULT f_chdrive (const TCHAR* path); /* Change current drive */
|
||||
FRESULT f_getcwd (TCHAR* buff, UINT len); /* Get current directory */
|
||||
FRESULT f_getlabel (const TCHAR* path, TCHAR* label, DWORD* sn); /* Get volume label */
|
||||
FRESULT f_setlabel (const TCHAR* label); /* Set volume label */
|
||||
FRESULT f_forward (FIL* fp, UINT(*func)(const BYTE*,UINT), UINT btf, UINT* bf); /* Forward data to the stream */
|
||||
FRESULT f_mkfs (BYTE vol, BYTE sfd, UINT au); /* Create a file system on the drive */
|
||||
FRESULT f_fdisk (BYTE pdrv, const DWORD szt[], void* work); /* Divide a physical drive into some partitions */
|
||||
FRESULT f_getfree (const TCHAR* path, DWORD* nclst, FATFS** fatfs); /* Get number of free clusters on the drive */
|
||||
FRESULT f_getlabel (const TCHAR* path, TCHAR* label, DWORD* vsn); /* Get volume label */
|
||||
FRESULT f_setlabel (const TCHAR* label); /* Set volume label */
|
||||
FRESULT f_mount (FATFS* fs, const TCHAR* path, BYTE opt); /* Mount/Unmount a logical drive */
|
||||
FRESULT f_mkfs (const TCHAR* path, BYTE sfd, UINT au); /* Create a file system on the volume */
|
||||
FRESULT f_fdisk (BYTE pdrv, const DWORD szt[], void* work); /* Divide a physical drive into some partitions */
|
||||
int f_putc (TCHAR c, FIL* fp); /* Put a character to the file */
|
||||
int f_puts (const TCHAR* str, FIL* cp); /* Put a string to the file */
|
||||
int f_printf (FIL* fp, const TCHAR* str, ...); /* Put a formatted string to the file */
|
||||
TCHAR* f_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the file */
|
||||
|
||||
#define f_eof(fp) (((fp)->fptr == (fp)->fsize) ? 1 : 0)
|
||||
#define f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)
|
||||
#define f_eof(fp) ((int)((fp)->fptr == (fp)->fsize))
|
||||
#define f_error(fp) ((fp)->err)
|
||||
#define f_tell(fp) ((fp)->fptr)
|
||||
#define f_size(fp) ((fp)->fsize)
|
||||
|
||||
@@ -249,7 +251,7 @@ TCHAR* f_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the fil
|
||||
/* Additional user defined functions */
|
||||
|
||||
/* RTC function */
|
||||
#if !_FS_READONLY
|
||||
#if !_FS_READONLY && !_FS_NORTC
|
||||
DWORD get_fattime (void);
|
||||
#endif
|
||||
|
||||
@@ -282,7 +284,6 @@ int ff_del_syncobj (_SYNC_t sobj); /* Delete a sync object */
|
||||
|
||||
#define FA_READ 0x01
|
||||
#define FA_OPEN_EXISTING 0x00
|
||||
#define FA__ERROR 0x80
|
||||
|
||||
#if !_FS_READONLY
|
||||
#define FA_WRITE 0x02
|
||||
|
||||
+182
-101
@@ -1,13 +1,8 @@
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ FatFs - FAT file system module configuration file R0.09b (C)ChaN, 2013
|
||||
/----------------------------------------------------------------------------/
|
||||
/
|
||||
/ CAUTION! Do not forget to make clean the project after any changes to
|
||||
/ the configuration options.
|
||||
/
|
||||
/----------------------------------------------------------------------------*/
|
||||
#ifndef _FFCONF
|
||||
#define _FFCONF 82786 /* Revision ID */
|
||||
/ FatFs - FAT file system module configuration file R0.10c (C)ChaN, 2014
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define _FFCONF 80376 /* Revision ID */
|
||||
|
||||
#if defined(CPUARM) && !defined(SIMU)
|
||||
#ifdef __cplusplus
|
||||
@@ -21,69 +16,82 @@ extern "C" {
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Functions and Buffer Configurations
|
||||
/----------------------------------------------------------------------------*/
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define _FS_TINY 0
|
||||
/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
|
||||
/ At the tiny configuration, size of the file object (FIL) is reduced _MAX_SS
|
||||
/ bytes. Instead of private sector buffer eliminated from the file object,
|
||||
/ common sector buffer in the file system object (FATFS) is used for the file
|
||||
/ data transfer. */
|
||||
|
||||
#define _FS_TINY 0 /* 0:Normal or 1:Tiny */
|
||||
/* When _FS_TINY is set to 1, FatFs uses the sector buffer in the file system
|
||||
/ object instead of the sector buffer in the individual file object for file
|
||||
/ data transfer. This reduces memory consumption 512 bytes each file object. */
|
||||
|
||||
#if defined(BOOT)
|
||||
#define _FS_READONLY 1 /* 0:Read/Write or 1:Read only */
|
||||
#define _FS_READONLY 1 /* 0:Read/Write or 1:Read only */
|
||||
#else
|
||||
#define _FS_READONLY 0 /* 0:Read/Write or 1:Read only */
|
||||
#define _FS_READONLY 0 /* 0:Read/Write or 1:Read only */
|
||||
#endif
|
||||
/* Setting _FS_READONLY to 1 defines read only configuration. This removes
|
||||
/ writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename,
|
||||
/ f_truncate and useless f_getfree. */
|
||||
/* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
|
||||
/ Read-only configuration removes basic writing API functions, f_write(),
|
||||
/ f_sync(), f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(),
|
||||
/ f_getfree() and optional writing functions as well. */
|
||||
|
||||
|
||||
#if defined(BOOT)
|
||||
#define _FS_MINIMIZE 1 /* 0 to 3 */
|
||||
#define _FS_MINIMIZE 1 /* 0 to 3 */
|
||||
#else
|
||||
#define _FS_MINIMIZE 0 /* 0 to 3 */
|
||||
#define _FS_MINIMIZE 0 /* 0 to 3 */
|
||||
#endif
|
||||
/* The _FS_MINIMIZE option defines minimization level to remove some functions.
|
||||
/* This option defines minimization level to remove some API functions.
|
||||
/
|
||||
/ 0: Full function.
|
||||
/ 1: f_stat, f_getfree, f_unlink, f_mkdir, f_chmod, f_truncate and f_rename
|
||||
/ are removed.
|
||||
/ 2: f_opendir and f_readdir are removed in addition to 1.
|
||||
/ 3: f_lseek is removed in addition to 2. */
|
||||
/ 0: All basic functions are enabled.
|
||||
/ 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_chmod(), f_utime(),
|
||||
/ f_truncate() and f_rename() function are removed.
|
||||
/ 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1.
|
||||
/ 3: f_lseek() function is removed in addition to 2. */
|
||||
|
||||
|
||||
#if defined(BOOT)
|
||||
#define _USE_STRFUNC 0 /* 0:Disable or 1-2:Enable */
|
||||
#define _USE_STRFUNC 0 /* 0:Disable or 1-2:Enable */
|
||||
#else
|
||||
#define _USE_STRFUNC 1 /* 0:Disable or 1-2:Enable */
|
||||
#define _USE_STRFUNC 1 /* 0:Disable or 1-2:Enable */
|
||||
#endif
|
||||
/* To enable string functions, set _USE_STRFUNC to 1 or 2. */
|
||||
/* This option switches string functions, f_gets(), f_putc(), f_puts() and
|
||||
/ f_printf().
|
||||
/
|
||||
/ 0: Disable string functions.
|
||||
/ 1: Enable without LF-CRLF conversion.
|
||||
/ 2: Enable with LF-CRLF conversion. */
|
||||
|
||||
|
||||
#define _USE_MKFS 1 /* 0:Disable or 1:Enable */
|
||||
/* To enable f_mkfs function, set _USE_MKFS to 1 and set _FS_READONLY to 0 */
|
||||
#define _USE_MKFS 1
|
||||
/* This option switches f_mkfs() function. (0:Disable or 1:Enable)
|
||||
/ To enable it, also _FS_READONLY need to be set to 0. */
|
||||
|
||||
|
||||
#define _USE_FASTSEEK 0 /* 0:Disable or 1:Enable */
|
||||
/* To enable fast seek feature, set _USE_FASTSEEK to 1. */
|
||||
#define _USE_FASTSEEK 0
|
||||
/* This option switches fast seek feature. (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define _USE_LABEL 0 /* 0:Disable or 1:Enable */
|
||||
/* To enable volume label functions, set _USE_LAVEL to 1 */
|
||||
#define _USE_LABEL 0
|
||||
/* This option switches volume label functions, f_getlabel() and f_setlabel().
|
||||
/ (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define _USE_FORWARD 0 /* 0:Disable or 1:Enable */
|
||||
/* To enable f_forward function, set _USE_FORWARD to 1 and set _FS_TINY to 1. */
|
||||
#define _USE_FORWARD 0
|
||||
/* This option switches f_forward() function. (0:Disable or 1:Enable) */
|
||||
/* To enable it, also _FS_TINY need to be set to 1. */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Locale and Namespace Configurations
|
||||
/----------------------------------------------------------------------------*/
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define _CODE_PAGE 1252
|
||||
/* The _CODE_PAGE specifies the OEM code page to be used on the target system.
|
||||
/* This option specifies the OEM code page to be used on the target system.
|
||||
/ Incorrect setting of the code page can cause a file open failure.
|
||||
/
|
||||
/ 932 - Japanese Shift-JIS (DBCS, OEM, Windows)
|
||||
/ 932 - Japanese Shift_JIS (DBCS, OEM, Windows)
|
||||
/ 936 - Simplified Chinese GBK (DBCS, OEM, Windows)
|
||||
/ 949 - Korean (DBCS, OEM, Windows)
|
||||
/ 950 - Traditional Chinese Big5 (DBCS, OEM, Windows)
|
||||
@@ -108,8 +116,8 @@ extern "C" {
|
||||
/ 857 - Turkish (OEM)
|
||||
/ 862 - Hebrew (OEM)
|
||||
/ 874 - Thai (OEM, Windows)
|
||||
/ 1 - ASCII only (Valid for non LFN cfg.)
|
||||
*/
|
||||
/ 1 - ASCII (No extended character. Valid for only non-LFN configuration.) */
|
||||
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define _USE_LFN 2 /* 0 to 3 */
|
||||
@@ -118,83 +126,130 @@ extern "C" {
|
||||
#define _USE_LFN 1 /* 0 to 3 */
|
||||
#define _MAX_LFN 32 /* Maximum LFN length to handle (12 to 255) */
|
||||
#endif
|
||||
|
||||
/* The _USE_LFN option switches the LFN support.
|
||||
/* The _USE_LFN option switches the LFN feature.
|
||||
/
|
||||
/ 0: Disable LFN feature. _MAX_LFN and _LFN_UNICODE have no effect.
|
||||
/ 1: Enable LFN with static working buffer on the BSS. Always NOT reentrant.
|
||||
/ 0: Disable LFN feature. _MAX_LFN has no effect.
|
||||
/ 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe.
|
||||
/ 2: Enable LFN with dynamic working buffer on the STACK.
|
||||
/ 3: Enable LFN with dynamic working buffer on the HEAP.
|
||||
/
|
||||
/ The LFN working buffer occupies (_MAX_LFN + 1) * 2 bytes. To enable LFN,
|
||||
/ Unicode handling functions ff_convert() and ff_wtoupper() must be added
|
||||
/ to the project. When enable to use heap, memory control functions
|
||||
/ ff_memalloc() and ff_memfree() must be added to the project. */
|
||||
/ When enable the LFN feature, Unicode handling functions (option/unicode.c) must
|
||||
/ be added to the project. The LFN working buffer occupies (_MAX_LFN + 1) * 2 bytes.
|
||||
/ When use stack for the working buffer, take care on stack overflow. When use heap
|
||||
/ memory for the working buffer, memory management functions, ff_memalloc() and
|
||||
/ ff_memfree(), must be added to the project. */
|
||||
|
||||
|
||||
#define _LFN_UNICODE 0 /* 0:ANSI/OEM or 1:Unicode */
|
||||
/* To switch the character code set on FatFs API to Unicode,
|
||||
/ enable LFN feature and set _LFN_UNICODE to 1. */
|
||||
#define _LFN_UNICODE 0
|
||||
/* This option switches character encoding on the API. (0:ANSI/OEM or 1:Unicode)
|
||||
/ To use Unicode string for the path name, enable LFN feature and set _LFN_UNICODE
|
||||
/ to 1. This option also affects behavior of string I/O functions. */
|
||||
|
||||
|
||||
#define _FS_RPATH 2 /* 0 to 2 */
|
||||
/* The _FS_RPATH option configures relative path feature.
|
||||
#define _STRF_ENCODE 3
|
||||
/* When _LFN_UNICODE is 1, this option selects the character encoding on the file to
|
||||
/ be read/written via string I/O functions, f_gets(), f_putc(), f_puts and f_printf().
|
||||
/
|
||||
/ 0: ANSI/OEM
|
||||
/ 1: UTF-16LE
|
||||
/ 2: UTF-16BE
|
||||
/ 3: UTF-8
|
||||
/
|
||||
/ When _LFN_UNICODE is 0, this option has no effect. */
|
||||
|
||||
|
||||
#define _FS_RPATH 2
|
||||
/* This option configures relative path feature.
|
||||
/
|
||||
/ 0: Disable relative path feature and remove related functions.
|
||||
/ 1: Enable relative path. f_chdrive() and f_chdir() are available.
|
||||
/ 2: f_getcwd() is available in addition to 1.
|
||||
/ 1: Enable relative path feature. f_chdir() and f_chdrive() are available.
|
||||
/ 2: f_getcwd() function is available in addition to 1.
|
||||
/
|
||||
/ Note that output of the f_readdir fnction is affected by this option. */
|
||||
/ Note that directory items read via f_readdir() are affected by this option. */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Physical Drive Configurations
|
||||
/----------------------------------------------------------------------------*/
|
||||
/ Drive/Volume Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define _VOLUMES 1
|
||||
/* Number of volumes (logical drives) to be used. */
|
||||
|
||||
|
||||
#define _MAX_SS 512 /* 512, 1024, 2048 or 4096 */
|
||||
/* Maximum sector size to be handled.
|
||||
/ Always set 512 for memory card and hard disk but a larger value may be
|
||||
/ required for on-board flash memory, floppy disk and optical disk.
|
||||
/ When _MAX_SS is larger than 512, it configures FatFs to variable sector size
|
||||
/ and GET_SECTOR_SIZE command must be implememted to the disk_ioctl function. */
|
||||
#define _STR_VOLUME_ID 0
|
||||
#define _VOLUME_STRS "RAM","NAND","CF","SD1","SD2","USB1","USB2","USB3"
|
||||
/* _STR_VOLUME_ID option switches string volume ID feature.
|
||||
/ When _STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive
|
||||
/ number in the path name. _VOLUME_STRS defines the drive ID strings for each
|
||||
/ logical drives. Number of items must be equal to _VOLUMES. Valid characters for
|
||||
/ the drive ID strings are: A-Z and 0-9. */
|
||||
|
||||
|
||||
#define _MULTI_PARTITION 0 /* 0:Single partition, 1:Enable multiple partition */
|
||||
/* When set to 0, each volume is bound to the same physical drive number and
|
||||
/ it can mount only first primaly partition. When it is set to 1, each volume
|
||||
/ is tied to the partitions listed in VolToPart[]. */
|
||||
#define _MULTI_PARTITION 0
|
||||
/* This option switches multi-partition feature. By default (0), each logical drive
|
||||
/ number is bound to the same physical drive number and only an FAT volume found on
|
||||
/ the physical drive will be mounted. When multi-partition feature is enabled (1),
|
||||
/ each logical drive number is bound to arbitrary physical drive and partition
|
||||
/ listed in the VolToPart[]. Also f_fdisk() funciton will be enabled. */
|
||||
|
||||
|
||||
#define _USE_ERASE 0 /* 0:Disable or 1:Enable */
|
||||
/* To enable sector erase feature, set _USE_ERASE to 1. CTRL_ERASE_SECTOR command
|
||||
/ should be added to the disk_ioctl functio. */
|
||||
#define _MIN_SS 512
|
||||
#define _MAX_SS 512
|
||||
/* These options configure the range of sector size to be supported. (512, 1024,
|
||||
/ 2048 or 4096) Always set both 512 for most systems, all type of memory cards and
|
||||
/ harddisk. But a larger value may be required for on-board flash memory and some
|
||||
/ type of optical media. When _MAX_SS is larger than _MIN_SS, FatFs is configured
|
||||
/ to variable sector size and GET_SECTOR_SIZE command must be implemented to the
|
||||
/ disk_ioctl() function. */
|
||||
|
||||
|
||||
#define _USE_TRIM 0
|
||||
/* This option switches ATA-TRIM feature. (0:Disable or 1:Enable)
|
||||
/ To enable Trim feature, also CTRL_TRIM command should be implemented to the
|
||||
/ disk_ioctl() function. */
|
||||
|
||||
|
||||
#define _FS_NOFSINFO 0
|
||||
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
|
||||
/ option, and f_getfree() function at first time after volume mount will force
|
||||
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
|
||||
/
|
||||
/ bit0=0: Use free cluster count in the FSINFO if available.
|
||||
/ bit0=1: Do not trust free cluster count in the FSINFO.
|
||||
/ bit1=0: Use last allocated cluster number in the FSINFO if available.
|
||||
/ bit1=1: Do not trust last allocated cluster number in the FSINFO.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ System Configurations
|
||||
/----------------------------------------------------------------------------*/
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define _WORD_ACCESS 0 /* 0 or 1 */
|
||||
/* Set 0 first and it is always compatible with all platforms. The _WORD_ACCESS
|
||||
/ option defines which access method is used to the word data on the FAT volume.
|
||||
#define _FS_NORTC 0
|
||||
#define _NORTC_MON 11
|
||||
#define _NORTC_MDAY 9
|
||||
#define _NORTC_YEAR 2014
|
||||
/* The _FS_NORTC option switches timestamp feature. If the system does not have
|
||||
/ an RTC function or valid timestamp is not needed, set _FS_NORTC to 1 to disable
|
||||
/ the timestamp feature. All objects modified by FatFs will have a fixed timestamp
|
||||
/ defined by _NORTC_MON, _NORTC_MDAY and _NORTC_YEAR.
|
||||
/ When timestamp feature is enabled (_FS_NORTC == 0), get_fattime() function need
|
||||
/ to be added to the project to read current time form RTC. _NORTC_MON,
|
||||
/ _NORTC_MDAY and _NORTC_YEAR have no effect.
|
||||
/ These options have no effect at read-only configuration (_FS_READONLY == 1). */
|
||||
|
||||
|
||||
#define _FS_LOCK 0
|
||||
/* The _FS_LOCK option switches file lock feature to control duplicated file open
|
||||
/ and illegal operation to open objects. This option must be 0 when _FS_READONLY
|
||||
/ is 1.
|
||||
/
|
||||
/ 0: Byte-by-byte access.
|
||||
/ 1: Word access. Do not choose this unless following condition is met.
|
||||
/
|
||||
/ When the byte order on the memory is big-endian or address miss-aligned word
|
||||
/ access results incorrect behavior, the _WORD_ACCESS must be set to 0.
|
||||
/ If it is not the case, the value can also be set to 1 to improve the
|
||||
/ performance and code size.
|
||||
*/
|
||||
|
||||
|
||||
/* A header file that defines sync object types on the O/S, such as
|
||||
/ windows.h, ucos_ii.h and semphr.h, must be included prior to ff.h. */
|
||||
/ 0: Disable file lock feature. To avoid volume corruption, application program
|
||||
/ should avoid illegal open, remove and rename to the open objects.
|
||||
/ >0: Enable file lock feature. The value defines how many files/sub-directories
|
||||
/ can be opened simultaneously under file lock control. Note that the file
|
||||
/ lock feature is independent of re-entrancy. */
|
||||
|
||||
#if defined(CPUARM) && !defined(BOOT)
|
||||
#define _FS_REENTRANT 1 /* 0:Disable or 1:Enable */
|
||||
@@ -203,19 +258,45 @@ extern "C" {
|
||||
#define _FS_REENTRANT 0 /* 0:Disable or 1:Enable */
|
||||
#endif
|
||||
|
||||
#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */
|
||||
#define _FS_TIMEOUT 1000
|
||||
|
||||
/* The _FS_REENTRANT option switches the reentrancy (thread safe) of the FatFs module.
|
||||
/* The _FS_REENTRANT option switches the re-entrancy (thread safe) of the FatFs
|
||||
/ module itself. Note that regardless of this option, file access to different
|
||||
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
|
||||
/ and f_fdisk() function, are always not re-entrant. Only file/directory access
|
||||
/ to the same volume is under control of this feature.
|
||||
/
|
||||
/ 0: Disable reentrancy. _SYNC_t and _FS_TIMEOUT have no effect.
|
||||
/ 1: Enable reentrancy. Also user provided synchronization handlers,
|
||||
/ ff_req_grant, ff_rel_grant, ff_del_syncobj and ff_cre_syncobj
|
||||
/ function must be added to the project. */
|
||||
/ 0: Disable re-entrancy. _FS_TIMEOUT and _SYNC_t have no effect.
|
||||
/ 1: Enable re-entrancy. Also user provided synchronization handlers,
|
||||
/ ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj()
|
||||
/ function, must be added to the project. Samples are available in
|
||||
/ option/syscall.c.
|
||||
/
|
||||
/ The _FS_TIMEOUT defines timeout period in unit of time tick.
|
||||
/ The _SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
|
||||
/ SemaphoreHandle_t and etc.. */
|
||||
|
||||
|
||||
#define _FS_LOCK 0 /* 0:Disable or >=1:Enable */
|
||||
/* To enable file lock control feature, set _FS_LOCK to 1 or greater.
|
||||
The value defines how many files can be opened simultaneously. */
|
||||
#define _WORD_ACCESS 0
|
||||
/* The _WORD_ACCESS option is an only platform dependent option. It defines
|
||||
/ which access method is used to the word data on the FAT volume.
|
||||
/
|
||||
/ 0: Byte-by-byte access. Always compatible with all platforms.
|
||||
/ 1: Word access. Do not choose this unless under both the following conditions.
|
||||
/
|
||||
/ * Address misaligned memory access is always allowed to ALL instructions.
|
||||
/ * Byte order on the memory is little-endian.
|
||||
/
|
||||
/ If it is the case, _WORD_ACCESS can also be set to 1 to reduce code size.
|
||||
/ Following table shows allowable settings of some processor types.
|
||||
/
|
||||
/ ARM7TDMI 0 ColdFire 0 V850E 0
|
||||
/ Cortex-M3 0 Z80 0/1 V850ES 0/1
|
||||
/ Cortex-M0 0 x86 0/1 TLCS-870 0/1
|
||||
/ AVR 0/1 RX600(LE) 0/1 TLCS-900 0/1
|
||||
/ AVR32 0 RL78 0 R32C 0
|
||||
/ PIC18 0/1 SH-2 0 M16C 0/1
|
||||
/ PIC24 0 H8S 0 MSP430 0
|
||||
/ PIC32 0 H8/300H 0 8051 0/1
|
||||
*/
|
||||
|
||||
|
||||
#endif /* _FFCONFIG */
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
/* Integer type definitions for FatFs module */
|
||||
/*-------------------------------------------*/
|
||||
|
||||
#ifndef _INTEGER
|
||||
#define _INTEGER
|
||||
#ifndef _FF_INTEGER
|
||||
#define _FF_INTEGER
|
||||
|
||||
#ifdef _WIN32 /* FatFs development platform */
|
||||
|
||||
@@ -12,24 +12,20 @@
|
||||
|
||||
#else /* Embedded platform */
|
||||
|
||||
/* These types must be 16-bit, 32-bit or larger integer */
|
||||
typedef int INT;
|
||||
typedef unsigned int UINT;
|
||||
|
||||
/* These types must be 8-bit integer */
|
||||
typedef char CHAR;
|
||||
typedef unsigned char UCHAR;
|
||||
/* This type MUST be 8 bit */
|
||||
typedef unsigned char BYTE;
|
||||
|
||||
/* These types must be 16-bit integer */
|
||||
/* These types MUST be 16 bit */
|
||||
typedef short SHORT;
|
||||
typedef unsigned short USHORT;
|
||||
typedef unsigned short WORD;
|
||||
typedef unsigned short WCHAR;
|
||||
|
||||
/* These types must be 32-bit integer */
|
||||
/* These types MUST be 16 bit or 32 bit */
|
||||
typedef int INT;
|
||||
typedef unsigned int UINT;
|
||||
|
||||
/* These types MUST be 32 bit */
|
||||
typedef long LONG;
|
||||
typedef unsigned long ULONG;
|
||||
typedef unsigned long DWORD;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3739,10 +3739,10 @@ WCHAR ff_convert ( /* Converted code, 0 means conversion error */
|
||||
#if !_TINY_TABLE
|
||||
if (dir) { /* OEMCP to unicode */
|
||||
p = sjis2uni;
|
||||
hi = sizeof(sjis2uni) / 4 - 1;
|
||||
hi = sizeof sjis2uni / 4 - 1;
|
||||
} else { /* Unicode to OEMCP */
|
||||
p = uni2sjis;
|
||||
hi = sizeof(uni2sjis) / 4 - 1;
|
||||
hi = sizeof uni2sjis / 4 - 1;
|
||||
}
|
||||
li = 0;
|
||||
for (n = 16; n; n--) {
|
||||
@@ -3764,7 +3764,7 @@ WCHAR ff_convert ( /* Converted code, 0 means conversion error */
|
||||
p -= 3;
|
||||
c = *p;
|
||||
} else { /* Unicode to OEMCP */
|
||||
li = 0; hi = sizeof(uni2sjis) / 4 - 1;
|
||||
li = 0; hi = sizeof uni2sjis / 4 - 1;
|
||||
for (n = 16; n; n--) {
|
||||
i = li + (hi - li) / 2;
|
||||
if (chr == uni2sjis[i * 2]) break;
|
||||
|
||||
@@ -10936,10 +10936,10 @@ WCHAR ff_convert ( /* Converted code, 0 means conversion error */
|
||||
} else {
|
||||
if (dir) { /* OEMCP to unicode */
|
||||
p = oem2uni;
|
||||
hi = sizeof(oem2uni) / 4 - 1;
|
||||
hi = sizeof oem2uni / 4 - 1;
|
||||
} else { /* Unicode to OEMCP */
|
||||
p = uni2oem;
|
||||
hi = sizeof(uni2oem) / 4 - 1;
|
||||
hi = sizeof uni2oem / 4 - 1;
|
||||
}
|
||||
li = 0;
|
||||
for (n = 16; n; n--) {
|
||||
|
||||
@@ -8565,10 +8565,10 @@ WCHAR ff_convert ( /* Converted code, 0 means conversion error */
|
||||
} else {
|
||||
if (dir) { /* OEMCP to unicode */
|
||||
p = oem2uni;
|
||||
hi = sizeof(oem2uni) / 4 - 1;
|
||||
hi = sizeof oem2uni / 4 - 1;
|
||||
} else { /* Unicode to OEMCP */
|
||||
p = uni2oem;
|
||||
hi = sizeof(uni2oem) / 4 - 1;
|
||||
hi = sizeof uni2oem / 4 - 1;
|
||||
}
|
||||
li = 0;
|
||||
for (n = 16; n; n--) {
|
||||
|
||||
@@ -6791,10 +6791,10 @@ WCHAR ff_convert ( /* Converted code, 0 means conversion error */
|
||||
} else {
|
||||
if (dir) { /* OEMCP to unicode */
|
||||
p = oem2uni;
|
||||
hi = sizeof(oem2uni) / 4 - 1;
|
||||
hi = sizeof oem2uni / 4 - 1;
|
||||
} else { /* Unicode to OEMCP */
|
||||
p = uni2oem;
|
||||
hi = sizeof(uni2oem) / 4 - 1;
|
||||
hi = sizeof uni2oem / 4 - 1;
|
||||
}
|
||||
li = 0;
|
||||
for (n = 16; n; n--) {
|
||||
|
||||
@@ -444,7 +444,7 @@ const WCHAR Tbl[] = { /* CP1256(0x80-0xFF) to Unicode conversion table */
|
||||
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF,
|
||||
0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7,
|
||||
0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2
|
||||
}
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 1257
|
||||
#define _TBLDEF 1
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Sample code of OS dependent controls for FatFs */
|
||||
/* (C)ChaN, 2012 */
|
||||
/* (C)ChaN, 2014 */
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdlib.h> /* ANSI memory controls */
|
||||
#include <malloc.h> /* ANSI memory controls */
|
||||
|
||||
#include "../ff.h"
|
||||
|
||||
@@ -13,33 +11,30 @@
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Create a Synchronization Object
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* This function is called in f_mount function to create a new
|
||||
/ synchronization object, such as semaphore and mutex. When a FALSE is
|
||||
/ returned, the f_mount function fails with FR_INT_ERR.
|
||||
/* This function is called in f_mount() function to create a new
|
||||
/ synchronization object, such as semaphore and mutex. When a 0 is returned,
|
||||
/ the f_mount() function fails with FR_INT_ERR.
|
||||
*/
|
||||
|
||||
int ff_cre_syncobj ( /* 1:Function succeeded, 0:Could not create due to any error */
|
||||
int ff_cre_syncobj ( /* !=0:Function succeeded, ==0:Could not create due to any error */
|
||||
BYTE vol, /* Corresponding logical drive being processed */
|
||||
_SYNC_t *sobj /* Pointer to return the created sync object */
|
||||
)
|
||||
{
|
||||
int ret;
|
||||
// static _SYNC_t sem[_VOLUMES]; /* FreeRTOS */
|
||||
|
||||
|
||||
*sobj = CreateMutex(NULL, FALSE, NULL); /* Win32 */
|
||||
ret = (*sobj != INVALID_HANDLE_VALUE);
|
||||
ret = (int)(*sobj != INVALID_HANDLE_VALUE);
|
||||
|
||||
// *sobj = SyncObjects[vol]; /* uITRON (give a static created sync object) */
|
||||
// ret = 1; /* The initial value of the semaphore must be 1. */
|
||||
// *sobj = SyncObjects[vol]; /* uITRON (give a static created sync object) */
|
||||
// ret = 1; /* The initial value of the semaphore must be 1. */
|
||||
|
||||
// *sobj = OSMutexCreate(0, &err); /* uC/OS-II */
|
||||
// ret = (err == OS_NO_ERR);
|
||||
// *sobj = OSMutexCreate(0, &err); /* uC/OS-II */
|
||||
// ret = (int)(err == OS_NO_ERR);
|
||||
|
||||
// if (!sem[vol]) /* FreeRTOS */
|
||||
// sem[vol] = xSemaphoreCreateMutex();
|
||||
// *sobj = sem[vol];
|
||||
// ret = (*sobj != NULL);
|
||||
// *sobj = xSemaphoreCreateMutex(); /* FreeRTOS */
|
||||
// ret = (int)(*sobj != NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -49,12 +44,12 @@ int ff_cre_syncobj ( /* 1:Function succeeded, 0:Could not create due to any erro
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Delete a Synchronization Object */
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* This function is called in f_mount function to delete a synchronization
|
||||
/ object that created with ff_cre_syncobj function. When a FALSE is
|
||||
/ returned, the f_mount function fails with FR_INT_ERR.
|
||||
/* This function is called in f_mount() function to delete a synchronization
|
||||
/ object that created with ff_cre_syncobj function. When a 0 is returned,
|
||||
/ the f_mount() function fails with FR_INT_ERR.
|
||||
*/
|
||||
|
||||
int ff_del_syncobj ( /* 1:Function succeeded, 0:Could not delete due to any error */
|
||||
int ff_del_syncobj ( /* !=0:Function succeeded, ==0:Could not delete due to any error */
|
||||
_SYNC_t sobj /* Sync object tied to the logical drive to be deleted */
|
||||
)
|
||||
{
|
||||
@@ -66,9 +61,10 @@ int ff_del_syncobj ( /* 1:Function succeeded, 0:Could not delete due to any erro
|
||||
// ret = 1; /* uITRON (nothing to do) */
|
||||
|
||||
// OSMutexDel(sobj, OS_DEL_ALWAYS, &err); /* uC/OS-II */
|
||||
// ret = (err == OS_NO_ERR);
|
||||
// ret = (int)(err == OS_NO_ERR);
|
||||
|
||||
// ret = 1; /* FreeRTOS (nothing to do) */
|
||||
// vSemaphoreDelete(sobj); /* FreeRTOS */
|
||||
// ret = 1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -79,23 +75,23 @@ int ff_del_syncobj ( /* 1:Function succeeded, 0:Could not delete due to any erro
|
||||
/* Request Grant to Access the Volume */
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* This function is called on entering file functions to lock the volume.
|
||||
/ When a FALSE is returned, the file function fails with FR_TIMEOUT.
|
||||
/ When a 0 is returned, the file function fails with FR_TIMEOUT.
|
||||
*/
|
||||
|
||||
int ff_req_grant ( /* TRUE:Got a grant to access the volume, FALSE:Could not get a grant */
|
||||
int ff_req_grant ( /* 1:Got a grant to access the volume, 0:Could not get a grant */
|
||||
_SYNC_t sobj /* Sync object to wait */
|
||||
)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = (WaitForSingleObject(sobj, _FS_TIMEOUT) == WAIT_OBJECT_0); /* Win32 */
|
||||
ret = (int)(WaitForSingleObject(sobj, _FS_TIMEOUT) == WAIT_OBJECT_0); /* Win32 */
|
||||
|
||||
// ret = (wai_sem(sobj) == E_OK); /* uITRON */
|
||||
// ret = (int)(wai_sem(sobj) == E_OK); /* uITRON */
|
||||
|
||||
// OSMutexPend(sobj, _FS_TIMEOUT, &err)); /* uC/OS-II */
|
||||
// ret = (err == OS_NO_ERR);
|
||||
// ret = (int)(err == OS_NO_ERR);
|
||||
|
||||
// ret = (xSemaphoreTake(sobj, _FS_TIMEOUT) == pdTRUE); /* FreeRTOS */
|
||||
// ret = (int)(xSemaphoreTake(sobj, _FS_TIMEOUT) == pdTRUE); /* FreeRTOS */
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -137,7 +133,7 @@ void* ff_memalloc ( /* Returns pointer to the allocated memory block */
|
||||
UINT msize /* Number of bytes to allocate */
|
||||
)
|
||||
{
|
||||
return malloc(msize);
|
||||
return malloc(msize); /* Allocate a new memory block with POSIX API */
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +145,7 @@ void ff_memfree (
|
||||
void* mblock /* Pointer to the memory block to free */
|
||||
)
|
||||
{
|
||||
free(mblock);
|
||||
free(mblock); /* Discard the memory block with POSIX API */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
|
||||
#if _USE_LFN != 0
|
||||
|
||||
#if _CODE_PAGE == 932
|
||||
#if _CODE_PAGE == 932 /* Japanese Shift_JIS */
|
||||
#include "cc932.c"
|
||||
#elif _CODE_PAGE == 936
|
||||
#elif _CODE_PAGE == 936 /* Simplified Chinese GBK */
|
||||
#include "cc936.c"
|
||||
#elif _CODE_PAGE == 949
|
||||
#elif _CODE_PAGE == 949 /* Korean */
|
||||
#include "cc949.c"
|
||||
#elif _CODE_PAGE == 950
|
||||
#elif _CODE_PAGE == 950 /* Traditional Chinese Big5 */
|
||||
#include "cc950.c"
|
||||
#else
|
||||
#else /* Small character-set */
|
||||
#include "ccsbcs.c"
|
||||
#endif
|
||||
|
||||
|
||||
+90
-48
@@ -69,7 +69,7 @@ FAI = NO
|
||||
|
||||
# the latests deliveries for Turnigy 9x transmitters (since 2 years now, 2014) do not stop sending if no pulses are generated.
|
||||
# This fact totally breaks the nice throttle and switch warning concept, because even we prevent sending pulses the
|
||||
# transmitter modul ignores this, and continous to send the last value or 0 at beginning. And 0 means in the middle of throttle -> 50%.
|
||||
# transmitter module ignores this, and continues to send the last value or 0 at beginning. And 0 means in the middle of throttle -> 50%.
|
||||
# To cope with this situation, we need a new concept how to handle throttle and switch warnings.
|
||||
# if you have a 0 value (50% ) for throttle, while throttle warning is active, you should activate this switch
|
||||
# Values = YES, NO
|
||||
@@ -126,7 +126,7 @@ CORRECT_NEGATIVE_VALUES = YES
|
||||
ARITHMETIC_OVERFLOW_CHECK = NO
|
||||
|
||||
# increases resolution for throttle statistics and throttle counting, in very rare cases.
|
||||
# this will be only true if an output channel is used for throttle calculation, and this chanenel has changed limits, e.g. -90% to +80%
|
||||
# this will be only true if an output channel is used for throttle calculation, and this channel has changed limits, e.g. -90% to +80%
|
||||
# if you use standard limits for throttle or directly the throttle stick you do not need to bother about this option
|
||||
# not valid for ARM based transmitters like Taranis, They do not have this rounding issue at all
|
||||
# Values = YES, NO
|
||||
@@ -161,7 +161,7 @@ FONT = STD
|
||||
# Values = YES, NO
|
||||
PPM_CENTER_ADJUSTABLE = NO
|
||||
|
||||
# PPM symetrical limits
|
||||
# PPM symmetrical limits
|
||||
# Values = YES, NO
|
||||
PPM_LIMITS_SYMETRICAL = NO
|
||||
|
||||
@@ -247,11 +247,15 @@ EEPROM_PROGRESS_BAR = NO
|
||||
|
||||
# Activates the DEBUG Mode (all boards)
|
||||
# On G9X V4 board, when VOICE=NO:
|
||||
# PORTH:7 --> Transistion LOW to HIGH = start of setupPulses(). Transistion HIGH to LOW = end of setupPulses().
|
||||
# PORTH:7 --> Transition LOW to HIGH = start of setupPulses(). Transition HIGH to LOW = end of setupPulses().
|
||||
# PORTH:6 --> LOW->HIGH = start of mixer calcs. HIGH->LOW, end of mixer calcs.
|
||||
# Values = YES, NO
|
||||
DEBUG = NO
|
||||
|
||||
# Activate writing of SPORT telemetry received data to sport.log file
|
||||
# Values = YES, NO
|
||||
SPORT_FILE_LOG = NO
|
||||
|
||||
# Flight Modes
|
||||
# Values = YES, NO
|
||||
FLIGHT_MODES = YES
|
||||
@@ -282,13 +286,27 @@ MENUS_LOCK = NO
|
||||
# MASSSTORAGE: The TX will appear as a drive
|
||||
USB = JOYSTICK
|
||||
|
||||
# Channel monitor display behaviour
|
||||
# Channel monitor display behavior
|
||||
# Values = NO, YES
|
||||
# YES - hide the fact that channel is inverted in limits tab
|
||||
# and show inverted channel value with oposite sign
|
||||
# NO - normal behaviour, show real channel values
|
||||
# and show inverted channel value with opposite sign
|
||||
# NO - normal behavior, show real channel values
|
||||
CHANNELS_MONITOR_INV_HIDE = NO
|
||||
|
||||
# Use newlib-nano
|
||||
# Values = NO, YES
|
||||
NANO = NO
|
||||
|
||||
# Enable trace of events into Trace Buffer for debugging purposes
|
||||
# Activating any of these options also activates DEBUG and DEBUG_TRACE_BUFFER
|
||||
# Values = NO, YES
|
||||
# TRACE_SD_CARD SD card operations (read, write, etc)
|
||||
# TRACE_FATFS FatFs file operations
|
||||
# TRACE_AUDIO Audio processing (not yet implemented)
|
||||
TRACE_SD_CARD = NO
|
||||
TRACE_FATFS = NO
|
||||
TRACE_AUDIO = NO
|
||||
|
||||
#------- END BUILD OPTIONS ---------------------------
|
||||
|
||||
# Define programs and commands.
|
||||
@@ -296,13 +314,14 @@ SHELL = sh
|
||||
IMG2LBM = -python ../util/img2lbm.py
|
||||
BIN2LBM = -python ../util/bin2lbm.py
|
||||
TRANSLATE = -python ../util/translate.py
|
||||
VERSION = 2.0.9
|
||||
VERSION = 2.0.13
|
||||
|
||||
SRC =
|
||||
CPPSRC =
|
||||
INCDIRS = . translations
|
||||
EXTRAINCDIRS =
|
||||
LUADEP =
|
||||
DEBUG_TRACE_BUFFER = NO
|
||||
|
||||
# MCU name
|
||||
ifneq ($(PCB), $(filter $(PCB), STD 9X 9XR STD128 9X128 9XR128 9X2561 9XR2561 GRUVIN9X MEGA2560 SKY9X 9XRPRO TARANIS))
|
||||
@@ -385,7 +404,7 @@ ifeq ($(PCB), $(filter $(PCB), STD128 9X128 9XR128))
|
||||
ARCH = AVR
|
||||
TRGT = avr-
|
||||
MCU = atmega128
|
||||
OPT = 2
|
||||
OPT = s
|
||||
SDCARD = NO
|
||||
THR_TRACE = NO
|
||||
EEPROM_VARIANT += ${M128_VARIANT}
|
||||
@@ -445,7 +464,7 @@ ifeq ($(PCB), $(filter $(PCB), 9X2561))
|
||||
ARCH = AVR
|
||||
TRGT = avr-
|
||||
MCU = atmega2561
|
||||
OPT = 2
|
||||
OPT = s
|
||||
SDCARD = NO
|
||||
THR_TRACE = YES
|
||||
EEPROM_VARIANT += ${M2561_VARIANT}
|
||||
@@ -506,7 +525,7 @@ ifeq ($(PCB), GRUVIN9X)
|
||||
endif
|
||||
TRGT = avr-
|
||||
MCU = atmega2560
|
||||
OPT = 2
|
||||
OPT = s
|
||||
CPPDEFS += -DF_CPU=$(F_CPU)UL -DPCBGRUVIN9X -DCPUM2560 -DEEPROM_VARIANT=0 -DAUDIO -DHAPTIC
|
||||
SDCARD = NO
|
||||
BUZZER = NO
|
||||
@@ -546,7 +565,7 @@ ifeq ($(PCB), MEGA2560)
|
||||
ARCH = AVR
|
||||
TRGT = avr-
|
||||
MCU = atmega2560
|
||||
OPT = 2
|
||||
OPT = s
|
||||
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBMEGA2560 -DCPUM2560 -DEEPROM_VARIANT=0 -DAUDIO -DRTCLOCK
|
||||
SDCARD = YES
|
||||
THR_TRACE = YES
|
||||
@@ -592,7 +611,7 @@ ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO))
|
||||
endif
|
||||
TRGT = arm-none-eabi-
|
||||
MCU = cortex-m3
|
||||
OPT = 2
|
||||
OPT = s
|
||||
SDCARD = YES
|
||||
BUZZER = NO
|
||||
THR_TRACE = YES
|
||||
@@ -601,6 +620,9 @@ ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO))
|
||||
CPPDEFS += -DROTARY_ENCODERS=1
|
||||
CPPSRC += targets/sky9x/rotenc_driver.cpp
|
||||
endif
|
||||
ifeq ($(SPORT_FILE_LOG), YES)
|
||||
CPPDEFS += -DSPORT_FILE_LOG
|
||||
endif
|
||||
INCDIRS += targets/sky9x CoOS/kernel CoOS/portable
|
||||
BOARDSRC = targets/sky9x/board_sky9x.cpp
|
||||
EXTRABOARDSRC = targets/sky9x/lcd_driver.cpp
|
||||
@@ -616,31 +638,26 @@ ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO))
|
||||
CPPSRC += audio_arm.cpp haptic.cpp gui/view_about.cpp gui/view_text.cpp
|
||||
CPPSRC += targets/sky9x/telemetry_driver.cpp targets/sky9x/second_serial_driver.cpp targets/sky9x/pwr_driver.cpp targets/sky9x/adc_driver.cpp targets/sky9x/eeprom_driver.cpp targets/sky9x/pulses_driver.cpp targets/sky9x/keys_driver.cpp targets/sky9x/audio_driver.cpp targets/sky9x/buzzer_driver.cpp targets/sky9x/haptic_driver.cpp targets/sky9x/sdcard_driver.cpp targets/sky9x/massstorage.cpp
|
||||
CPPSRC += loadboot.cpp
|
||||
|
||||
ifeq ($(SDCARD), YES)
|
||||
CPPDEFS += -DVOICE
|
||||
INCDIRS += FatFs FatFs/option
|
||||
EXTRABOARDSRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c targets/sky9x/diskio.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(BUZZER), YES)
|
||||
CPPDEFS += -DBUZZER
|
||||
CPPSRC += buzzer.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(RTCLOCK), YES)
|
||||
CPPDEFS += -DRTCLOCK
|
||||
CPPSRC += rtc.cpp targets/sky9x/rtc_driver.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(BLUETOOTH), YES)
|
||||
CPPDEFS += -DBLUETOOTH
|
||||
CPPSRC += targets/sky9x/bluetooth.cpp
|
||||
CPPDEFS += -DBLUETOOTH
|
||||
CPPSRC += targets/sky9x/bluetooth.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG), YES)
|
||||
CPPSRC += debug.cpp
|
||||
SRC += targets/sky9x/syscalls.c
|
||||
SRC += targets/sky9x/syscalls.c
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -657,10 +674,31 @@ ifeq ($(PCB), TARANIS)
|
||||
else
|
||||
CPPDEFS = -DREV4
|
||||
endif
|
||||
ifeq ($(SPORT_FILE_LOG), YES)
|
||||
CPPDEFS += -DSPORT_FILE_LOG
|
||||
endif
|
||||
ifeq ($(TRACE_SD_CARD), YES)
|
||||
DEBUG = YES
|
||||
DEBUG_TRACE_BUFFER = YES
|
||||
CPPDEFS += -DTRACE_SD_CARD
|
||||
endif
|
||||
ifeq ($(TRACE_FATFS), YES)
|
||||
DEBUG = YES
|
||||
DEBUG_TRACE_BUFFER = YES
|
||||
CPPDEFS += -DTRACE_FATFS
|
||||
endif
|
||||
ifeq ($(TRACE_AUDIO), YES)
|
||||
DEBUG = YES
|
||||
DEBUG_TRACE_BUFFER = YES
|
||||
CPPDEFS += -DTRACE_AUDIO
|
||||
endif
|
||||
ifeq ($(DEBUG_TRACE_BUFFER), YES)
|
||||
CPPDEFS += -DDEBUG_TRACE_BUFFER
|
||||
endif
|
||||
LDSCRIPT = targets/taranis/stm32_flash_bl.ld
|
||||
TRGT = arm-none-eabi-
|
||||
MCU = cortex-m3
|
||||
OPT = 2
|
||||
OPT = s
|
||||
CPPDEFS += -DHSE_VALUE=12000000
|
||||
SDCARD = YES
|
||||
THR_TRACE = YES
|
||||
@@ -717,7 +755,11 @@ ifeq ($(PCB), TARANIS)
|
||||
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_core.c
|
||||
EXTRABOARDSRC += targets/taranis/usbd_storage_msd.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(NANO), YES)
|
||||
# use newlib-nano for linking
|
||||
NEWLIB_NANO_FLAGS = --specs=nano.specs -u _printf_float
|
||||
CPPDEFS += -DNANO
|
||||
endif
|
||||
ifneq ($(LUA), NO)
|
||||
ifeq ($(LUA), YES)
|
||||
CPPDEFS += -DLUA_MODEL_SCRIPTS
|
||||
@@ -726,48 +768,39 @@ ifeq ($(PCB), TARANIS)
|
||||
INCDIRS += lua/src
|
||||
CPPSRC += lua.cpp
|
||||
LUASRC = lua/src/lapi.c lua/src/lcode.c lua/src/lctype.c lua/src/ldebug.c lua/src/ldo.c lua/src/ldump.c lua/src/lfunc.c lua/src/lgc.c lua/src/llex.c lua/src/lmem.c \
|
||||
lua/src/lobject.c lua/src/lopcodes.c lua/src/lparser.c lua/src/lstate.c lua/src/lstring.c lua/src/ltable.c lua/src/ltm.c lua/src/lundump.c lua/src/lvm.c lua/src/lzio.c \
|
||||
lua/src/lbaselib.c lua/src/linit.c lua/src/lmathlib.c lua/src/loadlib.c lua/src/lauxlib.c lua/src/ltablib.c lua/src/lcorolib.c
|
||||
# lua/src/loslib.c lua/src/lbitlib.c lua/src/lstrlib.c lua/src/liolib.c lua/src/ldblib.c
|
||||
lua/src/lobject.c lua/src/lopcodes.c lua/src/lparser.c lua/src/lstate.c lua/src/lstring.c lua/src/ltable.c lua/src/lrotable.c lua/src/ltm.c lua/src/lundump.c lua/src/lvm.c lua/src/lzio.c \
|
||||
lua/src/lbaselib.c lua/src/linit.c lua/src/lmathlib.c lua/src/lbitlib.c lua/src/loadlib.c lua/src/lauxlib.c lua/src/ltablib.c lua/src/lcorolib.c
|
||||
SRC += $(LUASRC)
|
||||
LUADEP = lua_exports.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(SDCARD), YES)
|
||||
EXTRABOARDSRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c targets/taranis/diskio.cpp
|
||||
CPPDEFS += -DVOICE
|
||||
INCDIRS += FatFs FatFs/option
|
||||
endif
|
||||
|
||||
ifeq ($(RTCLOCK), YES)
|
||||
CPPDEFS += -DRTCLOCK
|
||||
CPPSRC += rtc.cpp targets/taranis/rtc_driver.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG), YES)
|
||||
CPPSRC += debug.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(DSM2), PPM)
|
||||
CPPSRC += pulses/dsm2_arm.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(HUBSAN), YES)
|
||||
CPPDEFS += -DHUBSAN
|
||||
CPPSRC += pulses/hubsan.cpp
|
||||
CPPSRC += targets/taranis/a7105_driver.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(HAPTIC), YES)
|
||||
CPPDEFS += -DHAPTIC
|
||||
CPPSRC += haptic.cpp
|
||||
CPPSRC += targets/taranis/haptic_driver.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(CHANNELS_MONITOR_INV_HIDE), YES)
|
||||
CPPDEFS += -DCHANNELS_MONITOR_INV_HIDE
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
CC = $(TRGT)gcc
|
||||
@@ -970,7 +1003,7 @@ endif
|
||||
ifeq ($(EXT), $(filter $(EXT), FRSKY FRSKY_SPORT TELEMETREZ))
|
||||
CPPDEFS += -DFRSKY
|
||||
ifeq ($(EXT), FRSKY_SPORT)
|
||||
CPPSRC += telemetry/frsky.cpp telemetry/frsky_sport.cpp telemetry/frsky_d.cpp
|
||||
CPPSRC += telemetry/frsky.cpp telemetry/frsky_sport.cpp telemetry/frsky_d.cpp
|
||||
CPPDEFS += -DFRSKY_SPORT
|
||||
else
|
||||
CPPSRC += telemetry/frsky.cpp telemetry/frsky_d.cpp
|
||||
@@ -1104,6 +1137,7 @@ CPPFLAGS += $(CPPDEFS)
|
||||
CPPFLAGS += -Wall
|
||||
CPPFLAGS += -fno-exceptions
|
||||
CPPFLAGS += -Wno-strict-aliasing
|
||||
CPPFLAGS += -Wformat -Wreturn-type -Wunused -Wuninitialized -Wunknown-pragmas -Wno-switch -Wtype-limits
|
||||
INCFLAGS = $(patsubst %,-I%,$(INCDIRS))
|
||||
EXTRAINCFLAGS = $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||
|
||||
@@ -1276,11 +1310,18 @@ bitmaps/sticks.lbm: bitmaps/sticks_4x1.xbm bitmaps/splash_9x.xbm bitmaps/splash_
|
||||
$(IMG2LBM) bitmaps/about_9x.png bitmaps/about_9x.lbm img
|
||||
$(IMG2LBM) bitmaps/asterisk_4bits.png bitmaps/asterisk_4bits.lbm bmp
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
PARSER = avr-cpp
|
||||
else
|
||||
PARSER = gcc -E -x c++
|
||||
endif
|
||||
|
||||
lua_exports.cpp: myeeprom.h ../util/luaexport.py
|
||||
@echo "Generating a list of Lua exported constants in lua_exports.txt"
|
||||
@$(CPP) -DPCBTARANIS -DCPUARM -DLUA -DEXPORT myeeprom.h | grep LEXP > lua_exports.txt
|
||||
@$(PARSER) -DPCBTARANIS -DCPUARM -DLUA -DEXPORT myeeprom.h | grep LEXP > lua_exports.txt
|
||||
@echo "Parsing and generating C Lua exports in lua_exports.cpp"
|
||||
@python ../util/luaexport.py lua_exports.txt lua_exports.cpp
|
||||
@python ../util/luaexport.py $(VERSION) lua_exports.txt lua_exports.cpp lua_fields.txt
|
||||
@rm lua_exports.txt
|
||||
|
||||
# Eye candy.
|
||||
# AVR Studio 3.x does not check make's exit code but relies on
|
||||
@@ -1323,7 +1364,7 @@ FOXLIB=-L/usr/local/lib \
|
||||
-Wl,-rpath,$(FOXPATH)/src/.libs
|
||||
|
||||
simu: $(LUADEP) stamp_header $(BOARDSRC) $(CPPSRC) Makefile simu.cpp targets/simu/simpgmspace.cpp *.h tra lbm eeprom.bin
|
||||
g++ $(CPPFLAGS) $(INCFLAGS) simu.cpp $(BOARDSRC) $(CPPSRC) $(LUASRC) targets/simu/simpgmspace.cpp -MD -DSIMU -O0 -o simu $(FOXINC) $(FOXLIB) -pthread -fexceptions
|
||||
g++ $(CPPFLAGS) $(INCFLAGS) simu.cpp $(BOARDSRC) $(CPPSRC) $(LUASRC) targets/simu/simpgmspace.cpp -MD -DSIMU -DLUA_USE_APICHECK -O0 -o simu $(FOXINC) $(FOXLIB) -pthread -fexceptions
|
||||
|
||||
eeprom.bin:
|
||||
dd if=/dev/zero of=$@ bs=1 count=2048
|
||||
@@ -1339,7 +1380,7 @@ else
|
||||
%.hex: %.elf
|
||||
@echo
|
||||
@echo $(MSG_FLASH) $@
|
||||
$(OBJCOPY) -O ihex opentx.elf opentx.hex
|
||||
$(OBJCOPY) -O ihex opentx.elf opentx.hex
|
||||
endif
|
||||
|
||||
%.bin: %.elf
|
||||
@@ -1380,7 +1421,7 @@ ifeq ($(ARCH), AVR)
|
||||
$(CC) $(AVRCPPFLAGS) $< --output $@ $(LDFLAGS)
|
||||
else
|
||||
%.o: %.c
|
||||
$(CC) $(ARMCPPFLAGS) $< -o $@
|
||||
$(CC) $(ARMCPPFLAGS) -Wimplicit $< -o $@
|
||||
%.o: %.s
|
||||
$(AS) $< -o $@
|
||||
TMP = $(SRC:.c=.o)
|
||||
@@ -1389,7 +1430,7 @@ OBJS = $(TMP:.s=.o)
|
||||
@echo
|
||||
@echo $(MSG_COMPILING) $@
|
||||
$(CC) $(ARMCPPFLAGS) $< -o allsrc.o
|
||||
$(CC) $(OBJS) allsrc.o -mcpu=cortex-m3 -mthumb -nostartfiles -lm -T$(LDSCRIPT) -Wl,-Map=$(TARGET).map,--cref,--no-warn-mismatch,--gc-sections -o $@
|
||||
$(CC) $(OBJS) allsrc.o -mcpu=cortex-m3 -mthumb -nostartfiles -lm -T$(LDSCRIPT) -Wl,-Map=$(TARGET).map,--cref,--no-warn-mismatch,--gc-sections $(NEWLIB_NANO_FLAGS) -o $@
|
||||
endif
|
||||
|
||||
# Target: clean project.
|
||||
@@ -1417,9 +1458,10 @@ clean_list :
|
||||
$(REMOVE) *.lst
|
||||
$(REMOVE) allsrc.cpp
|
||||
$(REMOVE) stamp-opentx.h
|
||||
$(REMOVE) *.lbm
|
||||
$(REMOVE) bitmaps/*.lbm
|
||||
$(REMOVE) fonts/*/*.lbm
|
||||
$(REMOVE) lua_exports.txt lua_exports.cpp
|
||||
$(REMOVE) lua_exports.txt lua_exports.cpp lua_fields.txt
|
||||
$(MAKE) -C bootloader clean
|
||||
|
||||
#### Install
|
||||
@@ -1429,12 +1471,12 @@ AVRCOMMAND = $(AVRDUDE) $(AVRDEVICE)
|
||||
|
||||
WRITE_COMMAND = $(AVRCOMMAND) -U flash:w:opentx.hex:i
|
||||
ifeq ($(RESTORE_EEPROM), YES)
|
||||
BACKUP_EEPROM = YES
|
||||
ifeq ($(DOUBLE_WRITE_OK), YES)
|
||||
WRITE_COMMAND += -U eeprom:w:$(DATA_DIR)/eeprom-$(DATE).hex:i
|
||||
else
|
||||
SECOND_WRITE_COMMAND = -U eeprom:w:$(DATA_DIR)/eeprom-$(DATE).hex:i
|
||||
endif
|
||||
BACKUP_EEPROM = YES
|
||||
ifeq ($(DOUBLE_WRITE_OK), YES)
|
||||
WRITE_COMMAND += -U eeprom:w:$(DATA_DIR)/eeprom-$(DATE).hex:i
|
||||
else
|
||||
SECOND_WRITE_COMMAND = -U eeprom:w:$(DATA_DIR)/eeprom-$(DATE).hex:i
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(BACKUP_FLASH), YES)
|
||||
|
||||
+25
-22
@@ -494,21 +494,6 @@ void audioTask(void* pdata)
|
||||
}
|
||||
#endif
|
||||
|
||||
void AudioQueue::pushBuffer(AudioBuffer *buffer)
|
||||
{
|
||||
buffer->state = AUDIO_BUFFER_FILLED;
|
||||
|
||||
__disable_irq();
|
||||
|
||||
bufferWIdx = nextBufferIdx(bufferWIdx);
|
||||
|
||||
if (dacQueue(buffer)) {
|
||||
buffer->state = AUDIO_BUFFER_PLAYING;
|
||||
}
|
||||
|
||||
__enable_irq();
|
||||
}
|
||||
|
||||
void mixSample(uint16_t * result, int sample, unsigned int fade)
|
||||
{
|
||||
*result = limit(0, *result + ((sample >> fade) >> 4), 4095);
|
||||
@@ -607,7 +592,6 @@ int WavContext::mixBuffer(AudioBuffer *buffer, int volume, unsigned int fade)
|
||||
}
|
||||
}
|
||||
|
||||
clear();
|
||||
return -result;
|
||||
}
|
||||
#else
|
||||
@@ -719,12 +703,18 @@ void AudioQueue::wakeup()
|
||||
}
|
||||
|
||||
// mix the normal context (tones and wavs)
|
||||
if (normalContext.fragment.type == FRAGMENT_TONE)
|
||||
if (normalContext.fragment.type == FRAGMENT_TONE) {
|
||||
result = normalContext.tone.mixBuffer(buffer, g_eeGeneral.beepVolume, fade);
|
||||
else if (normalContext.fragment.type == FRAGMENT_FILE)
|
||||
}
|
||||
else if (normalContext.fragment.type == FRAGMENT_FILE) {
|
||||
result = normalContext.wav.mixBuffer(buffer, g_eeGeneral.wavVolume, fade);
|
||||
else
|
||||
if (result < 0) {
|
||||
normalContext.wav.clear();
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = 0;
|
||||
}
|
||||
if (result > 0) {
|
||||
size = max(size, result);
|
||||
fade += 1;
|
||||
@@ -732,7 +722,7 @@ void AudioQueue::wakeup()
|
||||
else {
|
||||
CoEnterMutexSection(audioMutex);
|
||||
if (ridx != widx) {
|
||||
normalContext.fragment = fragments[ridx];
|
||||
normalContext.tone.setFragment(fragments[ridx]);
|
||||
if (!fragments[ridx].repeat--) {
|
||||
ridx = (ridx + 1) % AUDIO_QUEUE_LENGTH;
|
||||
}
|
||||
@@ -757,8 +747,11 @@ void AudioQueue::wakeup()
|
||||
|
||||
// push the buffer if needed
|
||||
if (size > 0) {
|
||||
__disable_irq();
|
||||
bufferWIdx = nextBufferIdx(bufferWIdx);
|
||||
buffer->size = size;
|
||||
pushBuffer(buffer);
|
||||
buffer->state = dacQueue(buffer) ? AUDIO_BUFFER_PLAYING : AUDIO_BUFFER_FILLED;
|
||||
__enable_irq();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -799,8 +792,9 @@ void AudioQueue::playTone(uint16_t freq, uint16_t len, uint16_t pause, uint8_t f
|
||||
{
|
||||
CoEnterMutexSection(audioMutex);
|
||||
|
||||
if (freq && freq < BEEP_MIN_FREQ)
|
||||
if (freq && freq < BEEP_MIN_FREQ) {
|
||||
freq = BEEP_MIN_FREQ;
|
||||
}
|
||||
|
||||
if (flags & PLAY_BACKGROUND) {
|
||||
AudioFragment & fragment = varioContext.fragment;
|
||||
@@ -923,6 +917,15 @@ void AudioQueue::stopAll()
|
||||
CoLeaveMutexSection(audioMutex);
|
||||
}
|
||||
|
||||
void AudioQueue::flush()
|
||||
{
|
||||
CoEnterMutexSection(audioMutex);
|
||||
widx = ridx; // clean the queue
|
||||
varioContext.clear();
|
||||
backgroundContext.clear();
|
||||
CoLeaveMutexSection(audioMutex);
|
||||
}
|
||||
|
||||
void audioEvent(uint8_t e, uint16_t f)
|
||||
{
|
||||
#if defined(HAPTIC)
|
||||
|
||||
+10
-2
@@ -103,6 +103,12 @@ class ToneContext {
|
||||
uint16_t pause;
|
||||
} state;
|
||||
|
||||
inline void setFragment(AudioFragment & fragment)
|
||||
{
|
||||
this->fragment = fragment;
|
||||
memset(&state, 0, sizeof(state));
|
||||
}
|
||||
|
||||
inline void clear()
|
||||
{
|
||||
memset(this, 0, sizeof(ToneContext));
|
||||
@@ -163,6 +169,8 @@ class AudioQueue {
|
||||
|
||||
void stopAll();
|
||||
|
||||
void flush();
|
||||
|
||||
void pause(uint16_t tLen);
|
||||
|
||||
void stopSD();
|
||||
@@ -191,6 +199,7 @@ class AudioQueue {
|
||||
AudioBuffer * buffer = &buffers[idx];
|
||||
if (buffer->state == AUDIO_BUFFER_FILLED) {
|
||||
buffer->state = AUDIO_BUFFER_PLAYING;
|
||||
bufferRIdx = idx;
|
||||
return buffer;
|
||||
}
|
||||
idx = nextBufferIdx(idx);
|
||||
@@ -231,8 +240,6 @@ class AudioQueue {
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void pushBuffer(AudioBuffer *buffer);
|
||||
};
|
||||
|
||||
extern AudioQueue audioQueue;
|
||||
@@ -328,6 +335,7 @@ void pushPrompt(uint16_t prompt, uint8_t id=0);
|
||||
#define PLAY_FILE(f, flags, id) audioQueue.playFile((f), (flags), (id))
|
||||
#define STOP_PLAY(id) audioQueue.stopPlay((id))
|
||||
#define AUDIO_RESET() audioQueue.stopAll()
|
||||
#define AUDIO_FLUSH() audioQueue.flush()
|
||||
|
||||
#if defined(SDCARD)
|
||||
extern tmr10ms_t timeAutomaticPromptsSilence;
|
||||
|
||||
@@ -154,6 +154,7 @@ void audioDefevent(uint8_t e);
|
||||
#define AUDIO_HEARTBEAT() audio.heartbeat()
|
||||
#define IS_AUDIO_BUSY() audio.busy()
|
||||
#define AUDIO_RESET()
|
||||
#define AUDIO_FLUSH()
|
||||
|
||||
#define PLAY_PHASE_OFF(phase)
|
||||
#define PLAY_PHASE_ON(phase)
|
||||
|
||||
+16
-11
@@ -44,7 +44,9 @@ const pm_char * bmpLoad(uint8_t *bmp, const char *filename, const xcoord_t width
|
||||
uint8_t bmpBuf[LCD_W]; /* maximum with LCD_W */
|
||||
uint8_t *buf = &bmpBuf[0];
|
||||
|
||||
assert(width <= LCD_W);
|
||||
if (width > LCD_W) {
|
||||
return STR_INCOMPATIBLE;
|
||||
}
|
||||
|
||||
FRESULT result = f_open(&bmpFile, filename, FA_OPEN_EXISTING | FA_READ);
|
||||
if (result != FR_OK) {
|
||||
@@ -70,7 +72,7 @@ const pm_char * bmpLoad(uint8_t *bmp, const char *filename, const xcoord_t width
|
||||
uint32_t fsize = *((uint32_t *)&buf[2]);
|
||||
uint32_t hsize = *((uint32_t *)&buf[10]); /* header size */
|
||||
|
||||
uint32_t len = limit((uint32_t)0, (uint32_t)(hsize-14), (uint32_t)32);
|
||||
uint32_t len = limit((uint32_t)4, (uint32_t)(hsize-14), (uint32_t)32);
|
||||
result = f_read(&bmpFile, buf, len, &read);
|
||||
if (result != FR_OK || read != len) {
|
||||
f_close(&bmpFile);
|
||||
@@ -152,16 +154,16 @@ const pm_char * bmpLoad(uint8_t *bmp, const char *filename, const xcoord_t width
|
||||
*dest++ = w;
|
||||
*dest++ = h;
|
||||
|
||||
memset(dest, 0, w*((h+7)/8)*4);
|
||||
memset(dest, 0, BITMAP_BUFFER_SIZE(w, h) - 2);
|
||||
|
||||
uint32_t n;
|
||||
uint32_t rowSize;
|
||||
|
||||
switch (depth) {
|
||||
case 1:
|
||||
n = w/8;
|
||||
rowSize = ((w+31)/32)*4;
|
||||
for (uint32_t i=0; i<h; i+=2) {
|
||||
result = f_read(&bmpFile, buf, n*2, &read);
|
||||
if (result != FR_OK || read != n*2) {
|
||||
result = f_read(&bmpFile, buf, rowSize*2, &read);
|
||||
if (result != FR_OK || read != rowSize*2) {
|
||||
f_close(&bmpFile);
|
||||
return SDCARD_ERROR(result);
|
||||
}
|
||||
@@ -170,30 +172,33 @@ const pm_char * bmpLoad(uint8_t *bmp, const char *filename, const xcoord_t width
|
||||
uint8_t * dst = dest + (h-i-2)/2 * w + j;
|
||||
if (!(buf[j/8] & (1<<(7-(j%8)))))
|
||||
*dst |= 0xF0;
|
||||
if (!(buf[n+j/8] & (1<<(7-(j%8)))))
|
||||
if (!(buf[rowSize+j/8] & (1<<(7-(j%8)))))
|
||||
*dst |= 0x0F;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
rowSize = ((4*w+31)/32)*4;
|
||||
for (int32_t i=h-1; i>=0; i--) {
|
||||
result = f_read(&bmpFile, buf, ((w+7)/8)*4, &read);
|
||||
if (result != FR_OK || read != ((w+7)/8)*4) {
|
||||
result = f_read(&bmpFile, buf, rowSize, &read);
|
||||
if (result != FR_OK || read != rowSize) {
|
||||
f_close(&bmpFile);
|
||||
return SDCARD_ERROR(result);
|
||||
}
|
||||
for (uint32_t j=0; j<(w+1)/2; j++) {
|
||||
for (uint32_t j=0; j<rowSize; j++) {
|
||||
uint8_t * dst = dest + (i/2)*w + j*2;
|
||||
if (i & 1) {
|
||||
uint8_t val = palette[(buf[j] >> 4) & 0x0F] << 4;
|
||||
*dst |= val ^ 0xF0;
|
||||
if ((j+1)*2 >= w) break;
|
||||
val = palette[buf[j] & 0x0F] << 4;
|
||||
*(dst+1) |= val ^ 0xF0;
|
||||
}
|
||||
else {
|
||||
uint8_t val = palette[(buf[j] >> 4) & 0x0F];
|
||||
*dst |= val ^ 0x0F;
|
||||
if ((j+1)*2 >= w) break;
|
||||
val = palette[buf[j] & 0x0F];
|
||||
*(dst+1) |= val ^ 0x0F;
|
||||
}
|
||||
|
||||
@@ -116,6 +116,7 @@ else
|
||||
EXTRAINCDIRS += ../targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/inc
|
||||
EXTRAINCDIRS += ../targets/taranis
|
||||
EXTRAINCDIRS += ../fonts/std
|
||||
EXTRAINCDIRS += ../
|
||||
|
||||
ifeq ($(PCBREV), REV3)
|
||||
CPPDEFS += -DREV3
|
||||
@@ -160,7 +161,8 @@ SRC = ../targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/
|
||||
../targets/taranis/aspi.c \
|
||||
../targets/taranis/usb_bsp.c \
|
||||
../targets/taranis/usb_driver.c \
|
||||
../targets/taranis/pwr_driver.c
|
||||
../targets/taranis/pwr_driver.c \
|
||||
init.c
|
||||
|
||||
CPPSRC = ../targets/taranis/lcd_driver.cpp \
|
||||
../targets/taranis/configure_pins.cpp \
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
void _init (void)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -99,6 +99,7 @@ void beep(uint8_t val);
|
||||
|
||||
#define IS_AUDIO_BUSY() (g_beepCnt || beepAgain || beepOn)
|
||||
#define AUDIO_RESET()
|
||||
#define AUDIO_FLUSH()
|
||||
|
||||
#define PLAY_PHASE_OFF(phase)
|
||||
#define PLAY_PHASE_ON(phase)
|
||||
|
||||
+63
-1
@@ -38,7 +38,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#if !defined(SIMU)
|
||||
#if !defined(SIMU) && defined(DEBUG)
|
||||
|
||||
Fifo<512> debugRxFifo;
|
||||
|
||||
@@ -215,3 +215,65 @@ void debugTask(void* pdata)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(DEBUG_TRACE_BUFFER)
|
||||
|
||||
static struct TraceElement traceBuffer[TRACE_BUFFER_LEN];
|
||||
static uint8_t traceBufferPos;
|
||||
extern Fifo<512> uart3TxFifo;
|
||||
gtime_t filltm(gtime_t *t, struct gtm *tp);
|
||||
|
||||
void trace_event(enum TraceEvent event, uint32_t data)
|
||||
{
|
||||
if (traceBufferPos >= TRACE_BUFFER_LEN) return;
|
||||
__disable_irq();
|
||||
struct TraceElement * p = &traceBuffer[traceBufferPos++];
|
||||
__enable_irq();
|
||||
p->time = g_rtcTime;
|
||||
p->time_ms = g_ms100;
|
||||
p->event = event;
|
||||
p->data = data;
|
||||
}
|
||||
|
||||
void trace_event_i(enum TraceEvent event, uint32_t data)
|
||||
{
|
||||
if (traceBufferPos >= TRACE_BUFFER_LEN) return;
|
||||
struct TraceElement * p = &traceBuffer[traceBufferPos++];
|
||||
p->time = g_rtcTime;
|
||||
p->time_ms = g_ms100;
|
||||
p->event = event;
|
||||
p->data = data;
|
||||
}
|
||||
|
||||
|
||||
const struct TraceElement * getTraceElement(uint16_t idx)
|
||||
{
|
||||
if (idx < TRACE_BUFFER_LEN) return &traceBuffer[idx];
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "stamp-opentx.h"
|
||||
|
||||
void dumpTraceBuffer()
|
||||
{
|
||||
TRACE("Dump of Trace Buffer ("VERS_STR " " DATE_STR " " TIME_STR "):");
|
||||
TRACE("# Time Event Data");
|
||||
for(int n = 0; n < TRACE_BUFFER_LEN; ++n) {
|
||||
struct gtm tp;
|
||||
filltm(&traceBuffer[n].time, &tp);
|
||||
TRACE_INFO_WP("%02d ", n);
|
||||
TRACE_INFO_WP("%4d-%02d-%02d,%02d:%02d:%02d.%02d0", tp.tm_year+1900, tp.tm_mon+1, tp.tm_mday, tp.tm_hour, tp.tm_min, tp.tm_sec, traceBuffer[n].time_ms);
|
||||
TRACE(" %03d 0x%08x", traceBuffer[n].event, traceBuffer[n].data);
|
||||
if (traceBuffer[n].time == 0 && traceBuffer[n].time_ms == 0) break;
|
||||
if ((n % 5) == 0) {
|
||||
while (!uart3TxFifo.empty()) {
|
||||
CoTickDelay(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
TRACE("End of Trace Buffer dump");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#define debug_h
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "rtc.h"
|
||||
|
||||
#if defined(SIMU)
|
||||
|
||||
@@ -108,5 +109,88 @@ void debugTask(void* pdata);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(DEBUG_TRACE_BUFFER)
|
||||
|
||||
#define TRACE_BUFFER_LEN 50
|
||||
|
||||
enum TraceEvent {
|
||||
trace_start = 1,
|
||||
|
||||
sd_wait_ready = 10,
|
||||
sd_rcvr_datablock,
|
||||
sd_xmit_datablock_wait_ready,
|
||||
sd_xmit_datablock_rcvr_spi,
|
||||
sd_send_cmd_wait_ready,
|
||||
sd_send_cmd_rcvr_spi,
|
||||
|
||||
sd_SD_ReadSectors = 16,
|
||||
sd_disk_read,
|
||||
sd_SD_WriteSectors,
|
||||
sd_disk_write,
|
||||
|
||||
sd_disk_ioctl_CTRL_SYNC = 20,
|
||||
sd_disk_ioctl_GET_SECTOR_COUNT,
|
||||
sd_disk_ioctl_MMC_GET_CSD,
|
||||
sd_disk_ioctl_MMC_GET_CID,
|
||||
sd_disk_ioctl_MMC_GET_OCR,
|
||||
sd_disk_ioctl_MMC_GET_SDSTAT_1,
|
||||
sd_disk_ioctl_MMC_GET_SDSTAT_2,
|
||||
sd_spi_reset,
|
||||
|
||||
ff_f_write_validate = 30,
|
||||
ff_f_write_flag,
|
||||
ff_f_write_clst,
|
||||
ff_f_write_sync_window,
|
||||
ff_f_write_disk_write_dirty,
|
||||
ff_f_write_clust2sect,
|
||||
ff_f_write_disk_write,
|
||||
ff_f_write_disk_read,
|
||||
ff_f_write_move_window,
|
||||
|
||||
audio_getNextFilledBuffer_skip = 50,
|
||||
};
|
||||
|
||||
struct TraceElement {
|
||||
gtime_t time;
|
||||
uint8_t time_ms;
|
||||
uint8_t event;
|
||||
uint32_t data;
|
||||
};
|
||||
|
||||
void trace_event(enum TraceEvent event, uint32_t data);
|
||||
void trace_event_i(enum TraceEvent event, uint32_t data);
|
||||
const struct TraceElement * getTraceElement(uint16_t idx);
|
||||
void dumpTraceBuffer();
|
||||
|
||||
#define TRACE_EVENT(condition, event, data) if (condition) { trace_event(event, data); }
|
||||
#define TRACEI_EVENT(condition, event, data) if (condition) { trace_event_i(event, data); }
|
||||
|
||||
#else // #if defined(DEBUG_TRACE_BUFFER)
|
||||
|
||||
#define TRACE_EVENT(condition, event, data)
|
||||
#define TRACEI_EVENT(condition, event, data)
|
||||
|
||||
#endif // #if defined(DEBUG_TRACE_BUFFER)
|
||||
|
||||
#if defined(TRACE_SD_CARD)
|
||||
#define TRACE_SD_CARD_EVENT(condition, event, data) TRACE_EVENT(condition, event, data)
|
||||
#else
|
||||
#define TRACE_SD_CARD_EVENT(condition, event, data)
|
||||
#endif
|
||||
#if defined(TRACE_FATFS)
|
||||
#define TRACE_FATFS_EVENT(condition, event, data) TRACE_EVENT(condition, event, data)
|
||||
#else
|
||||
#define TRACE_FATFS_EVENT(condition, event, data)
|
||||
#endif
|
||||
#if defined(TRACE_AUDIO)
|
||||
#define TRACE_AUDIO_EVENT(condition, event, data) TRACE_EVENT(condition, event, data)
|
||||
#define TRACEI_AUDIO_EVENT(condition, event, data) TRACEI_EVENT(condition, event, data)
|
||||
#else
|
||||
#define TRACE_AUDIO_EVENT(condition, event, data)
|
||||
#define TRACEI_AUDIO_EVENT(condition, event, data)
|
||||
#endif
|
||||
|
||||
|
||||
#endif // #ifndef debug_h
|
||||
|
||||
|
||||
@@ -385,6 +385,7 @@ void eeLoadModel(uint8_t id)
|
||||
read32_eeprom_data((File_system[id+1].block_no << 12) + sizeof(struct t_eeprom_header), (uint8_t *)&g_model, size) ;
|
||||
}
|
||||
|
||||
AUDIO_FLUSH();
|
||||
flightReset();
|
||||
logicalSwitchesReset();
|
||||
|
||||
|
||||
@@ -964,16 +964,22 @@ void eeLoadModel(uint8_t id)
|
||||
}
|
||||
#endif
|
||||
|
||||
bool newModel = false;
|
||||
|
||||
if (sz < 256) {
|
||||
modelDefault(id);
|
||||
eeCheck(true);
|
||||
newModel = true;
|
||||
}
|
||||
|
||||
AUDIO_FLUSH();
|
||||
flightReset();
|
||||
logicalSwitchesReset();
|
||||
|
||||
if (pulsesStarted()) {
|
||||
checkAll();
|
||||
if (!newModel) {
|
||||
checkAll();
|
||||
}
|
||||
resumePulses();
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -47,6 +47,10 @@ class Fifo
|
||||
{
|
||||
}
|
||||
|
||||
bool empty() {
|
||||
return (ridx == widx);
|
||||
}
|
||||
|
||||
void push(uint8_t byte) {
|
||||
uint32_t next = (widx+1) & (N-1);
|
||||
if (next != ridx) {
|
||||
@@ -56,7 +60,7 @@ class Fifo
|
||||
}
|
||||
|
||||
bool pop(uint8_t & byte) {
|
||||
if (ridx == widx) {
|
||||
if (empty()) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -106,7 +106,7 @@ const MenuFuncP_PROGMEM menuTabDiag[] PROGMEM = {
|
||||
#define RADIO_SETUP_DATE_COLUMN RADIO_SETUP_2ND_COLUMN + 4*FWNUM
|
||||
#define RADIO_SETUP_TIME_COLUMN RADIO_SETUP_2ND_COLUMN + 2*FWNUM
|
||||
#else
|
||||
#define RADIO_SETUP_2ND_COLUMN (LCD_W-6*FW-1-MENUS_SCROLLBAR_WIDTH)
|
||||
#define RADIO_SETUP_2ND_COLUMN (LCD_W-6*FW-3-MENUS_SCROLLBAR_WIDTH)
|
||||
#define RADIO_SETUP_TIME_COLUMN (FW*15+9)
|
||||
#define RADIO_SETUP_DATE_COLUMN (FW*15+5)
|
||||
#endif
|
||||
@@ -292,9 +292,9 @@ void menuGeneralSetup(uint8_t event)
|
||||
#if defined(BATTGRAPH) || defined(PCBTARANIS)
|
||||
case ITEM_SETUP_BATT_RANGE:
|
||||
lcd_putsLeft(y, STR_BATTERY_RANGE);
|
||||
lcd_putc(g_eeGeneral.vBatMin >= 10 ? RADIO_SETUP_2ND_COLUMN+2*FW+FWNUM-1 : RADIO_SETUP_2ND_COLUMN+2*FW+FWNUM-FW/2, y, '-');
|
||||
putsVolts(RADIO_SETUP_2ND_COLUMN, y, 90+g_eeGeneral.vBatMin, (m_posHorz==0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
putsVolts(RADIO_SETUP_2ND_COLUMN+4*FW-2, y, 120+g_eeGeneral.vBatMax, (m_posHorz>0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
lcd_putc(lcdLastPos, y, '-');
|
||||
putsVolts(lcdLastPos+FW, y, 120+g_eeGeneral.vBatMax, (m_posHorz>0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
#if defined(PCBTARANIS)
|
||||
if (attr && m_posHorz < 0) lcd_filled_rect(RADIO_SETUP_2ND_COLUMN, y, LCD_W-RADIO_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH, 8);
|
||||
#endif
|
||||
@@ -531,8 +531,8 @@ void menuGeneralSetup(uint8_t event)
|
||||
#if defined(PCBTARANIS) && defined(REVPLUS)
|
||||
case ITEM_SETUP_BACKLIGHT_COLOR:
|
||||
lcd_putsLeft(y, STR_BLCOLOR);
|
||||
displaySlider(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.backlightColor, 17, attr);
|
||||
if (attr) g_eeGeneral.backlightColor = checkIncDec(event, g_eeGeneral.backlightColor, 0, 17, EE_GENERAL | NO_INCDEC_MARKS);
|
||||
displaySlider(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.backlightColor, 20, attr);
|
||||
if (attr) g_eeGeneral.backlightColor = checkIncDec(event, g_eeGeneral.backlightColor, 0, 20, EE_GENERAL | NO_INCDEC_MARKS);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -859,12 +859,7 @@ void onSdManagerMenu(const char *result)
|
||||
#endif
|
||||
#if defined(PCBTARANIS)
|
||||
else if (result == STR_ASSIGN_BITMAP) {
|
||||
strcpy(lfn, reusableBuffer.sdmanager.lines[index]);
|
||||
// TODO duplicated code for finding extension
|
||||
uint8_t len = strlen(lfn) - 4;
|
||||
memset(lfn+len, 0, sizeof(g_model.header.bitmap)-len);
|
||||
// TODO duplicated code
|
||||
memcpy(g_model.header.bitmap, lfn, sizeof(g_model.header.bitmap));
|
||||
strAppendFilename(g_model.header.bitmap, reusableBuffer.sdmanager.lines[index], sizeof(g_model.header.bitmap));
|
||||
LOAD_MODEL_BITMAP();
|
||||
memcpy(modelHeaders[g_eeGeneral.currModel].bitmap, g_model.header.bitmap, sizeof(g_model.header.bitmap));
|
||||
eeDirty(EE_MODEL);
|
||||
@@ -983,7 +978,8 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
uint8_t index = m_posVert-1-s_pgOfs;
|
||||
// TODO duplicated code for finding extension
|
||||
char * ext = reusableBuffer.sdmanager.lines[index];
|
||||
ext += strlen(ext) - 4;
|
||||
int len = strlen(ext) - 4;
|
||||
ext += len;
|
||||
/* TODO if (!strcasecmp(ext, MODELS_EXT)) {
|
||||
s_menu[s_menu_count++] = STR_LOAD_FILE;
|
||||
}
|
||||
@@ -992,7 +988,7 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
}
|
||||
#endif
|
||||
#if defined(PCBTARANIS)
|
||||
else if (!strcasecmp(ext, BITMAPS_EXT) && !READ_ONLY()) {
|
||||
else if (!strcasecmp(ext, BITMAPS_EXT) && !READ_ONLY() && len <= (int)sizeof(g_model.header.bitmap)) {
|
||||
MENU_ADD_ITEM(STR_ASSIGN_BITMAP);
|
||||
}
|
||||
else if (!strcasecmp(ext, TEXT_EXT)) {
|
||||
@@ -1254,7 +1250,7 @@ void menuGeneralDiagKeys(uint8_t event)
|
||||
|
||||
if (i<8) {
|
||||
y = i/2*FH+FH*4;
|
||||
lcd_img(14*FW, y, sticks, i/2, 0);
|
||||
if (i&1) lcd_img(14*FW, y, sticks, i/2, 0);
|
||||
displayKeyState(i&1? 20*FW : 18*FW, y, (EnumKeys)(TRM_BASE+i));
|
||||
}
|
||||
|
||||
@@ -1397,7 +1393,7 @@ void menuGeneralHardware(uint8_t event)
|
||||
case ITEM_SETUP_HW_UART3_MODE:
|
||||
g_eeGeneral.uart3Mode = selectMenuItem(HW_SETTINGS_COLUMN, y, STR_UART3MODE, STR_UART3MODES, g_eeGeneral.uart3Mode, 0, UART_MODE_MAX, attr, event);
|
||||
if (checkIncDec_Ret) {
|
||||
uart3Init(g_eeGeneral.uart3Mode, MODEL_TELEMETRY_PROTOCOL);
|
||||
uart3Init(g_eeGeneral.uart3Mode, MODEL_TELEMETRY_PROTOCOL());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1325,8 +1325,8 @@ void menuModelSetup(uint8_t event)
|
||||
uint8_t x = MODEL_SETUP_2ND_COLUMN+5*FW;
|
||||
for (uint8_t i=0; i<NUM_POTS ; i++) {
|
||||
#if !defined(REVPLUS)
|
||||
if (attr && i == POT3-POT1) {
|
||||
if (m_posHorz==i+1) REPEAT_LAST_CURSOR_MOVE();
|
||||
if (i == POT3-POT1) {
|
||||
if (attr && (m_posHorz==i+1)) REPEAT_LAST_CURSOR_MOVE();
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
@@ -1353,7 +1353,7 @@ void menuModelSetup(uint8_t event)
|
||||
uint8_t x = MODEL_SETUP_2ND_COLUMN+i*FW;
|
||||
#if defined(PCBTARANIS) && !defined(REVPLUS)
|
||||
if (i == POT3) {
|
||||
if (m_posHorz == POT3) REPEAT_LAST_CURSOR_MOVE();
|
||||
if (attr && m_posHorz == POT3) REPEAT_LAST_CURSOR_MOVE();
|
||||
continue;
|
||||
}
|
||||
else if (i > POT3) {
|
||||
@@ -1621,7 +1621,7 @@ void menuModelSetup(uint8_t event)
|
||||
if (IS_PPM_PROTOCOL(protocol)) {
|
||||
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+7*FW, y, STR_NCHANNELS, g_model.ppmNCH+2, m_posHorz!=0 ? attr : 0);
|
||||
}
|
||||
else if (attr) {
|
||||
else if (m_posHorz>0 && attr) {
|
||||
MOVE_CURSOR_FROM_HERE();
|
||||
}
|
||||
if (attr && (editMode>0 || p1valdiff || (!IS_PPM_PROTOCOL(protocol) && !IS_DSM2_PROTOCOL(protocol)))) {
|
||||
@@ -3097,12 +3097,13 @@ void menuModelExpoOne(uint8_t event)
|
||||
if (ed->srcRaw >= MIXSRC_FIRST_TELEM) {
|
||||
putsTelemetryChannel(LCD_W-8, 6*FH, ed->srcRaw - MIXSRC_FIRST_TELEM, x512, 0);
|
||||
if (ed->scale > 0) x512 = (x512 * 1024) / convertTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1, ed->scale);
|
||||
x512 = limit(-1024, x512, 1024);
|
||||
}
|
||||
else {
|
||||
lcd_outdezAtt(LCD_W-8, 6*FH, calcRESXto1000(x512), PREC1);
|
||||
}
|
||||
x512 = limit(-1024, x512, 1024);
|
||||
int y512 = expoFn(x512);
|
||||
y512 = limit(-1024, y512, 1024);
|
||||
lcd_outdezAtt(LCD_W-8-6*FW, 1*FH, calcRESXto1000(y512), PREC1);
|
||||
#else
|
||||
int16_t x512 = calibratedStick[ed->chn];
|
||||
@@ -3111,10 +3112,11 @@ void menuModelExpoOne(uint8_t event)
|
||||
lcd_outdezAtt(LCD_W-8-6*FW, 1*FH, calcRESXto100(y512), 0);
|
||||
#endif
|
||||
|
||||
x512 = X0+x512/(RESXu/WCHART);
|
||||
#if defined(CPUARM)
|
||||
x512 = X0+x512/(RESX/WCHART);
|
||||
y512 = (LCD_H-1) - ((y512+RESX)/2) * (LCD_H-1) / RESX;
|
||||
#else
|
||||
x512 = X0+x512/(RESXu/WCHART);
|
||||
y512 = (LCD_H-1) - (uint16_t)((y512+RESX)/2) * (LCD_H-1) / RESX;
|
||||
#endif
|
||||
|
||||
@@ -3997,7 +3999,7 @@ void menuModelLimits(uint8_t event)
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
putsChn(0, y, k+1, (sub==k && m_posHorz < 0) ? INVERS : 0);
|
||||
if (sub==k && m_posHorz < 0 && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
if (sub==k && m_posHorz < 0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
||||
killEvents(event);
|
||||
MENU_ADD_ITEM(STR_RESET);
|
||||
MENU_ADD_ITEM(STR_COPY_TRIMS_TO_OFS);
|
||||
@@ -4359,6 +4361,22 @@ enum LogicalSwitchFields {
|
||||
#define CHECK_INCDEC_PARAM(event, var, min, max) checkIncDec(event, var, min, max, incdecFlag)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
void putsEdgeDelayParam(xcoord_t x, uint8_t y, LogicalSwitchData *cs, uint8_t lattr, uint8_t rattr)
|
||||
{
|
||||
lcd_putc(x-4, y, '[');
|
||||
lcd_outdezAtt(x, y, lswTimerValue(cs->v2), LEFT|PREC1|lattr);
|
||||
lcd_putc(lcdLastPos, y, ':');
|
||||
if (cs->v3 < 0)
|
||||
lcd_putsAtt(lcdLastPos+3, y, "<<", rattr);
|
||||
else if (cs->v3 == 0)
|
||||
lcd_putsAtt(lcdLastPos+3, y, "--", rattr);
|
||||
else
|
||||
lcd_outdezAtt(lcdLastPos+3, y, lswTimerValue(cs->v2+cs->v3), LEFT|PREC1|rattr);
|
||||
lcd_putc(lcdLastPos, y, ']');
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM) && LCD_W < 212
|
||||
|
||||
#define CSWONE_2ND_COLUMN (11*FW)
|
||||
@@ -4440,17 +4458,10 @@ void menuModelLogicalSwitchOne(uint8_t event)
|
||||
v2_max = 99;
|
||||
}
|
||||
else if (cstate == LS_FAMILY_STAY) {
|
||||
lcd_putc(CSWONE_2ND_COLUMN-4, y, '[');
|
||||
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, lswTimerValue(cs->v2), LEFT|PREC1|(m_posHorz==0 ? attr : 0));
|
||||
lcd_putc(lcdLastPos, y, ':');
|
||||
if (cs->v3 == 0)
|
||||
lcd_putsAtt(lcdLastPos+3, y, "--", (m_posHorz==1 ? attr : 0));
|
||||
else
|
||||
lcd_outdezAtt(lcdLastPos+3, y, lswTimerValue(cs->v2+cs->v3), LEFT|PREC1|(m_posHorz==1 ? attr : 0));
|
||||
lcd_putc(lcdLastPos, y, ']');
|
||||
putsEdgeDelayParam(CSWONE_2ND_COLUMN, y, cs, m_posHorz==0 ? attr : 0, m_posHorz==1 ? attr : 0);
|
||||
if (s_editMode <= 0) continue;
|
||||
if (attr && m_posHorz==1) {
|
||||
CHECK_INCDEC_MODELVAR(event, cs->v3, 0, 222 - cs->v2);
|
||||
CHECK_INCDEC_MODELVAR(event, cs->v3, -1, 222 - cs->v2);
|
||||
break;
|
||||
}
|
||||
v2_min = -129; v2_max = 122;
|
||||
@@ -4480,7 +4491,7 @@ void menuModelLogicalSwitchOne(uint8_t event)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
v2_min = -125; v2_max = 125;
|
||||
v2_min = -LIMIT_EXT_PERCENT; v2_max = +LIMIT_EXT_PERCENT;
|
||||
lcd_outdezAtt(CSWONE_2ND_COLUMN, y, cs->v2, LEFT|attr);
|
||||
}
|
||||
}
|
||||
@@ -4563,14 +4574,7 @@ void menuModelLogicalSwitches(uint8_t event)
|
||||
}
|
||||
else if (cstate == LS_FAMILY_STAY) {
|
||||
putsSwitches(CSW_2ND_COLUMN, y, cs->v1, 0);
|
||||
lcd_putc(CSW_3RD_COLUMN-4, y, '[');
|
||||
lcd_outdezAtt(CSW_3RD_COLUMN, y, lswTimerValue(cs->v2), LEFT|PREC1);
|
||||
lcd_putc(lcdLastPos, y, ':');
|
||||
if (cs->v3 == 0)
|
||||
lcd_puts(lcdLastPos+3, y, "--");
|
||||
else
|
||||
lcd_outdezAtt(lcdLastPos+3, y, lswTimerValue(cs->v2+cs->v3), LEFT|PREC1);
|
||||
lcd_putc(lcdLastPos-1, y, ']');
|
||||
putsEdgeDelayParam(CSW_3RD_COLUMN, y, cs, 0, 0);
|
||||
}
|
||||
else if (cstate == LS_FAMILY_TIMER) {
|
||||
lcd_outdezAtt(CSW_2ND_COLUMN, y, cs->v1+1, LEFT);
|
||||
@@ -4682,7 +4686,7 @@ void menuModelLogicalSwitches(uint8_t event)
|
||||
uint8_t cstate = lswFamily(cs->func);
|
||||
#if defined(CPUARM)
|
||||
int16_t v1_val=cs->v1, v1_min=0, v1_max=MIXSRC_LAST_TELEM, v2_min=0, v2_max=MIXSRC_LAST_TELEM;
|
||||
int16_t v3_min=0, v3_max=100;
|
||||
int16_t v3_min=-1, v3_max=100;
|
||||
#else
|
||||
int8_t v1_min=0, v1_max=MIXSRC_LAST_TELEM, v2_min=0, v2_max=MIXSRC_LAST_TELEM;
|
||||
#define v1_val cs->v1
|
||||
@@ -4699,14 +4703,7 @@ void menuModelLogicalSwitches(uint8_t event)
|
||||
#if defined(CPUARM)
|
||||
else if (cstate == LS_FAMILY_STAY) {
|
||||
putsSwitches(CSW_2ND_COLUMN, y, cs->v1, attr1);
|
||||
lcd_putc(CSW_3RD_COLUMN-4, y, '[');
|
||||
lcd_outdezAtt(CSW_3RD_COLUMN, y, lswTimerValue(cs->v2), LEFT|PREC1|attr2);
|
||||
lcd_putc(lcdLastPos, y, ':');
|
||||
if (cs->v3 == 0)
|
||||
lcd_putsAtt(lcdLastPos+3, y, "--", (horz==LS_FIELD_V3 ? attr : 0));
|
||||
else
|
||||
lcd_outdezAtt(lcdLastPos+3, y, lswTimerValue(cs->v2+cs->v3), LEFT|PREC1|(horz==LS_FIELD_V3 ? attr : 0));
|
||||
lcd_putc(lcdLastPos, y, ']');
|
||||
putsEdgeDelayParam(CSW_3RD_COLUMN, y, cs, attr2, horz==LS_FIELD_V3 ? attr : 0);
|
||||
v1_min = SWSRC_FIRST_IN_LOGICAL_SWITCHES; v1_max = SWSRC_LAST_IN_LOGICAL_SWITCHES;
|
||||
v2_min=-129; v2_max = 122;
|
||||
v3_max = 222 - cs->v2;
|
||||
@@ -4791,7 +4788,7 @@ void menuModelLogicalSwitches(uint8_t event)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
v2_min = -125; v2_max = +125;
|
||||
v2_min = -LIMIT_EXT_PERCENT; v2_max = +LIMIT_EXT_PERCENT;
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -4801,7 +4798,7 @@ void menuModelLogicalSwitches(uint8_t event)
|
||||
}
|
||||
else {
|
||||
lcd_outdezAtt(CSW_3RD_COLUMN, y, cs->v2, LEFT|attr2);
|
||||
v2_min = -125; v2_max = 125;
|
||||
v2_min = -LIMIT_EXT_PERCENT; v2_max = +LIMIT_EXT_PERCENT;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -5122,8 +5119,10 @@ void menuModelCustomFunctions(uint8_t event)
|
||||
}
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
else if (func == FUNC_OVERRIDE_CHANNEL) {
|
||||
#if !defined(CPUARM)
|
||||
val_displayed = (int8_t)CFN_PARAM(sd);
|
||||
val_min = -125; val_max = 125;
|
||||
#endif
|
||||
val_min = -LIMIT_EXT_PERCENT; val_max = +LIMIT_EXT_PERCENT;
|
||||
lcd_outdezAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -137,6 +137,9 @@ void menuModelCustomFunctions(uint8_t event);
|
||||
void menuStatisticsView(uint8_t event);
|
||||
void menuStatisticsDebug(uint8_t event);
|
||||
void menuAboutView(uint8_t event);
|
||||
#if defined(DEBUG_TRACE_BUFFER)
|
||||
void menuTraceBuffer(uint8_t event);
|
||||
#endif
|
||||
|
||||
#if !defined(CPUM64)
|
||||
void displaySlider(uint8_t x, uint8_t y, uint8_t value, uint8_t max, uint8_t attr);
|
||||
|
||||
@@ -164,7 +164,7 @@ void displayTrims(uint8_t phase)
|
||||
uint8_t att = ROUND;
|
||||
int16_t val = getTrimValue(phase, i);
|
||||
|
||||
if (val < -125 || val > 125)
|
||||
if (val < TRIM_MIN || val > TRIM_MAX)
|
||||
att = BLINK|INVERS|ROUND;
|
||||
|
||||
if (val < -(TRIM_LEN+1)*4)
|
||||
|
||||
@@ -92,9 +92,20 @@ void menuStatisticsView(uint8_t event)
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define MENU_DEBUG_COL1_OFS (11*FW-2)
|
||||
#define MENU_DEBUG_Y_MIXMAX (2*FH-3)
|
||||
#define MENU_DEBUG_Y_LUA (3*FH-2)
|
||||
#define MENU_DEBUG_Y_FREE_RAM (4*FH-1)
|
||||
#define MENU_DEBUG_Y_STACK (5*FH)
|
||||
#define MENU_DEBUG_Y_RTOS (6*FH)
|
||||
#elif defined(PCBSKY9X)
|
||||
#define MENU_DEBUG_COL1_OFS (11*FW-3)
|
||||
#define MENU_DEBUG_COL2_OFS (17*FW)
|
||||
#define MENU_DEBUG_Y_CURRENT (1*FH)
|
||||
#define MENU_DEBUG_Y_MAH (2*FH)
|
||||
#define MENU_DEBUG_Y_CPU_TEMP (3*FH)
|
||||
#define MENU_DEBUG_Y_COPROC (4*FH)
|
||||
#define MENU_DEBUG_Y_MIXMAX (5*FH)
|
||||
#define MENU_DEBUG_Y_RTOS (6*FH)
|
||||
#else
|
||||
#define MENU_DEBUG_COL1_OFS (14*FW)
|
||||
#endif
|
||||
@@ -130,6 +141,13 @@ void menuStatisticsDebug(uint8_t event)
|
||||
maxMixerDuration = 0;
|
||||
AUDIO_KEYPAD_UP();
|
||||
break;
|
||||
|
||||
#if defined(DEBUG_TRACE_BUFFER)
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
pushMenu(menuTraceBuffer);
|
||||
return;
|
||||
#endif
|
||||
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
chainMenu(menuStatisticsView);
|
||||
return;
|
||||
@@ -149,76 +167,87 @@ void menuStatisticsDebug(uint8_t event)
|
||||
|
||||
#if defined(PCBSKY9X) && !defined(REVA)
|
||||
// current
|
||||
lcd_putsLeft(1*FH, STR_CPU_CURRENT);
|
||||
putsTelemetryValue(MENU_DEBUG_COL1_OFS, 1*FH, getCurrent(), UNIT_MILLIAMPS, LEFT);
|
||||
lcd_putsLeft(MENU_DEBUG_Y_CURRENT, STR_CPU_CURRENT);
|
||||
putsTelemetryValue(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_CURRENT, getCurrent(), UNIT_MILLIAMPS, LEFT);
|
||||
uint32_t current_scale = 488 + g_eeGeneral.currentCalib;
|
||||
lcd_putc(MENU_DEBUG_COL2_OFS, 1*FH, '>');
|
||||
putsTelemetryValue(MENU_DEBUG_COL2_OFS+FW+1, 1*FH, Current_max*10*current_scale/8192, UNIT_RAW, LEFT);
|
||||
lcd_putc(MENU_DEBUG_COL2_OFS, MENU_DEBUG_Y_CURRENT, '>');
|
||||
putsTelemetryValue(MENU_DEBUG_COL2_OFS+FW+1, MENU_DEBUG_Y_CURRENT, Current_max*10*current_scale/8192, UNIT_RAW, LEFT);
|
||||
// consumption
|
||||
lcd_putsLeft(2*FH, STR_CPU_MAH);
|
||||
putsTelemetryValue(MENU_DEBUG_COL1_OFS, 2*FH, g_eeGeneral.mAhUsed + Current_used*current_scale/8192/36, UNIT_MAH, LEFT|PREC1);
|
||||
lcd_putsLeft(MENU_DEBUG_Y_MAH, STR_CPU_MAH);
|
||||
putsTelemetryValue(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MAH, g_eeGeneral.mAhUsed + Current_used*current_scale/8192/36, UNIT_MAH, LEFT|PREC1);
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
lcd_putsLeft(3*FH, STR_CPU_TEMP);
|
||||
putsTelemetryValue(MENU_DEBUG_COL1_OFS, 3*FH, getTemperature(), UNIT_TEMPERATURE, LEFT);
|
||||
lcd_putc(MENU_DEBUG_COL2_OFS, 3*FH, '>');
|
||||
putsTelemetryValue(MENU_DEBUG_COL2_OFS+FW+1, 3*FH, maxTemperature+g_eeGeneral.temperatureCalib, UNIT_TEMPERATURE, LEFT);
|
||||
lcd_putsLeft(MENU_DEBUG_Y_CPU_TEMP, STR_CPU_TEMP);
|
||||
putsTelemetryValue(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_CPU_TEMP, getTemperature(), UNIT_TEMPERATURE, LEFT);
|
||||
lcd_putc(MENU_DEBUG_COL2_OFS, MENU_DEBUG_Y_CPU_TEMP, '>');
|
||||
putsTelemetryValue(MENU_DEBUG_COL2_OFS+FW+1, MENU_DEBUG_Y_CPU_TEMP, maxTemperature+g_eeGeneral.temperatureCalib, UNIT_TEMPERATURE, LEFT);
|
||||
#endif
|
||||
|
||||
#if defined(COPROCESSOR)
|
||||
lcd_putsLeft(4*FH, STR_COPROC_TEMP);
|
||||
lcd_putsLeft(MENU_DEBUG_Y_COPROC, STR_COPROC_TEMP);
|
||||
|
||||
if (Coproc_read==0) {
|
||||
lcd_putsAtt(MENU_DEBUG_COL1_OFS, 4*FH, PSTR("Co Proc NACK"),INVERS);
|
||||
lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, PSTR("Co Proc NACK"),INVERS);
|
||||
}
|
||||
else if (Coproc_read==0x81) {
|
||||
lcd_putsAtt(MENU_DEBUG_COL1_OFS, 4*FH, PSTR("Inst.TinyApp"),INVERS);
|
||||
lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, PSTR("Inst.TinyApp"),INVERS);
|
||||
}
|
||||
else if (Coproc_read<3) {
|
||||
lcd_putsAtt(MENU_DEBUG_COL1_OFS, 4*FH, PSTR("Upgr.TinyApp"),INVERS);
|
||||
lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, PSTR("Upgr.TinyApp"),INVERS);
|
||||
}
|
||||
else {
|
||||
putsTelemetryValue(MENU_DEBUG_COL1_OFS, 4*FH, Coproc_temp, UNIT_TEMPERATURE, LEFT);
|
||||
putsTelemetryValue(MENU_DEBUG_COL2_OFS, 4*FH, Coproc_maxtemp, UNIT_TEMPERATURE, LEFT);
|
||||
putsTelemetryValue(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_COPROC, Coproc_temp, UNIT_TEMPERATURE, LEFT);
|
||||
putsTelemetryValue(MENU_DEBUG_COL2_OFS, MENU_DEBUG_Y_COPROC, Coproc_maxtemp, UNIT_TEMPERATURE, LEFT);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) && !defined(SIMU)
|
||||
lcd_putsLeft(3*FH, "Free Mem");
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, 3*FH, getAvailableMemory(), LEFT);
|
||||
lcd_putsLeft(MENU_DEBUG_Y_FREE_RAM, "Free Mem");
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_FREE_RAM, getAvailableMemory(), LEFT);
|
||||
lcd_puts(lcdLastPos, MENU_DEBUG_Y_FREE_RAM, "b");
|
||||
#endif
|
||||
|
||||
#if defined(LUA)
|
||||
lcd_putsLeft(4*FH, "Lua scripts");
|
||||
lcd_putsAtt(MENU_DEBUG_COL1_OFS, 4*FH+1, "[Duration]", SMLSIZE);
|
||||
lcd_outdezAtt(lcdLastPos, 4*FH, 10*maxLuaDuration, LEFT);
|
||||
lcd_putsAtt(lcdLastPos+2, 4*FH+1, "[Interval]", SMLSIZE);
|
||||
lcd_outdezAtt(lcdLastPos, 4*FH, 10*maxLuaInterval, LEFT);
|
||||
lcd_putsLeft(MENU_DEBUG_Y_LUA, "Lua scripts");
|
||||
lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_LUA+1, "[Duration]", SMLSIZE);
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_LUA, 10*maxLuaDuration, LEFT);
|
||||
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_LUA+1, "[Interval]", SMLSIZE);
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_LUA, 10*maxLuaInterval, LEFT);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
lcd_putsLeft(5*FH, STR_TMIXMAXMS);
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, 5*FH, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT);
|
||||
lcd_puts(lcdLastPos, 5*FH, "ms");
|
||||
lcd_putsLeft(6*FH, STR_FREESTACKMINB);
|
||||
|
||||
#if LCD_W >= 212
|
||||
lcd_putsAtt(MENU_DEBUG_COL1_OFS, 6*FH+1, "[Main]", SMLSIZE);
|
||||
lcd_outdezAtt(lcdLastPos, 6*FH, stack_free(0), UNSIGN|LEFT);
|
||||
lcd_putsAtt(lcdLastPos+2, 6*FH+1, "[Mix]", SMLSIZE);
|
||||
lcd_outdezAtt(lcdLastPos, 6*FH, stack_free(1), UNSIGN|LEFT);
|
||||
lcd_putsAtt(lcdLastPos+2, 6*FH+1, "[Audio]", SMLSIZE);
|
||||
lcd_outdezAtt(lcdLastPos, 6*FH, stack_free(2), UNSIGN|LEFT);
|
||||
#else
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, 6*FH, stack_free(0), UNSIGN|LEFT);
|
||||
lcd_puts(lcdLastPos, 6*FH, "/");
|
||||
lcd_outdezAtt(lcdLastPos, 6*FH, stack_free(1), UNSIGN|LEFT);
|
||||
lcd_puts(lcdLastPos, 6*FH, "/");
|
||||
lcd_outdezAtt(lcdLastPos, 6*FH, stack_free(2), UNSIGN|LEFT);
|
||||
lcd_putsLeft(MENU_DEBUG_Y_MIXMAX, STR_TMIXMAXMS);
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MIXMAX, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT);
|
||||
lcd_puts(lcdLastPos, MENU_DEBUG_Y_MIXMAX, "ms");
|
||||
#endif
|
||||
|
||||
#else
|
||||
#if 0
|
||||
lcd_putsLeft(MENU_DEBUG_Y_STACK, STR_FREESTACKMINB);
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_STACK, stack_free(255), UNSIGN|LEFT);
|
||||
lcd_puts(lcdLastPos, MENU_DEBUG_Y_STACK, "b");
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB);
|
||||
lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+1, "[Main]", SMLSIZE);
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(0), UNSIGN|LEFT);
|
||||
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[Mix]", SMLSIZE);
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(1), UNSIGN|LEFT);
|
||||
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[Audio]", SMLSIZE);
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(2), UNSIGN|LEFT);
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB);
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS, stack_free(0), UNSIGN|LEFT);
|
||||
lcd_puts(lcdLastPos, MENU_DEBUG_Y_RTOS, "/");
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(1), UNSIGN|LEFT);
|
||||
lcd_puts(lcdLastPos, MENU_DEBUG_Y_RTOS, "/");
|
||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(2), UNSIGN|LEFT);
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
lcd_putsLeft(1*FH, STR_TMR1LATMAXUS);
|
||||
lcd_outdez8(MENU_DEBUG_COL1_OFS , 1*FH, g_tmr1Latency_max/2 );
|
||||
lcd_putsLeft(2*FH, STR_TMR1LATMINUS);
|
||||
@@ -234,3 +263,58 @@ void menuStatisticsDebug(uint8_t event)
|
||||
lcd_puts(3*FW, 7*FH+1, STR_MENUTORESET);
|
||||
lcd_status_line();
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG_TRACE_BUFFER)
|
||||
#include "stamp-opentx.h"
|
||||
|
||||
void menuTraceBuffer(uint8_t event)
|
||||
{
|
||||
switch(event)
|
||||
{
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
dumpTraceBuffer();
|
||||
killEvents(event);
|
||||
break;
|
||||
}
|
||||
|
||||
SIMPLE_SUBMENU("Trace Buffer " VERS_STR, TRACE_BUFFER_LEN);
|
||||
/* RTC time */
|
||||
struct gtm t;
|
||||
gettime(&t);
|
||||
putsTime(LCD_W+1, 0, t, TIMEBLINK);
|
||||
|
||||
uint8_t y = 0;
|
||||
uint8_t k = 0;
|
||||
int8_t sub = m_posVert;
|
||||
|
||||
lcd_putc(0, FH, '#');
|
||||
lcd_puts(4*FW, FH, "Time");
|
||||
lcd_puts(14*FW, FH, "Event");
|
||||
lcd_puts(20*FW, FH, "Data");
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-2; i++) {
|
||||
y = 1 + (i+2)*FH;
|
||||
k = i+s_pgOfs;
|
||||
|
||||
//item
|
||||
lcd_outdezAtt(0, y, k, LEFT | (sub==k ? INVERS : 0));
|
||||
|
||||
const struct TraceElement * te = getTraceElement(k);
|
||||
if (te) {
|
||||
//time
|
||||
putstime_t tme = te->time % SECS_PER_DAY;
|
||||
putsTimer(4*FW, y, tme, TIMEHOUR|LEFT, TIMEHOUR|LEFT);
|
||||
//event
|
||||
lcd_outdezNAtt(14*FW, y, te->event, LEADING0|LEFT, 3);
|
||||
//data
|
||||
lcd_putsn (20*FW, y, "0x", 2);
|
||||
lcd_outhex4(22*FW-2, y, (uint16_t)(te->data >> 16));
|
||||
lcd_outhex4(25*FW, y, (uint16_t)(te->data & 0xFFFF));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endif //#if defined(DEBUG_TRACE_BUFFER)
|
||||
|
||||
@@ -161,8 +161,50 @@ uint8_t barCoord(int16_t value, int16_t min, int16_t max)
|
||||
return limit((uint8_t)0, (uint8_t)(((int32_t)(BAR_WIDTH-1) * (value - min)) / (max - min)), (uint8_t)BAR_WIDTH);
|
||||
}
|
||||
|
||||
#if defined(LUA)
|
||||
|
||||
#define LUA_SCRIPT_ERROR_Y 3*FH
|
||||
// TODO more visual appealing implementation and text translations
|
||||
void displayLuaScriptError(uint8_t state, const char * name, int index)
|
||||
{
|
||||
lcd_putsAtt(0, LUA_SCRIPT_ERROR_Y, name, 0);
|
||||
if (index > 0) {
|
||||
lcd_outdezAtt(lcdLastPos, LUA_SCRIPT_ERROR_Y, index, LEFT);
|
||||
}
|
||||
lcd_putsAtt(lcdLastPos, LUA_SCRIPT_ERROR_Y, ": ", 0);
|
||||
switch (state) {
|
||||
case SCRIPT_SYNTAX_ERROR:
|
||||
lcd_putsAtt(lcdLastPos, LUA_SCRIPT_ERROR_Y, "Script syntax error", 0);
|
||||
break;
|
||||
case SCRIPT_PANIC:
|
||||
lcd_putsAtt(lcdLastPos, LUA_SCRIPT_ERROR_Y, "Script panic", 0);
|
||||
break;
|
||||
case SCRIPT_KILLED:
|
||||
lcd_putsAtt(lcdLastPos, LUA_SCRIPT_ERROR_Y, "Script killed", 0);
|
||||
break;
|
||||
default:
|
||||
lcd_putsAtt(lcdLastPos, LUA_SCRIPT_ERROR_Y, "Unknown error", 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void displayVoltagesScreen()
|
||||
{
|
||||
#if defined(LUA)
|
||||
uint8_t state = isTelemetryScriptAvailable(TELEMETRY_VOLTAGES_SCREEN);
|
||||
switch (state) {
|
||||
case SCRIPT_OK:
|
||||
return; //contents will be drawed by Lua Task
|
||||
case SCRIPT_NOFILE:
|
||||
break; //display normal screen
|
||||
case SCRIPT_SYNTAX_ERROR:
|
||||
case SCRIPT_PANIC:
|
||||
case SCRIPT_KILLED:
|
||||
//display script error
|
||||
displayLuaScriptError(state, "telempw", 0);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
// Volts / Amps / Watts / mAh
|
||||
uint8_t analog = 0;
|
||||
#if defined(CPUARM)
|
||||
@@ -255,8 +297,25 @@ void displayVoltagesScreen()
|
||||
displayRssiLine();
|
||||
}
|
||||
|
||||
|
||||
void displayAfterFlightScreen()
|
||||
{
|
||||
#if defined(LUA)
|
||||
uint8_t state = isTelemetryScriptAvailable(TELEMETRY_AFTER_FLIGHT_SCREEN);
|
||||
switch (state) {
|
||||
case SCRIPT_OK:
|
||||
return; //contents will be drawed by Lua Task
|
||||
case SCRIPT_NOFILE:
|
||||
break; //display normal screen
|
||||
case SCRIPT_SYNTAX_ERROR:
|
||||
case SCRIPT_PANIC:
|
||||
case SCRIPT_KILLED:
|
||||
//display script error
|
||||
displayLuaScriptError(state, "telemaf", 0);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t line=1*FH+1;
|
||||
if (IS_GPS_AVAILABLE()) {
|
||||
// Latitude
|
||||
@@ -430,7 +489,20 @@ bool displayTelemetryScreen()
|
||||
{
|
||||
#if defined(LUA)
|
||||
if (s_frsky_view < TELEMETRY_CUSTOM_SCREEN_1) {
|
||||
return isTelemetryScriptAvailable(s_frsky_view);
|
||||
uint8_t state = isTelemetryScriptAvailable(s_frsky_view);
|
||||
switch (state) {
|
||||
case SCRIPT_OK:
|
||||
return true; //contents will be drawed by Lua Task
|
||||
case SCRIPT_NOFILE:
|
||||
return false; //requested lua telemetry screen not available
|
||||
case SCRIPT_SYNTAX_ERROR:
|
||||
case SCRIPT_PANIC:
|
||||
case SCRIPT_KILLED:
|
||||
//display script error
|
||||
displayLuaScriptError(state, "telem", s_frsky_view+1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -299,5 +299,6 @@ void lcdSetContrast();
|
||||
|
||||
char * strAppend(char * dest, const char * source);
|
||||
char * strAppendDate(char * str, bool time=false);
|
||||
char * strAppendFilename(char * dest, const char * filename, const int size);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -830,7 +830,7 @@ void putsCurve(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att)
|
||||
void putsCurve(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att)
|
||||
{
|
||||
if (idx < 0) {
|
||||
lcd_putcAtt(x-1*FW, y, '!', att);
|
||||
lcd_putcAtt(x-3, y, '!', att);
|
||||
idx = -idx+CURVE_BASE-1;
|
||||
}
|
||||
if (idx < CURVE_BASE)
|
||||
|
||||
@@ -38,7 +38,10 @@
|
||||
|
||||
void lcd_mask(uint8_t *p, uint8_t mask, LcdFlags att)
|
||||
{
|
||||
ASSERT_IN_DISPLAY(p);
|
||||
// ASSERT_IN_DISPLAY(p);
|
||||
if ((p) >= DISPLAY_END) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (att&FILL_WHITE) {
|
||||
// TODO I could remove this, it's used for the top bar
|
||||
@@ -71,7 +74,12 @@ void lcd_plot(xcoord_t x, uint8_t y, LcdFlags att)
|
||||
void lcd_hlineStip(xcoord_t x, uint8_t y, xcoord_t w, uint8_t pat, LcdFlags att)
|
||||
{
|
||||
if (y >= LCD_H) return;
|
||||
if (x+w > LCD_W) { w = LCD_W - x; }
|
||||
if (x+w > LCD_W) {
|
||||
if (x >= LCD_W ) {
|
||||
return;
|
||||
}
|
||||
w = LCD_W - x;
|
||||
}
|
||||
|
||||
uint8_t *p = &displayBuf[ y / 2 * LCD_W + x ];
|
||||
uint8_t mask = PIXEL_GREY_MASK(y, att);
|
||||
@@ -149,6 +157,9 @@ void lcd_bmp(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t offset, uint8_
|
||||
width = w;
|
||||
}
|
||||
if (x+width > LCD_W) {
|
||||
if (x >= LCD_W ) {
|
||||
return;
|
||||
}
|
||||
width = LCD_W-x;
|
||||
}
|
||||
uint8_t rows = (pgm_read_byte(q++) + 1) / 2;
|
||||
@@ -157,6 +168,9 @@ void lcd_bmp(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t offset, uint8_
|
||||
q = img + 2 + row*w + offset;
|
||||
uint8_t *p = &displayBuf[(row + (y/2)) * LCD_W + x];
|
||||
for (xcoord_t i=0; i<width; i++) {
|
||||
if ((p) >= DISPLAY_END) {
|
||||
return;
|
||||
}
|
||||
uint8_t b = pgm_read_byte(q++);
|
||||
if (y & 1) {
|
||||
*p = (*p & 0x0f) + ((b & 0x0f) << 4);
|
||||
|
||||
+6
-2
@@ -198,12 +198,16 @@ void writeLogs()
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY)
|
||||
#if defined(CPUARM)
|
||||
#if defined(PCBTARANIS) && defined(REVPLUS)
|
||||
if (IS_VALID_XJT_VERSION())
|
||||
f_printf(&g_oLogFile, "%d,%d,", RAW_FRSKY_MINMAX(frskyData.swr), RAW_FRSKY_MINMAX(frskyData.rssi[0]));
|
||||
else
|
||||
f_printf(&g_oLogFile, "-,%d,", RAW_FRSKY_MINMAX(frskyData.rssi[0]));
|
||||
#elif defined(CPUARM)
|
||||
f_printf(&g_oLogFile, "%d,%d,", RAW_FRSKY_MINMAX(frskyData.swr), RAW_FRSKY_MINMAX(frskyData.rssi[0]));
|
||||
#else
|
||||
f_printf(&g_oLogFile, "%d,%d,%d,", frskyStreaming, RAW_FRSKY_MINMAX(frskyData.rssi[0]), RAW_FRSKY_MINMAX(frskyData.rssi[1]));
|
||||
#endif
|
||||
|
||||
for (uint8_t i=0; i<MAX_FRSKY_A_CHANNELS; i++) {
|
||||
int16_t converted_value = applyChannelRatio(i, RAW_FRSKY_MINMAX(frskyData.analog[i]));
|
||||
f_printf(&g_oLogFile, "%d.%02d,", converted_value/100, converted_value%100);
|
||||
|
||||
+579
-329
File diff suppressed because it is too large
Load Diff
+34
-12
@@ -23,6 +23,7 @@
|
||||
#include "lstate.h"
|
||||
#include "lstring.h"
|
||||
#include "ltable.h"
|
||||
#include "lrotable.h"
|
||||
#include "ltm.h"
|
||||
#include "lundump.h"
|
||||
#include "lvm.h"
|
||||
@@ -260,7 +261,7 @@ LUA_API const char *lua_typename (lua_State *L, int t) {
|
||||
|
||||
LUA_API int lua_iscfunction (lua_State *L, int idx) {
|
||||
StkId o = index2addr(L, idx);
|
||||
return (ttislcf(o) || (ttisCclosure(o)));
|
||||
return (ttislcf(o) || ttislightfunction(o) || (ttisCclosure(o)));
|
||||
}
|
||||
|
||||
|
||||
@@ -417,7 +418,7 @@ LUA_API size_t lua_rawlen (lua_State *L, int idx) {
|
||||
|
||||
LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) {
|
||||
StkId o = index2addr(L, idx);
|
||||
if (ttislcf(o)) return fvalue(o);
|
||||
if (ttislcf(o)) return lcfvalue(o);
|
||||
else if (ttisCclosure(o))
|
||||
return clCvalue(o)->f;
|
||||
else return NULL; /* not a C function */
|
||||
@@ -446,11 +447,14 @@ LUA_API const void *lua_topointer (lua_State *L, int idx) {
|
||||
case LUA_TTABLE: return hvalue(o);
|
||||
case LUA_TLCL: return clLvalue(o);
|
||||
case LUA_TCCL: return clCvalue(o);
|
||||
case LUA_TLCF: return cast(void *, cast(size_t, fvalue(o)));
|
||||
case LUA_TLCF: return cast(void *, cast(size_t, lcfvalue(o)));
|
||||
case LUA_TTHREAD: return thvalue(o);
|
||||
case LUA_TUSERDATA:
|
||||
case LUA_TLIGHTUSERDATA:
|
||||
return lua_touserdata(L, idx);
|
||||
case LUA_TROTABLE:
|
||||
case LUA_TLIGHTFUNCTION:
|
||||
return pvalue(o);
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
@@ -551,11 +555,10 @@ LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
|
||||
lua_lock(L);
|
||||
if (n == 0) {
|
||||
setfvalue(L->top, fn);
|
||||
setlcfvalue(L->top, fn);
|
||||
}
|
||||
else {
|
||||
Closure *cl;
|
||||
@@ -573,7 +576,6 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
|
||||
lua_unlock(L);
|
||||
}
|
||||
|
||||
|
||||
LUA_API void lua_pushboolean (lua_State *L, int b) {
|
||||
lua_lock(L);
|
||||
setbvalue(L->top, (b != 0)); /* ensure that true is 1 */
|
||||
@@ -589,6 +591,19 @@ LUA_API void lua_pushlightuserdata (lua_State *L, void *p) {
|
||||
lua_unlock(L);
|
||||
}
|
||||
|
||||
LUA_API void lua_pushrotable (lua_State *L, void *p) {
|
||||
lua_lock(L);
|
||||
setrvalue(L->top, p);
|
||||
api_incr_top(L);
|
||||
lua_unlock(L);
|
||||
}
|
||||
|
||||
LUA_API void lua_pushlightfunction(lua_State *L, void *p) {
|
||||
lua_lock(L);
|
||||
setlfvalue(L->top, p);
|
||||
api_incr_top(L);
|
||||
lua_unlock(L);
|
||||
}
|
||||
|
||||
LUA_API int lua_pushthread (lua_State *L) {
|
||||
lua_lock(L);
|
||||
@@ -598,8 +613,6 @@ LUA_API int lua_pushthread (lua_State *L) {
|
||||
return (G(L)->mainthread == L);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** get functions (Lua -> stack)
|
||||
*/
|
||||
@@ -609,9 +622,19 @@ LUA_API void lua_getglobal (lua_State *L, const char *var) {
|
||||
Table *reg = hvalue(&G(L)->l_registry);
|
||||
const TValue *gt; /* global table */
|
||||
lua_lock(L);
|
||||
gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
|
||||
setsvalue2s(L, L->top++, luaS_new(L, var));
|
||||
luaV_gettable(L, gt, L->top - 1, L->top - 1);
|
||||
|
||||
lu_byte keytype;
|
||||
luaR_result res = luaR_findglobal(var, &keytype);
|
||||
if (res != 0) {
|
||||
setsvalue2s(L, L->top++, luaS_new(L, var));
|
||||
setlfvalue(L->top - 1, (void*)(size_t)res)
|
||||
}
|
||||
else {
|
||||
gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
|
||||
setsvalue2s(L, L->top++, luaS_new(L, var));
|
||||
luaV_gettable(L, gt, L->top - 1, L->top - 1);
|
||||
}
|
||||
|
||||
lua_unlock(L);
|
||||
}
|
||||
|
||||
@@ -1008,7 +1031,6 @@ LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
LUA_API int lua_status (lua_State *L) {
|
||||
return L->status;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,12 @@ typedef struct luaL_Reg {
|
||||
lua_CFunction func;
|
||||
} luaL_Reg;
|
||||
|
||||
extern const luaL_Reg baselib[];
|
||||
extern const luaL_Reg mathlib[];
|
||||
extern const luaL_Reg opentxLib[];
|
||||
extern const luaL_Reg bitlib[];
|
||||
extern const luaL_Reg lcdLib[];
|
||||
extern const luaL_Reg modelLib[];
|
||||
|
||||
LUALIB_API void (luaL_checkversion_) (lua_State *L, lua_Number ver);
|
||||
#define luaL_checkversion(L) luaL_checkversion_(L, LUA_VERSION_NUM)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "lauxlib.h"
|
||||
#include "lualib.h"
|
||||
|
||||
#include "lrotable.h"
|
||||
|
||||
static int luaB_print (lua_State *L) {
|
||||
int n = lua_gettop(L); /* number of arguments */
|
||||
@@ -411,8 +411,7 @@ static int luaB_tostring (lua_State *L) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static const luaL_Reg base_funcs[] = {
|
||||
const luaL_Reg baselib[] = {
|
||||
{"assert", luaB_assert},
|
||||
{"collectgarbage", luaB_collectgarbage},
|
||||
{"dofile", luaB_dofile},
|
||||
@@ -441,16 +440,10 @@ static const luaL_Reg base_funcs[] = {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
LUAMOD_API int luaopen_base (lua_State *L) {
|
||||
/* set global _G */
|
||||
lua_pushglobaltable(L);
|
||||
lua_pushglobaltable(L);
|
||||
lua_setfield(L, -2, "_G");
|
||||
/* open lib into global table */
|
||||
luaL_setfuncs(L, base_funcs, 0);
|
||||
lua_pushliteral(L, LUA_VERSION);
|
||||
lua_setfield(L, -2, "_VERSION"); /* set global _VERSION */
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// TODO
|
||||
const luaR_value_entry baselib_vals[] = {
|
||||
{"_VERSION", LUA_VERSION},
|
||||
{NULL, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "lauxlib.h"
|
||||
#include "lualib.h"
|
||||
|
||||
#include "lrotable.h"
|
||||
|
||||
/* number of bits to consider in a number */
|
||||
#if !defined(LUA_NBITS)
|
||||
@@ -185,7 +186,7 @@ static int b_replace (lua_State *L) {
|
||||
}
|
||||
|
||||
|
||||
static const luaL_Reg bitlib[] = {
|
||||
const luaL_Reg bitlib[] = {
|
||||
{"arshift", b_arshift},
|
||||
{"band", b_and},
|
||||
{"bnot", b_not},
|
||||
@@ -201,10 +202,11 @@ static const luaL_Reg bitlib[] = {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
const luaR_value_entry bitlib_vals[] = {
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
LUAMOD_API int luaopen_bit32 (lua_State *L) {
|
||||
luaL_newlib(L, bitlib);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -299,7 +299,10 @@ int luaD_precall (lua_State *L, StkId func, int nresults) {
|
||||
ptrdiff_t funcr = savestack(L, func);
|
||||
switch (ttype(func)) {
|
||||
case LUA_TLCF: /* light C function */
|
||||
f = fvalue(func);
|
||||
f = lcfvalue(func);
|
||||
goto Cfunc;
|
||||
case LUA_TLIGHTFUNCTION:
|
||||
f = check_exp(ttislightfunction(func), val_(func).f);
|
||||
goto Cfunc;
|
||||
case LUA_TCCL: { /* C closure */
|
||||
f = clCvalue(func)->f;
|
||||
|
||||
@@ -20,13 +20,14 @@
|
||||
#include "lualib.h"
|
||||
#include "lauxlib.h"
|
||||
|
||||
#include "lrotable.h"
|
||||
|
||||
/*
|
||||
** these libs are loaded by lua.c and are readily available to any Lua
|
||||
** program
|
||||
*/
|
||||
static const luaL_Reg loadedlibs[] = {
|
||||
{"_G", luaopen_base},
|
||||
// {"_G", luaopen_base},
|
||||
// {LUA_LOADLIBNAME, luaopen_package},
|
||||
// {LUA_COLIBNAME, luaopen_coroutine},
|
||||
// {LUA_TABLIBNAME, luaopen_table},
|
||||
@@ -34,11 +35,22 @@ static const luaL_Reg loadedlibs[] = {
|
||||
// {LUA_OSLIBNAME, luaopen_os},
|
||||
// {LUA_STRLIBNAME, luaopen_string},
|
||||
// {LUA_BITLIBNAME, luaopen_bit32},
|
||||
{LUA_MATHLIBNAME, luaopen_math},
|
||||
// {LUA_MATHLIBNAME, luaopen_math},
|
||||
// {LUA_DBLIBNAME, luaopen_debug},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
/* The read-only tables are defined here */
|
||||
const luaR_table lua_rotable[] =
|
||||
{
|
||||
{LUA_MATHLIBNAME, mathlib, mathlib_vals},
|
||||
{LUA_BITLIBNAME, bitlib, NULL},
|
||||
{"lcd", lcdLib, NULL},
|
||||
{"model", modelLib, NULL},
|
||||
{"__baselib", baselib, NULL},
|
||||
{"__opentx", opentxLib, opentxConstants},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
/*
|
||||
** these libs are preloaded and must be required before used
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "lauxlib.h"
|
||||
#include "lualib.h"
|
||||
|
||||
#include "lrotable.h"
|
||||
|
||||
#undef PI
|
||||
#define PI ((lua_Number)(3.1415926535897932384626433832795))
|
||||
@@ -228,20 +229,19 @@ static int math_randomseed (lua_State *L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static const luaL_Reg mathlib[] = {
|
||||
const luaL_Reg mathlib[] = {
|
||||
{"abs", math_abs},
|
||||
{"acos", math_acos},
|
||||
{"asin", math_asin},
|
||||
{"atan2", math_atan2},
|
||||
{"atan", math_atan},
|
||||
{"ceil", math_ceil},
|
||||
{"cosh", math_cosh},
|
||||
{"cosh", math_cosh},
|
||||
{"cos", math_cos},
|
||||
{"deg", math_deg},
|
||||
{"exp", math_exp},
|
||||
{"floor", math_floor},
|
||||
{"fmod", math_fmod},
|
||||
{"fmod", math_fmod},
|
||||
{"frexp", math_frexp},
|
||||
{"ldexp", math_ldexp},
|
||||
#if defined(LUA_COMPAT_LOG10)
|
||||
@@ -263,16 +263,16 @@ static const luaL_Reg mathlib[] = {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
const luaR_value_entry mathlib_vals[] = {
|
||||
{"pi", PI},
|
||||
{"huge", HUGE_VAL},
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
/*
|
||||
** Open math library
|
||||
*/
|
||||
LUAMOD_API int luaopen_math (lua_State *L) {
|
||||
luaL_newlib(L, mathlib);
|
||||
lua_pushnumber(L, PI);
|
||||
lua_setfield(L, -2, "pi");
|
||||
lua_pushnumber(L, HUGE_VAL);
|
||||
lua_setfield(L, -2, "huge");
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -137,6 +137,8 @@ typedef union Value Value;
|
||||
#define ttisnil(o) checktag((o), LUA_TNIL)
|
||||
#define ttisboolean(o) checktag((o), LUA_TBOOLEAN)
|
||||
#define ttislightuserdata(o) checktag((o), LUA_TLIGHTUSERDATA)
|
||||
#define ttisrotable(o) checktag((o), LUA_TROTABLE)
|
||||
#define ttislightfunction(o) checktag((o), LUA_TLIGHTFUNCTION)
|
||||
#define ttisstring(o) checktype((o), LUA_TSTRING)
|
||||
#define ttisshrstring(o) checktag((o), ctb(LUA_TSHRSTR))
|
||||
#define ttislngstring(o) checktag((o), ctb(LUA_TLNGSTR))
|
||||
@@ -156,6 +158,8 @@ typedef union Value Value;
|
||||
#define nvalue(o) check_exp(ttisnumber(o), num_(o))
|
||||
#define gcvalue(o) check_exp(iscollectable(o), val_(o).gc)
|
||||
#define pvalue(o) check_exp(ttislightuserdata(o), val_(o).p)
|
||||
#define rvalue(o) check_exp(ttisrotable(o), val_(o).p)
|
||||
#define lfvalue(o) check_exp(ttislightfunction(o), val_(o).p)
|
||||
#define rawtsvalue(o) check_exp(ttisstring(o), &val_(o).gc->ts)
|
||||
#define tsvalue(o) (&rawtsvalue(o)->tsv)
|
||||
#define rawuvalue(o) check_exp(ttisuserdata(o), &val_(o).gc->u)
|
||||
@@ -163,7 +167,7 @@ typedef union Value Value;
|
||||
#define clvalue(o) check_exp(ttisclosure(o), &val_(o).gc->cl)
|
||||
#define clLvalue(o) check_exp(ttisLclosure(o), &val_(o).gc->cl.l)
|
||||
#define clCvalue(o) check_exp(ttisCclosure(o), &val_(o).gc->cl.c)
|
||||
#define fvalue(o) check_exp(ttislcf(o), val_(o).f)
|
||||
#define lcfvalue(o) check_exp(ttislcf(o), val_(o).f)
|
||||
#define hvalue(o) check_exp(ttistable(o), &val_(o).gc->h)
|
||||
#define bvalue(o) check_exp(ttisboolean(o), val_(o).b)
|
||||
#define thvalue(o) check_exp(ttisthread(o), &val_(o).gc->th)
|
||||
@@ -192,12 +196,18 @@ typedef union Value Value;
|
||||
|
||||
#define setnilvalue(obj) settt_(obj, LUA_TNIL)
|
||||
|
||||
#define setfvalue(obj,x) \
|
||||
#define setlcfvalue(obj,x) \
|
||||
{ TValue *io=(obj); val_(io).f=(x); settt_(io, LUA_TLCF); }
|
||||
|
||||
#define setpvalue(obj,x) \
|
||||
{ TValue *io=(obj); val_(io).p=(x); settt_(io, LUA_TLIGHTUSERDATA); }
|
||||
|
||||
#define setrvalue(obj,x) \
|
||||
{ TValue *io=(obj); val_(io).p=(x); settt_(io, LUA_TROTABLE); }
|
||||
|
||||
#define setlfvalue(obj,x) \
|
||||
{ TValue *io=(obj); val_(io).p=(x); settt_(io, LUA_TLIGHTFUNCTION); }
|
||||
|
||||
#define setbvalue(obj,x) \
|
||||
{ TValue *io=(obj); val_(io).b=(x); settt_(io, LUA_TBOOLEAN); }
|
||||
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/* Read-only tables for Lua */
|
||||
|
||||
#include <string.h>
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "lrotable.h"
|
||||
|
||||
/* Local defines */
|
||||
#define LUAR_FINDFUNCTION 0
|
||||
#define LUAR_FINDVALUE 1
|
||||
|
||||
/* Utility function: find a key in a given table (of functions or constants) */
|
||||
static luaR_result luaR_findkey(const void *where, const char *key, int type, int *found) {
|
||||
const char *pname;
|
||||
const luaL_Reg *pf = (luaL_Reg*)where;
|
||||
const luaR_value_entry *pv = (luaR_value_entry*)where;
|
||||
int isfunction = type == LUAR_FINDFUNCTION;
|
||||
*found = 0;
|
||||
if(!where)
|
||||
return 0;
|
||||
while(1) {
|
||||
if (!(pname = isfunction ? pf->name : pv->name))
|
||||
break;
|
||||
if (!strcmp(pname, key)) {
|
||||
*found = 1;
|
||||
return isfunction ? (luaR_result)(size_t)pf->func : (luaR_result)pv->value;
|
||||
}
|
||||
pf ++; pv ++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Find a global "read only table" in the constant lua_rotable array */
|
||||
luaR_result luaR_findglobal(const char *name, lu_byte *ptype) {
|
||||
unsigned i;
|
||||
*ptype = LUA_TNIL;
|
||||
if (strlen(name) > LUA_MAX_ROTABLE_NAME)
|
||||
return 0;
|
||||
for (i=0; lua_rotable[i].name; i++) {
|
||||
if (!strcmp(lua_rotable[i].name, name)) {
|
||||
*ptype = LUA_TROTABLE;
|
||||
return i+1;
|
||||
}
|
||||
if (!strncmp(lua_rotable[i].name, "__", 2)) {
|
||||
luaR_result result = luaR_findentry((void *)(size_t)(i+1), name, ptype);
|
||||
if (result != 0) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int luaR_findfunction(lua_State *L, const luaL_Reg *ptable) {
|
||||
int found;
|
||||
const char *key = luaL_checkstring(L, 2);
|
||||
luaR_result res = luaR_findkey(ptable, key, LUAR_FINDFUNCTION, &found);
|
||||
if (found)
|
||||
lua_pushlightfunction(L, (void*)(size_t)res);
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
luaR_result luaR_findentry(void *data, const char *key, lu_byte *ptype) {
|
||||
int found;
|
||||
unsigned idx = (unsigned)(size_t)data - 1;
|
||||
luaR_result res;
|
||||
*ptype = LUA_TNIL;
|
||||
/* First look at the functions */
|
||||
res = luaR_findkey(lua_rotable[idx].pfuncs, key, LUAR_FINDFUNCTION, &found);
|
||||
if (found) {
|
||||
*ptype = LUA_TLIGHTFUNCTION;
|
||||
return res;
|
||||
}
|
||||
else {
|
||||
/* Then at the values */
|
||||
res = luaR_findkey(lua_rotable[idx].pvalues, key, LUAR_FINDVALUE, &found);
|
||||
if(found) {
|
||||
*ptype = LUA_TNUMBER;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// Read-only tables for Lua
|
||||
|
||||
#ifndef lrotable_h
|
||||
#define lrotable_h
|
||||
|
||||
#include "lua.h"
|
||||
#include "llimits.h"
|
||||
#include "lauxlib.h"
|
||||
|
||||
typedef lua_Number luaR_result;
|
||||
|
||||
// A number entry in the read only table
|
||||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
lua_Number value;
|
||||
} luaR_value_entry;
|
||||
|
||||
extern const luaR_value_entry baselib_vals[];
|
||||
extern const luaR_value_entry mathlib_vals[];
|
||||
extern const luaR_value_entry opentxConstants[];
|
||||
|
||||
// A mapping between table name and its entries
|
||||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
const luaL_Reg *pfuncs;
|
||||
const luaR_value_entry *pvalues;
|
||||
} luaR_table;
|
||||
|
||||
extern const luaR_table lua_rotable[];
|
||||
|
||||
luaR_result luaR_findglobal(const char *key, lu_byte *ptype);
|
||||
int luaR_findfunction(lua_State *L, const luaL_Reg *ptable);
|
||||
luaR_result luaR_findentry(void *data, const char *key, lu_byte *ptype);
|
||||
|
||||
#endif
|
||||
@@ -113,7 +113,7 @@ static Node *mainposition (const Table *t, const TValue *key) {
|
||||
case LUA_TLIGHTUSERDATA:
|
||||
return hashpointer(t, pvalue(key));
|
||||
case LUA_TLCF:
|
||||
return hashpointer(t, fvalue(key));
|
||||
return hashpointer(t, lcfvalue(key));
|
||||
default:
|
||||
return hashpointer(t, gcvalue(key));
|
||||
}
|
||||
|
||||
@@ -23,12 +23,11 @@ static const char udatatypename[] = "userdata";
|
||||
|
||||
LUAI_DDEF const char *const luaT_typenames_[LUA_TOTALTAGS] = {
|
||||
"no value",
|
||||
"nil", "boolean", udatatypename, "number",
|
||||
"nil", "boolean", "rotable", "lightfunction", udatatypename, "number",
|
||||
"string", "table", "function", udatatypename, "thread",
|
||||
"proto", "upval" /* these last two cases are used for tests only */
|
||||
};
|
||||
|
||||
|
||||
void luaT_init (lua_State *L) {
|
||||
static const char *const luaT_eventname[] = { /* ORDER TM */
|
||||
"__index", "__newindex",
|
||||
|
||||
+12
-8
@@ -77,15 +77,17 @@ typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
|
||||
|
||||
#define LUA_TNIL 0
|
||||
#define LUA_TBOOLEAN 1
|
||||
#define LUA_TLIGHTUSERDATA 2
|
||||
#define LUA_TNUMBER 3
|
||||
#define LUA_TSTRING 4
|
||||
#define LUA_TTABLE 5
|
||||
#define LUA_TFUNCTION 6
|
||||
#define LUA_TUSERDATA 7
|
||||
#define LUA_TTHREAD 8
|
||||
#define LUA_TROTABLE 2
|
||||
#define LUA_TLIGHTFUNCTION 3
|
||||
#define LUA_TLIGHTUSERDATA 4
|
||||
#define LUA_TNUMBER 5
|
||||
#define LUA_TSTRING 6
|
||||
#define LUA_TTABLE 7
|
||||
#define LUA_TFUNCTION 8
|
||||
#define LUA_TUSERDATA 9
|
||||
#define LUA_TTHREAD 10
|
||||
|
||||
#define LUA_NUMTAGS 9
|
||||
#define LUA_NUMTAGS 11
|
||||
|
||||
|
||||
|
||||
@@ -214,6 +216,8 @@ LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...);
|
||||
LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
|
||||
LUA_API void (lua_pushboolean) (lua_State *L, int b);
|
||||
LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p);
|
||||
LUA_API void (lua_pushlightfunction) (lua_State *L, void *p);
|
||||
LUA_API void (lua_pushrotable) (lua_State *L, void *p);
|
||||
LUA_API int (lua_pushthread) (lua_State *L);
|
||||
|
||||
|
||||
|
||||
@@ -558,7 +558,7 @@
|
||||
** without modifying the main part of the file.
|
||||
*/
|
||||
|
||||
|
||||
#define LUA_MAX_ROTABLE_NAME 20
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+149
-51
@@ -25,7 +25,7 @@
|
||||
#include "ltable.h"
|
||||
#include "ltm.h"
|
||||
#include "lvm.h"
|
||||
|
||||
#include "lrotable.h"
|
||||
|
||||
|
||||
/* limit for table tag-method chains (to avoid loops) */
|
||||
@@ -106,9 +106,31 @@ static void callTM (lua_State *L, const TValue *f, const TValue *p1,
|
||||
}
|
||||
}
|
||||
|
||||
static void lua_getcstr(char *dest, const TString *src, size_t maxsize) {
|
||||
if (src->tsv.len+1 > maxsize)
|
||||
dest[0] = '\0';
|
||||
else {
|
||||
memcpy(dest, getstr(src), src->tsv.len);
|
||||
dest[src->tsv.len] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) {
|
||||
int loop;
|
||||
if (ttisrotable(t)) {
|
||||
setnilvalue(val);
|
||||
if (ttisstring(key)) {
|
||||
char keyname[LUA_MAX_ROTABLE_NAME + 1];
|
||||
lu_byte keytype;
|
||||
lua_getcstr(keyname, rawtsvalue(key), LUA_MAX_ROTABLE_NAME);
|
||||
luaR_result res = luaR_findentry(rvalue(t), keyname, &keytype);
|
||||
if (keytype == LUA_TLIGHTFUNCTION)
|
||||
setlfvalue(val, (void*)(size_t)res)
|
||||
else if (keytype == LUA_TNUMBER)
|
||||
setnvalue(val, (lua_Number)res)
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (loop = 0; loop < MAXTAGLOOP; loop++) {
|
||||
const TValue *tm;
|
||||
if (ttistable(t)) { /* `t' is a table? */
|
||||
@@ -123,7 +145,7 @@ void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) {
|
||||
}
|
||||
else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX)))
|
||||
luaG_typeerror(L, t, "index");
|
||||
if (ttisfunction(tm)) {
|
||||
if (ttisfunction(tm) || ttislightfunction(tm)) {
|
||||
callTM(L, tm, t, key, val, 1);
|
||||
return;
|
||||
}
|
||||
@@ -264,8 +286,11 @@ int luaV_equalobj_ (lua_State *L, const TValue *t1, const TValue *t2) {
|
||||
case LUA_TNIL: return 1;
|
||||
case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2));
|
||||
case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */
|
||||
case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2);
|
||||
case LUA_TLCF: return fvalue(t1) == fvalue(t2);
|
||||
case LUA_TLIGHTUSERDATA:
|
||||
case LUA_TROTABLE:
|
||||
case LUA_TLIGHTFUNCTION:
|
||||
return pvalue(t1) == pvalue(t2);
|
||||
case LUA_TLCF: return lcfvalue(t1) == lcfvalue(t2);
|
||||
case LUA_TSHRSTR: return eqshrstr(rawtsvalue(t1), rawtsvalue(t2));
|
||||
case LUA_TLNGSTR: return luaS_eqlngstr(rawtsvalue(t1), rawtsvalue(t2));
|
||||
case LUA_TUSERDATA: {
|
||||
@@ -554,53 +579,97 @@ void luaV_execute (lua_State *L) {
|
||||
lua_assert(base == ci->u.l.base);
|
||||
lua_assert(base <= L->top && L->top < L->stack + L->stacksize);
|
||||
vmdispatch (GET_OPCODE(i)) {
|
||||
vmcase(OP_MOVE,
|
||||
case OP_MOVE:
|
||||
setobjs2s(L, ra, RB(i));
|
||||
)
|
||||
vmcase(OP_LOADK,
|
||||
break;
|
||||
|
||||
case OP_LOADK:
|
||||
{
|
||||
TValue *rb = k + GETARG_Bx(i);
|
||||
setobj2s(L, ra, rb);
|
||||
)
|
||||
vmcase(OP_LOADKX,
|
||||
}
|
||||
break;
|
||||
|
||||
case OP_LOADKX:
|
||||
{
|
||||
TValue *rb;
|
||||
lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG);
|
||||
rb = k + GETARG_Ax(*ci->u.l.savedpc++);
|
||||
setobj2s(L, ra, rb);
|
||||
)
|
||||
vmcase(OP_LOADBOOL,
|
||||
}
|
||||
break;
|
||||
|
||||
case OP_LOADBOOL:
|
||||
setbvalue(ra, GETARG_B(i));
|
||||
if (GETARG_C(i)) ci->u.l.savedpc++; /* skip next instruction (if C) */
|
||||
)
|
||||
vmcase(OP_LOADNIL,
|
||||
break;
|
||||
|
||||
case OP_LOADNIL:
|
||||
{
|
||||
int b = GETARG_B(i);
|
||||
do {
|
||||
setnilvalue(ra++);
|
||||
} while (b--);
|
||||
)
|
||||
vmcase(OP_GETUPVAL,
|
||||
}
|
||||
break;
|
||||
|
||||
case OP_GETUPVAL:
|
||||
{
|
||||
int b = GETARG_B(i);
|
||||
setobj2s(L, ra, cl->upvals[b]->v);
|
||||
)
|
||||
vmcase(OP_GETTABUP,
|
||||
}
|
||||
break;
|
||||
|
||||
case OP_GETTABUP:
|
||||
{
|
||||
int b = GETARG_B(i);
|
||||
Protect(luaV_gettable(L, cl->upvals[b]->v, RKC(i), ra));
|
||||
)
|
||||
vmcase(OP_GETTABLE,
|
||||
if (ttisstring(RKC(i))) {
|
||||
char keyname[LUA_MAX_ROTABLE_NAME + 1];
|
||||
lu_byte keytype;
|
||||
lua_getcstr(keyname, rawtsvalue(RKC(i)), LUA_MAX_ROTABLE_NAME);
|
||||
luaR_result res = luaR_findglobal(keyname, &keytype);
|
||||
if (keytype == LUA_TROTABLE) {
|
||||
setrvalue(ra, (void*)(size_t)res)
|
||||
}
|
||||
else if (keytype == LUA_TLIGHTFUNCTION)
|
||||
setlfvalue(ra, (void*)(size_t)res)
|
||||
else if (keytype == LUA_TNUMBER)
|
||||
setnvalue(ra, (lua_Number)res)
|
||||
else
|
||||
Protect(luaV_gettable(L, cl->upvals[b]->v, RKC(i), ra));
|
||||
}
|
||||
else {
|
||||
Protect(luaV_gettable(L, cl->upvals[b]->v, RKC(i), ra));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case OP_GETTABLE:
|
||||
/* First try to look for a rotable with this name */
|
||||
Protect(luaV_gettable(L, RB(i), RKC(i), ra));
|
||||
)
|
||||
vmcase(OP_SETTABUP,
|
||||
break;
|
||||
|
||||
case OP_SETTABUP:
|
||||
{
|
||||
int a = GETARG_A(i);
|
||||
Protect(luaV_settable(L, cl->upvals[a]->v, RKB(i), RKC(i)));
|
||||
)
|
||||
vmcase(OP_SETUPVAL,
|
||||
}
|
||||
break;
|
||||
|
||||
case OP_SETUPVAL:
|
||||
{
|
||||
UpVal *uv = cl->upvals[GETARG_B(i)];
|
||||
setobj(L, uv->v, ra);
|
||||
luaC_barrier(L, uv, ra);
|
||||
)
|
||||
vmcase(OP_SETTABLE,
|
||||
}
|
||||
break;
|
||||
|
||||
case OP_SETTABLE:
|
||||
Protect(luaV_settable(L, ra, RKB(i), RKC(i)));
|
||||
)
|
||||
vmcase(OP_NEWTABLE,
|
||||
break;
|
||||
|
||||
case OP_NEWTABLE:
|
||||
{
|
||||
int b = GETARG_B(i);
|
||||
int c = GETARG_C(i);
|
||||
Table *t = luaH_new(L);
|
||||
@@ -608,31 +677,43 @@ void luaV_execute (lua_State *L) {
|
||||
if (b != 0 || c != 0)
|
||||
luaH_resize(L, t, luaO_fb2int(b), luaO_fb2int(c));
|
||||
checkGC(L, ra + 1);
|
||||
)
|
||||
vmcase(OP_SELF,
|
||||
}
|
||||
break;
|
||||
|
||||
case OP_SELF:
|
||||
{
|
||||
StkId rb = RB(i);
|
||||
setobjs2s(L, ra+1, rb);
|
||||
Protect(luaV_gettable(L, rb, RKC(i), ra));
|
||||
)
|
||||
vmcase(OP_ADD,
|
||||
}
|
||||
break;
|
||||
|
||||
case OP_ADD:
|
||||
arith_op(luai_numadd, TM_ADD);
|
||||
)
|
||||
vmcase(OP_SUB,
|
||||
break;
|
||||
|
||||
case OP_SUB:
|
||||
arith_op(luai_numsub, TM_SUB);
|
||||
)
|
||||
vmcase(OP_MUL,
|
||||
break;
|
||||
|
||||
case OP_MUL:
|
||||
arith_op(luai_nummul, TM_MUL);
|
||||
)
|
||||
vmcase(OP_DIV,
|
||||
break;
|
||||
|
||||
case OP_DIV:
|
||||
arith_op(luai_numdiv, TM_DIV);
|
||||
)
|
||||
vmcase(OP_MOD,
|
||||
break;
|
||||
|
||||
case OP_MOD:
|
||||
arith_op(luai_nummod, TM_MOD);
|
||||
)
|
||||
vmcase(OP_POW,
|
||||
break;
|
||||
|
||||
case OP_POW:
|
||||
arith_op(luai_numpow, TM_POW);
|
||||
)
|
||||
vmcase(OP_UNM,
|
||||
break;
|
||||
|
||||
case OP_UNM:
|
||||
{
|
||||
TValue *rb = RB(i);
|
||||
if (ttisnumber(rb)) {
|
||||
lua_Number nb = nvalue(rb);
|
||||
@@ -641,15 +722,19 @@ void luaV_execute (lua_State *L) {
|
||||
else {
|
||||
Protect(luaV_arith(L, ra, rb, rb, TM_UNM));
|
||||
}
|
||||
)
|
||||
}
|
||||
break;
|
||||
|
||||
vmcase(OP_NOT,
|
||||
TValue *rb = RB(i);
|
||||
int res = l_isfalse(rb); /* next assignment may change this value */
|
||||
setbvalue(ra, res);
|
||||
)
|
||||
|
||||
vmcase(OP_LEN,
|
||||
Protect(luaV_objlen(L, ra, RB(i)));
|
||||
)
|
||||
|
||||
vmcase(OP_CONCAT,
|
||||
int b = GETARG_B(i);
|
||||
int c = GETARG_C(i);
|
||||
@@ -662,9 +747,11 @@ void luaV_execute (lua_State *L) {
|
||||
checkGC(L, (ra >= rb ? ra + 1 : rb));
|
||||
L->top = ci->top; /* restore top */
|
||||
)
|
||||
|
||||
vmcase(OP_JMP,
|
||||
dojump(ci, i, 0);
|
||||
)
|
||||
|
||||
vmcase(OP_EQ,
|
||||
TValue *rb = RKB(i);
|
||||
TValue *rc = RKC(i);
|
||||
@@ -675,6 +762,7 @@ void luaV_execute (lua_State *L) {
|
||||
donextjump(ci);
|
||||
)
|
||||
)
|
||||
|
||||
vmcase(OP_LT,
|
||||
Protect(
|
||||
if (luaV_lessthan(L, RKB(i), RKC(i)) != GETARG_A(i))
|
||||
@@ -706,7 +794,9 @@ void luaV_execute (lua_State *L) {
|
||||
donextjump(ci);
|
||||
}
|
||||
)
|
||||
vmcase(OP_CALL,
|
||||
|
||||
case OP_CALL:
|
||||
{
|
||||
int b = GETARG_B(i);
|
||||
int nresults = GETARG_C(i) - 1;
|
||||
if (b != 0) L->top = ra+b; /* else previous instruction set top */
|
||||
@@ -719,8 +809,11 @@ void luaV_execute (lua_State *L) {
|
||||
ci->callstatus |= CIST_REENTRY;
|
||||
goto newframe; /* restart luaV_execute over new Lua function */
|
||||
}
|
||||
)
|
||||
vmcase(OP_TAILCALL,
|
||||
}
|
||||
break;
|
||||
|
||||
case OP_TAILCALL:
|
||||
{
|
||||
int b = GETARG_B(i);
|
||||
if (b != 0) L->top = ra+b; /* else previous instruction set top */
|
||||
lua_assert(GETARG_C(i) - 1 == LUA_MULTRET);
|
||||
@@ -748,7 +841,8 @@ void luaV_execute (lua_State *L) {
|
||||
lua_assert(L->top == oci->u.l.base + getproto(ofunc)->maxstacksize);
|
||||
goto newframe; /* restart luaV_execute over new Lua function */
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
vmcasenb(OP_RETURN,
|
||||
int b = GETARG_B(i);
|
||||
if (b != 0) L->top = ra+b-1;
|
||||
@@ -764,7 +858,9 @@ void luaV_execute (lua_State *L) {
|
||||
goto newframe; /* restart luaV_execute over new Lua function */
|
||||
}
|
||||
)
|
||||
vmcase(OP_FORLOOP,
|
||||
|
||||
case OP_FORLOOP:
|
||||
{
|
||||
lua_Number step = nvalue(ra+2);
|
||||
lua_Number idx = luai_numadd(L, nvalue(ra), step); /* increment index */
|
||||
lua_Number limit = nvalue(ra+1);
|
||||
@@ -774,7 +870,9 @@ void luaV_execute (lua_State *L) {
|
||||
setnvalue(ra, idx); /* update internal index... */
|
||||
setnvalue(ra+3, idx); /* ...and external index */
|
||||
}
|
||||
)
|
||||
}
|
||||
break;
|
||||
|
||||
vmcase(OP_FORPREP,
|
||||
const TValue *init = ra;
|
||||
const TValue *plimit = ra+1;
|
||||
|
||||
+19
-4
@@ -106,8 +106,9 @@ void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS)
|
||||
else {
|
||||
v = getValue(ed->srcRaw);
|
||||
if (ed->srcRaw >= MIXSRC_FIRST_TELEM && ed->scale > 0) {
|
||||
v = limit(-1024, int((v * 1024) / convertTelemValue(ed->srcRaw-MIXSRC_FIRST_TELEM+1, ed->scale)), 1024);
|
||||
v = (v * 1024) / convertTelemValue(ed->srcRaw-MIXSRC_FIRST_TELEM+1, ed->scale);
|
||||
}
|
||||
v = limit(-1024, v, 1024);
|
||||
}
|
||||
#else
|
||||
int16_t v = anas2[ed->chn];
|
||||
@@ -251,8 +252,10 @@ int16_t applyLimits(uint8_t channel, int32_t value)
|
||||
if (lim->revert) ofs = -ofs; // finally do the reverse.
|
||||
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
if (safetyCh[channel] != -128) // if safety channel available for channel check
|
||||
if (safetyCh[channel] != OVERRIDE_CHANNEL_UNDEFINED) {
|
||||
// safety channel available for channel check
|
||||
ofs = calc100toRESX(safetyCh[channel]);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ofs;
|
||||
@@ -374,7 +377,7 @@ getvalue_t getValue(uint8_t i)
|
||||
else if (i<=MIXSRC_FIRST_TELEM-1+TELEM_MIN_A1) return frskyData.analog[TELEM_ANA_A1].min;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_MIN_A2) return frskyData.analog[TELEM_ANA_A2].min;
|
||||
#if defined(CPUARM)
|
||||
else if (i<=MIXSRC_FIRST_TELEM-1+TELEM_MIN_A3) return frskyData.analog[TELEM_ANA_A3].min;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_MIN_A3) return frskyData.analog[TELEM_ANA_A3].min;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_MIN_A4) return frskyData.analog[TELEM_ANA_A4].min;
|
||||
#endif
|
||||
else if (i<=MIXSRC_FIRST_TELEM-1+TELEM_CSW_MAX) return *(((int16_t*)(&frskyData.hub.minAltitude))+i-(MIXSRC_FIRST_TELEM-1+TELEM_MIN_ALT));
|
||||
@@ -646,10 +649,22 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
||||
bool mixCondition = (md->flightModes != 0 || md->swtch);
|
||||
delayval_t mixEnabled = (!(md->flightModes & (1 << mixerCurrentFlightMode)) && getSwitch(md->swtch)) ? DELAY_POS_MARGIN+1 : 0;
|
||||
|
||||
#define MIXER_LINE_DISABLE() (mixCondition = true, mixEnabled = 0)
|
||||
|
||||
if (mixEnabled && md->srcRaw >= MIXSRC_FIRST_TRAINER && md->srcRaw <= MIXSRC_LAST_TRAINER && !ppmInValid) {
|
||||
mixEnabled = 0;
|
||||
MIXER_LINE_DISABLE();
|
||||
}
|
||||
|
||||
#if defined(PCBTARANIS) && defined(LUA_MODEL_SCRIPTS)
|
||||
// disable mixer if Lua script is used as source and script was killed
|
||||
if (mixEnabled && md->srcRaw >= MIXSRC_FIRST_LUA && md->srcRaw <= MIXSRC_LAST_LUA) {
|
||||
div_t qr = div(md->srcRaw-MIXSRC_FIRST_LUA, MAX_SCRIPT_OUTPUTS);
|
||||
if (scriptInternalData[qr.quot].state != SCRIPT_OK) {
|
||||
MIXER_LINE_DISABLE();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//========== VALUE ===============
|
||||
getvalue_t v = 0;
|
||||
if (mode > e_perout_mode_inactive_flight_mode) {
|
||||
|
||||
@@ -165,7 +165,7 @@
|
||||
CURVE_TYPE_CUSTOM,
|
||||
CURVE_TYPE_LAST = CURVE_TYPE_CUSTOM
|
||||
};
|
||||
PACK(typedef struct t_CurveInfo {
|
||||
PACK(typedef struct {
|
||||
uint8_t type:3;
|
||||
uint8_t smooth:1;
|
||||
uint8_t spare:4;
|
||||
@@ -473,7 +473,7 @@ enum CurveRefType {
|
||||
CURVE_REF_FUNC,
|
||||
CURVE_REF_CUSTOM
|
||||
};
|
||||
PACK(typedef struct t_CurveRef {
|
||||
PACK(typedef struct {
|
||||
uint8_t type;
|
||||
int8_t value;
|
||||
}) CurveRef;
|
||||
|
||||
+60
-9
@@ -148,7 +148,7 @@ uint8_t heartbeat;
|
||||
uint8_t stickMode;
|
||||
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
int8_t safetyCh[NUM_CHNOUT];
|
||||
safetych_t safetyCh[NUM_CHNOUT];
|
||||
#endif
|
||||
|
||||
union ReusableBuffer reusableBuffer;
|
||||
@@ -362,7 +362,11 @@ void defaultInputs()
|
||||
expo->weight = 100;
|
||||
expo->mode = 3; // TODO constant
|
||||
for (int c=0; c<4; c++) {
|
||||
#if defined(TRANSLATIONS_CZ) && defined(CPUARM)
|
||||
g_model.inputNames[i][c] = char2idx(STR_INPUTNAMES[1+STR_INPUTNAMES[0]*(stick_index-1)+c]);
|
||||
#else
|
||||
g_model.inputNames[i][c] = char2idx(STR_VSRCRAW[1+STR_VSRCRAW[0]*stick_index+c]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
eeDirty(EE_MODEL);
|
||||
@@ -387,7 +391,11 @@ void applyDefaultTemplate()
|
||||
expo->weight = 100;
|
||||
expo->mode = 3; // TODO constant
|
||||
for (int c=0; c<4; c++) {
|
||||
#if defined(TRANSLATIONS_CZ) && defined(CPUARM)
|
||||
g_model.inputNames[i][c] = char2idx(STR_INPUTNAMES[1+STR_INPUTNAMES[0]*(stick_index-1)+c]);
|
||||
#else
|
||||
g_model.inputNames[i][c] = char2idx(STR_VSRCRAW[1+STR_VSRCRAW[0]*stick_index+c]);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -441,6 +449,10 @@ void modelDefault(uint8_t id)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM) && !defined(PCBTARANIS)
|
||||
g_model.externalModule = MODULE_TYPE_PPM;
|
||||
#endif
|
||||
|
||||
#if defined(PXX) && defined(CPUARM)
|
||||
modelHeaders[id].modelId = g_model.header.modelId = id+1;
|
||||
checkModelIdUnique(id);
|
||||
@@ -463,6 +475,23 @@ void modelDefault(uint8_t id)
|
||||
g_model.mavlink.pc_rssi_en = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
bool isInputRecursive(int index)
|
||||
{
|
||||
ExpoData * line = expoAddress(0);
|
||||
for (int i=0; i<MAX_EXPOS; i++, line++) {
|
||||
if (line->chn > index)
|
||||
break;
|
||||
else if (line->chn < index)
|
||||
continue;
|
||||
else if (line->srcRaw >= MIXSRC_FIRST_LOGICAL_SWITCH)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(AUTOSOURCE)
|
||||
int8_t getMovedSource(GET_MOVED_SOURCE_PARAMS)
|
||||
{
|
||||
@@ -474,8 +503,10 @@ int8_t getMovedSource(GET_MOVED_SOURCE_PARAMS)
|
||||
if (min <= MIXSRC_FIRST_INPUT) {
|
||||
for (uint8_t i=0; i<MAX_INPUTS; i++) {
|
||||
if (abs(anas[i] - inputsStates[i]) > 512) {
|
||||
result = MIXSRC_FIRST_INPUT+i;
|
||||
break;
|
||||
if (!isInputRecursive(i)) {
|
||||
result = MIXSRC_FIRST_INPUT+i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1881,7 +1912,7 @@ void evalFunctions()
|
||||
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
for (uint8_t i=0; i<NUM_CHNOUT; i++) {
|
||||
safetyCh[i] = -128; // not defined
|
||||
safetyCh[i] = OVERRIDE_CHANNEL_UNDEFINED;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2121,8 +2152,15 @@ void evalFunctions()
|
||||
|
||||
#if defined(HAPTIC) && !defined(CPUARM)
|
||||
case FUNC_HAPTIC:
|
||||
haptic.event(AU_FRSKY_LAST+CFN_PARAM(sd));
|
||||
{
|
||||
tmr10ms_t tmr10ms = get_tmr10ms();
|
||||
uint8_t repeatParam = CFN_PLAY_REPEAT(sd);
|
||||
if (!lastFunctionTime[i] || (repeatParam && (signed)(tmr10ms-lastFunctionTime[i])>=1000*repeatParam)) {
|
||||
lastFunctionTime[i] = tmr10ms;
|
||||
haptic.event(AU_FRSKY_LAST+CFN_PARAM(sd));
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD)
|
||||
@@ -2486,6 +2524,10 @@ void opentxStart()
|
||||
{
|
||||
doSplash();
|
||||
|
||||
#if defined(DEBUG_TRACE_BUFFER)
|
||||
trace_event(trace_start, 0x12345678);
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X) && defined(SDCARD) && !defined(SIMU)
|
||||
for (int i=0; i<500 && !Card_initialized; i++) {
|
||||
CoTickDelay(1); // 2ms
|
||||
@@ -2511,6 +2553,10 @@ void opentxClose()
|
||||
// TODO needed? telemetryEnd();
|
||||
#endif
|
||||
|
||||
#if defined(LUA)
|
||||
luaClose();
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD)
|
||||
closeLogs();
|
||||
sdDone();
|
||||
@@ -3300,6 +3346,13 @@ uint16_t stack_free(uint8_t tid)
|
||||
stack = audioStack;
|
||||
size = AUDIO_STACK_SIZE;
|
||||
break;
|
||||
#if 0 // defined(PCBTARANIS)
|
||||
case 255:
|
||||
// main stack
|
||||
stack = (OS_STK *)&_main_stack_start;
|
||||
size = ((unsigned char *)&_estack - (unsigned char *)&_main_stack_start) / 4;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@@ -3388,12 +3441,10 @@ inline void opentxInit(OPENTX_INIT_ARGS)
|
||||
btInit();
|
||||
#endif
|
||||
|
||||
#if defined(RTCLOCK)
|
||||
#if defined(RTCLOCK) && !defined(COPROCESSOR)
|
||||
rtcInit();
|
||||
#endif
|
||||
|
||||
LUA_INIT();
|
||||
|
||||
if (g_eeGeneral.backlightMode != e_backlight_mode_off) backlightOn(); // on Tx start turn the light on
|
||||
|
||||
if (UNEXPECTED_SHUTDOWN()) {
|
||||
@@ -3420,7 +3471,7 @@ inline void opentxInit(OPENTX_INIT_ARGS)
|
||||
backlightOn();
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
uart3Init(g_eeGeneral.uart3Mode, MODEL_TELEMETRY_PROTOCOL);
|
||||
uart3Init(g_eeGeneral.uart3Mode, MODEL_TELEMETRY_PROTOCOL());
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
|
||||
+40
-15
@@ -433,9 +433,10 @@ enum PotType {
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define BITMAP_BUFFER_SIZE(width, height) (2 + width * ((height+7)/8)*4)
|
||||
#define MODEL_BITMAP_WIDTH 64
|
||||
#define MODEL_BITMAP_HEIGHT 32
|
||||
#define MODEL_BITMAP_SIZE (2+4*(MODEL_BITMAP_WIDTH*MODEL_BITMAP_HEIGHT/8))
|
||||
#define MODEL_BITMAP_SIZE BITMAP_BUFFER_SIZE(MODEL_BITMAP_WIDTH, MODEL_BITMAP_HEIGHT)
|
||||
extern uint8_t modelBitmap[MODEL_BITMAP_SIZE];
|
||||
void loadModelBitmap(char *name, uint8_t *bitmap);
|
||||
#define LOAD_MODEL_BITMAP() loadModelBitmap(g_model.header.bitmap, modelBitmap)
|
||||
@@ -621,7 +622,12 @@ extern uint8_t pxxFlag[NUM_MODULES];
|
||||
#define PXX_SEND_RANGECHECK (1 << 5)
|
||||
|
||||
#define LEN_STD_CHARS 40
|
||||
|
||||
#if defined(TRANSLATIONS_CZ)
|
||||
#define ZCHAR_MAX (LEN_STD_CHARS)
|
||||
#else
|
||||
#define ZCHAR_MAX (LEN_STD_CHARS + LEN_SPECIAL_CHARS)
|
||||
#endif
|
||||
|
||||
char idx2char(int8_t idx);
|
||||
#if defined(CPUARM) || defined(SIMU)
|
||||
@@ -693,7 +699,8 @@ extern uint8_t flightModeTransitionLast;
|
||||
#if defined(CPUARM) && !defined(SIMU)
|
||||
extern unsigned char *heap;
|
||||
extern int _end;
|
||||
extern unsigned char *_estack;
|
||||
extern int _estack;
|
||||
extern int _main_stack_start;
|
||||
#define getAvailableMemory() ((unsigned int)((unsigned char *)&_estack - heap))
|
||||
#endif
|
||||
|
||||
@@ -851,7 +858,14 @@ struct TimerState {
|
||||
extern TimerState timersStates[MAX_TIMERS];
|
||||
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
extern int8_t safetyCh[NUM_CHNOUT];
|
||||
#if defined(CPUARM)
|
||||
typedef int16_t safetych_t;
|
||||
#define OVERRIDE_CHANNEL_UNDEFINED -4096
|
||||
#else
|
||||
typedef int8_t safetych_t;
|
||||
#define OVERRIDE_CHANNEL_UNDEFINED -128
|
||||
#endif
|
||||
extern safetych_t safetyCh[NUM_CHNOUT];
|
||||
#endif
|
||||
|
||||
extern uint8_t trimsCheckTimer;
|
||||
@@ -1465,13 +1479,14 @@ enum AUDIO_SOUNDS {
|
||||
SCRIPT_OK,
|
||||
SCRIPT_NOFILE,
|
||||
SCRIPT_SYNTAX_ERROR,
|
||||
SCRIPT_PANIC,
|
||||
SCRIPT_KILLED
|
||||
};
|
||||
enum ScriptReference {
|
||||
SCRIPT_MIX_FIRST,
|
||||
SCRIPT_MIX_LAST=SCRIPT_MIX_FIRST+MAX_SCRIPTS-1,
|
||||
SCRIPT_FUNC_FIRST,
|
||||
SCRIPT_FUNC_LAST=SCRIPT_FUNC_FIRST+MAX_SCRIPTS-1,
|
||||
SCRIPT_FUNC_LAST=SCRIPT_FUNC_FIRST+NUM_CFN-1,
|
||||
SCRIPT_TELEMETRY_FIRST,
|
||||
SCRIPT_TELEMETRY_LAST=SCRIPT_TELEMETRY_FIRST+MAX_SCRIPTS, // telem0 and telem1 .. telem7
|
||||
};
|
||||
@@ -1488,28 +1503,38 @@ enum AUDIO_SOUNDS {
|
||||
uint8_t outputsCount;
|
||||
ScriptOutput outputs[MAX_SCRIPT_OUTPUTS];
|
||||
};
|
||||
#define LUASTATE_STANDALONE_SCRIPT_RUNNING 1
|
||||
#define LUASTATE_RELOAD_MODEL_SCRIPTS 2
|
||||
#define INTERPRETER_RUNNING_STANDALONE_SCRIPT 1
|
||||
#define INTERPRETER_RELOAD_PERMANENT_SCRIPTS 2
|
||||
#define INTERPRETER_PANIC 255
|
||||
extern uint8_t luaState;
|
||||
extern uint8_t luaScriptsCount;
|
||||
extern ScriptInternalData standaloneScript;
|
||||
extern ScriptInternalData scriptInternalData[MAX_SCRIPTS];
|
||||
extern ScriptInputsOutputs scriptInputsOutputs[MAX_SCRIPTS];
|
||||
void luaClose();
|
||||
void luaInit();
|
||||
void luaTask(uint8_t evt);
|
||||
void luaExec(const char *filename);
|
||||
void luaLoadMixScript(uint8_t index);
|
||||
void luaLoadMixScripts();
|
||||
int luaGetMemUsed();
|
||||
#define luaGetCpuUsed(idx) scriptInternalData[idx].instructions
|
||||
bool isTelemetryScriptAvailable(uint8_t index);
|
||||
#define LUA_INIT()
|
||||
#define LUA_RESET() luaInit()
|
||||
#define LUA_LOAD_MODEL_SCRIPTS() luaState |= LUASTATE_RELOAD_MODEL_SCRIPTS
|
||||
#define LUA_LOAD_MODEL_SCRIPT(idx) luaState |= LUASTATE_RELOAD_MODEL_SCRIPTS
|
||||
uint8_t isTelemetryScriptAvailable(uint8_t index);
|
||||
#define LUA_LOAD_MODEL_SCRIPTS() luaState |= INTERPRETER_RELOAD_PERMANENT_SCRIPTS
|
||||
#define LUA_LOAD_MODEL_SCRIPT(idx) luaState |= INTERPRETER_RELOAD_PERMANENT_SCRIPTS
|
||||
|
||||
// Lua PROTECT/UNPROTECT
|
||||
#include <setjmp.h>
|
||||
struct our_longjmp {
|
||||
struct our_longjmp *previous;
|
||||
jmp_buf b;
|
||||
volatile int status; /* error code */
|
||||
};
|
||||
extern struct our_longjmp * global_lj;
|
||||
#define PROTECT_LUA() { struct our_longjmp lj; \
|
||||
lj.previous = global_lj; /* chain new error handler */ \
|
||||
global_lj = &lj; \
|
||||
if (setjmp(lj.b) == 0)
|
||||
#define UNPROTECT_LUA() global_lj = lj.previous; } /* restore old error handler */
|
||||
#else
|
||||
#define LUA_INIT()
|
||||
#define LUA_RESET()
|
||||
#define LUA_LOAD_MODEL_SCRIPTS()
|
||||
#define LUA_LOAD_MODEL_SCRIPT(idx)
|
||||
#endif
|
||||
|
||||
@@ -308,9 +308,10 @@ void putPcmHead()
|
||||
putPcmPart( 0xC0 ) ;
|
||||
}
|
||||
|
||||
uint16_t scaleForPXX(uint8_t i)
|
||||
uint16_t scaleForPXX( uint8_t i )
|
||||
{
|
||||
return channelOutputs[i] * 3 / 4 + 2250 ;
|
||||
int16_t value = ( ( i < 16 ) ? channelOutputs[i] * 3 / 4 : 0 ) + 1024;
|
||||
return limit<uint16_t>(1, value, 2046);
|
||||
}
|
||||
|
||||
void setupPulsesPXX()
|
||||
|
||||
@@ -107,9 +107,6 @@ verify (twos_complement_arithmetic, TYPE_TWOS_COMPLEMENT (int));
|
||||
#define TM_YEAR_BASE 1900
|
||||
verify (base_year_is_a_multiple_of_100, TM_YEAR_BASE % 100 == 0);
|
||||
|
||||
#define SECS_PER_HOUR 3600ul
|
||||
#define SECS_PER_DAY 86400ul
|
||||
|
||||
/* Return 1 if YEAR + TM_YEAR_BASE is a leap year. */
|
||||
static inline int
|
||||
leapyear (long int year)
|
||||
|
||||
@@ -39,6 +39,9 @@
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#define SECS_PER_HOUR 3600ul
|
||||
#define SECS_PER_DAY 86400ul
|
||||
|
||||
typedef long int gtime_t;
|
||||
|
||||
struct gtm
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
source [find interface/stlink-v2.cfg]
|
||||
source [find target/stm32f2x_stlink.cfg]
|
||||
reset_config srst_only srst_nogate
|
||||
@@ -49,7 +49,7 @@ char idx2char(int8_t idx)
|
||||
if (idx < 37) return '0' + idx - 27;
|
||||
if (idx <= 40) return pgm_read_byte(s_charTab+idx-37);
|
||||
#if LEN_SPECIAL_CHARS > 0
|
||||
if (idx <= ZCHAR_MAX) return 'z' + 5 + idx - 40;
|
||||
if (idx <= (LEN_STD_CHARS + LEN_SPECIAL_CHARS)) return 'z' + 5 + idx - 40;
|
||||
#endif
|
||||
return ' ';
|
||||
}
|
||||
@@ -151,6 +151,18 @@ char * strAppend(char * dest, const char * source)
|
||||
return dest - 1;
|
||||
}
|
||||
|
||||
char * strAppendFilename(char * dest, const char * filename, const int size)
|
||||
{
|
||||
memset(dest, 0, size);
|
||||
for (int i=0; i<size; i++) {
|
||||
char c = *filename++;
|
||||
if (c == '\0' || c == '.')
|
||||
break;
|
||||
*dest++ = c;
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
#if defined(RTCLOCK)
|
||||
#include "rtc.h"
|
||||
|
||||
|
||||
+19
-12
@@ -191,6 +191,16 @@ getvalue_t getValueForLogicalSwitch(uint8_t i)
|
||||
#define getValueForLogicalSwitch(i) getValue(i)
|
||||
#endif
|
||||
|
||||
PACK(typedef struct {
|
||||
uint8_t state;
|
||||
uint8_t last;
|
||||
}) ls_sticky_struct;
|
||||
|
||||
PACK(typedef struct {
|
||||
uint16_t state:1;
|
||||
uint16_t duration:15;
|
||||
}) ls_stay_struct;
|
||||
|
||||
bool getLogicalSwitch(uint8_t idx)
|
||||
{
|
||||
LogicalSwitchData * ls = lswAddress(idx);
|
||||
@@ -206,7 +216,9 @@ bool getLogicalSwitch(uint8_t idx)
|
||||
#endif
|
||||
|
||||
if (ls->func == LS_FUNC_NONE || (s && !getSwitch(s))) {
|
||||
LS_LAST_VALUE(mixerCurrentFlightMode, idx) = CS_LAST_VALUE_INIT;
|
||||
if (ls->func != LS_FUNC_STICKY) {
|
||||
LS_LAST_VALUE(mixerCurrentFlightMode, idx) = CS_LAST_VALUE_INIT;
|
||||
}
|
||||
result = false;
|
||||
}
|
||||
else if ((s=lswFamily(ls->func)) == LS_FAMILY_BOOL) {
|
||||
@@ -379,6 +391,10 @@ DurationAndDelayProcessing:
|
||||
|
||||
if (context.timerState == SWITCH_ENABLE) {
|
||||
result = (ls->duration==0 || context.timer>0); // return false after duration timer runs out
|
||||
if (!result && ls->func == LS_FUNC_STICKY) {
|
||||
ls_sticky_struct & lastValue = (ls_sticky_struct &)context.lastValue;
|
||||
lastValue.state = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (context.timerState == SWITCH_ENABLE && ls->duration > 0 && context.timer > 0) {
|
||||
@@ -733,10 +749,6 @@ void logicalSwitchesTimerTick()
|
||||
}
|
||||
}
|
||||
else if (ls->func == LS_FUNC_STICKY) {
|
||||
PACK(typedef struct {
|
||||
uint8_t state;
|
||||
uint8_t last;
|
||||
}) ls_sticky_struct;
|
||||
ls_sticky_struct & lastValue = (ls_sticky_struct &)LS_LAST_VALUE(fm, i);
|
||||
bool before = lastValue.last & 0x01;
|
||||
if (lastValue.state) {
|
||||
@@ -760,22 +772,17 @@ void logicalSwitchesTimerTick()
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
else if (ls->func == LS_FUNC_STAY) {
|
||||
PACK(typedef struct {
|
||||
uint16_t state:1;
|
||||
uint16_t duration:15;
|
||||
}) ls_stay_struct;
|
||||
|
||||
ls_stay_struct & lastValue = (ls_stay_struct &)LS_LAST_VALUE(fm, i);
|
||||
lastValue.state = false;
|
||||
bool state = getSwitch(ls->v1);
|
||||
if (state) {
|
||||
if (ls->v3 == 0 && lastValue.duration == lswTimerValue(ls->v2))
|
||||
if (ls->v3 == -1 && lastValue.duration == lswTimerValue(ls->v2))
|
||||
lastValue.state = true;
|
||||
if (lastValue.duration < 1000)
|
||||
lastValue.duration++;
|
||||
}
|
||||
else {
|
||||
if (lastValue.duration > lswTimerValue(ls->v2) && lastValue.duration <= lswTimerValue(ls->v2+ls->v3))
|
||||
if (lastValue.duration > lswTimerValue(ls->v2) && (ls->v3 == 0 || lastValue.duration <= lswTimerValue(ls->v2+ls->v3)))
|
||||
lastValue.state = true;
|
||||
lastValue.duration = 0;
|
||||
}
|
||||
|
||||
@@ -301,7 +301,6 @@ FORCEINLINE void readKeysAndTrims()
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ROTARY_ENCODERS <= 2
|
||||
ISR(INT2_vect)
|
||||
{
|
||||
uint8_t input = (PIND & 0x0C);
|
||||
@@ -313,7 +312,6 @@ ISR(INT3_vect)
|
||||
uint8_t input = (PIND & 0x0C);
|
||||
if (input == 0 || input == 0x0C) incRotaryEncoder(0, +1);
|
||||
}
|
||||
#endif
|
||||
|
||||
ISR(INT5_vect)
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user