0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-19 14:48:03 +03:00

Added FM radio lower frequency options

This commit is contained in:
OneOfEleven
2023-10-22 23:59:47 +01:00
parent 7aff322458
commit df3d298487
26 changed files with 127 additions and 119 deletions

View File

@ -19,13 +19,13 @@
#include "app/action.h"
#include "app/app.h"
#include "app/dtmf.h"
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "app/search.h"
#include "audio.h"
#include "bsp/dp32g030/gpio.h"
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "driver/bk1080.h"
#endif
#include "driver/bk4819.h"
@ -105,7 +105,7 @@ void ACTION_Monitor(void)
RADIO_setup_registers(true);
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode)
{
FM_Start();
@ -118,7 +118,7 @@ void ACTION_Monitor(void)
void ACTION_Scan(bool bRestart)
{
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode)
{
if (g_current_function != FUNCTION_RECEIVE &&
@ -304,7 +304,7 @@ void ACTION_Scan(bool bRestart)
#endif
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
void ACTION_FM(void)
{
if (g_current_function != FUNCTION_TRANSMIT && g_current_function != FUNCTION_MONITOR)
@ -398,7 +398,7 @@ void ACTION_process(const key_code_t Key, const bool key_pressed, const bool key
ACTION_AlarmOr1750(false);
#endif
break;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
case ACTION_OPT_FM:
ACTION_FM();
break;

View File

@ -29,7 +29,7 @@ void ACTION_Scan(bool bFlag);
#ifdef ENABLE_ALARM
//static void ACTION_AlarmOr1750(bool b1750)
#endif
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
void ACTION_FM(void);
#endif

View File

@ -23,7 +23,7 @@
#endif
#include "app/app.h"
#include "app/dtmf.h"
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "app/generic.h"
@ -36,7 +36,7 @@
#include "board.h"
#include "bsp/dp32g030/gpio.h"
#include "driver/backlight.h"
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "driver/bk1080.h"
#endif
#include "driver/bk4819.h"
@ -456,7 +456,7 @@ void APP_start_listening(function_type_t Function, const bool reset_am_fix)
if (g_setting_backlight_on_tx_rx >= 2)
backlight_turn_on(backlight_tx_rx_time_500ms);
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode)
BK1080_Init(0, false);
#endif
@ -554,7 +554,7 @@ void APP_start_listening(function_type_t Function, const bool reset_am_fix)
FUNCTION_Select(Function);
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (Function == FUNCTION_MONITOR || g_fm_radio_mode)
#else
if (Function == FUNCTION_MONITOR)
@ -1011,7 +1011,7 @@ void APP_end_tx(void)
g_vox_pause_count_down = 0;
}
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode)
return;
#endif
@ -1104,7 +1104,7 @@ void APP_process(void)
APP_process_function();
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode && g_fm_radio_count_down_500ms > 0)
return;
#endif
@ -1172,7 +1172,7 @@ void APP_process(void)
#ifdef ENABLE_VOICE
g_voice_write_index == 0 &&
#endif
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
!g_fm_radio_mode &&
#endif
g_dtmf_call_state == DTMF_CALL_STATE_NONE &&
@ -1192,7 +1192,7 @@ void APP_process(void)
g_rx_reception_mode = RX_MODE_NONE;
}
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_schedule_fm &&
g_fm_scan_state != FM_SCAN_OFF &&
g_current_function != FUNCTION_MONITOR &&
@ -1213,7 +1213,7 @@ void APP_process(void)
{
#ifdef ENABLE_NOAA
if (
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
g_fm_radio_mode ||
#endif
g_ptt_is_pressed ||
@ -1239,7 +1239,7 @@ void APP_process(void)
}
#else
if (
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
g_fm_radio_mode ||
#endif
g_ptt_is_pressed ||
@ -1561,7 +1561,7 @@ void APP_time_slice_10ms(void)
g_flag_save_settings = false;
}
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_flag_save_fm)
{
SETTINGS_save_fm();
@ -1647,7 +1647,7 @@ void APP_time_slice_10ms(void)
// Skipping authentic device checks
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode && g_fm_radio_count_down_500ms > 0)
return;
#endif
@ -1729,7 +1729,7 @@ void APP_time_slice_10ms(void)
}
}
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode && g_fm_restore_count_down_10ms > 0)
{
if (--g_fm_restore_count_down_10ms == 0)
@ -1971,7 +1971,7 @@ void APP_cancel_user_input_modes(void)
if (g_dtmf_input_mode || g_dtmf_input_box_index > 0)
{
DTMF_clear_input_box();
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode)
g_request_display_screen = DISPLAY_FM;
else
@ -2050,7 +2050,7 @@ void APP_time_slice_500ms(void)
// Skipped authentic device check
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_count_down_500ms > 0)
{
g_fm_radio_count_down_500ms--;
@ -2109,7 +2109,7 @@ void APP_time_slice_500ms(void)
#endif
}
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_scan_state == FM_SCAN_OFF || g_ask_to_save)
#endif
{
@ -2177,7 +2177,7 @@ void APP_time_slice_500ms(void)
{
gui_display_type_t disp = DISPLAY_INVALID;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode &&
g_current_function != FUNCTION_RECEIVE &&
g_current_function != FUNCTION_MONITOR &&
@ -2206,7 +2206,7 @@ void APP_time_slice_500ms(void)
if (g_current_function != FUNCTION_POWER_SAVE && g_current_function != FUNCTION_TRANSMIT)
APP_update_rssi(g_eeprom.rx_vfo);
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (!g_ptt_is_pressed && g_fm_resume_count_down_500ms > 0)
{
if (--g_fm_resume_count_down_500ms == 0)
@ -2479,7 +2479,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
g_keypad_locked = 4; // 2 second pop-up
g_update_display = true;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (!g_fm_radio_mode) // don't beep when the FM radio is on, it cause bad gaps and loud clicks
#endif
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
@ -2672,7 +2672,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
MAIN_process_key(Key, key_pressed, key_held);
break;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
case DISPLAY_FM:
FM_process_key(Key, key_pressed, key_held);
break;
@ -2708,7 +2708,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
}
else
{
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (!g_fm_radio_mode)
#endif
if (!key_held && key_pressed)
@ -2750,7 +2750,7 @@ Skip:
g_update_status = true;
}
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_request_save_fm)
{
if (!key_held)

View File

@ -17,7 +17,7 @@
#include <string.h>
#include <stdio.h> // NULL
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "app/search.h"
@ -248,7 +248,7 @@ void DTMF_HandleRequest(void)
g_dtmf_reply_state = DTMF_REPLY_AB;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode)
{
FM_TurnOff();

View File

@ -17,7 +17,7 @@
#include <string.h>
#include "app/app.h"
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "app/generic.h"
@ -40,7 +40,7 @@ void GENERIC_Key_F(bool key_pressed, bool key_held)
if (g_input_box_index > 0)
{
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (!g_fm_radio_mode)
#endif
if (!key_held && key_pressed)
@ -74,7 +74,7 @@ void GENERIC_Key_F(bool key_pressed, bool key_held)
if (key_pressed)
{
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (!g_fm_radio_mode)
#endif
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
@ -171,7 +171,7 @@ void GENERIC_Key_PTT(bool key_pressed)
goto cancel_tx;
}
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_scan_state != FM_SCAN_OFF)
{ // FM radio is scanning .. stop
FM_PlayAndUpdate();
@ -181,9 +181,7 @@ void GENERIC_Key_PTT(bool key_pressed)
g_request_display_screen = DISPLAY_FM;
goto cancel_tx;
}
#endif
#ifdef ENABLE_FMRADIO
if (g_screen_to_display == DISPLAY_FM)
goto start_tx; // listening to the FM radio .. start TX'ing
#endif

View File

@ -18,7 +18,7 @@
#include "app/action.h"
#include "app/app.h"
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "app/generic.h"
@ -186,7 +186,7 @@ void processFKeyFunction(const key_code_t Key)
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
APP_stop_scan();
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
ACTION_FM();
#else
@ -626,7 +626,7 @@ void MAIN_Key_EXIT(bool key_pressed, bool key_held)
return;
}
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (!g_fm_radio_mode)
#endif
{
@ -656,7 +656,7 @@ void MAIN_Key_EXIT(bool key_pressed, bool key_held)
return;
}
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
ACTION_FM();
#endif
@ -996,7 +996,7 @@ void MAIN_process_key(key_code_t key, bool key_pressed, bool key_held)
// UART_printf(" main 1 key %2u %u %u %u\r\n", key, key_pressed, key_held);
#endif
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode && key != KEY_PTT && key != KEY_EXIT)
{
if (!key_held && key_pressed)

View File

@ -21,7 +21,7 @@
#if !defined(ENABLE_OVERLAY)
#include "ARMCM0.h"
#endif
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "app/uart.h"