Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve AHI: support for -180..180° roll angles #3641

merged 5 commits into from Dec 17, 2018


None yet
2 participants
Copy link

commented Jul 22, 2018

Based on Ardupilot's improved OSD AHI code.

Tested on the bench, seems to work well.
UPDATE: now tested in flight as well.

Updated fonts: iNavFlight/inav-configurator#552

@shellixyz shellixyz changed the title Improve AHI: support for -180..180 roll angles Improve AHI: support for -180..180° roll angles Jul 22, 2018

@digitalentity digitalentity added this to the 2.1 milestone Jul 22, 2018

@shellixyz shellixyz force-pushed the shellixyz:improved_ahi branch from 1a75921 to 1074897 Jul 23, 2018


This comment has been minimized.

Copy link
Collaborator Author

commented Nov 10, 2018


You will need to install this version of the fonts:

@shellixyz shellixyz force-pushed the shellixyz:improved_ahi branch from 1074897 to 436668a Dec 14, 2018

@shellixyz shellixyz force-pushed the shellixyz:improved_ahi branch from 436668a to 795cb99 Dec 14, 2018

@shellixyz shellixyz merged commit be103a6 into iNavFlight:development Dec 17, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed

thtexpert added a commit to thtexpert/inav that referenced this pull request Feb 12, 2019

