mirror of
https://github.com/egzumer/uv-k5-firmware-custom
synced 2024-11-22 01:32:43 +00:00
CTCSS tail define renamed
This commit is contained in:
parent
7cdb0c9a33
commit
84087c3d13
6
Makefile
6
Makefile
@ -13,7 +13,7 @@ ENABLE_KEEP_MEM_NAME := 1
|
||||
ENABLE_CHAN_NAME_FREQ := 1
|
||||
ENABLE_WIDE_RX := 1
|
||||
ENABLE_TX_WHEN_AM := 0
|
||||
ENABLE_TAIL_CTCSS_PHASE_SHIFT := 1
|
||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
|
||||
#ENABLE_SINGLE_VFO_CHAN := 1
|
||||
#ENABLE_BAND_SCOPE := 1
|
||||
|
||||
@ -168,8 +168,8 @@ endif
|
||||
ifeq ($(ENABLE_TX_WHEN_AM),1)
|
||||
CFLAGS += -DENABLE_TX_WHEN_AM
|
||||
endif
|
||||
ifeq ($(ENABLE_TAIL_CTCSS_PHASE_SHIFT),1)
|
||||
CFLAGS += -DENABLE_TAIL_CTCSS_PHASE_SHIFT
|
||||
ifeq ($(ENABLE_CTCSS_TAIL_PHASE_SHIFT),1)
|
||||
CFLAGS += -DENABLE_CTCSS_TAIL_PHASE_SHIFT
|
||||
endif
|
||||
ifeq ($(ENABLE_SINGLE_VFO_CHAN),1)
|
||||
CFLAGS += -DENABLE_SINGLE_VFO_CHAN
|
||||
|
16
README.md
16
README.md
@ -12,9 +12,9 @@ This version you can customize at compile time by making various changes to the
|
||||
You can edit those changes by (currently) editing the MakeFile, look for these lines at the top of the file ..
|
||||
|
||||
* ENABLE_AIRCOPY := 0
|
||||
* ENABLE_FMRADIO := 0 FM band 2 radio
|
||||
* ENABLE_FMRADIO := 0 FM band 2 RX
|
||||
* ENABLE_OVERLAY := 1
|
||||
* ENABLE_UART := 1 without this you can't configure the radio with your PC
|
||||
* ENABLE_UART := 1 without this you ENABLE_TAIL_CTCSS_PHASE_SHIFTcan't configure the radio with your PC
|
||||
* ENABLE_NOAA := 0 NOAA channels
|
||||
* ENABLE_VOICE := 0 strange voices
|
||||
* ENABLE_ALARM := 0 TX alarms
|
||||
@ -23,22 +23,20 @@ You can edit those changes by (currently) editing the MakeFile, look for these l
|
||||
* ENABLE_CHAN_NAME_FREQ := 1 show the channel frequency below the channel name/number
|
||||
* ENABLE_WIDE_RX := 1 enable the RX in the full 18MHz to 1300MHz (though frontend is not tuned for full range)
|
||||
* ENABLE_TX_WHEN_AM := 0 allow TX when RX set to AM
|
||||
* ENABLE_TAIL_CTCSS_PHASE_SHIFT := 1 use CTCSS tail phase shift rather than QS's 55Hz tone method
|
||||
* ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 use CTCSS tail phase shift rather than QS's 55Hz tone method
|
||||
* #ENABLE_SINGLE_VFO_CHAN := 1 not yet implemented
|
||||
* #ENABLE_BAND_SCOPE := 1 not yet implemented
|
||||
|
||||
To enable the custom option, set the above option to '1'
|
||||
|
||||
# Other changes made
|
||||
# Some other changes made
|
||||
|
||||
* Various bugs fixed that the QS firmware had (TX tail, Menu confimation etc)
|
||||
* Various bugs fixed that the QS firmware had
|
||||
* Added new bugs
|
||||
* Battery voltage boot screen now includes percentage
|
||||
* Slightly less intense menu style
|
||||
* AM RX now allowed everywhere, although the radio really doesn't do AM, the adverts are a con !
|
||||
* Finer RSSI bar steps
|
||||
* Nicer/cleaner big numeric font than original QS big numeric font
|
||||
* Various menu re-wordings - to try and reduce 'WTH does that mean ?'
|
||||
* Various menu re-wordings - trying to reduce 'WTH does that mean ?'
|
||||
* + others
|
||||
|
||||
# Compiler
|
||||
|
||||
|
94
dcs.c
94
dcs.c
@ -16,27 +16,17 @@
|
||||
|
||||
#include "dcs.h"
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||
#ifndef ARRAY_SIZE
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||
#endif
|
||||
|
||||
// CTCSS Hz * 10
|
||||
const uint16_t CTCSS_Options[50] = {
|
||||
#if 0
|
||||
670, 693, 719, 0x02E8, 0x0302, 0x031D, 0x0339, 0x0356,
|
||||
0x0375, 0x0393, 0x03B4, 0x03CE, 0x03E8, 0x040B, 0x0430, 0x0455,
|
||||
0x047C, 0x04A4, 0x04CE, 0x04F9, 0x0526, 0x0555, 0x0585, 0x05B6,
|
||||
0x05EA, 0x061F, 0x063E, 0x0656, 0x0677, 0x068F, 0x06B1, 0x06CA,
|
||||
0x06ED, 0x0707, 0x072B, 0x0746, 0x076B, 0x0788, 0x07AE, 0x07CB,
|
||||
0x07F3, 0x0811, 0x083B, 0x0885, 0x08D1, 0x08F3, 0x0920, 0x0972,
|
||||
0x09C7, 0x09ED
|
||||
#else
|
||||
670, 693, 719, 744, 770, 797, 825, 854,
|
||||
885, 915, 948, 974, 1000, 1035, 1072, 1109,
|
||||
1148, 1188, 1230, 1273, 1318, 1365, 1413, 1462,
|
||||
1514, 1567, 1598, 1622, 1655, 1679, 1713, 1738,
|
||||
1773, 1799, 1835, 1862, 1899, 1928, 1966, 1995,
|
||||
2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418,
|
||||
2503, 2541
|
||||
#endif
|
||||
670, 693, 719, 744, 770, 797, 825, 854, 885, 915,
|
||||
948, 974, 1000, 1035, 1072, 1109, 1148, 1188, 1230, 1273,
|
||||
1318, 1365, 1413, 1462, 1514, 1567, 1598, 1622, 1655, 1679,
|
||||
1713, 1738, 1773, 1799, 1835, 1862, 1899, 1928, 1966, 1995,
|
||||
2035, 2065, 2107, 2181, 2257, 2291, 2336, 2418, 2503, 2541
|
||||
};
|
||||
|
||||
const uint16_t DCS_Options[104] = {
|
||||
@ -57,53 +47,44 @@ const uint16_t DCS_Options[104] = {
|
||||
|
||||
static uint32_t DCS_CalculateGolay(uint32_t CodeWord)
|
||||
{
|
||||
uint32_t Word;
|
||||
uint8_t i;
|
||||
|
||||
Word = CodeWord;
|
||||
for (i = 0; i < 12; i++) {
|
||||
unsigned int i;
|
||||
uint32_t Word = CodeWord;
|
||||
for (i = 0; i < 12; i++)
|
||||
{
|
||||
Word <<= 1;
|
||||
if (Word & 0x1000) {
|
||||
if (Word & 0x1000)
|
||||
Word ^= 0x08EA;
|
||||
}
|
||||
}
|
||||
return CodeWord | ((Word & 0x0FFE) << 11);
|
||||
}
|
||||
|
||||
uint32_t DCS_GetGolayCodeWord(DCS_CodeType_t CodeType, uint8_t Option)
|
||||
{
|
||||
uint32_t Code;
|
||||
|
||||
Code = DCS_CalculateGolay(DCS_Options[Option] + 0x800U);
|
||||
if (CodeType == CODE_TYPE_REVERSE_DIGITAL) {
|
||||
uint32_t Code = DCS_CalculateGolay(DCS_Options[Option] + 0x800U);
|
||||
if (CodeType == CODE_TYPE_REVERSE_DIGITAL)
|
||||
Code ^= 0x7FFFFF;
|
||||
}
|
||||
|
||||
return Code;
|
||||
}
|
||||
|
||||
uint8_t DCS_GetCdcssCode(uint32_t Code)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; i < 23; i++) {
|
||||
unsigned int i;
|
||||
for (i = 0; i < 23; i++)
|
||||
{
|
||||
uint32_t Shift;
|
||||
|
||||
if (((Code >> 9) & 0x7U) == 4) {
|
||||
uint8_t j;
|
||||
|
||||
for (j = 0; j < ARRAY_SIZE(DCS_Options); j++) {
|
||||
if (DCS_Options[j] == (Code & 0x1FF)) {
|
||||
if (DCS_GetGolayCodeWord(2, j) == Code) {
|
||||
if (((Code >> 9) & 0x7U) == 4)
|
||||
{
|
||||
unsigned int j;
|
||||
for (j = 0; j < ARRAY_SIZE(DCS_Options); j++)
|
||||
if (DCS_Options[j] == (Code & 0x1FF))
|
||||
if (DCS_GetGolayCodeWord(2, j) == Code)
|
||||
return j;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Shift = Code >> 1;
|
||||
if (Code & 1U) {
|
||||
if (Code & 1U)
|
||||
Shift |= 0x400000U;
|
||||
}
|
||||
Code = Shift;
|
||||
}
|
||||
|
||||
@ -112,24 +93,21 @@ uint8_t DCS_GetCdcssCode(uint32_t Code)
|
||||
|
||||
uint8_t DCS_GetCtcssCode(uint16_t Code)
|
||||
{
|
||||
uint8_t i;
|
||||
int Smallest;
|
||||
uint8_t Result = 0xFF;
|
||||
unsigned int i;
|
||||
uint8_t Result = 0xFF;
|
||||
int Smallest = ARRAY_SIZE(CTCSS_Options);
|
||||
|
||||
Smallest = ARRAY_SIZE(CTCSS_Options);
|
||||
for (i = 0; i < ARRAY_SIZE(CTCSS_Options); i++) {
|
||||
int Delta;
|
||||
|
||||
Delta = Code - CTCSS_Options[i];
|
||||
if (Delta < 0) {
|
||||
for (i = 0; i < ARRAY_SIZE(CTCSS_Options); i++)
|
||||
{
|
||||
int Delta = Code - CTCSS_Options[i];
|
||||
if (Delta < 0)
|
||||
Delta = -(Code - CTCSS_Options[i]);
|
||||
}
|
||||
if (Delta < Smallest) {
|
||||
if (Smallest > Delta)
|
||||
{
|
||||
Smallest = Delta;
|
||||
Result = i;
|
||||
Result = i;
|
||||
}
|
||||
}
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
@ -654,7 +654,7 @@ void BK4819_ExitSubAu(void)
|
||||
// REG_51 <9> 0 Auto CDCSS Bw Mode 1 = Disable 0 = Enable.
|
||||
// REG_51 <8> 0 Auto CTCSS Bw Mode 0 = Enable 1 = Disable
|
||||
// REG_51 <6:0> 0 CTCSS/CDCSS Tx Gain1 Tuning 0 = min 127 = max
|
||||
|
||||
//
|
||||
BK4819_WriteRegister(BK4819_REG_51, 0x0000);
|
||||
}
|
||||
|
||||
@ -878,7 +878,7 @@ void BK4819_EnableCDCSS(void)
|
||||
|
||||
void BK4819_EnableCTCSS(void)
|
||||
{
|
||||
#ifdef ENABLE_TAIL_CTCSS_PHASE_SHIFT
|
||||
#ifdef ENABLE_CTCSS_TAIL_PHASE_SHIFT
|
||||
//BK4819_GenTail(1); // 120° phase shift
|
||||
BK4819_GenTail(2); // 180° phase shift
|
||||
//BK4819_GenTail(3); // 240° phase shift
|
||||
|
4
radio.c
4
radio.c
@ -595,7 +595,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
case CODE_TYPE_OFF:
|
||||
BK4819_SetCTCSSFrequency(670);
|
||||
|
||||
//#ifndef ENABLE_TAIL_CTCSS_PHASE_SHIFT
|
||||
//#ifndef ENABLE_CTCSS_TAIL_PHASE_SHIFT
|
||||
BK4819_SetTailDetection(550); // QS's 55Hz tone method
|
||||
//#else
|
||||
// BK4819_SetTailDetection(670); // 67Hz
|
||||
@ -611,7 +611,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
case CODE_TYPE_CONTINUOUS_TONE:
|
||||
BK4819_SetCTCSSFrequency(CTCSS_Options[Code]);
|
||||
|
||||
//#ifndef ENABLE_TAIL_CTCSS_PHASE_SHIFT
|
||||
//#ifndef ENABLE_CTCSS_TAIL_PHASE_SHIFT
|
||||
BK4819_SetTailDetection(550); // QS's 55Hz tone method
|
||||
//#else
|
||||
// BK4819_SetTailDetection(CTCSS_Options[Code]);
|
||||
|
Loading…
Reference in New Issue
Block a user