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.
- Check TX buffer space before calling serialWrite (which
unconditionally manipulates buffer management variables).
- Added available TX buffer space as one of debug variables.
- Use blackboxWrite() instead of serialWrite in blackboxWriteString().
Checks various features, modes, and OSD elements to determine if ACC is needed. Generates an arming disabled warning if ACC calibration has never been completed.
Isolates and prevents changes to runtime active features. Any changes to enabled features are deferred until after a save/reboot. Simplifies the previous logic.
Prevents potential failures when features are changed at runtime but the underlying code is not capabile of dynamic reconfiguration.
Adds `osd_distance_alarm` (defaulting to 0 for OFF) which behaves similarly to `osd_alt_alarm`. Causes the OSD distance to home element to blink if the alarm setting is exceeded.
Also added to the CMS menu for consistency with the altitude alarm.
Fix incorrect count of dma options for F3.
Value was hardcoded to 3, but the F3 has 4 ADCs.
Fix dmaPeripheralMapping for F3.
The dmaPeripheralMapping table was using index numbers and not device
numbers.
This meant all the dma mappings were out by one, eg.
```
```
ADC 1 is on DMA1, channel 1, but the output from dma ADC 2 list shows
the possibilities for ADC 1, not ADC 2 and shows no possibilities for
dma ADC 1 list
Ensure there are defaults for ADC4 on F3.
Always use 4 ADC instances for the ADC PG.
* PG should not be target dependant.
* Add a static assert which will fail if anything is changed.
Fix dmaopt in ADC PG, it should be a int8_t, not uint8_t
Fix occurrences of -1 that should be `DMA_OPT_UNUSED`.
Fixing this meant that dma_reqmap.h needed to be included in a few
places. When this was done there were errors because dma_reqmap.h was
included more than once and it's `#pragma once` was commented out.
Including dma_reqmap.h from every PG that uses `dmaopt` also caused
other compilation issues, fixed by this commit.
Fix incorrect count of dma options for F3.
Value was hardcoded to 3, but the F3 has 4 ADCs.
Fix dmaPeripheralMapping for F3.
The dmaPeripheralMapping table was using index numbers and not device
numbers.
This meant all the dma mappings were out by one, eg.
```
```
ADC 1 is on DMA1, channel 1, but the output from dma ADC 2 list shows
the possibilities for ADC 1, not ADC 2 and shows no possibilities for
dma ADC 1 list
Ensure there are defaults for ADC4 on F3.
Always use 4 ADC instances for the ADC PG.
* PG should not be target dependant.
* Add a static assert which will fail if anything is changed.
Fix dmaopt in ADC PG, it should be a int8_t, not uint8_t
Handle targets that currently define CAMERA_CONTROL_PIN
- Targets with a valid timer entry for the pin: Def is just deleted.
- Targets without a valid timer entry for the pin: Def is commented out and additional comment is added. The camera control function must have not being working for a long timer for the target anyway.