Developers Guide
Description of the tools to use, coding standards, and how to's for developers
! Not finalized yet... !
Tools
Build environment
Debian based Linux distro, (Ubuntu 16.04 LTS, or 18), If creating an vm, allocate at least 40Gb of disk.
GCC, G++ cross compilers
sudo apt-get install libc6-armel-cross libc6-dev-armel-cross binutils-arm-linux-gnueabi libncurses5-dev
sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
sudo apt-get install qt5-default
Installing QT for running varioQt at desktop
wget http://ftp.acc.umu.se/mirror/qt.io/qtproject/archive/qt/5.11/5.11.1/qt-opensource-linux-x64-5.11.1.run
sudo chmod +x qt-opensource-linux-x64-5.11.1.run
sudo ./qt-opensource-linux-x64-5.11.1.run
Select gcc_64
sudo apt-get install libasound2-dev
If using Ubuntu 18:
sudo apt install dos2unix libasound2-dev libssl-dev
Installing QT for crosscompiling to variometer device
http://ftp.acc.umu.se/mirror/qt.io/qtproject/archive/qt/5.10/5.10.1/single/qt-everywhere-src-5.10.1.zip
unzip
At the time of writing this guide, the package was broken, containing windows CR+LF, if ./configure fails to run use:
cd qt-everywhere-src-5.10.1
find . -type f -print0 | xargs -0 dos2unix
If support for the platform is missing, unzip the content of the zip file to mkspecs.
cd qtbase/mkspecs
unzip linux-arm-gnueabihf-g++
ls linux-arm-gnueabihf-g++
qmake.conf
qplatformdefs.h
Configure and install qt everywhere
~/qt-everywhere-src-5.10.1/configure -release -opensource -confirm-license -device-option CROSS_COMPILE=arm-linux-gnueabihf- -sysroot ~\mipfly-rootfs\
-prefix /usr/local/qt5.8\
-xplatform linux-arm-generic-g++\
-nomake examples\
-nomake tests\
-no-opengl\
-qt-zlib\
-qt-libpng\
-dbus\
-skip wayland
`make`
`make install`
Extract mipfly-rootfs
cd
tar xvf mipfly-rootfs.tar.gz
Git
The code repository uses GIT
Install Git
sudo apt-get install git
- If you encounter E: Unable to locate package,
sudo apt-get update
might fix the issue for you.
How to
Build
The code can be compiled to run on either at the device , or PC. The builds can be done for release or debug.
Create Makefile from scratch.
For deployment to device
~/mipfly-rootfs/usr/local/qt5.8/bin/qmake -o Makefile ~/pathToSource/VarioQt_Release.pro
For PC
/opt/Qt5.11.1/5.11.1/gcc_64/bin/qmake -o Makefile ~/pathToSource/VarioQt.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
Build binary
In the directory where you created the Makefile
make
Verify platform for binary
For a binary compiled for the variometer device:
file VarioQt
VarioQt: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=20d98e11281a1dac79eec7017394c2b23573c50d, not stripped
For a binary compiled for x86
g$ file VarioQt
VarioQt: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=d73b882658940664fba3f12da40df58e0309bacb, not stripped
Language translation
Add a new language
In VarioQt.pro, add the identifier of the language to the TRANSLATIONS definition.
TRANSLATIONS = french.ts swedish.ts italian.ts german.ts turkish.ts
Create/Update translation file
lupdate VarioQt.pro
Edit the .ts file and add the translated text between the translation tags. Remove the type="unfinished" attribute from the tag to signal that the translation is done.
After running lupdate the next time, search and do translations for the "new" unfinished tags.
<message>
<location filename="menu/avionics/avionicsMenu.cpp" line="76"/>
<source>WIND</source>
<translation>VENTO</translation>
</message>
Create binary language file (.qm)
lrelease VarioQt.pro
Adding a custom field (widget)
Add the name definition of your custom field in the mainui.ui file.
<widget class="MagicBox" name="boxPressAltAsl" native="true">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>400</x>
<y>400</y>
<width>120</width>
<height>30</height>
</rect>
</property>
</widget>
Add code for hide and show in the corresponding function in dynamicui.cpp
_pMainUI->boxPressAltAsl->hide();
if(type == "BoxPressAltAsl")
{
_pMainUI->boxPressAltAsl->move(x,y);
_pMainUI->boxPressAltAsl->setWidth(width);
_pMainUI->boxPressAltAsl->setHeight(height);
_pMainUI->boxPressAltAsl->setBorder(border);
_pMainUI->boxPressAltAsl->setCaption(title);
_pMainUI->boxPressAltAsl->setSize(size);
_pMainUI->boxPressAltAsl->setUnit(unit);
_pMainUI->boxPressAltAsl->setBaseUnit(unit);
_pMainUI->boxPressAltAsl->show();
}
Update you custombox value from mainui.cpp, either by subscribing to an signal, and implementing an handler, or adding the update to the timerEvent handler.
ui->boxPressAltAsl->setValue(QString::number(pressureAltitudeAsl_-pressureAltitudeAslOffset_));
To make your custom field visible, add the widget to your ui.xml definition file.
<ui type='BoxPressAltAsl' y='184' x='120' size='37' width='120' height='44' title='mAsl' unit='m' border='1'></ui>
Source code
The source files are structured and grouped by function.
├───bootloader
├───circRegression
├───fbfmwk
├───fonts
├───Geo
├───GPIO
├───IGC
│ └───lib
├───libQDeviceWatcher
├───maps
├───menu
│ ├───avionics
│ ├───bootloader
│ ├───general
│ ├───glideAverage
│ ├───glides
│ ├───location
│ ├───name
│ ├───navigation
│ ├───numSamples
│ ├───shutdown
│ ├───sound
│ ├───system
│ ├───task
│ ├───timezone
│ ├───usbDialog
│ ├───varioAverage
│ └───wind
├───navUtils
├───navWaypoint
├───NMEA
├───resources
│ ├───bmp
│ ├───fonts
│ ├───recorded
│ └───sounds
├───serial
├───settings
├───sound
├───stats
├───testing
├───tests
├───threads
├───ui
│ └───uiElements
├───utils
│ └───kmlReplay
├───varioPrimitives
└───xcsoar
└───Math
Runtime environment
Directory structure
├───airspace
├───flights
├───languages
├───maps
├───resources
│ ├───bmp
│ ├───fonts
│ ├───sites
│ └───sounds
├───taskfiles
├───ui
└───waypointfiles
Settingsfile description
Section | Identifier | Value | Description |
General | auto_set_crt_loc | true/false | Get textual information of nearest location from sites.json |
General | glide | @Variant | Best glideratio for glider, default 9 |
General | glide_num_avg | Int | Average (Used in Glideratio and Wind calc) |
General | HorisontalNear | Int | Airspace near definition, default 500 |
General | horisontalVeryNear | Int | Airspace very near definition, default 250 |
General | ignoreAirspaceOver | @Variant | Max altitude airspace to handle |
General | language | String | Name of active qm file without extention |
General | liveTrackingEnabled | true/false | Send data to livetrack server if internet connection is available |
General | num_samples | Int | Set numbers of samples to use in barometer mcu. averaging, default 250 |
General | trimSpeed | @Variant | Trim speed of glider, default 40 |
General | uiName | String | Filename of UI xml file, default. default.xml |
General | vario_int_sec | Int | Integration time for digital vario, default 10 |
General | verticalNear | Int | Airspace vertical near definition, default 100 |
General | volume_procent | Int | Volume |
General | pilot_name | String | Name |
General | rawLogginf | true/false | Enable/Disable writing NMEA scentences to file. |
General | timeZone | Int | Offset to GMT. |
General | saved_crt_loc | String | Current location. |
General | igc_std_filename | true/false | Use standard filename for igc files, or to use location name if available. |
General | use_dark_theme | true/false | Invert screen. |
General | app_on_sound_filename | path/filename | location and name of wavfile to play on startup. |
General | takeoff_sound_filename | path/filename | location and name of wavfile to play on takeoff. |
General | landing_sound_filename | true/false | location and name of wavfile to play when landed. |
General | wind_num_readings | Int | Default 170 |
General | wind_num_avg | Int | Default 50 |
General | wind_data_spread | Int | Default 40 |
General | wind_rms_error4 | Int | Default 4 |
General | mnuFontName | String | Font name to use in menus |
General | mnuFontSize | Int | Font size to use in menus |
General | turnOffAfterLand | true/false | Automatic shudown after landing. |
General | accountKey | String | Key (Retreive from www.mipfly.com web). |
General | accountId | String | Your account id. |
General | SoundManager_SQUARE | true/false | Default, true |
General | SoundManager_SILENTONGROUND | true/false | Default, true. |
General | SoundManager_LINEAR | true/false | Default, true |
General | SoundManager_UPTHR | Int | Default, 10. |
General | SoundManager_UPF0 | Int | Default, 500. |
General | SoundManager_UPF1000 | Int | Default, 1000. |
General | SoundManager_UPI0 | Int | Default, 600 |
General | SoundManager_UPI1000 | Int | Default, 200 |
General | SoundManager_DOWNTHR | Int | Default, -300 |
General | SoundManager_DOWNF0 | Int | Default, 450 |
General | SoundManager_DOWNF1000 | Int | Default, 150 |
Navigation | Airspace | String | Filenames of selected airspaces |
Navigation | Airspaces | String | Filenames of selected airspaces |
Navigation | Map | String | Filename of map file without extention |
Navigation | airspaceFrontUp | true/false | Draw airspace with course as "up" reference |
Navigation | lastLatitude | Number | Lat of last known position |
Navigation | lastLongitude | Number | Lon of last known position |
Navigation | showWoods | true/false | Draw woods at map |
Thermaling | pathMarkerSize | Int | Size of trail dots at thermalcentering widget |
Thermaling | thermalActiveDetect | true/false | |
Thermaling | activateTreshold | int | default 80 |
Thermaling | deactivateTreshold | int | default 60 |
Thermaling | turnIntegralDecay | @Variant | |
Thermaling | turnIntegralSaturation | Int | default 150 |
Thermaling | targetPage | Int | Page id in ui.xml file, containing the thermalcentering widget, default 2 |