mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 06:11:24 +03:00
fix key beeps + new copy VFO to chan
This commit is contained in:
parent
36ee70df5b
commit
44c1cdbe58
2
Makefile
2
Makefile
@ -8,7 +8,7 @@ ENABLE_SWD := 0
|
||||
ENABLE_OVERLAY := 0
|
||||
ENABLE_LTO := 1
|
||||
ENABLE_UART := 1
|
||||
ENABLE_UART_DEBUG := 0
|
||||
ENABLE_UART_DEBUG := 1
|
||||
ENABLE_AIRCOPY := 1
|
||||
ENABLE_AIRCOPY_REMEMBER_FREQ := 1
|
||||
ENABLE_AIRCOPY_RX_REBOOT := 0
|
||||
|
@ -2544,7 +2544,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
|
||||
// g_ptt_was_pressed = false;
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
UART_printf("proc key 1 %3u %u %u %u %u\r\n", Key, key_pressed, key_held, g_fkey_pressed, flag);
|
||||
// UART_printf("proc key 1 %3u %u %u %u %u\r\n", Key, key_pressed, key_held, g_fkey_pressed, flag);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -2566,12 +2566,12 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
|
||||
// g_ptt_was_released = false;
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
UART_printf("proc key 2 %3u %u %u %u %u\r\n", Key, key_pressed, key_held, g_fkey_pressed, flag);
|
||||
// UART_printf("proc key 2 %3u %u %u %u %u\r\n", Key, key_pressed, key_held, g_fkey_pressed, flag);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
UART_printf("proc key 3 %3u %u %u %u %u\r\n", Key, key_pressed, key_held, g_fkey_pressed, flag);
|
||||
// UART_printf("proc key 3 %3u %u %u %u %u\r\n", Key, key_pressed, key_held, g_fkey_pressed, flag);
|
||||
#endif
|
||||
|
||||
if (!flag) // this flag is responsible for keys being ignored :(
|
||||
|
38
app/main.c
38
app/main.c
@ -618,7 +618,8 @@ void MAIN_Key_MENU(const bool key_pressed, const bool key_held)
|
||||
g_eeprom.vfo_open)
|
||||
{ // not scanning
|
||||
|
||||
const unsigned int vfo = get_RX_VFO();
|
||||
//const unsigned int vfo = get_RX_VFO();
|
||||
const unsigned int vfo = g_eeprom.tx_vfo;
|
||||
|
||||
if (IS_USER_CHANNEL(g_eeprom.screen_channel[vfo]))
|
||||
{ // copy channel to VFO, then swap to the VFO
|
||||
@ -636,7 +637,8 @@ void MAIN_Key_MENU(const bool key_pressed, const bool key_held)
|
||||
|
||||
g_request_save_vfo = true;
|
||||
|
||||
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
g_beep_to_play = BEEP_880HZ_60MS_TRIPLE_BEEP;
|
||||
//g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
|
||||
|
||||
g_update_status = true;
|
||||
g_update_display = true;
|
||||
@ -645,16 +647,30 @@ void MAIN_Key_MENU(const bool key_pressed, const bool key_held)
|
||||
if (IS_FREQ_CHANNEL(g_eeprom.screen_channel[vfo]))
|
||||
{ // copy VFO to channel
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
g_another_voice_id = VOICE_ID_MENU;
|
||||
#endif
|
||||
|
||||
// g_request_display_screen = DISPLAY_MENU;
|
||||
// search the channels to see if the frequency is already present
|
||||
const unsigned int chan = BOARD_find_channel(g_eeprom.vfo_info[vfo].p_tx->frequency);
|
||||
|
||||
g_screen_to_display = DISPLAY_INVALID;
|
||||
GUI_SelectNextDisplay(DISPLAY_MENU);
|
||||
g_menu_cursor = MENU_MEM_SAVE;
|
||||
g_flag_refresh_menu = true;
|
||||
g_ask_for_confirmation = 0;
|
||||
g_is_in_sub_menu = true;
|
||||
|
||||
g_flag_refresh_menu = false;
|
||||
g_menu_cursor = MENU_MEM_SAVE;
|
||||
g_is_in_sub_menu = true;
|
||||
|
||||
if (chan <= USER_CHANNEL_LAST)
|
||||
{ // go straight to the channel that holds the same frequency
|
||||
g_sub_menu_selection = chan;
|
||||
}
|
||||
|
||||
g_screen_to_display = DISPLAY_MENU;
|
||||
g_update_display = false;
|
||||
UI_DisplayMenu();
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
g_another_voice_id = VOICE_ID_MENU;
|
||||
#endif
|
||||
|
||||
g_beep_to_play = BEEP_880HZ_60MS_TRIPLE_BEEP;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
11
audio.c
11
audio.c
@ -29,6 +29,7 @@
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/system.h"
|
||||
#include "driver/systick.h"
|
||||
#include "driver/uart.h"
|
||||
#include "functions.h"
|
||||
#include "misc.h"
|
||||
#include "settings.h"
|
||||
@ -96,7 +97,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
|
||||
// return;
|
||||
#endif
|
||||
if (g_current_function == FUNCTION_RECEIVE || g_current_function == FUNCTION_MONITOR)
|
||||
return;
|
||||
return; // not while the speakers in use
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
@ -110,9 +111,13 @@ void AUDIO_PlayBeep(beep_type_t Beep)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
// UART_printf("beep %u\r\n", (unsigned int)Beep);
|
||||
#endif
|
||||
|
||||
// whats this for ?
|
||||
// SYSTEM_DelayMs(20);
|
||||
SYSTEM_DelayMs(2);
|
||||
SYSTEM_DelayMs(20);
|
||||
// SYSTEM_DelayMs(2);
|
||||
|
||||
switch (Beep)
|
||||
{
|
||||
|
38
board.c
38
board.c
@ -843,23 +843,45 @@ void BOARD_EEPROM_LoadCalibration(void)
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int BOARD_find_channel(const uint32_t frequency)
|
||||
{
|
||||
unsigned int chan;
|
||||
|
||||
if (frequency == 0 || frequency == 0xffffffff)
|
||||
return 0xffffffff;
|
||||
|
||||
for (chan = 0; chan <= USER_CHANNEL_LAST; chan++)
|
||||
{
|
||||
uint32_t chan_freq;
|
||||
|
||||
if ((g_user_channel_attributes[chan] & USER_CH_BAND_MASK) > BAND7_470MHz)
|
||||
continue;
|
||||
|
||||
EEPROM_ReadBuffer(chan * 16, &chan_freq, 4);
|
||||
|
||||
if (chan_freq == 0 || chan_freq == 0xffffffff)
|
||||
continue;
|
||||
|
||||
if (chan_freq == frequency)
|
||||
return chan; // found it
|
||||
}
|
||||
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
||||
uint32_t BOARD_fetchChannelFrequency(const int channel)
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint32_t frequency;
|
||||
uint32_t offset;
|
||||
} __attribute__((packed)) info;
|
||||
uint32_t frequency;
|
||||
|
||||
if (channel < 0 || channel > (int)FREQ_CHANNEL_LAST)
|
||||
return 0;
|
||||
|
||||
if (!RADIO_CheckValidChannel(channel, false, 0))
|
||||
if ((g_user_channel_attributes[channel] & USER_CH_BAND_MASK) > BAND7_470MHz)
|
||||
return 0;
|
||||
|
||||
EEPROM_ReadBuffer(channel * 16, &info, sizeof(info));
|
||||
EEPROM_ReadBuffer(channel * 16, &frequency, 4);
|
||||
|
||||
return info.frequency;
|
||||
return frequency;
|
||||
}
|
||||
|
||||
unsigned int BOARD_fetchChannelStepSetting(const int channel)
|
||||
|
1
board.h
1
board.h
@ -27,6 +27,7 @@ void BOARD_ADC_GetBatteryInfo(uint16_t *pVoltage, uint16_t *pCurrent);
|
||||
void BOARD_Init(void);
|
||||
void BOARD_EEPROM_load(void);
|
||||
void BOARD_EEPROM_LoadCalibration(void);
|
||||
unsigned int BOARD_find_channel(const uint32_t frequency);
|
||||
uint32_t BOARD_fetchChannelFrequency(const int channel);
|
||||
unsigned int BOARD_fetchChannelStepSetting(const int channel);
|
||||
void BOARD_fetchChannelName(char *s, const int channel);
|
||||
|
@ -1038,14 +1038,15 @@ void BK4819_StartTone1(const uint16_t frequency, const unsigned int level, const
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); // enable speaker
|
||||
SYSTEM_DelayMs(2);
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | ((level & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
|
||||
|
||||
if (set_dac)
|
||||
{
|
||||
//BK4819_WriteRegister(BK4819_REG_30, 0);
|
||||
//BK4819_WriteRegister(BK4819_REG_30, BK4819_REG_30_ENABLE_AF_DAC | BK4819_REG_30_ENABLE_DISC_MODE | BK4819_REG_30_ENABLE_TX_DSP);
|
||||
BK4819_EnableTXLink();
|
||||
BK4819_WriteRegister(BK4819_REG_30, 0);
|
||||
BK4819_WriteRegister(BK4819_REG_30, BK4819_REG_30_ENABLE_AF_DAC | BK4819_REG_30_ENABLE_DISC_MODE | BK4819_REG_30_ENABLE_TX_DSP);
|
||||
//BK4819_EnableTXLink();
|
||||
}
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | ((level & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
|
||||
BK4819_WriteRegister(BK4819_REG_71, scale_freq(frequency));
|
||||
BK4819_ExitTxMute();
|
||||
}
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user