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.

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

SectionIdentifierValueDescription
Generalauto_set_crt_loctrue/falseGet textual information of nearest location from sites.json
Generalglide@VariantBest glideratio for glider, default 9
Generalglide_num_avgIntAverage (Used in Glideratio and Wind calc)
GeneralHorisontalNearIntAirspace near definition, default 500
GeneralhorisontalVeryNearIntAirspace very near definition, default 250
GeneralignoreAirspaceOver@VariantMax altitude airspace to handle
GenerallanguageStringName of active qm file without extention
GeneralliveTrackingEnabledtrue/falseSend data to livetrack server if internet connection is available
Generalnum_samplesIntSet numbers of samples to use in barometer mcu. averaging, default 250
GeneraltrimSpeed@VariantTrim speed of glider, default 40
GeneraluiNameStringFilename of UI xml file, default. default.xml
Generalvario_int_secIntIntegration time for digital vario, default 10
GeneralverticalNearIntAirspace vertical near definition, default 100
Generalvolume_procentIntVolume
Generalpilot_nameStringName
GeneralrawLogginftrue/falseEnable/Disable writing NMEA scentences to file.
GeneraltimeZoneIntOffset to GMT.
Generalsaved_crt_locStringCurrent location.
Generaligc_std_filenametrue/falseUse standard filename for igc files, or to use location name if available.
Generaluse_dark_themetrue/falseInvert screen.
Generalapp_on_sound_filenamepath/filenamelocation and name of wavfile to play on startup.
Generaltakeoff_sound_filenamepath/filenamelocation and name of wavfile to play on takeoff.
Generallanding_sound_filenametrue/falselocation and name of wavfile to play when landed.
Generalwind_num_readingsIntDefault 170
Generalwind_num_avgIntDefault 50
Generalwind_data_spreadIntDefault 40
Generalwind_rms_error4IntDefault 4
GeneralmnuFontNameStringFont name to use in menus
GeneralmnuFontSizeIntFont size to use in menus
GeneralturnOffAfterLandtrue/falseAutomatic shudown after landing.
GeneralaccountKeyStringKey (Retreive from www.mipfly.com web).
GeneralaccountIdStringYour account id.
GeneralSoundManager_SQUAREtrue/falseDefault, true
GeneralSoundManager_SILENTONGROUNDtrue/falseDefault, true.
GeneralSoundManager_LINEARtrue/falseDefault, true
GeneralSoundManager_UPTHRIntDefault, 10.
GeneralSoundManager_UPF0IntDefault, 500.
GeneralSoundManager_UPF1000IntDefault, 1000.
GeneralSoundManager_UPI0IntDefault, 600
GeneralSoundManager_UPI1000IntDefault, 200
GeneralSoundManager_DOWNTHRIntDefault, -300
GeneralSoundManager_DOWNF0IntDefault, 450
GeneralSoundManager_DOWNF1000IntDefault, 150
NavigationAirspaceStringFilenames of selected airspaces
NavigationAirspacesStringFilenames of selected airspaces
NavigationMapStringFilename of map file without extention
NavigationairspaceFrontUptrue/falseDraw airspace with course as "up" reference
NavigationlastLatitudeNumberLat of last known position
NavigationlastLongitudeNumberLon of last known position
NavigationshowWoodstrue/falseDraw woods at map
ThermalingpathMarkerSizeIntSize of trail dots at thermalcentering widget
ThermalingthermalActiveDetecttrue/false
ThermalingactivateTresholdintdefault 80
ThermalingdeactivateTresholdintdefault 60
ThermalingturnIntegralDecay@Variant
ThermalingturnIntegralSaturationIntdefault 150
ThermalingtargetPageIntPage id in ui.xml file, containing the thermalcentering widget, default 2