rebase to development branch (#1)
* Enforce spinup time even for idle throttle

* Improve AHI: support for -180..180° roll angles (iNavFlight#3641)

* Improve AHI: support for -180..180 roll angles

* Improve AHI: configurable max pitch

* Improve AHI: increase horizontal size

* Improve AHI: add possibility to resize it easily

* Use 5 bits to encode setting words

Saves 1672 bits on F3 without any lost functionality. Retriving a
setting name is significantly slower, but still not slow enough to be

* update

* revierw changes

* Add new target DALRCF722DUAL and add DALRCF405 board description

Add new target DALRCF722DUAL and add DALRCF405 board description to development branch

* Decrement rem_symbols when a symbol slot is used

Spotted by @alexbirkett

* [MATEKF722SE] Fix beeper; Enable LEDSTRIP

* [FOXEERF405] Add new board, initial cut

* Update README

Quick update

* [FOXEERF722DUAL] Initial cut on target

* Add docs

* [FOXEER] Enable DSHOT; Remap S5/S6 of F722 board to adopt 6-channel DSHOT

* Port Betaflight fpv_mix_degrees setting and camera mix logic for acro mode

* Fix incorrect return value in bitArrayFindFirstSet() when using non-zero start

When the first bit set is in the same 4-byte group that the start
(with start > 31), the returned index is off by the last multiple
of 32 <= start. This could cause unnecessary updates in the OSD
driver, since a non-dirty char would be actually updated while
it hadn't changed.

* Add bitarray functions for setting and clearing all the array

- bitArraySetAll() and bitArrayClrAll() set and clear the whole
array, with the size (in bytes) specified by the caller (to make
them work like bitArrayFindFirstSet())
- macros BITARRAY_SET_ALL() and BITARRAY_CLR_ALL() call those two
new functions using sizeof(array) as its size

* Cleanup geo* functions

- Rename gpsOrigin_s type to gpsOrigin_t
- Make geo* conversion functions return wether they succeeded or not
- Reorder geo* functions arguments to follow the (output, inputs)
- Document all the geo* functions

* Add navCalculatePathToDestination() function

Calculates distance and bearing to the given location in local
coordinate space.

Added navDestinationPath_t, which encapsulates distance and

Refactor calculateDistanceToDestination() and
calculateBearingToDestination() a bit to move the calculations to
static functions that can be reused by navCalculatePathTo()

* Adding altitude / sea (MSL)

* Update cms_menu_osd.c

* [GPS] Improve handling of SBAS and GALILEO supportability; Increase GPS failure timeout

* [F7] Move ADC to DMA2_Stream0; Clean up F7 timer DMA

* [MATEKF722] Enable DSHOT; Remap outputs to be DSHOT-compatible

* [FOXEERF722] Fix M4 for DSHOT

* [F4] Move ADC to DMA2_Stream0

* Fix comment




* [ASGARD32F4] Fix M1 for DSHOT

* LM75 I²C temperature sensor preliminary support

* Max7456 symbols cleanup (v2) (iNavFlight#4122)

* OSD symbols cleanup
* Update osd.c

* Output the number of bits used for encoding characters from settings.rb

Instead of hardcoding the number of bits in both settings.c and
settings.rb, make the latter output a constant to the
settings_generated.h file.

* Refactor code for locking access to MAX7456 to functions

Rename max7456Lock var to max7455Mutex. Add max7456Lock(),
max7456Unlock() and max7456TryLock().

* Add support for read/write MAX7456 NVM for chars > 256

Add max7456Character_t, which represents the data for character a
single MAX7456 character.
Use max7456Character_t to read and pass character data around.
Change max7456WriteNvm() to accept a 2-byte character address.
Change MSP handler for MSP_OSD_CHAR_WRITE to accept 2 byte character
addresses. To keep backwards compatibility, check wether the caller
sent 55 or 56 bytes.
Add max7456ReadNvm() to read a character from the MAX7456 NVM, which
will eventually be used for font metadata.

* Add workaround for corrupted characters when uploading MAX7456 fonts

Restore the previous behavior of rebooting after uploading characters,
but add a comment explaining why it needs to be done.

* Add support for OSD characters > 255, refactor MAX7456

Change display(Read|Write)Char* functions to use an uint16_t
character. This lets callers which need characters > 255 use these
functions, while keeping most strings in ASCII to save memory (
the string based functions still take a cosnt char *).

Change display drivers to support 16 bit characters when writing
a single character. Note that some drivers might silently truncate
the character, it's the responsability of the caller to check
wether the display supports characters > 255 (API will follow in
the next commit).

Refactor and cleanup the MAX7456 driver:

- Move global state to a struct, for better encapsulation
- Make max7456DrawScreenPartial() static, expose instead the new
function max7456Update(), which calls max7456StallCheck() and
max7456DrawScreenPartial() instead of doing all the work on
a single function.
- Rewrite max7456RefreshAll() to use HW based screen clearing, then
leverage max7456DrawScreenPartial() to redraw only non-blank
characters. This should make full screen redraws faster while
reducing complexity and flash usage (we no longer have 2 paths
for drawing).
- Support writing characters > 255, switching to 8bit mode on

* Add support for font metadata, use it for detecting extended fonts

Also, add boot logo on OSD when the font supports it. If the font
is invalid or out of date, show an "INVALID FONT" message.

* Call max7456Init() before displayInit()

Otherwise the display initialization might call methods on the
max7456 driver on an uninitialized device

* Ensure the MAX7456 detects a valid signal before accepting it

Code was not checking for the Loss-of-Sync bit, causing it to
detect PAL too early in some cases.

* Refactor the rest of the MAX7456 driver

- Cleanup init sequence to perform as much initialization as
possible in max7456Init().
- Initialize the OSD as soon as video sync is detected. If no
video sync is detected at 1.5s, start as PAL but then continue
probing until we find a valid video signal.
- Wait for the software reset to finish during initialization.
- Remove extern variable for maxScreenSize, replace it with
- Make sure that when disabling the OSD for reading/writing to
NVM we only enable it again if it was enabled before.
- Rewrite prototypes in the header file to use the same style and
formatting as the rest of the code.
- Delay call to millis() in max7456StallCheck() to avoid calling
it when it's not strictly needed.

* Rename displayFontMetadata() to displayGetFontMetadata()

* Add comment explaining the shift by 2 bits when writing to DMDI

* Rename fontMetadata in display driver's vTable to getFontMetadata

* smix reverse removed as obsolete

* Align OSD_FLYMODE to 13th column by default

Since OSD_FLYMODE is 4 characters and the display is 30 characters,
to center it we should place it on the 13th instead of the 12th.

* Enable MR Braking on Omnibus target

* Fix fly time bug

Closes iNavFlight#4141

* Enable pitot and LM75 temperature sensor on all targets >= F4

* [ADC] Implement ADC averaging on F7, enable ADC averaging on all targets

* Enable LM75 temperature sensors on all targets >= F4

* fix

* [F3] Remove some features; Reduce heap size

* Re-enable SPRACINGF3NEO for automated builds

* Add support for encoding coordinates with OLC

Just encoding support and a few tests

* fix 2

* Fix compilation warnings


Displays the +code of the current coordinates, saving a lot of
screen space, while providing enough information to locate the

* fix 3

* [VTX] Remove VTX_COMMON which is always defined

* [VTX] Initial cut on FFPV protocol

* [VTX] Fix FFPV receiving code. Verified to work

* [VTX/CMS] Add FFPV 2.4G VTX to CMS menu

* [VTX/CMS] Missing files

* [VTX] Remove FFPV VTX control from SPRACINGF3 NEO

* Override the OSD layout for 10 seconds when configuring an item

When configuring the OSD via MSP (e.g. from the configurator), the
layout that was just altered is shown in the OSD for 10 seconds,
regardless of the selected OSD layout via modes.

This allows configuring the layouts when looking at them in the
goggles while the radio is powered off.

* Enable Feature Airmode by default

* IMU orientation sanity check improvements

* Refactor pitot tube sensor; Change filtering and defaults; Change I2C driver code to handle 0xFF register address; Better MS4525 sensor

* [PITOT] Some refactoring

* [NAV] Fix failsafe RTH getting stuck if RTH->other_NAV_mode transition is not handled

* [MATEKF722SE] Enable DSHOT

* Make sure olc_encode() uses the same units as the GPS

Namely, 1e7. To accomplish this, we need to carefully convert
the values to unsigned after the initial normalization, because
OLC normalizes all values to lat to [0, 180] and lon to [0, 360]
and 360 * 1e7 overflows an int32.

Also, import all the tests from the original OLC C library.

* Enable MSP_DISPLAYPORT on targets with flash > 128 and no OSD

MSP_DISPLAYPORT is used to display CMS on MWOSD, which is useful
for targets without a builtin OSD. Since those targets also have
a bit more flash/ram to spare, we have room for this feature as
long as no builtin OSD is present.

* Loiter direction (iNavFlight#4036)

* Loiter direction

* Experimental biquad RC fitler instead of RC interpolation

* [F3] Disable PCA9685 drifer for targets with <256K Flash (F3)

* Disable PWM servo driver on SPRF3NEO

* OSD fixing & into +

Changed the "&" in CMS home, so it does not use ASCII char 38 that is actually the left side of the default crossair.

* Adding the +code in the OSD arming screen

* 1 extra row needed

* Add MATEKF722SE to release targets

* [USB] Increase CDC buffer on F7 boards to accomodate max MSP packet size

* [RANGEFINDER] Enable rangefinder by default on all targets

* [GPS] Change autobaud logic for UBX protocol to send baud change command in bulk

* [AGL] Fix non-working AGL estimation

* Updated target defaults for F722SE

* Fix detection of NTSC signal after 1.5s

Due to a logic error during refactor, signal was always being stored
internally as PAL when more than 1.5s had elapsed since boot. The
MAX7456 kept reporting that the signal was actually NTSC, causing the
reinitialization sequence to trigger and the OSD to blink once every
second, but since the data cached in RAM was always stored as PAL
this continued forever.

Fixes iNavFlight#4183

* Add flash blackbox to MATEKF722SE target

* DSHOT enabled on AirbotF4

* Fix a few compilation warnings

* [TARGET] MATEKF722MINI target (a variant of F722SE with SPIFLASH); A temporary solution until SPI mode is defined per device in device registry

* Add support for generating debug ASM files during build time

Generation is enabled by setting the environment variable GENERATE_ASM
to 1. To avoid overwriting files generated by -save-objs, we use
file.txt.S as the filename (-save-objs generates a file.s for each
file.c, and using s and S would break on case insensitive filesystems).

* TASK_VTXCTRL revert to 5Hz

* Replace ABS(float) with fabsf(float)

Disregarding loads and stores, fabfs() compiles to a single vabs.f32
instruction, which completes in 1 cycle. ABS(float), however, compiles
to vcmpe.f32, a branch and vneg.f32, which needs 2 cycles + branching.
The compiler is not able to perform this transformation because
(f < 0 ? -f : f) doesn't always yield the absolute value for
floats (e.g. ABS(-0) will yield -0).

* [TIMER] Fix race condition in timer DMA

* [DSHOT] Make sure DSHOT scheduler doesn't use stale currentTimeUs

* Add missing files for MATEKF722MINI

* Fix Fake GPS

* Change previousHeadingError type from float to int32_t

* Fix compilation without USE_DTERM_NOTCH

notchFilterApplyFn is only defined when USE_DTERM_NOTCH is enabled

* [NAV] Restrict MC RoC/RoD rate-limiting to the case where we actually accelerate

* [I2C] Make usage of 0xFF register address to access bus directly per-device setting

* Use signbit()

* Fix SoftI2C

* Replace old wind estimation reference

* Invalid value spacing

* Update

Remove ASYNC traces

* Delete does not provide useful infos once we have dropped ASYNC

* [VL53L0X] Fix infinite timeout (hang) during init

* Only use BOOTLOG on 256K+ targets (F4 and above); Enable debug-trace on VCP by default (don't enable the feature)

* [CALIBRATION] Separate library for zero calibration with variance calculation (time based, with retry); Migrate GYRO and ACC to new calibration; Implement movement threshold for acc calibration to discard shaky measurements

* [UNIT] Fix unittests and related bugs

* [BARO] Migrate to new calibration framework

* [PITOT] Migrate pitot to new calibration

* [NAV] Migrate gravity calibration to new framework

* fix for decimal value of battery voltage (in cli-status and oled display)

* Check the correct bit in VM0 to detect screen size

Check VM0 against VIDEO_MODE_PAL (bit 6 = 1). Previous check was
a typo that always returned true.

Fixes iNavFlight#4268

* Rangefinder enabled for MATEKF405SE on bus i2c-2

* MSP safety fixes (iNavFlight#4281)

* add DSHOT setings to cli documentation

* Update

* increase bbl denom range (cleanup)

* fixes iNavFlight#4288

* Update Board - Matek F411

* Fix MATEKF411_SFTSRL2 softserial (iNavFlight#4315)

* Update

* Update StickPositions images

* Used the svg source and then built the png

* Change something to get Travis CI unstuck

* Change something to get Travis CI unstuck

* Revert inscape settings

* Add 1-Wire support through the DS2482 IF chip

* Add driver for the DS18B20 1-Wire temperature sensors

* Improve temperature framework

- Support for multiple LM75 sensors
- Support for the DS18B20 sensors
- CLI command temp_sensor to configure sensors
- Logging of all temperature sensor values
- Display of all temperature sensor values on the OSD with support for alarms
- New MSP messages to query and set sensor configuration and read temperatures

* Enable 1-Wire and DS18B20 temp sensors on all F4 and F7 targets

* Couple fixes

* Add generic 1-Wire interface, use camel case and clean DS18B20 driver

* Use ptThreads for reading temp sensors

* 1-Wire add macros

* DS18B20 delay tweak

* ds2482OwMatchRomCommand fix

* DS18B20 factorize

* Increase servo mix max rate (iNavFlight#4306)

* Update RSSI source when rssi_channel changes via MSP (iNavFlight#4307)

Otherwise RSSI will not work until next reboot when channel is
changed from/to none.

* MSP over TBS Crossfire (iNavFlight#4094)

* MSP over Crossfire CRSF protocol

* Added crsfFrameDeviceInfo

* Made WAIT more correct, added althold and home reset

* Fixed indentation

* Update config.h

* Changes for fiam

* Remove `boardIdentifier` from config


* Update target.h

* Disable pitot on SP Racing F3 NEO

* Remove duplicate defines

* OSD, adding the "near home" icon (iNavFlight#4256)

When the aircraft is closer than min_rth_distance, the arrow to home is replaced by a different icon to show close home proximity.
Using OSD char n°122

* Nox board support (iNavFlight#4216)

* Add NOX target to release (iNavFlight#4331)

* Some temperature changes

* Fix logging of total PID output to BB log; Add a lot of debug logging via a GENERIC logging type

* Make blackbox-logged stateFlags 32-bit wide

* Move braking mode code to multicopter-specific code; Fix issue with incorrect boostFactor calculation; Make sure braking mode is correctly reset when we switch out of navitation modes or reset position controller

* Remove excess debug logging of VelXY controller

* Temperature sensor: DS18B20: don't wait for SkipRom before conversion

* Add temperature sensors documentation (iNavFlight#4338)

* Fix temp sensors label (iNavFlight#4339)

* Minor temperature label handling improvement (iNavFlight#4346)

* Improve temperature sensors documentation (iNavFlight#4347)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.