mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 14:21:25 +03:00
AIRCOPY TX power reduced from full power to it's bare minimum (a couple of mW's).
This commit is contained in:
parent
17deb5a237
commit
d1c9d184d0
@ -44,10 +44,13 @@ uint16_t g_aircopy_fsk_buffer[36];
|
||||
uint8_t g_aircopy_send_count_down_10ms;
|
||||
unsigned int g_aircopy_fsk_write_index;
|
||||
|
||||
void AIRCOPY_SendMessage(void)
|
||||
void AIRCOPY_SendMessage(const uint8_t request_packet)
|
||||
{
|
||||
unsigned int i;
|
||||
const uint16_t eeprom_addr = (uint16_t)g_aircopy_block_number * 64;
|
||||
|
||||
// will be used to ask the TX/ing radio to resend a missing/corrupted packet
|
||||
(void)request_packet;
|
||||
|
||||
// *********
|
||||
|
||||
@ -72,11 +75,12 @@ void AIRCOPY_SendMessage(void)
|
||||
for (i = 0; i < 34; i++)
|
||||
g_aircopy_fsk_buffer[1 + i] ^= Obfuscation[i % ARRAY_SIZE(Obfuscation)];
|
||||
|
||||
// TX the packet
|
||||
RADIO_SetTxParameters();
|
||||
|
||||
BK4819_SetupPowerAmplifier(0, g_current_vfo->pTX->frequency); // VERY low TX power
|
||||
BK4819_SendFSKData(g_aircopy_fsk_buffer);
|
||||
BK4819_SetupPowerAmplifier(0, 0);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, false);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO5_PIN1, false);
|
||||
|
||||
if (++g_aircopy_block_number >= g_aircopy_block_max)
|
||||
{
|
||||
@ -250,11 +254,11 @@ static void AIRCOPY_Key_MENU(bool key_pressed, bool key_held)
|
||||
|
||||
g_aircopy_fsk_write_index = 0;
|
||||
g_aircopy_block_number = 0;
|
||||
g_aircopy_fsk_buffer[0] = AIRCOPY_MAGIC_START;
|
||||
g_aircopy_fsk_buffer[1] = 0; // block number
|
||||
g_aircopy_fsk_buffer[35] = AIRCOPY_MAGIC_END;
|
||||
|
||||
AIRCOPY_SendMessage();
|
||||
// send initial packet
|
||||
//AIRCOPY_SendMessage(0xff);
|
||||
|
||||
g_aircopy_send_count_down_10ms = 30 / 10; // 30ms
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ extern uint16_t g_aircopy_fsk_buffer[36];
|
||||
extern uint8_t g_aircopy_send_count_down_10ms;
|
||||
extern unsigned int g_aircopy_fsk_write_index;
|
||||
|
||||
void AIRCOPY_SendMessage(void);
|
||||
void AIRCOPY_SendMessage(const uint8_t request_packet);
|
||||
void AIRCOPY_StorePacket(void);
|
||||
void AIRCOPY_ProcessKeys(key_code_t key, bool key_pressed, bool key_held);
|
||||
|
||||
|
14
app/app.c
14
app/app.c
@ -916,13 +916,13 @@ void APP_CheckRadioInterrupts(void)
|
||||
if (interrupt_status_bits & BK4819_REG_02_SQUELCH_LOST)
|
||||
{
|
||||
g_squelch_lost = true;
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, true);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_GREEN, true);
|
||||
}
|
||||
|
||||
if (interrupt_status_bits & BK4819_REG_02_SQUELCH_FOUND)
|
||||
{
|
||||
g_squelch_lost = false;
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_GREEN, false);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
@ -1298,7 +1298,7 @@ void APP_Update(void)
|
||||
|
||||
BK4819_DisableVox();
|
||||
BK4819_Sleep();
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2, false);
|
||||
|
||||
// Authentic device checked removed
|
||||
|
||||
@ -1562,7 +1562,7 @@ void APP_TimeSlice10ms(void)
|
||||
{
|
||||
if (--g_aircopy_send_count_down_10ms == 0)
|
||||
{
|
||||
AIRCOPY_SendMessage();
|
||||
AIRCOPY_SendMessage(0xff);
|
||||
GUI_DisplayScreen();
|
||||
}
|
||||
}
|
||||
@ -1639,9 +1639,9 @@ void APP_TimeSlice10ms(void)
|
||||
|
||||
RADIO_EnableCxCSS();
|
||||
BK4819_SetupPowerAmplifier(0, 0);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, false);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO5_PIN1, false);
|
||||
BK4819_Enable_AfDac_DiscMode_TxDsp();
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_RED, false);
|
||||
|
||||
GUI_DisplayScreen();
|
||||
}
|
||||
@ -1651,7 +1651,7 @@ void APP_TimeSlice10ms(void)
|
||||
|
||||
GUI_DisplayScreen();
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_RED, true);
|
||||
RADIO_SetTxParameters();
|
||||
BK4819_TransmitTone(true, 500);
|
||||
SYSTEM_DelayMs(2);
|
||||
|
@ -364,7 +364,7 @@ static void ToggleRX(bool on) {
|
||||
ToggleTX(false);
|
||||
}
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, on);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_GREEN, on);
|
||||
BK4819_RX_TurnOn();
|
||||
|
||||
ToggleAudio(on);
|
||||
@ -399,7 +399,7 @@ static void ToggleTX(bool on) {
|
||||
ToggleRX(false);
|
||||
}
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, on);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_RED, on);
|
||||
|
||||
if (on) {
|
||||
ToggleAudio(false);
|
||||
@ -434,8 +434,8 @@ static void ToggleTX(bool on) {
|
||||
|
||||
SetF(fMeasure);
|
||||
}
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, !on);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, on);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2, !on);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO5_PIN1, on);
|
||||
}
|
||||
|
||||
// Scan info
|
||||
|
@ -347,7 +347,7 @@ void BK4819_SetAGC(uint8_t Value)
|
||||
}
|
||||
}
|
||||
|
||||
void BK4819_ToggleGpioOut(BK4819_GPIO_PIN_t Pin, bool bSet)
|
||||
void BK4819_set_GPIO_pin(BK4819_GPIO_PIN_t Pin, bool bSet)
|
||||
{
|
||||
if (bSet)
|
||||
gBK4819_GpioOutState |= (0x40u >> Pin);
|
||||
@ -703,7 +703,7 @@ void BK4819_SetupPowerAmplifier(const uint8_t bias, const uint32_t frequency)
|
||||
// 280MHz gain 1 = 1 gain 2 = 0 gain 1 = 4 gain 2 = 2
|
||||
const uint8_t gain = (frequency < 28000000) ? (1u << 3) | (0u << 0) : (4u << 3) | (2u << 0);
|
||||
const uint8_t enable = 1;
|
||||
BK4819_WriteRegister(BK4819_REG_36, (bias << 8) | (enable << 7) | (gain << 0));
|
||||
BK4819_WriteRegister(BK4819_REG_36, ((uint16_t)bias << 8) | ((uint16_t)enable << 7) | ((uint16_t)gain << 0));
|
||||
}
|
||||
|
||||
void BK4819_SetFrequency(uint32_t Frequency)
|
||||
@ -845,19 +845,19 @@ void BK4819_PickRXFilterPathBasedOnFrequency(uint32_t Frequency)
|
||||
{
|
||||
if (Frequency < 28000000)
|
||||
{
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO2_PIN30, true);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO3_PIN31, false);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO2_PIN30, true);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO3_PIN31, false);
|
||||
}
|
||||
else
|
||||
if (Frequency == 0xFFFFFFFF)
|
||||
{
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO2_PIN30, false);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO3_PIN31, false);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO2_PIN30, false);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO3_PIN31, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO2_PIN30, false);
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO3_PIN31, true);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO2_PIN30, false);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO3_PIN31, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1203,7 +1203,7 @@ void BK4819_Conditional_RX_TurnOn_and_GPIO6_Enable(void)
|
||||
{
|
||||
if (g_rx_idle_mode)
|
||||
{
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, true);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2, true);
|
||||
BK4819_RX_TurnOn();
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ void BK4819_WriteU16(uint16_t Data);
|
||||
|
||||
void BK4819_SetAGC(uint8_t Value);
|
||||
|
||||
void BK4819_ToggleGpioOut(BK4819_GPIO_PIN_t Pin, bool bSet);
|
||||
void BK4819_set_GPIO_pin(BK4819_GPIO_PIN_t Pin, bool bSet);
|
||||
|
||||
void BK4819_SetCDCSSCodeWord(uint32_t CodeWord);
|
||||
void BK4819_SetCTCSSFrequency(uint32_t BaudRate);
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
@ -167,7 +167,7 @@ void FUNCTION_Select(function_type_t Function)
|
||||
BK4819_DisableVox();
|
||||
BK4819_Sleep();
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2, false);
|
||||
|
||||
g_update_status = true;
|
||||
|
||||
@ -229,7 +229,7 @@ void FUNCTION_Select(function_type_t Function)
|
||||
RADIO_SetTxParameters();
|
||||
|
||||
// turn the RED LED on
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_RED, true);
|
||||
|
||||
DTMF_Reply();
|
||||
|
||||
|
12
radio.c
12
radio.c
@ -589,7 +589,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
|
||||
g_enable_speaker = false;
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO0_PIN28_GREEN, false);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||
@ -611,11 +611,11 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO1_PIN29_RED, false);
|
||||
|
||||
BK4819_SetupPowerAmplifier(0, 0);
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, false);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO5_PIN1, false);
|
||||
|
||||
while (1)
|
||||
{
|
||||
@ -649,7 +649,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||
BK4819_PickRXFilterPathBasedOnFrequency(Frequency);
|
||||
|
||||
// what does this in do ?
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, true);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2, true);
|
||||
|
||||
// AF RX Gain and DAC
|
||||
BK4819_WriteRegister(BK4819_REG_48, 0xB3A8); // 1011 00 111010 1000
|
||||
@ -843,7 +843,7 @@ void RADIO_SetTxParameters(void)
|
||||
|
||||
g_enable_speaker = false;
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2, false);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
|
||||
@ -876,7 +876,7 @@ void RADIO_SetTxParameters(void)
|
||||
|
||||
BK4819_PickRXFilterPathBasedOnFrequency(g_current_vfo->pTX->frequency);
|
||||
|
||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, true);
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO5_PIN1, true);
|
||||
|
||||
SYSTEM_DelayMs(5);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user