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

Import HDZero OSD Driver from iNav #775

Merged
merged 8 commits into from
Feb 7, 2024

Conversation

saidinesh5
Copy link
Contributor

@saidinesh5 saidinesh5 commented Mar 17, 2022

Mostly from https://github.com/iNavFlight/inav/pull/7668/files commit

Notable changes:

  • And added missing functions to bitarray.h/.c, msp_serial.h/.c
  • Used baudRates[BAUD_115200] instead of
    baudRates[portConfig->peripheral_baudrateIndex]

Additional changes:

  • serial: serialPortFunction_e now needs 32 bits
  • Updated msp_protocol minor version to 52

How to use:

In CLI, Set FUNCTION_HDZERO_OSD to the appropriate serial port:
Eg. Assuming to use serial port 4, enter the following CLI commands to
enable FUNCTION_HDZERO_OSD in EmuFlight Configurator's CLI:

serial 3 65536 115200 115200 0 115200
save

REQUIRES HDZero firmware Rev 11062022 or later, otherwise older firmware will be a corruption issue in EmuFlight due to VTX-Tables "BackPack"

Known quirks to be attended before ready for master:

  • OSD VTX elements not synchronized with HDZero hardware settings [non-breaking issue].
  • DJI expects OSD elements in the 0-31,0-31 range (unpacked), where this PR is 0-63,0-63 (unpacked). e.g. osd_crosshairs_pos = 2253 not osd_crosshairs_pos = 8589. Desire to be backward-compat and/or intercept layer for DJI.
  • Walksnail requires PAL in Configurator for text alignment. Desire fixed.
  • Supports WTF.OS
  • Support UNKNOWN for DJI 03 -- needs feedback on what works or what does not. expecting MSP is different.
  • Needs to be updated and brought modern similar to iNav merges:

Closes #700

@saidinesh5 saidinesh5 marked this pull request as ready for review March 24, 2022 12:50
uint16_t charCount;
} displayFontMetadata_t;

// 'I', 'N', 'A', 'V'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saidinesh5 , what is the purpose of this section? with "INAV"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to include this for availing displayFontMetadata_t this one function (which is used nowhere). Originally I wanted to keep this osd driver as close to the inav version as possible to minimize the headaches when updating, but I am beginning to think that we don't have to worry about that right now because we have a lot of code that is useless currently.

static bool getFontMetadata(displayFontMetadata_t *metadata, const displayPort_t *displayPort)
{
    UNUSED(displayPort);
    metadata->charCount = 512;
    metadata->version = FONT_VERSION;
    return true;
}

Copy link
Member

@nerdCopter nerdCopter Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i believe, this will need to be EMUF for hdzero font EMUF_000.bmp. not validated yet.
nope. it was elsewhere.

@nerdCopter nerdCopter added 0.4.1 help wanted Extra attention is needed labels May 6, 2022
@nerdCopter

This comment was marked as outdated.

@nerdCopter
Copy link
Member

nerdCopter commented Jun 23, 2022

  • needs to intercept MSP for any old HDZero firmware that supports backpack. done.
  • otherwise, seems that everything works with HDZero's latest firmware.
  • would prefer more testers testing it.

@saidinesh5 saidinesh5 force-pushed the hdzero_inav branch 2 times, most recently from 258f073 to 669f265 Compare July 1, 2022 01:23
@nerdCopter nerdCopter added this to the 0.4.1 milestone milestone Jul 5, 2022
@nerdCopter nerdCopter added 0.4.3 and removed 0.4.1 labels Jul 29, 2022
@nerdCopter nerdCopter added in-testing-needs-testing needs testing before merge consideration and removed bug Something isn't working labels Aug 27, 2022
@nerdCopter
Copy link
Member

image

Mostly from https://github.com/iNavFlight/inav/pull/7668/files commit
Notable changes:
* And added missing functions to bitarray.h/.c, msp_serial.h/.c
* Used "drivers/max7456_symbols.h" instead of "drivers/osd_symbols.h"
* Used baudRates[portConfig->msp_baudrateIndex] instead of
baudRates[portConfig->peripheral_baudrateIndex]

Additional changes:
serial: serialPortFunction_e now needs 32 bits

How to use:

In CLI, Set FUNCTION_HDZERO_OSD to the appropriate serial port:
Eg. Assuming to use serial port 4, enter the following CLI commands to
enable FUNCTION_HDZERO_OSD in EmuFlight Configurator 3.0.1:
    serial 3 65536 115200 115200 0 115200
    save
This is because we changed the size of serialPortConfig_s.functionMask

TODO: Add the peripheral_baudrateIndex entry to serialPortConfig_s ?
As per geoffsim, the HDZero VTX hardcodes thE baudrate at 115200. So No
point making this configurable in EmuFlight As of now.
We can bring back the configurability later on if needed
Emuflight does not implement vtx tables and that causes corruption on
certain hdzero firmware. Everything seems smooth as Buttercake
@SebastianKumor
Copy link

I assume this will then also work with https://github.com/fpv-wtf/msp-osd ?

@nerdCopter
Copy link
Member

nerdCopter commented Sep 28, 2022

I assume this will then also work with fpv-wtf/msp-osd ?

unknown; needs to be tested. Here are the HDZero builds:

we request report/feedback on results.

edit: WTF.OS works, but need to set as PAL to align correctly.
still need legacy_SD for legacy_DJI.

@saidinesh5
Copy link
Contributor Author

I think we need to fix the OSD canvas size because DJI goggles only support SD resolution.
That's the reason we didn't merge this yet, because this is causing DJI osd to break.

@nerdCopter
Copy link
Member

@saidinesh5 , can you rebase on master?

@nerdCopter nerdCopter self-assigned this Nov 9, 2023
@nerdCopter
Copy link
Member

nerdCopter commented Nov 9, 2023

This needs work. I plan to take ownership. I really want to avoid MSP change for the uint32. betaflight stayed uint16.

edit: uint32 is fine. OSD bits will be reverted to 5bit, thanks to BF; #958

@nerdCopter nerdCopter merged commit 91c5ad7 into emuflight:master Feb 7, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.4.3 help wanted Extra attention is needed in-testing-needs-testing needs testing before merge consideration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

shark byte canvas mode
3 participants