Compare commits

...

114 Commits

Author SHA1 Message Date
bsongis 2e472700cc 2.0.4 preparation 2014-06-24 11:29:27 +02:00
bsongis edbe6fc72e Fixes #1316 2014-06-24 11:14:40 +02:00
bsongis 1b728948f4 Cosmetics 2014-06-24 11:14:40 +02:00
bsongis 7434c28820 Pulled from ersky9x 2014-06-24 11:14:40 +02:00
Bertrand Songis 751027b4ad Merge pull request #1355 from opentx/projectkk2glider/issue_1283
Fixes #1283 - EEPROM backup/restore - unexpectedShutdown set
2014-06-24 10:51:01 +02:00
Damjan Adamic 317890c9f9 Fixes #1283 - EEPROM backup/restore - unexpectedShutdown set 2014-06-23 19:47:49 +02:00
Damjan Adamic 65f433438a Fixes #1338 - Extend limits - Companion 2014-06-23 19:22:16 +02:00
bsongis 7167f6a9b7 Fixes Companion compilation error 2014-06-23 18:03:49 +02:00
bsongis cb47c0fc92 Fixes #1353 - Tests on radio needed before the release, thanks! 2014-06-23 17:58:52 +02:00
bsongis 37222c32a4 Sky9x compilation error when FRSKY not enabled 2014-06-23 17:40:16 +02:00
bsongis dafb700be2 [Taranis] Telemetry on battery serial port only enabled if UART3 mode is
set to telemetry
2014-06-23 17:38:00 +02:00
bsongis 9d4fbfc3ea Enable telemetry through the nice little cable on 9XR-PRRRO ;) 2014-06-23 17:24:38 +02:00
bsongis e96578c857 [Taranis] Telemetry (only FrSky D) through serial port inside the
battery compartment added
2014-06-23 15:41:50 +02:00
bsongis d2ce28f897 Constant badly used, thanks André for the review 2014-06-23 14:41:40 +02:00
Bertrand Songis 7b3e661110 Update DONATIONS.txt 2014-06-23 14:36:37 +02:00
bsongis 2c6f28e422 Fixes #1352 2014-06-23 12:15:17 +02:00
bsongis 1febac7bf9 Fixes #1347 2014-06-23 10:41:31 +02:00
Bertrand Songis 59b0bca88b Update DONATIONS.txt 2014-06-22 22:06:11 +02:00
bsongis 9f522beac4 300m/s as a max for the vario in Logical Switches 2014-06-22 15:23:56 +02:00
Bertrand Songis 4712383523 Merge pull request #1346 from opentx/projectkk2glider/issue_1345
Projectkk2glider/issue 1345
2014-06-22 15:17:42 +02:00
Damjan Adamic b8487c90de Removed traces 2014-06-22 13:53:46 +02:00
Damjan Adamic f3bc8cb9a4 Fixes #1345 2014-06-22 13:52:59 +02:00
Damjan Adamic c0c6a90f65 Added traces 2014-06-22 13:17:16 +02:00
bsongis ffd4151029 Menu length increased on Taranis to allow backups with date in the
filename
2014-06-22 09:29:12 +02:00
bsongis e3b8e91a0a No time on full EEPROM backup 2014-06-22 09:28:35 +02:00
bsongis 629e09c464 Only appends the date to a model backup (no time). No date/time on
gruvin9x board.
2014-06-22 09:23:59 +02:00
bsongis 8f36f0e405 Cosmetics 2014-06-22 09:14:16 +02:00
bsongis 7467213bad Possible display overflow 2014-06-22 09:00:41 +02:00
bsongis 5b2530ba79 Conditional compilation added around previous pull request (multi-lines
improvement)
2014-06-22 07:25:28 +02:00
Bertrand Songis d0a7d748c9 Merge pull request #1336 from ChrisNisbet01/multiline_string_issue
Fixes issue where strings may be truncated unnecessarily.
2014-06-22 07:17:33 +02:00
bsongis 790073d4db Fixes #1333 2014-06-22 07:14:54 +02:00
Bertrand Songis bb9cd3e8f5 Merge pull request #1344 from opentx/projectkk2glider/companion_lua_1334
Projectkk2glider/companion lua 1334
2014-06-22 00:19:17 +02:00
bsongis 83532f84cd Overflow in copySticksToOffset on 9x 2014-06-22 00:15:23 +02:00
bsongis cfd6d47dfb Fixes #1033 2014-06-22 00:14:49 +02:00
Damjan Adamic 831cbc0122 Script output names same as on the radio (i.e. LUA1b) 2014-06-21 22:20:56 +02:00
Damjan Adamic d0edbacf37 re #1334 - added Lua script outputs to: mixer soruces list, logical switches V1 and V2 list 2014-06-21 22:05:43 +02:00
bsongis 5fcba6e193 Fixes #1339 2014-06-21 21:49:26 +02:00
bsongis e5e378b1b0 Fixes #1343 2014-06-21 21:33:48 +02:00
bsongis 319b3006f3 Compilation problem on gruvin9x boards 2014-06-21 20:15:05 +02:00
bsongis e14c2e0916 Another couple of min/max fixed in Logical Switches 2014-06-21 20:12:28 +02:00
bsongis 026213fcd5 minTelemValue(...) rewritten 2014-06-21 20:03:36 +02:00
bsongis 1116bbb167 Cell max value is now 5.10V in the Firmware (as in Companion) 2014-06-21 19:39:49 +02:00
bsongis 99704109eb getRange(...) won't change the class members any more ... 2014-06-21 19:28:03 +02:00
bsongis f707035af5 A1- to A4- inaccessible 2014-06-21 19:18:23 +02:00
bsongis 8d6ab5c123 A1- A2- A3- A4- min/max wrong in Logical Switches (Companion) 2014-06-21 11:13:38 +02:00
bsongis 40a391d778 dTE min/max wrong in Logical Switches (Companion). GVARS min/max wrong
in Logical Switches (Firmware and Companion)
2014-06-21 11:06:58 +02:00
Chris Nisbet 9fe49846c5 Fixes issue where strings may be truncated unnecessarily.
If the string spans multiple lines (contains character 0x1E), the limit on the line's length should be set back to the original value.
2014-06-21 14:52:40 +12:00
bsongis 88c4c11b56 Fixes #1334 2014-06-21 00:00:29 +02:00
bsongis e4b5f98d58 Fixes #1331 2014-06-20 16:16:16 +02:00
bsongis 405391033d Logical Switches range bugfixes (both Companion and Firmware) 2014-06-20 16:06:55 +02:00
bsongis 13fd1f04c0 French translations 2014-06-20 14:35:15 +02:00
bsongis 8d42380abb Fixes #1329 2014-06-20 14:35:03 +02:00
bsongis 9e1afe8cb0 Bad display after removal of a custom script 2014-06-20 12:09:43 +02:00
bsongis 90381e369d kt to mph conversion taken from last commit (everything else removed, it
breaks 9x support)
2014-06-20 11:41:36 +02:00
bsongis 8fa2c21a47 Merge commit '2a277e930cb8e598c46aa24a5bf29056420cad6a' into next 2014-06-20 11:28:05 +02:00
bsongis c08b57ad9b Merge commit 'c9cc39c1395db32ffd4ef816f3cecbe8e5a2af96' into next 2014-06-20 11:27:41 +02:00
bsongis e31f71f874 Fixes copySticksToOffset bug when HELI enabled (thanks non regression
tests!)
2014-06-20 11:17:24 +02:00
Bertrand Songis 206563f433 Cosmetics 2014-06-20 11:06:11 +02:00
Bertrand Songis a191543ee3 Merge pull request #1298 from ChrisNisbet01/mass_storage_in_firmware
CN - Adds support for a mass storage USB device in the main firmware.
2014-06-20 11:03:59 +02:00
bsongis d74af019f8 #1323 non regression test added 2014-06-20 10:58:36 +02:00
Bertrand Songis 7ea0c7cb5c Merge pull request #1325 from opentx/MicheleVilla/IT_Translation_FW
Update it.h.txt
2014-06-20 09:49:05 +02:00
Michele 38918e157e Update it.h.txt
Small changes in Italian Translation
2014-06-20 08:42:37 +02:00
bsongis 99d33cbc74 Fixes #1324 2014-06-20 07:24:40 +02:00
Bertrand Songis a02b0f5d00 Update DONATIONS.txt 2014-06-20 07:08:33 +02:00
Andy Jenkinson bd42cbed33 Fixes #1302 2014-06-20 01:57:53 +01:00
Andy Jenkinson 546a680bec Support more build environments for Mac. 2014-06-20 00:48:11 +01:00
Bertrand Songis 7cc411d384 Update DONATIONS.txt 2014-06-19 23:59:49 +02:00
bsongis 6908509d79 CopyTrimsToOffset function added - #1323 2014-06-19 23:52:50 +02:00
bsongis b1f44d7101 Fixes #1323 2014-06-19 23:17:50 +02:00
Bertrand Songis e8e2ff4a94 Update DONATIONS.txt 2014-06-19 22:22:29 +02:00
Bertrand Songis 9d7af18f7b Update DONATIONS.txt 2014-06-19 21:17:15 +02:00
Bertrand Songis 937662eac4 Update DONATIONS.txt 2014-06-19 20:19:45 +02:00
Damjan Adamic 2a277e930c Correct minimum value for speed is 0 2014-06-19 16:44:24 +02:00
Damjan Adamic c9cc39c139 Unit for Knots is "kn" 2014-06-19 16:43:53 +02:00
bsongis 3623f66927 Does it fix #1212 on Windows? 2014-06-19 16:29:55 +02:00
bsongis dc58dd4d6f RPM max is 30000 also in Companion 2014-06-19 15:54:02 +02:00
bsongis 0d5196e8c9 Fixes #1291 2014-06-19 15:48:23 +02:00
Damjan Adamic 11b18ca760 Merge pull request #1315 from opentx/projectkk2glider/issue_1310
Fixes #1310 - Vspd V2 value resolution probem in Companion
2014-06-19 15:47:18 +02:00
Damjan Adamic b1fa194a1d Cosmetics 2014-06-19 15:45:47 +02:00
Damjan Adamic 3dfe0afd6f Merge branch 'next-upstream' 2014-06-19 15:40:02 +02:00
Kjell Kernen e82ca116f7 Added spalsh screens for 9xr and 9xrpro 2014-06-19 15:22:42 +02:00
Bertrand Songis 9db563c7c1 Merge pull request #1279 from hrenz/patch-4
Update de.h.txt    there was no RSSI selction at SF and Telemetrie
2014-06-19 15:15:42 +02:00
bsongis a9ad37cab9 Fixes #1304 - A1, A2, A3, A4, RSSI, SWR and Telemetry State alarms are
now Critical alarms and are played in "Alarm" mode.
2014-06-19 15:09:09 +02:00
bsongis 2d5a5eccd6 Fixes #1311 - Speed and AirSpeed maxima are now 2000kts in OpenTX 2014-06-19 15:04:17 +02:00
bsongis a5647ed7bc Fixes #1309 2014-06-19 14:47:26 +02:00
bsongis 7b1edb58a4 Fixes #1306 2014-06-19 12:29:22 +02:00
bsongis ed90015503 Fixes #1272 2014-06-19 11:59:18 +02:00
bsongis 6ef4134b2d Display of an unit in Logical Switches 2014-06-19 10:55:23 +02:00
Chris Nisbet 282a3d00b1 CN - Altered these files so that they have CRLF line endings. 2014-06-19 20:21:20 +12:00
bsongis 36395862d1 Fixes #1311 2014-06-19 10:20:09 +02:00
bsongis 1560fa8bd9 Companion bug in speed values (Logical Switches) 2014-06-19 10:20:09 +02:00
bsongis 79abc49a6c Update of bars source when the telemetry protocol changes 2014-06-19 10:20:09 +02:00
bsongis 6c86cada2c Bad initialization of weight in the MixerDialog (when no GVars) 2014-06-19 10:20:09 +02:00
Chris Nisbet 3e0135071e CN - Attempt to fix line ending issue where remote files have CRLF, but local files have LF only. 2014-06-19 19:50:40 +12:00
Chris Nisbet cdc0147dcb CN - Attempt to fix line ending issue where remote files have CRLF, but local files have LF only. 2014-06-19 19:49:29 +12:00
Damjan Adamic 73cd69c63b Fixes #1310 - Vspd V2 value resolution probem in Companion 2014-06-19 09:10:22 +02:00
Bertrand Songis 7e147c71c1 Merge pull request #1312 from opentx/projectkk2glider/issue_115
Fixes issue #115
2014-06-19 07:31:03 +02:00
Bertrand Songis c4140f305c Update DONATIONS.txt 2014-06-19 07:12:35 +02:00
Chris Nisbet 07b4be8f45 CN - Adds support for a mass storage USB device in the main firmware.
By default, the firmware includes the USB joystick device, but it is possible to replace this code with a mass storage device that allows access to the SD card when running the main firmware.
To include the mass storage device and remove the joystick device, add "USB=MASS" to the command line args when making the firmware.
2014-06-19 16:57:17 +12:00
Damjan Adamic fd9f3ad8be Bad indentaton and reduced buffer size 2014-06-19 06:53:53 +02:00
bsongis b83f95ed1a Events are transmitted to the Lua telemetry screens. Menus are displayed
over those screens (needed at least for Reset Telemetry/Flight)
2014-06-18 22:42:04 +02:00
bsongis b77d470684 background function added to Lua scripts (used only in telemetry
scripts)
2014-06-18 22:42:04 +02:00
bsongis ec81b078fe Now telem0.lua replaces the voltages screen and telem1.lua .. telem7.lua
are allowed. The user could now have 1+7+3+1=12 telemetry screens!
2014-06-18 22:42:04 +02:00
bsongis 2416dde7bb Lua telemetry screens. Still not finished:
- the scripts need to be wakedup even when not displayed
- I only tested telem0.lua, but theorically we could have 7 telemetry
screens
2014-06-18 22:42:04 +02:00
Bertrand Songis 0af5794cfa Update DONATIONS.txt 2014-06-18 22:29:11 +02:00
Damjan Adamic 1e917da05e RTC time initialization in simulator 2014-06-18 22:22:15 +02:00
Damjan Adamic c82068115f Fixes #115 - added date and time to backup filename 2014-06-18 22:19:57 +02:00
Bertrand Songis 41f14b93df Update DONATIONS.txt 2014-06-18 17:45:49 +02:00
Bertrand Songis df7455e24b Update DONATIONS.txt 2014-06-18 15:53:42 +02:00
Bertrand Songis a5316ef6e3 Update DONATIONS.txt 2014-06-18 11:43:56 +02:00
bsongis e6391f04c4 Firmware options refactoring. It allows
FirmwareInterface::getCapability() to know which options are enabled in
the preferences. The Heli tab and the GVars are displayed according to
these options.
2014-06-18 10:43:35 +02:00
bsongis 571b498a82 Warning removed 2014-06-18 07:26:36 +02:00
bsongis efc11be7ee TTS languages were hardcoded in the UI :( 2014-06-17 23:17:49 +02:00
hrenz 21b80be29a Update de.h.txt
Line 322 Colum 180 and Line 324 Colum 172 
german was different to engish
TR_TELEM_RSSI_RX missing
At opentx  telemetrie no RSSI selection at special funktions
hope thats all
2014-06-14 05:44:21 +02:00
100 changed files with 2872 additions and 2688 deletions
+13
View File
@@ -480,3 +480,16 @@ Gary Wild
Christof Ramm
Bruno Bedard
Salih Samim Aydin
Alexander Pils
Andrew Scerbina
Donovan Bodishbaugh
Ray Dunn
Burt Pickard-Richardson
Robert Ferguson
CY Enterprise
Michel Stathakis Neto
Beat Zurflueh
Heinrich Illig
Portstate Pty Ltd
Jens Hoffmann
Ricardo Santos
+7
View File
@@ -1,3 +1,10 @@
<h2>Version 2.0.4</h2>
<ul>
<li>Sound should be ok on all platforms</li>
<li>Min/Max reviewed in Logical switches (for the whole telemetry)</li>
<li>Various bug fixes</li>
</ul>
<h2>Version 2.0.3</h2>
<ul>
<li>EEPROM import bug on AdjustGVAR function</li>
+4 -12
View File
@@ -2,7 +2,7 @@ PROJECT( companion )
SET( C9X_VERSION_MAJOR "2" )
SET( C9X_VERSION_MINOR "0" )
SET( C9X_VERSION_REVISION "3" )
SET( C9X_VERSION_REVISION "4" )
SET( C9X_VERSION ${C9X_VERSION_MAJOR}.${C9X_VERSION_MINOR}.${C9X_VERSION_REVISION} )
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
@@ -87,13 +87,6 @@ add_custom_command(
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
)
add_custom_command(
OUTPUT ${RADIO_SRC_DIRECTORY}/stamp-opentx.h
COMMAND make stamp_header
DEPENDS ${RADIO_SRC_DIRECTORY}/Makefile
WORKING_DIRECTORY ${RADIO_SRC_DIRECTORY}
)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/../..
@@ -142,7 +135,6 @@ set(companion_SRCS
flashinterface.cpp
# xmlinterface.cpp
# ${PROJECT_BINARY_DIR}/radio.cxx
${RADIO_SRC_DIRECTORY}/stamp-opentx.h
helpers.cpp
mdichild.cpp
generaledit.cpp
@@ -250,8 +242,6 @@ NOW(TIME)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h @ONLY)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/translations.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc @ONLY)
# Subversion_WC_INFO( ${PROJECT_SOURCE_DIR}/../${FIRMWARE} G9X )
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/firmwares/opentx/stamp-opentx.h.in ${CMAKE_CURRENT_BINARY_DIR}/stamp-opentx.h @ONLY)
IF( WIN32 )
@@ -279,6 +269,8 @@ ADD_DEFINITIONS( -DQT_TRANSLATIONS_DIR="${QT_TRANSLATIONS_DIR}" )
IF( APPLE )
ADD_EXECUTABLE( ${PROJECT_NAME} MACOSX_BUNDLE ${companion_SRCS} ${companion_QM} )
# OS X compiler no longer automatically includes /Library/Frameworks in search path
SET( CMAKE_EXE_LINKER_FLAGS -F/Library/Frameworks )
ELSE( )
ADD_EXECUTABLE( ${PROJECT_NAME} WIN32 ${companion_SRCS} ${companion_QM} )
ENDIF( )
@@ -406,7 +398,7 @@ IF( APPLE )
COMMAND mkdir -p companion.app/Contents/Resources
COMMAND mkdir -p companion.app/Contents/translations
COMMAND rsync ${PROJECT_SOURCE_DIR}/images/${MACOSX_BUNDLE_ICON_FILE} companion.app/Contents/Resources/${MACOSX_BUNDLE_ICON_FILE} # Copy the icon files
COMMAND rsync ${PROJECT_SOURCE_DIR}/../targets/mac/lib* companion.app/Contents/Frameworks
#COMMAND rsync ${PROJECT_SOURCE_DIR}/../targets/mac/lib* companion.app/Contents/Frameworks
#COMMAND rsync ${PROJECT_SOURCE_DIR}/../targets/mac/libcrypto.1.0.0.dylib companion.app/Contents/Frameworks
COMMAND rsync -r --exclude=.svn ${PROJECT_SOURCE_DIR}/../targets/mac/qt_menu.nib companion.app/Contents/Resources/
COMMAND rsync ${PROJECT_BINARY_DIR}/*.qm companion.app/Contents/translations
+48 -96
View File
@@ -19,10 +19,6 @@ AppPreferencesDialog::AppPreferencesDialog(QWidget *parent) :
updateLock=false;
setWindowIcon(CompanionIcon("apppreferences.png"));
voice=NULL;
connect(ui->langCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(firmwareLangChanged()));
connect(ui->voiceCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(firmwareLangChanged()));
initSettings();
connect(ui->downloadVerCB, SIGNAL(currentIndexChanged(int)), this, SLOT(baseFirmwareChanged()));
connect(this, SIGNAL(accepted()), this, SLOT(writeValues()));
@@ -80,10 +76,11 @@ void AppPreferencesDialog::writeValues()
// If a new fw type has been choosen, several things need to reset
current_firmware_variant = getFirmwareVariant();
if (g.profile[g.id()].fwType() != current_firmware_variant.id) {
QString id = current_firmware_variant->getId();
if (g.profile[g.id()].fwType() != id) {
g.profile[g.id()].fwName("");
g.profile[g.id()].initFwVariables();
g.profile[g.id()].fwType( current_firmware_variant.id );
g.profile[g.id()].fwType(id);
}
}
@@ -103,8 +100,7 @@ void AppPreferencesDialog::initSettings()
ui->burnFirmware->setChecked(g.profile[g.id()].burnFirmware());
ui->snapshotPath->setText(g.snapshotDir());
ui->snapshotPath->setReadOnly(true);
if (ui->snapshotClipboardCKB->isChecked())
{
if (ui->snapshotClipboardCKB->isChecked()) {
ui->snapshotPath->setDisabled(true);
ui->snapshotPathButton->setDisabled(true);
}
@@ -114,8 +110,9 @@ void AppPreferencesDialog::initSettings()
ui->historySize->setValue(g.historySize());
ui->backLightColor->setCurrentIndex(g.backLight());
if (IS_TARANIS(GetCurrentFirmware()->getBoard()))
if (IS_TARANIS(GetCurrentFirmware()->getBoard())) {
ui->backLightColor->setEnabled(false);
}
ui->simuSW->setChecked(g.simuSW());
ui->modelWizard_CB->setChecked(g.useWizard());
@@ -189,13 +186,12 @@ void AppPreferencesDialog::initSettings()
foreach(FirmwareInterface * firmware, firmwares) {
ui->downloadVerCB->addItem(firmware->getName(), firmware->getId());
if (current_firmware == firmware) {
if (current_firmware->getFirmwareBase() == firmware) {
ui->downloadVerCB->setCurrentIndex(ui->downloadVerCB->count() - 1);
}
}
baseFirmwareChanged();
firmwareChanged();
}
void AppPreferencesDialog::on_libraryPathButton_clicked()
@@ -333,7 +329,8 @@ void AppPreferencesDialog::on_SplashSelect_clicked()
}
}
void AppPreferencesDialog::on_clearImageButton_clicked() {
void AppPreferencesDialog::on_clearImageButton_clicked()
{
ui->imageLabel->clear();
ui->SplashFileName->clear();
}
@@ -341,65 +338,45 @@ void AppPreferencesDialog::on_clearImageButton_clicked() {
void AppPreferencesDialog::showVoice(bool show)
{
if (show)
showVoice();
else
hideVoice();
}
void AppPreferencesDialog::showVoice()
{
ui->voiceLabel->show();
ui->voiceCombo->show();
}
void AppPreferencesDialog::hideVoice()
{
ui->voiceLabel->hide();
ui->voiceCombo->hide();
ui->voiceLabel->setVisible(show);
ui->voiceCombo->setVisible(show);
QTimer::singleShot(0, this, SLOT(shrink()));
}
void AppPreferencesDialog::baseFirmwareChanged()
{
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
voice=NULL;
foreach(FirmwareInterface * firmware, firmwares) {
if (firmware->getId() == selected_firmware) {
showVoice(firmware->voice);
populateFirmwareOptions(firmware);
break;
}
}
firmwareChanged();
}
FirmwareVariant AppPreferencesDialog::getFirmwareVariant()
FirmwareInterface * AppPreferencesDialog::getFirmwareVariant()
{
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
bool voice=false;
foreach(FirmwareInterface * firmware, firmwares) {
QString id = firmware->getId();
if (id == selected_firmware) {
foreach(QCheckBox *cb, optionsCheckBoxes) {
if (cb->isChecked()) {
if (cb->text()=="voice" && cb->isChecked())
voice=true;
id += QString("-") + cb->text();
}
}
if (voice) {
if (ui->voiceCombo->count() && (voice || firmware->voice))
id += QString("-tts") + ui->voiceCombo->currentText();
}
else {
hideVoice();
}
if (ui->langCombo->count())
id += QString("-") + ui->langCombo->currentText();
return GetFirmwareVariant(id);
if (voice && voice->isChecked()) {
id += QString("-tts") + ui->voiceCombo->currentText();
}
if (ui->langCombo->count()) {
id += QString("-") + ui->langCombo->currentText();
}
return GetFirmware(id);
}
}
@@ -410,6 +387,9 @@ FirmwareVariant AppPreferencesDialog::getFirmwareVariant()
void AppPreferencesDialog::firmwareOptionChanged(bool state)
{
QCheckBox *cb = qobject_cast<QCheckBox*>(sender());
if (cb == voice) {
showVoice(voice->isChecked());
}
FirmwareInterface * firmware=NULL;
if (cb && state) {
QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex());
@@ -421,74 +401,37 @@ void AppPreferencesDialog::firmwareOptionChanged(bool state)
foreach(Option other, opts) {
if (other.name != opt.name) {
foreach(QCheckBox *ocb, optionsCheckBoxes) {
if (ocb->text() == other.name)
if (ocb->text() == other.name) {
ocb->setChecked(false);
}
}
}
}
if (voice) {
showVoice(voice->isChecked());
}
return firmwareChanged();
return;
}
}
}
}
}
}
else if (cb && !state) {
if (cb->text()=="voice") {
hideVoice();
}
}
if (voice) {
showVoice(voice->isChecked());
}
else if (firmware) {
if (firmware->voice) {
showVoice();
}
}
return firmwareChanged();
}
void AppPreferencesDialog::firmwareLangChanged()
{
firmwareChanged();
}
void AppPreferencesDialog::firmwareChanged()
{
if (updateLock)
return;
FirmwareVariant variant = getFirmwareVariant();
QString stamp;
stamp.append(variant.firmware->getStampUrl());
QString url = variant.getFirmwareUrl();
}
void AppPreferencesDialog::populateFirmwareOptions(const FirmwareInterface * firmware)
{
const FirmwareInterface * parent = /*firmware->parent ? firmware->parent : */ firmware;
const FirmwareInterface * parent = firmware->getFirmwareBase();
updateLock = true;
QString id = current_firmware_variant->getId();
ui->langCombo->clear();
foreach(const char *lang, parent->languages) {
ui->langCombo->addItem(lang);
if (current_firmware_variant.id.endsWith(lang))
if (id.endsWith(lang)) {
ui->langCombo->setCurrentIndex(ui->langCombo->count() - 1);
}
ui->voiceCombo->clear();
foreach(const char *lang, parent->ttslanguages) {
ui->voiceCombo->addItem(lang);
if (current_firmware_variant.id.contains(QString("-tts%1").arg(lang)))
ui->voiceCombo->setCurrentIndex(ui->voiceCombo->count() - 1);
}
}
showVoice(ui->langCombo->count()!=0);
voice = NULL; // we will search for a voice checkbox
int index = 0;
foreach(QList<Option> opts, parent->opts) {
@@ -505,21 +448,30 @@ void AppPreferencesDialog::populateFirmwareOptions(const FirmwareInterface * fir
cb->show();
cb->setText(opt.name);
cb->setToolTip(opt.tooltip);
cb->setCheckState(current_firmware_variant.id.contains(opt.name) ? Qt::Checked : Qt::Unchecked);
if (opt.name==QString("voice")) {
voice=cb;
showVoice(current_firmware_variant.id.contains(opt.name) ||firmware->voice);
cb->setCheckState(id.contains(opt.name) ? Qt::Checked : Qt::Unchecked);
if (opt.name == QString("voice")) {
voice = cb;
}
}
}
}
for (; index<optionsCheckBoxes.size(); index++) {
QCheckBox *cb = optionsCheckBoxes.at(index);
cb->hide();
cb->setCheckState(Qt::Unchecked);
}
ui->voiceCombo->clear();
foreach(const char *lang, parent->ttslanguages) {
ui->voiceCombo->addItem(lang);
if (id.contains(QString("-tts%1").arg(lang))) {
ui->voiceCombo->setCurrentIndex(ui->voiceCombo->count() - 1);
}
}
showVoice(voice && voice->isChecked());
updateLock = false;
QTimer::singleShot(0, this, SLOT(shrink()));
}
+1 -3
View File
@@ -28,7 +28,7 @@ class AppPreferencesDialog : public QDialog
void hideVoice();
void populateLocale();
void populateFirmwareOptions(const FirmwareInterface *);
FirmwareVariant getFirmwareVariant();
FirmwareInterface * getFirmwareVariant();
QCheckBox * voice;
Ui::AppPreferencesDialog *ui;
@@ -39,10 +39,8 @@ class AppPreferencesDialog : public QDialog
protected slots:
void shrink();
void firmwareLangChanged();
void baseFirmwareChanged();
void firmwareOptionChanged(bool state);
void firmwareChanged();
void writeValues();
void on_libraryPathButton_clicked();
+260 -307
View File
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>685</width>
<height>818</height>
<height>550</height>
</rect>
</property>
<property name="sizePolicy">
@@ -51,22 +51,15 @@
<attribute name="title">
<string>Radio Profile</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="22" column="5">
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0,1,0,0,0,0,0">
<item row="21" column="7">
<widget class="QPushButton" name="sdPathButton">
<property name="text">
<string>Open Folder</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="downloadVerCB">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="26" column="0">
<item row="25" column="0">
<widget class="QLabel" name="label_13">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
@@ -82,7 +75,7 @@
</property>
</widget>
</item>
<item row="10" column="0">
<item row="9" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Build Options</string>
@@ -92,7 +85,7 @@
</property>
</widget>
</item>
<item row="8" column="0">
<item row="7" column="0">
<widget class="QLabel" name="langLabel">
<property name="text">
<string>Menu Language</string>
@@ -102,7 +95,7 @@
</property>
</widget>
</item>
<item row="24" column="0">
<item row="23" column="0">
<widget class="QLabel" name="label_14">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
@@ -115,14 +108,14 @@
</property>
</widget>
</item>
<item row="15" column="5">
<item row="14" column="7">
<widget class="QPushButton" name="SplashSelect">
<property name="text">
<string>Select Image</string>
</property>
</widget>
</item>
<item row="23" column="1">
<item row="22" column="1">
<widget class="QLabel" name="lblGeneralSettings">
<property name="enabled">
<bool>true</bool>
@@ -132,37 +125,247 @@
</property>
</widget>
</item>
<item row="15" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="11" column="0" colspan="6">
<item row="10" column="0" colspan="8">
<widget class="Line" name="line_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="10" column="1" colspan="5">
<item row="9" column="1" colspan="7">
<layout class="QGridLayout" name="optionsLayout"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="CPU_ID_LABEL">
<item row="14" column="0">
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Processor ID</string>
<string>Splash Screen</string>
</property>
</widget>
</item>
<item row="24" column="1" colspan="3">
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Profile Name</string>
</property>
</widget>
</item>
<item row="17" column="7">
<widget class="QPushButton" name="clearImageButton">
<property name="text">
<string>Clear Image</string>
</property>
</widget>
</item>
<item row="17" column="1">
<widget class="QLabel" name="imageLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>128</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>212</width>
<height>64</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Sans Serif</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Radio Type</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="19" column="0" colspan="8">
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="0" colspan="8">
<widget class="Line" name="line_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="20" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Other Settings</string>
</property>
</widget>
</item>
<item row="22" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>General Settings</string>
</property>
</widget>
</item>
<item row="21" column="0">
<widget class="QLabel" name="sdPathLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>SD Structure path</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="7" column="1" colspan="7">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1,1">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<widget class="QComboBox" name="langCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="voiceLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Sans Serif</family>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Voice Language</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="voiceCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Set voice language.
May be different from firmware language</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="1" colspan="7">
<widget class="QComboBox" name="downloadVerCB">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="14" column="1" colspan="6">
<widget class="QLineEdit" name="SplashFileName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="21" column="1" colspan="6">
<widget class="QLineEdit" name="sdPath">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="23" column="1" colspan="6">
<widget class="QComboBox" name="stickmodeCB">
<property name="maximumSize">
<size>
@@ -216,26 +419,7 @@ Mode 4:
</item>
</widget>
</item>
<item row="15" column="0">
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Splash Screen</string>
</property>
</widget>
</item>
<item row="26" column="1" colspan="3">
<item row="25" column="1" colspan="6">
<widget class="QComboBox" name="channelorderCB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -383,20 +567,31 @@ Mode 4:
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<item row="1" column="1" colspan="6">
<widget class="QLineEdit" name="profileNameLE"/>
</item>
<item row="1" column="7">
<widget class="QPushButton" name="removeProfileButton">
<property name="text">
<string>Profile Name</string>
<string>Remove Profile</string>
</property>
</widget>
</item>
<item row="29" column="1">
<item row="26" column="1" colspan="7">
<widget class="QCheckBox" name="renameFirmware">
<property name="text">
<string>Append version number to FW file name</string>
</property>
</widget>
</item>
<item row="27" column="1" colspan="7">
<widget class="QCheckBox" name="burnFirmware">
<property name="text">
<string>Offer to write FW to Tx after download</string>
</property>
</widget>
</item>
<item row="28" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -409,248 +604,6 @@ Mode 4:
</property>
</spacer>
</item>
<item row="28" column="5">
<widget class="QPushButton" name="removeProfileButton">
<property name="text">
<string>Remove Profile</string>
</property>
</widget>
</item>
<item row="15" column="1" colspan="2">
<widget class="QLineEdit" name="SplashFileName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>350</width>
<height>16777215</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="18" column="5">
<widget class="QPushButton" name="clearImageButton">
<property name="text">
<string>Clear Image</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="profileNameLE">
<property name="minimumSize">
<size>
<width>350</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>350</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="18" column="1">
<widget class="QLabel" name="imageLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>128</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>212</width>
<height>64</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="27" column="1" colspan="4">
<widget class="QCheckBox" name="renameFirmware">
<property name="text">
<string>Append version number to FW file name</string>
</property>
</widget>
</item>
<item row="28" column="1" colspan="4">
<widget class="QCheckBox" name="burnFirmware">
<property name="text">
<string>Offer to write FW to Tx after download</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QComboBox" name="langCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Sans Serif</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Radio Type</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="22" column="1">
<widget class="QLineEdit" name="sdPath">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>350</width>
<height>16777215</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="20" column="0" colspan="6">
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="0" colspan="6">
<widget class="Line" name="line_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="21" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Other Settings</string>
</property>
</widget>
</item>
<item row="23" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>General Settings</string>
</property>
</widget>
</item>
<item row="22" column="0">
<widget class="QLabel" name="sdPathLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>SD Structure path</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QComboBox" name="voiceCombo">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Set voice language.
May be different from firmware language</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="voiceLabel">
<property name="font">
<font>
<family>Sans Serif</family>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Voice Language</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="applicationTab">
+5 -8
View File
@@ -555,16 +555,13 @@ void burnDialog::on_BurnFlashButton_clicked()
QMessageBox::critical(this, tr("Warning"), tr("Wrong radio setting data in profile, Settings not patched"));
}
QString fileName;
if (patch) {
QString tempDir = QDir::tempPath();
fileName = tempDir + "/temp.bin";
QString tempDir = QDir::tempPath();
QString fileName = tempDir + "/temp.bin";
QFile file(fileName);
uint8_t *eeprom = (uint8_t*)malloc(GetEepromInterface()->getEEpromSize());
int eeprom_size = 0;
eeprom_size = GetEepromInterface()->save(eeprom, radioData, GetCurrentFirmwareVariant());
int eeprom_size = GetEepromInterface()->save(eeprom, radioData, GetCurrentFirmware()->getVariantNumber());
if (!eeprom_size) {
QMessageBox::warning(this, tr("Error"),tr("Cannot write file %1:\n%2.").arg(fileName).arg(file.errorString()));
hexfileName->clear();
@@ -578,10 +575,10 @@ void burnDialog::on_BurnFlashButton_clicked()
QTextStream outputStream(&file);
long result = file.write((char*)eeprom, eeprom_size);
if (result!=eeprom_size) {
if (result != eeprom_size) {
QMessageBox::warning(this, tr("Error"),tr("Error writing file %1:\n%2.").arg(fileName).arg(file.errorString()));
hexfileName->clear();
}
hexfileName->clear();
hexfileName->append(fileName);
}
+6 -2
View File
@@ -12,7 +12,11 @@
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
macro(_phonon_find_version)
file(READ "${PHONON_INCLUDE_DIR}/phonon/phononnamespace.h" _phonon_header LIMIT 5000 OFFSET 1000)
set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/phonon/phononnamespace.h")
if (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
endif (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
file(READ ${_phonon_namespace_header_file} _phonon_header LIMIT 5000 OFFSET 1000)
string(REGEX MATCH "define PHONON_VERSION_STR \"(4\\.[0-9]+\\.[0-9a-z]+)\"" _phonon_version_match "${_phonon_header}")
set(PHONON_VERSION "${CMAKE_MATCH_1}")
message(STATUS "Phonon Version: ${PHONON_VERSION}")
@@ -31,7 +35,7 @@ else(PHONON_FOUND)
# then at the default system locations (CMAKE_SYSTEM_PREFIX_PATH, i.e. /usr etc.)
find_library(PHONON_LIBRARY NAMES phonon)
find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h PATHS ${KDE4_INCLUDE_INSTALL_DIR} ${QT_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h PATHS ${KDE4_INCLUDE_INSTALL_DIR} ${QT_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ${QT_LIBRARY_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h)
if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
+9 -4
View File
@@ -97,18 +97,23 @@ int main(int argc, char *argv[])
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
if (g.profile[g.id()].fwType().isEmpty()){
g.profile[g.id()].fwType(default_firmware_variant.id);
g.profile[g.id()].fwType(default_firmware_variant->getId());
g.profile[g.id()].fwName("");
}
QPixmap pixmap = QPixmap(g.profile[g.id()].fwType().contains("taranis") ? ":/images/splasht.png" : ":/images/splash.png");
QString splashScreen;
if ( g.profile[g.id()].fwType().contains("taranis")) splashScreen = ":/images/splasht.png";
else if ( g.profile[g.id()].fwType().contains("9xrpro")) splashScreen = ":/images/splashp.png";
else if ( g.profile[g.id()].fwType().contains("9xr")) splashScreen = ":/images/splashr.png";
else splashScreen = ":/images/splash.png";
QPixmap pixmap = QPixmap(splashScreen);
QSplashScreen *splash = new QSplashScreen(pixmap);
RegisterEepromInterfaces();
registerOpenTxFirmwares();
current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType());
current_firmware_variant = GetFirmware(g.profile[g.id()].fwType());
MainWindow *mainWin = new MainWindow();
if (g.showSplash()) {
+2
View File
@@ -40,6 +40,8 @@
<file>images/9xcursphoto.png</file>
<file>images/screenshot.png</file>
<file>images/splash.png</file>
<file>images/splashp.png</file>
<file>images/splashr.png</file>
<file>images/splasht.png</file>
<file>images/companion-title.png</file>
<file>images/maps.png</file>
+21 -38
View File
@@ -333,32 +333,19 @@ void CompareDialog::printPhases()
str.append("</tr>");
}
str.append("</table>");
int gvars=0;
int gvarnum=0;
if (GetCurrentFirmware()->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1;
}
}
else {
gvars=1;
}
if (gvars==1) {
gvarnum=GetCurrentFirmware()->getCapability(Gvars);
}
if ((gvars==1 && GetCurrentFirmware()->getCapability(GvarsFlightModes)) || GetCurrentFirmware()->getCapability(RotaryEncoders)) {
int gvars = GetCurrentFirmware()->getCapability(Gvars);
if ((gvars && GetCurrentFirmware()->getCapability(GvarsFlightModes)) || GetCurrentFirmware()->getCapability(RotaryEncoders)) {
str.append("<br><table border=1 cellspacing=0 cellpadding=1 width=\"100%\">");
str.append("<tr><td style=\"border-style:none;\">&nbsp;</td>");
if (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(gvarnum)+tr("Gvars")+"</td>");
str.append(QString("<td colspan=%1 align=center><b>").arg(gvars)+tr("Gvars")+"</td>");
}
if (GetCurrentFirmware()->getCapability(RotaryEncoders)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(GetCurrentFirmware()->getCapability(RotaryEncoders))+tr("Rot. Enc.")+"</td>");
}
str.append("</tr><tr><td align=center><b>"+tr("Flight mode name")+"</b></td>");
if (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
for (i=0; i<gvarnum; i++) {
for (i=0; i<gvars; i++) {
str.append(QString("<td width=\"40\" align=\"center\"><b>GV%1</b><br>%2</td>").arg(i+1).arg(g_model1->gvars_names[i]));
}
}
@@ -373,7 +360,7 @@ void CompareDialog::printPhases()
color=getColor1(pd1->name,pd2->name);
str.append(QString("<font size=+1 face='Courier New' color=%2>%1</font></td>").arg(pd1->name).arg(color));
if (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
for (k=0; k<gvarnum; k++) {
for (k=0; k<gvars; k++) {
color=getColor1(pd1->gvars[k],pd2->gvars[k]);
if (pd1->gvars[k]<=1024) {
str.append(QString("<td align=\"right\" width=\"40\"><font size=+1 face='Courier New' color=%2>%1").arg(pd1->gvars[k]).arg(color)+"</font></td>");
@@ -436,18 +423,18 @@ void CompareDialog::printPhases()
}
str.append("</table>");
if ((gvars==1 && GetCurrentFirmware()->getCapability(GvarsFlightModes)) || GetCurrentFirmware()->getCapability(RotaryEncoders)) {
if ((gvars && GetCurrentFirmware()->getCapability(GvarsFlightModes)) || GetCurrentFirmware()->getCapability(RotaryEncoders)) {
str.append("<br><table border=1 cellspacing=0 cellpadding=1 width=\"100%\">");
str.append("<tr><td style=\"border-style:none;\">&nbsp;</td>");
if (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(gvarnum)+tr("Gvars")+"</td>");
str.append(QString("<td colspan=%1 align=center><b>").arg(gvars)+tr("Gvars")+"</td>");
}
if (GetCurrentFirmware()->getCapability(RotaryEncoders)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(GetCurrentFirmware()->getCapability(RotaryEncoders))+tr("Rot. Enc.")+"</td>");
}
str.append("</tr><tr><td align=center ><b>"+tr("Flight mode name")+"</b></td>");
if (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
for (i=0; i<gvarnum; i++) {
for (i=0; i<gvars; i++) {
str.append(QString("<td width=\"40\" align=\"center\"><b>GV%1</b><br>%2</td>").arg(i+1).arg(g_model2->gvars_names[i]));
}
}
@@ -462,7 +449,7 @@ void CompareDialog::printPhases()
color=getColor1(pd1->name,pd2->name);
str.append(QString("<font size=+1 face='Courier New' color=%2>%1</font></td>").arg(pd2->name).arg(color));
if (GetCurrentFirmware()->getCapability(GvarsFlightModes)) {
for (k=0; k<gvarnum; k++) {
for (k=0; k<gvars; k++) {
color=getColor1(pd1->gvars[k],pd2->gvars[k]);
if (pd2->gvars[k]<=1024) {
str.append(QString("<td align=\"right\" width=\"40\"><font size=+1 face='Courier New' color=%2>%1").arg(pd2->gvars[k]).arg(color)+"</font></td>");
@@ -562,28 +549,23 @@ void CompareDialog::printLimits()
void CompareDialog::printGvars()
{
QString color;
int gvars=0;
int gvarnum=0;
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT ) || (!GetCurrentFirmware()->getCapability(HasVariants) && GetCurrentFirmware()->getCapability(Gvars))) {
gvars=1;
gvarnum=GetCurrentFirmware()->getCapability(Gvars);
}
int gvars = GetCurrentFirmware()->getCapability(Gvars);
if (!GetCurrentFirmware()->getCapability(GvarsFlightModes) && (gvars==1 && GetCurrentFirmware()->getCapability(Gvars))) {
if (!GetCurrentFirmware()->getCapability(GvarsFlightModes) && gvars) {
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
str.append("<tr><td colspan=2><h2>"+tr("Global Variables")+"</h2></td></tr>");
str.append("<tr><td width=50%>");
str.append("<table border=1 cellspacing=0 cellpadding=3 width=100>");
FlightModeData *pd1=&g_model1->flightModeData[0];
FlightModeData *pd2=&g_model2->flightModeData[0];
int width=100/gvarnum;
int width = 100 / gvars;
str.append("<tr>");
for(int i=0; i<gvarnum; i++) {
for (int i=0; i<gvars; i++) {
str.append(QString("<td width=\"%1%\" align=\"center\"><b>").arg(width)+tr("GV")+QString("%1</b></td>").arg(i+1));
}
str.append("</tr>");
str.append("<tr>");
for(int i=0; i<gvarnum; i++) {
for (int i=0; i<gvars; i++) {
color=getColor1(pd1->gvars[i],pd2->gvars[i]);
str.append(QString("<td width=\"%1%\" align=\"center\"><font color=%2>").arg(width).arg(color)+QString("%1</font></td>").arg(pd1->gvars[i]));
}
@@ -591,12 +573,12 @@ void CompareDialog::printGvars()
str.append("</table></td><td width=50%>");
str.append("<table border=1 cellspacing=0 cellpadding=3 width=100>");
str.append("<tr>");
for(int i=0; i<gvarnum; i++) {
for (int i=0; i<gvars; i++) {
str.append(QString("<td width=\"%1%\" align=\"center\"><b>").arg(width)+tr("GV")+QString("%1</b></td>").arg(i+1));
}
str.append("</tr>");
str.append("<tr>");
for(int i=0; i<gvarnum; i++) {
for (int i=0; i<gvars; i++) {
color=getColor2(pd1->gvars[i],pd2->gvars[i]);
str.append(QString("<td width=\"%1%\" align=\"center\"><font color=%2>").arg(width).arg(color)+QString("%1</font></td>").arg(pd2->gvars[i]));
}
@@ -821,7 +803,7 @@ void CompareDialog::printMixers()
break;
};
str += QString(" %1").arg(getGVarString(md->weight)).rightJustified(6, ' ');
str += md->srcRaw.toString();
str += md->srcRaw.toString(*g_model1);
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));
@@ -899,7 +881,7 @@ void CompareDialog::printMixers()
break;
};
str += QString(" %1").arg(getGVarString(md->weight)).rightJustified(6, ' ');
str += md->srcRaw.toString();
str += md->srcRaw.toString(*g_model2);
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));
@@ -1043,8 +1025,9 @@ void CompareDialog::printSwitches()
str.append("<tr><td><h2>"+tr("Logical Switches")+"</h2></td></tr>");
str.append("<tr><td><table border=1 cellspacing=0 cellpadding=1 width=\"100%\">");
for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
QString sw1 = g_model1->customSw[i].toString(*g_model1);
QString sw2 = g_model2->customSw[i].toString(*g_model2);
GeneralSettings settings;
QString sw1 = g_model1->customSw[i].toString(*g_model1, settings);
QString sw2 = g_model2->customSw[i].toString(*g_model2, settings);
if (!(sw1.isEmpty() && sw2.isEmpty())) {
str.append("<tr>");
color=getColor1(sw1,sw2);
+1
View File
@@ -19,6 +19,7 @@ class CompareDialog : public QDialog
~CompareDialog();
protected:
GeneralSettings * settings;
ModelData * g_model1;
ModelData * g_model2;
ModelData * modeltemp;
+148 -65
View File
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <list>
#include <float.h>
#include "eeprominterface.h"
#include "firmwares/er9x/er9xinterface.h"
#include "firmwares/th9x/th9xinterface.h"
@@ -91,11 +92,13 @@ QString getGVarString(int16_t val, bool sign)
}
}
RawSourceRange RawSource::getRange(bool singleprec)
RawSourceRange RawSource::getRange(const ModelData & model, const GeneralSettings & settings, unsigned int flags) const
{
RawSourceRange result;
int board = GetEepromInterface()->getBoard();
FirmwareInterface * firmware = GetCurrentFirmware();
int board = firmware->getBoard();
bool singleprec = (flags & RANGE_SINGLE_PRECISION);
if (!singleprec && !IS_ARM(board)) {
singleprec = true;
@@ -103,11 +106,16 @@ RawSourceRange RawSource::getRange(bool singleprec)
switch (type) {
case SOURCE_TYPE_TELEMETRY:
if (singleprec) {
result.offset = -DBL_MAX;
}
switch (index) {
case TELEMETRY_SOURCE_TX_BATT:
result.step = 0.1;
result.decimals = 1;
result.max = 25.5;
result.unit = QObject::tr("V");
break;
case TELEMETRY_SOURCE_TX_TIME:
result.step = 1;
@@ -117,33 +125,41 @@ RawSourceRange RawSource::getRange(bool singleprec)
case TELEMETRY_SOURCE_TIMER2:
result.step = singleprec ? 5 : 1;
result.max = singleprec ? 255*5 : 60*60;
result.unit = QObject::tr("s");
break;
case TELEMETRY_SOURCE_RSSI_TX:
case TELEMETRY_SOURCE_RSSI_RX:
result.max = 100;
if (singleprec) result.offset = 128;
break;
case TELEMETRY_SOURCE_A1_MIN:
case TELEMETRY_SOURCE_A2_MIN:
case TELEMETRY_SOURCE_A3_MIN:
case TELEMETRY_SOURCE_A4_MIN:
result = model.frsky.channels[index-TELEMETRY_SOURCE_A1_MIN].getRange();
break;
case TELEMETRY_SOURCE_A1:
case TELEMETRY_SOURCE_A2:
case TELEMETRY_SOURCE_A3:
case TELEMETRY_SOURCE_A4:
if (model) {
const FrSkyChannelData & channel = model->frsky.channels[index-TELEMETRY_SOURCE_A1];
float ratio = channel.getRatio();
if (channel.type==0 || channel.type==1 || channel.type==2)
result.decimals = 2;
else
result.decimals = 0;
result.step = ratio / 255;
result.min = channel.offset * result.step;
result.max = ratio + result.min;
}
result = model.frsky.channels[index-TELEMETRY_SOURCE_A1].getRange();
break;
case TELEMETRY_SOURCE_ALT:
case TELEMETRY_SOURCE_ALT_MIN:
case TELEMETRY_SOURCE_ALT_MAX:
case TELEMETRY_SOURCE_GPS_ALT:
result.step = singleprec ? 8 : 1;
result.min = -500;
result.max = singleprec ? 1540 : 3000;
if (firmware->getCapability(Imperial) || settings.imperial) {
result.step = (result.step * 105) / 32;
result.min = (result.min * 105) / 32;
result.max = (result.max * 105) / 32;
result.unit = QObject::tr("ft");
}
else {
result.unit = QObject::tr("m");
}
break;
case TELEMETRY_SOURCE_T1:
case TELEMETRY_SOURCE_T1_MAX:
@@ -151,89 +167,133 @@ RawSourceRange RawSource::getRange(bool singleprec)
case TELEMETRY_SOURCE_T2_MAX:
result.min = -30;
result.max = 225;
result.unit = QObject::trUtf8("°C");
break;
case TELEMETRY_SOURCE_HDG:
result.step = singleprec ? 2 : 1;
result.max = 360;
if (singleprec) result.offset = 256;
result.unit = QObject::trUtf8("°");
break;
case TELEMETRY_SOURCE_RPM:
case TELEMETRY_SOURCE_RPM_MAX:
result.step = singleprec ? 50 : 1;
result.max = singleprec ? 12750 : 20000;
result.max = singleprec ? 12750 : 30000;
break;
case TELEMETRY_SOURCE_FUEL:
result.max = 100;
result.unit = QObject::tr("%");
break;
case TELEMETRY_SOURCE_ASPEED:
case TELEMETRY_SOURCE_ASPEED_MAX:
case TELEMETRY_SOURCE_SPEED:
case TELEMETRY_SOURCE_SPEED_MAX:
result.step = singleprec ? 4 : 1;
result.max = singleprec ? (4*236) : 2000;
if (model && !model->frsky.imperial) {
result.step = singleprec ? 2 : 1;
result.max = singleprec ? (2*255) : 2000;
if (firmware->getCapability(Imperial) || settings.imperial) {
result.step *= 1.150779;
result.max *= 1.150779;
result.unit = QObject::tr("mph");
}
else {
result.step *= 1.852;
result.max *= 1.852;
result.unit = QObject::tr("km/h");
}
break;
case TELEMETRY_SOURCE_VERTICAL_SPEED:
result.step = 0.1;
result.min = -12.5;
result.max = 13.0;
result.min = singleprec ? -12.5 : -300.0;
result.max = singleprec ? 13.0 : 300.0;
result.decimals = 1;
result.unit = QObject::tr("m/s");
break;
case TELEMETRY_SOURCE_DTE:
result.max = 30000;
break;
case TELEMETRY_SOURCE_DIST:
case TELEMETRY_SOURCE_DIST_MAX:
result.step = singleprec ? 8 : 1;
result.max = singleprec ? 2040 : 10000;
result.unit = QObject::tr("m");
break;
case TELEMETRY_SOURCE_CELL:
case TELEMETRY_SOURCE_CELL_MIN:
result.step = singleprec ? 0.02 : 0.01;
result.max = 5.1;
result.decimals = 2;
result.unit = QObject::tr("V");
break;
case TELEMETRY_SOURCE_CELLS_SUM:
case TELEMETRY_SOURCE_CELLS_MIN:
case TELEMETRY_SOURCE_VFAS:
case TELEMETRY_SOURCE_VFAS_MIN:
result.step = 0.1;
result.max = 25.5;
result.max = singleprec ? 25.5 : 100.0;
result.decimals = 1;
result.unit = QObject::tr("V");
break;
case TELEMETRY_SOURCE_CURRENT:
case TELEMETRY_SOURCE_CURRENT_MAX:
result.step = singleprec ? 0.5 : 0.1;
result.max = singleprec ? 127.5 : 200.0;
result.decimals = 1;
result.unit = QObject::tr("A");
break;
case TELEMETRY_SOURCE_CONSUMPTION:
result.step = singleprec ? 100 : 1;
result.max = singleprec ? 25500 : 10000;
result.unit = QObject::tr("mAh");
break;
case TELEMETRY_SOURCE_POWER:
case TELEMETRY_SOURCE_POWER_MAX:
result.step = singleprec ? 5 : 1;
result.max = singleprec ? 1275 : 2000;
result.unit = QObject::tr("W");
break;
case TELEMETRY_SOURCE_ACCX:
case TELEMETRY_SOURCE_ACCY:
case TELEMETRY_SOURCE_ACCZ:
result.step = 0.01;
result.decimals = 2;
result.max = 2.55;
result.max = singleprec ? 2.55 : 10.00;
result.min = singleprec ? 0 : -10.00;
result.unit = QObject::tr("g");
break;
default:
result.max = 125;
break;
}
if (singleprec && !result.offset) {
if (singleprec && result.offset==-DBL_MAX) {
result.offset = result.max - (127*result.step);
}
if (flags & (RANGE_DELTA_FUNCTION|RANGE_DELTA_ABS_FUNCTION)) {
if (singleprec) {
result.offset = 0;
result.min = result.step * -127;
result.max = result.step * 127;
}
else {
result.min = -result.max;
}
}
break;
default:
result.max = (model && model->extendedLimits ? 125 : 100);
result.min = - result.max;
case SOURCE_TYPE_GVAR:
result.max = 1024;
result.min = -result.max;
break;
default:
result.max = (model.extendedLimits ? 125 : 100);
result.min = -result.max;
break;
}
if (flags & RANGE_DELTA_ABS_FUNCTION) {
result.min = 0;
}
return result;
@@ -257,7 +317,7 @@ QString RotaryEncoderString(int index)
return CHECK_IN_ARRAY(rotary, index);
}
QString RawSource::toString()
QString RawSource::toString(const ModelData & model)
{
static const QString trims[] = {
QObject::tr("TrmR"), QObject::tr("TrmE"), QObject::tr("TrmT"), QObject::tr("TrmA")
@@ -292,11 +352,13 @@ QString RawSource::toString()
case SOURCE_TYPE_VIRTUAL_INPUT:
{
QString result = QObject::tr("[I%1]").arg(index+1);
if (model && strlen(model->inputNames[index]) > 0) {
result += QString(model->inputNames[index]);
if (strlen(model.inputNames[index]) > 0) {
result += QString(model.inputNames[index]);
}
return result;
}
case SOURCE_TYPE_LUA_OUTPUT:
return QObject::tr("LUA%1%2").arg(index/16+1).arg(QChar('a'+index%16));
case SOURCE_TYPE_STICK:
return AnalogString(index);
case SOURCE_TYPE_TRIM:
@@ -459,9 +521,14 @@ CSFunctionFamily LogicalSwitchData::getFunctionFamily()
return LS_FAMILY_VCOMP;
}
bool LogicalSwitchData::isDeltaFunction()
unsigned int LogicalSwitchData::getRangeFlags()
{
return (func == LS_FN_DPOS || func == LS_FN_DAPOS);
if (func == LS_FN_DPOS)
return RANGE_DELTA_FUNCTION;
else if (func == LS_FN_DAPOS)
return RANGE_DELTA_ABS_FUNCTION;
else
return 0;
}
QString LogicalSwitchData::funcToString()
@@ -514,7 +581,7 @@ QString LogicalSwitchData::funcToString()
}
}
QString LogicalSwitchData::toString(const ModelData & model)
QString LogicalSwitchData::toString(const ModelData & model, const GeneralSettings & settings)
{
QString result = "";
@@ -535,11 +602,11 @@ QString LogicalSwitchData::toString(const ModelData & model)
result += QObject::tr("Timer(%1, %2)").arg(ValToTim(val1)).arg(ValToTim(val2));
break;
case LS_FAMILY_VOFS: {
RawSource source = RawSource(val1, &model);
RawSourceRange range = source.getRange();
RawSource source = RawSource(val1);
RawSourceRange range = source.getRange(model, settings);
QString res;
if (val1)
res += source.toString();
res += source.toString(model);
else
res += "0";
res.remove(" ");
@@ -550,7 +617,7 @@ QString LogicalSwitchData::toString(const ModelData & model)
else if (func == LS_FN_DPOS) result = "d(" + res + ")";
result += res;
if (func == LS_FN_APOS || func == LS_FN_VPOS || isDeltaFunction())
if (func == LS_FN_APOS || func == LS_FN_VPOS || func == LS_FN_DPOS || func == LS_FN_DAPOS)
result += " &gt; ";
else if (func == LS_FN_ANEG || func == LS_FN_VNEG)
result += " &lt; ";
@@ -582,7 +649,7 @@ QString LogicalSwitchData::toString(const ModelData & model)
case LS_FAMILY_VCOMP:
if (val1)
result += RawSource(val1).toString();
result += RawSource(val1).toString(model);
else
result += "0";
switch (func) {
@@ -610,7 +677,7 @@ QString LogicalSwitchData::toString(const ModelData & model)
break;
}
if (val2)
result += RawSource(val2).toString();
result += RawSource(val2).toString(model);
else
result += "0";
break;
@@ -720,8 +787,9 @@ QStringList FuncSwData::toStringList()
QString FuncSwData::funcToString()
{
ModelData model;
if (func >= FuncSafetyCh1 && func <= FuncSafetyCh32)
return QObject::tr("Safety %1").arg(RawSource(SOURCE_TYPE_CH, func).toString());
return QObject::tr("Safety %1").arg(RawSource(SOURCE_TYPE_CH, func).toString(model));
else if (func == FuncTrainer)
return QObject::tr("Trainer");
else if (func == FuncTrainerRUD)
@@ -800,7 +868,8 @@ QString FuncSwData::paramToString()
}
else if ((func==FuncVolume)|| (func==FuncPlayValue)) {
RawSource item(param);
return item.toString();
ModelData model;
return item.toString(model);
}
else if ((func==FuncPlayPrompt) || (func==FuncPlayBoth)) {
if ( GetCurrentFirmware()->getCapability(VoicesAsNumbers)) {
@@ -810,15 +879,16 @@ QString FuncSwData::paramToString()
}
}
else if ((func>FuncBackgroundMusicPause) && (func<FuncCount)) {
ModelData model;
switch (adjustMode) {
case 0:
return QObject::tr("Value ")+QString("%1").arg(param);
break;
case 1:
return RawSource(param).toString();
return RawSource(param).toString(model);
break;
case 2:
return RawSource(param).toString();
return RawSource(param).toString(model);
break;
case 3:
if (param==0) {
@@ -998,6 +1068,29 @@ int GeneralSettings::getDefaultChannel(unsigned int stick) const
return -1;
}
float FrSkyChannelData::getRatio() const
{
if (type==0 || type==1 || type==2)
return float(ratio << multiplier) / 10.0;
else
return ratio << multiplier;
}
RawSourceRange FrSkyChannelData::getRange() const
{
RawSourceRange result;
float ratio = getRatio();
if (type==0 || type==1 || type==2)
result.decimals = 2;
else
result.decimals = 0;
result.step = ratio / 255;
result.min = offset * result.step;
result.max = ratio + result.min;
result.unit = QObject::tr("V");
return result;
}
void FrSkyData::clear()
{
memset(this, 0, sizeof(FrSkyData));
@@ -1020,13 +1113,6 @@ ModelData::ModelData(const ModelData & src)
ModelData & ModelData::operator = (const ModelData & src)
{
memcpy(this, &src, sizeof(ModelData));
for (int i=0; i<C9X_MAX_MIXERS; i++)
mixData[i].srcRaw.model = this;
for (int i=0; i<C9X_MAX_EXPOS; i++)
expoData[i].srcRaw.model = this;
swashRingData.collectiveSource.model = this;
return *this;
}
@@ -1137,7 +1223,7 @@ void ModelData::setDefaultInputs(const GeneralSettings & settings)
expo->mode = INPUT_MODE_BOTH;
expo->srcRaw = settings.getDefaultSource(i);
expo->weight = 100;
strncpy(inputNames[i], expo->srcRaw.toString().toLatin1().constData(), sizeof(inputNames[i])-1);
strncpy(inputNames[i], expo->srcRaw.toString(*this).toLatin1().constData(), sizeof(inputNames[i])-1);
}
}
}
@@ -1153,7 +1239,7 @@ void ModelData::setDefaultMixes(const GeneralSettings & settings)
mix->destCh = i+1;
mix->weight = 100;
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
mix->srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i, this);
mix->srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i);
}
else {
mix->srcRaw = RawSource(SOURCE_TYPE_STICK, i);
@@ -1299,8 +1385,8 @@ void UnregisterEepromInterfaces()
}
QList<FirmwareInterface *> firmwares;
FirmwareVariant default_firmware_variant;
FirmwareVariant current_firmware_variant;
FirmwareInterface * default_firmware_variant;
FirmwareInterface * current_firmware_variant;
void UnregisterFirmwares()
{
@@ -1364,15 +1450,11 @@ QString getBoardName(BoardEnum board)
}
}
FirmwareVariant GetFirmwareVariant(QString id)
FirmwareInterface * GetFirmware(QString id)
{
FirmwareVariant result;
foreach(FirmwareInterface * firmware, firmwares) {
if (id.contains(firmware->getId()+"-") || (!id.contains("-") && id.contains(firmware->getId()))) {
result.id = id;
result.firmware = firmware;
result.variant = firmware->getVariant(id);
FirmwareInterface * result = firmware->getFirmwareVariant(id);
if (result) {
return result;
}
}
@@ -1386,20 +1468,21 @@ void FirmwareInterface::addOption(const char *option, QString tooltip, uint32_t
addOptions(options);
}
unsigned int FirmwareInterface::getVariant(const QString & variantId)
unsigned int FirmwareInterface::getVariantNumber()
{
unsigned int variant = variantBase;
QStringList options = variantId.mid(id.length()+1).split("-", QString::SkipEmptyParts);
unsigned int result = 0;
const FirmwareInterface * base = getFirmwareBase();
QStringList options = id.mid(base->getId().length()+1).split("-", QString::SkipEmptyParts);
foreach(QString option, options) {
foreach(QList<Option> group, opts) {
foreach(QList<Option> group, base->opts) {
foreach(Option opt, group) {
if (opt.name == option) {
variant += opt.variant;
result += opt.variant;
}
}
}
}
return variant;
return result;
}
void FirmwareInterface::addLanguage(const char *lang)
+151 -178
View File
@@ -252,7 +252,7 @@ enum TelemetrySource {
TELEMETRY_SOURCE_ACCZ,
TELEMETRY_SOURCE_HDG,
TELEMETRY_SOURCE_VERTICAL_SPEED,
TELEMETRY_SOURCE_ASPD,
TELEMETRY_SOURCE_ASPEED,
TELEMETRY_SOURCE_DTE,
TELEMETRY_SOURCE_A1_MIN,
TELEMETRY_SOURCE_A2_MIN,
@@ -286,7 +286,7 @@ enum TelemetrySource {
enum RawSourceType {
SOURCE_TYPE_NONE,
SOURCE_TYPE_VIRTUAL_INPUT,
SOURCE_TYPE_LUA_INPUT,
SOURCE_TYPE_LUA_OUTPUT,
SOURCE_TYPE_STICK, // and POTS
SOURCE_TYPE_ROTARY_ENCODER,
SOURCE_TYPE_TRIM,
@@ -327,29 +327,31 @@ class RawSourceRange
double max;
double step;
double offset;
QString unit;
};
#define RANGE_SINGLE_PRECISION 1
#define RANGE_DELTA_FUNCTION 2
#define RANGE_DELTA_ABS_FUNCTION 4
class GeneralSettings;
class RawSource {
public:
RawSource():
type(SOURCE_TYPE_NONE),
index(0),
model(NULL)
index(0)
{
}
RawSource(int value, const ModelData * model=NULL):
RawSource(int value):
type(RawSourceType(abs(value)/65536)),
index(value >= 0 ? abs(value)%65536 : -(abs(value)%65536)),
model(model)
index(value >= 0 ? abs(value)%65536 : -(abs(value)%65536))
{
}
RawSource(RawSourceType type, int index=0, const ModelData * model=NULL):
RawSource(RawSourceType type, int index=0):
type(type),
index(index),
model(model)
index(index)
{
}
@@ -358,9 +360,9 @@ class RawSource {
return index >= 0 ? (type * 65536 + index) : -(type * 65536 - index);
}
QString toString();
QString toString(const ModelData & model);
RawSourceRange getRange(bool singleprec=false);
RawSourceRange getRange(const ModelData & model, const GeneralSettings & settings, unsigned int flags=0) const;
bool operator == ( const RawSource & other) {
return (this->type == other.type) && (this->index == other.index);
@@ -377,7 +379,6 @@ class RawSource {
RawSourceType type;
int index;
const ModelData * model;
};
enum RawSwitchType {
@@ -715,9 +716,9 @@ class LogicalSwitchData { // Logical Switches data
int andsw;
void clear() { memset(this, 0, sizeof(LogicalSwitchData)); }
CSFunctionFamily getFunctionFamily();
bool isDeltaFunction();
unsigned int getRangeFlags();
QString funcToString();
QString toString(const ModelData & model);
QString toString(const ModelData & model, const GeneralSettings & settings);
};
enum AssignFunc {
@@ -820,14 +821,8 @@ class FrSkyChannelData {
unsigned int multiplier;
FrSkyAlarmData alarms[2];
float getRatio() const
{
if (type==0 || type==1 || type==2)
return float(ratio << multiplier) / 10.0;
else
return ratio << multiplier;
}
float getRatio() const;
RawSourceRange getRange() const;
void clear() { memset(this, 0, sizeof(FrSkyChannelData)); }
};
@@ -888,7 +883,6 @@ class FrSkyData {
FrSkyData() { clear(); }
FrSkyChannelData channels[4];
unsigned int usrProto;
unsigned int imperial;
int blades;
unsigned int voltsSource;
bool altitudeDisplayed;
@@ -1061,99 +1055,103 @@ class RadioData {
// TODO rename FlightPhase to FlightMode
enum Capability {
FlightModes,
FlightModesName,
FlightModesHaveFades,
Mixes,
Timers,
TimeDivisions,
CustomFunctions,
VoicesAsNumbers,
VoicesMaxLength,
ModelVoice,
MultiLangVoice,
ModelImage,
Pots,
Switches,
SwitchesPositions,
LogicalSwitches,
CustomAndSwitches,
HasNegAndSwitches,
LogicalSwitchesExt,
RotaryEncoders,
Outputs,
ChannelsName,
ExtraInputs,
ExtendedTrims,
NumCurves,
NumCurvePoints,
OffsetWeight,
Simulation,
SoundMod,
SoundPitch,
MaxVolume,
EepromBackup,
Haptic,
HasBeeper,
ModelTrainerEnable,
Timer2ThrTrig,
HasExpoNames,
HasNoExpo,
HasMixerNames,
HasChNames,
HasCvNames,
HasPxxCountry,
HasPPMStart,
HasGeneralUnits,
HasFAIMode,
OptrexDisplay,
PPMExtCtrl,
PPMFrameLength,
DSM2Indexes,
Telemetry,
TelemetryUnits,
TelemetryBars,
Gvars,
GvarsInCS,
GvarsAreNamed,
GvarsFlightModes,
GvarsName,
NoTelemetryProtocol,
TelemetryCustomScreens,
TelemetryCustomScreensFieldsPerLine,
TelemetryTimeshift,
TelemetryMaxMultiplier,
HasAltitudeSel,
HasVario,
HasVarioSink,
HasVariants,
HasFailsafe,
HasSoundMixer,
NumModules,
PPMCenter,
SYMLimits,
HasCurrentCalibration,
HasVolume,
HasBrightness,
PerModelTimers,
SlowScale,
SlowRange,
PermTimers,
HasSDLogs,
CSFunc,
LCDWidth,
GetThrSwitch,
HasDisplayText,
VirtualInputs,
TrainerInputs,
LuaInputs,
LimitsPer1000,
EnhancedCurves,
HasFasOffset,
HasMahPersistent,
MultiposPots,
MultiposPotsPositions,
SimulatorVariant,
FlightModes,
FlightModesName,
FlightModesHaveFades,
Imperial,
Mixes,
Timers,
TimeDivisions,
CustomFunctions,
VoicesAsNumbers,
VoicesMaxLength,
ModelVoice,
MultiLangVoice,
ModelImage,
Pots,
Switches,
SwitchesPositions,
LogicalSwitches,
CustomAndSwitches,
HasNegAndSwitches,
LogicalSwitchesExt,
RotaryEncoders,
Outputs,
ChannelsName,
ExtraInputs,
ExtendedTrims,
NumCurves,
NumCurvePoints,
OffsetWeight,
Simulation,
SoundMod,
SoundPitch,
MaxVolume,
EepromBackup,
Haptic,
HasBeeper,
ModelTrainerEnable,
Timer2ThrTrig,
HasExpoNames,
HasNoExpo,
HasMixerNames,
HasChNames,
HasCvNames,
HasPxxCountry,
HasPPMStart,
HasGeneralUnits,
HasFAIMode,
OptrexDisplay,
PPMExtCtrl,
PPMFrameLength,
DSM2Indexes,
Telemetry,
TelemetryUnits,
TelemetryBars,
Heli,
Gvars,
GvarsInCS,
GvarsAreNamed,
GvarsFlightModes,
GvarsName,
NoTelemetryProtocol,
TelemetryCustomScreens,
TelemetryCustomScreensFieldsPerLine,
TelemetryTimeshift,
TelemetryMaxMultiplier,
HasAltitudeSel,
HasVario,
HasVarioSink,
HasFailsafe,
HasSoundMixer,
NumModules,
PPMCenter,
SYMLimits,
HasCurrentCalibration,
HasVolume,
HasBrightness,
PerModelTimers,
SlowScale,
SlowRange,
PermTimers,
HasSDLogs,
CSFunc,
LCDWidth,
GetThrSwitch,
HasDisplayText,
VirtualInputs,
TrainerInputs,
LuaScripts,
LuaInputsPerScript,
LuaOutputsPerScript,
LimitsPer1000,
EnhancedCurves,
HasFasOffset,
HasMahPersistent,
MultiposPots,
MultiposPotsPositions,
SimulatorVariant,
MavlinkTelemetry,
};
class SimulatorInterface;
@@ -1309,27 +1307,45 @@ struct Option {
class FirmwareInterface {
public:
FirmwareInterface(const QString & id, const QString & name, const BoardEnum board, EEPROMInterface * eepromInterface):
id(id),
name(name),
board(board),
eepromInterface(eepromInterface),
variantBase(0),
base(NULL)
{
}
FirmwareInterface(FirmwareInterface * base, const QString & id, const QString & name, const BoardEnum board, EEPROMInterface * eepromInterface):
id(id),
name(name),
board(board),
eepromInterface(eepromInterface),
variantBase(0),
base(base)
{
}
virtual ~FirmwareInterface()
{
delete eepromInterface;
}
FirmwareInterface(const QString & id, const QString & name, const BoardEnum board, EEPROMInterface * eepromInterface, bool voice = false):
id(id),
name(name),
board(board),
eepromInterface(eepromInterface),
voice(voice),
variantBase(0)
inline const FirmwareInterface * getFirmwareBase() const
{
return base ? base : this;
}
// TODO needed?
inline void setVariantBase(unsigned int variant)
{
variantBase = variant;
}
unsigned int getVariant(const QString & id);
virtual FirmwareInterface * getFirmwareVariant(const QString & id) { return NULL; }
unsigned int getVariantNumber();
virtual void addLanguage(const char *lang);
@@ -1348,19 +1364,19 @@ class FirmwareInterface {
virtual QString getReleaseNotesUrl() = 0;
virtual QString getFirmwareUrl(QString & id) = 0;
virtual QString getFirmwareUrl() = 0;
inline BoardEnum getBoard()
inline BoardEnum getBoard() const
{
return board;
}
inline QString getName()
inline QString getName() const
{
return name;
}
inline QString getId()
inline QString getId() const
{
return id;
}
@@ -1389,61 +1405,23 @@ class FirmwareInterface {
QString name;
BoardEnum board;
EEPROMInterface * eepromInterface;
public:
bool voice;
protected:
unsigned int variantBase;
FirmwareInterface * base;
private:
FirmwareInterface();
};
class FirmwareVariant
{
public:
FirmwareVariant():
firmware(NULL),
variant(0)
{
}
FirmwareVariant(QString & id, FirmwareInterface * firmware, unsigned int variant):
id(id),
firmware(firmware),
variant(variant)
{
}
QString getFirmwareUrl()
{
if (firmware)
return firmware->getFirmwareUrl(id);
else
return "";
}
QString id;
FirmwareInterface * firmware;
unsigned int variant;
};
extern QList<FirmwareInterface *> firmwares;
extern FirmwareVariant default_firmware_variant;
extern FirmwareVariant current_firmware_variant;
extern FirmwareInterface * default_firmware_variant;
extern FirmwareInterface * current_firmware_variant;
FirmwareVariant GetFirmwareVariant(QString id);
inline FirmwareInterface * GetFirmware(QString id)
{
return GetFirmwareVariant(id).firmware;
}
FirmwareInterface * GetFirmware(QString id);
inline FirmwareInterface * GetCurrentFirmware()
{
return current_firmware_variant.firmware;
return current_firmware_variant;
}
inline EEPROMInterface * GetEepromInterface()
@@ -1451,11 +1429,6 @@ inline EEPROMInterface * GetEepromInterface()
return GetCurrentFirmware()->getEepromInterface();
}
inline unsigned int GetCurrentFirmwareVariant()
{
return current_firmware_variant.variant;
}
void UnregisterEepromInterfaces();
inline int divRoundClosest(const int n, const int d)
@@ -468,7 +468,6 @@ t_Er9xModelData::operator ModelData ()
c9x.frsky = frsky;
c9x.frsky.usrProto=FrSkyUsrProto;
c9x.frsky.imperial=FrSkyImperial;
c9x.frsky.FrSkyGpsAlt=FrSkyGpsAlt;
return c9x;
}
@@ -596,7 +596,6 @@ t_Ersky9xModelData_v10::operator ModelData ()
c9x.frsky = frsky;
c9x.frsky.usrProto=FrSkyUsrProto;
c9x.frsky.imperial=FrSkyImperial;
c9x.frsky.FrSkyGpsAlt=FrSkyGpsAlt;
return c9x;
}
@@ -715,7 +714,6 @@ t_Ersky9xModelData_v11::operator ModelData ()
c9x.frsky = frsky;
c9x.frsky.usrProto=FrSkyUsrProto;
c9x.frsky.imperial=FrSkyImperial;
c9x.frsky.FrSkyGpsAlt=FrSkyGpsAlt;
// for (int i=0; i<8; i++) {
// c9x.frskyalarms[i].frskyAlarmLimit=frskyAlarms.alarmData[i].frskyAlarmLimit;
@@ -842,7 +842,6 @@ t_Open9xFrSkyData_v204::operator FrSkyData ()
c9x.channels[0] = channels[0];
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
c9x.imperial = imperial;
c9x.blades = blades+2;
c9x.screens[0].type = 1;
for (int i=0; i<4; i++)
@@ -856,7 +855,6 @@ t_Open9xFrSkyData_v205::operator FrSkyData ()
c9x.channels[0] = channels[0];
c9x.channels[1] = channels[1];
c9x.usrProto = usrProto;
c9x.imperial = imperial;
c9x.blades = blades+2;
c9x.screens[0].type = 1;
for (int i=0; i<4; i++)
@@ -46,6 +46,8 @@
#define GPS
#define FAI_CHOICE
#define FRSKY_STICKS
#define DSM2
#define DSM2_PPM
#define EEPROM_VARIANT SIMU_M128_VARIANTS
#define GAUGES
@@ -109,6 +109,7 @@ namespace Open9xSky9x {
#include "radio/src/targets/sky9x/sdcard_driver.cpp"
#include "radio/src/targets/sky9x/coproc_driver.cpp"
#include "radio/src/targets/sky9x/haptic_driver.cpp"
#include "radio/src/targets/sky9x/second_serial_driver.cpp"
#include "radio/src/haptic.cpp"
#include "radio/src/translations/tts_cz.cpp"
#include "radio/src/translations/tts_de.cpp"
@@ -187,9 +187,9 @@ class SourcesConversionTable: public ConversionTable {
if (IS_TARANIS(board) && version >= 216) {
for (int i=0; i<32; i++)
addConversion(RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i), val++);
for (int i=0; i<7; i++) {
for (int j=0; j<6; j++) {
addConversion(RawSource(SOURCE_TYPE_LUA_INPUT, i*16+j), val++);
for (int i=0; i<GetCurrentFirmware()->getCapability(LuaScripts); i++) {
for (int j=0; j<GetCurrentFirmware()->getCapability(LuaOutputsPerScript); j++) {
addConversion(RawSource(SOURCE_TYPE_LUA_OUTPUT, i*16+j), val++);
}
}
}
@@ -260,7 +260,7 @@ class SourcesConversionTable: public ConversionTable {
for (int i=0; i<TELEMETRY_SOURCE_ACC; i++) {
if (version < 216) {
if (i==TELEMETRY_SOURCE_TX_TIME || i==TELEMETRY_SOURCE_SWR || i==TELEMETRY_SOURCE_A3 || i==TELEMETRY_SOURCE_A4 || i==TELEMETRY_SOURCE_ASPD || i==TELEMETRY_SOURCE_DTE || i==TELEMETRY_SOURCE_CELL_MIN || i==TELEMETRY_SOURCE_CELLS_MIN || i==TELEMETRY_SOURCE_VFAS_MIN)
if (i==TELEMETRY_SOURCE_TX_TIME || i==TELEMETRY_SOURCE_SWR || i==TELEMETRY_SOURCE_A3 || i==TELEMETRY_SOURCE_A4 || i==TELEMETRY_SOURCE_ASPEED || i==TELEMETRY_SOURCE_DTE || i==TELEMETRY_SOURCE_CELL_MIN || i==TELEMETRY_SOURCE_CELLS_MIN || i==TELEMETRY_SOURCE_VFAS_MIN)
continue;
}
if (!IS_ARM(board)) {
@@ -443,7 +443,7 @@ class TelemetrySourcesConversionTable: public ConversionTable {
addConversion(1+TELEMETRY_SOURCE_HDG, val++);
addConversion(1+TELEMETRY_SOURCE_VERTICAL_SPEED, val++);
if (version >= 216) {
addConversion(1+TELEMETRY_SOURCE_ASPD, val++);
addConversion(1+TELEMETRY_SOURCE_ASPEED, val++);
addConversion(1+TELEMETRY_SOURCE_DTE, val++);
}
if (IS_ARM(board) && version >= 216) {
@@ -1009,7 +1009,7 @@ class MixField: public TransformedField {
if (IS_TARANIS(board) && version < 216) {
if (mix.srcRaw.type == SOURCE_TYPE_STICK && mix.srcRaw.index < NUM_STICKS) {
if (!mix.noExpo) {
mix.srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, mix.srcRaw.index, model);
mix.srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, mix.srcRaw.index);
}
}
}
@@ -1548,7 +1548,7 @@ class LogicalSwitchField: public TransformedField {
else if (csw.func != LS_FN_OFF) {
sourcesConversionTable->importValue((uint8_t)v1, csw.val1);
csw.val2 = v2;
RawSource val1(csw.val1, model);
RawSource val1(csw.val1);
if (IS_ARM(board) && version < 216 && val1.type == SOURCE_TYPE_TELEMETRY) {
switch (val1.index) {
case TELEMETRY_SOURCE_TIMER1:
@@ -2424,7 +2424,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
if (IS_ARM(board))
internalField.Append(new UnsignedField<3>(modelData.telemetryProtocol));
else
internalField.Append(new ConversionField< SignedField<3> >(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 protocol")));
internalField.Append(new BoolField<1>(modelData.thrTrim));
@@ -2559,7 +2559,7 @@ OpenTxModelData::OpenTxModelData(ModelData & modelData, BoardEnum board, unsigne
if (IS_TARANIS(board) && version >= 216) {
for (int i=0; i<7; i++) {
ScriptData & script = modelData.scriptData[i];
internalField.Append(new ZCharField<10>(script.filename));
internalField.Append(new CharField<10>(script.filename));
internalField.Append(new ZCharField<10>(script.name));
for (int j=0; j<10; j++) {
internalField.Append(new SignedField<8>(script.inputs[j]));
@@ -422,7 +422,7 @@ int OpenTxEepromInterface::getSize(ModelData &model)
uint8_t tmp[EESIZE_RLC_MAX];
efile->EeFsCreate(tmp, EESIZE_RLC_MAX, board);
OpenTxModelData open9xModel(model, board, 255, GetCurrentFirmwareVariant());
OpenTxModelData open9xModel(model, board, 255, GetCurrentFirmware()->getVariantNumber());
QByteArray eeprom;
open9xModel.Export(eeprom);
@@ -441,7 +441,7 @@ int OpenTxEepromInterface::getSize(GeneralSettings &settings)
uint8_t tmp[EESIZE_RLC_MAX];
efile->EeFsCreate(tmp, EESIZE_RLC_MAX, board);
OpenTxGeneralData open9xGeneral(settings, board, 255, GetCurrentFirmwareVariant());
OpenTxGeneralData open9xGeneral(settings, board, 255, GetCurrentFirmware()->getVariantNumber());
// open9xGeneral.Dump();
QByteArray eeprom;
@@ -453,9 +453,26 @@ int OpenTxEepromInterface::getSize(GeneralSettings &settings)
return efile->size(0);
}
FirmwareInterface * OpenTxFirmware::getFirmwareVariant(const QString & id)
{
if (id.contains(getId()+"-") || (!id.contains("-") && id.contains(getId()))) {
FirmwareInterface * result = new OpenTxFirmware(id, this);
// TODO result.variant = firmware->getVariant(id);
return result;
}
else {
return NULL;
}
}
int OpenTxFirmware::getCapability(const Capability capability)
{
switch (capability) {
case Imperial:
if (IS_ARM(board))
return 0;
else
return id.contains("imperial") ? 1 : 0;
case ModelImage:
if (IS_TARANIS(board))
return 1;
@@ -491,8 +508,18 @@ int OpenTxFirmware::getCapability(const Capability capability)
return 5;
case FlightModesHaveFades:
return 1;
case Heli:
if (IS_TARANIS(board))
return id.contains("noheli") ? 0 : 1;
else
return id.contains("heli") ? 1 : 0;
case Gvars:
return IS_ARM(board) ? 9 : 5;
if (IS_TARANIS(board))
return id.contains("nogvars") ? 0 : 9;
else if (id.contains("gvars"))
return IS_ARM(board) ? 9 : 5;
else
return 0;
case FlightModesName:
return (IS_TARANIS(board) ? 10 : 6);
case GvarsName:
@@ -563,7 +590,7 @@ int OpenTxFirmware::getCapability(const Capability capability)
case SoundPitch:
return 1;
case Haptic:
return 1;
return (board == BOARD_GRUVIN9X || IS_SKY9X(board) || board == BOARD_TARANIS_PLUS || id.contains("haptic"));
case ModelTrainerEnable:
if (IS_ARM(board))
return 1;
@@ -619,11 +646,6 @@ int OpenTxFirmware::getCapability(const Capability capability)
return 1;
case HasVarioSink:
return ((board == BOARD_GRUVIN9X || IS_ARM(board)) ? true : false);
case HasVariants:
if (IS_TARANIS(board))
return 0;
else
return 1;
case HasFailsafe:
return (IS_ARM(board) ? 32 : 0);
case NumModules:
@@ -656,7 +678,12 @@ int OpenTxFirmware::getCapability(const Capability capability)
return IS_TARANIS(board) ? 32 : 0;
case TrainerInputs:
return IS_ARM(board) ? 16 : 8;
case LuaInputs:
case LuaScripts:
return IS_TARANIS(board) ? 7 : 0;
case LuaInputsPerScript:
return IS_TARANIS(board) ? 10 : 0;
case LuaOutputsPerScript:
return IS_TARANIS(board) ? 6 : 0;
case LimitsPer1000:
case EnhancedCurves:
return IS_TARANIS(board);
@@ -675,6 +702,8 @@ int OpenTxFirmware::getCapability(const Capability capability)
return SIMU_M128_VARIANTS;
else
return 0;
case MavlinkTelemetry:
return id.contains("mavlink") ? 1 : 0;
default:
return 0;
}
@@ -912,7 +941,7 @@ bool OpenTxEepromInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, in
return true;
}
QString OpenTxFirmware::getFirmwareUrl(QString & id)
QString OpenTxFirmware::getFirmwareUrl()
{
QString url = OPENTX_FIRMWARE_DOWNLOADS;
switch (board) {
@@ -978,7 +1007,7 @@ void registerOpenTxFirmwares()
Option fai_options[] = { { "faichoice", QObject::tr("Possibility to enable FAI MODE at field") }, { "faimode", QObject::tr("FAI MODE always enabled") }, { NULL } };
/* 9x board */
openTx = new OpenTxFirmware("opentx-9x", QObject::tr("OpenTX for 9X board"), BOARD_STOCK, false);
openTx = new OpenTxFirmware("opentx-9x", QObject::tr("OpenTX for 9X board"), BOARD_STOCK);
openTx->addOptions(ext_options);
openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
@@ -1016,7 +1045,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(openTx);
/* 9x board with M128 chip */
openTx = new OpenTxFirmware("opentx-9x128", QObject::tr("OpenTX for M128 / 9X board"), BOARD_M128, false);
openTx = new OpenTxFirmware("opentx-9x128", QObject::tr("OpenTX for M128 / 9X board"), BOARD_M128);
openTx->addOptions(ext_options);
openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
@@ -1048,7 +1077,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(openTx);
/* 9XR board */
openTx = new OpenTxFirmware("opentx-9xr", QObject::tr("OpenTX for 9XR"), BOARD_STOCK, false);
openTx = new OpenTxFirmware("opentx-9xr", QObject::tr("OpenTX for 9XR"), BOARD_STOCK);
openTx->addOptions(extr_options);
openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
@@ -1083,7 +1112,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(openTx);
/* 9XR board with M128 chip */
openTx = new OpenTxFirmware("opentx-9xr128", QObject::tr("OpenTX for 9XR with M128 chip"), BOARD_M128, false);
openTx = new OpenTxFirmware("opentx-9xr128", QObject::tr("OpenTX for 9XR with M128 chip"), BOARD_M128);
openTx->addOptions(extr_options);
openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
@@ -1113,8 +1142,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(openTx);
/* Gruvin9x board */
openTx = new OpenTxFirmware("opentx-gruvin9x", QObject::tr("OpenTX for Gruvin9x board / 9X"), BOARD_GRUVIN9X, false);
openTx->setVariantBase(FRSKY_VARIANT);
openTx = new OpenTxFirmware("opentx-gruvin9x", QObject::tr("OpenTX for Gruvin9x board / 9X"), BOARD_GRUVIN9X);
openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support"));
openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
openTx->addOption("nofp", QObject::tr("No flight modes"));
@@ -1143,8 +1171,7 @@ void registerOpenTxFirmwares()
#ifndef __APPLE__
/* SKY9X board */
openTx = new OpenTxFirmware("opentx-sky9x", QObject::tr("OpenTX for Sky9x board / 9X"), BOARD_SKY9X, true);
openTx->setVariantBase(FRSKY_VARIANT);
openTx = new OpenTxFirmware("opentx-sky9x", QObject::tr("OpenTX for Sky9x board / 9X"), BOARD_SKY9X);
openTx->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
openTx->addOption("nofp", QObject::tr("No flight modes"));
@@ -1167,8 +1194,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(openTx);
/* 9XR-Pro */
openTx = new OpenTxFirmware("opentx-9xrpro", QObject::tr("OpenTX for 9XR-PRO"), BOARD_9XRPRO, true);
openTx->setVariantBase(FRSKY_VARIANT);
openTx = new OpenTxFirmware("opentx-9xrpro", QObject::tr("OpenTX for 9XR-PRO"), BOARD_9XRPRO);
openTx->addOption("heli", QObject::tr("Enable HELI menu and cyclic mix support"));
openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu"));
openTx->addOption("nofp", QObject::tr("No flight modes"));
@@ -1192,7 +1218,7 @@ void registerOpenTxFirmwares()
#endif
/* Taranis board */
openTx = new OpenTxFirmware("opentx-taranis", QObject::tr("OpenTX for FrSky Taranis"), BOARD_TARANIS, true);
openTx = new OpenTxFirmware("opentx-taranis", QObject::tr("OpenTX for FrSky Taranis"), BOARD_TARANIS);
openTx->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
openTx->addOption("nogvars", QObject::tr("Disable Global variables"));
openTx->addOption("haptic", QObject::tr("Haptic module installed"));
@@ -1203,7 +1229,7 @@ void registerOpenTxFirmwares()
firmwares.push_back(openTx);
/* Taranis Plus board */
openTx = new OpenTxFirmware("opentx-taranisplus", QObject::tr("OpenTX for FrSky Taranis Plus"), BOARD_TARANIS_PLUS, true);
openTx = new OpenTxFirmware("opentx-taranisplus", QObject::tr("OpenTX for FrSky Taranis Plus"), BOARD_TARANIS_PLUS);
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"));
@@ -1212,7 +1238,7 @@ void registerOpenTxFirmwares()
openTx->addOptions(fai_options);
firmwares.push_back(openTx);
default_firmware_variant = GetFirmwareVariant("opentx-9x-heli-templates-en");
default_firmware_variant = GetFirmware("opentx-9x-heli-templates-en");
current_firmware_variant = default_firmware_variant;
}
@@ -80,8 +80,13 @@ class OpenTxEepromInterface : public EEPROMInterface
class OpenTxFirmware: public FirmwareInterface {
public:
OpenTxFirmware(const QString & id, const QString & name, const BoardEnum board, bool voice = false):
FirmwareInterface(id, name, board, new OpenTxEepromInterface(board), voice)
OpenTxFirmware(const QString & id, OpenTxFirmware * parent):
FirmwareInterface(parent, id, parent->getName(), parent->getBoard(), parent->eepromInterface)
{
}
OpenTxFirmware(const QString & id, const QString & name, const BoardEnum board):
FirmwareInterface(id, name, board, new OpenTxEepromInterface(board))
{
addLanguage("en");
addLanguage("fr");
@@ -105,12 +110,14 @@ class OpenTxFirmware: public FirmwareInterface {
addTTSLanguage("es");
addTTSLanguage("hu");
}
virtual FirmwareInterface * getFirmwareVariant(const QString & id);
virtual QString getStampUrl();
virtual QString getReleaseNotesUrl();
virtual QString getFirmwareUrl(QString & id);
virtual QString getFirmwareUrl();
virtual int getCapability(const Capability);
@@ -118,7 +125,6 @@ class OpenTxFirmware: public FirmwareInterface {
virtual SimulatorInterface * getSimulator();
};
void registerOpenTxFirmwares();
@@ -2,4 +2,3 @@
#define DATE_STR "@DATE@"
#define TIME_STR "@TIME@"
#define VERS_STR "@C9X_VERSION@"
#define MOD_STR "FH"
+6
View File
@@ -14,6 +14,12 @@ FirmwarePreferencesDialog::FirmwarePreferencesDialog(QWidget *parent) :
ui->setupUi(this);
setWindowIcon(CompanionIcon("fwpreferences.png"));
initSettings();
foreach(const char *lang, GetCurrentFirmware()->getFirmwareBase()->ttslanguages) {
ui->voiceCombo->addItem(lang);
if (current_firmware_variant->getId().contains(QString("-tts%1").arg(lang)))
ui->voiceCombo->setCurrentIndex(ui->voiceCombo->count() - 1);
}
}
FirmwarePreferencesDialog::~FirmwarePreferencesDialog()
-50
View File
@@ -81,56 +81,6 @@
<string>Set voice language.
May be different from firmware language</string>
</property>
<item>
<property name="text">
<string>en</string>
</property>
</item>
<item>
<property name="text">
<string>cz</string>
</property>
</item>
<item>
<property name="text">
<string>de</string>
</property>
</item>
<item>
<property name="text">
<string>es</string>
</property>
</item>
<item>
<property name="text">
<string>fi</string>
</property>
</item>
<item>
<property name="text">
<string>fr</string>
</property>
</item>
<item>
<property name="text">
<string>it</string>
</property>
</item>
<item>
<property name="text">
<string>pl</string>
</property>
</item>
<item>
<property name="text">
<string>pt</string>
</property>
</item>
<item>
<property name="text">
<string>se</string>
</property>
</item>
</widget>
</item>
<item row="7" column="5">
+11 -10
View File
@@ -83,26 +83,26 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
switchDefPosEditLock=true;
populateBacklightCB(ui->backlightswCB, g_eeGeneral.backlightMode);
bool voice = current_firmware_variant.id.contains("voice");
if (!GetCurrentFirmware()->getCapability(MultiLangVoice)) {
ui->VoiceLang_label->hide();
ui->voiceLang_CB->hide();
}
else {
voiceLangEditLock=true;
voiceLangEditLock = true;
populateVoiceLangCB(ui->voiceLang_CB, g_eeGeneral.ttsLanguage);
voiceLangEditLock=false;
voiceLangEditLock = false;
}
bool mavlink = current_firmware_variant.id.contains("mavlink");
if (!mavlink) {
if (!GetCurrentFirmware()->getCapability(MavlinkTelemetry)) {
ui->mavbaud_CB->hide();
ui->mavbaud_label->hide();
}
else {
mavbaudEditLock=true;
mavbaudEditLock = true;
ui->mavbaud_CB->setCurrentIndex(g_eeGeneral.mavbaud);
populateVoiceLangCB(ui->voiceLang_CB, g_eeGeneral.ttsLanguage);
mavbaudEditLock=false;
// TODO why ??? populateVoiceLangCB(ui->voiceLang_CB, g_eeGeneral.ttsLanguage);
mavbaudEditLock = false;
}
if (!GetCurrentFirmware()->getCapability(HasSoundMixer)) {
@@ -120,7 +120,8 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->varioPMax_SB->hide();
ui->varioR0_label->hide();
ui->varioR0_SB->hide();
} else {
}
else {
ui->beepVolume_SL->setValue(g_eeGeneral.beepVolume);
ui->varioVolume_SL->setValue(g_eeGeneral.varioVolume);
ui->bgVolume_SL->setValue(g_eeGeneral.backgroundVolume);
@@ -167,7 +168,7 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
ui->displayTypeCB->setDisabled(true);
ui->displayTypeCB->hide();
}
if (!GetCurrentFirmware()->getCapability(HasVolume) && !voice) {
if (!GetCurrentFirmware()->getCapability(HasVolume)) {
ui->volume_SB->hide();
ui->volume_SB->setDisabled(true);
ui->label_volume->hide();
+37 -77
View File
@@ -72,7 +72,7 @@ QString getInputStr(ModelData & model, int index)
}
}
else {
result = RawSource(SOURCE_TYPE_STICK, index).toString();
result = RawSource(SOURCE_TYPE_STICK, index).toString(model);
}
return result;
@@ -140,20 +140,6 @@ void populatePhasesCB(QComboBox *b, int value)
b->setCurrentIndex(value + GetCurrentFirmware()->getCapability(FlightModes));
}
bool gvarsEnabled()
{
int gvars=0;
if (GetCurrentFirmware()->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1;
}
}
else {
gvars=1;
}
return gvars;
}
GVarGroup::GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightCB, int & weight, const int deflt, const int mini, const int maxi, const unsigned int flags):
QObject(),
weightGV(weightGV),
@@ -165,14 +151,14 @@ GVarGroup::GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightC
{
lock = true;
if (gvarsEnabled()) {
if (GetCurrentFirmware()->getCapability(Gvars)) {
populateGVCB(weightCB, weight);
connect(weightGV, SIGNAL(stateChanged(int)), this, SLOT(gvarCBChanged(int)));
connect(weightCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
}
else {
weightGV->hide();
if (weight > maxi || weight < -mini) {
if (weight > maxi || weight < mini) {
weight = deflt;
}
}
@@ -363,36 +349,6 @@ void populateBacklightCB(QComboBox *b, const uint8_t value)
}
}
void populateAndSwitchCB(QComboBox *b, const RawSwitch & value)
{
GeneralSettings fakeSettings;
if (IS_ARM(GetEepromInterface()->getBoard())) {
populateSwitchCB(b, value, fakeSettings);
}
else {
RawSwitch item;
b->clear();
item = RawSwitch(SWITCH_TYPE_NONE);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
for (int i=1; i<=GetCurrentFirmware()->getCapability(SwitchesPositions); i++) {
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
}
for (int i=1; i<=6; i++) {
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
}
}
}
void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, unsigned long attr)
{
RawSwitch item;
@@ -523,8 +479,7 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettin
void populateGVCB(QComboBox *b, int value)
{
int selected=0;
int nullitem;
bool selected = false;
b->clear();
@@ -534,29 +489,22 @@ void populateGVCB(QComboBox *b, int value)
b->addItem(QObject::tr("-GV%1").arg(-i), gval);
if (value == gval) {
b->setCurrentIndex(b->count()-1);
selected=1;
selected = true;
}
}
b->addItem("---", 0);
nullitem=b->count()-1;
if (value == 0) {
b->setCurrentIndex(b->count()-1);
selected=1;
}
for (int i=1; i<=pgvars; i++) {
int16_t gval = (int16_t)(10000+i);
b->addItem(QObject::tr("GV%1").arg(i), gval);
if (value == gval) {
b->setCurrentIndex(b->count()-1);
selected=1;
selected = true;
}
}
if (selected==0)
b->setCurrentIndex(nullitem);
if (!selected) {
b->setCurrentIndex(pgvars);
}
}
void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData & model, unsigned int flags)
@@ -567,16 +515,27 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
if (flags & POPULATE_SOURCES) {
item = RawSource(SOURCE_TYPE_NONE);
b->addItem(item.toString(), item.toValue());
b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
if (flags & POPULATE_SCRIPT_OUTPUTS) {
for (int i=0; i<GetCurrentFirmware()->getCapability(LuaScripts); i++) {
for (int j=0; j<GetCurrentFirmware()->getCapability(LuaOutputsPerScript); j++) {
item = RawSource(SOURCE_TYPE_LUA_OUTPUT, i*16+j);
b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
}
}
if (flags & POPULATE_VIRTUAL_INPUTS) {
int virtualInputs = GetCurrentFirmware()->getCapability(VirtualInputs);
for (int i=0; i<virtualInputs; i++) {
if (model.isInputValid(i)) {
item = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i, &model);
b->addItem(item.toString(), item.toValue());
item = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, i);
b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
}
@@ -585,12 +544,12 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
if (flags & POPULATE_SOURCES) {
for (int i=0; i<4+GetCurrentFirmware()->getCapability(Pots); i++) {
item = RawSource(SOURCE_TYPE_STICK, i);
b->addItem(item.toString(), item.toValue());
b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
for (int i=0; i<GetCurrentFirmware()->getCapability(RotaryEncoders); i++) {
item = RawSource(SOURCE_TYPE_ROTARY_ENCODER, i);
b->addItem(item.toString(), item.toValue());
b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
}
@@ -598,27 +557,27 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
if (flags & POPULATE_TRIMS) {
for (int i=0; i<4; i++) {
item = RawSource(SOURCE_TYPE_TRIM, i);
b->addItem(item.toString(), item.toValue());
b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
}
if (flags & POPULATE_SOURCES) {
item = RawSource(SOURCE_TYPE_MAX);
b->addItem(item.toString(), item.toValue());
b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
if (flags & POPULATE_SWITCHES) {
for (int i=0; i<GetCurrentFirmware()->getCapability(Switches); i++) {
item = RawSource(SOURCE_TYPE_SWITCH, i);
b->addItem(item.toString(), item.toValue());
b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
for (int i=0; i<GetCurrentFirmware()->getCapability(LogicalSwitches); i++) {
item = RawSource(SOURCE_TYPE_CUSTOM_SWITCH, i);
b->addItem(item.toString(), item.toValue());
b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
}
@@ -626,19 +585,19 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
if (flags & POPULATE_SOURCES) {
for (int i=0; i<NUM_CYC; i++) {
item = RawSource(SOURCE_TYPE_CYC, i);
b->addItem(item.toString(), item.toValue());
b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
for (int i=0; i<GetCurrentFirmware()->getCapability(TrainerInputs); i++) {
item = RawSource(SOURCE_TYPE_PPM, i);
b->addItem(item.toString(), item.toValue());
b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
for (int i=0; i<GetCurrentFirmware()->getCapability(Outputs); i++) {
item = RawSource(SOURCE_TYPE_CH, i);
b->addItem(item.toString(), item.toValue());
b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
}
@@ -648,7 +607,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
if (i==TELEMETRY_SOURCE_RSSI_TX && IS_TARANIS(GetCurrentFirmware()->getBoard()))
continue;
item = RawSource(SOURCE_TYPE_TELEMETRY, i);
b->addItem(item.toString(), item.toValue());
b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
}
@@ -657,7 +616,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
if (i==TELEMETRY_SOURCE_RSSI_TX && IS_TARANIS(GetCurrentFirmware()->getBoard()))
continue;
item = RawSource(SOURCE_TYPE_TELEMETRY, i);
b->addItem(item.toString(), item.toValue());
b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
}
@@ -665,7 +624,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const ModelData &
if (flags & POPULATE_GVARS) {
for (int i=0; i<GetCurrentFirmware()->getCapability(Gvars); i++) {
item = RawSource(SOURCE_TYPE_GVAR, i);
b->addItem(item.toString(), item.toValue());
b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
}
@@ -791,7 +750,8 @@ QString getFrSkyMeasure(int units)
QString getFrSkySrc(int index)
{
return RawSource(SOURCE_TYPE_TELEMETRY, index-1).toString();
ModelData model;
return RawSource(SOURCE_TYPE_TELEMETRY, index-1).toString(model);
}
QString getTrimInc(ModelData * g_model)
+8 -10
View File
@@ -37,8 +37,6 @@ class CompanionIcon: public QIcon {
CompanionIcon(QString baseimage);
};
bool gvarsEnabled();
class GVarGroup : public QObject {
Q_OBJECT
@@ -84,7 +82,6 @@ class CurveGroup : public QObject {
#define POPULATE_ONOFF 0x01
#define POPULATE_TIMER_MODES 0x02
void populateAndSwitchCB(QComboBox *b, const RawSwitch & value);
void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, unsigned long attr=0);
void populatePhasesCB(QComboBox *b, int value);
@@ -92,13 +89,14 @@ void populateGvarUseCB(QComboBox *b, unsigned int phase);
QString getProtocolStr(const int proto);
QString getPhasesStr(unsigned int phases, ModelData & model);
#define POPULATE_SOURCES 1
#define POPULATE_TRIMS 2
#define POPULATE_SWITCHES 4
#define POPULATE_GVARS 8
#define POPULATE_TELEMETRY 16
#define POPULATE_TELEMETRYEXT 32
#define POPULATE_VIRTUAL_INPUTS 64
#define POPULATE_SOURCES (1<<0)
#define POPULATE_TRIMS (1<<1)
#define POPULATE_SWITCHES (1<<2)
#define POPULATE_GVARS (1<<3)
#define POPULATE_TELEMETRY (1<<4)
#define POPULATE_TELEMETRYEXT (1<<5)
#define POPULATE_VIRTUAL_INPUTS (1<<6)
#define POPULATE_SCRIPT_OUTPUTS (1<<7)
#define GVARS_VARIANT 0x0001
#define FRSKY_VARIANT 0x0002
Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

+2 -2
View File
@@ -350,9 +350,9 @@ void logsDialog::on_mapsButton_clicked() {
geFile.close();
QStringList parameters;
#ifdef __APPLE__
gePath = "/usr/bin/open";
parameters << "-a";
parameters << "Google\\ Earth";
parameters << gePath;
gePath = "/usr/bin/open";
#endif
parameters << geFilename;
QProcess *process = new QProcess(this);
+11 -11
View File
@@ -230,7 +230,7 @@ void MainWindow::checkForUpdates()
}
else if (checkForUpdatesState & CHECK_FIRMWARE) {
checkForUpdatesState -= CHECK_FIRMWARE;
QString stamp = GetFirmware(current_firmware_variant.id)->getStampUrl();
QString stamp = GetCurrentFirmware()->getStampUrl();
if (!stamp.isEmpty()) {
networkManager = new QNetworkAccessManager(this);
connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(checkForFirmwareUpdateFinished(QNetworkReply*)));
@@ -362,7 +362,7 @@ void MainWindow::firmwareDownloadAccepted()
return;
}
file.close();
g.fwRev.set(current_firmware_variant.id, version2index(firmwareVersionString));
g.fwRev.set(current_firmware_variant->getId(), version2index(firmwareVersionString));
if (g.profile[g.id()].burnFirmware()) {
int ret = QMessageBox::question(this, "Companion", tr("Do you want to write the firmware to the radio now ?"), QMessageBox::Yes | QMessageBox::No);
if (ret == QMessageBox::Yes) {
@@ -397,7 +397,7 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
download = true;
}
else {
int currentVersion = g.fwRev.get(current_firmware_variant.id);
int currentVersion = g.fwRev.get(current_firmware_variant->getId());
QString currentVersionString = index2version(currentVersion);
QMessageBox msgBox;
@@ -406,10 +406,10 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
if (currentVersion == 0) {
QString rn = GetFirmware(current_firmware_variant.id)->getReleaseNotesUrl();
QString rn = GetCurrentFirmware()->getReleaseNotesUrl();
QAbstractButton *rnButton = NULL;
msgBox.setWindowTitle("Companion");
msgBox.setInformativeText(tr("Firmware %1 does not seem to have ever been downloaded.\nRelease %2 is available.\nDo you want to download it now?").arg(current_firmware_variant.id).arg(versionString));
msgBox.setInformativeText(tr("Firmware %1 does not seem to have ever been downloaded.\nRelease %2 is available.\nDo you want to download it now?").arg(current_firmware_variant->getId()).arg(versionString));
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
msgBox.addButton(trUtf8("No"), QMessageBox::NoRole);
if (!rn.isEmpty()) {
@@ -435,10 +435,10 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
}
}
else if (version > currentVersion) {
QString rn = GetFirmware(current_firmware_variant.id)->getReleaseNotesUrl();
QString rn = GetCurrentFirmware()->getReleaseNotesUrl();
QAbstractButton *rnButton = NULL;
msgBox.setText("Companion");
msgBox.setInformativeText(tr("A new version of %1 firmware is available:\n - current is %2\n - newer is %3\n\nDo you want to download it now ?").arg(current_firmware_variant.id).arg(currentVersionString).arg(versionString));
msgBox.setInformativeText(tr("A new version of %1 firmware is available:\n - current is %2\n - newer is %3\n\nDo you want to download it now ?").arg(current_firmware_variant->getId()).arg(currentVersionString).arg(versionString));
QAbstractButton *YesButton = msgBox.addButton(trUtf8("Yes"), QMessageBox::YesRole);
msgBox.addButton(trUtf8("No"), QMessageBox::NoRole);
if (!rn.isEmpty()) {
@@ -476,7 +476,7 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
if (ignore) {
int res = QMessageBox::question(this, "Companion", tr("Ignore this release %1?").arg(versionString), QMessageBox::Yes | QMessageBox::No);
if (res==QMessageBox::Yes) {
g.fwRev.set(current_firmware_variant.id, version);
g.fwRev.set(current_firmware_variant->getId(), version);
}
}
else if (download == true) {
@@ -493,10 +493,10 @@ void MainWindow::checkForFirmwareUpdateFinished(QNetworkReply * reply)
void MainWindow::startFirmwareDownload()
{
QString url = current_firmware_variant.getFirmwareUrl();
QString url = current_firmware_variant->getFirmwareUrl();
qDebug() << url;
QString ext = url.mid(url.lastIndexOf("."));
QString defaultFilename = g.flashDir() + "/" + current_firmware_variant.id;
QString defaultFilename = g.flashDir() + "/" + current_firmware_variant->getId();
if (g.profile[g.id()].renameFwFiles()) {
defaultFilename += "-" + firmwareVersionString;
}
@@ -633,7 +633,7 @@ void MainWindow::loadProfile() //TODO Load all variables - Also HW!
g.id( profnum );
// TODO Get rid of this global variable - The profile.firmware is the real source
current_firmware_variant = GetFirmwareVariant(g.profile[g.id()].fwType());
current_firmware_variant = GetFirmware(g.profile[g.id()].fwType());
foreach (QMdiSubWindow *window, mdiArea->subWindowList()) {
MdiChild *mdiChild = qobject_cast<MdiChild *>(window->widget());
+1 -1
View File
@@ -401,7 +401,7 @@ bool MdiChild::saveFile(const QString &fileName, bool setCurrent)
int eeprom_size = 0;
if (fileType != FILE_TYPE_XML) {
eeprom_size = GetEepromInterface()->save(eeprom, radioData, GetCurrentFirmwareVariant(), 0/*last version*/);
eeprom_size = GetEepromInterface()->save(eeprom, radioData, GetCurrentFirmware()->getVariantNumber(), 0/*last version*/);
if (!eeprom_size) {
QMessageBox::warning(this, tr("Error"),tr("Cannot write file %1:\n%2.").arg(myFile).arg(file.errorString()));
return false;
+4
View File
@@ -196,6 +196,10 @@ void Channels::refreshExtendedLimits()
minDSB->setMinimum(-model.getChannelsMax());
maxDSB->setMaximum(model.getChannelsMax());
//reset any limit that is bigger than current maximum (dependent on extended limits setting)
if ( model.limitData[i].min < -model.getChannelsMax() ) model.limitData[i].min = -model.getChannelsMax();
if ( model.limitData[i].max > +model.getChannelsMax() ) model.limitData[i].max = +model.getChannelsMax();
}
emit modified();
}
+10 -18
View File
@@ -266,7 +266,11 @@ void CustomFunctionsPanel::playMusic()
else {
phononCurrent = index;
clickObject->clear();
#ifdef __APPLE__
clickObject->setCurrentSource(QUrl("file://"+track));
#else
clickObject->setCurrentSource(QUrl(track));
#endif
clickObject->play();
playBT[index]->setIcon(CompanionIcon("stop.png"));
}
@@ -586,24 +590,12 @@ void CustomFunctionsPanel::populateFuncCB(QComboBox *b, unsigned int value)
b->clear();
for (unsigned int i=0; i<FuncCount; i++) {
b->addItem(FuncSwData(AssignFunc(i)).funcToString());
if (!firmware->getCapability(HasVolume)) {
if (i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
}
}
if ((i==FuncPlayHaptic) && !firmware->getCapability(Haptic)) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
}
if ((i==FuncPlayBoth) && !firmware->getCapability(HasBeeper)) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
}
if ((i==FuncLogs) && !firmware->getCapability(HasSDLogs)) {
if (((i==FuncVolume || i==FuncBackgroundMusic || i==FuncBackgroundMusicPause) && !firmware->getCapability(HasVolume)) ||
((i==FuncPlayHaptic) && !firmware->getCapability(Haptic)) ||
((i==FuncPlayBoth) && !firmware->getCapability(HasBeeper)) ||
((i==FuncLogs) && !firmware->getCapability(HasSDLogs)) ||
((i>=FuncAdjustGV1 && i<=FuncAdjustGVLast) && !firmware->getCapability(Gvars))
) {
QModelIndex index = b->model()->index(i, 0);
QVariant v(0);
b->model()->setData(index, v, Qt::UserRole - 1);
+2 -2
View File
@@ -122,7 +122,7 @@ ExpoDialog::~ExpoDialog()
void ExpoDialog::updateScale()
{
if (firmware->getCapability(VirtualInputs) && ed->srcRaw.type == SOURCE_TYPE_TELEMETRY) {
RawSourceRange range = ed->srcRaw.getRange();
RawSourceRange range = ed->srcRaw.getRange(model, generalSettings);
ui->scaleLabel->show();
ui->scale->show();
ui->scale->setDecimals(range.decimals);
@@ -146,7 +146,7 @@ void ExpoDialog::valuesChanged()
updateScale();
}
RawSourceRange range = srcRaw.getRange();
RawSourceRange range = srcRaw.getRange(model, generalSettings);
ed->scale = round(float(ui->scale->value()) / range.step);
ed->carryTrim = 1 - ui->trimCB->currentIndex();
ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
+1 -2
View File
@@ -11,8 +11,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
phaseIdx(phaseIdx),
phase(model.flightModeData[phaseIdx]),
reCount(firmware->getCapability(RotaryEncoders)),
gvCount(((!firmware->getCapability(HasVariants)) || (GetCurrentFirmwareVariant() & GVARS_VARIANT)) ?
firmware->getCapability(Gvars) : 0)
gvCount(firmware->getCapability(Gvars))
{
ui->setupUi(this);
+2 -2
View File
@@ -165,12 +165,12 @@ QString InputsPanel::getInputText(int dest, bool * new_ch)
if (md->offset) str += " " + tr("Offset(%1)").arg(getGVarString(md->offset));
if (firmware->getCapability(VirtualInputs)) {
str += " " + tr("Source(%1)").arg(md->srcRaw.toString());
str += " " + tr("Source(%1)").arg(md->srcRaw.toString(model));
if (md->carryTrim>0) {
str += " " + tr("NoTrim");
}
else if (md->carryTrim<0) {
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString();
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString(model);
}
}
+77 -66
View File
@@ -53,7 +53,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
cswitchValue[i]->setAccelerated(true);
cswitchValue[i]->setDecimals(0);
cswitchValue[i]->setProperty("index", i);
connect(cswitchValue[i], SIGNAL(editingFinished()), this, SLOT(edited()));
connect(cswitchValue[i], SIGNAL(valueChanged(double)), this, SLOT(edited()));
gridLayout->addWidget(cswitchValue[i], i+1, 2);
cswitchValue[i]->setVisible(false);
@@ -70,7 +70,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
cswitchOffset[i]->setMinimum(-125);
cswitchOffset[i]->setAccelerated(true);
cswitchOffset[i]->setDecimals(0);
connect(cswitchOffset[i], SIGNAL(editingFinished()), this, SLOT(edited()));
connect(cswitchOffset[i], SIGNAL(valueChanged(double)), this, SLOT(edited()));
cswitchOffset[i]->setVisible(false);
v2Layout->addWidget(cswitchOffset[i]);
cswitchOffset2[i] = new QDoubleSpinBox(this);
@@ -79,7 +79,7 @@ LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model,
cswitchOffset2[i]->setMinimum(-125);
cswitchOffset2[i]->setAccelerated(true);
cswitchOffset2[i]->setDecimals(0);
connect(cswitchOffset2[i], SIGNAL(editingFinished()), this, SLOT(edited()));
connect(cswitchOffset2[i], SIGNAL(valueChanged(double)), this, SLOT(edited()));
cswitchOffset2[i]->setVisible(false);
v2Layout->addWidget(cswitchOffset2[i]);
cswitchTOffset[i] = new QTimeEdit(this);
@@ -138,14 +138,9 @@ void LogicalSwitchesPanel::v1Edited(int value)
int i = sender()->property("index").toInt();
model.customSw[i].val1 = cswitchSource1[i]->itemData(value).toInt();
if (model.customSw[i].getFunctionFamily() == LS_FAMILY_VOFS) {
RawSource source = RawSource(model.customSw[i].val1, &model);
RawSourceRange range = source.getRange();
if (model.customSw[i].isDeltaFunction()) {
model.customSw[i].val2 = (cswitchOffset[i]->value() / range.step);
}
else {
model.customSw[i].val2 = (cswitchOffset[i]->value() - range.offset) / range.step/* TODO - source.getRawOffset(model)*/;
}
RawSource source = RawSource(model.customSw[i].val1);
RawSourceRange range = source.getRange(model, generalSettings, model.customSw[i].getRangeFlags());
model.customSw[i].val2 = (cswitchOffset[i]->value() - range.offset) / range.step;
setSwitchWidgetVisibility(i);
}
emit modified();
@@ -191,7 +186,6 @@ void LogicalSwitchesPanel::edited()
int i = sender()->property("index").toInt();
int newFunc = csw[i]->itemData(csw[i]->currentIndex()).toInt();
bool chAr = (model.customSw[i].getFunctionFamily() != LogicalSwitchData(newFunc).getFunctionFamily());
bool chDelta = (model.customSw[i].isDeltaFunction() ^ LogicalSwitchData(newFunc).isDeltaFunction());
model.customSw[i].func = newFunc;
if (chAr) {
if (model.customSw[i].getFunctionFamily() == LS_FAMILY_TIMER) {
@@ -210,47 +204,43 @@ void LogicalSwitchesPanel::edited()
model.customSw[i].andsw = 0;
setSwitchWidgetVisibility(i);
}
if (chDelta) {
model.customSw[i].val2 = 0;
setSwitchWidgetVisibility(i);
}
RawSource source;
switch (model.customSw[i].getFunctionFamily())
{
case LS_FAMILY_VOFS:
{
source = RawSource(model.customSw[i].val1, &model);
RawSourceRange range = source.getRange();
int value = source.isTimeBased() ? QTimeS(cswitchTOffset[i]->time()).seconds() : cswitchOffset[i]->value();
if (model.customSw[i].isDeltaFunction()) {
/*TODO: is this delta function value set correctly*/
model.customSw[i].val2 = (value/range.step);
value=model.customSw[i].val2*range.step;
}
else {
model.customSw[i].val2 = round((value-range.offset)/range.step);;
value= model.customSw[i].val2*range.step + range.offset;
}
if (source.isTimeBased()) cswitchTOffset[i]->setTime(QTimeS(value));
else cswitchOffset[i]->setValue(value);
source = RawSource(model.customSw[i].val1);
RawSourceRange range = source.getRange(model, generalSettings, model.customSw[i].getRangeFlags());
double value = source.isTimeBased() ? QTimeS(cswitchTOffset[i]->time()).seconds() : cswitchOffset[i]->value();
model.customSw[i].val2 = round((value-range.offset)/range.step);;
value = model.customSw[i].val2*range.step + range.offset;
if (source.isTimeBased())
cswitchTOffset[i]->setTime(QTimeS(round(value)));
else
cswitchOffset[i]->setValue(value);
break;
}
case LS_FAMILY_TIMER:
model.customSw[i].val1 = TimToVal(cswitchValue[i]->value());
model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value());
updateTimerParam(cswitchValue[i], model.customSw[i].val1);
updateTimerParam(cswitchOffset[i], model.customSw[i].val2);
updateTimerParam(cswitchValue[i], model.customSw[i].val1, 0.1);
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, 0.1);
break;
case LS_FAMILY_STAY:
if (sender() == cswitchOffset[i]) {
model.customSw[i].val2 = TimToVal(cswitchOffset[i]->value());
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true);
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, 0.0);
}
else {
model.customSw[i].val3 = TimToVal(cswitchOffset2[i]->value()) - model.customSw[i].val2;
}
updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, true);
updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, cswitchOffset[i]->value());
if (model.customSw[i].val3 == 0) {
cswitchOffset2[i]->setSuffix(tr("(infinite)"));
cswitchOffset2[i]->clear();
}
break;
default:
break;
@@ -260,11 +250,11 @@ void LogicalSwitchesPanel::edited()
}
}
void LogicalSwitchesPanel::updateTimerParam(QDoubleSpinBox *sb, int timer, bool allowZero)
void LogicalSwitchesPanel::updateTimerParam(QDoubleSpinBox *sb, int timer, double minimum)
{
sb->setVisible(true);
sb->setDecimals(1);
sb->setMinimum(allowZero ? 0.0 : 0.1);
sb->setMinimum(minimum);
sb->setMaximum(175);
float value = ValToTim(timer);
if (value>=60)
@@ -274,6 +264,7 @@ void LogicalSwitchesPanel::updateTimerParam(QDoubleSpinBox *sb, int timer, bool
else
sb->setSingleStep(0.1);
sb->setValue(value);
sb->setSuffix("");
}
#define SOURCE1_VISIBLE 0x1
@@ -288,45 +279,33 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
lock = true;
unsigned int mask = 0;
RawSource source = RawSource(model.customSw[i].val1, &model);
RawSourceRange range = source.getRange();
RawSource source = RawSource(model.customSw[i].val1);
RawSourceRange range = source.getRange(model, generalSettings, model.customSw[i].getRangeFlags());
switch (model.customSw[i].getFunctionFamily())
{
case LS_FAMILY_VOFS:
mask |= SOURCE1_VISIBLE;
populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
populateSourceCB(cswitchSource1[i], source, model, POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
cswitchOffset[i]->setDecimals(range.decimals);
cswitchOffset[i]->setSingleStep(range.step);
if (source.isTimeBased()) {
mask |= VALUE_TO_VISIBLE;
int maxTime;
int value;
if (model.customSw[i].isDeltaFunction()) {
/*TODO: is this delta function value set correctly*/
maxTime = range.step*127;
value = range.step*model.customSw[i].val2;
} else {
maxTime = range.max;
value = range.step*(model.customSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset;
}
int maxTime = round(range.max);
int value = round(range.step*model.customSw[i].val2 + range.offset);
cswitchTOffset[i]->setMaximumTime(QTimeS(maxTime));
cswitchTOffset[i]->setDisplayFormat((maxTime>=3600)?"hh:mm:ss":"mm:ss");
cswitchTOffset[i]->setTime(QTimeS(value));
}
else {
mask |= VALUE2_VISIBLE;
if (model.customSw[i].isDeltaFunction()) {
/*TODO: is this delta function value set correctly*/
cswitchOffset[i]->setMinimum(range.step*-127);
cswitchOffset[i]->setMaximum(range.step*127);
cswitchOffset[i]->setValue(range.step*model.customSw[i].val2);
}
else {
cswitchOffset[i]->setMinimum(range.min);
cswitchOffset[i]->setMaximum(range.max);
cswitchOffset[i]->setValue(range.step*(model.customSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset);
}
if (range.unit.isEmpty())
cswitchOffset[i]->setSuffix("");
else
cswitchOffset[i]->setSuffix(" " + range.unit);
cswitchOffset[i]->setMinimum(range.min);
cswitchOffset[i]->setMaximum(range.max);
cswitchOffset[i]->setValue(range.step*(model.customSw[i].val2/* TODO+source.getRawOffset(model)*/)+range.offset);
}
break;
case LS_FAMILY_VBOOL:
@@ -338,18 +317,22 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
case LS_FAMILY_STAY:
mask |= SOURCE1_VISIBLE | VALUE2_VISIBLE | VALUE3_VISIBLE;
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1), generalSettings);
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true);
updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, true);
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, 0.0);
updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, cswitchOffset[i]->value());
if (model.customSw[i].val3 == 0) {
cswitchOffset2[i]->setSuffix(tr("(infinite)"));
cswitchOffset2[i]->clear();
}
break;
case LS_FAMILY_VCOMP:
mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), model, POPULATE_SOURCES | POPULATE_TRIMS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), model, POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), model, POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (firmware->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
break;
case LS_FAMILY_TIMER:
mask |= VALUE1_VISIBLE | VALUE2_VISIBLE;
updateTimerParam(cswitchValue[i], model.customSw[i].val1);
updateTimerParam(cswitchOffset[i], model.customSw[i].val2);
updateTimerParam(cswitchValue[i], model.customSw[i].val1, 0.1);
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, 0.1);
break;
}
@@ -406,6 +389,34 @@ void LogicalSwitchesPanel::populateCSWCB(QComboBox *b, int value)
b->setMaxVisibleItems(10);
}
void LogicalSwitchesPanel::populateAndSwitchCB(QComboBox *b, const RawSwitch & value)
{
if (IS_ARM(firmware->getBoard())) {
populateSwitchCB(b, value, generalSettings, POPULATE_ONOFF);
}
else {
RawSwitch item;
b->clear();
item = RawSwitch(SWITCH_TYPE_NONE);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
for (int i=1; i<=firmware->getCapability(SwitchesPositions); i++) {
item = RawSwitch(SWITCH_TYPE_SWITCH, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
}
for (int i=1; i<=6; i++) {
item = RawSwitch(SWITCH_TYPE_VIRTUAL, i);
b->addItem(item.toString(), item.toValue());
if (item == value) b->setCurrentIndex(b->count()-1);
}
}
}
void LogicalSwitchesPanel::updateLine(int i)
{
lock = true;
+2 -1
View File
@@ -44,8 +44,9 @@ class LogicalSwitchesPanel : public ModelPanel
int selectedSwitch;
void populateCSWCB(QComboBox *b, int value);
void populateAndSwitchCB(QComboBox *b, const RawSwitch & value);
void updateLine(int index);
void updateTimerParam(QDoubleSpinBox *sb, int timer, bool allowZero=false);
void updateTimerParam(QDoubleSpinBox *sb, int timer, double minimum=0);
};
+2 -2
View File
@@ -19,7 +19,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
this->setWindowTitle(tr("DEST -> CH%1").arg(md->destCh));
populateSourceCB(ui->sourceCB, md->srcRaw, model, POPULATE_SOURCES | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
populateSourceCB(ui->sourceCB, md->srcRaw, model, POPULATE_SOURCES | POPULATE_SCRIPT_OUTPUTS | POPULATE_VIRTUAL_INPUTS | POPULATE_SWITCHES | POPULATE_TRIMS);
ui->sourceCB->removeItem(0);
int limit = firmware->getCapability(OffsetWeight);
@@ -142,7 +142,7 @@ void MixerDialog::valuesChanged()
if (!lock) {
lock = true;
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
md->srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt(), &model);
md->srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt());
if (firmware->getCapability(HasNoExpo)) {
bool drVisible = (md->srcRaw.type == SOURCE_TYPE_STICK && md->srcRaw.index < NUM_STICKS);
ui->MixDR_CB->setEnabled(drVisible);
+4 -8
View File
@@ -170,16 +170,12 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
default: str += " "; break;
};
//set mixer src model if it is unset (srcRaw needs this to generate proper toString() for input source type)
if (md->srcRaw.model == 0)
md->srcRaw.model = &model;
//highlight source if needed
// highlight source if needed
if ( (md->srcRaw.type == SOURCE_TYPE_CH) && (md->srcRaw.index+1 == (int)highlightedSource) ) {
str += " <b>" + Qt::escape(md->srcRaw.toString()) + "</b>";
str += " <b>" + Qt::escape(md->srcRaw.toString(model)) + "</b>";
}
else {
str += " " + Qt::escape(md->srcRaw.toString());
str += " " + Qt::escape(md->srcRaw.toString(model));
}
str += " " + Qt::escape(tr("Weight(%1)").arg(getGVarString(md->weight, true)));
@@ -192,7 +188,7 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
}
if (md->carryTrim>0) str += " " + Qt::escape(tr("NoTrim"));
else if (md->carryTrim<0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString();
else if (md->carryTrim<0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString(model);
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)));
+2 -1
View File
@@ -28,7 +28,8 @@ ModelEdit::ModelEdit(QWidget * parent, RadioData & radioData, int modelId, Firmw
ui->pushButton->setIcon(CompanionIcon("simulate.png"));
SetupPanel * setupPanel = new SetupPanel(this, model, generalSettings, firmware);
addTab(setupPanel, tr("Setup"));
addTab(new HeliPanel(this, model, generalSettings, firmware), tr("Heli"));
if (firmware->getCapability(Heli))
addTab(new HeliPanel(this, model, generalSettings, firmware), tr("Heli"));
addTab(new FlightModesPanel(this, model, generalSettings, firmware), tr("Flight Modes"));
addTab(new InputsPanel(this, model, generalSettings, firmware), tr("Inputs"));
addTab(new MixesPanel(this, model, generalSettings, firmware), tr("Mixes"));
+22 -34
View File
@@ -168,7 +168,8 @@ void TelemetryAnalog::on_RatioSB_editingFinished()
if (calib<0) {
if (calib<((ratio*-128)/255)) {
analog.offset=-128;
} else {
}
else {
analog.offset=round(calib*255/ratio);
}
}
@@ -294,7 +295,6 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model,
for (int c=0; c<firmware->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
fieldsCB[l][c] = new QComboBox(this);
fieldsCB[l][c]->setProperty("index", c + (l<<8));
populateTelemetrySourceCB(fieldsCB[l][c], screen.body.lines[l].source[c], l==3, model.frsky.usrProto);
ui->screenNumsLayout->addWidget(fieldsCB[l][c], l, c, 1, 1);
connect(fieldsCB[l][c], SIGNAL(currentIndexChanged(int)), this, SLOT(customFieldChanged(int)));
}
@@ -303,7 +303,6 @@ TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model,
for (int l=0; l<4; l++) {
barsCB[l] = new QComboBox(this);
barsCB[l]->setProperty("index", l);
populateTelemetrySourceCB(barsCB[l], screen.body.bars[l].source, false, model.frsky.usrProto);
connect(barsCB[l], SIGNAL(currentIndexChanged(int)), this, SLOT(barSourceChanged(int)));
ui->screenBarsLayout->addWidget(barsCB[l], l, 0, 1, 1);
@@ -336,10 +335,10 @@ void TelemetryCustomScreen::populateTelemetrySourceCB(QComboBox *b, unsigned int
int telem_hub[] = {0,0,0,0,0,0,0,0,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,0,0,2,2,1,1,1,1,1,1};
b->clear();
b->addItem(RawSource(SOURCE_TYPE_NONE, 0).toString());
b->addItem(RawSource(SOURCE_TYPE_NONE, 0).toString(model));
for (unsigned int i = 0; i < (last ? TELEMETRY_SOURCES_STATUS_COUNT : TELEMETRY_SOURCES_DISPLAY_COUNT); i++) {
b->addItem(RawSource(SOURCE_TYPE_TELEMETRY, i).toString());
b->addItem(RawSource(SOURCE_TYPE_TELEMETRY, i).toString(model));
if (!firmware->isTelemetrySourceAvailable(i)) {
//disable item
QModelIndex index = b->model()->index(i+1, 0);
@@ -375,6 +374,16 @@ void TelemetryCustomScreen::update()
ui->screenNums->setVisible(screen.type == 0);
ui->screenBars->setVisible(screen.type != 0);
for (int l=0; l<4; l++) {
for (int c=0; c<firmware->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
populateTelemetrySourceCB(fieldsCB[l][c], screen.body.lines[l].source[c], l==3, model.frsky.usrProto);
}
}
for (int l=0; l<4; l++) {
populateTelemetrySourceCB(barsCB[l], screen.body.bars[l].source, false, model.frsky.usrProto);
}
if (screen.type == 0) {
for (int l=0; l<4; l++) {
for (int c=0; c<firmware->getCapability(TelemetryCustomScreensFieldsPerLine); c++) {
@@ -398,8 +407,8 @@ void TelemetryCustomScreen::updateBar(int line)
int index = screen.body.bars[line].source;
barsCB[line]->setCurrentIndex(index);
if (index) {
RawSource source = RawSource(SOURCE_TYPE_TELEMETRY, index-1, &model);
RawSourceRange range = source.getRange(true);
RawSource source = RawSource(SOURCE_TYPE_TELEMETRY, index-1);
RawSourceRange range = source.getRange(model, generalSettings, RANGE_SINGLE_PRECISION);
int max = round((range.max - range.min) / range.step);
if (int(255-screen.body.bars[line].barMax) > max)
screen.body.bars[line].barMax = 255 - max;
@@ -519,6 +528,7 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin
for (int i=0; i<firmware->getCapability(TelemetryCustomScreens); i++) {
TelemetryCustomScreen * tab = new TelemetryCustomScreen(this, model, model.frsky.screens[i], generalSettings, firmware);
ui->customScreens->addTab(tab, tr("Telemetry screen %1").arg(i+1));
telemetryCustomScreens[i] = tab;
}
if (IS_ARM(GetEepromInterface()->getBoard())) {
@@ -606,27 +616,10 @@ void TelemetryPanel::setup()
}
}
if (!(firmware->getCapability(HasAltitudeSel)||firmware->getCapability(HasVario))) {
ui->altimetryGB->hide();
}
ui->altimetryGB->setVisible(firmware->getCapability(HasAltitudeSel) || firmware->getCapability(HasVario)),
ui->frskyProtoCB->setDisabled(firmware->getCapability(NoTelemetryProtocol));
if (firmware->getCapability(NoTelemetryProtocol)) {
ui->frskyProtoCB->setDisabled(true);
}
else {
ui->frskyProtoCB->setEnabled(true);
}
if (!firmware->getCapability(TelemetryUnits)) {
ui->frskyUnitsCB->setDisabled(true);
int index=0;
if (firmware_id.contains("imperial")) {
index=1;
}
ui->frskyUnitsCB->setCurrentIndex(index);
}
if ((firmware->getCapability(Telemetry)&TM_HASWSHH)) {
if (firmware->getCapability(Telemetry) & TM_HASWSHH) {
ui->frskyProtoCB->addItem(tr("Winged Shadow How High"));
}
else {
@@ -660,7 +653,6 @@ void TelemetryPanel::setup()
}
ui->frskyProtoCB->setCurrentIndex(model.frsky.usrProto);
ui->frskyUnitsCB->setCurrentIndex(model.frsky.imperial);
ui->bladesCount->setValue(model.frsky.blades);
populateVoltsSource();
@@ -725,12 +717,6 @@ void TelemetryPanel::onAnalogModified()
emit modified();
}
void TelemetryPanel::on_frskyUnitsCB_currentIndexChanged(int index)
{
model.frsky.imperial = index;
emit modified();
}
void TelemetryPanel::on_bladesCount_editingFinished()
{
model.frsky.blades = ui->bladesCount->value();
@@ -740,6 +726,8 @@ void TelemetryPanel::on_bladesCount_editingFinished()
void TelemetryPanel::on_frskyProtoCB_currentIndexChanged(int index)
{
model.frsky.usrProto = index;
for (int i=0; i<firmware->getCapability(TelemetryCustomScreens); i++)
telemetryCustomScreens[i]->update();
emit modified();
}
+1 -1
View File
@@ -86,7 +86,6 @@ class TelemetryPanel : public ModelPanel
void on_telemetryProtocol_currentIndexChanged(int index);
void onAnalogModified();
void on_frskyProtoCB_currentIndexChanged(int index);
void on_frskyUnitsCB_currentIndexChanged(int index);
void on_bladesCount_editingFinished();
void on_AltitudeToolbar_ChkB_toggled(bool checked);
void on_rssiAlarm1CB_currentIndexChanged(int index);
@@ -106,6 +105,7 @@ class TelemetryPanel : public ModelPanel
private:
Ui::Telemetry *ui;
TelemetryAnalog * analogs[4];
TelemetryCustomScreen * telemetryCustomScreens[4];
void setup();
void telBarUpdate();
+140 -235
View File
@@ -61,7 +61,7 @@
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0">
<item row="1" column="0">
<widget class="QGroupBox" name="A1GB">
<property name="sizePolicy">
@@ -188,221 +188,6 @@
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QGroupBox" name="serialGB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout_34" columnstretch="0,1,1,1">
<property name="horizontalSpacing">
<number>9</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Volt source</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="frskyUnitsCB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Metric</string>
</property>
</item>
<item>
<property name="text">
<string>Imperial</string>
</property>
</item>
</widget>
</item>
<item row="3" column="2">
<widget class="QLabel" name="current_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Current source</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_112">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Protocol</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QUnsignedAutoComboBox" name="frskyCurrentCB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QComboBox" name="frskyProtoCB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>FrSky Sensor Hub</string>
</property>
</item>
</widget>
</item>
<item row="3" column="1">
<widget class="QUnsignedAutoComboBox" name="frskyVoltCB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_113">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Units</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="blades_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Blades</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Serial Protocol</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QDoubleSpinBox" name="bladesCount">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>2.000000000000000</double>
</property>
<property name="maximum">
<double>5.000000000000000</double>
</property>
<property name="value">
<double>2.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QGroupBox" name="A2GB">
<property name="flat">
@@ -738,21 +523,121 @@
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout" rowstretch="0,1">
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0">
<property name="horizontalSpacing">
<number>3</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="1" column="2">
<item row="3" column="1">
<widget class="QUnsignedAutoComboBox" name="frskyVoltCB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Volt source</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QUnsignedAutoComboBox" name="frskyCurrentCB">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="5">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<widget class="QLabel" name="current_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Current source</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QDoubleSpinBox" name="bladesCount">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="minimum">
<double>2.000000000000000</double>
</property>
<property name="maximum">
<double>5.000000000000000</double>
</property>
<property name="value">
<double>2.000000000000000</double>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="blades_label">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Blades</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="mahCount_label">
<property name="text">
<string>mAh count</string>
</property>
</widget>
</item>
<item row="1" column="3">
<item row="2" column="3">
<widget class="QSpinBox" name="mahCount_SB">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -768,7 +653,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="fasOffset_DSB">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@@ -793,7 +678,7 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="fasOffset_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
@@ -806,26 +691,13 @@
</property>
</widget>
</item>
<item row="1" column="4">
<item row="2" column="4">
<widget class="QCheckBox" name="mahCount_ChkB">
<property name="text">
<string>Persistent mAh</string>
</property>
</widget>
</item>
<item row="1" column="5">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
@@ -845,6 +717,39 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Serial Protocol</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="frskyProtoCB">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>FrSky Sensor Hub</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
+29 -39
View File
@@ -21,13 +21,8 @@ PrintDialog::PrintDialog(QWidget *parent, FirmwareInterface * firmware, GeneralS
g_model(gm),
printfilename(filename),
ui(new Ui::PrintDialog),
gvars(gvarsEnabled()),
gvarnum (0)
gvars(firmware->getCapability(Gvars))
{
if (gvars) {
gvarnum=firmware->getCapability(Gvars);
}
ui->setupUi(this);
this->setWindowIcon(CompanionIcon("print.png"));
te = ui->textEdit;
@@ -143,13 +138,13 @@ void PrintDialog::printSetup()
QString PrintDialog::printFlightModes()
{
QString str="";
str.append(QString("<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td colspan=%1><h2>").arg(!gvars ? 8+firmware->getCapability(RotaryEncoders) : 8+gvarnum+firmware->getCapability(RotaryEncoders)));
str.append(QString("<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td colspan=%1><h2>").arg(!gvars ? 8+firmware->getCapability(RotaryEncoders) : 8+gvars+firmware->getCapability(RotaryEncoders)));
str.append(tr("Flight modes"));
str.append("</h2></td></tr><tr><td style=\"border-style:none;\">&nbsp;</td><td colspan=2 align=center><b>");
str.append(tr("Fades")+"</b></td>");
str.append("<td colspan=4 align=center><b>"+tr("Trims")+"</b></td>");
if (gvars) {
str.append(QString("<td colspan=%1 align=center><b>").arg(gvarnum)+tr("Gvars")+"</b></td>");
str.append(QString("<td colspan=%1 align=center><b>").arg(gvars)+tr("Gvars")+"</b></td>");
}
if (firmware->getCapability(RotaryEncoders)) {
str.append(QString("<td colspan=%1 align=center><b>").arg(firmware->getCapability(RotaryEncoders))+tr("Rot.Enc.")+"</b></td>");
@@ -161,10 +156,8 @@ QString PrintDialog::printFlightModes()
GeneralSettings generalSettings = *g_eeGeneral;
str.append(QString("<td align=\"center\" nowrap><b>%1</b></td>").arg(labels[CONVERT_MODE(i+1)-1]));
}
if (gvars) {
for (unsigned int i=0; i<gvarnum; i++) {
str.append(QString("<td align=\"center\" nowrap><b>GV%1</b><br>%2</td>").arg(i+1).arg(g_model->gvars_names[i]));
}
for (unsigned int i=0; i<gvars; i++) {
str.append(QString("<td align=\"center\" nowrap><b>GV%1</b><br>%2</td>").arg(i+1).arg(g_model->gvars_names[i]));
}
for (int i=0; i<firmware->getCapability(RotaryEncoders); i++) {
str.append(QString("<td align=\"center\"><b>RE%1</b></td>").arg((i==0 ? 'A': 'B')));
@@ -183,16 +176,14 @@ QString PrintDialog::printFlightModes()
str.append("<td align=\"right\" ><font size=+1 face='Courier New' color=green>"+tr("FM")+QString("%1</font></td>").arg(pd->trimRef[k]));
}
}
if (gvars) {
for (unsigned int k=0; k<gvarnum; k++) {
if (pd->gvars[k]<=1024) {
str.append(QString("<td align=\"right\"><font size=+1 face='Courier New' color=green>%1").arg(pd->gvars[k])+"</font></td>");
}
else {
int num = pd->gvars[k] - 1025;
if (num>=i) num++;
str.append("<td align=\"right\" ><font size=+1 face='Courier New' color=green>"+tr("FM")+QString("%1</font></td>").arg(num));
}
for (unsigned int k=0; k<gvars; k++) {
if (pd->gvars[k]<=1024) {
str.append(QString("<td align=\"right\"><font size=+1 face='Courier New' color=green>%1").arg(pd->gvars[k])+"</font></td>");
}
else {
int num = pd->gvars[k] - 1025;
if (num>=i) num++;
str.append("<td align=\"right\" ><font size=+1 face='Courier New' color=green>"+tr("FM")+QString("%1</font></td>").arg(num));
}
}
for (int k=0; k<firmware->getCapability(RotaryEncoders); k++) {
@@ -247,9 +238,9 @@ void PrintDialog::printInputs()
str += "&nbsp;" + tr("Weight") + QString("(%1)").arg(getGVarString(ed->weight,true));
if (firmware->getCapability(VirtualInputs)) {
str += " " + tr("Source") + QString("(%1)").arg(ed->srcRaw.toString());
str += " " + tr("Source") + QString("(%1)").arg(ed->srcRaw.toString(*g_model));
if (ed->carryTrim>0) str += " " + tr("NoTrim");
else if (ed->carryTrim<0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(ed->carryTrim)-1)).toString();
else if (ed->carryTrim<0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(ed->carryTrim)-1)).toString(*g_model);
}
if (ed->curve.value) str += " " + Qt::escape(ed->curve.toString());
@@ -330,11 +321,8 @@ void PrintDialog::printMixes()
case (2): str += "&nbsp;R"; break;
default: str += "&nbsp;&nbsp;"; break;
};
//set mixer src model if it is unset (srcRaw needs this to generate proper toString() for input source type)
if (md->srcRaw.model == 0)
md->srcRaw.model = g_model;
str += " " + md->srcRaw.toString();
str += " " + md->srcRaw.toString(*g_model);
str += " " + Qt::escape(tr("Weight(%1)").arg(getGVarString(md->weight, true)));
QString phasesStr = getPhasesStr(md->phases, *g_model);
@@ -344,8 +332,10 @@ void PrintDialog::printMixes()
str += " " + Qt::escape(tr("Switch(%1)").arg(md->swtch.toString()));
}
if (md->carryTrim>0) str += " " + Qt::escape(tr("NoTrim"));
else if (md->carryTrim<0) str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString();
if (md->carryTrim>0)
str += " " + Qt::escape(tr("NoTrim"));
else if (md->carryTrim<0)
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString(*g_model);
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)));
@@ -359,7 +349,8 @@ void PrintDialog::printMixes()
str += Qt::escape(tr(" Delay(u%1:d%2)").arg((double)md->delayUp/scale).arg((double)md->delayDown/scale));
if (md->speedDown || md->speedUp)
str += Qt::escape(tr(" Slow(u%1:d%2)").arg((double)md->speedUp/scale).arg((double)md->speedDown/scale));
if (md->mixWarn) str += Qt::escape(tr(" Warn(%1)").arg(md->mixWarn));
if (md->mixWarn)
str += Qt::escape(tr(" Warn(%1)").arg(md->mixWarn));
if (firmware->getCapability(HasMixerNames)) {
QString MixerName;
MixerName.append(md->name);
@@ -597,7 +588,7 @@ void PrintDialog::printSwitches()
if (g_model->customSw[i].func) {
str.append("<tr>");
str.append("<td width=\"60\"><b>"+tr("L")+QString("%1</b></td>").arg(i+1));
QString tstr = g_model->customSw[i].toString(*g_model);
QString tstr = g_model->customSw[i].toString(*g_model, *g_eeGeneral);
str.append(doTL(tstr,"green"));
str.append("</tr>");
sc++;
@@ -611,20 +602,20 @@ void PrintDialog::printSwitches()
void PrintDialog::printGvars()
{
if (!firmware->getCapability(GvarsFlightModes) && (gvars && firmware->getCapability(Gvars))) {
if (!firmware->getCapability(GvarsFlightModes) && gvars) {
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\">";
str.append("<tr><td><h2>"+tr("Global Variables")+"</h2></td></tr>");
str.append("<tr><td><table border=1 cellspacing=0 cellpadding=3 width=100>");
FlightModeData *pd=&g_model->flightModeData[0];
int width=100/gvarnum;
int width = 100/gvars;
str.append("<tr>");
for(unsigned int i=0; i<gvarnum; i++) {
str.append(QString("<td width=\"%1%\" align=\"center\"><b>").arg(width)+tr("GV")+QString("%1</b></td>").arg(i+1));
for (unsigned int i=0; i<gvars; i++) {
str.append(QString("<td width=\"%1%\" align=\"center\"><b>").arg(width)+tr("GV")+QString("%1</b></td>").arg(i+1));
}
str.append("</tr>");
str.append("<tr>");
for(unsigned int i=0; i<gvarnum; i++) {
str.append(QString("<td width=\"%1%\" align=\"center\"><font color=green>").arg(width)+QString("%1</font></td>").arg(pd->gvars[i]));
for (unsigned int i=0; i<gvars; i++) {
str.append(QString("<td width=\"%1%\" align=\"center\"><font color=green>").arg(width)+QString("%1</font></td>").arg(pd->gvars[i]));
}
str.append("</tr>");
str.append("</table></td></tr></table>");
@@ -763,7 +754,6 @@ void PrintDialog::printFrSky()
str.append("<td width=\"40\" align=\"center\"><b>"+getFrSkyAlarmType(fd->rssiAlarms[1].level)+"</b></td><td width=\"40\" align=\"center\"><b>&lt;</b></td><td width=\"40\" align=\"center\"><b>"+QString::number(fd->rssiAlarms[1].value,10)+"</b></td></tr>");
str.append("<tr><td colspan=10 align=\"Left\" height=\"4px\"></td></tr>");
str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Frsky serial protocol")+"</b></td><td colspan=8 align=\"left\">"+getFrSkyProtocol(fd->usrProto)+"</td></tr>");
str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Units system")+"</b></td><td colspan=8 align=\"left\">"+getFrSkyMeasure(fd->imperial)+"</td></tr>");
str.append("<tr><td colspan=2 align=\"Left\"><b>"+tr("Blades")+"</b></td><td colspan=8 align=\"left\">"+fd->blades+"</td></tr>");
str.append("<tr><td colspan=10 align=\"Left\" height=\"4px\"></td></tr></table>");
}
+1 -2
View File
@@ -28,8 +28,7 @@ public:
private:
Ui::PrintDialog *ui;
bool gvars;
unsigned int gvarnum;
unsigned int gvars;
void printSetup();
QString printFlightModes();
+2 -1
View File
@@ -361,7 +361,8 @@ void SimulatorDialog::initUi(T * ui)
int column = i / (outputs/2);
int line = i % (outputs/2);
QLabel * label = new QLabel(tabWidget);
label->setText(RawSource(SOURCE_TYPE_CH, i).toString());
ModelData model;
label->setText(RawSource(SOURCE_TYPE_CH, i).toString(model));
channelsLayout->addWidget(label, line, column == 0 ? 0 : 5, 1, 1);
QSlider * slider = new QSlider(tabWidget);
+4 -4
View File
@@ -129,28 +129,28 @@ int main(int argc, char *argv[])
if (msgBox.clickedButton() == exitButton)
return 0;
else if (msgBox.clickedButton() == taranisButton) {
current_firmware_variant = GetFirmwareVariant("opentx-taranis-haptic-en");
current_firmware_variant = GetFirmware("opentx-taranis-haptic-en");
fileName = eedir.filePath("eeprom-taranis.bin");
path = fileName.toAscii();
eepromFileName = path.data();
dialog = new SimulatorDialogTaranis();
}
else if (msgBox.clickedButton() == sky9xButton) {
current_firmware_variant = GetFirmwareVariant("opentx-sky9x-heli-templates-ppmca-gvars-symlimits-autosource-autoswitch-battgraph-bluetooth-en");
current_firmware_variant = GetFirmware("opentx-sky9x-heli-templates-ppmca-gvars-symlimits-autosource-autoswitch-battgraph-bluetooth-en");
fileName = eedir.filePath("eeprom-sky9x.bin");
path = fileName.toAscii();
eepromFileName = path.data();
dialog = new SimulatorDialog9X();
}
else if (msgBox.clickedButton() == gruvinButton) {
current_firmware_variant = GetFirmwareVariant("opentx-gruvin9x-heli-templates-sdcard-voice-DSM2PPM-ppmca-gvars-symlimits-autosource-autoswitch-battgraph-ttsen-en");
current_firmware_variant = GetFirmware("opentx-gruvin9x-heli-templates-sdcard-voice-DSM2PPM-ppmca-gvars-symlimits-autosource-autoswitch-battgraph-ttsen-en");
fileName = eedir.filePath("eeprom-gruvin9x.bin");
path = fileName.toAscii();
eepromFileName = path.data();
dialog = new SimulatorDialog9X();
}
else {
current_firmware_variant = GetFirmwareVariant("opentx-9x128-frsky-heli-templates-audio-voice-haptic-DSM2-ppmca-gvars-symlimits-autosource-autoswitch-battgraph-thrtrace-en");
current_firmware_variant = GetFirmware("opentx-9x128-frsky-heli-templates-audio-voice-haptic-DSM2-ppmca-gvars-symlimits-autosource-autoswitch-battgraph-thrtrace-en");
fileName = eedir.filePath("eeprom-9x128.bin");
path = fileName.toAscii();
eepromFileName = path.data();
+10 -10
View File
@@ -6178,7 +6178,7 @@ p, li { white-space: pre-wrap; }
<message>
<location filename="../eeprominterface.cpp" line="272"/>
<source>AirSpeed</source>
<translation>VitA</translation>
<translation>Vitesse Air</translation>
</message>
<message>
<location filename="../eeprominterface.cpp" line="273"/>
@@ -7353,7 +7353,7 @@ p, li { white-space: pre-wrap; }
<message>
<location filename="../eeprominterface.cpp" line="268"/>
<source>Alt</source>
<translation></translation>
<translation>Altitude</translation>
</message>
<message>
<location filename="../eeprominterface.cpp" line="268"/>
@@ -7363,7 +7363,7 @@ p, li { white-space: pre-wrap; }
<message>
<location filename="../eeprominterface.cpp" line="268"/>
<source>Fuel</source>
<translation>Carb</translation>
<translation>Carburant</translation>
</message>
<message>
<location filename="../eeprominterface.cpp" line="269"/>
@@ -7373,17 +7373,17 @@ p, li { white-space: pre-wrap; }
<message>
<location filename="../eeprominterface.cpp" line="269"/>
<source>Dist</source>
<translation></translation>
<translation>Distance</translation>
</message>
<message>
<location filename="../eeprominterface.cpp" line="269"/>
<source>GPS Alt</source>
<translation>Alt GPS</translation>
<translation>Altitude GPS</translation>
</message>
<message>
<location filename="../eeprominterface.cpp" line="270"/>
<source>Cell</source>
<translation>Elem</translation>
<translation>Element LiPo</translation>
</message>
<message>
<location filename="../eeprominterface.cpp" line="270"/>
@@ -7393,17 +7393,17 @@ p, li { white-space: pre-wrap; }
<message>
<location filename="../eeprominterface.cpp" line="270"/>
<source>Curr</source>
<translation>Cour</translation>
<translation>Courant</translation>
</message>
<message>
<location filename="../eeprominterface.cpp" line="270"/>
<source>Cnsp</source>
<translation>Cnsm</translation>
<translation>Consommation</translation>
</message>
<message>
<location filename="../eeprominterface.cpp" line="270"/>
<source>Powr</source>
<translation>Puis</translation>
<translation>Puissance</translation>
</message>
<message>
<location filename="../eeprominterface.cpp" line="271"/>
@@ -7423,7 +7423,7 @@ p, li { white-space: pre-wrap; }
<message>
<location filename="../eeprominterface.cpp" line="272"/>
<source>VSpd</source>
<translation>VitV</translation>
<translation>Vitesse Verticale</translation>
</message>
<message>
<location filename="../eeprominterface.cpp" line="273"/>
+1 -1
View File
@@ -60,7 +60,7 @@ void WizMix::addMix(ModelData &model, Input input, int weight, int channel, int
mix.destCh = channel+1;
if (isTaranis){
int channel = settings.getDefaultChannel(input-1);
mix.srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, channel, &model);
mix.srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, channel);
}
else
mix.srcRaw = RawSource(SOURCE_TYPE_STICK, input-1);
+16
View File
@@ -1,3 +1,19 @@
<h2>Version 2.0.4 / 2014-06-24</h2>
[Taranis]
<ul>
<li>Lua Telemetry custom screens added
<li>Lua wrong memory used indication
<li>Telemetry on the serial port in the battery bay
<li>
</ul>
[All]
<ul>
<li>Air Speed added in Logs
<li>|d|>x bug fix
<li>Timers played even if 00:00
</ul>
<h2>Version 2.0.3 / 2014-06-17</h2>
<ul>
<li>Bugfix on Reset Flight function (possible freeze of the menus)
+20 -4
View File
@@ -272,6 +272,12 @@ LUA = NO
# Values = NO, READONLY, NOMENUS
MENUS_LOCK = NO
# USB options in the main image
# Values = JOYSTICK, MASSSTORAGE
# JOYSTICK: The TX will appear as a joystick
# MASSSTORAGE: The TX will appear as a drive
USB = JOYSTICK
#------- END BUILD OPTIONS ---------------------------
# Define programs and commands.
@@ -279,7 +285,7 @@ SHELL = sh
IMG2LBM = -python ../util/img2lbm.py
BIN2LBM = -python ../util/bin2lbm.py
TRANSLATE = -python ../util/translate.py
VERSION = 2.0.3
VERSION = 2.0.4
SRC =
CPPSRC =
@@ -590,7 +596,7 @@ ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO))
EEPROMSRC = eeprom_common.cpp eeprom_raw.cpp eeprom_conversions.cpp
PULSESSRC = pulses/pulses_arm.cpp pulses/ppm_arm.cpp pulses/pxx_arm.cpp pulses/dsm2_arm.cpp
CPPSRC += audio_arm.cpp haptic.cpp gui/view_about.cpp gui/view_text.cpp
CPPSRC += targets/sky9x/telemetry_driver.cpp targets/sky9x/pwr_driver.cpp targets/sky9x/adc_driver.cpp targets/sky9x/eeprom_driver.cpp targets/sky9x/pulses_driver.cpp targets/sky9x/keys_driver.cpp targets/sky9x/audio_driver.cpp targets/sky9x/buzzer_driver.cpp targets/sky9x/haptic_driver.cpp targets/sky9x/sdcard_driver.cpp targets/sky9x/massstorage.cpp
CPPSRC += targets/sky9x/telemetry_driver.cpp targets/sky9x/second_serial_driver.cpp targets/sky9x/pwr_driver.cpp targets/sky9x/adc_driver.cpp targets/sky9x/eeprom_driver.cpp targets/sky9x/pulses_driver.cpp targets/sky9x/keys_driver.cpp targets/sky9x/audio_driver.cpp targets/sky9x/buzzer_driver.cpp targets/sky9x/haptic_driver.cpp targets/sky9x/sdcard_driver.cpp targets/sky9x/massstorage.cpp
CPPSRC += loadboot.cpp
ifeq ($(SDCARD), YES)
@@ -616,7 +622,6 @@ ifeq ($(PCB), $(filter $(PCB), SKY9X 9XRPRO))
ifeq ($(DEBUG), YES)
CPPSRC += debug.cpp
CPPSRC += targets/sky9x/debug_driver.cpp
SRC += targets/sky9x/syscalls.c
endif
endif
@@ -673,7 +678,7 @@ ifeq ($(PCB), TARANIS)
SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_pwr.c
SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_usart.c
SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/gcc_ride7/startup_stm32f2xx.s
SRC += targets/taranis/usb_bsp.c targets/taranis/usbd_desc.c targets/taranis/usbd_hid_joystick.c
SRC += targets/taranis/usb_bsp.c targets/taranis/usbd_desc.c
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_core.c
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_dcd.c
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_dcd_int.c
@@ -682,6 +687,17 @@ ifeq ($(PCB), TARANIS)
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_req.c
EXTRABOARDSRC += targets/taranis/usbd_usr.cpp
SRC += targets/sky9x/syscalls.c
ifeq ($(USB), JOYSTICK)
CPPDEFS += -DUSB_JOYSTICK
SRC += targets/taranis/usbd_hid_joystick.c
else
CPPDEFS += -DUSB_MASS_STORAGE
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_data.c
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_scsi.c
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_bot.c
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_core.c
EXTRABOARDSRC += targets/taranis/usbd_storage_msd.cpp
endif
ifneq ($(LUA), NO)
ifeq ($(LUA), YES)
+14 -14
View File
@@ -155,6 +155,19 @@ const char * audioFilenames[] = {
"eeformat",
"lowbatt",
"inactiv",
"a1_org",
"a1_red",
"a2_org",
"a2_red",
"a3_org",
"a3_red",
"a4_org",
"a4_red",
"rssi_org",
"rssi_red",
"swr_red",
"telemko",
"telemok",
#if defined(PCBSKY9X)
"highmah",
"hightemp",
@@ -189,20 +202,7 @@ const char * audioFilenames[] = {
"timer00",
"timer10",
"timer20",
"timer30",
"a1_org",
"a1_red",
"a2_org",
"a2_red",
"a3_org",
"a3_red",
"a4_org",
"a4_red",
"rssi_org",
"rssi_red",
"swr_red",
"telemko",
"telemok"
"timer30"
};
uint64_t sdAvailableSystemAudioFiles = 0;
+6 -1
View File
@@ -582,7 +582,7 @@ const pm_char * eeBackupModel(uint8_t i_fileSrc)
len = i+1;
if (len) {
if (buf[i])
buf[i] = idx2char(buf[i]);
buf[i] = idx2char(buf[i]);
else
buf[i] = '_';
}
@@ -597,6 +597,11 @@ const pm_char * eeBackupModel(uint8_t i_fileSrc)
len = sizeof(MODELS_PATH) + PSIZE(TR_MODEL) + 2;
}
#if defined(RTCLOCK) && LCD_W >= 212
char * tmp = strAppendDate(&buf[len]);
len = tmp - buf;
#endif
strcpy_P(&buf[len], STR_MODELS_EXT);
#ifdef SIMU
+26 -1
View File
@@ -103,6 +103,31 @@ TEST(Trims, infiniteChainedTrims)
}
#endif
TEST(Trims, CopyTrimsToOffset)
{
MODEL_RESET();
modelDefault(0);
setTrimValue(0, 1, -100); // -100 on elevator
evalFunctions(); // it disables all safety channels
copyTrimsToOffset(1);
EXPECT_EQ(getTrimValue(0, 1), -100); // unchanged
#if defined(CPUARM)
EXPECT_EQ(g_model.limitData[1].offset, -195);
#else
EXPECT_EQ(g_model.limitData[1].offset, -200);
#endif
}
TEST(Trims, CopySticksToOffset)
{
MODEL_RESET();
modelDefault(0);
anaInValues[ELE_STICK] = -100;
perMain();
copySticksToOffset(1);
EXPECT_EQ(g_model.limitData[1].offset, -97);
}
TEST(outdezNAtt, test_unsigned)
{
uint8_t refBuf[sizeof(displayBuf)];
@@ -901,7 +926,7 @@ TEST(Heli, Mode2Test)
EXPECT_EQ(chans[2], CHANNEL_MAX/2);
}
#elif defined(HELI)
TEST(Heli, BasicTest)
TEST(Heli, SimpleTest)
{
MODEL_RESET();
applyTemplate(TMPL_HELI_SETUP);
+12 -3
View File
@@ -256,8 +256,9 @@ void menuGeneralSetup(uint8_t event)
#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
if (attr && checkIncDec_Ret)
if (attr && checkIncDec_Ret) {
g_rtcTime = gmktime(&t); // update local timestamp and get wday calculated
}
break;
case ITEM_SETUP_TIME:
@@ -726,6 +727,9 @@ void backupEeprom()
lcd_rect(3, 6*FH+4, 204, 7);
lcdRefresh();
//reset unexpectedShutdown to prevent warning when user restores EEPROM backup
g_eeGeneral.unexpectedShutdown = 0;
eeDirty(EE_GENERAL);
eeCheck(true);
// create the directory if needed...
@@ -742,7 +746,7 @@ void backupEeprom()
// prepare the filename...
char * tmp = strAppend(filename, EEPROMS_PATH "/eeprom");
tmp = strAppendDate(tmp, true);
tmp = strAppendDate(tmp);
strAppend(tmp, EEPROM_EXT);
// open the file for writing...
@@ -760,6 +764,11 @@ void backupEeprom()
}
f_close(&file);
//set back unexpectedShutdown
g_eeGeneral.unexpectedShutdown = 1;
eeDirty(EE_GENERAL);
eeCheck(true);
}
#endif
@@ -1388,7 +1397,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);
uart3Init(g_eeGeneral.uart3Mode, g_model.telemetryProtocol);
}
break;
}
+54 -16
View File
@@ -308,7 +308,7 @@ void onModelSelectMenu(const char *result)
POPUP_WARNING(eeBackupModel(sub));
}
else if (result == STR_RESTORE_MODEL || result == STR_UPDATE_LIST) {
if (!listSdFiles(MODELS_PATH, MODELS_EXT, sizeof(g_model.header.name), NULL)) {
if (!listSdFiles(MODELS_PATH, MODELS_EXT, MENU_LINE_LENGTH-1, NULL)) {
POPUP_WARNING(STR_NO_MODELS_ON_SD);
s_menu_flags = 0;
}
@@ -1350,7 +1350,17 @@ void menuModelSetup(uint8_t event)
lcd_putsLeft(y, STR_BEEPCTR);
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS; i++) {
// TODO flash saving, \001 not needed in STR_RETA123
lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+i*FW, y, STR_RETA123, i, ((m_posHorz==i) && attr) ? BLINK|INVERS : (((g_model.beepANACenter & ((BeepANACenter)1<<i)) || (attr && m_posHorz<0)) ? INVERS : 0 ) );
uint8_t x = MODEL_SETUP_2ND_COLUMN+i*FW;
#if defined(PCBTARANIS) && !defined(REVPLUS)
if (i == POT3) {
if (m_posHorz == POT3) REPEAT_LAST_CURSOR_MOVE();
continue;
}
else if (i > POT3) {
x -= FW;
}
#endif
lcd_putsiAtt(x, y, STR_RETA123, i, ((m_posHorz==i) && attr) ? BLINK|INVERS : (((g_model.beepANACenter & ((BeepANACenter)1<<i)) || (attr && m_posHorz<0)) ? INVERS : 0 ) );
}
if (attr && CURSOR_ON_CELL) {
if (event==EVT_KEY_BREAK(KEY_ENTER) || p1valdiff) {
@@ -2739,8 +2749,16 @@ void deleteExpoMix(uint8_t expo, uint8_t idx)
pauseMixerCalculations();
if (expo) {
ExpoData *expo = expoAddress(idx);
#if defined(PCBTARANIS)
int input = expo->chn;
#endif
memmove(expo, expo+1, (MAX_EXPOS-(idx+1))*sizeof(ExpoData));
memclear(&g_model.expoData[MAX_EXPOS-1], sizeof(ExpoData));
#if defined(PCBTARANIS)
if (!isInputAvailable(input)) {
memclear(&g_model.inputNames[input], LEN_INPUT_NAME);
}
#endif
}
else {
MixData *mix = mixAddress(idx);
@@ -3840,6 +3858,9 @@ void onLimitsMenu(const char *result)
ld->revert = false;
ld->curve = 0;
}
else if (result == STR_COPY_STICKS_TO_OFS) {
copySticksToOffset(ch);
}
else if (result == STR_COPY_TRIMS_TO_OFS) {
copyTrimsToOffset(ch);
}
@@ -3920,6 +3941,7 @@ void menuModelLimits(uint8_t event)
killEvents(event);
MENU_ADD_ITEM(STR_RESET);
MENU_ADD_ITEM(STR_COPY_TRIMS_TO_OFS);
MENU_ADD_ITEM(STR_COPY_STICKS_TO_OFS);
menuHandler = onLimitsMenu;
}
#else
@@ -3955,7 +3977,7 @@ void menuModelLimits(uint8_t event)
ld->offset = checkIncDec(event, ld->offset, -1000, 1000, EE_MODEL|NO_INCDEC_MARKS|DBLKEYS_1000);
}
else if (attr && event==EVT_KEY_LONG(KEY_MENU)) {
copyTrimsToOffset(k);
copySticksToOffset(k);
s_editMode = 0;
}
break;
@@ -4383,7 +4405,12 @@ void menuModelLogicalSwitchOne(uint8_t event)
if (v1_val >= MIXSRC_FIRST_TELEM) {
putsTelemetryChannel(CSWONE_2ND_COLUMN, y, v1_val - MIXSRC_FIRST_TELEM, convertLswTelemValue(cs), attr|LEFT);
v2_max = maxTelemValue(v1_val - MIXSRC_FIRST_TELEM + 1);
v2_min = minTelemValue(v1_val - MIXSRC_FIRST_TELEM + 1);
if (cs->func == LS_FUNC_DIFFEGREATER)
v2_min = -v2_max;
else if (cs->func == LS_FUNC_ADIFFEGREATER)
v2_min = 0;
else
v2_min = minTelemValue(v1_val - MIXSRC_FIRST_TELEM + 1);
INCDEC_SET_FLAG(INCDEC_REP10 | NO_INCDEC_MARKS);
if (cs->v2 < v2_min || cs->v2 > v2_max) {
cs->v2 = 0;
@@ -4668,7 +4695,12 @@ void menuModelLogicalSwitches(uint8_t event)
putsTelemetryChannel(CSW_3RD_COLUMN, y, v1_val - MIXSRC_FIRST_TELEM, convertLswTelemValue(cs), LEFT|attr2);
v2_max = maxTelemValue(v1_val - MIXSRC_FIRST_TELEM + 1);
#if defined(CPUARM)
v2_min = minTelemValue(v1_val - MIXSRC_FIRST_TELEM + 1);
if (cs->func == LS_FUNC_DIFFEGREATER)
v2_min = -v2_max;
else if (cs->func == LS_FUNC_ADIFFEGREATER)
v2_min = 0;
else
v2_min = minTelemValue(v1_val - MIXSRC_FIRST_TELEM + 1);
if (horz == 2 && v2_max-v2_min > 1000)
INCDEC_SET_FLAG(INCDEC_REP10 | NO_INCDEC_MARKS);
if (cs->v2 < v2_min || cs->v2 > v2_max) {
@@ -4692,7 +4724,15 @@ void menuModelLogicalSwitches(uint8_t event)
}
else {
lcd_outdezAtt(CSW_3RD_COLUMN, y, cs->v2, LEFT|attr2);
v2_min = -125; v2_max = 125;
#if defined(CPUARM) && defined(GVARS)
if (v1_val >= MIXSRC_GVAR1) {
v2_min = -1024; v2_max = +1024;
}
else
#endif
{
v2_min = -125; v2_max = +125;
}
}
#else
if (v1_val >= MIXSRC_FIRST_TELEM) {
@@ -5325,6 +5365,9 @@ void menuModelCustomScriptOne(uint8_t event)
void menuModelCustomScripts(uint8_t event)
{
lcd_outdezAtt(19*FW, 0, luaGetMemUsed(), 0);
lcd_puts(19*FW+1, 0, STR_BYTES);
MENU(STR_MENUCUSTOMSCRIPTS, menuTabModel, e_CustomScripts, MAX_SCRIPTS+1, {0, NAVIGATION_LINE_BY_LINE|3/*repeated*/});
uint8_t y;
@@ -5358,19 +5401,14 @@ void menuModelCustomScripts(uint8_t event)
lcd_putsnAtt(5*FW, y, sd.file, sizeof(sd.file), 0);
switch (scriptInternalData[scriptIndex].state) {
case SCRIPT_SYNTAX_ERROR:
lcd_puts(28*FW+2, y, "(error)");
lcd_puts(30*FW+2, y, "(error)");
break;
case SCRIPT_KILLED:
lcd_puts(27*FW+2, y, "(killed)");
break;
case SCRIPT_LEAK:
lcd_puts(29*FW+2, y, "(leak)");
lcd_puts(29*FW+2, y, "(killed)");
break;
default:
lcd_outdezAtt(31*FW, y, luaGetCpuUsed(scriptIndex));
lcd_putc(31*FW, y, '%');
lcd_outdezAtt(34*FW+2, y, luaGetMemUsed(scriptIndex));
lcd_putc(34*FW+2, y, 'k');
lcd_outdezAtt(34*FW, y, luaGetCpuUsed(scriptIndex));
lcd_putc(34*FW, y, '%');
break;
}
scriptIndex++;
@@ -5551,7 +5589,7 @@ void menuModelTelemetry(uint8_t event)
#if defined(CPUARM)
case ITEM_TELEMETRY_PROTOCOL_TYPE:
g_model.telemetryProtocol = selectMenuItem(TELEM_COL2, y, STR_TELEMETRY_TYPE, "\006S.PORTD\0 ", g_model.telemetryProtocol, PROTOCOL_FRSKY_SPORT, PROTOCOL_FRSKY_D, attr, event);
g_model.telemetryProtocol = selectMenuItem(TELEM_COL2, y, STR_TELEMETRY_TYPE, "\017FrSky S.PORT\0 FrSky D\0 FrSky D (cable)", g_model.telemetryProtocol, PROTOCOL_TELEMETRY_FIRST, CASE_PCBTARANIS(g_eeGeneral.uart3Mode==UART_MODE_TELEMETRY ? PROTOCOL_FRSKY_D_SECONDARY : PROTOCOL_FRSKY_D) CASE_PCBSKY9X(PROTOCOL_FRSKY_D_SECONDARY) attr, event);
break;
#endif
+21 -15
View File
@@ -165,7 +165,7 @@ int16_t checkIncDec(uint8_t event, int16_t val, int16_t i_min, int16_t i_max, ui
#if defined(CPUARM)
do {
if (IS_KEY_REPT(event) && (i_flags & INCDEC_REP10)) {
newval+=10;
newval += min(10, i_max-val);
}
else {
newval++;
@@ -190,7 +190,7 @@ int16_t checkIncDec(uint8_t event, int16_t val, int16_t i_min, int16_t i_max, ui
#if defined(CPUARM)
do {
if (IS_KEY_REPT(event) && (i_flags & INCDEC_REP10)) {
newval-=10;
newval -= min(10, val-i_min);
}
else {
newval--;
@@ -1350,7 +1350,7 @@ void drawStatusLine()
{
if (statusLineTime) {
if ((tmr10ms_t)(get_tmr10ms() - statusLineTime) <= (tmr10ms_t)STATUS_LINE_DELAY) {
if (statusLineHeight < 8) statusLineHeight++;
if (statusLineHeight < FH) statusLineHeight++;
}
else if (statusLineHeight) {
statusLineHeight--;
@@ -1359,27 +1359,33 @@ void drawStatusLine()
statusLineTime = 0;
}
lcd_filled_rect(0, 8*FH-statusLineHeight, LCD_W, 8, SOLID, ERASE);
lcd_putsAtt(5, 8*FH+1-statusLineHeight, statusLineMsg, BSS);
lcd_filled_rect(0, 8*FH-statusLineHeight, LCD_W, 8, SOLID);
lcd_filled_rect(0, LCD_H-statusLineHeight, LCD_W, FH, SOLID, ERASE);
lcd_putsAtt(5, LCD_H+1-statusLineHeight, statusLineMsg, BSS);
lcd_filled_rect(0, LCD_H-statusLineHeight, LCD_W, FH, SOLID);
}
}
#endif
#if defined(PCBTARANIS)
bool isInputAvailable(int input)
{
for (int i=0; i<MAX_EXPOS; i++) {
ExpoData * expo = expoAddress(i);
if (!EXPO_VALID(expo))
break;
if (expo->chn == input)
return true;
}
return false;
}
#endif
#if defined(CPUARM)
bool isSourceAvailable(int source)
{
#if defined(PCBTARANIS)
if (source>=MIXSRC_FIRST_INPUT && source<=MIXSRC_LAST_INPUT) {
int input = source - MIXSRC_FIRST_INPUT;
for (int i=0; i<MAX_EXPOS; i++) {
ExpoData * expo = expoAddress(i);
if (!EXPO_VALID(expo))
break;
if (expo->chn == input)
return true;
}
return false;
return isInputAvailable(source - MIXSRC_FIRST_INPUT);
}
#endif
+6 -1
View File
@@ -236,6 +236,7 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max);
#endif
#if defined(CPUARM)
bool isInputAvailable(int input);
bool isSourceAvailable(int source);
bool isTelemetrySourceAvailable(int source);
bool isInputSourceAvailable(int source);
@@ -397,7 +398,11 @@ void displayWarning(uint8_t event);
#else
#define MENU_ADD_SD_ITEM(s)
#endif
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+1)
#if LCD_W >= 212
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+12)
#else
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+1)
#endif
extern const char *s_menu[MENU_MAX_LINES];
extern uint16_t s_menu_count;
extern uint8_t s_menu_flags;
+2 -2
View File
@@ -340,7 +340,7 @@ void displayTimers()
// Main timer
if (g_model.timers[0].mode) {
TimerState & timerState = timersStates[0];
putsTimer(TIMERS_X, TIMER1_Y, timerState.val, MIDSIZE|LEFT, MIDSIZE|LEFT);
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);
if (g_model.timers[0].persistent) lcd_putcAtt(TIMERS_R, TIMER1_Y+1, 'P', SMLSIZE);
if (timerState.val < 0) {
@@ -353,7 +353,7 @@ void displayTimers()
// Second timer
if (g_model.timers[1].mode) {
TimerState & timerState = timersStates[1];
putsTimer(TIMERS_X, TIMER2_Y, timerState.val, MIDSIZE|LEFT, MIDSIZE|LEFT);
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);
if (g_model.timers[1].persistent) lcd_putcAtt(TIMERS_R, TIMER2_Y+1, 'P', SMLSIZE);
if (timerState.val < 0) {
+117 -104
View File
@@ -48,15 +48,22 @@ bar_threshold_t barsThresholds[THLD_MAX];
#endif
enum FrskyViews {
e_frsky_custom_screen_1,
e_frsky_custom_screen_2,
CASE_CPUARM(e_frsky_custom_screen_3)
e_frsky_voltages,
e_frsky_after_flight,
FRSKY_VIEW_MAX = e_frsky_after_flight
TELEMETRY_VOLTAGES_SCREEN,
CASE_LUA(TELEMETRY_LUA_SCREEN_1)
CASE_LUA(TELEMETRY_LUA_SCREEN_2)
CASE_LUA(TELEMETRY_LUA_SCREEN_3)
CASE_LUA(TELEMETRY_LUA_SCREEN_4)
CASE_LUA(TELEMETRY_LUA_SCREEN_5)
CASE_LUA(TELEMETRY_LUA_SCREEN_6)
CASE_LUA(TELEMETRY_LUA_SCREEN_7)
TELEMETRY_CUSTOM_SCREEN_1,
TELEMETRY_CUSTOM_SCREEN_2,
CASE_CPUARM(TELEMETRY_CUSTOM_SCREEN_3)
TELEMETRY_AFTER_FLIGHT_SCREEN,
FRSKY_VIEW_MAX = TELEMETRY_AFTER_FLIGHT_SCREEN
};
uint8_t s_frsky_view = e_frsky_custom_screen_1;
uint8_t s_frsky_view = TELEMETRY_VOLTAGES_SCREEN;
#if LCD_W >= 212
#define BAR_LEFT 26
@@ -214,10 +221,107 @@ void menuTelemetryFrsky(uint8_t event)
lcdDrawTelemetryTopBar();
if (s_frsky_view < MAX_FRSKY_SCREENS) {
FrSkyScreenData & screen = g_model.frsky.screens[s_frsky_view];
if (s_frsky_view == TELEMETRY_VOLTAGES_SCREEN) {
// Volts / Amps / Watts / mAh
uint8_t analog = 0;
#if defined(CPUARM)
lcd_putsiAtt(0, 2*FH, STR_VOLTSRC, g_model.frsky.voltsSource, 0);
#else
lcd_putsiAtt(0, 2*FH, STR_AMPSRC, g_model.frsky.voltsSource+1, 0);
#endif
switch (g_model.frsky.voltsSource) {
case FRSKY_VOLTS_SOURCE_A1:
case FRSKY_VOLTS_SOURCE_A2:
#if defined(CPUARM)
case FRSKY_VOLTS_SOURCE_A3:
case FRSKY_VOLTS_SOURCE_A4:
#endif
displayVoltageScreenLine(2*FH, g_model.frsky.voltsSource);
analog = 1+g_model.frsky.voltsSource;
break;
#if defined(FRSKY_HUB)
case FRSKY_VOLTS_SOURCE_FAS:
putsTelemetryChannel(3*FW+6*FW+4, FH+1, TELEM_VFAS-1, frskyData.hub.vfas, DBLSIZE);
break;
case FRSKY_VOLTS_SOURCE_CELLS:
putsTelemetryChannel(3*FW+6*FW+4, FH+1, TELEM_CELLS_SUM-1, frskyData.hub.cellsSum, DBLSIZE);
break;
#endif
}
if (g_model.frsky.currentSource) {
lcd_putsiAtt(0, 4*FH, STR_AMPSRC, g_model.frsky.currentSource, 0);
switch(g_model.frsky.currentSource) {
case FRSKY_CURRENT_SOURCE_A1:
case FRSKY_CURRENT_SOURCE_A2:
#if defined(CPUARM)
case FRSKY_CURRENT_SOURCE_A3:
case FRSKY_CURRENT_SOURCE_A4:
#endif
displayVoltageScreenLine(4*FH, g_model.frsky.currentSource-1);
break;
#if defined(FRSKY_HUB)
case FRSKY_CURRENT_SOURCE_FAS:
putsTelemetryChannel(3*FW+6*FW+4, 3*FH+1, TELEM_CURRENT-1, frskyData.hub.current, DBLSIZE);
break;
#endif
}
putsTelemetryChannel(4, 5*FH+1, TELEM_POWER-1, frskyData.hub.power, LEFT|DBLSIZE);
putsTelemetryChannel(3*FW+4+4*FW+6*FW+FW, 5*FH+1, TELEM_CONSUMPTION-1, frskyData.hub.currentConsumption, DBLSIZE);
}
else {
#if defined(CPUARM)
displayVoltageScreenLine(analog > 0 ? 5*FH : 4*FH, analog==1+FRSKY_VOLTS_SOURCE_A1 ? FRSKY_VOLTS_SOURCE_A2 : FRSKY_VOLTS_SOURCE_A1);
#else
displayVoltageScreenLine(analog > 0 ? 5*FH : 4*FH, analog ? 2-analog : 0);
#endif
if (analog == 0) displayVoltageScreenLine(6*FH, 1);
}
#if defined(FRSKY_HUB)
// Cells voltage
if (frskyData.hub.cellsCount > 0) {
uint8_t y = 1*FH;
for (uint8_t k=0; k<frskyData.hub.cellsCount && k<6; k++) {
#if defined(GAUGES)
if (g_model.frsky.screensType & (1<<s_frsky_view)) {
uint8_t attr = (barsThresholds[THLD_CELL] && frskyData.hub.cellVolts[k] < barsThresholds[THLD_CELL]) ? BLINK|PREC2 : PREC2;
#else
uint8_t attr = PREC2;
#endif
lcd_outdezNAtt(LCD_W, y, TELEMETRY_CELL_VOLTAGE(k), attr, 4);
y += 1*FH;
}
#if defined(PCBTARANIS)
if (frskyData.hub.cellsCount > 6) {
y = 1*FH;
for (uint8_t k=6; k<frskyData.hub.cellsCount && k<12; k++) {
#if defined(GAUGES)
uint8_t attr = (barsThresholds[THLD_CELL] && frskyData.hub.cellVolts[k] < barsThresholds[THLD_CELL]) ? BLINK|PREC2 : PREC2;
#else
uint8_t attr = PREC2;
#endif
lcd_outdezNAtt(LCD_W-3*FW-2, y, TELEMETRY_CELL_VOLTAGE(k), attr, 4);
y += 1*FH;
}
lcd_vline(LCD_W-6*FW-4, 8, 47);
} else
#endif
lcd_vline(LCD_W-3*FW-2, 8, 47);
}
#endif
displayRssiLine();
}
#if defined(LUA)
else if (s_frsky_view < TELEMETRY_CUSTOM_SCREEN_1) {
putEvent(event == EVT_KEY_BREAK(KEY_UP) ? event : EVT_KEY_BREAK(KEY_DOWN));
}
#endif
else if (s_frsky_view < TELEMETRY_CUSTOM_SCREEN_1+MAX_FRSKY_SCREENS) {
FrSkyScreenData & screen = g_model.frsky.screens[s_frsky_view-TELEMETRY_CUSTOM_SCREEN_1];
#if defined(GAUGES)
if (g_model.frsky.screensType & (1<<(s_frsky_view-TELEMETRY_CUSTOM_SCREEN_1))) {
// Custom Screen with gauges
uint8_t barHeight = 5;
for (int8_t i=3; i>=0; i--) {
@@ -340,104 +444,13 @@ void menuTelemetryFrsky(uint8_t event)
}
}
lcd_status_line();
if (fields_count == 0)
if (fields_count == 0) {
putEvent(event == EVT_KEY_BREAK(KEY_UP) ? event : EVT_KEY_BREAK(KEY_DOWN));
}
}
}
else if (s_frsky_view == e_frsky_voltages) {
// Volts / Amps / Watts / mAh
uint8_t analog = 0;
#if defined(CPUARM)
lcd_putsiAtt(0, 2*FH, STR_VOLTSRC, g_model.frsky.voltsSource, 0);
#else
lcd_putsiAtt(0, 2*FH, STR_AMPSRC, g_model.frsky.voltsSource+1, 0);
#endif
switch (g_model.frsky.voltsSource) {
case FRSKY_VOLTS_SOURCE_A1:
case FRSKY_VOLTS_SOURCE_A2:
#if defined(CPUARM)
case FRSKY_VOLTS_SOURCE_A3:
case FRSKY_VOLTS_SOURCE_A4:
#endif
displayVoltageScreenLine(2*FH, g_model.frsky.voltsSource);
analog = 1+g_model.frsky.voltsSource;
break;
#if defined(FRSKY_HUB)
case FRSKY_VOLTS_SOURCE_FAS:
putsTelemetryChannel(3*FW+6*FW+4, FH+1, TELEM_VFAS-1, frskyData.hub.vfas, DBLSIZE);
break;
case FRSKY_VOLTS_SOURCE_CELLS:
putsTelemetryChannel(3*FW+6*FW+4, FH+1, TELEM_CELLS_SUM-1, frskyData.hub.cellsSum, DBLSIZE);
break;
#endif
}
if (g_model.frsky.currentSource) {
lcd_putsiAtt(0, 4*FH, STR_AMPSRC, g_model.frsky.currentSource, 0);
switch(g_model.frsky.currentSource) {
case FRSKY_CURRENT_SOURCE_A1:
case FRSKY_CURRENT_SOURCE_A2:
#if defined(CPUARM)
case FRSKY_CURRENT_SOURCE_A3:
case FRSKY_CURRENT_SOURCE_A4:
#endif
displayVoltageScreenLine(4*FH, g_model.frsky.currentSource-1);
break;
#if defined(FRSKY_HUB)
case FRSKY_CURRENT_SOURCE_FAS:
putsTelemetryChannel(3*FW+6*FW+4, 3*FH+1, TELEM_CURRENT-1, frskyData.hub.current, DBLSIZE);
break;
#endif
}
putsTelemetryChannel(4, 5*FH+1, TELEM_POWER-1, frskyData.hub.power, LEFT|DBLSIZE);
putsTelemetryChannel(3*FW+4+4*FW+6*FW+FW, 5*FH+1, TELEM_CONSUMPTION-1, frskyData.hub.currentConsumption, DBLSIZE);
}
else {
#if defined(CPUARM)
displayVoltageScreenLine(analog > 0 ? 5*FH : 4*FH, analog==1+FRSKY_VOLTS_SOURCE_A1 ? FRSKY_VOLTS_SOURCE_A2 : FRSKY_VOLTS_SOURCE_A1);
#else
displayVoltageScreenLine(analog > 0 ? 5*FH : 4*FH, analog ? 2-analog : 0);
#endif
if (analog == 0) displayVoltageScreenLine(6*FH, 1);
}
#if defined(FRSKY_HUB)
// Cells voltage
if (frskyData.hub.cellsCount > 0) {
uint8_t y = 1*FH;
for (uint8_t k=0; k<frskyData.hub.cellsCount && k<6; k++) {
#if defined(GAUGES)
uint8_t attr = (barsThresholds[THLD_CELL] && frskyData.hub.cellVolts[k] < barsThresholds[THLD_CELL]) ? BLINK|PREC2 : PREC2;
#else
uint8_t attr = PREC2;
#endif
lcd_outdezNAtt(LCD_W, y, TELEMETRY_CELL_VOLTAGE(k), attr, 4);
y += 1*FH;
}
#if defined(PCBTARANIS)
if (frskyData.hub.cellsCount > 6) {
y = 1*FH;
for (uint8_t k=6; k<frskyData.hub.cellsCount && k<12; k++) {
#if defined(GAUGES)
uint8_t attr = (barsThresholds[THLD_CELL] && frskyData.hub.cellVolts[k] < barsThresholds[THLD_CELL]) ? BLINK|PREC2 : PREC2;
#else
uint8_t attr = PREC2;
#endif
lcd_outdezNAtt(LCD_W-3*FW-2, y, TELEMETRY_CELL_VOLTAGE(k), attr, 4);
y += 1*FH;
}
lcd_vline(LCD_W-6*FW-4, 8, 47);
} else
#endif
lcd_vline(LCD_W-3*FW-2, 8, 47);
}
#endif
displayRssiLine();
}
#if defined(FRSKY_HUB)
else if (s_frsky_view == e_frsky_after_flight) {
else if (s_frsky_view == TELEMETRY_AFTER_FLIGHT_SCREEN) {
uint8_t line=1*FH+1;
if (IS_GPS_AVAILABLE()) {
// Latitude
+10 -4
View File
@@ -301,7 +301,7 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
}
#endif
if (p<lineEnd && !BLINKING_CHAR) {
if (p<DISPLAY_END && p<lineEnd && !BLINKING_CHAR) {
ASSERT_IN_DISPLAY(p);
uint8_t mask = ~(0xff << ym8);
LCD_BYTE_FILTER(p, mask, b << ym8);
@@ -336,7 +336,10 @@ void lcd_putc(xcoord_t x, uint8_t y, const unsigned char c)
void lcd_putsnAtt(xcoord_t x, uint8_t y, const pm_char * s, uint8_t len, LcdFlags mode)
{
xcoord_t orig_x = x;
const xcoord_t orig_x = x;
#if defined(CPUARM)
const uint8_t orig_len = len;
#endif
bool setx = false;
while (len--) {
unsigned char c;
@@ -373,6 +376,9 @@ void lcd_putsnAtt(xcoord_t x, uint8_t y, const pm_char * s, uint8_t len, LcdFlag
setx = true;
}
else if (c == 0x1E) { //NEWLINE
#if defined(CPUARM)
len = orig_len;
#endif
x = orig_x;
y += FH;
#if defined(CPUARM)
@@ -552,7 +558,7 @@ void lcd_outdezNAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags flags, uint8_t
}
else if (midsize) {
x -= 3;
xn = x+1;
xn = x;
}
else if (tinsize) {
x--;
@@ -912,7 +918,7 @@ void putsTimer(xcoord_t x, uint8_t y, putstime_t tme, LcdFlags att, LcdFlags att
#if defined(PCBTARANIS)
#define separator ':'
if (att & MIDSIZE) {
if (att & TIMEHOUR) {
div_t qr2 = div(qr.quot, 60);
lcd_outdezNAtt(x, y, qr2.quot, att|LEADING0|LEFT, 2);
lcd_putcAtt(lcdLastPos, y, separator, att&att2);
+5 -1
View File
@@ -113,7 +113,6 @@
#define SMLSIZE 0x0200
#define TINSIZE 0x0400
#define STREXPANDED 0x0800
#define TIMEBLINK 0x1000
#else
#define MIDSIZE DBLSIZE
#define SMLSIZE 0x00
@@ -127,6 +126,11 @@
#define GREY_MASK(x) ((x) & 0xF000)
#endif
#if defined(CPUARM)
#define TIMEBLINK 0x10000
#define TIMEHOUR 0x20000
#endif
#if defined(CPUARM)
#define LcdFlags uint32_t
#else
+6 -3
View File
@@ -124,10 +124,12 @@ const pm_char * openLogs()
#if defined(FRSKY_HUB)
if (IS_USR_PROTO_FRSKY_HUB()) {
f_puts("GPS Date,GPS Time,Long,Lat,Course,GPS Speed(", &g_oLogFile);
f_puts(TELEMETRY_GPS_SPEED_UNIT, &g_oLogFile);
f_puts(TELEMETRY_SPEED_UNIT, &g_oLogFile);
f_puts("),GPS Alt,Baro Alt(", &g_oLogFile);
f_puts(TELEMETRY_BARO_ALT_UNIT, &g_oLogFile);
f_puts("),Vertical Speed,Temp1,Temp2,RPM,Fuel," TELEMETRY_CELLS_LABEL "Current,Consumption,Vfas,AccelX,AccelY,AccelZ,", &g_oLogFile);
f_puts("),Vertical Speed,Air Speed(", &g_oLogFile);
f_puts(TELEMETRY_SPEED_UNIT, &g_oLogFile);
f_puts("),Temp1,Temp2,RPM,Fuel," TELEMETRY_CELLS_LABEL "Current,Consumption,Vfas,AccelX,AccelY,AccelZ,", &g_oLogFile);
}
#endif
@@ -213,7 +215,7 @@ void writeLogs()
TELEMETRY_BARO_ALT_PREPARE();
if (IS_USR_PROTO_FRSKY_HUB()) {
f_printf(&g_oLogFile, "%4d-%02d-%02d,%02d:%02d:%02d,%03d.%04d%c,%03d.%04d%c,%03d.%02d," TELEMETRY_GPS_SPEED_FORMAT TELEMETRY_GPS_ALT_FORMAT TELEMETRY_BARO_ALT_FORMAT TELEMETRY_VSPEED_FORMAT "%d,%d,%d,%d," TELEMETRY_CELLS_FORMAT TELEMETRY_CURRENT_FORMAT "%d," TELEMETRY_VFAS_FORMAT "%d,%d,%d,",
f_printf(&g_oLogFile, "%4d-%02d-%02d,%02d:%02d:%02d,%03d.%04d%c,%03d.%04d%c,%03d.%02d," TELEMETRY_SPEED_FORMAT TELEMETRY_GPS_ALT_FORMAT TELEMETRY_BARO_ALT_FORMAT TELEMETRY_VSPEED_FORMAT TELEMETRY_SPEED_FORMAT "%d,%d,%d,%d," TELEMETRY_CELLS_FORMAT TELEMETRY_CURRENT_FORMAT "%d," TELEMETRY_VFAS_FORMAT "%d,%d,%d,",
frskyData.hub.year+2000,
frskyData.hub.month,
frskyData.hub.day,
@@ -232,6 +234,7 @@ void writeLogs()
TELEMETRY_GPS_ALT_ARGS
TELEMETRY_BARO_ALT_ARGS
TELEMETRY_VSPEED_ARGS
TELEMETRY_ASPEED_ARGS
frskyData.hub.temperature1,
frskyData.hub.temperature2,
frskyData.hub.rpm,
+75 -45
View File
@@ -65,8 +65,8 @@ ScriptInternalData standaloneScript = { SCRIPT_NOFILE, 0 };
uint16_t maxLuaInterval = 0;
uint16_t maxLuaDuration = 0;
#define PERMANENT_SCRIPTS_MAX_INSTRUCTIONS (1000/100)
#define MANUAL_SCRIPTS_MAX_INSTRUCTIONS (10000/100)
#define PERMANENT_SCRIPTS_MAX_INSTRUCTIONS (10000/100)
#define MANUAL_SCRIPTS_MAX_INSTRUCTIONS (20000/100)
#define SCRIPTS_MAX_HEAP 50
#define SET_LUA_INSTRUCTIONS_COUNT(x) (instructionsPercent=0, lua_sethook(L, hook, LUA_MASKCOUNT, x))
@@ -155,7 +155,11 @@ static int luaGetValue(lua_State *L)
}
else {
const char *what = luaL_checkstring(L, 1);
if (!strcmp(what, "altitude")) {
if (!strcmp(what, "altitude-max")) {
lua_pushnumber(L, frskyData.hub.maxAltitude);
return 1;
}
else if (!strcmp(what, "altitude")) {
lua_pushnumber(L, double(frskyData.hub.baroAltitude)/100);
return 1;
}
@@ -250,6 +254,16 @@ static int luaLcdDrawText(lua_State *L)
return 0;
}
static int luaLcdDrawTimer(lua_State *L)
{
int x = luaL_checkinteger(L, 1);
int y = luaL_checkinteger(L, 2);
int seconds = luaL_checkinteger(L, 3);
int att = luaL_checkinteger(L, 4);
putsTimer(x, y, seconds, att|LEFT, att);
return 0;
}
static int luaLcdDrawNumber(lua_State *L)
{
int x = luaL_checkinteger(L, 1);
@@ -314,6 +328,25 @@ static int luaLcdDrawFilledRectangle(lua_State *L)
return 0;
}
#if 0
static int luaLcdDrawGauge(lua_State *L)
{
int x = luaL_checkinteger(L, 1);
int y = luaL_checkinteger(L, 2);
int w = luaL_checkinteger(L, 3);
int h = luaL_checkinteger(L, 4);
int num = luaL_checkinteger(L, 5);
int den = luaL_checkinteger(L, 6);
int flags = luaL_checkinteger(L, 7);
lcd_rect(x, y, w, h);
uint8_t len = limit((uint8_t)1, uint8_t(w*num/den), uint8_t(w));
for (int i=1; i<h-1; i++) {
lcd_hline(x+1, y+i, len);
}
return 0;
}
#endif
static int luaLcdDrawScreenTitle(lua_State *L)
{
const char * str = luaL_checkstring(L, 1);
@@ -739,9 +772,14 @@ static int luaModelGetCustomFunction(lua_State *L)
lua_newtable(L);
lua_pushtablenumber(L, "switch", CFN_SWITCH(cfn));
lua_pushtablenumber(L, "function", CFN_FUNC(cfn));
lua_pushtablezstring(L, "name", cfn->play.name);
lua_pushtablenumber(L, "value", cfn->all.val);
lua_pushtablenumber(L, "mode", cfn->all.mode);
if (CFN_FUNC(cfn) == FUNC_PLAY_TRACK || CFN_FUNC(cfn) == FUNC_BACKGND_MUSIC || CFN_FUNC(cfn) == FUNC_PLAY_SCRIPT) {
lua_pushtablezstring(L, "name", cfn->play.name);
}
else {
lua_pushtablenumber(L, "value", cfn->all.val);
lua_pushtablenumber(L, "mode", cfn->all.mode);
lua_pushtablenumber(L, "param", cfn->all.param);
}
lua_pushtablenumber(L, "active", CFN_ACTIVE(cfn));
}
else {
@@ -775,6 +813,9 @@ static int luaModelSetCustomFunction(lua_State *L)
else if (!strcmp(key, "mode")) {
cfn->all.mode = luaL_checkinteger(L, -1);
}
else if (!strcmp(key, "param")) {
cfn->all.param = luaL_checkinteger(L, -1);
}
else if (!strcmp(key, "active")) {
CFN_ACTIVE(cfn) = luaL_checkinteger(L, -1);
}
@@ -1020,7 +1061,9 @@ static const luaL_Reg lcdLib[] = {
{ "drawLine", luaLcdDrawLine },
{ "drawRectangle", luaLcdDrawRectangle },
{ "drawFilledRectangle", luaLcdDrawFilledRectangle },
// { "drawGauge", luaLcdDrawGauge },
{ "drawText", luaLcdDrawText },
{ "drawTimer", luaLcdDrawTimer },
{ "drawNumber", luaLcdDrawNumber },
{ "drawSwitch", luaLcdDrawSwitch },
{ "drawSource", luaLcdDrawSource },
@@ -1113,8 +1156,6 @@ int luaLoad(const char *filename, ScriptInternalData & sid, ScriptInputsOutputs
{
int init = 0;
uint8_t prev_mem = lua_gc(L, LUA_GCCOUNT, 0);
sid.instructions = 0;
sid.state = SCRIPT_OK;
@@ -1138,6 +1179,10 @@ int luaLoad(const char *filename, ScriptInternalData & sid, ScriptInputsOutputs
sid.run = luaL_ref(L, LUA_REGISTRYINDEX);
lua_pushnil(L);
}
else if (!strcmp(key, "background")) {
sid.background = luaL_ref(L, LUA_REGISTRYINDEX);
lua_pushnil(L);
}
else if (sio && !strcmp(key, "input")) {
luaGetInputs(*sio);
}
@@ -1160,8 +1205,6 @@ int luaLoad(const char *filename, ScriptInternalData & sid, ScriptInputsOutputs
sid.state = SCRIPT_SYNTAX_ERROR;
}
sid.memory = lua_gc(L, LUA_GCCOUNT, 0) - prev_mem;
if (sid.state != SCRIPT_OK) {
luaFree(sid);
}
@@ -1176,7 +1219,6 @@ void luaLoadMixScript(uint8_t index)
if (ZEXIST(sd.file)) {
ScriptInternalData & sid = scriptInternalData[luaScriptsCount++];
ScriptInputsOutputs * sio = &scriptInputsOutputs[index];
memset(&sid, 0, sizeof(sid));
sid.reference = SCRIPT_MIX_FIRST+index;
sid.state = SCRIPT_NOFILE;
char filename[sizeof(SCRIPTS_MIXES_PATH)+sizeof(sd.file)+sizeof(SCRIPTS_EXT)] = SCRIPTS_MIXES_PATH "/";
@@ -1194,7 +1236,6 @@ bool luaLoadFunctionScript(uint8_t index)
if (fn.func == FUNC_PLAY_SCRIPT && ZEXIST(fn.play.name)) {
if (luaScriptsCount < MAX_SCRIPTS) {
ScriptInternalData & sid = scriptInternalData[luaScriptsCount++];
memset(&sid, 0, sizeof(sid));
sid.reference = SCRIPT_FUNC_FIRST+index;
sid.state = SCRIPT_NOFILE;
char filename[sizeof(SCRIPTS_FUNCS_PATH)+sizeof(fn.play.name)+sizeof(SCRIPTS_EXT)] = SCRIPTS_FUNCS_PATH "/";
@@ -1226,7 +1267,6 @@ bool luaLoadTelemetryScript(uint8_t index)
if (isFileAvailable(path)) {
if (luaScriptsCount < MAX_SCRIPTS) {
ScriptInternalData & sid = scriptInternalData[luaScriptsCount++];
memset(&sid, 0, sizeof(sid));
sid.reference = SCRIPT_TELEMETRY_FIRST+index;
sid.state = SCRIPT_NOFILE;
luaLoad(path, sid);
@@ -1249,9 +1289,11 @@ bool isTelemetryScriptAvailable(uint8_t index)
return false;
}
void luaLoadMixScripts()
void luaLoadPermanentScripts()
{
luaScriptsCount = 0;
memset(scriptInternalData, 0, sizeof(scriptInternalData));
memset(scriptInputsOutputs, 0, sizeof(scriptInputsOutputs));
// Load model scripts
for (int i=0; i<MAX_SCRIPTS; i++) {
@@ -1267,7 +1309,7 @@ void luaLoadMixScripts()
}
// Load telemetry scripts
for (int i=0; i<MAX_SCRIPTS; i++) {
for (int i=0; i<MAX_SCRIPTS+1; i++) {
if (!luaLoadTelemetryScript(i)) {
POPUP_WARNING("Too many Lua scripts!"); // TODO translation
break;
@@ -1307,9 +1349,6 @@ void luaError(uint8_t error)
case SCRIPT_KILLED:
msg = "Script killed";
break;
case SCRIPT_LEAK:
msg = "Script memory leak";
break;
}
POPUP_WARNING(msg);
}
@@ -1415,14 +1454,14 @@ void luaTask(uint8_t evt)
if (luaState & LUASTATE_RELOAD_MODEL_SCRIPTS) {
luaState = 0;
LUA_RESET();
luaLoadMixScripts();
luaLoadPermanentScripts();
}
for (int i=0; i<luaScriptsCount; i++) {
ScriptInternalData & sid = scriptInternalData[i];
if (sid.state == SCRIPT_OK) {
uint8_t prev_mem = lua_gc(L, LUA_GCCOUNT, 0);
SET_LUA_INSTRUCTIONS_COUNT(PERMANENT_SCRIPTS_MAX_INSTRUCTIONS);
int inputsCount = 0;
#if defined(SIMU) || defined(DEBUG)
const char *filename;
#endif
@@ -1430,6 +1469,7 @@ void luaTask(uint8_t evt)
if (sid.reference >= SCRIPT_MIX_FIRST && sid.reference <= SCRIPT_MIX_LAST) {
ScriptData & sd = g_model.scriptsData[sid.reference-SCRIPT_MIX_FIRST];
sio = &scriptInputsOutputs[sid.reference-SCRIPT_MIX_FIRST];
inputsCount = sio->inputsCount;
#if defined(SIMU) || defined(DEBUG)
filename = sd.file;
#endif
@@ -1452,15 +1492,19 @@ void luaTask(uint8_t evt)
lua_rawgeti(L, LUA_REGISTRYINDEX, sid.run);
}
else {
if (g_menuStack[0]!=menuTelemetryFrsky || sid.reference!=SCRIPT_TELEMETRY_FIRST+s_frsky_view) {
continue;
}
#if defined(SIMU) || defined(DEBUG)
filename = "[telem]";
#endif
lua_rawgeti(L, LUA_REGISTRYINDEX, sid.run);
if (g_menuStack[0]==menuTelemetryFrsky && sid.reference==SCRIPT_TELEMETRY_FIRST+s_frsky_view) {
lua_rawgeti(L, LUA_REGISTRYINDEX, sid.run);
lua_pushinteger(L, evt);
inputsCount = 1;
}
else if (sid.background) {
lua_rawgeti(L, LUA_REGISTRYINDEX, sid.background);
}
}
if (lua_pcall(L, sio ? sio->inputsCount : 0, sio ? sio->outputsCount : 0, 0) == 0) {
if (lua_pcall(L, inputsCount, sio ? sio->outputsCount : 0, 0) == 0) {
if (sio) {
for (int j=sio->outputsCount-1; j>=0; j--) {
if (!lua_isnumber(L, -1)) {
@@ -1488,38 +1532,19 @@ void luaTask(uint8_t evt)
luaFree(sid);
}
else {
sid.memory += lua_gc(L, LUA_GCCOUNT, 0) - prev_mem;
if (instructionsPercent > sid.instructions) {
sid.instructions = instructionsPercent;
}
}
}
}
if (lua_gc(L, LUA_GCCOUNT, 0) > SCRIPTS_MAX_HEAP) {
uint8_t max_memory = 0;
int8_t max_idx = -1;
for (int i=0; i<MAX_SCRIPTS; i++) {
ScriptInternalData & sid = scriptInternalData[i];
if (sid.state == SCRIPT_OK && sid.memory > max_memory && sid.memory > 15) {
max_idx = i;
}
}
if (max_idx >= 0) {
ScriptInternalData & sid = scriptInternalData[max_idx];
TRACE("Script %d killed", max_idx);
// TODO Global Warning
sid.state = SCRIPT_LEAK;
luaFree(sid);
}
}
}
lua_gc(L, LUA_GCCOLLECT, 0);
#if defined(SIMU) || defined(DEBUG)
static int lastgc = 0;
int gc = 1000*lua_gc(L, LUA_GCCOUNT, 0) + lua_gc(L, LUA_GCCOUNTB, 0);
int gc = luaGetMemUsed();
if (gc != lastgc) {
lastgc = gc;
TRACE("GC Use: %dbytes", gc);
@@ -1531,3 +1556,8 @@ void luaTask(uint8_t evt)
maxLuaDuration = t0;
}
}
int luaGetMemUsed()
{
return 1000*lua_gc(L, LUA_GCCOUNT, 0) + lua_gc(L, LUA_GCCOUNTB, 0);
}
+2 -2
View File
@@ -469,7 +469,7 @@ void evalInputs(uint8_t mode)
if (ch < NUM_STICKS) { //only do this for sticks
#if defined(PCBTARANIS)
if (mode & e_perout_mode_nosticks) {
calibratedStick[ch] = 0;
v = calibratedStick[ch] = 0;
}
#endif
@@ -533,7 +533,7 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
{
evalInputs(mode);
evalLogicalSwitches(mode==e_perout_mode_normal);
if (tick10ms) evalLogicalSwitches(mode==e_perout_mode_normal);
#if defined(MODULE_ALWAYS_SEND_PULSES)
checkStartupWarnings();
+26 -28
View File
@@ -142,6 +142,12 @@
#define NUM_CAL_PPM 4
#if defined(PCBTARANIS)
#define LEN_MODEL_NAME 12
#define LEN_BITMAP_NAME 10
#define LEN_EXPOMIX_NAME 8
#define LEN_FP_NAME 10
#define LEN_CHANNEL_NAME 6
#define LEN_INPUT_NAME 4
enum CurveType {
CURVE_TYPE_STANDARD,
CURVE_TYPE_CUSTOM,
@@ -153,17 +159,22 @@ PACK(typedef struct t_CurveInfo {
uint8_t spare:4;
int8_t points;
}) CurveInfo;
#define MAX_CURVES 32
#define NUM_POINTS 512
#define CURVDATA CurveInfo
#define MAX_CURVES 32
#define NUM_POINTS 512
#define CURVDATA CurveInfo
#elif defined(CPUARM)
#define MAX_CURVES 16
#define NUM_POINTS 512
#define CURVDATA int16_t
#define LEN_MODEL_NAME 10
#define LEN_EXPOMIX_NAME 6
#define LEN_FP_NAME 6
#define MAX_CURVES 16
#define NUM_POINTS 512
#define CURVDATA int16_t
#else
#define MAX_CURVES 8
#define NUM_POINTS (112-MAX_CURVES)
#define CURVDATA int8_t
#define LEN_MODEL_NAME 10
#define LEN_FP_NAME 6
#define MAX_CURVES 8
#define NUM_POINTS (112-MAX_CURVES)
#define CURVDATA int8_t
#endif
#if defined(PCBTARANIS) || defined(PCBSKY9X)
@@ -276,8 +287,8 @@ enum BeeperMode {
#if defined(PCBTARANIS)
enum uartModes {
UART_MODE_NONE,
UART_MODE_SPORT,
// UART_MODE_VIRTUAL_SP2UART,
UART_MODE_TELEMETRY_MIRROR,
UART_MODE_TELEMETRY,
#if defined(DEBUG)
UART_MODE_DEBUG,
#endif
@@ -326,7 +337,7 @@ PACK(typedef struct t_ScriptData {
TRAINER_MODULE
};
#define MODELDATA_BITMAP char bitmap[LEN_BITMAP_NAME];
#define MODELDATA_EXTRA uint8_t externalModule; uint8_t trainerMode; ModuleData moduleData[NUM_MODULES+1]; char curveNames[MAX_CURVES][6]; ScriptData scriptsData[MAX_SCRIPTS]; char inputNames[MAX_INPUTS][4]; uint8_t nPotsToWarn; int8_t potPosition[NUM_POTS]; uint8_t spare[2];
#define MODELDATA_EXTRA uint8_t externalModule; uint8_t trainerMode; ModuleData moduleData[NUM_MODULES+1]; char curveNames[MAX_CURVES][6]; ScriptData scriptsData[MAX_SCRIPTS]; char inputNames[MAX_INPUTS][LEN_INPUT_NAME]; uint8_t nPotsToWarn; int8_t potPosition[NUM_POTS]; uint8_t spare[2];
#define LIMITDATA_EXTRA char name[LEN_CHANNEL_NAME]; int8_t curve;
#define swstate_t uint16_t
#elif defined(PCBSKY9X)
@@ -443,21 +454,6 @@ PACK(typedef struct t_EEGeneral {
#define SWITCHES_DELAY_NONE (-15)
#define HAPTIC_STRENGTH() (3+g_eeGeneral.hapticStrength)
#if defined(PCBTARANIS)
#define LEN_MODEL_NAME 12
#define LEN_BITMAP_NAME 10
#define LEN_EXPOMIX_NAME 8
#define LEN_FP_NAME 10
#define LEN_CHANNEL_NAME 6
#elif defined(PCBSKY9X)
#define LEN_MODEL_NAME 10
#define LEN_EXPOMIX_NAME 6
#define LEN_FP_NAME 6
#else
#define LEN_MODEL_NAME 10
#define LEN_FP_NAME 6
#endif
#if defined(PCBTARANIS)
enum CurveRefType {
CURVE_REF_DIFF,
@@ -1699,8 +1695,10 @@ enum ThrottleSources {
enum TelemetryProtocol
{
PROTOCOL_FRSKY_SPORT,
PROTOCOL_TELEMETRY_FIRST,
PROTOCOL_FRSKY_SPORT = PROTOCOL_TELEMETRY_FIRST,
PROTOCOL_FRSKY_D,
PROTOCOL_FRSKY_D_SECONDARY
};
PACK(typedef struct t_ModelData {
+116 -43
View File
@@ -701,30 +701,36 @@ void setGVarValue(uint8_t idx, int16_t value, int8_t phase)
#endif
#if defined(FRSKY)
#if defined(CPUARM) && defined(FRSKY)
ls_telemetry_value_t minTelemValue(uint8_t channel)
{
switch (channel) {
case TELEM_FUEL:
#if defined(CPUARM)
case TELEM_TX_TIME:
case TELEM_SWR:
#endif
case TELEM_RSSI_TX:
case TELEM_RSSI_RX:
return 0;
case TELEM_HDG:
return 0;
#if defined(CPUARM)
default:
return -30000;
#else
case TELEM_TIMER1:
case TELEM_TIMER2:
return -3600;
case TELEM_ALT:
case TELEM_MIN_ALT:
case TELEM_MAX_ALT:
case TELEM_GPSALT:
return -500;
case TELEM_T1:
case TELEM_MAX_T1:
case TELEM_T2:
case TELEM_MAX_T2:
return -30;
case TELEM_ACCx:
case TELEM_ACCy:
case TELEM_ACCz:
return -1000;
case TELEM_VSPEED:
return -3000;
default:
return 0;
#endif
}
}
#endif
#if defined(FRSKY)
ls_telemetry_value_t maxTelemValue(uint8_t channel)
{
switch (channel) {
@@ -745,6 +751,25 @@ ls_telemetry_value_t maxTelemValue(uint8_t channel)
case TELEM_HDG:
return 180;
#if defined(CPUARM)
case TELEM_SPEED:
case TELEM_MAX_SPEED:
case TELEM_ASPEED:
case TELEM_MAX_ASPEED:
return 2000;
case TELEM_CELL:
case TELEM_MIN_CELL:
return 510;
case TELEM_CELLS_SUM:
case TELEM_MIN_CELLS_SUM:
case TELEM_VFAS:
case TELEM_MIN_VFAS:
return 1000;
case TELEM_VSPEED:
return 3000;
case TELEM_ACCx:
case TELEM_ACCy:
case TELEM_ACCz:
return 1000;
default:
return 30000;
#else
@@ -813,6 +838,10 @@ getvalue_t convert8bitsTelemValue(uint8_t channel, ls_telemetry_value_t value)
break;
case TELEM_CELL:
case TELEM_HDG:
case TELEM_ASPEED:
case TELEM_MAX_ASPEED:
case TELEM_SPEED:
case TELEM_MAX_SPEED:
result = value * 2;
break;
case TELEM_DIST:
@@ -2483,7 +2512,7 @@ void opentxClose()
#endif
#if defined(PCBTARANIS) && !defined(SIMU)
#if defined(USB_JOYSTICK) && defined(PCBTARANIS) && !defined(SIMU)
extern USB_OTG_CORE_HANDLE USB_OTG_dev;
/*
@@ -2517,7 +2546,7 @@ void usbJoystickUpdate(void)
USBD_HID_SendReport (&USB_OTG_dev, HID_Buffer, HID_IN_PACKET );
}
#endif //#if defined(PCBTARANIS) && !defined(SIMU)
#endif //#if defined(USB_JOYSTICK) && defined(PCBTARANIS) && !defined(SIMU)
void perMain()
@@ -2674,10 +2703,17 @@ void perMain()
#if defined(PCBTARANIS) && !defined(SIMU)
static bool usbStarted = false;
if (!usbStarted && usbPlugged()) {
#if defined(USB_MASS_STORAGE)
opentxClose();
#endif
usbStart();
#if defined(USB_MASS_STORAGE)
usbPluggedIn();
#endif
usbStarted = true;
}
#if defined(USB_JOYTICK)
if (usbStarted) {
if (!usbPlugged()) {
//disable USB
@@ -2688,6 +2724,8 @@ void perMain()
usbJoystickUpdate();
}
}
#endif
#endif //#if defined(PCBTARANIS) && !defined(SIMU)
#if defined(NAVIGATION_STICKS)
@@ -2754,31 +2792,40 @@ void perMain()
StickScrollAllowed = 1 ;
#endif
const char *warn = s_warning;
uint8_t menu = s_menu_count;
if (!LCD_LOCKED()) {
#if defined(USB_MASS_STORAGE)
if (usbPlugged()) {
lcd_clear();
g_menuStack[g_menuStackPtr]((warn || menu) ? 0 : evt);
if (warn) DISPLAY_WARNING(evt);
#if defined(NAVIGATION_MENUS)
if (menu) {
const char * result = displayMenu(evt);
if (result) {
menuHandler(result);
putEvent(EVT_MENU_UP);
}
}
#endif
#if defined(LUA)
evt = 0;
#endif
menuMainView(0);
}
else
#endif
{
const char *warn = s_warning;
uint8_t menu = s_menu_count;
if (!LCD_LOCKED()) {
lcd_clear();
g_menuStack[g_menuStackPtr]((warn || menu) ? 0 : evt);
}
#if defined(LUA)
luaTask(evt);
luaTask(evt);
#endif
if (!LCD_LOCKED()) {
if (warn) DISPLAY_WARNING(evt);
#if defined(NAVIGATION_MENUS)
if (menu) {
const char * result = displayMenu(evt);
if (result) {
menuHandler(result);
putEvent(EVT_MENU_UP);
}
}
#endif
}
}
drawStatusLine();
lcdRefresh();
@@ -3041,24 +3088,50 @@ void instantTrim()
AUDIO_WARNING2();
}
void copyTrimsToOffset(uint8_t ch)
void copySticksToOffset(uint8_t ch)
{
pauseMixerCalculations();
int32_t zero = (int32_t)channelOutputs[ch];
evalFlightModeMixes(e_perout_mode_nosticks+e_perout_mode_notrainer, 0);
int32_t val = chans[ch];
LimitData *ld = limitAddress(ch);
limit_min_max_t lim = LIMIT_MAX(ld);
limit_min_max_t lim = LIMIT_MIN(ld);
if (val < 0) {
val = -val;
lim = LIMIT_MIN(ld);
}
#if defined(CPUARM)
zero = (zero*100000 - val*lim) / (102400-val);
zero = (zero*256000 - val*lim) / (1024*256-val);
#else
zero = (zero*100000 - 10*val*lim) / (102400-val);
zero = (zero*25600 - val*lim) / (26214-val);
#endif
ld->offset = (ld->revert) ? -zero : zero;
ld->offset = (ld->revert ? -zero : zero);
resumeMixerCalculations();
eeDirty(EE_MODEL);
}
void copyTrimsToOffset(uint8_t ch)
{
int16_t zero;
pauseMixerCalculations();
evalFlightModeMixes(e_perout_mode_noinput, 0); // do output loop - zero input sticks and trims
zero = applyLimits(ch, chans[ch]);
evalFlightModeMixes(e_perout_mode_noinput-e_perout_mode_notrims, 0); // do output loop - only trims
int16_t output = applyLimits(ch, chans[ch]) - zero;
int16_t v = g_model.limitData[ch].offset;
if (g_model.limitData[ch].revert) output = -output;
#if defined(CPUARM)
v += (output * 125) / 128;
#else
v += output;
#endif
g_model.limitData[ch].offset = limit((int16_t)-1000, (int16_t)v, (int16_t)1000); // make sure the offset doesn't go haywire
resumeMixerCalculations();
eeDirty(EE_MODEL);
}
@@ -3289,7 +3362,7 @@ inline void opentxInit(OPENTX_INIT_ARGS)
backlightOn();
#if defined(PCBTARANIS)
uart3Init(g_eeGeneral.uart3Mode);
uart3Init(g_eeGeneral.uart3Mode, g_model.telemetryProtocol);
#endif
#if defined(CPUARM)
+25 -21
View File
@@ -1177,6 +1177,7 @@ void incSubtrim(uint8_t idx, int16_t inc);
void instantTrim();
FORCEINLINE void evalTrims();
void copyTrimsToOffset(uint8_t ch);
void copySticksToOffset(uint8_t ch);
void moveTrimsToOffsets();
void evalFunctions();
@@ -1318,6 +1319,21 @@ enum AUDIO_SOUNDS {
#endif
AU_TX_BATTERY_LOW,
AU_INACTIVITY,
#if defined(CPUARM)
AU_A1_ORANGE,
AU_A1_RED,
AU_A2_ORANGE,
AU_A2_RED,
AU_A3_ORANGE,
AU_A3_RED,
AU_A4_ORANGE,
AU_A4_RED,
AU_RSSI_ORANGE,
AU_RSSI_RED,
AU_SWR_RED,
AU_TELEMETRY_LOST,
AU_TELEMETRY_BACK,
#endif
#if defined(PCBSKY9X)
AU_TX_MAH_HIGH,
AU_TX_TEMP_HIGH,
@@ -1361,21 +1377,6 @@ enum AUDIO_SOUNDS {
AU_TIMER_LT10,
AU_TIMER_20,
AU_TIMER_30,
#if defined(CPUARM)
AU_A1_ORANGE,
AU_A1_RED,
AU_A2_ORANGE,
AU_A2_RED,
AU_A3_ORANGE,
AU_A3_RED,
AU_A4_ORANGE,
AU_A4_RED,
AU_RSSI_ORANGE,
AU_RSSI_RED,
AU_SWR_RED,
AU_TELEMETRY_LOST,
AU_TELEMETRY_BACK,
#endif
AU_FRSKY_FIRST,
AU_FRSKY_BEEP1 = AU_FRSKY_FIRST,
AU_FRSKY_BEEP2,
@@ -1449,8 +1450,7 @@ enum AUDIO_SOUNDS {
SCRIPT_OK,
SCRIPT_NOFILE,
SCRIPT_SYNTAX_ERROR,
SCRIPT_KILLED,
SCRIPT_LEAK
SCRIPT_KILLED
};
enum ScriptReference {
SCRIPT_MIX_FIRST,
@@ -1458,14 +1458,14 @@ enum AUDIO_SOUNDS {
SCRIPT_FUNC_FIRST,
SCRIPT_FUNC_LAST=SCRIPT_FUNC_FIRST+MAX_SCRIPTS-1,
SCRIPT_TELEMETRY_FIRST,
SCRIPT_TELEMETRY_LAST=SCRIPT_TELEMETRY_FIRST+MAX_SCRIPTS-1,
SCRIPT_TELEMETRY_LAST=SCRIPT_TELEMETRY_FIRST+MAX_SCRIPTS, // telem0 and telem1 .. telem7
};
struct ScriptInternalData {
uint8_t reference;
uint8_t state;
int run;
int background;
uint8_t instructions;
uint8_t memory;
};
struct ScriptInputsOutputs {
uint8_t inputsCount;
@@ -1485,7 +1485,7 @@ enum AUDIO_SOUNDS {
void luaExec(const char *filename);
void luaLoadMixScript(uint8_t index);
void luaLoadMixScripts();
#define luaGetMemUsed(idx) scriptInternalData[idx].memory
int luaGetMemUsed();
#define luaGetCpuUsed(idx) scriptInternalData[idx].instructions
bool isTelemetryScriptAvailable(uint8_t index);
#define LUA_INIT()
@@ -1513,7 +1513,7 @@ union ReusableBuffer
uint16_t eepromfree;
#if defined(SDCARD)
char menu_bss[MENU_MAX_LINES][MENU_LINE_LENGTH];
char mainname[42]; // because reused for SD backup / restore
char mainname[45]; // because reused for SD backup / restore, max backup filename 44 chars: "/MODELS/MODEL0134353-2014-06-19-04-51-27.bin"
#else
char mainname[LEN_MODEL_NAME];
#endif
@@ -1698,4 +1698,8 @@ void varioWakeup();
extern const pm_uchar logo_taranis[];
#endif
#if defined(USB_MASS_STORAGE)
extern void usbPluggedIn();
#endif
#endif
+7 -1
View File
@@ -39,6 +39,9 @@
#include <fcntl.h>
#include <stdarg.h>
#include <sys/stat.h>
#if defined(RTCLOCK)
#include <time.h>
#endif
#if defined WIN32 || !defined __GNUC__
#include <direct.h>
@@ -352,7 +355,10 @@ void StartMainThread(bool tests)
#endif
g_tmr10ms = 0;
#if defined(RTCLOCK)
g_rtcTime = time(0);
#endif
main_thread_running = (tests ? 1 : 2);
pthread_create(&main_thread_pid, NULL, &main_thread, NULL);
}
+4 -23
View File
@@ -36,29 +36,12 @@
#include "../../opentx.h"
#if defined(DEBUG) && !defined(SIMU)
void DEBUG_UART_Configure( uint32_t baudrate, uint32_t masterClock);
void DEBUG_UART_Stop();
#else
#define DEBUG_UART_Stop()
#define DEBUG_UART_Configure(...)
#endif
uint16_t ResetReason;
uint32_t Master_frequency ;
volatile uint32_t Tenms ;
volatile uint8_t lcdLock;
volatile uint32_t lcdInputs;
/** Console baudrate 9600. */
#define CONSOLE_BAUDRATE 9600
/** Usart Hw interface used by the console (UART0). */
#define CONSOLE_USART UART0
/** Usart Hw ID used by the console (UART0). */
#define CONSOLE_ID ID_UART0
/** Pins description corresponding to Rxd,Txd, (UART pins) */
#define CONSOLE_PINS {PINS_UART}
extern "C" void sam_boot( void ) ;
// Prototype
@@ -124,7 +107,6 @@ inline void setup_switches()
inline void UART3_Configure(uint32_t baudrate, uint32_t masterClock)
{
// const Pin pPins[] = CONSOLE_PINS;
register Uart *pUart = BT_USART;
/* Configure PIO */
@@ -493,11 +475,13 @@ void opentxBootloader();
// Need PA3 and PA4 set to peripheral A
void i2cInit()
{
register Pio *pioptr ;
register uint32_t timing ;
register Pio *pioptr;
register uint32_t timing;
PMC->PMC_PCER0 |= 0x00080000L ; // Enable peripheral clock to TWI0
TWI0->TWI_CR = TWI_CR_SWRST ; // Reset in case we are restarting
/* Configure PIO */
pioptr = PIOA ;
pioptr->PIO_ABCDSR[0] &= ~0x00000018 ; // Peripheral A
@@ -589,9 +573,6 @@ void boardInit()
PMC->PMC_SCER |= 0x0400 ; // PCK2 enabled
PMC->PMC_PCK[2] = 2 ; // PCK2 is PLLA
DEBUG_UART_Configure( 9600, Master_frequency ) ;
UART3_Configure( 9600, Master_frequency ) ; // TODO not needed, done after ...
start_timer2() ;
start_timer0() ;
adcInit() ;
+4
View File
@@ -291,4 +291,8 @@ void telemetryPortInit(uint32_t baudrate);
uint32_t telemetryTransmitPending();
void telemetryTransmitBuffer(uint8_t * buffer, uint32_t size);
// Second UART driver
void telemetrySecondPortInit(unsigned int protocol);
uint16_t telemetrySecondPortReceive();
#endif
+4 -6
View File
@@ -45,21 +45,19 @@ extern uint8_t *dsm2StreamPtr;
void module_output_active()
{
register Pio *pioptr ;
pioptr = PIOA ;
register Pio *pioptr = PIOA ;
pioptr->PIO_ABCDSR[0] &= ~PIO_PA17 ; // Peripheral C
pioptr->PIO_ABCDSR[1] |= PIO_PA17 ; // Peripheral C
pioptr->PIO_PDR = PIO_PA17 ; // Disable bit A17 Assign to peripheral
pioptr->PIO_MDER = PIO_PA17 ; // Open Drain O/p in A17
// pioptr->PIO_MDDR = PIO_PA17 ; // Push Pull O/p in A17
#if defined(REVX)
pioptr->PIO_MDER = PIO_PA17 ; // Open Drain O/p in A17
pioptr->PIO_PUER = PIO_PA17 ; // With pull up
#endif
}
void init_main_ppm(uint32_t period, uint32_t out_enable)
{
register Pio *pioptr ;
register Pwm *pwmptr ;
setupPulsesPPM(EXTERNAL_MODULE) ;
@@ -34,9 +34,16 @@
*
*/
#include "../opentx.h"
#include "../../opentx.h"
#include <stdarg.h>
/** Usart Hw interface used by the console (UART0). */
#define SECOND_SERIAL_UART UART0
/** Usart Hw ID used by the console (UART0). */
#define SECOND_SERIAL_ID ID_UART0
/** Pins description corresponding to Rxd,Txd, (UART pins) */
#define SECOND_SERIAL_PINS {PINS_UART}
#if !defined(SIMU)
extern Fifo<512> debugRxFifo;
@@ -49,7 +56,7 @@ extern Fifo<512> debugRxFifo;
*/
void debugPutc(const char c)
{
Uart *pUart = CONSOLE_USART;
Uart *pUart = SECOND_SERIAL_UART;
/* Wait for the transmitter to be ready */
while ( (pUart->UART_SR & UART_SR_TXEMPTY) == 0 ) ;
@@ -65,22 +72,22 @@ void debugPutc(const char c)
* masterClock Frequency of the system master clock (in Hz).
* uses PA9 and PA10, RXD2 and TXD2
*/
void DEBUG_UART_Configure( uint32_t baudrate, uint32_t masterClock)
void SECOND_UART_Configure(uint32_t baudrate, uint32_t masterClock)
{
register Uart *pUart = CONSOLE_USART;
register Uart *pUart = SECOND_SERIAL_UART;
/* Configure PIO */
configure_pins( (PIO_PA9 | PIO_PA10), PIN_PERIPHERAL | PIN_INPUT | PIN_PER_A | PIN_PORTA | PIN_NO_PULLUP ) ;
/* Configure PMC */
PMC->PMC_PCER0 = 1 << CONSOLE_ID;
PMC->PMC_PCER0 = 1 << SECOND_SERIAL_ID;
/* Reset and disable receiver & transmitter */
pUart->UART_CR = UART_CR_RSTRX | UART_CR_RSTTX
| UART_CR_RXDIS | UART_CR_TXDIS;
/* Configure mode */
pUart->UART_MR = 0x800 ; // NORMAL, No Parity
pUart->UART_MR = 0x800 ; // NORMAL, No Parity
/* Configure baudrate */
/* Asynchronous, no oversampling */
@@ -91,19 +98,44 @@ void DEBUG_UART_Configure( uint32_t baudrate, uint32_t masterClock)
/* Enable receiver and transmitter */
pUart->UART_CR = UART_CR_RXEN | UART_CR_TXEN;
pUart->UART_IER = UART_IER_RXRDY ;
NVIC_EnableIRQ(UART0_IRQn) ;
#if defined(DEBUG)
pUart->UART_IER = UART_IER_RXRDY;
NVIC_EnableIRQ(UART0_IRQn);
#endif
}
void DEBUG_UART_Stop()
void SECOND_UART_Stop()
{
CONSOLE_USART->UART_IDR = UART_IDR_RXRDY ;
SECOND_SERIAL_UART->UART_IDR = UART_IDR_RXRDY ;
NVIC_DisableIRQ(UART0_IRQn) ;
}
extern "C" void UART0_IRQHandler()
{
debugRxFifo.push(CONSOLE_USART->UART_RHR);
#if defined(DEBUG)
debugRxFifo.push(SECOND_SERIAL_UART->UART_RHR);
#endif
}
#else
#define SECOND_UART_Configure(...)
#endif
#if defined(FRSKY)
void telemetrySecondPortInit(unsigned int /*protocol*/)
{
SECOND_UART_Configure(FRSKY_D_BAUDRATE, Master_frequency);
startPdcUsartReceive();
}
uint16_t telemetrySecondPortReceive()
{
Uart *pUart = SECOND_SERIAL_UART;
if (pUart->UART_SR & UART_SR_RXRDY) {
return pUart->UART_RHR ;
}
return 0xFFFF ;
}
#endif
@@ -97,7 +97,7 @@ static int8_t SCSI_ReadFormatCapacity(uint8_t lun, uint8_t *params);
static int8_t SCSI_ReadCapacity10(uint8_t lun, uint8_t *params);
static int8_t SCSI_RequestSense (uint8_t lun, uint8_t *params);
static int8_t SCSI_StartStopUnit(uint8_t lun, uint8_t *params);
static int8_t SCSI_AllowRemoval(uint8_t lun, uint8_t *params);
static int8_t SCSI_AllowRemoval(uint8_t lun, uint8_t *params);
static int8_t SCSI_ModeSense6 (uint8_t lun, uint8_t *params);
static int8_t SCSI_ModeSense10 (uint8_t lun, uint8_t *params);
static int8_t SCSI_Write10(uint8_t lun , uint8_t *params);
@@ -147,7 +147,7 @@ int8_t SCSI_ProcessCmd(USB_OTG_CORE_HANDLE *pdev,
return SCSI_StartStopUnit(lun, params);
case SCSI_ALLOW_MEDIUM_REMOVAL:
return SCSI_AllowRemoval( lun, params);
return SCSI_AllowRemoval( lun, params);
case SCSI_MODE_SENSE6:
return SCSI_ModeSense6 (lun, params);
@@ -433,24 +433,29 @@ void SCSI_SenseCode(uint8_t lun, uint8_t sKey, uint8_t ASC)
* @param params: Command parameters
* @retval status
*/
extern uint8_t lunReady[] ;
extern uint8_t lunReady[] ;
static int8_t SCSI_StartStopUnit(uint8_t lun, uint8_t *params)
{
MSC_BOT_DataLen = 0;
if (lun < 2) {
if (params[4] & 1) {
// lun to be active
lunReady[lun] = 1 ;
}
else {
// lun to be ejected
lunReady[lun] = 0 ;
}
}
#if defined(BOOT)
if (lun < 2)
#else
if (lun < 1)
#endif
{
if (params[4] & 1) {
// lun to be active
lunReady[lun] = 1 ;
}
else {
// lun to be ejected
lunReady[lun] = 0 ;
}
}
return 0;
}
+8 -5
View File
@@ -113,11 +113,6 @@ extern uint16_t sessionTimer;
void delaysInit(void);
#define DEBUG_BAUDRATE 115200
void uart3Init(unsigned int mode);
void uart3Putc(const char c);
void delaysInit(void);
void delay_01us(uint16_t nb);
@@ -224,7 +219,9 @@ void turnBacklightOff(void);
int usbPlugged(void);
void usbInit(void);
void usbStart(void);
#if defined(USB_JOYSTICK)
void usbStop(void);
#endif
#ifdef __cplusplus
}
@@ -257,6 +254,12 @@ void hapticOff(void);
#define HAPTIC_ON() hapticOn()
#endif
// UART3 driver
#define DEBUG_BAUDRATE 115200
void uart3Init(unsigned int mode, unsigned int protocol);
void uart3Putc(const char c);
#define telemetrySecondPortInit(protocol) uart3Init(UART_MODE_TELEMETRY, protocol)
extern uint8_t currentTrainerMode;
#endif
@@ -40,6 +40,11 @@ extern Fifo<512> telemetryFifo;
void telemetryPortInit(uint32_t baudrate)
{
if (baudrate == 0) {
USART_DeInit(USART2);
return;
}
USART_InitTypeDef USART_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
@@ -77,6 +82,7 @@ void telemetryPortInit(uint32_t baudrate)
USART_Cmd(SPORT, ENABLE);
USART_ITConfig(SPORT, USART_IT_RXNE, ENABLE);
NVIC_EnableIRQ(USART2_IRQn);
NVIC_SetPriority(USART2_IRQn, 6);
}
+31 -6
View File
@@ -36,6 +36,10 @@
#include "../../opentx.h"
bool uart3Telemetry = false;
Fifo<512> uart3TxFifo;
extern Fifo<512> telemetryFifo;
void uart3Setup(unsigned int baudrate)
{
USART_InitTypeDef USART_InitStructure;
@@ -60,7 +64,7 @@ void uart3Setup(unsigned int baudrate)
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_InitStructure.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;
USART_Init(UART3, &USART_InitStructure);
USART_Cmd(UART3, ENABLE);
@@ -72,12 +76,13 @@ void uart3Setup(unsigned int baudrate)
NVIC_SetPriority(USART3_IRQn, 7);
}
void uart3Init(unsigned int mode)
void uart3Init(unsigned int mode, unsigned int protocol)
{
USART_DeInit(USART3);
uart3Telemetry = false;
switch(mode) {
case UART_MODE_SPORT:
switch (mode) {
case UART_MODE_TELEMETRY_MIRROR:
uart3Setup(FRSKY_SPORT_BAUDRATE);
break;
#if defined(DEBUG)
@@ -85,11 +90,15 @@ void uart3Init(unsigned int mode)
uart3Setup(DEBUG_BAUDRATE);
break;
#endif
case UART_MODE_TELEMETRY:
if (protocol == PROTOCOL_FRSKY_D_SECONDARY) {
uart3Setup(FRSKY_D_BAUDRATE);
uart3Telemetry = true;
}
break;
}
}
Fifo<512> uart3TxFifo;
void uart3Putc(const char c)
{
uart3TxFifo.push(c);
@@ -105,8 +114,11 @@ void debugPutc(const char c)
}
#endif
#define USART_FLAG_ERRORS (USART_FLAG_ORE | USART_FLAG_NE | USART_FLAG_FE | USART_FLAG_PE)
extern "C" void USART3_IRQHandler(void)
{
// Send
if (USART_GetITStatus(UART3, USART_IT_TXE) != RESET) {
uint8_t txchar;
if (uart3TxFifo.pop(txchar)) {
@@ -117,4 +129,17 @@ extern "C" void USART3_IRQHandler(void)
USART_ITConfig(UART3, USART_IT_TXE, DISABLE);
}
}
// Receive
uint32_t status = SPORT->SR;
while (status & (USART_FLAG_RXNE | USART_FLAG_ERRORS)) {
uint8_t data = SPORT->DR;
if (uart3Telemetry && !(status & USART_FLAG_ERRORS)) {
telemetryFifo.push(data);
}
status = SPORT->SR;
}
}
+9 -1
View File
@@ -43,6 +43,7 @@ int usbPlugged(void)
//debounce
static uint8_t debounced_state = 0;
static uint8_t last_state = 0;
if ( GPIO_ReadInputDataBit(GPIOA, PIN_FS_VBUS) ) {
if (last_state) debounced_state = 1;
last_state = 1;
@@ -69,16 +70,23 @@ void usbInit(void)
void usbStart(void)
{
#if !defined(BOOT)
#if defined(USB_JOYSTICK)
//intialize USB as HID device
USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_HID_cb, &USR_cb);
#elif defined(USB_MASS_STORAGE)
//intialize USB as MSC device
USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_MSC_cb, &USR_cb);
#endif
#else
//intialize USB as MSC device
USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_MSC_cb, &USR_cb);
#endif //!defined(BOOT)
}
#if defined(USB_JOYSTICK)
void usbStop(void)
{
USBD_DeInit(&USB_OTG_dev);
}
#endif
+7
View File
@@ -68,10 +68,17 @@
#define USBD_CONFIGURATION_FS_STRING "MSC Config"
#define USBD_INTERFACE_FS_STRING "MSC Interface"
#else
#if defined(USB_JOYSTICK)
#define USBD_PID 0x5710
#define USBD_PRODUCT_FS_STRING "FrSky Taranis Joystick"
#define USBD_CONFIGURATION_FS_STRING "HID Config"
#define USBD_INTERFACE_FS_STRING "HID Interface"
#elif defined(USB_MASS_STORAGE)
#define USBD_PID 0x5720
#define USBD_PRODUCT_FS_STRING "FrSky Taranis Mass Storage"
#define USBD_CONFIGURATION_FS_STRING "MSC Config"
#define USBD_INTERFACE_FS_STRING "MSC Interface"
#endif
#endif
USBD_DEVICE USR_desc =
+34 -8
View File
@@ -35,7 +35,12 @@ extern "C" {
#include "usbd_msc_mem.h"
#include "usb_conf.h"
#if defined(BOOT)
#define STORAGE_LUN_NBR 2
#else
/* SD card only when not running bootloader */
#define STORAGE_LUN_NBR 1
#endif
#define BLOCKSIZE 512
/* USB Mass storage Standard Inquiry Data */
@@ -54,6 +59,7 @@ const unsigned char STORAGE_Inquirydata[] = {//36
'T', 'a', 'r', 'a', 'n', 'i', 's', ' ', /* Product : 16 Bytes */
'R', 'a', 'd', 'i', 'o', ' ', ' ', ' ',
'1', '.', '0', '0', /* Version : 4 Bytes */
#if defined(BOOT)
/* LUN 1 */
0x00,
0x80,
@@ -67,10 +73,13 @@ const unsigned char STORAGE_Inquirydata[] = {//36
'T', 'a', 'r', 'a', 'n', 'i', 's', ' ', /* Product : 16 Bytes */
'R', 'a', 'd', 'i', 'o', ' ', ' ', ' ',
'1', '.', '0' ,'0', /* Version : 4 Bytes */
#endif
};
#if defined(BOOT)
int32_t fat12Write( const uint8_t *buffer, uint16_t sector, uint32_t count ) ;
int32_t fat12Read( uint8_t *buffer, uint16_t sector, uint16_t count ) ;
#endif
int8_t STORAGE_Init (uint8_t lun);
@@ -137,11 +146,14 @@ int8_t STORAGE_Init (uint8_t lun)
*/
int8_t STORAGE_GetCapacity (uint8_t lun, uint32_t *block_num, uint32_t *block_size)
{
#if defined(BOOT)
if (lun == 1) {
*block_size = BLOCKSIZE;
*block_num = 3 + EESIZE/BLOCKSIZE + FLASHSIZE/BLOCKSIZE;
}
else {
else
#endif
{
if (!SD_CARD_PRESENT())
return -1;
@@ -161,17 +173,22 @@ int8_t STORAGE_GetCapacity (uint8_t lun, uint32_t *block_num, uint32_t *block_si
return 0;
}
#if defined(BOOT)
uint8_t lunReady[2] ;
#else
uint8_t lunReady[1] ;
#endif
void usbPluggedIn()
{
if (lunReady[0] == 0) {
lunReady[0] = 1;
}
#if defined(BOOT)
if (lunReady[1] == 0) {
lunReady[1] = 1;
}
#endif
}
/**
@@ -181,13 +198,16 @@ void usbPluggedIn()
*/
int8_t STORAGE_IsReady (uint8_t lun)
{
#if defined(BOOT)
if (lun == 1) {
if (lunReady[1] == 0) {
return -1 ;
}
return 0 ;
}
else {
else
#endif
{
if (lunReady[0] == 0) {
return -1 ;
}
@@ -221,11 +241,14 @@ int8_t STORAGE_Read (uint8_t lun,
uint32_t blk_addr,
uint16_t blk_len)
{
#if defined(BOOT)
if (lun == 1) {
if (fat12Read(buf, blk_addr, blk_len) != 0)
return -1;
}
else {
else
#endif
{
if (SD_ReadSectors(buf, blk_addr, blk_len) != 0) {
return -1;
}
@@ -249,11 +272,14 @@ int8_t STORAGE_Write (uint8_t lun,
uint32_t blk_addr,
uint16_t blk_len)
{
#if defined(BOOT)
if (lun == 1) {
if (fat12Write(buf, blk_addr, blk_len) != 0)
return -1;
}
else {
else
#endif
{
if (SD_WriteSectors(buf, blk_addr, blk_len) != 0)
return -1;
}
@@ -269,10 +295,10 @@ int8_t STORAGE_Write (uint8_t lun,
int8_t STORAGE_GetMaxLun (void)
{
return (STORAGE_LUN_NBR - 1);
return STORAGE_LUN_NBR - 1;
}
#if defined(BOOT)
//------------------------------------------------------------------------------
/**
* FAT12 boot sector partition.
@@ -766,5 +792,5 @@ int32_t fat12Write(const uint8_t *buffer, uint16_t sector, uint32_t count )
}
return 0 ;
}
#endif
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+3
View File
@@ -119,6 +119,9 @@ void USBD_USR_DeviceConnected (void)
*/
void USBD_USR_DeviceDisconnected (void)
{
#if !defined(BOOT) && defined(USB_MASS_STORAGE)
NVIC_SystemReset();
#endif
}
+21 -10
View File
@@ -161,7 +161,7 @@ NOINLINE void processSerialData(uint8_t data)
#endif
#if defined(PCBTARANIS)
if (g_eeGeneral.uart3Mode == UART_MODE_SPORT) {
if (g_eeGeneral.uart3Mode == UART_MODE_TELEMETRY_MIRROR) {
uart3Putc(data);
}
#endif
@@ -303,7 +303,16 @@ void telemetryWakeup()
#endif
}
#elif defined(PCBSKY9X)
rxPdcUsart(processSerialData); // Receive serial data here
if (telemetryProtocol == PROTOCOL_FRSKY_D_SECONDARY) {
uint16_t data ;
while ((data=telemetrySecondPortReceive()) != 0xFFFF) {
processSerialData(data);
}
}
else {
// Receive serial data here
rxPdcUsart(processSerialData);
}
#endif
#if !defined(PCBTARANIS)
@@ -572,17 +581,19 @@ void telemetryReset()
void telemetryInit(void)
{
#if defined(CPUARM)
if (telemetryProtocol == PROTOCOL_FRSKY_SPORT)
telemetryPortInit(FRSKY_SPORT_BAUDRATE);
else
if (telemetryProtocol == PROTOCOL_FRSKY_D) {
telemetryPortInit(FRSKY_D_BAUDRATE);
}
else if (telemetryProtocol==PROTOCOL_FRSKY_D_SECONDARY) {
telemetryPortInit(0);
telemetrySecondPortInit(PROTOCOL_FRSKY_D_SECONDARY);
}
else {
telemetryPortInit(FRSKY_SPORT_BAUDRATE);
}
#elif !defined(SIMU)
telemetryPortInit();
#endif
#if 0
// if we call telemetryReset() here we also reset the consumption after model load
// right now I don't see why we call it here
telemetryReset();
#endif
// we don't reset the telemetry here as we would also reset the consumption after model load
}
+6 -4
View File
@@ -344,8 +344,8 @@ enum AlarmLevel {
#define TELEMETRY_BARO_ALT_ARGS frskyData.hub.baroAltitude < 0 ? '-' : ' ', abs(baroAltitudeDivision.quot), abs(baroAltitudeDivision.rem),
#define TELEMETRY_GPS_ALT_FORMAT "%c%d.%02d,"
#define TELEMETRY_GPS_ALT_ARGS frskyData.hub.gpsAltitude < 0 ? '-' : ' ', abs(frskyData.hub.gpsAltitude / 100), abs(frskyData.hub.gpsAltitude % 100),
#define TELEMETRY_GPS_SPEED_UNIT (IS_IMPERIAL_ENABLE() ? SPEED_UNIT_IMP : SPEED_UNIT_METR)
#define TELEMETRY_GPS_SPEED_FORMAT "%d,"
#define TELEMETRY_SPEED_UNIT (IS_IMPERIAL_ENABLE() ? SPEED_UNIT_IMP : SPEED_UNIT_METR)
#define TELEMETRY_SPEED_FORMAT "%d,"
#define TELEMETRY_GPS_SPEED_ARGS getConvertedTelemetryValue(frskyData.hub.gpsSpeed_bp, UNIT_KTS),
#if defined(CPUARM)
#define TELEMETRY_CELLS_ARGS frskyData.hub.cellsSum / 10, frskyData.hub.cellsSum % 10, TELEMETRY_CELL_VOLTAGE(0)/100, TELEMETRY_CELL_VOLTAGE(0)%100, TELEMETRY_CELL_VOLTAGE(1)/100, TELEMETRY_CELL_VOLTAGE(1)%100, TELEMETRY_CELL_VOLTAGE(2)/100, TELEMETRY_CELL_VOLTAGE(2)%100, TELEMETRY_CELL_VOLTAGE(3)/100, TELEMETRY_CELL_VOLTAGE(3)%100, TELEMETRY_CELL_VOLTAGE(4)/100, TELEMETRY_CELL_VOLTAGE(4)%100, TELEMETRY_CELL_VOLTAGE(5)/100, TELEMETRY_CELL_VOLTAGE(5)%100, TELEMETRY_CELL_VOLTAGE(6)/100, TELEMETRY_CELL_VOLTAGE(6)%100, TELEMETRY_CELL_VOLTAGE(7)/100, TELEMETRY_CELL_VOLTAGE(7)%100, TELEMETRY_CELL_VOLTAGE(8)/100, TELEMETRY_CELL_VOLTAGE(8)%100, TELEMETRY_CELL_VOLTAGE(9)/100, TELEMETRY_CELL_VOLTAGE(9)%100, TELEMETRY_CELL_VOLTAGE(10)/100, TELEMETRY_CELL_VOLTAGE(10)%100, TELEMETRY_CELL_VOLTAGE(11)/100, TELEMETRY_CELL_VOLTAGE(11)%100,
@@ -362,6 +362,7 @@ enum AlarmLevel {
#define TELEMETRY_VFAS_ARGS frskyData.hub.vfas / 10, frskyData.hub.vfas % 10,
#define TELEMETRY_VSPEED_FORMAT "%c%d.%02d,"
#define TELEMETRY_VSPEED_ARGS frskyData.hub.varioSpeed < 0 ? '-' : ' ', abs(frskyData.hub.varioSpeed / 100), abs(frskyData.hub.varioSpeed % 100),
#define TELEMETRY_ASPEED_ARGS getConvertedTelemetryValue(frskyData.hub.airSpeed, UNIT_KTS),
#define TELEMETRY_OPENXSENSOR() (0)
#else
#define TELEMETRY_STREAMING() (frskyStreaming > 0)
@@ -382,8 +383,8 @@ enum AlarmLevel {
#define TELEMETRY_BARO_ALT_ARGS frskyData.hub.baroAltitude_bp,
#define TELEMETRY_GPS_ALT_FORMAT "%d,"
#define TELEMETRY_GPS_ALT_ARGS frskyData.hub.gpsAltitude_bp,
#define TELEMETRY_GPS_SPEED_UNIT (IS_IMPERIAL_ENABLE() ? SPEED_UNIT_IMP : SPEED_UNIT_METR)
#define TELEMETRY_GPS_SPEED_FORMAT "%d,"
#define TELEMETRY_SPEED_UNIT (IS_IMPERIAL_ENABLE() ? SPEED_UNIT_IMP : SPEED_UNIT_METR)
#define TELEMETRY_SPEED_FORMAT "%d,"
#define TELEMETRY_GPS_SPEED_ARGS getConvertedTelemetryValue(frskyData.hub.gpsSpeed_bp, UNIT_KTS),
#if defined(CPUARM)
#define TELEMETRY_CELLS_ARGS frskyData.hub.cellsSum / 10, frskyData.hub.cellsSum % 10, frskyData.hub.cellVolts[0]*2/100, frskyData.hub.cellVolts[0]*2%100, frskyData.hub.cellVolts[1]*2/100, frskyData.hub.cellVolts[1]*2%100, frskyData.hub.cellVolts[2]*2/100, frskyData.hub.cellVolts[2]*2%100, frskyData.hub.cellVolts[3]*2/100, frskyData.hub.cellVolts[3]*2%100, frskyData.hub.cellVolts[4]*2/100, frskyData.hub.cellVolts[4]*2%100, frskyData.hub.cellVolts[5]*2/100, frskyData.hub.cellVolts[5]*2%100, frskyData.hub.cellVolts[6]*2/100, frskyData.hub.cellVolts[6]*2%100, frskyData.hub.cellVolts[7]*2/100, frskyData.hub.cellVolts[7]*2%100, frskyData.hub.cellVolts[8]*2/100, frskyData.hub.cellVolts[8]*2%100, frskyData.hub.cellVolts[9]*2/100, frskyData.hub.cellVolts[9]*2%100, frskyData.hub.cellVolts[10]*2/100, frskyData.hub.cellVolts[10]*2%100, frskyData.hub.cellVolts[11]*2/100, frskyData.hub.cellVolts[11]*2%100,
@@ -400,6 +401,7 @@ enum AlarmLevel {
#define TELEMETRY_VFAS_ARGS frskyData.hub.vfas / 10, frskyData.hub.vfas % 10,
#define TELEMETRY_VSPEED_FORMAT "%c%d.%02d,"
#define TELEMETRY_VSPEED_ARGS frskyData.hub.varioSpeed < 0 ? '-' : ' ', frskyData.hub.varioSpeed / 100, frskyData.hub.varioSpeed % 100,
#define TELEMETRY_ASPEED_ARGS getConvertedTelemetryValue(frskyData.hub.airSpeed, UNIT_KTS),
#if defined(FRSKY_HUB)
#define TELEMETRY_OPENXSENSOR() (frskyData.hub.openXsensor)
+2 -1
View File
@@ -519,7 +519,8 @@ const pm_char STR_BLCOLOR[] PROGMEM = TR_BLCOLOR;
const pm_char STR_PT[] PROGMEM = TR_PT;
const pm_char STR_PTS[] PROGMEM = TR_PTS;
const pm_char STR_SMOOTH[] PROGMEM = TR_SMOOTH;
const pm_char STR_COPY_TRIMS_TO_OFS[] PROGMEM = TR_COPY_TRIMS_TO_OFS;
const pm_char STR_COPY_STICKS_TO_OFS[] PROGMEM = TR_COPY_STICKS_TO_OFS;
const pm_char STR_COPY_TRIMS_TO_OFS[] PROGMEM = TR_COPY_TRIMS_TO_OFS;
const pm_char STR_TOP_BAR[] PROGMEM = TR_TOP_BAR;
const pm_char STR_ALTITUDE[] PROGMEM = TR_ALTITUDE;
const pm_char STR_SCALE[] PROGMEM = TR_SCALE;
+2 -1
View File
@@ -700,7 +700,8 @@ extern const pm_char STR_BLCOLOR[];
extern const pm_char STR_PT[];
extern const pm_char STR_PTS[];
extern const pm_char STR_SMOOTH[];
extern const pm_char STR_COPY_TRIMS_TO_OFS[];
extern const pm_char STR_COPY_STICKS_TO_OFS[];
extern const pm_char STR_COPY_TRIMS_TO_OFS[];
extern const pm_char STR_TOP_BAR[];
extern const pm_char STR_ALTITUDE[];
extern const pm_char STR_SCALE[];
+4 -3
View File
@@ -80,7 +80,7 @@
#define TR_TRNCHN "CH1CH2CH3CH4"
#define LEN_UART3MODES "\017"
#define TR_UART3MODES "VYP\0 ""S-Port Mirror\0 ""Debug\0 "
#define TR_UART3MODES "VYP\0 ""S-Port Mirror\0 ""Telemetry\0 ""Debug\0 "
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "Není\0 ""Potenciometr\0 ""Vícepol. přep.\0"
@@ -787,7 +787,7 @@
#define TR_ANTENNAPROBLEM CENTER "Problém s TX anténou!"
#define TR_MODELIDUSED TR("ID již použito","ID modelu je již použito")
#define TR_MODULE INDENT "Modul"
#define TR_TELEMETRY_TYPE "Telemetry Type"
#define TR_TELEMETRY_TYPE TR("Type", "Telemetry Type")
#define TR_CHANNELRANGE INDENT "Rozsah kanálů"
#define TR_LOWALARM INDENT "Nízký Alarm"
#define TR_CRITICALALARM INDENT "Kritický Alarm"
@@ -803,7 +803,8 @@
#define TR_PT "č."
#define TR_PTS " b."
#define TR_SMOOTH "Hladká"
#define TR_COPY_TRIMS_TO_OFS "Kopírovat trim do subtrimu"
#define TR_COPY_STICKS_TO_OFS "Kopírovat stick do subtrimu"
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
#define TR_PERSISTENT_MAH TR(INDENT "Str mAh", INDENT "Ukládat mAh")
#define TR_PREFLIGHT "Předletová kontrola"
#define TR_CHECKLIST INDENT "Zobrazit poznámky"
File diff suppressed because it is too large Load Diff
+4 -3
View File
@@ -80,7 +80,7 @@
#define TR_TRNCHN "CH1CH2CH3CH4"
#define LEN_UART3MODES "\017"
#define TR_UART3MODES "OFF\0 ""S-Port Mirror\0 ""Debug\0 "
#define TR_UART3MODES "OFF\0 ""S-Port Mirror\0 ""Telemetry\0 ""Debug\0 "
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "None\0 ""Pot\0 ""Multipos Switch"
@@ -787,7 +787,7 @@
#define TR_ANTENNAPROBLEM CENTER "TX Antenna problem!"
#define TR_MODELIDUSED TR("ID already used","Model ID already used")
#define TR_MODULE INDENT "Module"
#define TR_TELEMETRY_TYPE "Telemetry Type"
#define TR_TELEMETRY_TYPE TR("Type", "Telemetry Type")
#define TR_CHANNELRANGE TR(INDENT "Ch. Range", INDENT "Channel Range")
#define TR_LOWALARM INDENT "Low Alarm"
#define TR_CRITICALALARM INDENT "Critical Alarm"
@@ -803,7 +803,8 @@
#define TR_PT "pt"
#define TR_PTS "pts"
#define TR_SMOOTH "Smooth"
#define TR_COPY_TRIMS_TO_OFS "Copy Trim To Subtrim"
#define TR_COPY_STICKS_TO_OFS "Copy sticks to subtrim"
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
#define TR_PERSISTENT_MAH TR(INDENT "Str mAh", INDENT "Persistent mAh")
#define TR_PREFLIGHT "Preflight Checks"
#define TR_CHECKLIST TR(INDENT "Checklist", INDENT "Display Checklist")
+4 -3
View File
@@ -80,7 +80,7 @@
#define TR_TRNCHN "CH1CH2CH3CH4"
#define LEN_UART3MODES "\017"
#define TR_UART3MODES "OFF\0 ""S-Port Mirror\0 ""Debug\0 "
#define TR_UART3MODES "OFF\0 ""S-Port Mirror\0 ""Telemetry\0 ""Debug\0 "
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "None\0 ""Pot\0 ""Multipos Switch"
@@ -787,7 +787,7 @@
#define TR_ANTENNAPROBLEM CENTER "¡Problema antena TX!"
#define TR_MODELIDUSED TR("ID en uso", "ID modelo en uso")
#define TR_MODULE INDENT "Modulo"
#define TR_TELEMETRY_TYPE "Telemetry Type"
#define TR_TELEMETRY_TYPE TR("Type", "Telemetry Type")
#define TR_CHANNELRANGE INDENT "Gama de canales"
#define TR_LOWALARM INDENT "Alarma baja"
#define TR_CRITICALALARM INDENT "Alarma Critica"
@@ -803,7 +803,8 @@
#define TR_PT "pt"
#define TR_PTS "pts"
#define TR_SMOOTH "Smooth"
#define TR_COPY_TRIMS_TO_OFS "Copy Trims To Offset"
#define TR_COPY_STICKS_TO_OFS "Copy Sticks To Offset"
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
#define TR_PERSISTENT_MAH INDENT "Valor mAh"
#define TR_PREFLIGHT "Preflight Checks"
#define TR_CHECKLIST INDENT "Display Checklist"
+4 -3
View File
@@ -80,7 +80,7 @@
#define TR_TRNCHN "CH1CH2CH3CH4"
#define LEN_UART3MODES "\017"
#define TR_UART3MODES "POIS\0 ""S-Port Pelik\0 ""Debug\0 "
#define TR_UART3MODES "POIS\0 ""S-Port Pelik\0 ""Telemetry\0 ""Debug\0 "
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "None\0 ""Potikka\0 ""Monias. Kytkin\0"
@@ -787,7 +787,7 @@
#define TR_ANTENNAPROBLEM CENTER "TX Antenna problem!"
#define TR_MODELIDUSED TR("ID already used","Model ID already used")
#define TR_MODULE INDENT "Module"
#define TR_TELEMETRY_TYPE "Telemetry Type"
#define TR_TELEMETRY_TYPE TR("Type", "Telemetry Type")
#define TR_CHANNELRANGE INDENT "Channel Range"
#define TR_LOWALARM INDENT "Low Alarm"
#define TR_CRITICALALARM INDENT "Critical Alarm"
@@ -803,7 +803,8 @@
#define TR_PT "pt"
#define TR_PTS "pts"
#define TR_SMOOTH "Smooth"
#define TR_COPY_TRIMS_TO_OFS "Copy Trims To Offset"
#define TR_COPY_STICKS_TO_OFS "Copy Sticks To Offset"
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
#define TR_PERSISTENT_MAH INDENT "Store mAh"
#define TR_PREFLIGHT "Preflight Checks"
#define TR_CHECKLIST INDENT "Display Checklist"
+2 -1
View File
@@ -80,7 +80,7 @@
#define TR_TRNCHN "CH1CH2CH3CH4"
#define LEN_UART3MODES "\017"
#define TR_UART3MODES "OFF\0 ""Recopie S-Port\0""Debug\0 "
#define TR_UART3MODES "OFF\0 ""Recopie S-Port\0""Telemetrie\0 ""Debug\0 "
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "Rien\0 ""Potentiomètre\0 ""Inter multi-pos"
@@ -803,6 +803,7 @@
#define TR_PT "pt"
#define TR_PTS "pts"
#define TR_SMOOTH "Lissage"
#define TR_COPY_STICKS_TO_OFS "Manche vers subtrim"
#define TR_COPY_TRIMS_TO_OFS "Trim vers subtrim"
#define TR_PERSISTENT_MAH TR(INDENT "Enr. mAh", INDENT "Enregistrer mAh")
#define TR_PREFLIGHT "Vérifications avant vol"
+6 -5
View File
@@ -80,7 +80,7 @@
#define TR_TRNCHN "ch1ch2ch3ch4"
#define LEN_UART3MODES "\017"
#define TR_UART3MODES "OFF\0 ""Replica Porta-S""Debug\0 "
#define TR_UART3MODES "OFF\0 ""Replica Porta-S""Telemetry\0 ""Debug\0 "
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "None\0 ""Potenziometro\0 ""Inter. Multipos"
@@ -580,7 +580,7 @@
#define TR_BLOFFBRIGHTNESS TR(INDENT"Lumin. OFF",INDENT"Luminosità OFF")
#define TR_BLCOLOR INDENT "Colore"
#define TR_SPLASHSCREEN TR("Schermo avvio", "Schermata di avvio")
#define TR_THROTTLEWARNING TR("All. Mot", INDENT "Allarme Motore")
#define TR_THROTTLEWARNING TR("All. Mot.", INDENT "Allarme Motore")
#define TR_SWITCHWARNING TR("Avv. Int.", INDENT "Avviso Interr.")
#define TR_POTWARNING TR("Avv. Pot.", INDENT "Avviso Pot.")
#define TR_TIMEZONE "Ora locale"
@@ -680,7 +680,7 @@
#define TR_BATT_CALIB "Calibra batt."
#define TR_CURRENT_CALIB "Calibra corr."
#define TR_VOLTAGE "Voltaggio"
#define TR_CURRENT "Corr."
#define TR_CURRENT "Corrente"
#define TR_SELECT_MODEL "Scegli Memo."
#define TR_CREATE_MODEL "Crea Modello"
#define TR_COPY_MODEL "Copia Modello"
@@ -707,7 +707,7 @@
#define TR_COPROC "CoProc."
#define TR_COPROC_TEMP "Temp. MB \016>"
#define TR_CAPAWARNING INDENT "CapacitàLow"
#define TR_TEMPWARNING INDENT "Temp Alta"
#define TR_TEMPWARNING INDENT "Temp. Alta"
#define TR_FUNC "Funz"
#define TR_V1 "V1"
#define TR_V2 "V2"
@@ -803,7 +803,8 @@
#define TR_PT "pt"
#define TR_PTS "pti"
#define TR_SMOOTH "Smussa"
#define TR_COPY_TRIMS_TO_OFS "Copia Trim su Offset"
#define TR_COPY_STICKS_TO_OFS "Copia Stick su Offset"
#define TR_COPY_TRIMS_TO_OFS "Copia Trim in Subtrim"
#define TR_PERSISTENT_MAH INDENT "Memo mAh"
#define TR_PREFLIGHT "Controlli Prevolo"
#define TR_CHECKLIST INDENT "Mostra Checklist"
+3 -2
View File
@@ -80,7 +80,7 @@
#define TR_TRNCHN "KN1KN2KN3KN4"
#define LEN_UART3MODES "\017"
#define TR_UART3MODES "Wyłącz\0 ""S-Port Mirror\0 ""Debug\0 "
#define TR_UART3MODES "Wyłącz\0 ""S-Port Mirror\0 ""Telemetry\0 ""Debug\0 "
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "Brak\0 ""Potencjometr\0 ""Przeł.Wielopoz."
@@ -803,7 +803,8 @@
#define TR_PT "pkt"
#define TR_PTS "pkty"
#define TR_SMOOTH "Gładka"
#define TR_COPY_TRIMS_TO_OFS "Skopiuj Trymery Do Offsetu"
#define TR_COPY_STICKS_TO_OFS "Skopiuj Stick Do Offsetu"
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
#define TR_PERSISTENT_MAH TR(INDENT "Zap. mAh", INDENT "Zapisz mAh")
#define TR_PREFLIGHT "Lista Ostrzeżeń"
#define TR_CHECKLIST TR(INDENT "Czeklista",INDENT "Pokaż Listę Ostrzeżeń")
+4 -3
View File
@@ -80,7 +80,7 @@
#define TR_TRNCHN "CH1CH2CH3CH4"
#define LEN_UART3MODES "\017"
#define TR_UART3MODES "OFF\0 ""S-Port Mirror\0 ""Debug\0 "
#define TR_UART3MODES "OFF\0 ""S-Port Mirror\0 ""Telemetry\0 ""Debug\0 "
#define LEN_POTTYPES "\017"
#define TR_POTTYPES "None\0 ""Pot\0 ""Multipos Switch"
@@ -787,7 +787,7 @@
#define TR_ANTENNAPROBLEM CENTER "TX Antenna problem!"
#define TR_MODELIDUSED TR("ID already used","Model ID already used")
#define TR_MODULE INDENT "Module"
#define TR_TELEMETRY_TYPE "Telemetry Type"
#define TR_TELEMETRY_TYPE TR("Type", "Telemetry Type")
#define TR_CHANNELRANGE INDENT "Channel Range"
#define TR_LOWALARM INDENT "Low Alarm"
#define TR_CRITICALALARM INDENT "Critical Alarm"
@@ -803,7 +803,8 @@
#define TR_PT "pt"
#define TR_PTS "pts"
#define TR_SMOOTH "Smooth"
#define TR_COPY_TRIMS_TO_OFS "Copy Trims To Offset"
#define TR_COPY_STICKS_TO_OFS "Copy Sticks To Offset"
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
#define TR_PERSISTENT_MAH INDENT "Store mAh"
#define TR_PREFLIGHT "Preflight Checks"
#define TR_CHECKLIST INDENT "Display Checklist"
+3 -2
View File
@@ -80,7 +80,7 @@
#define TR_TRNCHN "KN1KN2KN3KN4"
#define LEN_UART3MODES "\022"
#define TR_UART3MODES "Av\0 ""Spegling av S-Port""Debug\0 "
#define TR_UART3MODES "Av\0 ""Spegling av S-Port""Telemetry\0 ""Debug\0 "
#define LEN_POTTYPES "\020"
#define TR_POTTYPES "Ingen\0 ""Potentiometer\0 ""Flerlägesväljare"
@@ -803,7 +803,8 @@
#define TR_PT "pt"
#define TR_PTS "pkt"
#define TR_SMOOTH "Mjuk"
#define TR_COPY_TRIMS_TO_OFS "Spara trimmar som offset"
#define TR_COPY_STICKS_TO_OFS "Spara sticks som offset"
#define TR_COPY_TRIMS_TO_OFS "Copy trims to subtrim"
#define TR_PERSISTENT_MAH INDENT "Lagra mAh"
#define TR_PREFLIGHT "Startkontroller"
#define TR_CHECKLIST TR(INDENT "Checklista", INDENT "Visa Checklista")
+5
View File
@@ -153,6 +153,11 @@ I18N_PLAY_FUNCTION(en, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
I18N_PLAY_FUNCTION(en, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds == 0) {
PLAY_NUMBER(seconds, 0 , 0);
return;
}
if (seconds < 0) {
PUSH_NUMBER_PROMPT(EN_PROMPT_MINUS);
seconds = -seconds;
+5
View File
@@ -178,6 +178,11 @@ I18N_PLAY_FUNCTION(fr, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
I18N_PLAY_FUNCTION(fr, playDuration, int seconds PLAY_DURATION_ATT)
{
if (seconds == 0) {
PLAY_NUMBER(0, 0, FEMININ);
return;
}
if (seconds < 0) {
PUSH_NUMBER_PROMPT(FR_PROMPT_MOINS);
seconds = -seconds;