<!-- TITLE: Developers Guide --> <!-- SUBTITLE: 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. [Linux Arm Gnueabihf G](/uploads/development-tools/linux-arm-gnueabihf-g.zip "Linux Arm Gnueabihf G") 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 <table> <tr><td>Section</td><td>Identifier</td><td>Value</td><td>Description</td></tr> <tr><td>General</td><td>auto_set_crt_loc</td><td>true/false</td><td>Get textual information of nearest location from sites.json</td></tr> <tr><td>General</td><td>glide</td><td>@Variant</td><td>Best glideratio for glider, default 9</td></tr> <tr><td>General</td><td>glide_num_avg</td><td>Int</td><td>Average (Used in Glideratio and Wind calc)</td></tr> <tr><td>General</td><td>HorisontalNear</td><td>Int</td><td>Airspace near definition, default 500</td></tr> <tr><td>General</td><td>horisontalVeryNear</td><td>Int</td><td>Airspace very near definition, default 250</td></tr> <tr><td>General</td><td>ignoreAirspaceOver</td><td>@Variant</td><td>Max altitude airspace to handle</td></tr> <tr><td>General</td><td>language</td><td>String</td><td>Name of active qm file without extention</td></tr> <tr><td>General</td><td>liveTrackingEnabled</td><td>true/false</td><td>Send data to livetrack server if internet connection is available</td></tr> <tr><td>General</td><td>num_samples</td><td>Int</td><td>Set numbers of samples to use in barometer mcu. averaging, default 250</td></tr> <tr><td>General</td><td>trimSpeed</td><td>@Variant</td><td>Trim speed of glider, default 40</td></tr> <tr><td>General</td><td>uiName</td><td>String</td><td>Filename of UI xml file, default. default.xml</td></tr> <tr><td>General</td><td>vario_int_sec</td><td>Int</td><td>Integration time for digital vario, default 10</td></tr> <tr><td>General</td><td>verticalNear</td><td>Int</td><td>Airspace vertical near definition, default 100</td></tr> <tr><td>General</td><td>volume_procent</td><td>Int</td><td>Volume</td></tr> <tr><td>General</td><td>pilot_name</td><td>String</td><td>Name</td></tr> <tr><td>General</td><td>rawLogginf</td><td>true/false</td><td>Enable/Disable writing NMEA scentences to file.</td></tr> <tr><td>General</td><td>timeZone</td><td>Int</td><td>Offset to GMT.</td></tr> <tr><td>General</td><td>saved_crt_loc</td><td>String</td><td>Current location.</td></tr> <tr><td>General</td><td>igc_std_filename</td><td>true/false</td><td>Use standard filename for igc files, or to use location name if available.</td></tr> <tr><td>General</td><td>use_dark_theme</td><td>true/false</td><td>Invert screen.</td></tr> <tr><td>General</td><td>app_on_sound_filename</td><td>path/filename</td><td>location and name of wavfile to play on startup.</td></tr> <tr><td>General</td><td>takeoff_sound_filename</td><td>path/filename</td><td>location and name of wavfile to play on takeoff.</td></tr> <tr><td>General</td><td>landing_sound_filename</td><td>true/false</td><td>location and name of wavfile to play when landed.</td></tr> <tr><td>General</td><td>wind_num_readings</td><td>Int</td><td>Default 170</td></tr> <tr><td>General</td><td>wind_num_avg</td><td>Int</td><td>Default 50</td></tr> <tr><td>General</td><td>wind_data_spread</td><td>Int</td><td>Default 40</td></tr> <tr><td>General</td><td>wind_rms_error4</td><td>Int</td><td>Default 4</td></tr> <tr><td>General</td><td>mnuFontName</td><td>String</td><td>Font name to use in menus</td></tr> <tr><td>General</td><td>mnuFontSize</td><td>Int</td><td>Font size to use in menus</td></tr> <tr><td>General</td><td>turnOffAfterLand</td><td>true/false</td><td>Automatic shudown after landing.</td></tr> <tr><td>General</td><td>accountKey</td><td>String</td><td>Key (Retreive from www.mipfly.com web).</td></tr> <tr><td>General</td><td>accountId</td><td>String</td><td>Your account id.</td></tr> <tr><td>General</td><td>SoundManager_SQUARE</td><td>true/false</td><td>Default, true</td></tr> <tr><td>General</td><td>SoundManager_SILENTONGROUND</td><td>true/false</td><td>Default, true.</td></tr> <tr><td>General</td><td>SoundManager_LINEAR</td><td>true/false</td><td>Default, true</td></tr> <tr><td>General</td><td>SoundManager_UPTHR</td><td>Int</td><td>Default, 10.</td></tr> <tr><td>General</td><td>SoundManager_UPF0</td><td>Int</td><td>Default, 500.</td></tr> <tr><td>General</td><td>SoundManager_UPF1000</td><td>Int</td><td>Default, 1000.</td></tr> <tr><td>General</td><td>SoundManager_UPI0</td><td>Int</td><td>Default, 600</td></tr> <tr><td>General</td><td>SoundManager_UPI1000</td><td>Int</td><td>Default, 200</td></tr> <tr><td>General</td><td>SoundManager_DOWNTHR</td><td>Int</td><td>Default, -300</td></tr> <tr><td>General</td><td>SoundManager_DOWNF0</td><td>Int</td><td>Default, 450</td></tr> <tr><td>General</td><td>SoundManager_DOWNF1000</td><td>Int</td><td>Default, 150</td></tr> <tr><td>Navigation</td><td>Airspace</td><td>String</td><td>Filenames of selected airspaces</td></tr> <tr><td>Navigation</td><td>Airspaces</td><td>String</td><td>Filenames of selected airspaces</td></tr> <tr><td>Navigation</td><td>Map</td><td>String</td><td>Filename of map file without extention</td></tr> <tr><td>Navigation</td><td>airspaceFrontUp</td><td>true/false</td><td>Draw airspace with course as "up" reference</td></tr> <tr><td>Navigation</td><td>lastLatitude</td><td>Number</td><td>Lat of last known position</td></tr> <tr><td>Navigation</td><td>lastLongitude</td><td>Number</td><td>Lon of last known position</td></tr> <tr><td>Navigation</td><td>showWoods</td><td>true/false</td><td>Draw woods at map</td></tr> <tr><td>Thermaling</td><td>pathMarkerSize</td><td>Int</td><td>Size of trail dots at thermalcentering widget</td></tr> <tr><td>Thermaling</td><td>thermalActiveDetect</td><td>true/false</td><td></td></tr> <tr><td>Thermaling</td><td>activateTreshold</td><td>int</td><td>default 80</td></tr> <tr><td>Thermaling</td><td>deactivateTreshold</td><td>int</td><td>default 60</td></tr> <tr><td>Thermaling</td><td>turnIntegralDecay</td><td>@Variant</td><td></td></tr> <tr><td>Thermaling</td><td>turnIntegralSaturation</td><td>Int</td><td>default 150</td></tr> <tr><td>Thermaling</td><td>targetPage</td><td>Int</td><td>Page id in ui.xml file, containing the thermalcentering widget, default 2</td></tr> </table>