mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 14:25:20 +03:00
SPRACINGF3NEO - Use RTC6705 clk hack.
CF/BF - Fix typo in max7456DmaInProgress. Always define an implementation even when there is no TX-DMA. CF/BF - Ensure that max7456 communication does not disrupt RTC6705 communication when using the same SPI port for both. CF/BF - Port RTC6705 to use the VTX API. * Support VTX channel/band/power on OSD for ALL vtx APIs - previously it only supported RTC6705. * Remove all FEATURE_VTX usage. * Remove all `#define VTX` usage. Note that due to the async nature of tramp/smartaudio it's not possible to know the current band/channel after requesting a change (as the request hasn't been processed) so it makes no sense to try and save the config - and on the tramp/smartaudio vtx the vtx maintains it's state. So on an RTX6705 equipped FC the user should now MANUALLY save the config using the save config stick position. CF/BF - Move CMS for RTC6705 into vtx_rtc6705.c for consistency with other VTX CMS menus. CF/BF - Update RTC6705 via SOFT SPI to use VTX API. * Achieved by simply aligning the API at the driver level and removing all legacy conditional compilation checks. CF/BF - Use new IO for RTC6705 CLK Hack CF/BF - Port VTX button from CF v1.x. Features: * Channel Cycle * Band Cycle * Power Cycle * Save Settings * Works with any VTX using VTX API. CF/BF - Allow support for Internal and External VTX - External takes precedence when configured. CF/BF - Fix display of VTX power in CMS. * Issue occured when CMS was transitioned from integer to list of strings. CF/BF - Disable SMARTAUDIO and TRAMP on the SPRacingF3NEO due to flash size. CF/BF - Cleanup const usage of bass-by-value parameters. Cleanup naming. CF/BF - Cleanup naming. Removing noise-words. Improving consistency. CF/BF - Improve readability by further naming cleanups. CF/BF - Remove some magic numbers in the RTC6705 VTX code. CF/BF - Use braces on some procedural macros. CF/BF - Improve code readability by renaming rtc6705SetChannel to rtc6705SetBandAndChannel. CF/BF - Remove editor mishap. CF/BF - Make the rtc6705Dev variable static. CF/BF - remove duplicate state variablertc6705Dev_t - vtxDevice_t had all we needed. Use brackets on some procedural style macros. Make all the vtx vtable static const. CF/BF - making some declarations const. CF/BF - Fix vtx_power maximum value (out by one).
This commit is contained in:
parent
aae589cab8
commit
723831b579
47 changed files with 1084 additions and 655 deletions
|
@ -55,6 +55,7 @@
|
|||
#include "drivers/adc.h"
|
||||
#include "drivers/bus_i2c.h"
|
||||
#include "drivers/bus_spi.h"
|
||||
#include "drivers/buttons.h"
|
||||
#include "drivers/inverter.h"
|
||||
#include "drivers/flash_m25p16.h"
|
||||
#include "drivers/sonar_hcsr04.h"
|
||||
|
@ -62,7 +63,9 @@
|
|||
#include "drivers/usb_io.h"
|
||||
#include "drivers/transponder_ir.h"
|
||||
#include "drivers/exti.h"
|
||||
#include "drivers/vtx_soft_spi_rtc6705.h"
|
||||
#include "drivers/max7456.h"
|
||||
#include "drivers/vtx_rtc6705.h"
|
||||
#include "drivers/vtx_common.h"
|
||||
|
||||
#include "fc/config.h"
|
||||
#include "fc/fc_init.h"
|
||||
|
@ -92,7 +95,8 @@
|
|||
#include "io/osd.h"
|
||||
#include "io/osd_slave.h"
|
||||
#include "io/displayport_msp.h"
|
||||
#include "io/vtx.h"
|
||||
#include "io/vtx_rtc6705.h"
|
||||
#include "io/vtx_control.h"
|
||||
#include "io/vtx_smartaudio.h"
|
||||
#include "io/vtx_tramp.h"
|
||||
|
||||
|
@ -156,6 +160,18 @@ void processLoopback(void)
|
|||
}
|
||||
|
||||
|
||||
#ifdef VTX_RTC6705
|
||||
bool canUpdateVTX(void)
|
||||
{
|
||||
#if defined(MAX7456_SPI_INSTANCE) && defined(RTC6705_SPI_INSTANCE) && defined(SPI_SHARED_MAX7456_AND_RTC6705)
|
||||
if (feature(FEATURE_OSD)) {
|
||||
return !max7456DmaInProgress();
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BUS_SWITCH_PIN
|
||||
void busSwitchInit(void)
|
||||
{
|
||||
|
@ -217,17 +233,8 @@ void init(void)
|
|||
#endif
|
||||
|
||||
#if defined(BUTTONS)
|
||||
#ifdef BUTTON_A_PIN
|
||||
IO_t buttonAPin = IOGetByTag(IO_TAG(BUTTON_A_PIN));
|
||||
IOInit(buttonAPin, OWNER_SYSTEM, 0);
|
||||
IOConfigGPIO(buttonAPin, IOCFG_IPU);
|
||||
#endif
|
||||
|
||||
#ifdef BUTTON_B_PIN
|
||||
IO_t buttonBPin = IOGetByTag(IO_TAG(BUTTON_B_PIN));
|
||||
IOInit(buttonBPin, OWNER_SYSTEM, 0);
|
||||
IOConfigGPIO(buttonBPin, IOCFG_IPU);
|
||||
#endif
|
||||
buttonsInit();
|
||||
|
||||
// Check status of bind plug and exit if not active
|
||||
delayMicroseconds(10); // allow configuration to settle
|
||||
|
@ -238,7 +245,7 @@ void init(void)
|
|||
uint8_t secondsRemaining = 5;
|
||||
bool bothButtonsHeld;
|
||||
do {
|
||||
bothButtonsHeld = !IORead(buttonAPin) && !IORead(buttonBPin);
|
||||
bothButtonsHeld = buttonAPressed() && buttonBPressed();
|
||||
if (bothButtonsHeld) {
|
||||
if (--secondsRemaining == 0) {
|
||||
resetEEPROM();
|
||||
|
@ -375,8 +382,8 @@ void init(void)
|
|||
updateHardwareRevision();
|
||||
#endif
|
||||
|
||||
#ifdef VTX
|
||||
vtxInit();
|
||||
#ifdef VTX_RTC6705
|
||||
rtc6705IOInit();
|
||||
#endif
|
||||
|
||||
#if defined(SONAR_SOFTSERIAL2_EXCLUSIVE) && defined(SONAR) && defined(USE_SOFTSERIAL2)
|
||||
|
@ -439,19 +446,6 @@ void init(void)
|
|||
|
||||
rxInit();
|
||||
|
||||
/*
|
||||
* VTX
|
||||
*/
|
||||
|
||||
#ifdef USE_RTC6705
|
||||
if (feature(FEATURE_VTX)) {
|
||||
rtc6705_soft_spi_init();
|
||||
current_vtx_channel = vtxConfig()->vtx_channel;
|
||||
rtc6705_soft_spi_set_channel(vtx_freq[current_vtx_channel]);
|
||||
rtc6705_soft_spi_set_rf_power(vtxConfig()->vtx_power);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* CMS, display devices and OSD
|
||||
*/
|
||||
|
@ -568,13 +562,25 @@ void init(void)
|
|||
#endif
|
||||
|
||||
#ifdef VTX_CONTROL
|
||||
vtxControlInit();
|
||||
|
||||
vtxCommonInit();
|
||||
|
||||
#ifdef VTX_SMARTAUDIO
|
||||
smartAudioInit();
|
||||
vtxSmartAudioInit();
|
||||
#endif
|
||||
|
||||
#ifdef VTX_TRAMP
|
||||
trampInit();
|
||||
vtxTrampInit();
|
||||
#endif
|
||||
|
||||
#ifdef VTX_RTC6705
|
||||
#ifdef VTX_RTC6705OPTIONAL
|
||||
if (!vtxCommonDeviceRegistered()) // external VTX takes precedence when configured.
|
||||
#endif
|
||||
{
|
||||
vtxRTC6705Init();
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // VTX_CONTROL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue