0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 06:11:24 +03:00

FM radio tidy up

This commit is contained in:
OneOfEleven 2023-10-11 18:32:10 +01:00
parent d676c77e85
commit 8c21a0e543
8 changed files with 72 additions and 63 deletions

View File

@ -2272,8 +2272,10 @@ static void APP_ProcessKey(const key_code_t Key, const bool key_pressed, const b
backlight_turn_on();
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
// AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
#ifdef ENABLE_FMRADIO
if (!g_fm_radio_mode)
#endif
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
// keypad is locked, tell the user
g_keypad_locked = 4; // 2 second pop-up
@ -2533,8 +2535,13 @@ static void APP_ProcessKey(const key_code_t Key, const bool key_pressed, const b
ACTION_Handle(Key, key_pressed, key_held);
}
else
if (!key_held && key_pressed)
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
{
#ifdef ENABLE_FMRADIO
if (!g_fm_radio_mode)
#endif
if (!key_held && key_pressed)
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
}
}
Skip:

View File

@ -192,8 +192,6 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
//if (Deviation > -281 && Deviation < 280)
if (Deviation < 280 || Deviation > 3815)
{
// not BLE(less than or equal)
if (Frequency > LowerLimit && (Frequency - BK1080_BaseFrequency) == 1)
{
if (BK1080_FrequencyDeviation & 0x800)
@ -203,8 +201,6 @@ int FM_CheckFrequencyLock(uint16_t Frequency, uint16_t LowerLimit)
goto Bail;
}
// not BLT(less than)
if (Frequency >= LowerLimit && (BK1080_BaseFrequency - Frequency) == 1)
{
if ((BK1080_FrequencyDeviation & 0x800) == 0)
@ -285,9 +281,11 @@ static void FM_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
uint32_t Frequency;
g_input_box_index = 0;
NUMBER_Get(g_input_box, &Frequency);
Frequency /= 10000;
if (Frequency < g_eeprom.fm_lower_limit || g_eeprom.fm_upper_limit < Frequency)
{
g_request_display_screen = DISPLAY_FM;

View File

@ -40,8 +40,11 @@ void GENERIC_Key_F(bool key_pressed, bool key_held)
if (g_input_box_index > 0)
{
if (!key_held && key_pressed)
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
#ifdef ENABLE_FMRADIO
if (!g_fm_radio_mode)
#endif
if (!key_held && key_pressed)
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return;
}
@ -69,7 +72,10 @@ void GENERIC_Key_F(bool key_pressed, bool key_held)
if (key_pressed)
{
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
#ifdef ENABLE_FMRADIO
if (!g_fm_radio_mode)
#endif
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
return;
}

View File

@ -65,21 +65,17 @@ void toggle_chan_scanlist(void)
g_flag_reset_vfos = true;
}
static void processFKeyFunction(const key_code_t Key, const bool beep)
static void processFKeyFunction(const key_code_t Key)
{
uint8_t Band;
uint8_t Vfo = g_eeprom.tx_vfo;
if (g_screen_to_display == DISPLAY_MENU)
{
// if (beep)
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
return;
}
// if (beep)
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
switch (Key)
{
case KEY_0:
@ -116,14 +112,12 @@ static void processFKeyFunction(const key_code_t Key, const bool beep)
g_eeprom.screen_channel[Vfo] = FREQ_CHANNEL_FIRST + Band;
g_eeprom.freq_channel[Vfo] = FREQ_CHANNEL_FIRST + Band;
g_request_save_vfo = true;
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
g_request_save_vfo = true;
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
g_request_display_screen = DISPLAY_MAIN;
if (beep)
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
g_request_display_screen = DISPLAY_MAIN;
break;
case KEY_2:
@ -141,14 +135,12 @@ static void processFKeyFunction(const key_code_t Key, const bool beep)
else
g_eeprom.tx_vfo = (Vfo + 1) & 1u;
g_request_save_settings = 1;
g_flag_reconfigure_vfos = true;
g_request_save_settings = 1;
g_flag_reconfigure_vfos = true;
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
g_request_display_screen = DISPLAY_MAIN;
if (beep)
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
break;
case KEY_3:
@ -163,11 +155,15 @@ static void processFKeyFunction(const key_code_t Key, const bool beep)
if (IS_USER_CHANNEL(g_tx_vfo->channel_save))
{ // swap to frequency mode
g_eeprom.screen_channel[Vfo] = g_eeprom.freq_channel[g_eeprom.tx_vfo];
#ifdef ENABLE_VOICE
g_another_voice_id = VOICE_ID_FREQUENCY_MODE;
g_another_voice_id = VOICE_ID_FREQUENCY_MODE;
#endif
g_request_save_vfo = true;
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
g_request_save_vfo = true;
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
break;
}
@ -175,33 +171,34 @@ static void processFKeyFunction(const key_code_t Key, const bool beep)
if (Channel != 0xFF)
{ // swap to channel mode
g_eeprom.screen_channel[Vfo] = Channel;
#ifdef ENABLE_VOICE
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
AUDIO_SetDigitVoice(1, Channel + 1);
g_another_voice_id = (voice_id_t)0xFE;
#endif
g_request_save_vfo = true;
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
g_request_save_vfo = true;
g_vfo_configure_mode = VFO_CONFIGURE_RELOAD;
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
break;
}
}
if (beep)
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
break;
case KEY_4:
g_fkey_pressed = false;
g_flag_start_scan = true;
g_scan_single_frequency = false;
g_fkey_pressed = false;
g_flag_start_scan = true;
g_scan_single_frequency = false;
g_backup_cross_vfo_rx_tx = g_eeprom.cross_vfo_rx_tx;
g_eeprom.cross_vfo_rx_tx = CROSS_BAND_OFF;
g_update_status = true;
// if (beep)
// g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
g_update_status = true;
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
break;
case KEY_5:
@ -227,10 +224,12 @@ static void processFKeyFunction(const key_code_t Key, const bool beep)
#endif
#endif
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
break;
case KEY_6:
ACTION_Power();
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
break;
case KEY_7:
@ -239,11 +238,13 @@ static void processFKeyFunction(const key_code_t Key, const bool beep)
#else
toggle_chan_scanlist();
#endif
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
break;
case KEY_8:
g_tx_vfo->frequency_reverse = g_tx_vfo->frequency_reverse == false;
g_request_save_channel = 1;
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
break;
case KEY_9:
@ -261,16 +262,17 @@ static void processFKeyFunction(const key_code_t Key, const bool beep)
break;
}
if (beep)
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
break;
default:
g_update_status = true;
g_fkey_pressed = false;
g_update_status = true;
g_fkey_pressed = false;
if (beep)
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
#ifdef ENABLE_FMRADIO
if (!g_fm_radio_mode)
#endif
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
break;
}
}
@ -293,7 +295,7 @@ static void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
g_fkey_pressed = false;
g_update_status = true;
processFKeyFunction(Key, false);
processFKeyFunction(Key);
}
}
@ -469,7 +471,7 @@ static void MAIN_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
g_fkey_pressed = false;
g_update_status = true;
processFKeyFunction(Key, true);
processFKeyFunction(Key);
}
static void MAIN_Key_EXIT(bool key_pressed, bool key_held)

Binary file not shown.

Binary file not shown.

View File

@ -14,8 +14,6 @@
* limitations under the License.
*/
#ifdef ENABLE_FMRADIO
#include <string.h>
#include "app/fm.h"
@ -55,12 +53,12 @@ void UI_DisplayFM(void)
if (g_ask_to_save)
{
strcpy(String, "SAVE?");
strcpy(String, "SAVE ?");
}
else
if (g_ask_to_delete)
{
strcpy(String, "DEL?");
strcpy(String, "DEL ?");
}
else
{
@ -74,7 +72,7 @@ void UI_DisplayFM(void)
{
if (g_eeprom.fm_frequency_playing == g_fm_channels[i])
{
sprintf(String, "VFO(CH%02u)", i + 1);
sprintf(String, "VFO (CH %u)", i + 1);
break;
}
}
@ -83,13 +81,13 @@ void UI_DisplayFM(void)
strcpy(String, "VFO");
}
else
sprintf(String, "MR(CH%02u)", g_eeprom.fm_selected_channel + 1);
sprintf(String, "CH %2u", g_eeprom.fm_selected_channel + 1);
}
else
if (!g_fm_auto_scan)
strcpy(String, "M-SCAN");
else
sprintf(String, "A-SCAN(%u)", g_fm_channel_position + 1);
sprintf(String, "A-SCAN %u", g_fm_channel_position + 1);
}
UI_PrintString(String, 0, 127, 2, 10);
@ -117,7 +115,7 @@ void UI_DisplayFM(void)
}
else
{
sprintf(String, "CH-%02u", g_eeprom.fm_selected_channel + 1);
sprintf(String, "CH %2u", g_eeprom.fm_selected_channel + 1);
UI_PrintString(String, 0, 127, 4, 10);
}
@ -125,5 +123,3 @@ void UI_DisplayFM(void)
ST7565_BlitFullScreen();
}
#endif

View File

@ -4,7 +4,7 @@
#ifdef GIT_HASH
#define VER GIT_HASH
#else
#define VER "231009"
#define VER "231012"
#endif
#ifndef ONE_OF_ELEVEN_VER