Compare commits
199 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 | |||
| 36481471a3 | |||
| dd08886f2c | |||
| 76ef4b5948 | |||
| eaa247f46d | |||
| 3ada9f7cf5 | |||
| 10a5e4dc89 | |||
| 50e4850745 | |||
| a92de216ac | |||
| 3f3708f0f1 | |||
| 72c433ce9d | |||
| f123b69521 | |||
| 80369f0e8f | |||
| 8cd67bf31e | |||
| 34ef060e16 | |||
| 1f07f88dce | |||
| 4db5bdd486 | |||
| 05ac0682f0 | |||
| f12c3072b5 | |||
| 35aea83c89 | |||
| cf9b5d05a8 | |||
| d5393be5cb | |||
| 10c9936fa0 | |||
| 7a74d3ac85 | |||
| 39edaff669 | |||
| c5aed5f79b | |||
| 9b07a77e14 | |||
| 380fe5e44d | |||
| 8bd2c120d6 | |||
| 741ef45f3e | |||
| 4103adf75d | |||
| c0e612531d | |||
| 55cb5dce87 | |||
| 12ba27247e | |||
| 1e33e99655 | |||
| 50acd1fd92 | |||
| c3626225aa | |||
| b71a96ed55 | |||
| d2fcd544d8 | |||
| 50997721e2 | |||
| 828372ab29 | |||
| 21ae270c0e | |||
| 1b2efd1121 | |||
| 8d6a7c9495 | |||
| 189becfbb2 | |||
| 5a19e147fd | |||
| 062f93ae38 | |||
| 9861a08150 | |||
| de15d0a5a4 | |||
| 1e77bb3c02 | |||
| adadbe06ad | |||
| 92f2c48de9 | |||
| 1d4fa2a8b0 | |||
| 5493776b9c | |||
| b166b77c3e | |||
| 0ecb978364 | |||
| c8d792d3d8 | |||
| e9663e40e2 | |||
| a7e906dea9 | |||
| 685ab3d101 | |||
| 77564d74a4 | |||
| a0142d65be | |||
| 662bf15562 | |||
| 79b928af56 | |||
| 8c28f4bc48 | |||
| 7a4d6c89a1 | |||
| 38347becca | |||
| 49036dbb40 | |||
| abf36de157 | |||
| 32afbf5a5a | |||
| cba4a02cc1 | |||
| 4062555605 | |||
| 9cb38ce839 | |||
| 905090ef09 | |||
| 62e5820082 | |||
| 2d21e16201 | |||
| 07303f4301 | |||
| 91228f803c | |||
| e5d7e1f7c2 | |||
| 81573537eb | |||
| 7a85328b86 | |||
| fd84c62ff4 | |||
| 13e0b21656 | |||
| 5949be30fa | |||
| 0117c2da68 | |||
| 943f70c599 | |||
| 52a48fc4b1 | |||
| 2712ffabb0 | |||
| fa8c8a7094 | |||
| 5907193571 | |||
| 45abfb872f | |||
| 4d5962b15b | |||
| eea1c3a84c | |||
| deed7fc20f | |||
| 62fca3f8b6 | |||
| 9377e58407 | |||
| 9b53f69038 | |||
| 3680149b52 | |||
| 93faeeafbe | |||
| 2d5d1cb357 | |||
| 2a5364dc8c | |||
| 7f47a4fe10 | |||
| a0cc428228 | |||
| 61985f7d6a | |||
| 3baf64f123 | |||
| 4fd40c154e | |||
| 3c360618b9 | |||
| 1d96731ad5 | |||
| 9d1d31d26a | |||
| 0b52ccfaf1 | |||
| 484566083e | |||
| 0f33dc6113 | |||
| 7f3778fc3c | |||
| 0a9dcc5ce6 | |||
| 2f01f139cc | |||
| fb3e615008 | |||
| ce6d0807fa | |||
| cab8f3db71 | |||
| 399a8b2e35 | |||
| 3d4a791940 | |||
| 7373ce2cae | |||
| 5da1e35efe | |||
| fe5b7bee8c | |||
| 2da1134796 | |||
| 83e47d9e35 | |||
| f0c76efaf7 | |||
| 2fe7d856c3 | |||
| a7c1f22b36 | |||
| d92620919b | |||
| 94bb21886b | |||
| 5db98a3fef | |||
| 763c7fbb7d | |||
| b2d1a4ed22 | |||
| e7211065ab | |||
| 68b8b0e38f | |||
| 644c833311 | |||
| 30b1f62e99 | |||
| 03aa787c8e | |||
| 79592d3b00 | |||
| 7ed527a328 | |||
| 3e0766f2bf | |||
| 71e7926045 | |||
| 8c3d47deac | |||
| 197f31d5a1 | |||
| 1a198c35ad | |||
| 2934fc4d23 | |||
| 4ae9585080 | |||
| 161016a02a | |||
| 559bb83864 | |||
| 9a37c3027e | |||
| 6548afcad3 | |||
| ee31c51275 | |||
| 63aadad10c | |||
| 30958a9a65 | |||
| 995183bf22 |
@@ -518,3 +518,74 @@ Jens Lochmüller
|
||||
Anthony Witham
|
||||
Peter Hauke
|
||||
Arizona Action Photos
|
||||
Francis F Dale
|
||||
Willie Swanepoel
|
||||
Edward Hauser
|
||||
Adilson Oliveira
|
||||
Joseph Ordille
|
||||
Michael Shellim
|
||||
Teddie Holmes
|
||||
Alexandre Rault
|
||||
Eric Albin
|
||||
Lukas Kliment
|
||||
Bernard Philippe
|
||||
Bernard Delpy
|
||||
Didier Klein
|
||||
Arnaldo Guedes
|
||||
Cyberauto Systems
|
||||
John Alsbrooks
|
||||
John Kearney
|
||||
Christopher Borden
|
||||
Marc Virgilio Ricci
|
||||
Frederick Davie
|
||||
Jürgen Enders
|
||||
Terrence Pitts
|
||||
Thomas Sandner
|
||||
Marco Coltorti
|
||||
Harald Wilczak
|
||||
Rodney Lorimor
|
||||
Richard Davis
|
||||
Stephen Palmer
|
||||
Michael Napolitan
|
||||
Joshua Bardwell
|
||||
Fred Dawson
|
||||
Jim Wagner
|
||||
Peter Johnson
|
||||
Fredrik Lewerth
|
||||
Arvin Stenersen
|
||||
Daniel Morgan
|
||||
Roy Nixon
|
||||
Joachim Blunck
|
||||
Karl-Heinz Gansel
|
||||
Monrovia Mountain Enterprises
|
||||
Alessandro Villa
|
||||
Jan-Åke Nilsson
|
||||
Matthias Rei
|
||||
DVR Solutions BV
|
||||
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
|
||||
|
||||
@@ -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,3 +1,25 @@
|
||||
<h2>Version 2.0.10</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</h2>
|
||||
<ul>
|
||||
<li>Compare dialog bugfixes</li>
|
||||
<li>Curve index correctly resetted when type changed</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.7</h2>
|
||||
<ul>
|
||||
<li>SafetyCH function was missing in simulator</li>
|
||||
<li>EEPROM export warning when exporting logical switches > L12 on 9X128</li>
|
||||
<li>FAS offset was not exported on 9X/9XR boards</li>
|
||||
<li>Trims modes bugfix on non Taranis boards</li>
|
||||
<li>It was impossible to open a backuped model from the Tx</li>
|
||||
</ul>
|
||||
|
||||
<h2>Version 2.0.6</h2>
|
||||
<ul>
|
||||
<li>Fix Mix curves bug on Sky9x boards</li>
|
||||
|
||||
@@ -2,7 +2,7 @@ PROJECT( companion )
|
||||
|
||||
SET( C9X_VERSION_MAJOR "2" )
|
||||
SET( C9X_VERSION_MINOR "0" )
|
||||
SET( C9X_VERSION_REVISION "6" )
|
||||
SET( C9X_VERSION_REVISION "10" )
|
||||
SET( C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR}.${C9X_VERSION_REVISION} )
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
|
||||
@@ -87,6 +87,13 @@ add_custom_command(
|
||||
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${RADIO_SRC_DIRECTORY}/lua_exports.inc
|
||||
COMMAND make lua_exports.cpp
|
||||
DEPENDS ${RADIO_SRC_DIRECTORY}/myeeprom.h
|
||||
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PROJECT_SOURCE_DIR}/../..
|
||||
@@ -112,6 +119,7 @@ set(common_SRCS
|
||||
firmwares/ersky9x/ersky9xinterface.cpp
|
||||
${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm
|
||||
${RADIO_SRC_DIRECTORY}/translations/en.h
|
||||
${RADIO_SRC_DIRECTORY}/lua_exports.inc
|
||||
firmwares/opentx/opentxeeprom.cpp
|
||||
firmwares/opentx/open9xStockeeprom.cpp
|
||||
firmwares/opentx/open9xGruvin9xeeprom.cpp
|
||||
@@ -312,6 +320,7 @@ set(simu_SRCS
|
||||
${ERSKY9X_CHECKOUT_DIRECTORY}/ersky9xsimulator.cpp
|
||||
${RADIO_SRC_DIRECTORY}/bitmaps/sticks.lbm
|
||||
${RADIO_SRC_DIRECTORY}/translations/en.h
|
||||
${RADIO_SRC_DIRECTORY}/lua_exports.inc
|
||||
modeledit/node.cpp
|
||||
modeledit/edge.cpp # TODO not needed
|
||||
simulator.cpp
|
||||
@@ -329,7 +338,11 @@ if(WIN32)
|
||||
set(simu_SRCS ${simu_SRCS} icon.rc)
|
||||
endif()
|
||||
|
||||
add_executable(simulator WIN32 ${simu_SRCS})
|
||||
if(APPLE)
|
||||
add_executable(simulator MACOSX_BUNDLE ${simu_SRCS})
|
||||
else()
|
||||
add_executable(simulator WIN32 ${simu_SRCS})
|
||||
endif()
|
||||
|
||||
if(SDL_FOUND)
|
||||
target_link_libraries(simulator simulation common ${QT_LIBRARIES} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS})
|
||||
@@ -418,9 +431,15 @@ ADD_CUSTOM_TARGET( stamp
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/version.h ${CMAKE_SOURCE_DIR}/../companion.stamp
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/version.h )
|
||||
|
||||
ADD_CUSTOM_TARGET( translations
|
||||
IF(WIN32)
|
||||
ADD_CUSTOM_TARGET( translations
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMAND lupdate ${CMAKE_SOURCE_DIR} -ts ${companion_TS} )
|
||||
ELSE( )
|
||||
ADD_CUSTOM_TARGET( translations
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMAND lupdate-qt4 ${CMAKE_SOURCE_DIR} -ts ${companion_TS} )
|
||||
ENDIF( )
|
||||
|
||||
SET(CPACK_PACKAGE_NAME "COMPANION")
|
||||
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Models and settings editor for the OpenTx open source firmware")
|
||||
|
||||
@@ -156,11 +156,11 @@ void avrOutputDialog::doCopy()
|
||||
dest.close();
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(this, tr("Error"),tr("Cannot write destination") + ": " + dest.errorString());
|
||||
QMessageBox::warning(this, tr("Error"),tr("Cannot write destination") + ": " + dest.fileName() + ", " + tr("reason") + ": " + dest.errorString());
|
||||
}
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(this, tr("Error"),tr("Cannot open source file") + ": " + source.errorString());
|
||||
QMessageBox::warning(this, tr("Error"),tr("Cannot open source file") + ": " + source.fileName() + ", " + tr("reason") + ": " + source.errorString());
|
||||
}
|
||||
|
||||
source.close();
|
||||
|
||||
@@ -354,10 +354,8 @@ void burnConfigDialog::restFuses(bool eeProtect)
|
||||
//use hfuse = 0x81 to prevent eeprom being erased with every flashing
|
||||
}
|
||||
else {
|
||||
QString tempDir = QDir::tempPath();
|
||||
QString tempFile;
|
||||
QString lfuses;
|
||||
tempFile = tempDir + "/ftemp.bin";
|
||||
QString tempFile = generateProcessUniqueTempFileName("ftemp.bin");
|
||||
QStringList argread;
|
||||
argread << "-c" << avrProgrammer << "-p" << avrMCU << args <<"-U" << "lfuse:r:"+tempFile+":r" ;
|
||||
avrOutputDialog *ad = new avrOutputDialog(this, avrLoc, argread, "Reset Fuses",AVR_DIALOG_CLOSE_IF_SUCCESSFUL,FALSE);
|
||||
@@ -376,7 +374,7 @@ void burnConfigDialog::restFuses(bool eeProtect)
|
||||
lfuses="lfuse:w:0x3F:m";
|
||||
}
|
||||
file.close();
|
||||
unlink(tempFile.toAscii());
|
||||
qunlink(tempFile);
|
||||
}
|
||||
else {
|
||||
lfuses="lfuse:w:0x3F:m";
|
||||
|
||||
@@ -418,12 +418,11 @@ void burnDialog::on_BurnFlashButton_clicked()
|
||||
image = pixmap->toImage().scaled(ui->imageLabel->width(), ui->imageLabel->height());
|
||||
}
|
||||
if (!image.isNull()) {
|
||||
QString tempDir = QDir::tempPath();
|
||||
QString tempFile;
|
||||
if (getFileType(fileName) == FILE_TYPE_HEX)
|
||||
tempFile = tempDir + "/flash.hex";
|
||||
tempFile = generateProcessUniqueTempFileName("flash.hex");
|
||||
else
|
||||
tempFile = tempDir + "/flash.bin";
|
||||
tempFile = generateProcessUniqueTempFileName("flash.bin");
|
||||
FlashInterface flash(fileName);
|
||||
flash.setSplash(image);
|
||||
if (flash.saveFlash(tempFile) > 0) {
|
||||
@@ -556,8 +555,7 @@ void burnDialog::on_BurnFlashButton_clicked()
|
||||
}
|
||||
|
||||
if (patch) {
|
||||
QString tempDir = QDir::tempPath();
|
||||
QString fileName = tempDir + "/temp.bin";
|
||||
QString fileName = generateProcessUniqueTempFileName("temp.bin");
|
||||
QFile file(fileName);
|
||||
|
||||
uint8_t *eeprom = (uint8_t*)malloc(GetEepromInterface()->getEEpromSize());
|
||||
|
||||
@@ -156,16 +156,12 @@ void CompareDialog::dropEvent(QDropEvent *event)
|
||||
|
||||
void CompareDialog::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
QByteArray ba = curvefile5.toLatin1();
|
||||
char *name = ba.data();
|
||||
unlink(name);
|
||||
ba = curvefile9.toLatin1();
|
||||
name = ba.data();
|
||||
unlink(name);
|
||||
}
|
||||
|
||||
CompareDialog::~CompareDialog()
|
||||
{
|
||||
qunlink(curvefile5);
|
||||
qunlink(curvefile9);
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -260,13 +256,10 @@ void CompareDialog::printSetup()
|
||||
str.append(fv(tr("Pulse Polarity"), g_model1->moduleData[0].polarityToString(), color));
|
||||
color=getColor1(g_model1->thrTrim,g_model2->thrTrim);
|
||||
str.append(fv(tr("Throttle Trim"), g_model1->thrTrim ? tr("Enabled") : tr("Disabled"), color));
|
||||
color=getColor1(g_model1->thrExpo,g_model2->thrExpo);
|
||||
str.append(fv(tr("Throttle Expo"), g_model1->thrExpo ? tr("Enabled") : tr("Disabled"),color));
|
||||
// TODO str.append(fv(tr("Trim Switch"), getSWName(g_model->trimSw)));
|
||||
color=getColor1(getTrimInc(g_model1),getTrimInc(g_model2));
|
||||
str.append(fv(tr("Trim Increment"), getTrimInc(g_model1),color));
|
||||
color=getColor1(getCenterBeep(g_model1),getCenterBeep(g_model2));
|
||||
str.append(fv(tr("Center Beep"), getCenterBeep(g_model1),color)); // specify which channels beep
|
||||
color = getColor1(getCenterBeepStr(g_model1), getCenterBeepStr(g_model2));
|
||||
str.append(fv(tr("Center Beep"), getCenterBeepStr(g_model1), color)); // specify which channels beep
|
||||
str.append("</table></td>");
|
||||
str.append("<td><table border=0 cellspacing=0 cellpadding=3 width=\"50%\">");
|
||||
color=getColor2(g_model1->name,g_model2->name);
|
||||
@@ -283,13 +276,10 @@ void CompareDialog::printSetup()
|
||||
str.append(fv(tr("Pulse Polarity"), g_model2->moduleData[0].polarityToString(), color));
|
||||
color=getColor2(g_model1->thrTrim,g_model2->thrTrim);
|
||||
str.append(fv(tr("Throttle Trim"), g_model2->thrTrim ? tr("Enabled") : tr("Disabled"), color));
|
||||
color=getColor2(g_model1->thrExpo,g_model2->thrExpo);
|
||||
str.append(fv(tr("Throttle Expo"), g_model2->thrExpo ? tr("Enabled") : tr("Disabled"),color));
|
||||
// TODO str.append(fv(tr("Trim Switch"), getSWName(g_model->trimSw)));
|
||||
color=getColor2(getTrimInc(g_model1),getTrimInc(g_model2));
|
||||
str.append(fv(tr("Trim Increment"), getTrimInc(g_model2),color));
|
||||
color=getColor2(getCenterBeep(g_model1),getCenterBeep(g_model2));
|
||||
str.append(fv(tr("Center Beep"), getCenterBeep(g_model2),color)); // specify which channels beep
|
||||
color = getColor2(getCenterBeepStr(g_model1),getCenterBeepStr(g_model2));
|
||||
str.append(fv(tr("Center Beep"), getCenterBeepStr(g_model2), color)); // specify which channels beep
|
||||
str.append("</td></tr></table></td></tr></table>");
|
||||
te->append(str);
|
||||
}
|
||||
@@ -506,11 +496,11 @@ void CompareDialog::printLimits()
|
||||
str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),"",true));
|
||||
}
|
||||
color=getColor1(g_model1->limitData[i].offset,g_model2->limitData[i].offset);
|
||||
str.append(doTR(QString::number((qreal)g_model1->limitData[i].offset/10, 'f', 1),color));
|
||||
str.append(doTR(g_model1->limitData[i].offsetToString(), color));
|
||||
color=getColor1(g_model1->limitData[i].min,g_model2->limitData[i].min);
|
||||
str.append(doTR(QString::number(g_model1->limitData[i].min),color));
|
||||
str.append(doTR(g_model1->limitData[i].minToString(), color));
|
||||
color=getColor1(g_model1->limitData[i].max,g_model2->limitData[i].max);
|
||||
str.append(doTR(QString::number(g_model1->limitData[i].max),color));
|
||||
str.append(doTR(g_model1->limitData[i].maxToString(), color));
|
||||
color=getColor1(g_model1->limitData[i].revert,g_model2->limitData[i].revert);
|
||||
str.append(doTR(QString(g_model1->limitData[i].revert ? tr("INV") : tr("NOR")),color));
|
||||
str.append("</tr>");
|
||||
@@ -533,11 +523,11 @@ void CompareDialog::printLimits()
|
||||
str.append(doTC(tr("CH")+QString(" %1").arg(i+1,2,10,QChar('0')),"",true));
|
||||
}
|
||||
color=getColor2(g_model1->limitData[i].offset,g_model2->limitData[i].offset);
|
||||
str.append(doTR(QString::number((qreal)g_model2->limitData[i].offset/10, 'f', 1),color));
|
||||
str.append(doTR(g_model2->limitData[i].offsetToString(), color));
|
||||
color=getColor2(g_model1->limitData[i].min,g_model2->limitData[i].min);
|
||||
str.append(doTR(QString::number(g_model2->limitData[i].min),color));
|
||||
str.append(doTR(g_model2->limitData[i].minToString(), color));
|
||||
color=getColor2(g_model1->limitData[i].max,g_model2->limitData[i].max);
|
||||
str.append(doTR(QString::number(g_model2->limitData[i].max),color));
|
||||
str.append(doTR(g_model2->limitData[i].maxToString(), color));
|
||||
color=getColor2(g_model1->limitData[i].revert,g_model2->limitData[i].revert);
|
||||
str.append(doTR(QString(g_model2->limitData[i].revert ? tr("INV") : tr("NOR")),color));
|
||||
str.append("</tr>");
|
||||
@@ -807,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));
|
||||
str += md->curve.toString().replace("<", "<").replace(">", ">");
|
||||
if (md->curve.value) str += " " + md->curve.toString().replace("<", "<").replace(">", ">");
|
||||
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);
|
||||
@@ -885,8 +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));
|
||||
// TODO if (md->differential) str += " "+ tr("Diff") + QString(" (%1%)").arg(getGVarString(md->differential));
|
||||
// TODO if (md->curve) str += " " + tr("Curve") + QString("(%1)").arg(getCurveStr(md->curve).replace("<", "<").replace(">", ">"));
|
||||
if (md->curve.value) str += " " + md->curve.toString().replace("<", "<").replace(">", ">");
|
||||
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);
|
||||
|
||||
@@ -505,7 +505,7 @@ class ConversionTable {
|
||||
{
|
||||
after = 0;
|
||||
|
||||
for (std::list<ConversionTuple>::iterator it=internalTable.begin(); it!=internalTable.end(); it++) {
|
||||
for (std::list<ConversionTuple>::iterator it=exportTable.begin(); it!=exportTable.end(); it++) {
|
||||
ConversionTuple tuple = *it;
|
||||
if (before == tuple.a) {
|
||||
after = tuple.b;
|
||||
@@ -520,7 +520,7 @@ class ConversionTable {
|
||||
{
|
||||
after = 0;
|
||||
|
||||
for (std::list<ConversionTuple>::iterator it=internalTable.begin(); it!=internalTable.end(); it++) {
|
||||
for (std::list<ConversionTuple>::iterator it=importTable.begin(); it!=importTable.end(); it++) {
|
||||
ConversionTuple tuple = *it;
|
||||
if (before == tuple.b) {
|
||||
after = tuple.a;
|
||||
@@ -547,10 +547,23 @@ class ConversionTable {
|
||||
|
||||
void addConversion(const int a, const int b)
|
||||
{
|
||||
internalTable.push_back(ConversionTuple(a, b));
|
||||
ConversionTuple conversion(a, b);
|
||||
importTable.push_back(conversion);
|
||||
exportTable.push_back(conversion);
|
||||
}
|
||||
|
||||
std::list<ConversionTuple> internalTable;
|
||||
void addImportConversion(const int a, const int b)
|
||||
{
|
||||
importTable.push_back(ConversionTuple(a, b));
|
||||
}
|
||||
|
||||
void addExportConversion(const int a, const int b)
|
||||
{
|
||||
exportTable.push_back(ConversionTuple(a, b));
|
||||
}
|
||||
|
||||
std::list<ConversionTuple> importTable;
|
||||
std::list<ConversionTuple> exportTable;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
@@ -648,7 +661,7 @@ class ConversionField: public TransformedField {
|
||||
if (table->exportValue(_field, _field))
|
||||
return;
|
||||
if (!error.isEmpty())
|
||||
EEPROMWarnings += error + "\n";
|
||||
EEPROMWarnings.push_back(error);
|
||||
}
|
||||
|
||||
if (shift) {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "helpers.h"
|
||||
#include "wizarddata.h"
|
||||
|
||||
QString EEPROMWarnings;
|
||||
std::list<QString> EEPROMWarnings;
|
||||
|
||||
const char * switches9X[] = { "3POS", "THR", "RUD", "ELE", "AIL", "GEA", "TRN" };
|
||||
const char * switchesX9D[] = { "SA", "SB", "SC", "SD", "SE", "SF", "SG", "SH" };
|
||||
@@ -724,7 +724,7 @@ QString FuncSwData::funcToString()
|
||||
{
|
||||
ModelData model;
|
||||
if (func >= FuncSafetyCh1 && func <= FuncSafetyCh32)
|
||||
return QObject::tr("Safety %1").arg(RawSource(SOURCE_TYPE_CH, func).toString(model));
|
||||
return QObject::tr("Override %1").arg(RawSource(SOURCE_TYPE_CH, func).toString(model));
|
||||
else if (func == FuncTrainer)
|
||||
return QObject::tr("Trainer");
|
||||
else if (func == FuncTrainerRUD)
|
||||
@@ -851,6 +851,28 @@ QString FuncSwData::repeatToString()
|
||||
}
|
||||
}
|
||||
|
||||
QString LimitData::minToString()
|
||||
{
|
||||
return QString::number((qreal)min/10);
|
||||
}
|
||||
|
||||
QString LimitData::maxToString()
|
||||
{
|
||||
return QString::number((qreal)max/10);
|
||||
}
|
||||
|
||||
QString LimitData::offsetToString()
|
||||
{
|
||||
return QString::number((qreal)offset/10, 'f', 1);
|
||||
}
|
||||
|
||||
void LimitData::clear()
|
||||
{
|
||||
memset(this, 0, sizeof(LimitData));
|
||||
min = -1000;
|
||||
max = +1000;
|
||||
}
|
||||
|
||||
GeneralSettings::GeneralSettings()
|
||||
{
|
||||
memset(this, 0, sizeof(GeneralSettings));
|
||||
|
||||
@@ -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;
|
||||
@@ -631,7 +633,10 @@ class LimitData {
|
||||
bool symetrical;
|
||||
char name[6+1];
|
||||
CurveReference curve;
|
||||
void clear() { memset(this, 0, sizeof(LimitData)); min = -1000; max = +1000; }
|
||||
QString minToString();
|
||||
QString maxToString();
|
||||
QString offsetToString();
|
||||
void clear();
|
||||
};
|
||||
|
||||
enum MltpxValue {
|
||||
@@ -916,7 +921,6 @@ class TimerData {
|
||||
RawSwitch mode;
|
||||
bool minuteBeep;
|
||||
unsigned int countdownBeep;
|
||||
bool dir; // 0=>Count Down, 1=>Count Up
|
||||
unsigned int val;
|
||||
unsigned int persistent;
|
||||
int pvalue;
|
||||
@@ -983,7 +987,6 @@ class ModelData {
|
||||
char name[12+1];
|
||||
TimerData timers[2];
|
||||
bool thrTrim; // Enable Throttle Trim
|
||||
bool thrExpo; // Enable Throttle Expo
|
||||
int trimInc; // Trim Increments
|
||||
bool disableThrottleWarning;
|
||||
|
||||
@@ -1128,6 +1131,7 @@ enum Capability {
|
||||
HasSoundMixer,
|
||||
NumModules,
|
||||
PPMCenter,
|
||||
PPMUnitMicroseconds,
|
||||
SYMLimits,
|
||||
HasCurrentCalibration,
|
||||
HasVolume,
|
||||
@@ -1198,7 +1202,7 @@ class EEPROMInterface
|
||||
|
||||
};
|
||||
|
||||
extern QString EEPROMWarnings;
|
||||
extern std::list<QString> EEPROMWarnings;
|
||||
|
||||
/* EEPROM string conversion functions */
|
||||
void setEEPROMString(char *dst, const char *src, int size);
|
||||
|
||||
@@ -344,6 +344,57 @@ unsigned int RleFile::readRlc12(uint8_t *buf, unsigned int i_len, bool rlc2)
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int importRlc(QByteArray & dst, QByteArray & src, unsigned int rlcVersion)
|
||||
{
|
||||
uint8_t *buf = (uint8_t *)src.data();
|
||||
unsigned int len = src.size();
|
||||
uint8_t zeroes = 0;
|
||||
uint8_t bRlc = 0;
|
||||
|
||||
dst.resize(0);
|
||||
|
||||
for( ; 1; ) {
|
||||
for (int i=0; i<zeroes; i++)
|
||||
dst.append((char)0);
|
||||
zeroes = 0;
|
||||
|
||||
if (len == 0)
|
||||
return dst.size();
|
||||
|
||||
for (int i=0; i<bRlc; i++) {
|
||||
dst.append(*buf++);
|
||||
if (--len == 0)
|
||||
return dst.size();
|
||||
}
|
||||
|
||||
bRlc = *buf++;
|
||||
--len;
|
||||
|
||||
if (!(bRlc & 0x7f)) {
|
||||
qDebug() << "RLC decoding error!";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rlcVersion == 2) {
|
||||
if (bRlc&0x80){ // if contains high byte
|
||||
zeroes = (bRlc>>4) & 0x07;
|
||||
bRlc = bRlc & 0x0f;
|
||||
}
|
||||
else if (bRlc&0x40){
|
||||
zeroes = bRlc & 0x3f;
|
||||
bRlc = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (bRlc&0x80){ // if contains high byte
|
||||
zeroes = bRlc & 0x7f;
|
||||
bRlc = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return dst.size();
|
||||
}
|
||||
|
||||
unsigned int RleFile::write1(uint8_t b)
|
||||
{
|
||||
return write(&b, 1);
|
||||
|
||||
@@ -146,4 +146,6 @@ public:
|
||||
unsigned int get_current_block_number(unsigned int block_no, uint16_t *p_size);
|
||||
};
|
||||
|
||||
unsigned int importRlc(QByteArray & dst, QByteArray & src, unsigned int rlcVersion=2);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -138,8 +138,8 @@ t_Er9xLimitData::t_Er9xLimitData()
|
||||
t_Er9xLimitData::operator LimitData ()
|
||||
{
|
||||
LimitData c9x;
|
||||
c9x.min = min-100;
|
||||
c9x.max = max+100;
|
||||
c9x.min = 10*(min-100);
|
||||
c9x.max = 10*(max+100);
|
||||
c9x.revert = revert;
|
||||
c9x.offset = offset;
|
||||
return c9x;
|
||||
@@ -358,7 +358,6 @@ t_Er9xModelData::operator ModelData ()
|
||||
c9x.used = true;
|
||||
getEEPROMString(c9x.name, name, sizeof(name));
|
||||
c9x.timers[0].mode = getEr9xTimerMode(tmrMode);
|
||||
c9x.timers[0].dir = tmrDir;
|
||||
c9x.timers[0].val = tmrVal;
|
||||
switch(protocol) {
|
||||
case 1:
|
||||
@@ -377,7 +376,6 @@ t_Er9xModelData::operator ModelData ()
|
||||
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;
|
||||
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.funcSw[0].func = FuncInstantTrim;
|
||||
|
||||
@@ -147,8 +147,8 @@ t_Ersky9xLimitData::t_Ersky9xLimitData()
|
||||
t_Ersky9xLimitData::operator LimitData ()
|
||||
{
|
||||
LimitData c9x;
|
||||
c9x.min = min-100;
|
||||
c9x.max = max+100;
|
||||
c9x.min = 10*(min-100);
|
||||
c9x.max = 10*(max+100);
|
||||
c9x.revert = revert;
|
||||
c9x.offset = offset;
|
||||
return c9x;
|
||||
@@ -489,7 +489,6 @@ t_Ersky9xModelData_v10::operator ModelData ()
|
||||
getEEPROMString(c9x.name, name, sizeof(name));
|
||||
for (int i=0; i<2; i++) {
|
||||
c9x.timers[i].mode = getErSky9xTimerMode(timer[i].tmrModeA);
|
||||
c9x.timers[i].dir = timer[i].tmrDir;
|
||||
c9x.timers[i].val = timer[i].tmrVal;
|
||||
}
|
||||
switch(protocol) {
|
||||
@@ -509,7 +508,6 @@ t_Ersky9xModelData_v10::operator ModelData ()
|
||||
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;
|
||||
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.funcSw[0].func = FuncInstantTrim;
|
||||
@@ -607,7 +605,6 @@ t_Ersky9xModelData_v11::operator ModelData ()
|
||||
getEEPROMString(c9x.name, name, sizeof(name));
|
||||
for (int i=0; i<2; i++) {
|
||||
c9x.timers[i].mode = getErSky9xTimerMode(timer[i].tmrModeA);
|
||||
c9x.timers[i].dir = timer[i].tmrDir;
|
||||
c9x.timers[i].val = timer[i].tmrVal;
|
||||
}
|
||||
switch(protocol) {
|
||||
@@ -627,7 +624,6 @@ t_Ersky9xModelData_v11::operator ModelData ()
|
||||
c9x.moduleData[0].ppmFrameLength=ppmFrameLength;
|
||||
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.funcSw[0].func = FuncInstantTrim;
|
||||
|
||||
@@ -201,8 +201,8 @@ t_Gruvin9xLimitData::t_Gruvin9xLimitData()
|
||||
t_Gruvin9xLimitData::operator LimitData ()
|
||||
{
|
||||
LimitData c9x;
|
||||
c9x.min = min-100;
|
||||
c9x.max = max+100;
|
||||
c9x.min = 10*(min-100);
|
||||
c9x.max = 10*(max+100);
|
||||
c9x.revert = revert;
|
||||
c9x.offset = offset;
|
||||
return c9x;
|
||||
@@ -378,7 +378,6 @@ t_Gruvin9xTimerData::operator TimerData ()
|
||||
TimerData c9x;
|
||||
c9x.mode = getEr9xTimerMode(mode);
|
||||
c9x.val = val;
|
||||
c9x.dir = dir;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
@@ -447,7 +446,6 @@ t_Gruvin9xModelData_v102::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
@@ -518,7 +516,6 @@ t_Gruvin9xModelData_v103::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
@@ -589,7 +586,6 @@ t_Gruvin9xModelData_v105::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
@@ -680,7 +676,6 @@ t_Gruvin9xModelData_v106::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc-2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
|
||||
@@ -138,7 +138,6 @@ t_Open9xArmTimerData_v202::operator TimerData ()
|
||||
*/
|
||||
c9x.val = val;
|
||||
c9x.persistent = false;
|
||||
c9x.dir = (val == 0);
|
||||
return c9x;
|
||||
}
|
||||
|
||||
@@ -149,7 +148,7 @@ t_Open9xArmExpoData_v208::operator ExpoData ()
|
||||
c9x.chn = chn;
|
||||
|
||||
if (expo!=0 && curve!=0) {
|
||||
EEPROMWarnings += ::QObject::tr("Simultaneous usage of expo and curves is no longer supported") + "\n";
|
||||
EEPROMWarnings.push_back(::QObject::tr("Simultaneous usage of expo and curves is no longer supported"));
|
||||
}
|
||||
else {
|
||||
if (curve == 0) {
|
||||
@@ -179,7 +178,7 @@ t_Open9xArmExpoData_v210::operator ExpoData ()
|
||||
c9x.chn = chn;
|
||||
|
||||
if (expo!=0 && curve!=0) {
|
||||
EEPROMWarnings += ::QObject::tr("Simultaneous usage of expo and curves is no longer supported") + "\n";
|
||||
EEPROMWarnings.push_back(::QObject::tr("Simultaneous usage of expo and curves is no longer supported"));
|
||||
}
|
||||
else {
|
||||
if (curve == 0) {
|
||||
|
||||
@@ -89,7 +89,7 @@ t_Open9xExpoData_v201::operator ExpoData ()
|
||||
c9x.mode = mode;
|
||||
c9x.chn = chn;
|
||||
if (expo!=0 && curve!=0) {
|
||||
EEPROMWarnings += ::QObject::tr("Simultaneous usage of expo and curves is no longer supported in OpenTX") + "\n";
|
||||
EEPROMWarnings.push_back(::QObject::tr("Simultaneous usage of expo and curves is no longer supported in OpenTX"));
|
||||
}
|
||||
else {
|
||||
if (curve == 0) {
|
||||
@@ -129,8 +129,8 @@ t_Open9xExpoData_v211::operator ExpoData ()
|
||||
t_Open9xLimitData_v201::operator LimitData ()
|
||||
{
|
||||
LimitData c9x;
|
||||
c9x.min = min-100;
|
||||
c9x.max = max+100;
|
||||
c9x.min = 10*(min-100);
|
||||
c9x.max = 10*(max+100);
|
||||
c9x.revert = revert;
|
||||
c9x.offset = offset;
|
||||
return c9x;
|
||||
@@ -139,8 +139,8 @@ t_Open9xLimitData_v201::operator LimitData ()
|
||||
t_Open9xLimitData_v211::operator LimitData ()
|
||||
{
|
||||
LimitData c9x;
|
||||
c9x.min = min-100;
|
||||
c9x.max = max+100;
|
||||
c9x.min = 10*(min-100);
|
||||
c9x.max = 10*(max+100);
|
||||
c9x.revert = revert;
|
||||
c9x.offset = offset;
|
||||
c9x.symetrical=symetrical;
|
||||
@@ -573,8 +573,8 @@ t_Open9xFuncSwData_v201::operator FuncSwData ()
|
||||
}
|
||||
|
||||
enum Functions {
|
||||
FUNC_SAFETY_CH1,
|
||||
FUNC_SAFETY_CH16=FUNC_SAFETY_CH1+15,
|
||||
FUNC_OVERRIDE_CH1,
|
||||
FUNC_OVERRIDE_CH16=FUNC_OVERRIDE_CH1+15,
|
||||
FUNC_TRAINER,
|
||||
FUNC_TRAINER_RUD,
|
||||
FUNC_TRAINER_ELE,
|
||||
@@ -704,7 +704,6 @@ t_Open9xTimerData_v201::operator TimerData ()
|
||||
// c9x.mode = TMRMODE_OFF;
|
||||
c9x.val = val;
|
||||
c9x.persistent = persistent;
|
||||
c9x.dir = dir;
|
||||
return c9x;
|
||||
}
|
||||
|
||||
@@ -725,7 +724,6 @@ t_Open9xTimerData_v202::operator TimerData ()
|
||||
*/
|
||||
c9x.val = val;
|
||||
c9x.persistent = false;
|
||||
c9x.dir = (val == 0);
|
||||
return c9x;
|
||||
}
|
||||
|
||||
@@ -939,7 +937,6 @@ t_Open9xModelData_v201::operator ModelData ()
|
||||
}
|
||||
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc - 2;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.beepANACenter = beepANACenter;
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#define GPS
|
||||
#define FAI_CHOICE
|
||||
#define FRSKY_STICKS
|
||||
#define OVERRIDE_CHANNEL_FUNCTION
|
||||
|
||||
#define EEPROM_VARIANT 3
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#define FRSKY_STICKS
|
||||
#define DSM2
|
||||
#define DSM2_PPM
|
||||
#define OVERRIDE_CHANNEL_FUNCTION
|
||||
|
||||
#define EEPROM_VARIANT SIMU_M128_VARIANTS
|
||||
#define GAUGES
|
||||
|
||||
@@ -50,6 +50,8 @@
|
||||
#define GPS
|
||||
#define FAI_CHOICE
|
||||
#define FRSKY_STICKS
|
||||
#define OVERRIDE_CHANNEL_FUNCTION
|
||||
#define FAS_OFFSET
|
||||
|
||||
#define EEPROM_VARIANT SIMU_STOCK_VARIANTS
|
||||
#define GAUGES
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#define GPS
|
||||
#define FAI_CHOICE
|
||||
#define FRSKY_STICKS
|
||||
#define OVERRIDE_CHANNEL_FUNCTION
|
||||
|
||||
#define NUM_POTS 3
|
||||
#define EEPROM_VARIANT 3
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#define EEPROM_VARIANT 3
|
||||
#define HAPTIC
|
||||
#define REVPLUS
|
||||
#define OVERRIDE_CHANNEL_FUNCTION
|
||||
|
||||
#define NUM_POTS 5
|
||||
|
||||
|
||||
@@ -40,11 +40,11 @@ inline int switchIndex(int i, BoardEnum board, unsigned int version)
|
||||
class SwitchesConversionTable: public ConversionTable {
|
||||
|
||||
public:
|
||||
SwitchesConversionTable(BoardEnum board, unsigned int version, unsigned long flags=0)
|
||||
SwitchesConversionTable(BoardEnum board, unsigned int version, bool timer=false)
|
||||
{
|
||||
int val=0;
|
||||
int offset=0;
|
||||
if (flags & POPULATE_TIMER_MODES) {
|
||||
if (timer) {
|
||||
offset = 4;
|
||||
for (int i=0; i<5; i++) {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_TIMER_MODE, i), val++);
|
||||
@@ -56,8 +56,15 @@ class SwitchesConversionTable: public ConversionTable {
|
||||
|
||||
for (int i=1; i<=MAX_SWITCHES_POSITION(board); i++) {
|
||||
int s = switchIndex(i, board, version);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_SWITCH, -s), -val+offset);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_SWITCH, s), val++);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_SWITCH, s), val);
|
||||
if (IS_TARANIS(board) && s>=21/*SHup/SHdown*/) {
|
||||
addImportConversion(RawSwitch(SWITCH_TYPE_SWITCH, 21+22-s), -val+offset);
|
||||
addExportConversion(RawSwitch(SWITCH_TYPE_SWITCH, -s), -val+offset);
|
||||
}
|
||||
else {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_SWITCH, -s), -val+offset);
|
||||
}
|
||||
val++;
|
||||
}
|
||||
|
||||
if (IS_TARANIS(board) && version >= 216) {
|
||||
@@ -86,17 +93,15 @@ class SwitchesConversionTable: public ConversionTable {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_VIRTUAL, i), val++);
|
||||
}
|
||||
|
||||
if (!(flags & POPULATE_TIMER_MODES)) {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_OFF), -val+offset);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_ON), val++);
|
||||
if (version >= 216) {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_ONE, -1), -val+offset);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_ONE, 1), val++);
|
||||
if (IS_ARM(board)) {
|
||||
for (int i=1; i<=MAX_FLIGHT_MODES(board, version); i++) {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_FLIGHT_MODE, -i), -val+offset);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i), val++);
|
||||
}
|
||||
addConversion(RawSwitch(SWITCH_TYPE_OFF), -val+offset);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_ON), val++);
|
||||
if (version >= 216) {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_ONE, -1), -val+offset);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_ONE, 1), val++);
|
||||
if (IS_ARM(board)) {
|
||||
for (int i=1; i<=MAX_FLIGHT_MODES(board, version); i++) {
|
||||
addConversion(RawSwitch(SWITCH_TYPE_FLIGHT_MODE, -i), -val+offset);
|
||||
addConversion(RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i), val++);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,6 +129,16 @@ class SwitchesConversionTable: public ConversionTable {
|
||||
ConversionTable::addConversion(sw.toValue(), b);
|
||||
}
|
||||
|
||||
void addImportConversion(const RawSwitch & sw, const int b)
|
||||
{
|
||||
ConversionTable::addImportConversion(sw.toValue(), b);
|
||||
}
|
||||
|
||||
void addExportConversion(const RawSwitch & sw, const int b)
|
||||
{
|
||||
ConversionTable::addExportConversion(sw.toValue(), b);
|
||||
}
|
||||
|
||||
class Cache {
|
||||
public:
|
||||
Cache(BoardEnum board, unsigned int version, unsigned long flags, SwitchesConversionTable * table):
|
||||
@@ -235,8 +250,9 @@ class SourcesConversionTable: public ConversionTable {
|
||||
addConversion(RawSource(SOURCE_TYPE_SWITCH, i), val++);
|
||||
}
|
||||
}
|
||||
for (int i=0; i<MAX_CUSTOM_SWITCHES(board, version); i++)
|
||||
for (int i=0; i<MAX_CUSTOM_SWITCHES(board, version); i++) {
|
||||
addConversion(RawSource(SOURCE_TYPE_CUSTOM_SWITCH, i), val++);
|
||||
}
|
||||
}
|
||||
|
||||
if (!afterrelease21March2013) {
|
||||
@@ -369,7 +385,8 @@ template <int N>
|
||||
class SwitchField: public ConversionField< SignedField<N> > {
|
||||
public:
|
||||
SwitchField(RawSwitch & sw, BoardEnum board, unsigned int version, unsigned long flags=0):
|
||||
ConversionField< SignedField<N> >(_switch, SwitchesConversionTable::getInstance(board, version, flags), "Switch"),
|
||||
ConversionField< SignedField<N> >(_switch, SwitchesConversionTable::getInstance(board, version, flags), "Switch",
|
||||
"Switch "+ sw.toString()+" cannot be exported on this board!"),
|
||||
sw(sw),
|
||||
_switch(0)
|
||||
{
|
||||
@@ -503,7 +520,8 @@ template <int N>
|
||||
class SourceField: public ConversionField< UnsignedField<N> > {
|
||||
public:
|
||||
SourceField(RawSource & source, BoardEnum board, unsigned int version, unsigned int variant, unsigned long flags=0):
|
||||
ConversionField< UnsignedField<N> >(_source, SourcesConversionTable::getInstance(board, version, variant, flags), "Source"),
|
||||
ConversionField< UnsignedField<N> >(_source, SourcesConversionTable::getInstance(board, version, variant, flags),
|
||||
"Source", "Source "+ source.toString(ModelData())+" cannot be exported on this board!"),
|
||||
source(source),
|
||||
_source(0)
|
||||
{
|
||||
@@ -1133,7 +1151,7 @@ class InputField: public TransformedField {
|
||||
|
||||
virtual void beforeExport()
|
||||
{
|
||||
_weight = smallGvarToEEPROM(expo.weight);
|
||||
_weight = smallGvarToEEPROM(expo.weight);
|
||||
|
||||
if (!IS_TARANIS(board) || version < 216) {
|
||||
if (expo.curve.type==CurveReference::CURVE_REF_FUNC && expo.curve.value) {
|
||||
@@ -1188,19 +1206,43 @@ class InputField: public TransformedField {
|
||||
|
||||
class LimitField: public StructField {
|
||||
public:
|
||||
template <int shift>
|
||||
static int exportLimitValue(int value)
|
||||
{
|
||||
if (value > 10000)
|
||||
return 4095 + value - 10000;
|
||||
else if (value < -10000)
|
||||
return -4096 + value + 10000;
|
||||
else
|
||||
return value + shift;
|
||||
}
|
||||
|
||||
template <int shift>
|
||||
static int importLimitValue(int value)
|
||||
{
|
||||
if (value > 4095)
|
||||
return 10000 + value - 4095;
|
||||
else if (value < -4096)
|
||||
return -10000 + value + 4096;
|
||||
else
|
||||
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)) {
|
||||
@@ -1255,14 +1297,14 @@ class CurvesField: public TransformedField {
|
||||
if (IS_TARANIS(board) && version >= 216) {
|
||||
offset += (curve->type == CurveData::CURVE_TYPE_CUSTOM ? curve->count * 2 - 2 : curve->count);
|
||||
if (offset > maxPoints) {
|
||||
EEPROMWarnings += ::QObject::tr("OpenTX only accepts %1 points in all curves").arg(maxPoints) + "\n";
|
||||
EEPROMWarnings.push_back(::QObject::tr("OpenTX only accepts %1 points in all curves").arg(maxPoints));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
offset += (curve->type == CurveData::CURVE_TYPE_CUSTOM ? curve->count * 2 - 2 : curve->count) - 5;
|
||||
if (offset > maxPoints - 5 * maxCurves) {
|
||||
EEPROMWarnings += ::QObject::tr("OpenTx only accepts %1 points in all curves").arg(maxPoints) + "\n";
|
||||
EEPROMWarnings.push_back(::QObject::tr("OpenTx only accepts %1 points in all curves").arg(maxPoints));
|
||||
break;
|
||||
}
|
||||
_curves[i] = offset;
|
||||
@@ -1544,9 +1586,25 @@ class LogicalSwitchField: public TransformedField {
|
||||
else if (csw.func >= LS_FN_EQUAL && csw.func <= LS_FN_ELESS) {
|
||||
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
|
||||
sourcesConversionTable->importValue((uint8_t)v2, csw.val2);
|
||||
if (IS_TARANIS(board) && version < 216) {
|
||||
RawSource val1(csw.val1);
|
||||
if (val1.type == SOURCE_TYPE_STICK && val1.index < NUM_STICKS) {
|
||||
csw.val1 = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, val1.index).toValue();
|
||||
}
|
||||
RawSource val2(csw.val2);
|
||||
if (val2.type == SOURCE_TYPE_STICK && val2.index < NUM_STICKS) {
|
||||
csw.val2 = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, val2.index).toValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (csw.func != LS_FN_OFF) {
|
||||
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
|
||||
if (IS_TARANIS(board) && version < 216) {
|
||||
RawSource val1(csw.val1);
|
||||
if (val1.type == SOURCE_TYPE_STICK && val1.index < NUM_STICKS) {
|
||||
csw.val1 = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, val1.index).toValue();
|
||||
}
|
||||
}
|
||||
csw.val2 = v2;
|
||||
RawSource val1(csw.val1);
|
||||
if (IS_ARM(board) && version < 216 && val1.type == SOURCE_TYPE_TELEMETRY) {
|
||||
@@ -2335,10 +2393,9 @@ class FrskyField: public StructField {
|
||||
Append(new UnsignedField<3>(frsky.varioSource));
|
||||
Append(new SignedField<5>(frsky.varioCenterMin));
|
||||
Append(new ConversionField< UnsignedField<3> >(frsky.currentSource, &telemetryCurrentSourceConversionTable, "Current Source"));
|
||||
Append(new SignedField<8>(frsky.varioCenterMax));
|
||||
Append(new SignedField<5>(frsky.varioCenterMax));
|
||||
if (version >= 216) {
|
||||
// TODO int8_t fasOffset;
|
||||
Append(new SpareBitsField<8>());
|
||||
Append(new SignedField<8>(frsky.fasOffset));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2394,7 +2451,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
|
||||
}
|
||||
|
||||
for (int i=0; i<O9X_MAX_TIMERS; i++) {
|
||||
internalField.Append(new SwitchField<8>(modelData.timers[i].mode, board, version, POPULATE_TIMER_MODES));
|
||||
internalField.Append(new SwitchField<8>(modelData.timers[i].mode, board, version, true));
|
||||
if ((IS_ARM(board) || IS_2560(board)) && version >= 216) {
|
||||
internalField.Append(new UnsignedField<16>(modelData.timers[i].val));
|
||||
internalField.Append(new UnsignedField<2>(modelData.timers[i].countdownBeep));
|
||||
@@ -2428,7 +2485,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
|
||||
if (IS_ARM(board))
|
||||
internalField.Append(new UnsignedField<3>(modelData.telemetryProtocol));
|
||||
else
|
||||
internalField.Append(new ConversionField< UnsignedField<3> >((unsigned int &)modelData.moduleData[0].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this protocol")));
|
||||
internalField.Append(new ConversionField< UnsignedField<3> >((unsigned int &)modelData.moduleData[0].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this telemetry protocol")));
|
||||
|
||||
internalField.Append(new BoolField<1>(modelData.thrTrim));
|
||||
|
||||
@@ -2532,12 +2589,12 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
|
||||
|
||||
if (IS_TARANIS(board)) {
|
||||
modulesCount = 3;
|
||||
internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[1].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this protocol")));
|
||||
internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[1].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this radio protocol")));
|
||||
internalField.Append(new UnsignedField<8>(modelData.trainerMode));
|
||||
}
|
||||
else if (IS_ARM(board) && version >= 216) {
|
||||
modulesCount = 3;
|
||||
internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[0].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this protocol")));
|
||||
internalField.Append(new ConversionField< SignedField<8> >(modelData.moduleData[0].protocol, &protocolsConversionTable, "Protocol", ::QObject::tr("OpenTX doesn't accept this radio protocol")));
|
||||
}
|
||||
|
||||
if (IS_ARM(board) && version >= 215) {
|
||||
@@ -2757,8 +2814,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
|
||||
|
||||
@@ -163,8 +163,20 @@ bool OpenTxEepromInterface::loadModelVariant(unsigned int index, ModelData &mode
|
||||
}
|
||||
else {
|
||||
// load from SD Backup, size is stored in index
|
||||
QByteArray eepromData((char *)data, index);
|
||||
open9xModel.Import(eepromData);
|
||||
QByteArray backupData((char *)data, index);
|
||||
QByteArray modelData;
|
||||
if (IS_SKY9X(board))
|
||||
modelData = backupData;
|
||||
else
|
||||
importRlc(modelData, backupData);
|
||||
if (modelData.size()) {
|
||||
open9xModel.Import(modelData);
|
||||
// open9xModel.Dump();
|
||||
model.used = true;
|
||||
}
|
||||
else {
|
||||
model.clear();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -402,10 +414,21 @@ int OpenTxEepromInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t
|
||||
}
|
||||
}
|
||||
|
||||
if (!EEPROMWarnings.isEmpty())
|
||||
if (!EEPROMWarnings.empty()) {
|
||||
QString msg;
|
||||
int noErrorsToDisplay = std::min((int)EEPROMWarnings.size(),10);
|
||||
for (int n = 0; n < noErrorsToDisplay; n++) {
|
||||
msg += "-" + EEPROMWarnings.front() + "\n";
|
||||
EEPROMWarnings.pop_front();
|
||||
}
|
||||
if (!EEPROMWarnings.empty()) {
|
||||
msg = QObject::tr("(displaying only first 10 warnings)") + "\n" + msg;
|
||||
}
|
||||
EEPROMWarnings.clear();
|
||||
QMessageBox::warning(NULL,
|
||||
QObject::tr("Warning"),
|
||||
QObject::tr("EEPROM saved with these warnings:") + "\n- " + EEPROMWarnings.remove(EEPROMWarnings.length()-1, 1).replace("\n", "\n- "));
|
||||
QObject::tr("EEPROM saved with these warnings:") + "\n" + msg);
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
@@ -557,7 +580,7 @@ int OpenTxFirmware::getCapability(const Capability capability)
|
||||
else
|
||||
return 16;
|
||||
case SafetyChannelCustomFunction:
|
||||
return id.contains("nosafetych") ? 0 : 1;
|
||||
return id.contains("noovveridech") ? 0 : 1;
|
||||
case LogicalSwitches:
|
||||
if (IS_ARM(board))
|
||||
return 32;
|
||||
@@ -621,7 +644,7 @@ int OpenTxFirmware::getCapability(const Capability capability)
|
||||
case HasCvNames:
|
||||
return (IS_TARANIS(board) ? 1 : 0);
|
||||
case Telemetry:
|
||||
if (board == BOARD_GRUVIN9X || IS_ARM(board) || id.contains("frsky"))
|
||||
if (board == BOARD_GRUVIN9X || IS_ARM(board) || id.contains("frsky") || id.contains("telemetrez"))
|
||||
return TM_HASTELEMETRY|TM_HASOFFSET|TM_HASWSHH;
|
||||
else
|
||||
return 0;
|
||||
@@ -640,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:
|
||||
@@ -910,11 +935,32 @@ bool OpenTxEepromInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, in
|
||||
{
|
||||
std::cout << "trying " << getName() << " backup import...";
|
||||
|
||||
if (esize < 8 || memcmp(eeprom, "o9x", 3) != 0 || eeprom[3] != 0x30+board) {
|
||||
if (esize < 8 || memcmp(eeprom, "o9x", 3) != 0) {
|
||||
std::cout << " no\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
BoardEnum backupBoard = (BoardEnum)-1;
|
||||
switch (eeprom[3]) {
|
||||
case 0x33:
|
||||
backupBoard = BOARD_TARANIS;
|
||||
break;
|
||||
case 0x32:
|
||||
backupBoard = BOARD_SKY9X;
|
||||
break;
|
||||
case 0x31:
|
||||
backupBoard = BOARD_GRUVIN9X;
|
||||
break;
|
||||
default:
|
||||
std::cout << " unknown board\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (backupBoard != board) {
|
||||
std::cout << " not right board\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t version = eeprom[4];
|
||||
uint8_t bcktype = eeprom[5];
|
||||
uint16_t size = ((uint16_t)eeprom[7] << 8) + eeprom[6];
|
||||
@@ -1007,8 +1053,8 @@ void addOpenTxCommonOptions(OpenTxFirmware * firmware)
|
||||
{
|
||||
firmware->addOption("ppmus", QObject::tr("Channel values displayed in us"));
|
||||
firmware->addOption("sqt5font", QObject::tr("Use alternative SQT5 font"));
|
||||
firmware->addOption("nosafetych", QObject::tr("No SafetyCH functions available"));
|
||||
Option fai_options[] = { { "faichoice", QObject::tr("Possibility to enable FAI MODE at field") }, { "faimode", QObject::tr("FAI MODE always enabled") }, { NULL } };
|
||||
firmware->addOption("nooverridech", QObject::tr("No OverrideCH functions available"));
|
||||
Option fai_options[] = { { "faichoice", QObject::tr("Possibility to enable FAI MODE (no telemetry) at field") }, { "faimode", QObject::tr("FAI MODE (no telemetry) always enabled") }, { NULL } };
|
||||
firmware->addOptions(fai_options);
|
||||
}
|
||||
|
||||
@@ -1051,7 +1097,6 @@ void registerOpenTxFirmwares()
|
||||
openTx->addOption("novario", QObject::tr("No vario support"));
|
||||
openTx->addOption("nogps", QObject::tr("No GPS support"));
|
||||
openTx->addOption("nogauges", QObject::tr("No gauges in the custom telemetry screen"));
|
||||
openTx->addOption("nosafetych", QObject::tr("No SafetyCH functions available"));
|
||||
openTx->addOption("fasoffset", QObject::tr("Allow compensating for offset errors in FrSky FAS current sensors"));
|
||||
openTx->addOption("stickrev", QObject::tr("Add support for reversing stick inputs (e.g. needed for FrSky gimbals)"));
|
||||
addOpenTxCommonOptions(openTx);
|
||||
@@ -1219,6 +1264,7 @@ void registerOpenTxFirmwares()
|
||||
openTx->addOption("nogvars", QObject::tr("Disable Global variables"));
|
||||
openTx->addOption("haptic", QObject::tr("Haptic module installed"));
|
||||
openTx->addOption("lua", QObject::tr("Support for Lua model scripts"));
|
||||
openTx->addOption("nojoystick", QObject::tr("No Joystick emulation inside the FW (only Mass Storage as in the Bootloader)"));
|
||||
addOpenTxCommonOptions(openTx);
|
||||
firmwares.push_back(openTx);
|
||||
|
||||
@@ -1227,10 +1273,11 @@ void registerOpenTxFirmwares()
|
||||
openTx->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
|
||||
openTx->addOption("nogvars", QObject::tr("Disable Global variables"));
|
||||
openTx->addOption("lua", QObject::tr("Support for Lua model scripts"));
|
||||
openTx->addOption("nojoystick", QObject::tr("No Joystick emulation inside the FW (only Mass Storage as in the Bootloader)"));
|
||||
addOpenTxCommonOptions(openTx);
|
||||
firmwares.push_back(openTx);
|
||||
|
||||
default_firmware_variant = GetFirmware("opentx-9x-heli-templates-en");
|
||||
default_firmware_variant = GetFirmware("opentx-taranis-en");
|
||||
current_firmware_variant = default_firmware_variant;
|
||||
}
|
||||
|
||||
|
||||
@@ -124,8 +124,8 @@ t_Th9xLimitData::t_Th9xLimitData()
|
||||
t_Th9xLimitData::operator LimitData ()
|
||||
{
|
||||
LimitData c9x;
|
||||
c9x.min = min-100;
|
||||
c9x.max = max+100;
|
||||
c9x.min = 10*(min-100);
|
||||
c9x.max = 10*(max+100);
|
||||
c9x.revert = revert;
|
||||
c9x.offset = offset;
|
||||
return c9x;
|
||||
@@ -197,7 +197,7 @@ int8_t t_Th9xLogicalSwitchData::fromSource(RawSource source)
|
||||
if (source.type == SOURCE_TYPE_STICK)
|
||||
v1 = 1+source.index;
|
||||
else if (source.type == SOURCE_TYPE_ROTARY_ENCODER) {
|
||||
EEPROMWarnings += ::QObject::tr("th9x on this board doesn't have Rotary Encoders") + "\n";
|
||||
EEPROMWarnings.push_back(::QObject::tr("th9x on this board doesn't have Rotary Encoders"));
|
||||
v1 = 5+source.index;
|
||||
}
|
||||
else if (source.type == SOURCE_TYPE_MAX)
|
||||
@@ -272,7 +272,6 @@ t_Th9xModelData::operator ModelData ()
|
||||
/*c9x.protocol = (Protocol)protocol;
|
||||
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
|
||||
c9x.thrTrim = thrTrim;
|
||||
c9x.thrExpo = thrExpo;
|
||||
c9x.trimInc = trimInc;
|
||||
c9x.moduleData[0].ppmDelay = 300 + 50 * ppmDelay;
|
||||
c9x.funcSw[0].func = FuncTrims2Offsets;
|
||||
|
||||
@@ -275,7 +275,10 @@ These will be relevant for all models in the same EEPROM.</string>
|
||||
<item>
|
||||
<widget class="QSlider" name="backlightColor_SL">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@@ -3195,7 +3198,7 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pot (normal)</string>
|
||||
<string>Pot with detent (normal)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@@ -3203,6 +3206,11 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Multipos Switch</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pot without detent</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
@@ -3236,7 +3244,7 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pot (normal)</string>
|
||||
<string>Pot with detent (normal)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@@ -3244,6 +3252,11 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Multipos Switch</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pot without detent</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
@@ -3284,7 +3297,7 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pot (normal)</string>
|
||||
<string>Pot with detent (normal)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@@ -3292,6 +3305,11 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Multipos Switch</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pot without detent</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
|
||||
+139
-48
@@ -1,4 +1,11 @@
|
||||
#include <QtGui>
|
||||
#if defined WIN32
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#if !defined WIN32 && defined __GNUC__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include "appdata.h"
|
||||
#include "helpers.h"
|
||||
#include "simulatordialog.h"
|
||||
@@ -140,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()));
|
||||
@@ -163,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(step*mini);
|
||||
sb->setMaximum(step*maxi);
|
||||
sb->setValue(step*val);
|
||||
}
|
||||
else {
|
||||
dsb->setMinimum(step*mini);
|
||||
dsb->setMaximum(step*maxi);
|
||||
dsb->setValue(step*val);
|
||||
}
|
||||
|
||||
connect(weightSB, SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
|
||||
|
||||
lock = false;
|
||||
@@ -186,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()/step;
|
||||
else
|
||||
weight = dsb->value()/step;
|
||||
}
|
||||
}
|
||||
|
||||
CurveGroup::CurveGroup(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueSB, CurveReference & curve, unsigned int flags):
|
||||
@@ -216,7 +241,7 @@ CurveGroup::CurveGroup(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox
|
||||
|
||||
curveValueCB->setMaxVisibleItems(10);
|
||||
|
||||
connect(curveTypeCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
|
||||
connect(curveTypeCB, SIGNAL(currentIndexChanged(int)), this, SLOT(typeChanged(int)));
|
||||
connect(curveGVarCB, SIGNAL(stateChanged(int)), this, SLOT(gvarCBChanged(int)));
|
||||
connect(curveValueCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
|
||||
connect(curveValueSB, SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
|
||||
@@ -300,6 +325,28 @@ void CurveGroup::gvarCBChanged(int state)
|
||||
}
|
||||
}
|
||||
|
||||
void CurveGroup::typeChanged(int value)
|
||||
{
|
||||
if (!lock) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
curve = CurveReference(CurveReference::CURVE_REF_DIFF, 0);
|
||||
break;
|
||||
case 1:
|
||||
curve = CurveReference(CurveReference::CURVE_REF_EXPO, 0);
|
||||
break;
|
||||
case 2:
|
||||
curve = CurveReference(CurveReference::CURVE_REF_FUNC, 0);
|
||||
break;
|
||||
case 3:
|
||||
curve = CurveReference(CurveReference::CURVE_REF_CUSTOM, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void CurveGroup::valuesChanged()
|
||||
{
|
||||
if (!lock) {
|
||||
@@ -349,13 +396,13 @@ void populateBacklightCB(QComboBox *b, const uint8_t value)
|
||||
}
|
||||
}
|
||||
|
||||
void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, unsigned long attr)
|
||||
void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, SwitchContext context)
|
||||
{
|
||||
RawSwitch item;
|
||||
|
||||
b->clear();
|
||||
|
||||
if (attr & POPULATE_ONOFF) {
|
||||
if (context != MixesContext) {
|
||||
// !FMx
|
||||
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||
for (int i=-GetCurrentFirmware()->getCapability(FlightModes); i<0; i++) {
|
||||
@@ -364,14 +411,6 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
}
|
||||
// !One
|
||||
item = RawSwitch(SWITCH_TYPE_ONE, 1);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
// OFF
|
||||
item = RawSwitch(SWITCH_TYPE_OFF);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
for (int i=-GetCurrentFirmware()->getCapability(LogicalSwitches); i<0; i++) {
|
||||
@@ -406,13 +445,13 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
||||
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
|
||||
if (IS_TARANIS(GetCurrentFirmware()->getBoard())) {
|
||||
//hide up and down for !SH and !SF, because they are redundant (!SFup == SFdown)
|
||||
if (item.toString().contains("H") || item.toString().contains("F")) continue;
|
||||
if (item.toString().contains("H") || item.toString().contains("F")) continue;
|
||||
}
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
if (attr & POPULATE_TIMER_MODES) {
|
||||
if (context == TimersContext) {
|
||||
for (int i=0; i<5; i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_TIMER_MODE, i);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
@@ -459,7 +498,7 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
}
|
||||
|
||||
if (attr & POPULATE_ONOFF) {
|
||||
if (context == CustomFunctionsContext) {
|
||||
// ON
|
||||
item = RawSwitch(SWITCH_TYPE_ON);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
@@ -468,7 +507,10 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
|
||||
item = RawSwitch(SWITCH_TYPE_ONE, 1);
|
||||
b->addItem(item.toString(), item.toValue());
|
||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||
// FMx
|
||||
}
|
||||
|
||||
// FMx
|
||||
if (context != MixesContext) {
|
||||
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||
for (int i=1; i<=GetCurrentFirmware()->getCapability(FlightModes); i++) {
|
||||
item = RawSwitch(SWITCH_TYPE_FLIGHT_MODE, i);
|
||||
@@ -760,19 +802,35 @@ QString getFrSkySrc(int index)
|
||||
|
||||
QString getTrimInc(ModelData * g_model)
|
||||
{
|
||||
switch (g_model->trimInc) {
|
||||
case (1): return QObject::tr("Extra Fine");
|
||||
case (2): return QObject::tr("Fine");
|
||||
case (3): return QObject::tr("Medium");
|
||||
case (4): return QObject::tr("Coarse");
|
||||
default: return QObject::tr("Exponential");
|
||||
}
|
||||
switch (g_model->trimInc) {
|
||||
case -2:
|
||||
return QObject::tr("Exponential");
|
||||
case -1:
|
||||
return QObject::tr("Extra Fine");
|
||||
case 0:
|
||||
return QObject::tr("Fine");
|
||||
case 1:
|
||||
return QObject::tr("Medium");
|
||||
case 2:
|
||||
return QObject::tr("Coarse");
|
||||
default:
|
||||
return QObject::tr("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
QString getTimerStr(TimerData & timer)
|
||||
{
|
||||
QString str = ", " + (timer.dir ? QObject::tr("Count Up") : QObject::tr("Count Down"));
|
||||
return QObject::tr("%1:%2, ").arg(timer.val/60, 2, 10, QChar('0')).arg(timer.val%60, 2, 10, QChar('0')) + timer.mode.toString() + str;
|
||||
QString result = QObject::tr("%1:%2").arg(timer.val/60, 2, 10, QChar('0')).arg(timer.val%60, 2, 10, QChar('0'));
|
||||
result += QString(", ") + timer.mode.toString();
|
||||
if (timer.persistent)
|
||||
result += QObject::tr(", Persistent");
|
||||
if (timer.minuteBeep)
|
||||
result += QObject::tr(", MinuteBeep");
|
||||
if (timer.countdownBeep == 1)
|
||||
result += QObject::tr(", CountDown(Beeps)");
|
||||
else if (timer.countdownBeep == 2)
|
||||
result += QObject::tr(", CountDown(Voice)");
|
||||
return result;
|
||||
}
|
||||
|
||||
QString getProtocol(ModelData * g_model)
|
||||
@@ -813,18 +871,37 @@ QString getPhasesStr(unsigned int phases, ModelData & model)
|
||||
}
|
||||
}
|
||||
|
||||
QString getCenterBeep(ModelData * g_model)
|
||||
QString getCenterBeepStr(ModelData * g_model)
|
||||
{
|
||||
//RETA123
|
||||
QStringList strl;
|
||||
if(g_model->beepANACenter & 0x01) strl << QObject::tr("Rudder");
|
||||
if(g_model->beepANACenter & 0x02) strl << QObject::tr("Elevator");
|
||||
if(g_model->beepANACenter & 0x04) strl << QObject::tr("Throttle");
|
||||
if(g_model->beepANACenter & 0x08) strl << QObject::tr("Aileron");
|
||||
if(g_model->beepANACenter & 0x10) strl << "P1";
|
||||
if(g_model->beepANACenter & 0x20) strl << "P2";
|
||||
if(g_model->beepANACenter & 0x40) strl << "P3";
|
||||
if(g_model->beepANACenter & 0x80) strl << "LS";
|
||||
if (g_model->beepANACenter & 0x01)
|
||||
strl << QObject::tr("Rudder");
|
||||
if (g_model->beepANACenter & 0x02)
|
||||
strl << QObject::tr("Elevator");
|
||||
if (g_model->beepANACenter & 0x04)
|
||||
strl << QObject::tr("Throttle");
|
||||
if (g_model->beepANACenter & 0x08)
|
||||
strl << QObject::tr("Aileron");
|
||||
if (IS_TARANIS(GetCurrentFirmware()->getBoard())) {
|
||||
if (g_model->beepANACenter & 0x10)
|
||||
strl << "S1";
|
||||
if (g_model->beepANACenter & 0x20)
|
||||
strl << "S2";
|
||||
if (g_model->beepANACenter & 0x40)
|
||||
strl << "S3";
|
||||
if (g_model->beepANACenter & 0x80)
|
||||
strl << "LS";
|
||||
if (g_model->beepANACenter & 0x100)
|
||||
strl << "RS";
|
||||
}
|
||||
else {
|
||||
if (g_model->beepANACenter & 0x10)
|
||||
strl << "P1";
|
||||
if (g_model->beepANACenter & 0x20)
|
||||
strl << "P2";
|
||||
if (g_model->beepANACenter & 0x40)
|
||||
strl << "P3";
|
||||
}
|
||||
return strl.join(", ");
|
||||
}
|
||||
|
||||
@@ -942,3 +1019,17 @@ QString index2version(int index)
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
int qunlink(const QString & fileName)
|
||||
{
|
||||
qDebug() << "unlinking "<< fileName;
|
||||
QByteArray ba = fileName.toLatin1();
|
||||
return unlink(ba.constData());
|
||||
}
|
||||
|
||||
QString generateProcessUniqueTempFileName(const QString & fileName)
|
||||
{
|
||||
QString sanitizedFileName = fileName;
|
||||
sanitizedFileName.remove('/');
|
||||
return QDir::tempPath() + QString("/%1-").arg(QCoreApplication::applicationPid()) + sanitizedFileName;
|
||||
}
|
||||
|
||||
+22
-9
@@ -6,7 +6,7 @@
|
||||
|
||||
extern const QColor colors[C9X_MAX_CURVES];
|
||||
|
||||
#define TMR_NUM_OPTION (TMR_VAROFS+2*9+2*GetCurrentFirmware()->getCapability(LogicalSwitches)-1)
|
||||
#define TMR_NUM_OPTION (TMRMODE_COUNT+2*9+2*GetCurrentFirmware()->getCapability(LogicalSwitches)-1)
|
||||
|
||||
//convert from mode 1 to mode generalSettings.stickMode
|
||||
//NOTICE! => 1..4 -> 1..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, bool allowGVars=true);
|
||||
|
||||
protected slots:
|
||||
void gvarCBChanged(int);
|
||||
@@ -50,10 +50,12 @@ 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;
|
||||
};
|
||||
|
||||
@@ -67,6 +69,7 @@ class CurveGroup : public QObject {
|
||||
|
||||
protected slots:
|
||||
void gvarCBChanged(int);
|
||||
void typeChanged(int);
|
||||
void valuesChanged();
|
||||
|
||||
protected:
|
||||
@@ -80,9 +83,15 @@ class CurveGroup : public QObject {
|
||||
int lastType;
|
||||
};
|
||||
|
||||
#define POPULATE_ONOFF 0x01
|
||||
#define POPULATE_TIMER_MODES 0x02
|
||||
void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, unsigned long attr=0);
|
||||
enum SwitchContext
|
||||
{
|
||||
LogicalSwitchesContext,
|
||||
CustomFunctionsContext,
|
||||
TimersContext,
|
||||
MixesContext
|
||||
};
|
||||
|
||||
void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, SwitchContext context);
|
||||
|
||||
void populatePhasesCB(QComboBox *b, int value);
|
||||
void populateGvarUseCB(QComboBox *b, unsigned int phase);
|
||||
@@ -113,7 +122,7 @@ int findmult(float value, float base);
|
||||
QString getTrimInc(ModelData * g_model);
|
||||
QString getTimerStr(TimerData & timer);
|
||||
QString getProtocol(ModelData * g_model);
|
||||
QString getCenterBeep(ModelData * g_model);
|
||||
QString getCenterBeepStr(ModelData * g_model);
|
||||
|
||||
/* FrSky helpers */
|
||||
QString getFrSkyAlarmType(int alarm);
|
||||
@@ -138,4 +147,8 @@ class QTimeS : public QTime
|
||||
int seconds() const { return hour()*3600 + minute()*60 + second(); };
|
||||
};
|
||||
|
||||
int qunlink(const QString & fileName);
|
||||
|
||||
QString generateProcessUniqueTempFileName(const QString & fileName);
|
||||
|
||||
#endif // HELPERS_H
|
||||
|
||||
@@ -239,13 +239,13 @@ void logsDialog::on_mapsButton_clicked() {
|
||||
itemSelected=n-1;
|
||||
}
|
||||
|
||||
QString geFilename = QDir::tempPath() + "/track0.png";
|
||||
if (QFile::exists(geFilename)) {
|
||||
QFile::remove(geFilename);
|
||||
QString geIconFilename = generateProcessUniqueTempFileName("track0.png");
|
||||
if (QFile::exists(geIconFilename)) {
|
||||
QFile::remove(geIconFilename);
|
||||
}
|
||||
QFile::copy(":/images/track0.png", geFilename);
|
||||
QFile::copy(":/images/track0.png", geIconFilename);
|
||||
|
||||
geFilename = QDir::tempPath() + "/flight.kml";
|
||||
QString geFilename = generateProcessUniqueTempFileName("flight.kml");
|
||||
if (QFile::exists(geFilename)) {
|
||||
QFile::remove(geFilename);
|
||||
}
|
||||
@@ -264,7 +264,7 @@ void logsDialog::on_mapsButton_clicked() {
|
||||
QTextStream outputStream(&geFile);
|
||||
outputStream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<kml xmlns=\"http://www.opengis.net/kml/2.2\" xmlns:gx=\"http://www.google.com/kml/ext/2.2\">\n";
|
||||
outputStream << "\t<Document>\n\t\t<name>" << logFilename << "</name>\n";
|
||||
outputStream << "\t\t<Style id=\"multiTrack_n\">\n\t\t\t<IconStyle>\n\t\t\t\t<Icon>\n\t\t\t\t\t<href>file://" << QDir::tempPath() << "/track0.png</href>\n\t\t\t\t</Icon>\n\t\t\t</IconStyle>\n\t\t\t<LineStyle>\n\t\t\t\t<color>991081f4</color>\n\t\t\t\t<width>6</width>\n\t\t\t</LineStyle>\n\t\t</Style>\n";
|
||||
outputStream << "\t\t<Style id=\"multiTrack_n\">\n\t\t\t<IconStyle>\n\t\t\t\t<Icon>\n\t\t\t\t\t<href>file://" << geIconFilename << "</href>\n\t\t\t\t</Icon>\n\t\t\t</IconStyle>\n\t\t\t<LineStyle>\n\t\t\t\t<color>991081f4</color>\n\t\t\t\t<width>6</width>\n\t\t\t</LineStyle>\n\t\t</Style>\n";
|
||||
outputStream << "\t\t<Style id=\"multiTrack_h\">\n\t\t\t<IconStyle>\n\t\t\t\t<scale>0</scale>\n\t\t\t\t<Icon>\n\t\t\t\t\t<href>file://" << QDir::tempPath() << "/track0.png</href>\n\t\t\t\t</Icon>\n\t\t\t</IconStyle>\n\t\t\t<LineStyle>\n\t\t\t\t<color>991081f4</color>\n\t\t\t\t<width>8</width>\n\t\t\t</LineStyle>\n\t\t</Style>\n";
|
||||
outputStream << "\t\t<StyleMap id=\"multiTrack\">\n\t\t\t<Pair>\n\t\t\t\t<key>normal</key>\n\t\t\t\t<styleUrl>#multiTrack_n</styleUrl>\n\t\t\t</Pair>\n\t\t\t<Pair>\n\t\t\t\t<key>highlight</key>\n\t\t\t\t<styleUrl>#multiTrack_h</styleUrl>\n\t\t\t</Pair>\n\t\t</StyleMap>\n";
|
||||
outputStream << "\t\t<Style id=\"lineStyle\">\n\t\t\t<LineStyle>\n\t\t\t\t<color>991081f4</color>\n\t\t\t\t<width>6</width>\n\t\t\t</LineStyle>\n\t\t</Style>\n";
|
||||
|
||||
@@ -804,9 +804,9 @@ QStringList MainWindow::GetSambaArguments(const QString &tcl)
|
||||
{
|
||||
QStringList result;
|
||||
|
||||
QString tclFilename = QDir::tempPath() + "/temp.tcl";
|
||||
QString tclFilename = generateProcessUniqueTempFileName("temp.tcl");
|
||||
if (QFile::exists(tclFilename)) {
|
||||
unlink(tclFilename.toAscii());
|
||||
qunlink(tclFilename);
|
||||
}
|
||||
QFile tclFile(tclFilename);
|
||||
if (!tclFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
@@ -946,21 +946,23 @@ QString MainWindow::FindMassstoragePath(QString filename)
|
||||
|
||||
void MainWindow::readEeprom()
|
||||
{
|
||||
QString tempDir = QDir::tempPath();
|
||||
QString tempFile;
|
||||
|
||||
EEPROMInterface *eepromInterface = GetEepromInterface();
|
||||
|
||||
if (IS_ARM(eepromInterface->getBoard()))
|
||||
tempFile = tempDir + "/temp.bin";
|
||||
tempFile = generateProcessUniqueTempFileName("temp.bin");
|
||||
else
|
||||
tempFile = tempDir + "/temp.hex";
|
||||
tempFile += generateProcessUniqueTempFileName("temp.hex");
|
||||
|
||||
qDebug() << "MainWindow::readEeprom(): using temp file: " << tempFile;
|
||||
|
||||
if (readEepromFromRadio(tempFile, tr("Read Models and Settings From Radio"))) {
|
||||
MdiChild *child = createMdiChild();
|
||||
child->newFile();
|
||||
child->loadFile(tempFile, false);
|
||||
child->show();
|
||||
qunlink(tempFile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1042,7 +1044,10 @@ bool MainWindow::readEepromFromRadio(const QString filename, const QString messa
|
||||
|
||||
QFile file(filename);
|
||||
if (file.exists()) {
|
||||
file.remove();
|
||||
if (!file.remove()) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Could not delete temporary file: %1").arg(filename));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_ARM(GetCurrentFirmware()->getBoard())) {
|
||||
@@ -1165,13 +1170,12 @@ void MainWindow::writeBackup()
|
||||
return;
|
||||
}
|
||||
int oldrev = getEpromVersion(fileName);
|
||||
QString tempDir = QDir::tempPath();
|
||||
QString tempFlash = tempDir + "/flash.bin";
|
||||
QString tempFlash = generateProcessUniqueTempFileName("flash.bin");
|
||||
|
||||
if (!readFirmwareFromRadio(tempFlash))
|
||||
return;
|
||||
|
||||
QString restoreFile = tempDir + "/compat.bin";
|
||||
QString restoreFile = generateProcessUniqueTempFileName("compat.bin");
|
||||
if (!convertEEPROM(fileName, restoreFile, tempFlash)) {
|
||||
int ret = QMessageBox::question(this, "Error", tr("Cannot check Models and Settings compatibility! Continue anyway?") ,
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
@@ -1188,9 +1192,7 @@ void MainWindow::writeBackup()
|
||||
}
|
||||
fileName = restoreFile;
|
||||
}
|
||||
QByteArray ba = tempFlash.toLatin1();
|
||||
char *name = ba.data();
|
||||
unlink(name);
|
||||
qunlink(tempFlash);
|
||||
}
|
||||
else {
|
||||
if (backupEnable) {
|
||||
@@ -1304,8 +1306,7 @@ void MainWindow::writeFlash(QString fileToFlash)
|
||||
if (!fileName.isEmpty()) {
|
||||
g.backupOnFlash(backup);
|
||||
if (backup) {
|
||||
QString tempDir = QDir::tempPath();
|
||||
QString backupFile = tempDir + "/backup.bin";
|
||||
QString backupFile = generateProcessUniqueTempFileName("backup.bin");
|
||||
bool backupEnable=g.enableBackup();
|
||||
QString backupPath=g.backupDir();
|
||||
if (!backupPath.isEmpty() && !IS_TARANIS(GetEepromInterface()->getBoard())) {
|
||||
@@ -1330,7 +1331,7 @@ void MainWindow::writeFlash(QString fileToFlash)
|
||||
sleep(2);
|
||||
int res = writeFirmwareToRadio(fileName);
|
||||
if (res) {
|
||||
QString restoreFile = tempDir + "/restore.bin";
|
||||
QString restoreFile = generateProcessUniqueTempFileName("restore.bin");
|
||||
if (!convertEEPROM(backupFile, restoreFile, fileName)) {
|
||||
QMessageBox::warning(this, tr("Conversion failed"), tr("Cannot convert Models and Settings for use with this firmware, original data will be used"));
|
||||
restoreFile = backupFile;
|
||||
@@ -1596,7 +1597,7 @@ void MainWindow::createActions()
|
||||
writeEepromAct = addAct("write_eeprom.png", tr("Write Models and Settings To Radio"), tr("Write Models and Settings to Radio"), SLOT(writeEeprom()));
|
||||
readEepromAct = addAct("read_eeprom.png", tr("Read Models and Settings From Radio"), tr("Read Models and Settings from Radio"), SLOT(readEeprom()));
|
||||
burnConfigAct = addAct("configure.png", tr("Configure Communications..."), tr("Configure software for communicating with the Radio"), SLOT(burnConfig()));
|
||||
writeBackupToRadioAct = addAct("write_eeprom_file.png", tr("Write Backup to Radio"), tr("Write Backup from file to to Radio"), SLOT(writeBackup()));
|
||||
writeBackupToRadioAct = addAct("write_eeprom_file.png", tr("Write Backup to Radio"), tr("Write Backup from file to Radio"), SLOT(writeBackup()));
|
||||
readBackupToFileAct = addAct("read_eeprom_file.png", tr("Backup Radio to File"), tr("Save a complete backup file of all settings and model data in the Radio"), SLOT(readBackup()));
|
||||
contributorsAct = addAct("contributors.png", tr("Contributors..."), tr("A tribute to those who have contributed to OpenTX and Companion"), SLOT(contributors()));
|
||||
|
||||
|
||||
@@ -531,8 +531,7 @@ void MdiChild::writeEeprom() // write to Tx
|
||||
}
|
||||
QString stickCal=g.profile[g.id()].stickPotCalib();
|
||||
burnConfigDialog bcd;
|
||||
QString tempDir = QDir::tempPath();
|
||||
QString tempFile = tempDir + "/temp.bin";
|
||||
QString tempFile = generateProcessUniqueTempFileName("temp.bin");
|
||||
saveFile(tempFile, false);
|
||||
if(!QFileInfo(tempFile).exists()) {
|
||||
QMessageBox::critical(this,tr("Error"), tr("Cannot write temporary file!"));
|
||||
@@ -550,12 +549,12 @@ void MdiChild::writeEeprom() // write to Tx
|
||||
return;
|
||||
}
|
||||
int oldrev=((MainWindow *)this->parent())->getEpromVersion(tempFile);
|
||||
QString tempFlash=tempDir + "/flash.bin";
|
||||
QString tempFlash = generateProcessUniqueTempFileName("flash.bin");
|
||||
|
||||
if (!((MainWindow *)this->parent())->readFirmwareFromRadio(tempFlash))
|
||||
return;
|
||||
|
||||
QString restoreFile = tempDir + "/compat.bin";
|
||||
QString restoreFile = generateProcessUniqueTempFileName("compat.bin");
|
||||
if (!((MainWindow *)this->parent())->convertEEPROM(tempFile, restoreFile, tempFlash)) {
|
||||
int ret = QMessageBox::question(this, tr("Error"), tr("Cannot check eeprom compatibility! Continue anyway?"), QMessageBox::Yes | QMessageBox::No);
|
||||
if (ret == QMessageBox::No)
|
||||
@@ -571,9 +570,7 @@ void MdiChild::writeEeprom() // write to Tx
|
||||
}
|
||||
tempFile=restoreFile;
|
||||
}
|
||||
QByteArray ba = tempFlash.toLatin1();
|
||||
char *name = ba.data();
|
||||
unlink(name);
|
||||
qunlink(tempFlash);
|
||||
}
|
||||
else {
|
||||
if (backupEnable) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "channels.h"
|
||||
#include "helpers.h"
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QSpinBox>
|
||||
@@ -6,6 +7,74 @@
|
||||
#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),
|
||||
step(1.0)
|
||||
{
|
||||
|
||||
bool allowGVars = false;
|
||||
|
||||
spinbox->setProperty("index", row);
|
||||
spinbox->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
spinbox->setAccelerated(true);
|
||||
|
||||
if (firmware->getCapability(PPMUnitMicroseconds)) {
|
||||
step = 5.12;
|
||||
spinbox->setDecimals(1);
|
||||
spinbox->setSuffix("us");
|
||||
}
|
||||
else {
|
||||
spinbox->setDecimals(0);
|
||||
spinbox->setSuffix("%");
|
||||
}
|
||||
|
||||
if (IS_TARANIS(firmware->getBoard()) || deflt == 0 /*it's the offset*/) {
|
||||
min *= 10;
|
||||
max *= 10;
|
||||
deflt *= 10;
|
||||
step /= 10;
|
||||
spinbox->setDecimals(1);
|
||||
allowGVars = true;
|
||||
}
|
||||
|
||||
spinbox->setSingleStep(step);
|
||||
|
||||
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, step, allowGVars);
|
||||
}
|
||||
|
||||
LimitsGroup::~LimitsGroup()
|
||||
{
|
||||
delete gvarGroup;
|
||||
}
|
||||
|
||||
void LimitsGroup::updateMinMax(int max)
|
||||
{
|
||||
if (IS_TARANIS(firmware->getBoard())) {
|
||||
max *= 10;
|
||||
}
|
||||
if (spinbox->maximum() == 0) {
|
||||
spinbox->setMinimum(-step*max);
|
||||
if (value < -max) {
|
||||
value = -max;
|
||||
}
|
||||
}
|
||||
if (spinbox->minimum() == 0) {
|
||||
spinbox->setMaximum(step*max);
|
||||
if (value > max) {
|
||||
value = max;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
|
||||
ModelPanel(parent, model, generalSettings, firmware)
|
||||
{
|
||||
@@ -13,8 +82,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 +120,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, -100, 100, 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(), 0, -100);
|
||||
|
||||
// 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(), 100);
|
||||
|
||||
// Channel inversion
|
||||
QComboBox * invCB = new QComboBox(this);
|
||||
@@ -117,6 +154,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 +172,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 +181,9 @@ Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & genera
|
||||
|
||||
Channels::~Channels()
|
||||
{
|
||||
foreach(LimitsGroup *group, limitsGroups) {
|
||||
delete group;
|
||||
}
|
||||
}
|
||||
|
||||
void Channels::symlimitsEdited()
|
||||
@@ -164,46 +206,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(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 step;
|
||||
};
|
||||
|
||||
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();
|
||||
|
||||
@@ -506,7 +506,7 @@ void CustomFunctionsPanel::update()
|
||||
lock = true;
|
||||
for (int i=0; i<firmware->getCapability(CustomFunctions); i++) {
|
||||
if (!initialized) {
|
||||
populateSwitchCB(fswtchSwtch[i], model.funcSw[i].swtch, generalSettings, POPULATE_ONOFF);
|
||||
populateSwitchCB(fswtchSwtch[i], model.funcSw[i].swtch, generalSettings, CustomFunctionsContext);
|
||||
populateFuncCB(fswtchFunc[i], model.funcSw[i].func);
|
||||
populateGVmodeCB(fswtchGVmode[i], model.funcSw[i].adjustMode);
|
||||
populateFuncParamCB(fswtchParamT[i], model, model.funcSw[i].func, model.funcSw[i].param, model.funcSw[i].adjustMode);
|
||||
@@ -527,7 +527,7 @@ void CustomFunctionsPanel::fswPaste()
|
||||
FuncSwData *fsw = &model.funcSw[selectedFunction];
|
||||
memcpy(fsw, fswData.mid(0, sizeof(FuncSwData)).constData(), sizeof(FuncSwData));
|
||||
lock = true;
|
||||
populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, generalSettings, POPULATE_ONOFF);
|
||||
populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, generalSettings, CustomFunctionsContext);
|
||||
populateFuncCB(fswtchFunc[selectedFunction], model.funcSw[selectedFunction].func);
|
||||
populateGVmodeCB(fswtchGVmode[selectedFunction], model.funcSw[selectedFunction].adjustMode);
|
||||
populateFuncParamCB(fswtchParamT[selectedFunction], model, model.funcSw[selectedFunction].func, model.funcSw[selectedFunction].param, model.funcSw[selectedFunction].adjustMode);
|
||||
@@ -543,7 +543,7 @@ void CustomFunctionsPanel::fswDelete()
|
||||
model.funcSw[selectedFunction].clear();
|
||||
// TODO update switch and func
|
||||
lock = true;
|
||||
populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, generalSettings, POPULATE_ONOFF);
|
||||
populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, generalSettings, CustomFunctionsContext);
|
||||
populateFuncCB(fswtchFunc[selectedFunction], model.funcSw[selectedFunction].func);
|
||||
refreshCustomFunction(selectedFunction);
|
||||
lock = false;
|
||||
|
||||
@@ -33,7 +33,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
|
||||
|
||||
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve);
|
||||
|
||||
populateSwitchCB(ui->switchesCB, ed->swtch, generalSettings);
|
||||
populateSwitchCB(ui->switchesCB, ed->swtch, generalSettings, MixesContext);
|
||||
|
||||
ui->sideCB->setCurrentIndex(ed->mode-1);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
|
||||
// Phase switch
|
||||
if (phaseIdx > 0) {
|
||||
populateSwitchCB(ui->swtch, phase.swtch, generalSettings);
|
||||
populateSwitchCB(ui->swtch, phase.swtch, generalSettings, MixesContext);
|
||||
connect(ui->swtch, SIGNAL(currentIndexChanged(int)), this, SLOT(phaseSwitch_currentIndexChanged(int)));
|
||||
}
|
||||
else {
|
||||
@@ -63,19 +63,25 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
trimsValue << ui->trim1Value << ui->trim2Value << ui->trim3Value << ui->trim4Value;
|
||||
trimsSlider << ui->trim1Slider << ui->trim2Slider << ui->trim3Slider << ui->trim4Slider;
|
||||
|
||||
BoardEnum board = firmware->getBoard();
|
||||
|
||||
for (int i=0; i<4; i++) {
|
||||
trimsLabel[i]->setText(labels[CONVERT_MODE(i+1)-1]);
|
||||
|
||||
QComboBox * cb = trimsUse[i];
|
||||
cb->setProperty("index", i);
|
||||
cb->addItem(QObject::tr("Trim disabled"), -1);
|
||||
if (IS_TARANIS(board)) {
|
||||
cb->addItem(QObject::tr("Trim disabled"), -1);
|
||||
}
|
||||
for (int m=0; m<modesCount; m++) {
|
||||
if (m == phaseIdx) {
|
||||
cb->addItem(QObject::tr("Own Trim"), m*2);
|
||||
}
|
||||
else if (phaseIdx > 0) {
|
||||
cb->addItem(QObject::tr("Use Trim from Flight mode %1").arg(m), m*2);
|
||||
cb->addItem(QObject::tr("Use Trim from Flight mode %1 + Own Trim as an offset").arg(m), m*2+1);
|
||||
if (IS_TARANIS(board)) {
|
||||
cb->addItem(QObject::tr("Use Trim from Flight mode %1 + Own Trim as an offset").arg(m), m*2+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
connect(cb, SIGNAL(currentIndexChanged(int)), this, SLOT(phaseTrimUse_currentIndexChanged(int)));
|
||||
@@ -157,7 +163,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
||||
gvLayout->addWidget(gvValues[i], i, col++, 1, 1);
|
||||
|
||||
// Popups
|
||||
if (IS_TARANIS(GetEepromInterface()->getBoard()) && (phaseIdx == 0)) {
|
||||
if (IS_TARANIS(board) && phaseIdx == 0) {
|
||||
gvPopups[i] = new QCheckBox(ui->gvGB);
|
||||
gvPopups[i]->setProperty("index", i);
|
||||
gvPopups[i]->setText(tr("Popup enabled"));
|
||||
@@ -270,7 +276,11 @@ void FlightModePanel::trimUpdate(unsigned int trim)
|
||||
trimsSlider[trim]->setEnabled(false);
|
||||
}
|
||||
else {
|
||||
trimsUse[trim]->setCurrentIndex(1 + 2*phase.trimRef[chn] + phase.trimMode[chn] - (phase.trimRef[chn] > phaseIdx ? 1 : 0));
|
||||
BoardEnum board = firmware->getBoard();
|
||||
if (IS_TARANIS(board))
|
||||
trimsUse[trim]->setCurrentIndex(1 + 2*phase.trimRef[chn] + phase.trimMode[chn] - (phase.trimRef[chn] > phaseIdx ? 1 : 0));
|
||||
else
|
||||
trimsUse[trim]->setCurrentIndex(phase.trimRef[chn]);
|
||||
trimsValue[trim]->setEnabled(true);
|
||||
trimsSlider[trim]->setEnabled(true);
|
||||
}
|
||||
@@ -305,10 +315,10 @@ void FlightModePanel::phaseGVUse_currentIndexChanged(int index)
|
||||
QComboBox *comboBox = qobject_cast<QComboBox*>(sender());
|
||||
int gvar = comboBox->property("index").toInt();
|
||||
if (index == 0) {
|
||||
phase.gvars[gvar]=0;
|
||||
phase.gvars[gvar] = 0;
|
||||
}
|
||||
else {
|
||||
phase.gvars[gvar] = 1024+index+(index>phaseIdx?1:0);
|
||||
phase.gvars[gvar] = 1024 + index;
|
||||
}
|
||||
update();
|
||||
emit modified();
|
||||
@@ -364,8 +374,15 @@ void FlightModePanel::phaseTrimUse_currentIndexChanged(int index)
|
||||
phase.trim[chn] = 0;
|
||||
}
|
||||
else {
|
||||
phase.trimMode[chn] = data % 2;
|
||||
phase.trimRef[chn] = data / 2;
|
||||
BoardEnum board = firmware->getBoard();
|
||||
if (IS_TARANIS(board)) {
|
||||
phase.trimMode[chn] = data % 2;
|
||||
phase.trimRef[chn] = data / 2;
|
||||
}
|
||||
else {
|
||||
phase.trimMode[chn] = 0;
|
||||
phase.trimRef[chn] = data / 2;
|
||||
}
|
||||
phase.trim[chn] = 0;
|
||||
}
|
||||
trimUpdate(trim);
|
||||
|
||||
@@ -167,16 +167,20 @@ void LogicalSwitchesPanel::andEdited(int value)
|
||||
|
||||
void LogicalSwitchesPanel::durationEdited(double duration)
|
||||
{
|
||||
int index = sender()->property("index").toInt();
|
||||
model.customSw[index].duration = (uint8_t)round(duration*10);
|
||||
emit modified();
|
||||
if (!lock) {
|
||||
int index = sender()->property("index").toInt();
|
||||
model.customSw[index].duration = (uint8_t)round(duration*10);
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void LogicalSwitchesPanel::delayEdited(double delay)
|
||||
{
|
||||
int index = sender()->property("index").toInt();
|
||||
model.customSw[index].delay = (uint8_t)round(delay*10);
|
||||
emit modified();
|
||||
if (!lock) {
|
||||
int index = sender()->property("index").toInt();
|
||||
model.customSw[index].delay = (uint8_t)round(delay*10);
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
void LogicalSwitchesPanel::edited()
|
||||
@@ -184,19 +188,25 @@ void LogicalSwitchesPanel::edited()
|
||||
if (!lock) {
|
||||
lock = true;
|
||||
int i = sender()->property("index").toInt();
|
||||
int newFunc = csw[i]->itemData(csw[i]->currentIndex()).toInt();
|
||||
bool chAr = (model.customSw[i].getFunctionFamily() != LogicalSwitchData(newFunc).getFunctionFamily());
|
||||
model.customSw[i].func = newFunc;
|
||||
if (chAr) {
|
||||
if (model.customSw[i].getFunctionFamily() == LS_FAMILY_TIMER) {
|
||||
CSFunctionFamily oldFuncFamily = model.customSw[i].getFunctionFamily();
|
||||
model.customSw[i].func = csw[i]->itemData(csw[i]->currentIndex()).toInt();
|
||||
CSFunctionFamily newFuncFamily = model.customSw[i].getFunctionFamily();
|
||||
|
||||
if (oldFuncFamily != newFuncFamily) {
|
||||
if (newFuncFamily == LS_FAMILY_TIMER) {
|
||||
model.customSw[i].val1 = -119;
|
||||
model.customSw[i].val2 = -119;
|
||||
}
|
||||
else if (model.customSw[i].getFunctionFamily() == LS_FAMILY_STAY) {
|
||||
else if (newFuncFamily == LS_FAMILY_STAY) {
|
||||
model.customSw[i].val1 = 0;
|
||||
model.customSw[i].val2 = -129;
|
||||
model.customSw[i].val3 = 0;
|
||||
}
|
||||
else if (newFuncFamily == LS_FAMILY_STICKY) {
|
||||
model.customSw[i].val1 = 0;
|
||||
model.customSw[i].val2 = 0;
|
||||
model.customSw[i].delay = 0;
|
||||
}
|
||||
else {
|
||||
model.customSw[i].val1 = 0;
|
||||
model.customSw[i].val2 = 0;
|
||||
@@ -207,7 +217,7 @@ void LogicalSwitchesPanel::edited()
|
||||
|
||||
RawSource source;
|
||||
|
||||
switch (model.customSw[i].getFunctionFamily())
|
||||
switch (newFuncFamily)
|
||||
{
|
||||
case LS_FAMILY_VOFS:
|
||||
{
|
||||
@@ -229,6 +239,7 @@ void LogicalSwitchesPanel::edited()
|
||||
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, 0.1);
|
||||
break;
|
||||
case LS_FAMILY_STAY:
|
||||
cswitchOffset2[i]->setSpecialValueText(tr("(no release)"));
|
||||
if (sender() == cswitchOffset[i]) {
|
||||
model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value());
|
||||
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, 0.0);
|
||||
@@ -236,10 +247,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("(infinite)");
|
||||
}
|
||||
else {
|
||||
cswitchOffset2[i]->setSuffix("");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -264,7 +277,6 @@ void LogicalSwitchesPanel::updateTimerParam(QDoubleSpinBox *sb, int timer, doubl
|
||||
else
|
||||
sb->setSingleStep(0.1);
|
||||
sb->setValue(value);
|
||||
sb->setSuffix("");
|
||||
}
|
||||
|
||||
#define SOURCE1_VISIBLE 0x1
|
||||
@@ -273,12 +285,13 @@ void LogicalSwitchesPanel::updateTimerParam(QDoubleSpinBox *sb, int timer, doubl
|
||||
#define VALUE2_VISIBLE 0x8
|
||||
#define VALUE3_VISIBLE 0x10
|
||||
#define VALUE_TO_VISIBLE 0x20
|
||||
#define DELAY_ENABLED 0x40
|
||||
|
||||
void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||
{
|
||||
lock = true;
|
||||
|
||||
unsigned int mask = 0;
|
||||
unsigned int mask = DELAY_ENABLED;
|
||||
RawSource source = RawSource(model.customSw[i].val1);
|
||||
RawSourceRange range = source.getRange(model, generalSettings, model.customSw[i].getRangeFlags());
|
||||
|
||||
@@ -308,20 +321,25 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||
cswitchOffset[i]->setValue(range.step*(model.customSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset);
|
||||
}
|
||||
break;
|
||||
case LS_FAMILY_VBOOL:
|
||||
case LS_FAMILY_STICKY:
|
||||
// no break
|
||||
case LS_FAMILY_VBOOL:
|
||||
mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
|
||||
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1), generalSettings);
|
||||
populateSwitchCB(cswitchSource2[i], RawSwitch(model.customSw[i].val2), generalSettings);
|
||||
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1), generalSettings, LogicalSwitchesContext);
|
||||
populateSwitchCB(cswitchSource2[i], RawSwitch(model.customSw[i].val2), generalSettings, LogicalSwitchesContext);
|
||||
break;
|
||||
case LS_FAMILY_STAY:
|
||||
mask |= SOURCE1_VISIBLE | VALUE2_VISIBLE | VALUE3_VISIBLE;
|
||||
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1), generalSettings);
|
||||
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("(no release)"));
|
||||
if (model.customSw[i].val3 == 0) {
|
||||
cswitchOffset2[i]->setSuffix(tr("(infinite)"));
|
||||
cswitchOffset2[i]->clear();
|
||||
}
|
||||
else {
|
||||
cswitchOffset2[i]->setSuffix("");
|
||||
}
|
||||
break;
|
||||
case LS_FAMILY_VCOMP:
|
||||
@@ -342,6 +360,11 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||
cswitchOffset[i]->setVisible(mask & VALUE2_VISIBLE);
|
||||
cswitchOffset2[i]->setVisible(mask & VALUE3_VISIBLE);
|
||||
cswitchTOffset[i]->setVisible(mask & VALUE_TO_VISIBLE);
|
||||
if (firmware->getCapability(LogicalSwitchesExt)) {
|
||||
cswitchDelay[i]->setEnabled(mask & DELAY_ENABLED);
|
||||
cswitchDuration[i]->setValue(model.customSw[i].duration/10.0);
|
||||
cswitchDelay[i]->setValue(model.customSw[i].delay/10.0);
|
||||
}
|
||||
lock = false;
|
||||
}
|
||||
|
||||
@@ -392,7 +415,7 @@ void LogicalSwitchesPanel::populateCSWCB(QComboBox *b, int value)
|
||||
void LogicalSwitchesPanel::populateAndSwitchCB(QComboBox *b, const RawSwitch & value)
|
||||
{
|
||||
if (IS_ARM(firmware->getBoard())) {
|
||||
populateSwitchCB(b, value, generalSettings, POPULATE_ONOFF);
|
||||
populateSwitchCB(b, value, generalSettings, LogicalSwitchesContext);
|
||||
}
|
||||
else {
|
||||
RawSwitch item;
|
||||
@@ -425,10 +448,6 @@ void LogicalSwitchesPanel::updateLine(int i)
|
||||
setSwitchWidgetVisibility(i);
|
||||
lock = true;
|
||||
populateAndSwitchCB(cswitchAnd[i], RawSwitch(model.customSw[i].andsw));
|
||||
if (firmware->getCapability(LogicalSwitchesExt)) {
|
||||
cswitchDuration[i]->setValue(model.customSw[i].duration/10.0);
|
||||
cswitchDelay[i]->setValue(model.customSw[i].delay/10.0);
|
||||
}
|
||||
lock = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
|
||||
}
|
||||
}
|
||||
|
||||
populateSwitchCB(ui->switchesCB, md->swtch, generalSettings);
|
||||
populateSwitchCB(ui->switchesCB, md->swtch, generalSettings, MixesContext);
|
||||
ui->warningCB->setCurrentIndex(md->mixWarn);
|
||||
ui->mltpxCB->setCurrentIndex(md->mltpx);
|
||||
int scale=firmware->getCapability(SlowScale);
|
||||
|
||||
@@ -15,7 +15,7 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, Ge
|
||||
lock = true;
|
||||
|
||||
// Mode
|
||||
populateSwitchCB(ui->mode, timer.mode, generalSettings, POPULATE_TIMER_MODES);
|
||||
populateSwitchCB(ui->mode, timer.mode, generalSettings, TimersContext);
|
||||
|
||||
if (!firmware->getCapability(PermTimers)) {
|
||||
ui->persistent->hide();
|
||||
@@ -210,8 +210,8 @@ 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->setValue(model.modelId);
|
||||
ui->label_channelsStart->setVisible(mask & MASK_CHANNELS_RANGE);
|
||||
ui->channelsStart->setVisible(mask & MASK_CHANNELS_RANGE);
|
||||
|
||||
@@ -198,12 +198,14 @@ void TelemetryAnalog::on_CalibSB_editingFinished()
|
||||
}
|
||||
if (alarm2value<calib) {
|
||||
alarm2value=calib;
|
||||
} else if (alarm2value>(ratio+calib)) {
|
||||
}
|
||||
else if (alarm2value>(ratio+calib)) {
|
||||
alarm2value=ratio+calib;
|
||||
}
|
||||
analog.alarms[0].value=round(((alarm1value-calib)*255)/ratio);
|
||||
analog.alarms[1].value=round(((alarm2value-calib)*255)/ratio);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
analog.offset=0;
|
||||
analog.alarms[0].value=0;
|
||||
analog.alarms[1].value=0;
|
||||
|
||||
@@ -658,10 +658,10 @@
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.500000000000000</double>
|
||||
<double>-12.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1.500000000000000</double>
|
||||
<double>12.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
|
||||
@@ -31,12 +31,12 @@ PrintDialog::PrintDialog(QWidget *parent, FirmwareInterface * firmware, GeneralS
|
||||
te->clear();
|
||||
QString modelname=g_model->name;
|
||||
if (modelname.isEmpty()) {
|
||||
curvefile5=QString("%1/curve5.png").arg(qd->tempPath());
|
||||
curvefile9=QString("%1/curve9.png").arg(qd->tempPath());
|
||||
curvefile5=generateProcessUniqueTempFileName("curve5.png");
|
||||
curvefile9=generateProcessUniqueTempFileName("curve9.png");
|
||||
}
|
||||
else {
|
||||
curvefile5=QString("%1/%2-curve5.png").arg(qd->tempPath()).arg(modelname);
|
||||
curvefile9=QString("%1/%2-curve9.png").arg(qd->tempPath()).arg(modelname);
|
||||
curvefile5=generateProcessUniqueTempFileName(QString("%1-curve5.png").arg(modelname));
|
||||
curvefile9=generateProcessUniqueTempFileName(QString("%1-curve9.png").arg(modelname));
|
||||
}
|
||||
printSetup();
|
||||
if (gvars) {
|
||||
@@ -60,19 +60,14 @@ PrintDialog::PrintDialog(QWidget *parent, FirmwareInterface * firmware, GeneralS
|
||||
|
||||
void PrintDialog::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
if (printfilename.isEmpty()) {
|
||||
QByteArray ba = curvefile5.toLatin1();
|
||||
char *name = ba.data();
|
||||
unlink(name);
|
||||
ba = curvefile9.toLatin1();
|
||||
name = ba.data();
|
||||
unlink(name);
|
||||
}
|
||||
}
|
||||
|
||||
PrintDialog::~PrintDialog()
|
||||
{
|
||||
delete ui;
|
||||
// notice PrintDialog::closeEvent() is not called if user clicks on Close button
|
||||
qunlink(curvefile5);
|
||||
qunlink(curvefile9);
|
||||
delete ui;
|
||||
}
|
||||
|
||||
QString doTC(const QString s, const QString color="", bool bold=false)
|
||||
@@ -121,10 +116,8 @@ void PrintDialog::printSetup()
|
||||
str.append(fv(tr("Protocol"), getProtocol(g_model))); //proto, numch, delay,
|
||||
str.append(fv(tr("Pulse Polarity"), g_model->moduleData[0].polarityToString()));
|
||||
str.append(fv(tr("Throttle Trim"), g_model->thrTrim ? tr("Enabled") : tr("Disabled")));
|
||||
str.append(fv(tr("Throttle Expo"), g_model->thrExpo ? tr("Enabled") : tr("Disabled")));
|
||||
// TODO str.append(fv(tr("Trim Switch"), getSWName(g_model->trimSw)));
|
||||
str.append(fv(tr("Trim Increment"), getTrimInc(g_model)));
|
||||
str.append(fv(tr("Center Beep"), getCenterBeep(g_model))); // specify which channels beep
|
||||
str.append(fv(tr("Center Beep"), getCenterBeepStr(g_model))); // specify which channels beep
|
||||
str.append("</td></tr></table></td>");
|
||||
if (!gvars) {
|
||||
str.append("<td width=\"380\">");
|
||||
@@ -340,7 +333,6 @@ void PrintDialog::printMixes()
|
||||
if (firmware->getCapability(HasNoExpo) && md->noExpo) str += " " + Qt::escape(tr("No DR/Expo"));
|
||||
if (md->sOffset) str += " " + Qt::escape(tr("Offset(%1)").arg(getGVarString(md->sOffset)));
|
||||
if (md->curve.value) str += " " + Qt::escape(md->curve.toString());
|
||||
|
||||
|
||||
int scale = firmware->getCapability(SlowScale);
|
||||
if (scale == 0)
|
||||
@@ -379,22 +371,22 @@ void PrintDialog::printLimits()
|
||||
if (firmware->getCapability(HasChNames)) {
|
||||
str.append("<tr><td><b>"+tr("Name")+"</b></td>");
|
||||
for(int i=0; i<firmware->getCapability(Outputs); i++) {
|
||||
str.append(doTR(g_model->limitData[i].name,"green"));
|
||||
str.append(doTR(g_model->limitData[i].name, "green"));
|
||||
}
|
||||
}
|
||||
str.append("<tr><td><b>"+tr("Offset")+"</b></td>");
|
||||
for(int i=0; i<firmware->getCapability(Outputs); i++) {
|
||||
str.append(doTR(QString::number((qreal)g_model->limitData[i].offset/10, 'f', 1),"green"));
|
||||
str.append(doTR(g_model->limitData[i].offsetToString(), "green"));
|
||||
}
|
||||
str.append("</tr>");
|
||||
str.append("<tr><td><b>"+tr("Min")+"</b></td>");
|
||||
for(int i=0; i<firmware->getCapability(Outputs); i++) {
|
||||
str.append(doTR(QString::number((qreal)g_model->limitData[i].min/10),"green"));
|
||||
str.append(doTR(g_model->limitData[i].minToString(), "green"));
|
||||
}
|
||||
str.append("</tr>");
|
||||
str.append("<tr><td><b>"+tr("Max")+"</b></td>");
|
||||
for(int i=0; i<firmware->getCapability(Outputs); i++) {
|
||||
str.append(doTR(QString::number((qreal)g_model->limitData[i].max/10),"green"));
|
||||
str.append(doTR(g_model->limitData[i].maxToString(), "green"));
|
||||
}
|
||||
str.append("</tr>");
|
||||
str.append("<tr><td><b>"+tr("Invert")+"</b></td>");
|
||||
|
||||
+2035
-1732
File diff suppressed because it is too large
Load Diff
+2090
-1746
File diff suppressed because it is too large
Load Diff
+2749
-1894
File diff suppressed because it is too large
Load Diff
+2054
-1938
File diff suppressed because it is too large
Load Diff
+2066
-1814
File diff suppressed because it is too large
Load Diff
+2082
-1766
File diff suppressed because it is too large
Load Diff
+2066
-1814
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+2063
-1815
File diff suppressed because it is too large
Load Diff
+2066
-1818
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -628,8 +628,8 @@ void ElevonsPage::initializePage()
|
||||
bool ElevonsPage::validatePage()
|
||||
{
|
||||
releaseBookings();
|
||||
return (bookChannel(elevon1CB, AILERONS_INPUT, 100, ELEVATOR_INPUT, 100) &&
|
||||
bookChannel(elevon2CB, AILERONS_INPUT, -100, ELEVATOR_INPUT, 100));
|
||||
return (bookChannel(elevon1CB, AILERONS_INPUT, 50, ELEVATOR_INPUT, 50) &&
|
||||
bookChannel(elevon2CB, AILERONS_INPUT, -50, ELEVATOR_INPUT, 50));
|
||||
}
|
||||
|
||||
RudderPage::RudderPage(WizardDialog *dlg, QString image, QString title, QString text, int nextPage):
|
||||
@@ -1002,7 +1002,7 @@ WizardPrinter::WizardPrinter(WizMix *wizMix)
|
||||
mix = wizMix;
|
||||
}
|
||||
|
||||
QString WizardPrinter::printChannel( Input input1, int weight1, Input input2, int weight2 )
|
||||
QString WizardPrinter::printChannel( Input input1, int weight1, Input input2, int weight2 )
|
||||
{
|
||||
QString str;
|
||||
str = QString("[%1, %2]").arg(inputName(input1)).arg(weight1);
|
||||
|
||||
@@ -136,7 +136,6 @@ void saveModel(ModelData & m, model & xm)
|
||||
trims xtrims;
|
||||
xtrims.extended(m.extendedTrims);
|
||||
xtrims.throttleTrim(m.thrTrim);
|
||||
xtrims.throttleTrimExpo(m.thrExpo);
|
||||
xm.trims(xtrims);
|
||||
}
|
||||
if (m.beepANACenter) {
|
||||
|
||||
@@ -24,5 +24,6 @@
|
||||
#define round(x) floor(x+0.5)
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _tcsnicmp
|
||||
#define snprintf _snprintf
|
||||
|
||||
#endif
|
||||
|
||||
+39
-1
@@ -1,4 +1,42 @@
|
||||
<h2>Version 2.0.6 / 2014-07-08</h2>
|
||||
<h2>Version 2.0.10 / 2014-09-08</h2>
|
||||
[All]
|
||||
<ul>
|
||||
<li>Duration and AND fixed on Sticky and Edge logical switches
|
||||
|
||||
[Taranis]
|
||||
<ul>
|
||||
<li>CCPM issue on Helis when cross trims used
|
||||
<li>Taranis+ LCD color range and brightness adjusted
|
||||
<li>Taranis+ SWR removed
|
||||
<li>Lua small enhancements (TIMEHOUR constant, GVARS over 500)
|
||||
<li>Lua hardening, use of newlib-nano (optimizes RAM usage)
|
||||
<li>Incoming telemetry rejected if RSSI=0
|
||||
<li>Assign Bitmap impossible if filename length too big
|
||||
<li>
|
||||
|
||||
[9XR-PRO]
|
||||
<ul>
|
||||
<li>Telemetry enabled
|
||||
|
||||
<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
|
||||
|
||||
<h2>Version 2.0.7 / 2014-07-15</h2>
|
||||
[Taranis]
|
||||
<ul>
|
||||
<li>Instant Trim problem when using a negative curve
|
||||
|
||||
[All]
|
||||
<ul>
|
||||
<li>SafetyCH function was missing on the compilation server
|
||||
|
||||
<h2>Version 2.0.6 / 2014-07-13</h2>
|
||||
[Taranis]
|
||||
<ul>
|
||||
<li>Telemetry Type field is hidden when only S.PORT is available
|
||||
|
||||
@@ -24,3 +24,6 @@
|
||||
/gtests
|
||||
/gtest_main.a
|
||||
/gtests.d
|
||||
/lua_exports.cpp
|
||||
/lua_exports.txt
|
||||
/lua_fields.txt
|
||||
|
||||
+34
-11
@@ -169,9 +169,9 @@ PPM_LIMITS_SYMETRICAL = NO
|
||||
# Values = PERCENT_PREC1, PERCENT_PREC0, US
|
||||
PPM_UNIT = PERCENT_PREC1
|
||||
|
||||
# SafetyCHxx functions enable
|
||||
# OverrideCHxx functions enable
|
||||
# Values = YES, NO
|
||||
SAFETY_CHANNEL_FUNCTION = YES
|
||||
OVERRIDE_CHANNEL_FUNCTION = YES
|
||||
|
||||
# FrSky Hub
|
||||
# Values = YES, NO
|
||||
@@ -289,6 +289,10 @@ USB = JOYSTICK
|
||||
# NO - normal behaviour, show real channel values
|
||||
CHANNELS_MONITOR_INV_HIDE = NO
|
||||
|
||||
# Use newlib-nano
|
||||
# Values = NO, YES
|
||||
NANO = YES
|
||||
|
||||
#------- END BUILD OPTIONS ---------------------------
|
||||
|
||||
# Define programs and commands.
|
||||
@@ -296,12 +300,13 @@ SHELL = sh
|
||||
IMG2LBM = -python ../util/img2lbm.py
|
||||
BIN2LBM = -python ../util/bin2lbm.py
|
||||
TRANSLATE = -python ../util/translate.py
|
||||
VERSION = 2.0.6
|
||||
VERSION = 2.0.10
|
||||
|
||||
SRC =
|
||||
CPPSRC =
|
||||
INCDIRS = . translations
|
||||
EXTRAINCDIRS =
|
||||
LUADEP =
|
||||
|
||||
# MCU name
|
||||
ifneq ($(PCB), $(filter $(PCB), STD 9X 9XR STD128 9X128 9XR128 9X2561 9XR2561 GRUVIN9X MEGA2560 SKY9X 9XRPRO TARANIS))
|
||||
@@ -717,6 +722,12 @@ ifeq ($(PCB), TARANIS)
|
||||
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
|
||||
@@ -729,6 +740,7 @@ ifeq ($(PCB), TARANIS)
|
||||
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
|
||||
SRC += $(LUASRC)
|
||||
LUADEP = lua_exports.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(SDCARD), YES)
|
||||
@@ -769,6 +781,7 @@ ifeq ($(PCB), TARANIS)
|
||||
endif
|
||||
|
||||
CC = $(TRGT)gcc
|
||||
CPP = $(TRGT)cpp
|
||||
AS = $(TRGT)as
|
||||
OBJCOPY = $(TRGT)objcopy
|
||||
OBJDUMP = $(TRGT)objdump
|
||||
@@ -1022,8 +1035,8 @@ ifeq ($(PPM_LIMITS_SYMETRICAL), YES)
|
||||
CPPDEFS += -DPPM_LIMITS_SYMETRICAL
|
||||
endif
|
||||
|
||||
ifeq ($(SAFETY_CHANNEL_FUNCTION), YES)
|
||||
CPPDEFS += -DSAFETY_CHANNEL_FUNCTION
|
||||
ifeq ($(OVERRIDE_CHANNEL_FUNCTION), YES)
|
||||
CPPDEFS += -DOVERRIDE_CHANNEL_FUNCTION
|
||||
endif
|
||||
|
||||
ifeq ($(PPM_UNIT), US)
|
||||
@@ -1156,7 +1169,7 @@ all: begin gccversion sizebefore build sizeafter end
|
||||
ifeq ($(ARCH), AVR)
|
||||
build: stamp_header tra lbm allsrc.cpp elf remallsrc hex
|
||||
else ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO TARANIS))
|
||||
build: stamp_header tra lbm bootloader.lbm allsrc.cpp elf remallsrc bin
|
||||
build: stamp_header tra lbm bootloader.lbm $(LUADEP) allsrc.cpp elf remallsrc bin
|
||||
else
|
||||
build: stamp_header tra lbm allsrc.cpp elf remallsrc bin
|
||||
endif
|
||||
@@ -1272,6 +1285,13 @@ bitmaps/sticks.lbm: bitmaps/sticks_4x1.xbm bitmaps/splash_9x.xbm bitmaps/splash_
|
||||
$(IMG2LBM) bitmaps/about_taranis.png bitmaps/about_taranis.lbm bmp
|
||||
$(IMG2LBM) bitmaps/about_9x.png bitmaps/about_9x.lbm img
|
||||
$(IMG2LBM) bitmaps/asterisk_4bits.png bitmaps/asterisk_4bits.lbm bmp
|
||||
|
||||
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
|
||||
@echo "Parsing and generating C Lua exports in 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
|
||||
@@ -1313,8 +1333,8 @@ FOXLIB=-L/usr/local/lib \
|
||||
-lFOX-1.6 \
|
||||
-Wl,-rpath,$(FOXPATH)/src/.libs
|
||||
|
||||
simu: 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
|
||||
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 -DLUA_USE_APICHECK -O0 -o simu $(FOXINC) $(FOXLIB) -pthread -fexceptions
|
||||
|
||||
eeprom.bin:
|
||||
dd if=/dev/zero of=$@ bs=1 count=2048
|
||||
@@ -1380,7 +1400,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.
|
||||
@@ -1408,7 +1428,9 @@ clean_list :
|
||||
$(REMOVE) *.lst
|
||||
$(REMOVE) allsrc.cpp
|
||||
$(REMOVE) stamp-opentx.h
|
||||
$(REMOVE) `find . -name "*.lbm"`
|
||||
$(REMOVE) bitmaps/*.lbm
|
||||
$(REMOVE) fonts/*/*.lbm
|
||||
$(REMOVE) lua_exports.txt lua_exports.cpp lua_fields.txt
|
||||
$(MAKE) -C bootloader clean
|
||||
|
||||
#### Install
|
||||
@@ -1490,4 +1512,5 @@ gtest_main.a : gtest-all.o gtest_main.o
|
||||
GTEST_TESTS_SRCS = $(shell find tests/ -type f -name '*.cpp')
|
||||
|
||||
gtests: $(BOARDSRC) $(CPPSRC) $(GTEST_TESTS_SRCS) targets/simu/simpgmspace.cpp *.h gtest_main.a
|
||||
g++ -std=gnu++0x $(CPPFLAGS) $(BOARDSRC) $(CPPSRC) $(GTEST_TESTS_SRCS) targets/simu/simpgmspace.cpp -I$(GTEST_DIR) ${INCFLAGS} -I$(GTEST_DIR)/include -o gtests -lpthread -MD -DSIMU -lQtCore -lQtGui gtest_main.a
|
||||
g++ -std=gnu++0x $(CPPFLAGS) $(BOARDSRC) $(CPPSRC) $(LUASRC) $(GTEST_TESTS_SRCS) targets/simu/simpgmspace.cpp -I$(GTEST_DIR) ${INCFLAGS} -I$(GTEST_DIR)/include -o gtests -lpthread -MD -DSIMU -lQtCore -lQtGui gtest_main.a -fexceptions
|
||||
|
||||
|
||||
@@ -607,7 +607,6 @@ int WavContext::mixBuffer(AudioBuffer *buffer, int volume, unsigned int fade)
|
||||
}
|
||||
}
|
||||
|
||||
clear();
|
||||
return -result;
|
||||
}
|
||||
#else
|
||||
@@ -719,12 +718,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;
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ const pm_char * bmpLoad(uint8_t *bmp, const char *filename, const xcoord_t width
|
||||
f_close(&bmpFile);
|
||||
return SDCARD_ERROR(result);
|
||||
}
|
||||
for (uint32_t j=0; j<w/2; j++) {
|
||||
for (uint32_t j=0; j<(w+1)/2; j++) {
|
||||
uint8_t * dst = dest + (i/2)*w + j*2;
|
||||
if (i & 1) {
|
||||
uint8_t val = palette[(buf[j] >> 4) & 0x0F] << 4;
|
||||
|
||||
@@ -160,7 +160,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)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -472,8 +472,8 @@ void ConvertModel_215_to_216(ModelData &model)
|
||||
memcpy(&g_model.header, &oldModel.header, sizeof(g_model.header));
|
||||
for (uint8_t i=0; i<2; i++) {
|
||||
TimerData & timer = g_model.timers[i];
|
||||
if (oldModel.timers[i].mode >= TMRMODE_FIRST_SWITCH)
|
||||
timer.mode = TMRMODE_FIRST_SWITCH + ConvertSwitch_215_to_216(oldModel.timers[i].mode - TMRMODE_FIRST_SWITCH + 1) - 1;
|
||||
if (oldModel.timers[i].mode >= TMRMODE_COUNT)
|
||||
timer.mode = TMRMODE_COUNT + ConvertSwitch_215_to_216(oldModel.timers[i].mode - TMRMODE_COUNT + 1) - 1;
|
||||
else
|
||||
timer.mode = oldModel.timers[i].mode;
|
||||
timer.start = oldModel.timers[i].start;
|
||||
@@ -730,7 +730,7 @@ void ConvertModel_215_to_216(ModelData &model)
|
||||
fn.func = oldModel.funcSw[i].func;
|
||||
if (fn.func <= 15) {
|
||||
fn.all.param = fn.func;
|
||||
fn.func = FUNC_SAFETY_CHANNEL;
|
||||
fn.func = FUNC_OVERRIDE_CHANNEL;
|
||||
}
|
||||
else if (fn.func <= 20) {
|
||||
fn.all.param = fn.func - 16;
|
||||
|
||||
+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 {
|
||||
|
||||
@@ -229,16 +229,16 @@ void menuGeneralSetup(uint8_t event)
|
||||
#if defined(RTCLOCK)
|
||||
case ITEM_SETUP_DATE:
|
||||
lcd_putsLeft(y, STR_DATE);
|
||||
lcd_putc(RADIO_SETUP_DATE_COLUMN+2, y, '-'); lcd_putc(RADIO_SETUP_DATE_COLUMN+3*FW, y, '-');
|
||||
lcd_putc(RADIO_SETUP_DATE_COLUMN, y, '-'); lcd_putc(RADIO_SETUP_DATE_COLUMN+3*FW-2, y, '-');
|
||||
for (uint8_t j=0; j<3; j++) {
|
||||
uint8_t rowattr = (m_posHorz==j ? attr : 0);
|
||||
switch (j) {
|
||||
case 0:
|
||||
lcd_outdezAtt(RADIO_SETUP_DATE_COLUMN+2, y, t.tm_year+1900, rowattr);
|
||||
lcd_outdezAtt(RADIO_SETUP_DATE_COLUMN, y, t.tm_year+1900, rowattr);
|
||||
if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_year = checkIncDec(event, t.tm_year, 112, 200, 0);
|
||||
break;
|
||||
case 1:
|
||||
lcd_outdezNAtt(RADIO_SETUP_DATE_COLUMN+3*FW, y, t.tm_mon+1, rowattr|LEADING0, 2);
|
||||
lcd_outdezNAtt(RADIO_SETUP_DATE_COLUMN+3*FW-2, y, t.tm_mon+1, rowattr|LEADING0, 2);
|
||||
if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_mon = checkIncDec(event, t.tm_mon, 0, 11, 0);
|
||||
break;
|
||||
case 2:
|
||||
@@ -247,7 +247,7 @@ void menuGeneralSetup(uint8_t event)
|
||||
int8_t dlim = (((((year%4==0) && (year%100!=0)) || (year%400==0)) && (t.tm_mon==1)) ? 1 : 0);
|
||||
static const pm_uint8_t dmon[] PROGMEM = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
dlim += pgm_read_byte(&dmon[t.tm_mon]);
|
||||
lcd_outdezNAtt(RADIO_SETUP_DATE_COLUMN+6*FW-2, y, t.tm_mday, rowattr|LEADING0, 2);
|
||||
lcd_outdezNAtt(RADIO_SETUP_DATE_COLUMN+6*FW-4, y, t.tm_mday, rowattr|LEADING0, 2);
|
||||
if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_mday = checkIncDec(event, t.tm_mday, 1, dlim, 0);
|
||||
break;
|
||||
}
|
||||
@@ -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, 100, attr);
|
||||
if (attr) g_eeGeneral.backlightColor = checkIncDec(event, g_eeGeneral.backlightColor, 0, 100, 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)) {
|
||||
@@ -1386,9 +1382,9 @@ void menuGeneralHardware(uint8_t event)
|
||||
putsMixerSource(sizeof(TR_TYPE)*FW, y, MIXSRC_FIRST_POT+idx);
|
||||
uint8_t potType = (g_eeGeneral.potsType & mask) >> shift;
|
||||
if (potType == POT_TYPE_NONE && i < 2)
|
||||
potType = POT_TYPE_POT;
|
||||
potType = POT_TYPE_DETENT;
|
||||
potType = selectMenuItem(HW_SETTINGS_COLUMN, y, STR_TYPE, STR_POTTYPES, potType, 0, POT_TYPE_MAX, attr, event);
|
||||
if (potType == POT_TYPE_POT && i < 2)
|
||||
if (potType == POT_TYPE_DETENT && i < 2)
|
||||
potType = POT_TYPE_NONE;
|
||||
g_eeGeneral.potsType &= ~mask;
|
||||
g_eeGeneral.potsType |= (potType << shift);
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1490,7 +1486,9 @@ void menuCommonCalib(uint8_t event)
|
||||
reusableBuffer.calib.loVals[i] = min(vt, reusableBuffer.calib.loVals[i]);
|
||||
reusableBuffer.calib.hiVals[i] = max(vt, reusableBuffer.calib.hiVals[i]);
|
||||
if (i >= POT1 && i <= POT_LAST) {
|
||||
reusableBuffer.calib.midVals[i] = (reusableBuffer.calib.hiVals[i] + reusableBuffer.calib.loVals[i]) / 2;
|
||||
if (IS_POT_WITHOUT_DETENT(i)) {
|
||||
reusableBuffer.calib.midVals[i] = (reusableBuffer.calib.hiVals[i] + reusableBuffer.calib.loVals[i]) / 2;
|
||||
}
|
||||
#if defined(PCBTARANIS)
|
||||
uint8_t idx = i - POT1;
|
||||
int count = reusableBuffer.calib.xpotsCalib[idx].stepsCount;
|
||||
@@ -1585,23 +1583,25 @@ void menuCommonCalib(uint8_t event)
|
||||
for (uint8_t i=POT1; i<=POT_LAST; i++) {
|
||||
int idx = i - POT1;
|
||||
int count = reusableBuffer.calib.xpotsCalib[idx].stepsCount;
|
||||
if (IS_POT_MULTIPOS(i) && count > 1 && count <= XPOTS_MULTIPOS_COUNT) {
|
||||
for (int j=0; j<count; j++) {
|
||||
for (int k=j+1; k<count; k++) {
|
||||
if (reusableBuffer.calib.xpotsCalib[idx].steps[k] < reusableBuffer.calib.xpotsCalib[idx].steps[j]) {
|
||||
swap(reusableBuffer.calib.xpotsCalib[idx].steps[j], reusableBuffer.calib.xpotsCalib[idx].steps[k]);
|
||||
if (IS_POT_MULTIPOS(i)) {
|
||||
if (count > 1 && count <= XPOTS_MULTIPOS_COUNT) {
|
||||
for (int j=0; j<count; j++) {
|
||||
for (int k=j+1; k<count; k++) {
|
||||
if (reusableBuffer.calib.xpotsCalib[idx].steps[k] < reusableBuffer.calib.xpotsCalib[idx].steps[j]) {
|
||||
swap(reusableBuffer.calib.xpotsCalib[idx].steps[j], reusableBuffer.calib.xpotsCalib[idx].steps[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[i];
|
||||
calib->count = count - 1;
|
||||
for (int j=0; j<calib->count; j++) {
|
||||
calib->steps[j] = (reusableBuffer.calib.xpotsCalib[idx].steps[j+1] + reusableBuffer.calib.xpotsCalib[idx].steps[j]) >> 5;
|
||||
}
|
||||
}
|
||||
StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[i];
|
||||
calib->count = count - 1;
|
||||
for (int j=0; j<calib->count; j++) {
|
||||
calib->steps[j] = (reusableBuffer.calib.xpotsCalib[idx].steps[j+1] + reusableBuffer.calib.xpotsCalib[idx].steps[j]) >> 5;
|
||||
else {
|
||||
g_eeGeneral.potsType &= ~(0x03<<(2*idx));
|
||||
}
|
||||
}
|
||||
else {
|
||||
g_eeGeneral.potsType &= ~(1<<idx);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
g_eeGeneral.chkSum = evalChkSum();
|
||||
|
||||
@@ -1120,7 +1120,7 @@ void menuModelSetup(uint8_t event)
|
||||
div_t qr = div(timer->start, 60);
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, timer->mode, SWSRC_FIRST, TMR_VAROFS+SWSRC_LAST-1);
|
||||
CHECK_INCDEC_MODELVAR_CHECK(event, timer->mode, SWSRC_FIRST, TMRMODE_COUNT+SWSRC_LAST-1/*SWSRC_None removed*/, isSwitchAvailableInTimers);
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, qr.quot, 59);
|
||||
@@ -1224,7 +1224,7 @@ void menuModelSetup(uint8_t event)
|
||||
if (attr) {
|
||||
s_editMode = 0;
|
||||
if (!READ_ONLY()) {
|
||||
switch(event) {
|
||||
switch (event) {
|
||||
CASE_EVT_ROTARY_BREAK
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
#if defined(CPUM64)
|
||||
@@ -1320,12 +1320,12 @@ void menuModelSetup(uint8_t event)
|
||||
}
|
||||
}
|
||||
|
||||
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, PSTR("\004""Off\0""Man\0""Auto"), potMode, attr & ((m_posHorz == 0) ? attr : !INVERS));
|
||||
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, PSTR("\004""OFF\0""Man\0""Auto"), potMode, attr & ((m_posHorz == 0) ? attr : !INVERS));
|
||||
if (potMode) {
|
||||
uint8_t x = MODEL_SETUP_2ND_COLUMN+5*FW;
|
||||
for (uint8_t i=0; i<NUM_POTS ; i++) {
|
||||
#if !defined(REVPLUS)
|
||||
if (i == POT3-POT1) {
|
||||
if (attr && i == POT3-POT1) {
|
||||
if (m_posHorz==i+1) REPEAT_LAST_CURSOR_MOVE();
|
||||
continue;
|
||||
}
|
||||
@@ -1940,7 +1940,7 @@ void menuModelFlightModesAll(uint8_t event)
|
||||
|
||||
case ITEM_FLIGHT_MODES_SWITCH:
|
||||
putsSwitches((5+LEN_FP_NAME)*FW+FW/2, y, p->swtch, attr);
|
||||
if (active) CHECK_INCDEC_MODELSWITCH(event, p->swtch, SWSRC_FIRST_SHORT_LIST, SWSRC_LAST_SHORT_LIST);
|
||||
if (active) CHECK_INCDEC_MODELSWITCH(event, p->swtch, SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, isSwitchAvailableInMixes);
|
||||
break;
|
||||
|
||||
case ITEM_FLIGHT_MODES_TRIM_RUD:
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
@@ -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
|
||||
@@ -4691,28 +4695,21 @@ void menuModelLogicalSwitches(uint8_t event)
|
||||
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
|
||||
putsSwitches(CSW_2ND_COLUMN, y, cs->v1, attr1);
|
||||
putsSwitches(CSW_3RD_COLUMN, y, cs->v2, attr2);
|
||||
v1_min = SWSRC_OFF+1; v1_max = SWSRC_ON-1;
|
||||
v2_min = SWSRC_OFF+1; v2_max = SWSRC_ON-1;
|
||||
v1_min = SWSRC_FIRST_IN_LOGICAL_SWITCHES; v1_max = SWSRC_LAST_IN_LOGICAL_SWITCHES;
|
||||
v2_min = SWSRC_FIRST_IN_LOGICAL_SWITCHES; v2_max = SWSRC_LAST_IN_LOGICAL_SWITCHES;
|
||||
INCDEC_SET_FLAG(INCDEC_SWITCH);
|
||||
INCDEC_ENABLE_CHECK(isSwitchAvailableInLogicalSwitches);
|
||||
}
|
||||
#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, ']');
|
||||
v1_min = SWSRC_OFF+1; v1_max = SWSRC_ON-1;
|
||||
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;
|
||||
if (horz == 1) {
|
||||
INCDEC_SET_FLAG(INCDEC_SWITCH);
|
||||
INCDEC_ENABLE_CHECK(isSwitchAvailable);
|
||||
INCDEC_ENABLE_CHECK(isSwitchAvailableInLogicalSwitches);
|
||||
}
|
||||
else {
|
||||
INCDEC_SET_FLAG(0);
|
||||
@@ -5042,7 +5039,7 @@ void menuModelCustomFunctions(uint8_t event)
|
||||
switch (j) {
|
||||
case 0:
|
||||
putsSwitches(MODEL_CUSTOM_FUNC_1ST_COLUMN, y, CFN_SWITCH(sd), attr | ((activeFnSwitches & ((MASK_CFN_TYPE)1 << k)) ? BOLD : 0));
|
||||
if (active || AUTOSWITCH_ENTER_LONG()) CHECK_INCDEC_MODELSWITCH(event, CFN_SWITCH(sd), SWSRC_FIRST, SWSRC_LAST);
|
||||
if (active || AUTOSWITCH_ENTER_LONG()) CHECK_INCDEC_MODELSWITCH(event, CFN_SWITCH(sd), SWSRC_FIRST, SWSRC_LAST, isSwitchAvailableInCustomFunctions);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
@@ -5068,8 +5065,8 @@ void menuModelCustomFunctions(uint8_t event)
|
||||
case 2:
|
||||
{
|
||||
int8_t maxParam = NUM_CHNOUT-1;
|
||||
#if defined(SAFETY_CHANNEL_FUNCTION)
|
||||
if (func == FUNC_SAFETY_CHANNEL) {
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
if (func == FUNC_OVERRIDE_CHANNEL) {
|
||||
putsChn(lcdNextPos, y, CFN_CH_INDEX(sd)+1, attr);
|
||||
}
|
||||
else
|
||||
@@ -5120,8 +5117,8 @@ void menuModelCustomFunctions(uint8_t event)
|
||||
val_max = FUNC_RESET_PARAM_LAST;
|
||||
lcd_putsiAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, STR_VFSWRESET, CFN_PARAM(sd), attr);
|
||||
}
|
||||
#if defined(SAFETY_CHANNEL_FUNCTION)
|
||||
else if (func == FUNC_SAFETY_CHANNEL) {
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
else if (func == FUNC_OVERRIDE_CHANNEL) {
|
||||
val_displayed = (int8_t)CFN_PARAM(sd);
|
||||
val_min = -125; val_max = 125;
|
||||
lcd_outdezAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
|
||||
|
||||
+77
-23
@@ -1117,7 +1117,7 @@ int8_t switchMenuItem(uint8_t x, uint8_t y, int8_t value, LcdFlags attr, uint8_t
|
||||
{
|
||||
lcd_putsColumnLeft(x, y, STR_SWITCH);
|
||||
putsSwitches(x, y, value, attr);
|
||||
if (attr) CHECK_INCDEC_MODELSWITCH(event, value, SWSRC_FIRST_SHORT_LIST, SWSRC_LAST_SHORT_LIST);
|
||||
if (attr) CHECK_INCDEC_MODELSWITCH(event, value, SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, isSwitchAvailableInMixes);
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -1433,6 +1433,12 @@ bool isTelemetrySourceAvailable(int source)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) && defined(REVPLUS)
|
||||
// on Taranis+ we also hide the SWR
|
||||
if (source == TELEM_SWR)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
if (source >= TELEM_A1 && source <= TELEM_A4) {
|
||||
return g_model.frsky.channels[source-TELEM_A1].ratio != 0;
|
||||
}
|
||||
@@ -1462,6 +1468,14 @@ bool isTelemetrySourceAvailable(int source)
|
||||
|
||||
bool isInputSourceAvailable(int source)
|
||||
{
|
||||
#if defined(PCBTARANIS) && !defined(REVPLUS)
|
||||
if (source == MIXSRC_POT3)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
if (source>=MIXSRC_Rud && source<=MIXSRC_MAX)
|
||||
return true;
|
||||
|
||||
if (source>=MIXSRC_Rud && source<=MIXSRC_MAX)
|
||||
return true;
|
||||
|
||||
@@ -1480,17 +1494,25 @@ bool isInputSourceAvailable(int source)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isSwitchAvailableInLogicalSwitches(int swtch)
|
||||
enum SwitchContext
|
||||
{
|
||||
LogicalSwitchesContext,
|
||||
CustomFunctionsContext,
|
||||
TimersContext,
|
||||
MixesContext
|
||||
};
|
||||
|
||||
bool isSwitchAvailable(int swtch, SwitchContext context)
|
||||
{
|
||||
if (swtch < 0) {
|
||||
if (swtch <= -SWSRC_ON)
|
||||
return false;
|
||||
#if defined(PCBTARANIS)
|
||||
else if (swtch == -SWSRC_SF0 || swtch == -SWSRC_SF2 || swtch == -SWSRC_SH0 || swtch == -SWSRC_SH2)
|
||||
if (swtch == -SWSRC_SF0 || swtch == -SWSRC_SF2 || swtch == -SWSRC_SH0 || swtch == -SWSRC_SH2)
|
||||
return false;
|
||||
#endif
|
||||
else
|
||||
swtch = -swtch;
|
||||
if (swtch == -SWSRC_ON || swtch == -SWSRC_One) {
|
||||
return false;
|
||||
}
|
||||
swtch = -swtch;
|
||||
}
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
@@ -1506,27 +1528,59 @@ bool isSwitchAvailableInLogicalSwitches(int swtch)
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isSwitchAvailable(int swtch)
|
||||
{
|
||||
if (!isSwitchAvailableInLogicalSwitches(swtch)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (swtch < 0) {
|
||||
swtch = -swtch;
|
||||
}
|
||||
|
||||
if (swtch >= SWSRC_FIRST_LOGICAL_SWITCH && swtch <= SWSRC_LAST_LOGICAL_SWITCH) {
|
||||
if (context != LogicalSwitchesContext && swtch >= SWSRC_FIRST_LOGICAL_SWITCH && swtch <= SWSRC_LAST_LOGICAL_SWITCH) {
|
||||
LogicalSwitchData * cs = lswAddress(swtch-SWSRC_FIRST_LOGICAL_SWITCH);
|
||||
return (cs->func != LS_FUNC_NONE);
|
||||
}
|
||||
|
||||
if (context != CustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_One)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (swtch >= SWSRC_FIRST_FLIGHT_MODE && swtch <= SWSRC_LAST_FLIGHT_MODE) {
|
||||
if (context == MixesContext) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
swtch -= SWSRC_FIRST_FLIGHT_MODE;
|
||||
if (swtch == 0) {
|
||||
return true;
|
||||
}
|
||||
FlightModeData * fm = flightModeAddress(swtch);
|
||||
return (fm->swtch != SWSRC_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isSwitchAvailableInLogicalSwitches(int swtch)
|
||||
{
|
||||
return isSwitchAvailable(swtch, LogicalSwitchesContext);
|
||||
}
|
||||
|
||||
bool isSwitchAvailableInCustomFunctions(int swtch)
|
||||
{
|
||||
return isSwitchAvailable(swtch, CustomFunctionsContext);
|
||||
}
|
||||
|
||||
bool isSwitchAvailableInMixes(int swtch)
|
||||
{
|
||||
return isSwitchAvailable(swtch, MixesContext);
|
||||
}
|
||||
|
||||
bool isSwitchAvailableInTimers(int swtch)
|
||||
{
|
||||
if (swtch >= 0) {
|
||||
if (swtch < TMRMODE_COUNT) {
|
||||
return true;
|
||||
}
|
||||
swtch -= TMRMODE_COUNT-1;
|
||||
}
|
||||
|
||||
return isSwitchAvailable(swtch, TimersContext);
|
||||
}
|
||||
|
||||
bool isThrottleSourceAvailable(int source)
|
||||
{
|
||||
#if defined(PCBTARANIS)
|
||||
@@ -1544,8 +1598,8 @@ bool isLogicalSwitchFunctionAvailable(int function)
|
||||
bool isAssignableFunctionAvailable(int function)
|
||||
{
|
||||
switch (function) {
|
||||
#if !defined(SAFETY_CHANNEL_FUNCTION)
|
||||
case FUNC_SAFETY_CHANNEL:
|
||||
#if !defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
case FUNC_OVERRIDE_CHANNEL:
|
||||
#endif
|
||||
#if !defined(HAPTIC)
|
||||
case FUNC_HAPTIC:
|
||||
|
||||
+12
-5
@@ -209,9 +209,13 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
||||
var = checkIncDecModelZero(event,var,max)
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define CHECK_INCDEC_MODELVAR_CHECK(event, var, min, max, check) \
|
||||
var = checkIncDec(event, var, min, max, EE_MODEL, check)
|
||||
#define CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, var, max, check) \
|
||||
var = checkIncDec(event, var, 0, max, EE_MODEL, check)
|
||||
#else
|
||||
#define CHECK_INCDEC_MODELVAR_CHECK(event, var, min, max, check) \
|
||||
var = checkIncDec(event, var, min, max, EE_MODEL)
|
||||
#define CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, var, max, check) \
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, var, max)
|
||||
#endif
|
||||
@@ -220,19 +224,22 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
||||
bool isThrottleSourceAvailable(int source);
|
||||
bool isLogicalSwitchFunctionAvailable(int function);
|
||||
bool isAssignableFunctionAvailable(int function);
|
||||
bool isSwitchAvailable(int swtch);
|
||||
bool isSwitchAvailableInLogicalSwitches(int swtch);
|
||||
bool isSwitchAvailableInCustomFunctions(int swtch);
|
||||
bool isSwitchAvailableInMixes(int swtch);
|
||||
bool isSwitchAvailableInTimers(int swtch);
|
||||
bool isModuleAvailable(int module);
|
||||
#define AUTOSWITCH_ENTER_LONG() (attr && event==EVT_KEY_LONG(KEY_ENTER))
|
||||
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max) \
|
||||
var = checkIncDec(event,var,min,max,EE_MODEL|INCDEC_SWITCH|NO_INCDEC_MARKS, isSwitchAvailable)
|
||||
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max, available) \
|
||||
var = checkIncDec(event,var,min,max,EE_MODEL|INCDEC_SWITCH|NO_INCDEC_MARKS, available)
|
||||
#elif defined(AUTOSWITCH)
|
||||
#define AUTOSWITCH_ENTER_LONG() (attr && event==EVT_KEY_LONG(KEY_ENTER))
|
||||
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max) \
|
||||
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max, available) \
|
||||
var = checkIncDec(event,var,min,max,EE_MODEL|INCDEC_SWITCH)
|
||||
#else
|
||||
#define AUTOSWITCH_ENTER_LONG() (0)
|
||||
#define CHECK_INCDEC_MODELSWITCH CHECK_INCDEC_MODELVAR
|
||||
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max, available) \
|
||||
CHECK_INCDEC_MODELVAR(event, var, min, max)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
|
||||
@@ -306,7 +306,7 @@ void displayTopBar()
|
||||
}
|
||||
|
||||
/* Audio volume */
|
||||
if (requiredSpeakerVolume == 0)
|
||||
if (requiredSpeakerVolume == 0 || g_eeGeneral.beepMode == e_mode_quiet)
|
||||
LCD_ICON(BAR_VOLUME_X, BAR_Y, ICON_SPEAKER0);
|
||||
else if (requiredSpeakerVolume < 10)
|
||||
LCD_ICON(BAR_VOLUME_X, BAR_Y, ICON_SPEAKER1);
|
||||
@@ -340,8 +340,8 @@ void displayTimers()
|
||||
// Main timer
|
||||
if (g_model.timers[0].mode) {
|
||||
TimerState & timerState = timersStates[0];
|
||||
putsTimer(TIMERS_X, TIMER1_Y, timerState.val, TIMEHOUR|MIDSIZE|LEFT, TIMEHOUR|MIDSIZE|LEFT);
|
||||
putsTimerMode(TIMERS_X, TIMER1_Y-6, g_model.timers[0].mode, SMLSIZE);
|
||||
putsTimer(TIMERS_X, TIMER1_Y, timerState.val, TIMEHOUR|MIDSIZE|LEFT, TIMEHOUR|MIDSIZE|LEFT);
|
||||
if (g_model.timers[0].persistent) lcd_putcAtt(TIMERS_R, TIMER1_Y+1, 'P', SMLSIZE);
|
||||
if (timerState.val < 0) {
|
||||
if (BLINK_ON_PHASE) {
|
||||
@@ -353,8 +353,8 @@ void displayTimers()
|
||||
// Second timer
|
||||
if (g_model.timers[1].mode) {
|
||||
TimerState & timerState = timersStates[1];
|
||||
putsTimer(TIMERS_X, TIMER2_Y, timerState.val, TIMEHOUR|MIDSIZE|LEFT, TIMEHOUR|MIDSIZE|LEFT);
|
||||
putsTimerMode(TIMERS_X, TIMER2_Y-6, g_model.timers[1].mode, SMLSIZE);
|
||||
putsTimer(TIMERS_X, TIMER2_Y, timerState.val, TIMEHOUR|MIDSIZE|LEFT, TIMEHOUR|MIDSIZE|LEFT);
|
||||
if (g_model.timers[1].persistent) lcd_putcAtt(TIMERS_R, TIMER2_Y+1, 'P', SMLSIZE);
|
||||
if (timerState.val < 0) {
|
||||
if (BLINK_ON_PHASE) {
|
||||
|
||||
@@ -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
|
||||
@@ -149,76 +160,86 @@ 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 defined(PCBTARANIS)
|
||||
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_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);
|
||||
|
||||
@@ -310,7 +310,7 @@ bool displayGaugesTelemetryScreen(FrSkyScreenData & screen)
|
||||
else {
|
||||
#if defined(CPUARM)
|
||||
threshold = barsThresholds[source-TELEM_ALT];
|
||||
#else
|
||||
#elif defined(GAUGES)
|
||||
threshold = convertBarTelemValue(source, barsThresholds[source-TELEM_ALT]);
|
||||
#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
|
||||
|
||||
+101
-15
@@ -51,14 +51,90 @@ uint8_t lcdLastPos;
|
||||
uint8_t lcdNextPos;
|
||||
|
||||
#if defined(CPUARM)
|
||||
void lcdPutPattern(xcoord_t x, uint8_t y, const uint8_t * pattern, uint8_t width, uint8_t height, LcdFlags flags);
|
||||
void lcdPutPattern(xcoord_t x, uint8_t y, const uint8_t * pattern, uint8_t width, uint8_t height, LcdFlags flags)
|
||||
{
|
||||
bool blink = false;
|
||||
bool inv = false;
|
||||
if (flags & BLINK) {
|
||||
if (BLINK_ON_PHASE) {
|
||||
if (flags & INVERS)
|
||||
inv = true;
|
||||
else {
|
||||
blink = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (flags & INVERS) {
|
||||
inv = true;
|
||||
}
|
||||
|
||||
uint8_t lines = (height+7)/8;
|
||||
assert(lines <= 5);
|
||||
|
||||
for (int8_t i=0; i<width+2; i++) {
|
||||
if (x<LCD_W) {
|
||||
uint8_t b[5] = { 0 };
|
||||
if (i==0) {
|
||||
if (x==0 || !inv) {
|
||||
lcdNextPos++;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
// we need to work on the previous x when INVERS
|
||||
x--;
|
||||
}
|
||||
}
|
||||
else if (i<=width) {
|
||||
uint8_t skip = true;
|
||||
for (uint8_t j=0; j<lines; j++) {
|
||||
b[j] = pgm_read_byte(pattern++); /*top byte*/
|
||||
if (b[j] != 0xff) {
|
||||
skip = false;
|
||||
}
|
||||
}
|
||||
if (skip) {
|
||||
if (flags & FIXEDWIDTH) {
|
||||
for (uint8_t j=0; j<lines; j++) {
|
||||
b[j] = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((flags & CONDENSED) && i==2) {
|
||||
/*condense the letter by skipping column 3 */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for (int8_t j=-1; j<=height; j++) {
|
||||
bool plot;
|
||||
if (j < 0 || j == height) {
|
||||
plot = false;
|
||||
if (height >= 12) continue;
|
||||
if (j<0 && !inv) continue;
|
||||
}
|
||||
else {
|
||||
uint8_t line = (j / 8);
|
||||
uint8_t pixel = (j % 8);
|
||||
plot = b[line] & (1 << pixel);
|
||||
}
|
||||
if (inv) plot = !plot;
|
||||
if (!blink) {
|
||||
lcd_plot(x, y+j, plot ? FORCE : ERASE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
x++;
|
||||
lcdNextPos++;
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
|
||||
{
|
||||
#if !defined(BOOT)
|
||||
const pm_uchar *q = (c < 0xC0) ? &font_5x7[(c-0x20)*5] : &font_5x7_extra[(c-0xC0)*5];
|
||||
#else
|
||||
const pm_uchar *q = &font_5x7[(c-0x20)*5];
|
||||
#endif
|
||||
const pm_uchar * q;
|
||||
|
||||
lcdNextPos = x-1;
|
||||
|
||||
@@ -78,14 +154,17 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
|
||||
c_remapped = 4;
|
||||
else if (c!=' ')
|
||||
flags &= ~BOLD;
|
||||
if ((c>= 128) && (flags & DBLSIZE))
|
||||
c_remapped = c - 60;
|
||||
}
|
||||
|
||||
if (flags & DBLSIZE) {
|
||||
/* each letter consists of ten top bytes followed by
|
||||
* by ten bottom bytes (20 bytes per * char) */
|
||||
q = &font_10x14[((uint16_t)c_remapped)*20];
|
||||
if (c >= 0xC0) {
|
||||
q = &font_10x14_extra[((uint16_t)(c-0xC0))*20];
|
||||
}
|
||||
else {
|
||||
if (c >= 128)
|
||||
c_remapped = c - 60;
|
||||
q = &font_10x14[((uint16_t)c_remapped)*20];
|
||||
}
|
||||
lcdPutPattern(x, y, q, 10, 16, flags);
|
||||
}
|
||||
else if (flags & XXLSIZE) {
|
||||
@@ -94,23 +173,30 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
|
||||
}
|
||||
else if (flags & MIDSIZE) {
|
||||
q = &font_8x10[((uint16_t)c-0x20)*16];
|
||||
lcdPutPattern(x, y, q, 8, 11, flags);
|
||||
lcdPutPattern(x, y, q, 8, 12, flags);
|
||||
}
|
||||
else if (flags & SMLSIZE) {
|
||||
q = (c < 0xc0 ? &font_4x6[(c-0x20)*5] : &font_4x6_extra[(c-0xc0)*5]);
|
||||
lcdPutPattern(x, y, q, 5, 6, flags);
|
||||
lcdPutPattern(x, y, q, 5, 7, flags);
|
||||
}
|
||||
else if (flags & TINSIZE) {
|
||||
q = &font_3x5[((uint16_t)c-0x2d)*3];
|
||||
lcdPutPattern(x, y, q, 3, 5, flags);
|
||||
}
|
||||
#if defined(BOLD_FONT)
|
||||
else if (flags & BOLD) {
|
||||
q = &font_5x7_B[c_remapped*5];
|
||||
lcdPutPattern(x, y, q, 5, 7, flags);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#if !defined(BOOT)
|
||||
q = (c < 0xC0) ? &font_5x7[(c-0x20)*5] : &font_5x7_extra[(c-0xC0)*5];
|
||||
#else
|
||||
q = &font_5x7[(c-0x20)*5];
|
||||
#endif
|
||||
lcdPutPattern(x, y, q, 5, 7, flags);
|
||||
}
|
||||
}
|
||||
@@ -757,10 +843,10 @@ void putsCurve(xcoord_t x, uint8_t y, int8_t idx, LcdFlags att)
|
||||
void putsTimerMode(xcoord_t x, uint8_t y, int8_t mode, LcdFlags att)
|
||||
{
|
||||
if (mode >= 0) {
|
||||
if (mode < TMR_VAROFS)
|
||||
if (mode < TMRMODE_COUNT)
|
||||
return lcd_putsiAtt(x, y, STR_VTMRMODES, mode, att);
|
||||
else
|
||||
mode -= (TMR_VAROFS-1);
|
||||
mode -= (TMRMODE_COUNT-1);
|
||||
}
|
||||
putsSwitches(x, y, mode, att);
|
||||
}
|
||||
|
||||
+1
-104
@@ -38,110 +38,7 @@
|
||||
|
||||
#define LCD_BYTE_FILTER(p, keep, add) *(p) = (*(p) & (keep)) | (add)
|
||||
|
||||
#if defined(CPUARM)
|
||||
void lcdPutPattern(xcoord_t x, uint8_t y, const uint8_t * pattern, uint8_t width, uint8_t height, LcdFlags flags)
|
||||
{
|
||||
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
|
||||
uint8_t *end = &displayBuf[ y / 8 * LCD_W + LCD_W ];
|
||||
|
||||
bool blink = false;
|
||||
bool inv = false;
|
||||
if (flags & BLINK) {
|
||||
if (BLINK_ON_PHASE) {
|
||||
if (flags & INVERS)
|
||||
inv = true;
|
||||
else {
|
||||
blink = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (flags & INVERS) {
|
||||
inv = true;
|
||||
}
|
||||
|
||||
uint8_t lines = (height+7)/8;
|
||||
assert(lines <= 5);
|
||||
|
||||
for (int8_t i=0; i<width+2; i++) {
|
||||
if (p<end) {
|
||||
uint8_t b[5] = { 0 };
|
||||
if (i==0) {
|
||||
if (x==0 || !inv) {
|
||||
lcdNextPos++;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
// we need to work on the previous byte when INVERS
|
||||
p--;
|
||||
}
|
||||
}
|
||||
else if (i<=width) {
|
||||
uint8_t skip = true;
|
||||
for (uint8_t j=0; j<lines; j++) {
|
||||
b[j] = pgm_read_byte(pattern++); /*top byte*/
|
||||
if (b[j] != 0xff) {
|
||||
skip = false;
|
||||
}
|
||||
}
|
||||
if (skip) {
|
||||
if (flags & FIXEDWIDTH) {
|
||||
for (uint8_t j=0; j<lines; j++) {
|
||||
b[j] = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((flags & CONDENSED) && i==2) {
|
||||
/*condense the letter by skipping column 3 */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
const uint8_t ym8 = (y & 0x07);
|
||||
const uint8_t keepref = (1 << ((height&0x07)+1)) - 1;
|
||||
uint8_t * dest = p;
|
||||
for (uint8_t j=0; j<lines+1; j++) {
|
||||
if (dest < DISPLAY_END) {
|
||||
uint8_t b1=0, b2=0, keep=0;
|
||||
if (j>0) {
|
||||
b1 = b[j-1] >> (8-ym8);
|
||||
}
|
||||
else {
|
||||
keep = ~(keepref << ym8);
|
||||
}
|
||||
if (j<lines) {
|
||||
if (inv) {
|
||||
b[j] = ~b[j];
|
||||
}
|
||||
b2 = b[j] << ym8;
|
||||
}
|
||||
else {
|
||||
keep = ~(keepref >> (8-ym8));
|
||||
}
|
||||
if (!blink) {
|
||||
LCD_BYTE_FILTER(dest, keep, b1|b2);
|
||||
}
|
||||
dest += LCD_W;
|
||||
}
|
||||
}
|
||||
|
||||
if (inv && height<8) {
|
||||
if (ym8) {
|
||||
lcd_mask(p, 0x01 << (ym8-1), FORCE);
|
||||
}
|
||||
else if (y) {
|
||||
ASSERT_IN_DISPLAY(p - LCD_W);
|
||||
lcd_mask(p - LCD_W, 0x80, FORCE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p++;
|
||||
lcdNextPos++;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#if !defined(CPUARM)
|
||||
void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
|
||||
{
|
||||
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
|
||||
|
||||
@@ -36,86 +36,6 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
void lcdPutPattern(xcoord_t x, uint8_t y, const uint8_t * pattern, uint8_t width, uint8_t height, LcdFlags flags)
|
||||
{
|
||||
bool blink = false;
|
||||
bool inv = false;
|
||||
if (flags & BLINK) {
|
||||
if (BLINK_ON_PHASE) {
|
||||
if (flags & INVERS)
|
||||
inv = true;
|
||||
else {
|
||||
blink = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (flags & INVERS) {
|
||||
inv = true;
|
||||
}
|
||||
|
||||
uint8_t lines = (height+7)/8;
|
||||
assert(lines <= 5);
|
||||
|
||||
for (int8_t i=0; i<width+2; i++) {
|
||||
if (x<LCD_W) {
|
||||
uint8_t b[5] = { 0 };
|
||||
if (i==0) {
|
||||
if (x==0 || !inv) {
|
||||
lcdNextPos++;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
// we need to work on the previous x when INVERS
|
||||
x--;
|
||||
}
|
||||
}
|
||||
else if (i<=width) {
|
||||
uint8_t skip = true;
|
||||
for (uint8_t j=0; j<lines; j++) {
|
||||
b[j] = pgm_read_byte(pattern++); /*top byte*/
|
||||
if (b[j] != 0xff) {
|
||||
skip = false;
|
||||
}
|
||||
}
|
||||
if (skip) {
|
||||
if (flags & FIXEDWIDTH) {
|
||||
for (uint8_t j=0; j<lines; j++) {
|
||||
b[j] = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((flags & CONDENSED) && i==2) {
|
||||
/*condense the letter by skipping column 3 */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for (int8_t j=-1; j<=height; j++) {
|
||||
bool plot;
|
||||
if (j < 0 || j == height) {
|
||||
plot = false;
|
||||
if (j<0 && !inv) continue;
|
||||
}
|
||||
else {
|
||||
uint8_t line = (j / 8);
|
||||
uint8_t pixel = (j % 8);
|
||||
plot = b[line] & (1 << pixel);
|
||||
}
|
||||
if (inv) plot = !plot;
|
||||
if (!blink) {
|
||||
lcd_plot(x, y+j, plot ? FORCE : ERASE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
x++;
|
||||
lcdNextPos++;
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_mask(uint8_t *p, uint8_t mask, LcdFlags att)
|
||||
{
|
||||
ASSERT_IN_DISPLAY(p);
|
||||
@@ -172,7 +92,7 @@ void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat, LcdFlags att)
|
||||
if (x >= LCD_W) return;
|
||||
if (y >= LCD_H) return;
|
||||
if (h<0) { y+=h; h=-h; }
|
||||
if (y<0) { h+=y; y=0; }
|
||||
if (y<0) { h+=y; y=0; if (h<=0) return; }
|
||||
if (y+h > LCD_H) { h = LCD_H - y; }
|
||||
|
||||
if (pat==DOTTED && !(y%2)) {
|
||||
@@ -225,7 +145,12 @@ void lcd_bmp(xcoord_t x, uint8_t y, const pm_uchar * img, uint8_t offset, uint8_
|
||||
{
|
||||
const pm_uchar *q = img;
|
||||
uint8_t w = pgm_read_byte(q++);
|
||||
if (!width) width = w;
|
||||
if (!width || width > w) {
|
||||
width = w;
|
||||
}
|
||||
if (x+width > LCD_W) {
|
||||
width = LCD_W-x;
|
||||
}
|
||||
uint8_t rows = (pgm_read_byte(q++) + 1) / 2;
|
||||
|
||||
for (uint8_t row=0; row<rows; row++) {
|
||||
|
||||
+13
-4
@@ -115,7 +115,9 @@ const pm_char * openLogs()
|
||||
f_puts("Time,", &g_oLogFile);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM) && defined(FRSKY)
|
||||
#if defined(PCBTARANIS) && defined(REVPLUS)
|
||||
f_puts("RSSI,A1,A2,A3,A4,", &g_oLogFile);
|
||||
#elif defined(CPUARM) && defined(FRSKY)
|
||||
f_puts("SWR,RSSI,A1,A2,A3,A4,", &g_oLogFile);
|
||||
#elif defined(FRSKY)
|
||||
f_puts("Buffer,RX,TX,A1,A2,", &g_oLogFile);
|
||||
@@ -155,7 +157,10 @@ tmr10ms_t lastLogTime = 0;
|
||||
|
||||
void closeLogs()
|
||||
{
|
||||
f_close(&g_oLogFile);
|
||||
if (f_close(&g_oLogFile) != FR_OK) {
|
||||
// close failed, forget file
|
||||
g_oLogFile.fs = 0;
|
||||
}
|
||||
lastLogTime = 0;
|
||||
}
|
||||
|
||||
@@ -195,7 +200,9 @@ void writeLogs()
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY)
|
||||
#if defined(CPUARM)
|
||||
#if defined(PCBTARANIS) && defined(REVPLUS)
|
||||
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]));
|
||||
@@ -279,13 +286,15 @@ void writeLogs()
|
||||
if (result<0 && !error_displayed) {
|
||||
error_displayed = STR_SDCARD_ERROR;
|
||||
POPUP_WARNING(STR_SDCARD_ERROR);
|
||||
closeLogs();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
error_displayed = NULL;
|
||||
if (g_oLogFile.fs)
|
||||
if (g_oLogFile.fs) {
|
||||
closeLogs();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+559
-272
File diff suppressed because it is too large
Load Diff
+35
-21
@@ -64,6 +64,7 @@ int16_t ex_chans[NUM_CHNOUT] = {0}; // Outputs (before LIMITS) of the last perMa
|
||||
int16_t cyc_anas[3] = {0};
|
||||
#if defined(PCBTARANIS)
|
||||
int16_t heliAnas[4] = {0};
|
||||
uint8_t heliTrims[4] = {0};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -105,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];
|
||||
@@ -151,10 +153,14 @@ void applyExpos(int16_t *anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS)
|
||||
virtualInputsTrims[cur_chn] = -1;
|
||||
|
||||
#if defined(HELI)
|
||||
if (ed->srcRaw == MIXSRC_Ele)
|
||||
if (ed->srcRaw == MIXSRC_Ele) {
|
||||
heliAnas[ELE_STICK] = v;
|
||||
else if (ed->srcRaw == MIXSRC_Ail)
|
||||
heliTrims[ELE_STICK] = virtualInputsTrims[cur_chn];
|
||||
}
|
||||
else if (ed->srcRaw == MIXSRC_Ail) {
|
||||
heliAnas[AIL_STICK] = v;
|
||||
heliTrims[AIL_STICK] = virtualInputsTrims[cur_chn];
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -245,7 +251,7 @@ int16_t applyLimits(uint8_t channel, int32_t value)
|
||||
|
||||
if (lim->revert) ofs = -ofs; // finally do the reverse.
|
||||
|
||||
#if defined(SAFETY_CHANNEL_FUNCTION)
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
if (safetyCh[channel] != -128) // if safety channel available for channel check
|
||||
ofs = calc100toRESX(safetyCh[channel]);
|
||||
#endif
|
||||
@@ -504,17 +510,17 @@ void evalInputs(uint8_t mode)
|
||||
|
||||
#if !defined(PCBTARANIS)
|
||||
rawAnas[ch] = v;
|
||||
anas[ch] = v; //set values for mixer
|
||||
anas[ch] = v; // set values for mixer
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* TRIMs */
|
||||
evalTrims();
|
||||
|
||||
/* EXPOs */
|
||||
applyExpos(anas, mode);
|
||||
|
||||
/* TRIMs */
|
||||
evalTrims(); // when no virtual inputs, the trims need the anas array calculated above (when throttle trim enabled)
|
||||
|
||||
if (mode == e_perout_mode_normal) {
|
||||
#if !defined(CPUARM)
|
||||
anaCenter &= g_model.beepANACenter;
|
||||
@@ -525,9 +531,11 @@ void evalInputs(uint8_t mode)
|
||||
}
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define HELI_ANAS_ARRAY heliAnas
|
||||
#define HELI_ANAS_ARRAY(x) heliAnas[x]
|
||||
#define HELI_TRIMS_ARRAY(x) trims[heliTrims[x]]
|
||||
#else
|
||||
#define HELI_ANAS_ARRAY anas
|
||||
#define HELI_ANAS_ARRAY(x) anas[x]
|
||||
#define HELI_TRIMS_ARRAY(x) trims[x]
|
||||
#endif
|
||||
|
||||
uint8_t mixerCurrentFlightMode;
|
||||
@@ -543,14 +551,14 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
||||
|
||||
#if defined(HELI)
|
||||
if (g_model.swashR.value) {
|
||||
uint32_t v = ((int32_t)HELI_ANAS_ARRAY[ELE_STICK]*HELI_ANAS_ARRAY[ELE_STICK] + (int32_t)HELI_ANAS_ARRAY[AIL_STICK]*HELI_ANAS_ARRAY[AIL_STICK]);
|
||||
uint32_t v = ((int32_t)HELI_ANAS_ARRAY(ELE_STICK)*HELI_ANAS_ARRAY(ELE_STICK) + (int32_t)HELI_ANAS_ARRAY(AIL_STICK)*HELI_ANAS_ARRAY(AIL_STICK));
|
||||
uint32_t q = calc100toRESX(g_model.swashR.value);
|
||||
q *= q;
|
||||
if (v>q) {
|
||||
uint16_t d = isqrt32(v);
|
||||
int16_t tmp = calc100toRESX(g_model.swashR.value);
|
||||
HELI_ANAS_ARRAY[ELE_STICK] = (int32_t) HELI_ANAS_ARRAY[ELE_STICK]*tmp/d;
|
||||
HELI_ANAS_ARRAY[AIL_STICK] = (int32_t) HELI_ANAS_ARRAY[AIL_STICK]*tmp/d;
|
||||
HELI_ANAS_ARRAY(ELE_STICK) = (int32_t) HELI_ANAS_ARRAY(ELE_STICK)*tmp/d;
|
||||
HELI_ANAS_ARRAY(AIL_STICK) = (int32_t) HELI_ANAS_ARRAY(AIL_STICK)*tmp/d;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -558,8 +566,8 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
||||
#define REZ_SWASH_Y(x) ((x)) // 1024 => 1024
|
||||
|
||||
if (g_model.swashR.type) {
|
||||
getvalue_t vp = HELI_ANAS_ARRAY[ELE_STICK]+trims[ELE_STICK];
|
||||
getvalue_t vr = HELI_ANAS_ARRAY[AIL_STICK]+trims[AIL_STICK];
|
||||
getvalue_t vp = HELI_ANAS_ARRAY(ELE_STICK) + HELI_TRIMS_ARRAY(ELE_STICK);
|
||||
getvalue_t vr = HELI_ANAS_ARRAY(AIL_STICK) + HELI_TRIMS_ARRAY(AIL_STICK);
|
||||
getvalue_t vc = 0;
|
||||
if (g_model.swashR.collectiveSource)
|
||||
vc = getValue(g_model.swashR.collectiveSource);
|
||||
@@ -637,7 +645,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
||||
|
||||
//========== PHASE && SWITCH =====
|
||||
bool mixCondition = (md->flightModes != 0 || md->swtch);
|
||||
delayval_t mixEnabled = !(md->flightModes & (1 << mixerCurrentFlightMode)) && getSwitch(md->swtch);
|
||||
delayval_t mixEnabled = (!(md->flightModes & (1 << mixerCurrentFlightMode)) && getSwitch(md->swtch)) ? DELAY_POS_MARGIN+1 : 0;
|
||||
|
||||
if (mixEnabled && md->srcRaw >= MIXSRC_FIRST_TRAINER && md->srcRaw <= MIXSRC_LAST_TRAINER && !ppmInValid) {
|
||||
mixEnabled = 0;
|
||||
@@ -742,11 +750,17 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
||||
else
|
||||
mix_trim = -1;
|
||||
if (mix_trim >= 0) {
|
||||
int16_t trim = trims[mix_trim];
|
||||
if (mix_trim == THR_STICK && g_model.throttleReversed)
|
||||
v -= trim;
|
||||
else
|
||||
v += trim;
|
||||
int32_t trim = trims[mix_trim];
|
||||
if (mix_trim == THR_STICK) {
|
||||
if (g_model.thrTrim) {
|
||||
int16_t trimMin = g_model.extendedTrims ? 2*TRIM_EXTENDED_MIN : 2*TRIM_MIN;
|
||||
trim = (((g_model.throttleReversed)?(trim+trimMin):(trim-trimMin)) * (RESX-v)) >> (RESX_SHIFT+1);
|
||||
}
|
||||
if (g_model.throttleReversed) {
|
||||
trim = -trim;
|
||||
}
|
||||
}
|
||||
v += trim;
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
+140
-98
@@ -39,6 +39,18 @@
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#if defined(EXPORT)
|
||||
#define LUA_EXPORT(...) LEXP(__VA_ARGS__)
|
||||
#define LUA_EXPORT_TELEMETRY(...) LEXP_TELEMETRY(__VA_ARGS__)
|
||||
#define LUA_EXPORT_MULTIPLE(...) LEXP_MULTIPLE(__VA_ARGS__)
|
||||
#define LUA_EXPORT_EXTRA(...) LEXP_EXTRA(__VA_ARGS__)
|
||||
#else
|
||||
#define LUA_EXPORT(...)
|
||||
#define LUA_EXPORT_TELEMETRY(...)
|
||||
#define LUA_EXPORT_MULTIPLE(...)
|
||||
#define LUA_EXPORT_EXTRA(...)
|
||||
#endif
|
||||
|
||||
#define WARN_THR_BIT 0x01
|
||||
#define WARN_BEP_BIT 0x80
|
||||
#define WARN_SW_BIT 0x02
|
||||
@@ -795,7 +807,7 @@ PACK(typedef struct t_LogicalSwitchData { // Logical Switches data
|
||||
|
||||
enum Functions {
|
||||
// first the functions which need a checkbox
|
||||
FUNC_SAFETY_CHANNEL,
|
||||
FUNC_OVERRIDE_CHANNEL,
|
||||
FUNC_TRAINER,
|
||||
FUNC_INSTANT_TRIM,
|
||||
FUNC_RESET,
|
||||
@@ -837,10 +849,10 @@ enum Functions {
|
||||
FUNC_MAX
|
||||
};
|
||||
|
||||
#if defined(SAFETY_CHANNEL_FUNCTION)
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
#define HAS_ENABLE_PARAM(func) ((func) < FUNC_FIRST_WITHOUT_ENABLE)
|
||||
#else
|
||||
#define HAS_ENABLE_PARAM(func) ((func) < FUNC_FIRST_WITHOUT_ENABLE && (func) != FUNC_SAFETY_CHANNEL)
|
||||
#define HAS_ENABLE_PARAM(func) ((func) < FUNC_FIRST_WITHOUT_ENABLE && (func) != FUNC_OVERRIDE_CHANNEL)
|
||||
#endif
|
||||
|
||||
#if defined(VOICE)
|
||||
@@ -1023,56 +1035,56 @@ PACK(typedef struct {
|
||||
|
||||
enum TelemetrySource {
|
||||
TELEM_NONE,
|
||||
TELEM_TX_VOLTAGE,
|
||||
TELEM_TX_VOLTAGE, LUA_EXPORT_TELEMETRY("tx-voltage", "Transmitter battery voltage [volts]")
|
||||
#if defined(CPUARM)
|
||||
TELEM_TX_TIME,
|
||||
TELEM_TX_TIME, LUA_EXPORT_TELEMETRY("clock", "RTC clock [minutes from midnight]")
|
||||
TELEM_RESERVE1,
|
||||
TELEM_RESERVE2,
|
||||
TELEM_RESERVE3,
|
||||
TELEM_RESERVE4,
|
||||
TELEM_RESERVE5,
|
||||
#endif
|
||||
TELEM_TIMER1,
|
||||
TELEM_TIMER2,
|
||||
#if defined(CPUARM)
|
||||
TELEM_SWR,
|
||||
#endif
|
||||
TELEM_RSSI_TX,
|
||||
TELEM_RSSI_RX,
|
||||
#if defined(CPUARM)
|
||||
TELEM_RESERVE0,
|
||||
#endif
|
||||
TELEM_A_FIRST,
|
||||
TELEM_A1=TELEM_A_FIRST,
|
||||
TELEM_A2,
|
||||
#if !defined(CPUARM)
|
||||
TELEM_A_LAST=TELEM_A2,
|
||||
#else
|
||||
TELEM_A3,
|
||||
TELEM_A4,
|
||||
TELEM_A_LAST=TELEM_A4,
|
||||
#endif
|
||||
TELEM_ALT,
|
||||
TELEM_RPM,
|
||||
TELEM_FUEL,
|
||||
TELEM_T1,
|
||||
TELEM_T2,
|
||||
TELEM_SPEED,
|
||||
TELEM_DIST,
|
||||
TELEM_GPSALT,
|
||||
TELEM_CELL,
|
||||
TELEM_CELLS_SUM,
|
||||
TELEM_VFAS,
|
||||
TELEM_CURRENT,
|
||||
TELEM_CONSUMPTION,
|
||||
TELEM_POWER,
|
||||
TELEM_ACCx,
|
||||
TELEM_ACCy,
|
||||
TELEM_ACCz,
|
||||
TELEM_HDG,
|
||||
TELEM_VSPEED,
|
||||
TELEM_ASPEED,
|
||||
TELEM_DTE,
|
||||
TELEM_TIMER1, LUA_EXPORT_TELEMETRY("timer1", "Timer 1 value [seconds]")
|
||||
TELEM_TIMER2, LUA_EXPORT_TELEMETRY("timer2", "Timer 2 value [seconds]")
|
||||
#if defined(CPUARM)
|
||||
TELEM_SWR, LUA_EXPORT_TELEMETRY("swr", "Transmitter antenna quality [less is better]")
|
||||
#endif
|
||||
TELEM_RSSI_TX,
|
||||
TELEM_RSSI_RX, LUA_EXPORT_TELEMETRY("rssi", "RSSI [more is better]")
|
||||
#if defined(CPUARM)
|
||||
TELEM_RESERVE0,
|
||||
#endif
|
||||
TELEM_A_FIRST,
|
||||
TELEM_A1=TELEM_A_FIRST, LUA_EXPORT_TELEMETRY("a1", "A1 analogue value [units as configured]")
|
||||
TELEM_A2, LUA_EXPORT_TELEMETRY("a2", "A2 analogue value [units as configured]")
|
||||
#if !defined(CPUARM)
|
||||
TELEM_A_LAST=TELEM_A2,
|
||||
#else
|
||||
TELEM_A3, LUA_EXPORT_TELEMETRY("a3", "A3 analogue value [units as configured]")
|
||||
TELEM_A4, LUA_EXPORT_TELEMETRY("a4", "A4 analogue value [units as configured]")
|
||||
TELEM_A_LAST=TELEM_A4,
|
||||
#endif
|
||||
TELEM_ALT, LUA_EXPORT_TELEMETRY("altitude", "Variometer altitude [meters]")
|
||||
TELEM_RPM, LUA_EXPORT_TELEMETRY("rpm", "Rotational speed [revolutions per minute]")
|
||||
TELEM_FUEL, LUA_EXPORT_TELEMETRY("fuel", "Fuel level [percent]")
|
||||
TELEM_T1, LUA_EXPORT_TELEMETRY("temp1", "Temperature 1 [degrees celsius]")
|
||||
TELEM_T2, LUA_EXPORT_TELEMETRY("temp2", "Temperature 2 [degrees celsius]")
|
||||
TELEM_SPEED, LUA_EXPORT_TELEMETRY("gps-speed", "GPS speed [knots]")
|
||||
TELEM_DIST, LUA_EXPORT_TELEMETRY("distance", "GPS distance [meters]")
|
||||
TELEM_GPSALT, LUA_EXPORT_TELEMETRY("gps-altitude", "GPS altitude [meters]")
|
||||
TELEM_CELL, LUA_EXPORT_TELEMETRY("cell-min", "LiPo sensor - lowest current cell voltage [volts]")
|
||||
TELEM_CELLS_SUM, LUA_EXPORT_TELEMETRY("cell-sum", "LiPo sensor - current summ of all cell voltages [volts]")
|
||||
TELEM_VFAS, LUA_EXPORT_TELEMETRY("vfas", "Current sensor - voltage [volts]")
|
||||
TELEM_CURRENT, LUA_EXPORT_TELEMETRY("current", "Current sensor - current [ampers]")
|
||||
TELEM_CONSUMPTION, LUA_EXPORT_TELEMETRY("consumption", "Current sensor - consumption [mili amper hours]")
|
||||
TELEM_POWER, LUA_EXPORT_TELEMETRY("power", "Current sensor - power [wats]")
|
||||
TELEM_ACCx, LUA_EXPORT_TELEMETRY("accx", "G sensor - acceleration in X axis [g]")
|
||||
TELEM_ACCy, LUA_EXPORT_TELEMETRY("accy", "G sensor - acceleration in Y axis [g]")
|
||||
TELEM_ACCz, LUA_EXPORT_TELEMETRY("accz", "G sensor - acceleration in Z axis [g]")
|
||||
TELEM_HDG, LUA_EXPORT_TELEMETRY("heading", "GPS heading [degrees]")
|
||||
TELEM_VSPEED, LUA_EXPORT_TELEMETRY("vertical-speed", "Variometer vertical speed [m/s]")
|
||||
TELEM_ASPEED, LUA_EXPORT_TELEMETRY("air-speed", "Air speed [knots]")
|
||||
TELEM_DTE, LUA_EXPORT_TELEMETRY("dte", "Total energy [???]")
|
||||
#if defined(CPUARM)
|
||||
TELEM_RESERVE6,
|
||||
TELEM_RESERVE7,
|
||||
@@ -1081,28 +1093,29 @@ enum TelemetrySource {
|
||||
TELEM_RESERVE10,
|
||||
#endif
|
||||
TELEM_MIN_A_FIRST,
|
||||
TELEM_MIN_A1=TELEM_MIN_A_FIRST,
|
||||
TELEM_MIN_A2,
|
||||
TELEM_MIN_A1=TELEM_MIN_A_FIRST, LUA_EXPORT_TELEMETRY("a1-min", "A1 analogue value minimum [units as configured]")
|
||||
TELEM_MIN_A2, LUA_EXPORT_TELEMETRY("a2-min", "A2 analogue value minimum [units as configured]")
|
||||
#if !defined(CPUARM)
|
||||
TELEM_MIN_A_LAST=TELEM_MIN_A2,
|
||||
#else
|
||||
TELEM_MIN_A3,
|
||||
TELEM_MIN_A4,
|
||||
TELEM_MIN_A3, LUA_EXPORT_TELEMETRY("a3-min", "A3 analogue value minimum [units as configured]")
|
||||
TELEM_MIN_A4, LUA_EXPORT_TELEMETRY("a4-min", "A4 analogue value minimum [units as configured]")
|
||||
TELEM_MIN_A_LAST=TELEM_MIN_A4,
|
||||
#endif
|
||||
TELEM_MIN_ALT,
|
||||
TELEM_MAX_ALT,
|
||||
TELEM_MAX_RPM,
|
||||
TELEM_MAX_T1,
|
||||
TELEM_MAX_T2,
|
||||
TELEM_MAX_SPEED,
|
||||
TELEM_MAX_DIST,
|
||||
TELEM_MAX_ASPEED,
|
||||
TELEM_MIN_CELL,
|
||||
TELEM_MIN_CELLS_SUM,
|
||||
TELEM_MIN_VFAS,
|
||||
TELEM_MAX_CURRENT,
|
||||
TELEM_MAX_POWER,
|
||||
// TODO: add A1-4 MAX
|
||||
TELEM_MIN_ALT, LUA_EXPORT_TELEMETRY("altitude-min", "Lowest altitude [meters]")
|
||||
TELEM_MAX_ALT, LUA_EXPORT_TELEMETRY("altitude-max", "Highest altitude [meters]")
|
||||
TELEM_MAX_RPM, LUA_EXPORT_TELEMETRY("rpm-max", "Highest rotational speed [revolutions per minute] [meters]")
|
||||
TELEM_MAX_T1, LUA_EXPORT_TELEMETRY("temp1-max", "Highest temperature 1 [degrees celsius]")
|
||||
TELEM_MAX_T2, LUA_EXPORT_TELEMETRY("temp2-max", "Highest temperature 2 [degrees celsius]")
|
||||
TELEM_MAX_SPEED, LUA_EXPORT_TELEMETRY("gps-speed-max", "Highest GPS speed [knots]")
|
||||
TELEM_MAX_DIST, LUA_EXPORT_TELEMETRY("distance-max", "Biggest GPS distance [meters]")
|
||||
TELEM_MAX_ASPEED, LUA_EXPORT_TELEMETRY("air-speed-max", "Highest air speed [knots]")
|
||||
TELEM_MIN_CELL, LUA_EXPORT_TELEMETRY("cell-min-min", "LiPo sensor - all time lowest cell voltage [volts]")
|
||||
TELEM_MIN_CELLS_SUM, LUA_EXPORT_TELEMETRY("cell-sum-min", "LiPo sensor - all time lowest summ of all cell voltages [volts]")
|
||||
TELEM_MIN_VFAS, LUA_EXPORT_TELEMETRY("vfas-min", "Current sensor - lowest voltage [volts]")
|
||||
TELEM_MAX_CURRENT, LUA_EXPORT_TELEMETRY("current-max", "Current sensor - highest current [ampers]")
|
||||
TELEM_MAX_POWER, LUA_EXPORT_TELEMETRY("power-max", "Current sensor - highest power [wats]")
|
||||
#if defined(CPUARM)
|
||||
TELEM_RESERVE11,
|
||||
TELEM_RESERVE12,
|
||||
@@ -1438,33 +1451,40 @@ enum SwitchSources {
|
||||
SWSRC_LAST = SWSRC_COUNT-1,
|
||||
SWSRC_FIRST = -SWSRC_LAST,
|
||||
|
||||
SWSRC_LAST_SHORT_LIST = SWSRC_LAST_LOGICAL_SWITCH,
|
||||
SWSRC_FIRST_SHORT_LIST = -SWSRC_LAST_SHORT_LIST,
|
||||
#if defined(CPUARM)
|
||||
SWSRC_LAST_IN_LOGICAL_SWITCHES = SWSRC_LAST_FLIGHT_MODE,
|
||||
SWSRC_LAST_IN_MIXES = SWSRC_LAST_FLIGHT_MODE,
|
||||
#else
|
||||
SWSRC_LAST_IN_LOGICAL_SWITCHES = SWSRC_LAST_LOGICAL_SWITCH,
|
||||
SWSRC_LAST_IN_MIXES = SWSRC_LAST_LOGICAL_SWITCH,
|
||||
#endif
|
||||
SWSRC_FIRST_IN_LOGICAL_SWITCHES = -SWSRC_LAST_IN_LOGICAL_SWITCHES,
|
||||
SWSRC_FIRST_IN_MIXES = -SWSRC_LAST_IN_MIXES,
|
||||
};
|
||||
|
||||
enum MixSources {
|
||||
MIXSRC_NONE,
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
MIXSRC_FIRST_INPUT,
|
||||
MIXSRC_FIRST_INPUT, LUA_EXPORT_MULTIPLE("input", "Input [I%d]", MAX_INPUTS)
|
||||
MIXSRC_LAST_INPUT = MIXSRC_FIRST_INPUT+MAX_INPUTS-1,
|
||||
|
||||
MIXSRC_FIRST_LUA,
|
||||
MIXSRC_LAST_LUA = MIXSRC_FIRST_LUA+(MAX_SCRIPTS*MAX_SCRIPT_OUTPUTS)-1,
|
||||
#endif
|
||||
|
||||
MIXSRC_Rud,
|
||||
MIXSRC_Ele,
|
||||
MIXSRC_Thr,
|
||||
MIXSRC_Ail,
|
||||
MIXSRC_Rud, LUA_EXPORT("rud", "Rudder")
|
||||
MIXSRC_Ele, LUA_EXPORT("ele", "Elevator")
|
||||
MIXSRC_Thr, LUA_EXPORT("thr", "Throttle")
|
||||
MIXSRC_Ail, LUA_EXPORT("ail", "Aileron")
|
||||
|
||||
MIXSRC_FIRST_POT,
|
||||
#if defined(PCBTARANIS)
|
||||
MIXSRC_POT1 = MIXSRC_FIRST_POT,
|
||||
MIXSRC_POT2,
|
||||
MIXSRC_POT3,
|
||||
MIXSRC_SLIDER1,
|
||||
MIXSRC_SLIDER2,
|
||||
MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer 1")
|
||||
MIXSRC_POT2, LUA_EXPORT("s2", "Potentiometer 2")
|
||||
MIXSRC_POT3, LUA_EXPORT("s3", "Potentiometer 3")
|
||||
MIXSRC_SLIDER1, LUA_EXPORT("ls", "Left slider")
|
||||
MIXSRC_SLIDER2, LUA_EXPORT("rs", "Right slider")
|
||||
MIXSRC_LAST_POT = MIXSRC_SLIDER2,
|
||||
#else
|
||||
MIXSRC_P1 = MIXSRC_FIRST_POT,
|
||||
@@ -1494,26 +1514,26 @@ enum MixSources {
|
||||
|
||||
MIXSRC_MAX,
|
||||
|
||||
MIXSRC_CYC1,
|
||||
MIXSRC_CYC2,
|
||||
MIXSRC_CYC3,
|
||||
MIXSRC_CYC1, LUA_EXPORT("cyc1", "Cyclic 1")
|
||||
MIXSRC_CYC2, LUA_EXPORT("cyc2", "Cyclic 2")
|
||||
MIXSRC_CYC3, LUA_EXPORT("cyc3", "Cyclic 3")
|
||||
|
||||
MIXSRC_TrimRud,
|
||||
MIXSRC_TrimEle,
|
||||
MIXSRC_TrimThr,
|
||||
MIXSRC_TrimAil,
|
||||
MIXSRC_TrimRud, LUA_EXPORT("trim-rud", "Rudder trim")
|
||||
MIXSRC_TrimEle, LUA_EXPORT("trim-ele", "Elevator trim")
|
||||
MIXSRC_TrimThr, LUA_EXPORT("trim-thr", "Throttle trim")
|
||||
MIXSRC_TrimAil, LUA_EXPORT("trim-ail", "Aileron trim")
|
||||
|
||||
MIXSRC_FIRST_SWITCH,
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
MIXSRC_SA = MIXSRC_FIRST_SWITCH,
|
||||
MIXSRC_SB,
|
||||
MIXSRC_SC,
|
||||
MIXSRC_SD,
|
||||
MIXSRC_SE,
|
||||
MIXSRC_SF,
|
||||
MIXSRC_SG,
|
||||
MIXSRC_SH,
|
||||
MIXSRC_SA = MIXSRC_FIRST_SWITCH, LUA_EXPORT("sa", "Switch A")
|
||||
MIXSRC_SB, LUA_EXPORT("sb", "Switch B")
|
||||
MIXSRC_SC, LUA_EXPORT("sc", "Switch C")
|
||||
MIXSRC_SD, LUA_EXPORT("sd", "Switch D")
|
||||
MIXSRC_SE, LUA_EXPORT("se", "Switch E")
|
||||
MIXSRC_SF, LUA_EXPORT("sf", "Switch F")
|
||||
MIXSRC_SG, LUA_EXPORT("sg", "Switch G")
|
||||
MIXSRC_SH, LUA_EXPORT("sh", "Switch H")
|
||||
#else
|
||||
MIXSRC_3POS = MIXSRC_FIRST_SWITCH,
|
||||
#if defined(EXTRA_3POS)
|
||||
@@ -1527,18 +1547,18 @@ enum MixSources {
|
||||
MIXSRC_TRN,
|
||||
#endif
|
||||
MIXSRC_FIRST_LOGICAL_SWITCH,
|
||||
MIXSRC_SW1 = MIXSRC_FIRST_LOGICAL_SWITCH,
|
||||
MIXSRC_SW1 = MIXSRC_FIRST_LOGICAL_SWITCH, LUA_EXPORT_MULTIPLE("ls", "Logical switch L%d", NUM_LOGICAL_SWITCH)
|
||||
MIXSRC_SW9 = MIXSRC_SW1 + 8,
|
||||
MIXSRC_SWA,
|
||||
MIXSRC_SWB,
|
||||
MIXSRC_SWC,
|
||||
MIXSRC_LAST_LOGICAL_SWITCH = MIXSRC_FIRST_LOGICAL_SWITCH+NUM_LOGICAL_SWITCH-1,
|
||||
|
||||
MIXSRC_FIRST_TRAINER,
|
||||
MIXSRC_FIRST_TRAINER, LUA_EXPORT_MULTIPLE("trn", "Trainer input %d", NUM_TRAINER)
|
||||
MIXSRC_LAST_TRAINER = MIXSRC_FIRST_TRAINER+NUM_TRAINER-1,
|
||||
|
||||
MIXSRC_FIRST_CH,
|
||||
MIXSRC_CH1 = MIXSRC_FIRST_CH,
|
||||
MIXSRC_CH1 = MIXSRC_FIRST_CH, LUA_EXPORT_MULTIPLE("ch", "Channel CH%d", NUM_CHNOUT)
|
||||
MIXSRC_CH2,
|
||||
MIXSRC_CH3,
|
||||
MIXSRC_CH4,
|
||||
@@ -1556,13 +1576,33 @@ enum MixSources {
|
||||
MIXSRC_CH16,
|
||||
MIXSRC_LAST_CH = MIXSRC_CH1+NUM_CHNOUT-1,
|
||||
|
||||
MIXSRC_GVAR1,
|
||||
MIXSRC_GVAR1, LUA_EXPORT_MULTIPLE("gvar", "Global variable %d", MAX_GVARS)
|
||||
MIXSRC_LAST_GVAR = MIXSRC_GVAR1+MAX_GVARS-1,
|
||||
|
||||
MIXSRC_FIRST_TELEM,
|
||||
MIXSRC_LAST_TELEM = MIXSRC_FIRST_TELEM+NUM_TELEMETRY-1
|
||||
};
|
||||
|
||||
#if defined(LUA)
|
||||
#define EXTRA_FIRST 1000
|
||||
enum LuaExtraFields {
|
||||
EXTRA_LATITUDE = EXTRA_FIRST, LUA_EXPORT_EXTRA("latitude", "GPS latitude [degrees, North is positive]", \
|
||||
"gpsToDouble(frskyData.hub.gpsLatitudeNS=='S', frskyData.hub.gpsLatitude_bp, frskyData.hub.gpsLatitude_ap)", \
|
||||
"frskyData.hub.gpsFix")
|
||||
EXTRA_LONGITUDE, LUA_EXPORT_EXTRA("longitude", "GPS longitude [degrees, East is positive]", \
|
||||
"gpsToDouble(frskyData.hub.gpsLongitudeEW=='W', frskyData.hub.gpsLongitude_bp, frskyData.hub.gpsLongitude_ap)", \
|
||||
"frskyData.hub.gpsFix")
|
||||
EXTRA_PILOT_LATITUDE, LUA_EXPORT_EXTRA("pilot-latitude", "Latitude of frist GPS position [degrees, North is positive]", \
|
||||
"pilotLatitude", "frskyData.hub.gpsFix")
|
||||
EXTRA_PILOT_LONGITUDE, LUA_EXPORT_EXTRA("pilot-longitude", "Longitude of frist GPS position [degrees, East is positive]", \
|
||||
"pilotLongitude", "frskyData.hub.gpsFix")
|
||||
EXTRA_GPS_CLOCK, LUA_EXPORT_EXTRA("gps-clock", "GPS clock [seconds from midnight]", \
|
||||
"(int)(frskyData.hub.hour)*3600 + frskyData.hub.min*60 + frskyData.hub.sec", "frskyData.hub.gpsFix")
|
||||
EXTRA_FLIGHT_MODE LUA_EXPORT_EXTRA("flight-mode", "Current flight mode number [number]", \
|
||||
"getFlightMode()", "true")
|
||||
};
|
||||
#endif // #if defined(LUA)
|
||||
|
||||
#define MIXSRC_FIRST (MIXSRC_NONE+1)
|
||||
#define MIXSRC_LAST MIXSRC_LAST_CH
|
||||
#define INPUTSRC_FIRST MIXSRC_Rud
|
||||
@@ -1577,12 +1617,14 @@ enum TimerModes {
|
||||
TMRMODE_THR,
|
||||
TMRMODE_THR_REL,
|
||||
TMRMODE_THR_TRG,
|
||||
TMRMODE_FIRST_SWITCH
|
||||
TMRMODE_COUNT
|
||||
};
|
||||
|
||||
#define COUNTDOWN_SILENT 0
|
||||
#define COUNTDOWN_BEEPS 1
|
||||
#define COUNTDOWN_VOICE 2
|
||||
enum CountDownModes {
|
||||
COUNTDOWN_SILENT,
|
||||
COUNTDOWN_BEEPS,
|
||||
COUNTDOWN_VOICE
|
||||
};
|
||||
|
||||
#if defined(CPUARM) || defined(CPUM2560)
|
||||
PACK(typedef struct t_TimerData {
|
||||
|
||||
+71
-21
@@ -147,7 +147,7 @@ uint8_t heartbeat;
|
||||
|
||||
uint8_t stickMode;
|
||||
|
||||
#if defined(SAFETY_CHANNEL_FUNCTION)
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
int8_t safetyCh[NUM_CHNOUT];
|
||||
#endif
|
||||
|
||||
@@ -441,11 +441,23 @@ 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);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM) && defined(FLIGHT_MODES) && defined(GVARS)
|
||||
for (int p=1; p<MAX_FLIGHT_MODES; p++) {
|
||||
for (int i=0; i<MAX_GVARS; i++) {
|
||||
g_model.flightModeData[p].gvars[i] = GVAR_MAX+1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
g_model.frsky.channels[0].ratio = 132;
|
||||
#endif
|
||||
@@ -455,6 +467,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)
|
||||
{
|
||||
@@ -466,8 +495,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1047,10 +1078,16 @@ void doSplash()
|
||||
getADC();
|
||||
|
||||
#if defined(FSPLASH)
|
||||
if (!(g_eeGeneral.splashMode & 0x04))
|
||||
// Splash is forced, we can't skip it
|
||||
if (!(g_eeGeneral.splashMode & 0x04)) {
|
||||
#endif
|
||||
|
||||
if (keyDown() || inputsMoved()) return;
|
||||
|
||||
#if defined(FSPLASH)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pwrCheck()==e_power_off) return;
|
||||
|
||||
#if !defined(PCBTARANIS) && !defined(PCBSTD)
|
||||
@@ -1405,8 +1442,6 @@ uint16_t BandGap ;
|
||||
uint16_t anaIn(uint8_t chan)
|
||||
{
|
||||
#if defined(PCBTARANIS)
|
||||
// crossAna[]={LH,LV,RH,RV,S1,S2,LS,RS,BAT
|
||||
// s_anaFilt[]={LH,LV,RH,RV,S1,S2,LS,RS,_BAT
|
||||
return s_anaFilt[chan];
|
||||
#elif defined(PCBSKY9X) && !defined(REVA)
|
||||
static const uint8_t crossAna[]={1,5,7,0,4,6,2,3};
|
||||
@@ -1613,11 +1648,8 @@ void timerReset(uint8_t idx)
|
||||
|
||||
void flightReset()
|
||||
{
|
||||
static bool firstReset = true;
|
||||
if (firstReset)
|
||||
firstReset = false;
|
||||
else
|
||||
AUDIO_RESET();
|
||||
// we don't reset the whole audio here (the tada.wav would be cut, if a prompt is queued before FlightReset, it should be played)
|
||||
// TODO check if the vario / background music are stopped correctly if switching to a model which doesn't have these functions enabled
|
||||
|
||||
if (!IS_MANUAL_RESET_TIMER(0)) {
|
||||
timerReset(0);
|
||||
@@ -1655,10 +1687,13 @@ FORCEINLINE void evalTrims()
|
||||
for (uint8_t i=0; i<NUM_STICKS; i++) {
|
||||
// do trim -> throttle trim if applicable
|
||||
int16_t trim = getTrimValue(phase, i);
|
||||
#if !defined(PCBTARANIS)
|
||||
if (i==THR_STICK && g_model.thrTrim) {
|
||||
trim = (((g_model.throttleReversed)?(int32_t)(trim+TRIM_MIN):(int32_t)(trim-TRIM_MIN)) * (RESX-getValue(MIXSRC_Thr))) >> (RESX_SHIFT+1);
|
||||
int16_t trimMin = g_model.extendedTrims ? TRIM_EXTENDED_MIN : TRIM_MIN;
|
||||
trim = (((g_model.throttleReversed)?(int32_t)(trim+trimMin):(int32_t)(trim-trimMin)) * (RESX-anas[i])) >> (RESX_SHIFT+1);
|
||||
}
|
||||
else if (trimsCheckTimer > 0) {
|
||||
#endif
|
||||
if (trimsCheckTimer > 0) {
|
||||
trim = 0;
|
||||
}
|
||||
|
||||
@@ -1867,7 +1902,7 @@ void evalFunctions()
|
||||
static rotenc_t rePreviousValues[ROTARY_ENCODERS];
|
||||
#endif
|
||||
|
||||
#if defined(SAFETY_CHANNEL_FUNCTION)
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
for (uint8_t i=0; i<NUM_CHNOUT; i++) {
|
||||
safetyCh[i] = -128; // not defined
|
||||
}
|
||||
@@ -1900,8 +1935,8 @@ void evalFunctions()
|
||||
|
||||
switch (CFN_FUNC(sd)) {
|
||||
|
||||
#if defined(SAFETY_CHANNEL_FUNCTION)
|
||||
case FUNC_SAFETY_CHANNEL:
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
case FUNC_OVERRIDE_CHANNEL:
|
||||
safetyCh[CFN_CH_INDEX(sd)] = CFN_PARAM(sd);
|
||||
break;
|
||||
#endif
|
||||
@@ -2310,7 +2345,7 @@ void doMixerCalculations()
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (tm > 0) tm -= (TMR_VAROFS-1);
|
||||
if (tm > 0) tm -= (TMRMODE_COUNT-1);
|
||||
if (getSwitch(tm))
|
||||
newTimerVal++;
|
||||
}
|
||||
@@ -2499,6 +2534,10 @@ void opentxClose()
|
||||
// TODO needed? telemetryEnd();
|
||||
#endif
|
||||
|
||||
#if defined(LUA)
|
||||
luaClose();
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD)
|
||||
closeLogs();
|
||||
sdDone();
|
||||
@@ -3095,6 +3134,12 @@ ISR(USART0_UDRE_vect)
|
||||
|
||||
void instantTrim()
|
||||
{
|
||||
#if defined(PCBTARANIS)
|
||||
int16_t anas_0[NUM_INPUTS];
|
||||
evalInputs(e_perout_mode_notrainer | e_perout_mode_nosticks);
|
||||
memcpy(anas_0, anas, sizeof(anas_0));
|
||||
#endif
|
||||
|
||||
evalInputs(e_perout_mode_notrainer);
|
||||
|
||||
for (uint8_t stick=0; stick<NUM_STICKS; stick++) {
|
||||
@@ -3107,7 +3152,7 @@ void instantTrim()
|
||||
ExpoData * ed = expoAddress(e);
|
||||
if (!EXPO_VALID(ed)) break; // end of list
|
||||
if (ed->srcRaw-MIXSRC_Rud == stick) {
|
||||
delta = anas[ed->chn];
|
||||
delta = anas[ed->chn] - anas_0[ed->chn];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -3282,6 +3327,13 @@ uint16_t stack_free(uint8_t tid)
|
||||
stack = audioStack;
|
||||
size = AUDIO_STACK_SIZE;
|
||||
break;
|
||||
#if 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;
|
||||
}
|
||||
@@ -3374,8 +3426,6 @@ inline void opentxInit(OPENTX_INIT_ARGS)
|
||||
rtcInit();
|
||||
#endif
|
||||
|
||||
LUA_INIT();
|
||||
|
||||
if (g_eeGeneral.backlightMode != e_backlight_mode_off) backlightOn(); // on Tx start turn the light on
|
||||
|
||||
if (UNEXPECTED_SHUTDOWN()) {
|
||||
@@ -3402,7 +3452,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)
|
||||
|
||||
+43
-21
@@ -348,17 +348,24 @@ extern void boardInit();
|
||||
|
||||
enum PotType {
|
||||
POT_TYPE_NONE,
|
||||
POT_TYPE_POT,
|
||||
POT_TYPE_DETENT,
|
||||
POT_TYPE_MULTIPOS,
|
||||
POT_TYPE_MAX=POT_TYPE_MULTIPOS
|
||||
POT_TYPE_NO_DETENT,
|
||||
POT_TYPE_MAX=POT_TYPE_NO_DETENT
|
||||
};
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define IS_POT_AVAILABLE(x) ((x)!=POT3 || (g_eeGeneral.potsType & (0x03 << (2*((x)-POT1))))!=POT_TYPE_NONE)
|
||||
#define IS_POT_MULTIPOS(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsType>>(2*((x)-POT1)))&0x03)==POT_TYPE_MULTIPOS)
|
||||
#if defined(PCBTARANIS) && defined(REVPLUS)
|
||||
#define IS_POT_AVAILABLE(x) ((x)!=POT3 || (g_eeGeneral.potsType & (0x03 << (2*((x)-POT1))))!=POT_TYPE_NONE)
|
||||
#define IS_POT_MULTIPOS(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsType>>(2*((x)-POT1)))&0x03)==POT_TYPE_MULTIPOS)
|
||||
#define IS_POT_WITHOUT_DETENT(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsType>>(2*((x)-POT1)))&0x03)==POT_TYPE_NO_DETENT)
|
||||
#elif defined(PCBTARANIS)
|
||||
#define IS_POT_AVAILABLE(x) ((x)!=POT3)
|
||||
#define IS_POT_MULTIPOS(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsType>>(2*((x)-POT1)))&0x03)==POT_TYPE_MULTIPOS)
|
||||
#define IS_POT_WITHOUT_DETENT(x) ((x)>=POT1 && (x)<=POT_LAST && ((g_eeGeneral.potsType>>(2*((x)-POT1)))&0x03)==POT_TYPE_NO_DETENT)
|
||||
#else
|
||||
#define IS_POT_AVAILABLE(x) (true)
|
||||
#define IS_POT_MULTIPOS(x) (false)
|
||||
#define IS_POT_AVAILABLE(x) (true)
|
||||
#define IS_POT_MULTIPOS(x) (false)
|
||||
#define IS_POT_WITHOUT_DETENT(x) (true)
|
||||
#endif
|
||||
|
||||
#define GET_LOWRES_POT_POSITION(i) (getValue(MIXSRC_FIRST_POT+(i)) >> 4)
|
||||
@@ -686,7 +693,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
|
||||
|
||||
@@ -843,7 +851,7 @@ struct TimerState {
|
||||
|
||||
extern TimerState timersStates[MAX_TIMERS];
|
||||
|
||||
#if defined(SAFETY_CHANNEL_FUNCTION)
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
extern int8_t safetyCh[NUM_CHNOUT];
|
||||
#endif
|
||||
|
||||
@@ -1078,8 +1086,6 @@ extern int16_t calcRESXto1000(int16_t x);
|
||||
extern int8_t calcRESXto100(int16_t x);
|
||||
#endif
|
||||
|
||||
#define TMR_VAROFS 5
|
||||
|
||||
extern const char vers_stamp[];
|
||||
|
||||
extern uint8_t g_vbat100mV;
|
||||
@@ -1460,13 +1466,14 @@ enum AUDIO_SOUNDS {
|
||||
SCRIPT_OK,
|
||||
SCRIPT_NOFILE,
|
||||
SCRIPT_SYNTAX_ERROR,
|
||||
SCRIPT_KILLED
|
||||
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
|
||||
};
|
||||
@@ -1483,13 +1490,18 @@ enum AUDIO_SOUNDS {
|
||||
uint8_t outputsCount;
|
||||
ScriptOutput outputs[MAX_SCRIPT_OUTPUTS];
|
||||
};
|
||||
#define LUASTATE_STANDALONE_SCRIPT_RUNNING 1
|
||||
#define LUASTATE_RELOAD_MODEL_SCRIPTS 2
|
||||
enum InterpreterState {
|
||||
INTERPRETER_RUNNING_PERMANENT_SCRIPTS,
|
||||
INTERPRETER_RUNNING_STANDALONE_SCRIPT,
|
||||
INTERPRETER_RELOAD_PERMANENT_SCRIPTS,
|
||||
INTERPRETER_PANIC,
|
||||
};
|
||||
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);
|
||||
@@ -1498,13 +1510,23 @@ enum AUDIO_SOUNDS {
|
||||
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
|
||||
#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
|
||||
|
||||
+1
-1
@@ -357,7 +357,7 @@ int main(int argc,char **argv)
|
||||
// We pass the "name" of the application, and its "vendor", the name
|
||||
// and vendor are used to search the registry database (which stores
|
||||
// persistent information e.g. fonts and colors).
|
||||
FXApp application("Open9xSim", "thus");
|
||||
FXApp application("OpenTX Simu", "OpenTX");
|
||||
|
||||
// Here we initialize the application. We pass the command line arguments
|
||||
// because FOX may sometimes need to filter out some of the arguments.
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
+39
-14
@@ -171,8 +171,36 @@ void getSwitchesPosition(bool startup)
|
||||
}
|
||||
#define SWITCH_POSITION(sw) (switchesPos & (1<<(sw)))
|
||||
#define POT_POSITION(sw) ((potsPos[(sw)/XPOTS_MULTIPOS_COUNT] & 0x0f) == ((sw) % XPOTS_MULTIPOS_COUNT))
|
||||
|
||||
getvalue_t getValueForLogicalSwitch(uint8_t i)
|
||||
{
|
||||
getvalue_t result = getValue(i);
|
||||
if (i>=MIXSRC_FIRST_INPUT && i<=MIXSRC_LAST_INPUT) {
|
||||
int8_t trimIdx = virtualInputsTrims[i-MIXSRC_FIRST_INPUT];
|
||||
if (trimIdx >= 0) {
|
||||
int16_t trim = trims[trimIdx];
|
||||
if (trimIdx == THR_STICK && g_model.throttleReversed)
|
||||
result -= trim;
|
||||
else
|
||||
result += trim;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#else
|
||||
#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);
|
||||
@@ -188,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) {
|
||||
@@ -219,10 +249,10 @@ bool getLogicalSwitch(uint8_t idx)
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
getvalue_t x = getValue(ls->v1);
|
||||
getvalue_t x = getValueForLogicalSwitch(ls->v1);
|
||||
getvalue_t y;
|
||||
if (s == LS_FAMILY_COMP) {
|
||||
y = getValue(ls->v2);
|
||||
y = getValueForLogicalSwitch(ls->v2);
|
||||
|
||||
switch (ls->func) {
|
||||
case LS_FUNC_EQUAL:
|
||||
@@ -361,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) {
|
||||
@@ -715,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) {
|
||||
@@ -742,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;
|
||||
}
|
||||
|
||||
@@ -309,8 +309,6 @@ void *main_thread(void *)
|
||||
|
||||
if (g_eeGeneral.backlightMode != e_backlight_mode_off) backlightOn(); // on Tx start turn the light on
|
||||
|
||||
LUA_INIT();
|
||||
|
||||
if (main_thread_running == 1) {
|
||||
opentxStart();
|
||||
}
|
||||
|
||||
@@ -293,6 +293,6 @@ void telemetryTransmitBuffer(uint8_t * buffer, uint32_t size);
|
||||
|
||||
// Second UART driver
|
||||
void telemetrySecondPortInit(unsigned int protocol);
|
||||
uint16_t telemetrySecondPortReceive();
|
||||
bool telemetrySecondPortReceive(uint8_t & data);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -44,10 +44,9 @@
|
||||
/** Pins description corresponding to Rxd,Txd, (UART pins) */
|
||||
#define SECOND_SERIAL_PINS {PINS_UART}
|
||||
|
||||
Fifo<512> serial2RxFifo;
|
||||
|
||||
#if !defined(SIMU)
|
||||
|
||||
extern Fifo<512> debugRxFifo;
|
||||
|
||||
/*
|
||||
* Outputs a character on the UART line.
|
||||
*
|
||||
@@ -99,10 +98,8 @@ void SECOND_UART_Configure(uint32_t baudrate, uint32_t masterClock)
|
||||
/* Enable receiver and transmitter */
|
||||
pUart->UART_CR = UART_CR_RXEN | UART_CR_TXEN;
|
||||
|
||||
#if defined(DEBUG)
|
||||
pUart->UART_IER = UART_IER_RXRDY;
|
||||
NVIC_EnableIRQ(UART0_IRQn);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SECOND_UART_Stop()
|
||||
@@ -113,9 +110,7 @@ void SECOND_UART_Stop()
|
||||
|
||||
extern "C" void UART0_IRQHandler()
|
||||
{
|
||||
#if defined(DEBUG)
|
||||
debugRxFifo.push(SECOND_SERIAL_UART->UART_RHR);
|
||||
#endif
|
||||
serial2RxFifo.push(SECOND_SERIAL_UART->UART_RHR);
|
||||
}
|
||||
#else
|
||||
#define SECOND_UART_Configure(...)
|
||||
@@ -125,17 +120,11 @@ extern "C" void UART0_IRQHandler()
|
||||
void telemetrySecondPortInit(unsigned int /*protocol*/)
|
||||
{
|
||||
SECOND_UART_Configure(FRSKY_D_BAUDRATE, Master_frequency);
|
||||
startPdcUsartReceive();
|
||||
// startPdcUsartReceive();
|
||||
}
|
||||
|
||||
uint16_t telemetrySecondPortReceive()
|
||||
bool telemetrySecondPortReceive(uint8_t & data)
|
||||
{
|
||||
Uart *pUart = SECOND_SERIAL_UART;
|
||||
|
||||
if (pUart->UART_SR & UART_SR_RXRDY) {
|
||||
return pUart->UART_RHR ;
|
||||
}
|
||||
|
||||
return 0xFFFF ;
|
||||
return serial2RxFifo.pop(data);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include "debug.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Exported variables
|
||||
@@ -53,10 +54,8 @@
|
||||
|
||||
#undef errno
|
||||
extern int errno;
|
||||
extern int _end;
|
||||
extern int _estack;
|
||||
|
||||
#define RAM_END (unsigned char *)&_estack
|
||||
extern int _end;
|
||||
extern int _main_stack_start;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Exported functions
|
||||
@@ -68,7 +67,7 @@ extern int _getpid ( void ) ;
|
||||
unsigned char *heap = (unsigned char *)&_end;
|
||||
extern caddr_t _sbrk(int nbytes)
|
||||
{
|
||||
if (heap + nbytes < RAM_END-4096) {
|
||||
if (heap + nbytes < (unsigned char *)&_main_stack_start) {
|
||||
unsigned char *prev_heap = heap;
|
||||
heap += nbytes;
|
||||
return (caddr_t) prev_heap;
|
||||
@@ -142,7 +141,7 @@ extern int _write( int file, char *ptr, int len )
|
||||
|
||||
extern void _exit( int status )
|
||||
{
|
||||
printf( "Exiting with status %d.\n", status ) ;
|
||||
TRACE( "Exiting with status %d.\n", status ) ;
|
||||
|
||||
for ( ; ; ) ;
|
||||
}
|
||||
@@ -156,3 +155,8 @@ extern int _getpid ( void )
|
||||
{
|
||||
return -1 ;
|
||||
}
|
||||
|
||||
void _init (void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
#define RX_UART_BUFFER_SIZE 32
|
||||
#define RX_UART_BUFFER_SIZE 128
|
||||
|
||||
struct t_rxUartBuffer
|
||||
{
|
||||
@@ -44,8 +44,7 @@ struct t_rxUartBuffer
|
||||
uint8_t *outPtr ;
|
||||
};
|
||||
|
||||
struct t_rxUartBuffer TelemetryInBuffer[2] ;
|
||||
uint32_t TelemetryActiveBuffer;
|
||||
struct t_rxUartBuffer TelemetryInBuffer ;
|
||||
uint16_t DsmRxTimeout;
|
||||
|
||||
// USART0 configuration
|
||||
@@ -106,18 +105,14 @@ extern "C" void USART0_IRQHandler()
|
||||
void startPdcUsartReceive()
|
||||
{
|
||||
register Usart *pUsart = SECOND_USART;
|
||||
|
||||
TelemetryInBuffer[0].outPtr = TelemetryInBuffer[0].fifo ;
|
||||
TelemetryInBuffer[1].outPtr = TelemetryInBuffer[1].fifo ;
|
||||
TelemetryInBuffer.outPtr = TelemetryInBuffer.fifo ;
|
||||
#ifndef SIMU
|
||||
// TODO because of the 64bits cast ...
|
||||
pUsart->US_RPR = (uint32_t)TelemetryInBuffer[0].fifo ;
|
||||
pUsart->US_RNPR = (uint32_t)TelemetryInBuffer[1].fifo ;
|
||||
pUsart->US_RPR = (uint32_t)TelemetryInBuffer.fifo ;
|
||||
pUsart->US_RNPR = (uint32_t)TelemetryInBuffer.fifo ;
|
||||
#endif
|
||||
pUsart->US_RCR = RX_UART_BUFFER_SIZE ;
|
||||
pUsart->US_RNCR = RX_UART_BUFFER_SIZE ;
|
||||
pUsart->US_PTCR = US_PTCR_RXTEN ;
|
||||
TelemetryActiveBuffer = 0;
|
||||
}
|
||||
|
||||
void rxPdcUsart( void (*pChProcess)(uint8_t x) )
|
||||
@@ -126,34 +121,29 @@ void rxPdcUsart( void (*pChProcess)(uint8_t x) )
|
||||
register Usart *pUsart = SECOND_USART;
|
||||
uint8_t *ptr ;
|
||||
uint8_t *endPtr ;
|
||||
uint32_t j ;
|
||||
|
||||
// Find out where the DMA has got to
|
||||
__disable_irq() ;
|
||||
pUsart->US_PTCR = US_PTCR_RXTDIS ; // Freeze DMA
|
||||
ptr = (uint8_t *)pUsart->US_RPR ;
|
||||
j = pUsart->US_RNCR ;
|
||||
pUsart->US_PTCR = US_PTCR_RXTEN ; // DMA active again
|
||||
__enable_irq() ;
|
||||
|
||||
endPtr = ptr - 1 ;
|
||||
ptr = TelemetryInBuffer[TelemetryActiveBuffer].outPtr ;
|
||||
if ( j == 0 ) // First buf is full
|
||||
endPtr = (uint8_t *)pUsart->US_RPR ;
|
||||
// Check for DMA passed end of buffer
|
||||
if ( endPtr > &TelemetryInBuffer.fifo[RX_UART_BUFFER_SIZE-1] )
|
||||
{
|
||||
endPtr = &TelemetryInBuffer[TelemetryActiveBuffer].fifo[RX_UART_BUFFER_SIZE-1] ; // last byte
|
||||
endPtr = TelemetryInBuffer.fifo ;
|
||||
}
|
||||
while ( ptr <= endPtr )
|
||||
ptr = TelemetryInBuffer.outPtr ;
|
||||
while ( ptr != endPtr )
|
||||
{
|
||||
(*pChProcess)(*ptr++) ;
|
||||
if ( ptr > &TelemetryInBuffer.fifo[RX_UART_BUFFER_SIZE-1] ) // last byte
|
||||
{
|
||||
ptr = TelemetryInBuffer.fifo ;
|
||||
}
|
||||
}
|
||||
TelemetryInBuffer[TelemetryActiveBuffer].outPtr = ptr ;
|
||||
if ( j == 0 ) // First buf is full
|
||||
TelemetryInBuffer.outPtr = ptr ;
|
||||
|
||||
if ( pUsart->US_RNCR == 0 )
|
||||
{
|
||||
TelemetryInBuffer[TelemetryActiveBuffer].outPtr = TelemetryInBuffer[TelemetryActiveBuffer].fifo ;
|
||||
pUsart->US_RNPR = (uint32_t)TelemetryInBuffer[TelemetryActiveBuffer].fifo ;
|
||||
pUsart->US_RNPR = (uint32_t)TelemetryInBuffer.fifo ;
|
||||
pUsart->US_RNCR = RX_UART_BUFFER_SIZE ;
|
||||
TelemetryActiveBuffer ^= 1 ; // Other buffer is active
|
||||
rxPdcUsart( pChProcess ) ; // Get any chars from second buffer
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
+15
@@ -98,8 +98,23 @@ LoopFillZerobss:
|
||||
ldr r3, = _ebss
|
||||
cmp r2, r3
|
||||
bcc FillZerobss
|
||||
|
||||
/*Paint Main Stack */
|
||||
ldr r2, = _main_stack_start
|
||||
PaintMainStack:
|
||||
movs r3, #0x55555555
|
||||
str r3, [r2], #4
|
||||
LoopPaintMainStack:
|
||||
ldr r3, = _estack
|
||||
cmp r2, r3
|
||||
bcc PaintMainStack
|
||||
|
||||
/* Call the clock system intitialization function.*/
|
||||
bl SystemInit
|
||||
|
||||
/* Call C++ constructors for static objects */
|
||||
bl __libc_init_array
|
||||
|
||||
/* Call the application's entry point.*/
|
||||
bl main
|
||||
bx lr
|
||||
|
||||
@@ -51,16 +51,19 @@
|
||||
#else
|
||||
#define POT_R 8
|
||||
#endif
|
||||
#define SLIDE_L 14
|
||||
#define SLIDE_R 15
|
||||
#define BATTERY 10
|
||||
#define POT_XTRA 9
|
||||
#define SLIDE_L 14
|
||||
#define SLIDE_R 15
|
||||
#define BATTERY 10
|
||||
|
||||
// Sample time should exceed 1uS
|
||||
#define SAMPTIME 2 // sample time = 15 cycles
|
||||
|
||||
volatile uint16_t Analog_values[NUMBER_ANALOG];
|
||||
|
||||
#if defined(REV4a)
|
||||
#if defined(REVPLUS)
|
||||
const int8_t ana_direction[NUMBER_ANALOG] = {1,-1,1,-1, -1,-1,1,-1,1, 1};
|
||||
#elif defined(REV4a)
|
||||
const int8_t ana_direction[NUMBER_ANALOG] = {1,-1,1,-1, -1,-1,0,-1,1, 1};
|
||||
#elif !defined(REV3)
|
||||
const int8_t ana_direction[NUMBER_ANALOG] = {1,-1,1,-1, -1,1,0,-1,1, 1};
|
||||
@@ -68,33 +71,33 @@ volatile uint16_t Analog_values[NUMBER_ANALOG];
|
||||
|
||||
void adcInit()
|
||||
{
|
||||
RCC->APB2ENR |= RCC_APB2ENR_ADC1EN ; // Enable clock
|
||||
RCC->AHB1ENR |= RCC_AHB1Periph_GPIOADC ; // Enable ports A&C clocks
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_DMA2EN ; // Enable DMA2 clock
|
||||
RCC->APB2ENR |= RCC_APB2ENR_ADC1EN; // Enable clock
|
||||
RCC->AHB1ENR |= RCC_AHB1Periph_GPIOADC; // Enable ports A&C clocks
|
||||
RCC->AHB1ENR |= RCC_AHB1ENR_DMA2EN; // Enable DMA2 clock
|
||||
|
||||
#if defined(REV3)
|
||||
configure_pins(PIN_STK_J1 | PIN_STK_J2 | PIN_STK_J3 | PIN_STK_J4 |
|
||||
PIN_FLP_J1 | PIN_FLP_J2, PIN_ANALOG | PIN_PORTA) ;
|
||||
PIN_FLP_J1 | PIN_FLP_J2, PIN_ANALOG | PIN_PORTA);
|
||||
#else
|
||||
configure_pins(PIN_STK_J1 | PIN_STK_J2 | PIN_STK_J3 | PIN_STK_J4 |
|
||||
PIN_FLP_J1, PIN_ANALOG | PIN_PORTA) ;
|
||||
PIN_FLP_J1, PIN_ANALOG | PIN_PORTA);
|
||||
#endif
|
||||
|
||||
#if !defined(REV3)
|
||||
#if defined(REVPLUS)
|
||||
configure_pins(PIN_FLP_J2 | PIN_FLP_J3, PIN_ANALOG|PIN_PORTB);
|
||||
#elif !defined(REV3)
|
||||
configure_pins(PIN_FLP_J2, PIN_ANALOG|PIN_PORTB);
|
||||
#endif
|
||||
|
||||
configure_pins(PIN_SLD_J1 | PIN_SLD_J2 | PIN_MVOLT, PIN_ANALOG | PIN_PORTC) ;
|
||||
configure_pins(PIN_SLD_J1 | PIN_SLD_J2 | PIN_MVOLT, PIN_ANALOG | PIN_PORTC);
|
||||
|
||||
ADC1->CR1 = ADC_CR1_SCAN ;
|
||||
ADC1->CR2 = ADC_CR2_ADON | ADC_CR2_DMA | ADC_CR2_DDS ;
|
||||
ADC1->SQR1 = (NUMBER_ANALOG-1) << 20 ; // NUMBER_ANALOG Channels
|
||||
ADC1->SQR2 = (SLIDE_L<<5) + (SLIDE_R<<10) + (BATTERY<<15) ;
|
||||
ADC1->SQR3 = STICK_LH + (STICK_LV<<5) + (STICK_RV<<10) + (STICK_RH<<15) + (POT_L<<20) + (POT_R<<25) ;
|
||||
ADC1->SMPR1 = SAMPTIME + (SAMPTIME<<3) + (SAMPTIME<<6) + (SAMPTIME<<9) + (SAMPTIME<<12)
|
||||
+ (SAMPTIME<<15) + (SAMPTIME<<18) + (SAMPTIME<<21) + (SAMPTIME<<24) ;
|
||||
ADC1->SMPR2 = SAMPTIME + (SAMPTIME<<3) + (SAMPTIME<<6) + (SAMPTIME<<9) + (SAMPTIME<<12)
|
||||
+ (SAMPTIME<<15) + (SAMPTIME<<18) + (SAMPTIME<<21) + (SAMPTIME<<24) + (SAMPTIME<<27) ;
|
||||
ADC1->CR1 = ADC_CR1_SCAN;
|
||||
ADC1->CR2 = ADC_CR2_ADON | ADC_CR2_DMA | ADC_CR2_DDS;
|
||||
ADC1->SQR1 = (NUMBER_ANALOG-1) << 20 ; // bits 23:20 = number of conversions
|
||||
ADC1->SQR2 = (POT_XTRA<<0) + (SLIDE_L<<5) + (SLIDE_R<<10) + (BATTERY<<15); // conversions 7 and more
|
||||
ADC1->SQR3 = (STICK_LH<<0) + (STICK_LV<<5) + (STICK_RV<<10) + (STICK_RH<<15) + (POT_L<<20) + (POT_R<<25); // conversions 1 to 6
|
||||
ADC1->SMPR1 = SAMPTIME + (SAMPTIME<<3) + (SAMPTIME<<6) + (SAMPTIME<<9) + (SAMPTIME<<12) + (SAMPTIME<<15) + (SAMPTIME<<18) + (SAMPTIME<<21) + (SAMPTIME<<24);
|
||||
ADC1->SMPR2 = SAMPTIME + (SAMPTIME<<3) + (SAMPTIME<<6) + (SAMPTIME<<9) + (SAMPTIME<<12) + (SAMPTIME<<15) + (SAMPTIME<<18) + (SAMPTIME<<21) + (SAMPTIME<<24) + (SAMPTIME<<27) ;
|
||||
|
||||
ADC->CCR = 0 ; //ADC_CCR_ADCPRE_0 ; // Clock div 2
|
||||
|
||||
@@ -125,10 +128,14 @@ void adcRead()
|
||||
#if !defined(REV3)
|
||||
// adc direction correct
|
||||
for (i=0; i<NUMBER_ANALOG; i++) {
|
||||
if (ana_direction[i] == -1)
|
||||
if (ana_direction[i] < 0) {
|
||||
Analog_values[i] = 4096-Analog_values[i];
|
||||
else if (ana_direction[i] == 0)
|
||||
}
|
||||
#if !defined(REVPLUS)
|
||||
else if (ana_direction[i] == 0) {
|
||||
Analog_values[i] = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -338,8 +338,8 @@ void lcdSetRefVolt(uint8_t val)
|
||||
#if defined(REVPLUS)
|
||||
void turnBacklightOn(uint8_t level, uint8_t color)
|
||||
{
|
||||
TIM4->CCR4 = (100-level)*color;
|
||||
TIM4->CCR2 = (100-level)*(100-color);
|
||||
TIM4->CCR4 = ((100-level)*(20-color))/20;
|
||||
TIM4->CCR2 = ((100-level)*color)/20;
|
||||
}
|
||||
|
||||
void turnBacklightOff(void)
|
||||
|
||||
@@ -34,6 +34,8 @@ ENTRY(Reset_Handler)
|
||||
|
||||
/* Highest address of the user mode stack */
|
||||
_estack = 0x20020000; /* end of 128K SRAM */
|
||||
_main_stack_size = 0x1000; /*size of main stack*/
|
||||
_main_stack_start = _estack - _main_stack_size;
|
||||
|
||||
/* Generate a link error if heap and stack don't fit into RAM */
|
||||
_Min_Heap_Size = 0; /* required amount of heap */
|
||||
|
||||
@@ -21,6 +21,8 @@ ENTRY(Reset_Handler)
|
||||
|
||||
/* Highest address of the user mode stack */
|
||||
_estack = 0x20020000; /* end of 128K SRAM */
|
||||
_main_stack_size = 0x1000; /*size of main stack*/
|
||||
_main_stack_start = _estack - _main_stack_size;
|
||||
|
||||
/* Generate a link error if heap and stack don't fit into RAM */
|
||||
_Min_Heap_Size = 0; /* required amount of heap */
|
||||
|
||||
@@ -131,15 +131,15 @@ extern "C" void USART3_IRQHandler(void)
|
||||
}
|
||||
|
||||
// Receive
|
||||
uint32_t status = SPORT->SR;
|
||||
uint32_t status = USART3->SR;
|
||||
while (status & (USART_FLAG_RXNE | USART_FLAG_ERRORS)) {
|
||||
uint8_t data = SPORT->DR;
|
||||
uint8_t data = USART3->DR;
|
||||
|
||||
if (uart3Telemetry && !(status & USART_FLAG_ERRORS)) {
|
||||
telemetryFifo.push(data);
|
||||
}
|
||||
|
||||
status = SPORT->SR;
|
||||
status = USART3->SR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@ enum AlarmsCheckSteps {
|
||||
void telemetryWakeup()
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
uint8_t requiredTelemetryProtocol = MODEL_TELEMETRY_PROTOCOL;
|
||||
uint8_t requiredTelemetryProtocol = MODEL_TELEMETRY_PROTOCOL();
|
||||
if (telemetryProtocol != requiredTelemetryProtocol) {
|
||||
telemetryProtocol = requiredTelemetryProtocol;
|
||||
telemetryInit();
|
||||
@@ -307,8 +307,8 @@ void telemetryWakeup()
|
||||
}
|
||||
#elif defined(PCBSKY9X)
|
||||
if (telemetryProtocol == PROTOCOL_FRSKY_D_SECONDARY) {
|
||||
uint16_t data ;
|
||||
while ((data=telemetrySecondPortReceive()) != 0xFFFF) {
|
||||
uint8_t data;
|
||||
while (telemetrySecondPortReceive(data)) {
|
||||
processSerialData(data);
|
||||
}
|
||||
}
|
||||
@@ -347,7 +347,7 @@ void telemetryWakeup()
|
||||
alarmsCheckTime = get_tmr10ms() + 100; /* next check in 1 second */
|
||||
|
||||
if (alarmsCheckStep == ALARM_SWR_STEP) {
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(PCBTARANIS) && !defined(REVPLUS)
|
||||
if (IS_FRSKY_SPORT_PROTOCOL() && frskyData.swr.value > 0x33) {
|
||||
AUDIO_SWR_RED();
|
||||
POPUP_WARNING(STR_ANTENNAPROBLEM);
|
||||
|
||||
@@ -477,9 +477,9 @@ void frskyUpdateCells(void);
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define MODEL_TELEMETRY_PROTOCOL ((g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.externalModule == MODULE_TYPE_PPM) ? g_model.telemetryProtocol : PROTOCOL_FRSKY_SPORT)
|
||||
#define MODEL_TELEMETRY_PROTOCOL() ((g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF && g_model.externalModule == MODULE_TYPE_PPM) ? g_model.telemetryProtocol : PROTOCOL_FRSKY_SPORT)
|
||||
#elif defined(CPUARM)
|
||||
#define MODEL_TELEMETRY_PROTOCOL g_model.telemetryProtocol
|
||||
#define MODEL_TELEMETRY_PROTOCOL() g_model.telemetryProtocol
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -290,8 +290,9 @@ void frskyDProcessPacket(uint8_t *packet)
|
||||
link_counter += 256 / FRSKY_D_AVERAGING;
|
||||
#if defined(VARIO)
|
||||
uint8_t varioSource = g_model.frsky.varioSource - VARIO_SOURCE_A1;
|
||||
if (varioSource < 2)
|
||||
if (varioSource < 2) {
|
||||
frskyData.hub.varioSpeed = applyChannelRatio(varioSource, frskyData.analog[varioSource].value);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -300,12 +301,14 @@ void frskyDProcessPacket(uint8_t *packet)
|
||||
uint8_t numBytes = 3 + (packet[1] & 0x07); // sanitize in case of data corruption leading to buffer overflow
|
||||
for (uint8_t i=3; i<numBytes; i++) {
|
||||
#if defined(FRSKY_HUB)
|
||||
if (IS_USR_PROTO_FRSKY_HUB())
|
||||
if (IS_USR_PROTO_FRSKY_HUB()) {
|
||||
parseTelemHubByte(packet[i]);
|
||||
}
|
||||
#endif
|
||||
#if defined(WS_HOW_HIGH)
|
||||
if (IS_USR_PROTO_WS_HOW_HIGH())
|
||||
if (IS_USR_PROTO_WS_HOW_HIGH()) {
|
||||
parseTelemWSHowHighByte(packet[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user