Call targetConfiguration() once before config is loaded and again afterwards in case the config needs to be changed to load from SD card etc
Drop SPI clock during binding
Remove debug
Add per device SPI DMA enable
Fix sdioPinConfigure() declaration warning
Reduce clock speed during SPI RX initialisation
Improves menu readability by changing the background from a transparent display of the camera image to a static opaque gray background.
The behavior is controlled with the `osd_menu_background` parameter which defaults to `TRANSPARENT` to preserve the previous behavior. Other opaque options are available:
```
osd_menu_background = TRANSPARENT
Allowed values: TRANSPARENT, BLACK, GRAY, LIGHT_GRAY
```
The background setting is available in the CMS OSD menu and the user can cycle through the various options with the display updating in real-time.
Currently only the onboard MAX7456-based OSD is supported, but the implementation adds `displayPort` support so it can easily be extended to other OSD devices if those manufacturers want to add support. Also can be extended to other background types (like colors, varying transparency, etc.) for future device support.
Makes use of the built-in MAX7456 feature to display all transparent pixels as "gray". The MAX7456 display area seems to be a few scan lines smaller than the actual camera video image so it's normal for some of the camera image to "leak" at the top/bottom of the display. The OSD display area can be adjusted up/down using the `vcd_v_offset` setting if desired.
This allows the init sequence to correctly determine and store that
the selected display device after autoselection was MAX7456 but it
hasn't been yet initialized, and allows us to properly transmit this
information to the configurator.
This also lets the display subsystem initialize the MAX7456 at any
time, so for example in flight controllers that require battery power
in order to turn on the MAX7456, the user can plug the battery after
powering the system up via USB and the MAX7456 will be detected shortly
after without having to reboot.
- Add displayWriteFontCharacter() for font writing, removing all max7456
specific code.
- Add displayIsReady() for asynchronous display initialization
- Add displayBeginTransaction()/displayCommitTransaction() for display
transactions, which allow performing complex drawing operations without
flickering
- Add displayGetCanvas(), which retrieves the canvas associated with a
display (if it has it)
- Add canvas implementation for pixel based access for a display
- Add FrSkyOSD driver and displayPort driver
- Enable FrSkyOSD driver for targets with flash > 256
- Rename max7456_symbols.h to osd_symbols.h
Found through static analysis with GrammaTech CodeSonar
Need to make sure escapeCharFound is initialized to false. It doesn't look like anything really can go wrong (yet), but the loop in 804 could be executed even if not needed.
Significantly reduces the time the OSD task spends drawing elements that are completely or mostly static. The larger the element the more time savings are realized. Currently implemented support for:
- Crosshairs
- Artificial Horizon Sidebars
- Craft name
- Display name
- Stick overlay
Since the static portions are only rendered once, the static elements add no processing time to the OSD task. As an example, enabling the above elements prior to these changes results in a total rendering time of 47us. After the enhancements they take only 6us (basically the rendering phase minimum overhead). So effectively 41us are removed from the OSD task.
Opens the possibility to add large mostly static elements with no additional overhead. An example would be a camera framing element that might draw a "box" around most of the screen. Previously this would add significant processing overhead to the OSD task, but now it will have no impact.
The max7456 driver performs a "stall check" looking to see if the device had stopped responding. It does this by reading the VM0 register and comparing it to the in-memory version. Presumably if communication failed because the device isn't responding then the result of the SPI transfer would be an unexpected value. If the incorrect value was returned then it would trigger a reinitialization in the hopes of getting the device to respond.
The problem is that this check was happening on **every** call to `displayDrawScreen` unnecessarily. So in the case of the OSD using the max7456 it would happen every 16.7ms (60hz) which is clearly overkill. The unnecessary register check was adding a fixed ~7us to every iteration of the OSD task (along with potential extra bus contention). So now the "stall test" is only performed once a second.
These are set in many targets, but they are exactly the same as set in #6871
Notable exceptions: NOX, IMPUSERCF3 are set to clock data into the MAX7456 at 5MHz
Eliminate unnecessary register writes by keeping previous state information and only writing the registers when the related settings actually change. Saves 17 register writes per `clearScreen()` call.
Also fixed character invert flag handling. Previously changes to the flag would only affect subsequently drawn characters and previous characters would remain unchanged. So for static OSD elements it produced an inconsistent state. Now all characters immediately reflect the current state of the invert flag.
Results in appoximately a 33% reduction in processing time for the OSD task at default settings (~31us reduced to ~21us on F405).
The for loop variable was being erroneously double incremented when a character was updated. This would cause fewer characters to be checked/updated during each cycle based on how many were found to be updated.
The 0xFF character is used as an "escape" character by the MAX7456 when using auto-increment mode. The last byte of the characters used for the logo is the 0xFF character and this was causing the version and CMS instructions to not display.
Changed the logic to avoid the 0xFF character during the auto-increment phase and added a second pass if needed to update those characters in direct addressing mode.