diff --git a/src/main/io/vtx_singularity.c b/src/main/io/vtx_singularity.c deleted file mode 100644 index 1831a6c81..000000000 --- a/src/main/io/vtx_singularity.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * This file is part of Cleanflight. - * - * Cleanflight is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Cleanflight is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Cleanflight. If not, see . - */ - - -// Get target build configuration -#include "platform.h" - -#ifdef VTX_SINGULARITY - -// Own interfaces -#include "io/vtx_singularity.h" -#include "io/osd.h" - -//External dependencies -#include "config/config_master.h" -#include "config/config_eeprom.h" -#include "drivers/vtx_rtc6705.h" -#include "fc/runtime_config.h" -#include "io/beeper.h" - - -static uint8_t locked = 0; - -void vtxSingularityInit(void) -{ - rtc6705Init(); - if (masterConfig.vtx_mode == 0) { - rtc6705SetChannel(masterConfig.vtx_band, masterConfig.vtx_channel); - } else if (masterConfig.vtx_mode == 1) { - rtc6705SetFreq(masterConfig.vtx_mhz); - } -} - -static void setChannelSaveAndNotify(uint8_t *bandOrChannel, uint8_t step, int32_t min, int32_t max) -{ - if (ARMING_FLAG(ARMED)) { - locked = 1; - } - - if (masterConfig.vtx_mode == 0 && !locked) { - uint8_t temp = (*bandOrChannel) + step; - temp = constrain(temp, min, max); - *bandOrChannel = temp; - - rtc6705SetChannel(masterConfig.vtx_band, masterConfig.vtx_channel); - writeEEPROM(); - readEEPROM(); - beeperConfirmationBeeps(temp); - } -} - -void vtxSingularityIncrementBand(void) -{ - setChannelSaveAndNotify(&(masterConfig.vtx_band), 1, RTC6705_BAND_MIN, RTC6705_BAND_MAX); -} - -void vtxSingularityDecrementBand(void) -{ - setChannelSaveAndNotify(&(masterConfig.vtx_band), -1, RTC6705_BAND_MIN, RTC6705_BAND_MAX); -} - -void vtxSingularityIncrementChannel(void) -{ - setChannelSaveAndNotify(&(masterConfig.vtx_channel), 1, RTC6705_CHANNEL_MIN, RTC6705_CHANNEL_MAX); -} - -void vtxSingularityDecrementChannel(void) -{ - setChannelSaveAndNotify(&(masterConfig.vtx_channel), -1, RTC6705_CHANNEL_MIN, RTC6705_CHANNEL_MAX); -} - -void vtxSingularityUpdateActivatedChannel(void) -{ - if (ARMING_FLAG(ARMED)) { - locked = 1; - } - - if (masterConfig.vtx_mode == 2 && !locked) { - static uint8_t lastIndex = -1; - uint8_t index; - - for (index = 0; index < MAX_CHANNEL_ACTIVATION_CONDITION_COUNT; index++) { - vtxChannelActivationCondition_t *vtxChannelActivationCondition = &masterConfig.vtxChannelActivationConditions[index]; - - if (isRangeActive(vtxChannelActivationCondition->auxChannelIndex, &vtxChannelActivationCondition->range) - && index != lastIndex) { - lastIndex = index; - rtc6705SetChannel(vtxChannelActivationCondition->band, vtxChannelActivationCondition->channel); - break; - } - } - } -} - -#endif - diff --git a/src/main/io/vtx_singularity.h b/src/main/io/vtx_singularity.h deleted file mode 100644 index a823aacb8..000000000 --- a/src/main/io/vtx_singularity.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This file is part of Cleanflight. - * - * Cleanflight is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Cleanflight is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Cleanflight. If not, see . - */ - -#pragma once - -#include "fc/rc_controls.h" - -#define VTX_BAND_MIN 1 -#define VTX_BAND_MAX 5 -#define VTX_CHANNEL_MIN 1 -#define VTX_CHANNEL_MAX 8 -#define MAX_CHANNEL_ACTIVATION_CONDITION_COUNT 10 - -typedef struct vtxChannelActivationCondition_s { - uint8_t auxChannelIndex; - uint8_t band; - uint8_t channel; - channelRange_t range; -} vtxChannelActivationCondition_t; - -void vtxSingularityInit(void); -void vtxSingularityIncrementBand(void); -void vtxSingularityDecrementBand(void); -void vtxSingularityIncrementChannel(void); -void vtxSingularityDecrementChannel(void); -void vtxSingularityUpdateActivatedChannel(void); -